Be sure to use the correct type, so bits do not get wrapped
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist package (which contains metaconfig) is available via SVN:
17 #     svn co https://svn.sourceforge.net/svnroot/dist/trunk/dist
18 #
19 #
20 # Though this script was generated by metaconfig, it is OK to send
21 # patches against it. It's up to the Configure pumpkin to backport
22 # the patch to the metaunits if it is accepted.
23 # See Porting/pumpkin.pod for more information on metaconfig.
24 #
25
26 # $Id: Head.U 6 2006-08-25 22:21:46Z rmanfredi $
27 #
28 # Generated on Tue Jul  8 13:24:59 CEST 2008 [metaconfig 3.5 PL0]
29 # (with additional metaconfig patches by perlbug@perl.org)
30
31 cat >c1$$ <<EOF
32 ARGGGHHHH!!!!!
33
34 SCO csh still thinks true is false.  Write to SCO today and tell them that next
35 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
36
37 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
38 we'd have to do is go in and swap the && and || tokens, wherever they are.)
39
40 [End of diatribe. We now return you to your regularly scheduled programming...]
41 EOF
42 cat >c2$$ <<EOF
43
44 OOPS!  You naughty creature!  You didn't run Configure with sh!
45 I will attempt to remedy the situation by running sh for you...
46 EOF
47
48 true || cat c1$$ c2$$
49 true || exec sh $0 $argv:q
50
51 (exit $?0) || cat c2$$
52 (exit $?0) || exec sh $0 $argv:q
53 rm -f c1$$ c2$$
54
55 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
56         cat >&4 <<EOF
57 ***
58 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
59 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
60 *** Please read the README.plan9 for further instructions.
61 *** Cannot continue, aborting.
62 ***
63 EOF
64         exit 1
65 fi
66
67 if test ! -c /dev/null ; then
68         cat >&4 <<EOF
69 ***
70 *** I'm sorry, but /dev/null appears to be a file rather than a device.
71 *** Please consult your operating sytem's notes for making a device
72 *** in /dev.
73 *** Cannot continue, aborting.
74 ***
75 EOF
76         exit 1
77 fi
78
79 : compute my invocation name
80 me=$0
81 case "$0" in
82 */*)
83         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
84         test "$me" || me=$0
85         ;;
86 esac
87
88 : Proper separator for the PATH environment variable
89 p_=:
90 : On OS/2 this directory should exist if this is not floppy only system ":-]"
91 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
92         if test -n "$OS2_SHELL"; then
93                 p_=\;
94                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
95                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
96                 is_os2=yes
97         elif test -n "$DJGPP"; then
98                 case "X${MACHTYPE:-nonesuchmach}" in
99                 *cygwin) ;;
100                 *) p_=\; ;;
101                 esac
102         fi
103 fi
104
105 : Proper PATH setting
106 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
107 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
108 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
109 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
110 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
111 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
112 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
113 paths="$paths /sbin /usr/sbin /usr/libexec"
114 paths="$paths /system/gnu_library/bin"
115
116 for p in $paths
117 do
118         case "$p_$PATH$p_" in
119         *$p_$p$p_*) ;;
120         *) test -d $p && PATH=$PATH$p_$p ;;
121         esac
122 done
123
124 PATH=.$p_$PATH
125 export PATH
126
127 : shall we be using ksh?
128 inksh=''
129 needksh=''
130 avoidksh=''
131 newsh=/bin/ksh
132 changesh=''
133 if (PATH=.; alias -x) >/dev/null 2>&1; then
134                 inksh=true
135 fi
136 if test -f /hp-ux -a -f /bin/ksh; then
137         needksh='to avoid sh bug in "here document" expansion'
138 fi
139 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
140         if test X`/usr/bin/uname -v` = X4; then
141                 avoidksh="to avoid AIX 4's /bin/sh"
142                 newsh=/usr/bin/bsh
143         fi
144 fi
145 if test -f /osf_boot -a -f /usr/sbin/setld; then
146         if test X`/usr/bin/uname -s` = XOSF1; then
147                 avoidksh="to avoid Digital UNIX' ksh"
148                 newsh=/bin/sh
149                 unset BIN_SH
150         fi
151 fi
152 case "$inksh/$needksh" in
153 /[a-z]*)
154                 ENV=''
155                 changesh=true
156                 reason="$needksh"
157         ;;
158 esac
159 case "$inksh/$avoidksh" in
160 true/[a-z]*)
161         changesh=true
162         reason="$avoidksh"
163         ;;
164 esac
165 case "$inksh/$needksh-$avoidksh-" in
166 true/--)
167                 cat <<EOM
168 (I see you are using the Korn shell.  Some ksh's blow up on $me,
169 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
170 EOM
171         ;;
172 esac
173 case "$changesh" in
174 true)
175         export newsh
176         echo "(Feeding myself to $newsh $reason.)"
177         case "$0" in
178         Configure|*/Configure) exec $newsh $0 "$@";;
179         *) exec $newsh Configure "$@";;
180         esac
181         ;;
182 esac
183 test -x "${newsh}" || unset newsh
184
185 : if needed, set CDPATH to a harmless value that is not chatty
186 : avoid bash 2.02 problems with empty CDPATH.
187 case "$CDPATH" in
188 '')     ;;
189 *)      case "$SHELL" in
190         *bash*) CDPATH='.' ;;
191         *) CDPATH='' ;;
192         esac
193         ;;
194 esac
195
196 : Configure runs within the UU subdirectory
197 test -d UU || mkdir UU
198 cd UU && rm -f ./*
199
200 ccname=''
201 ccversion=''
202 ccsymbols=''
203 cppccsymbols=''
204 cppsymbols=''
205 from=''
206 run=''
207 targetarch=''
208 to=''
209 usecrosscompile=''
210 mistrustnm=''
211 perllibs=''
212 dynamic_ext=''
213 extensions=''
214 known_extensions=''
215 nonxs_ext=''
216 static_ext=''
217 useopcode=''
218 useposix=''
219 extras=''
220 d_bsd=''
221 d_eunice=''
222 d_xenix=''
223 eunicefix=''
224 ar=''
225 awk=''
226 bash=''
227 bison=''
228 byacc=''
229 cat=''
230 chgrp=''
231 chmod=''
232 chown=''
233 comm=''
234 compress=''
235 cp=''
236 cpio=''
237 cpp=''
238 csh=''
239 date=''
240 echo=''
241 egrep=''
242 emacs=''
243 expr=''
244 find=''
245 flex=''
246 gmake=''
247 grep=''
248 gzip=''
249 inews=''
250 ksh=''
251 less=''
252 line=''
253 lint=''
254 ln=''
255 lp=''
256 lpr=''
257 ls=''
258 mail=''
259 mailx=''
260 make=''
261 mkdir=''
262 more=''
263 mv=''
264 nm=''
265 nroff=''
266 perl=''
267 pg=''
268 pmake=''
269 pr=''
270 rm=''
271 rmail=''
272 sed=''
273 sendmail=''
274 shar=''
275 sleep=''
276 smail=''
277 sort=''
278 submit=''
279 tail=''
280 tar=''
281 tbl=''
282 tee=''
283 test=''
284 touch=''
285 tr=''
286 troff=''
287 uname=''
288 uniq=''
289 uuname=''
290 vi=''
291 zcat=''
292 zip=''
293 full_ar=''
294 full_sed=''
295 libswanted=''
296 hint=''
297 myuname=''
298 osname=''
299 osvers=''
300 Author=''
301 Date=''
302 Header=''
303 Id=''
304 Locker=''
305 Log=''
306 RCSfile=''
307 Revision=''
308 Source=''
309 State=''
310 _a=''
311 _exe=''
312 _o=''
313 archobjs=''
314 exe_ext=''
315 firstmakefile=''
316 lib_ext=''
317 obj_ext=''
318 path_sep=''
319 rm_try=''
320 afs=''
321 afsroot=''
322 alignbytes=''
323 ansi2knr=''
324 archlib=''
325 archlibexp=''
326 d_archlib=''
327 installarchlib=''
328 archname=''
329 myarchname=''
330 d_atolf=''
331 d_atoll=''
332 baserev=''
333 bin=''
334 binexp=''
335 initialinstalllocation=''
336 installbin=''
337 userelocatableinc=''
338 byteorder=''
339 cc=''
340 ccflags=''
341 cppflags=''
342 ldflags=''
343 lkflags=''
344 locincpth=''
345 optimize=''
346 cf_email=''
347 cf_by=''
348 cf_time=''
349 contains=''
350 cpp_stuff=''
351 cpplast=''
352 cppminus=''
353 cpprun=''
354 cppstdin=''
355 d__fwalk=''
356 d_access=''
357 d_accessx=''
358 d_aintl=''
359 d_alarm=''
360 asctime_r_proto=''
361 d_asctime_r=''
362 d_attribute_format=''
363 d_attribute_malloc=''
364 d_attribute_nonnull=''
365 d_attribute_noreturn=''
366 d_attribute_pure=''
367 d_attribute_unused=''
368 d_attribute_warn_unused_result=''
369 d_printf_format_null=''
370 d_bcmp=''
371 d_bcopy=''
372 d_builtin_choose_expr=''
373 d_builtin_expect=''
374 d_bzero=''
375 d_c99_variadic_macros=''
376 d_casti32=''
377 castflags=''
378 d_castneg=''
379 d_chown=''
380 d_chroot=''
381 d_chsize=''
382 d_class=''
383 d_clearenv=''
384 d_closedir=''
385 d_void_closedir=''
386 d_cmsghdr_s=''
387 d_const=''
388 d_copysignl=''
389 d_cplusplus=''
390 cryptlib=''
391 d_crypt=''
392 crypt_r_proto=''
393 d_crypt_r=''
394 d_csh=''
395 full_csh=''
396 d_ctermid=''
397 ctermid_r_proto=''
398 d_ctermid_r=''
399 ctime_r_proto=''
400 d_ctime_r=''
401 d_cuserid=''
402 d_dbl_dig=''
403 d_dbminitproto=''
404 d_difftime=''
405 d_dir_dd_fd=''
406 d_dirfd=''
407 d_dlerror=''
408 d_dlopen=''
409 d_dlsymun=''
410 d_dosuid=''
411 d_suidsafe=''
412 d_drand48_r=''
413 drand48_r_proto=''
414 d_drand48proto=''
415 d_dup2=''
416 d_eaccess=''
417 d_endgrent=''
418 d_endgrent_r=''
419 endgrent_r_proto=''
420 d_endhent=''
421 d_endhostent_r=''
422 endhostent_r_proto=''
423 d_endnent=''
424 d_endnetent_r=''
425 endnetent_r_proto=''
426 d_endpent=''
427 d_endprotoent_r=''
428 endprotoent_r_proto=''
429 d_endpwent=''
430 d_endpwent_r=''
431 endpwent_r_proto=''
432 d_endsent=''
433 d_endservent_r=''
434 endservent_r_proto=''
435 d_faststdio=''
436 d_fchdir=''
437 d_fchmod=''
438 d_fchown=''
439 d_fcntl=''
440 d_fcntl_can_lock=''
441 d_fd_macros=''
442 d_fd_set=''
443 d_fds_bits=''
444 d_fgetpos=''
445 d_finite=''
446 d_finitel=''
447 d_flexfnam=''
448 d_flock=''
449 d_flockproto=''
450 d_fork=''
451 d_fp_class=''
452 d_fpclass=''
453 d_fpclassify=''
454 d_fpclassl=''
455 d_fpos64_t=''
456 d_frexpl=''
457 d_fs_data_s=''
458 d_fseeko=''
459 d_fsetpos=''
460 d_fstatfs=''
461 d_fsync=''
462 d_ftello=''
463 d_ftime=''
464 d_gettimeod=''
465 d_futimes=''
466 d_Gconvert=''
467 d_getcwd=''
468 d_getespwnam=''
469 d_getfsstat=''
470 d_getgrent=''
471 d_getgrent_r=''
472 getgrent_r_proto=''
473 d_getgrgid_r=''
474 getgrgid_r_proto=''
475 d_getgrnam_r=''
476 getgrnam_r_proto=''
477 d_getgrps=''
478 d_gethbyaddr=''
479 d_gethbyname=''
480 d_gethent=''
481 aphostname=''
482 d_gethname=''
483 d_phostname=''
484 d_uname=''
485 d_gethostbyaddr_r=''
486 gethostbyaddr_r_proto=''
487 d_gethostbyname_r=''
488 gethostbyname_r_proto=''
489 d_gethostent_r=''
490 gethostent_r_proto=''
491 d_gethostprotos=''
492 d_getitimer=''
493 d_getlogin=''
494 d_getlogin_r=''
495 getlogin_r_proto=''
496 d_getmnt=''
497 d_getmntent=''
498 d_getnbyaddr=''
499 d_getnbyname=''
500 d_getnent=''
501 d_getnetbyaddr_r=''
502 getnetbyaddr_r_proto=''
503 d_getnetbyname_r=''
504 getnetbyname_r_proto=''
505 d_getnetent_r=''
506 getnetent_r_proto=''
507 d_getnetprotos=''
508 d_getpagsz=''
509 d_getpent=''
510 d_getpgid=''
511 d_getpgrp2=''
512 d_bsdgetpgrp=''
513 d_getpgrp=''
514 d_getppid=''
515 d_getprior=''
516 d_getpbyname=''
517 d_getpbynumber=''
518 d_getprotobyname_r=''
519 getprotobyname_r_proto=''
520 d_getprotobynumber_r=''
521 getprotobynumber_r_proto=''
522 d_getprotoent_r=''
523 getprotoent_r_proto=''
524 d_getprotoprotos=''
525 d_getprpwnam=''
526 d_getpwent=''
527 d_getpwent_r=''
528 getpwent_r_proto=''
529 d_getpwnam_r=''
530 getpwnam_r_proto=''
531 d_getpwuid_r=''
532 getpwuid_r_proto=''
533 d_getsent=''
534 d_getservbyname_r=''
535 getservbyname_r_proto=''
536 d_getservbyport_r=''
537 getservbyport_r_proto=''
538 d_getservent_r=''
539 getservent_r_proto=''
540 d_getservprotos=''
541 d_getspnam=''
542 d_getspnam_r=''
543 getspnam_r_proto=''
544 d_getsbyname=''
545 d_getsbyport=''
546 d_gmtime_r=''
547 gmtime_r_proto=''
548 d_gnulibc=''
549 gnulibc_version=''
550 d_hasmntopt=''
551 d_htonl=''
552 d_ilogbl=''
553 d_inetaton=''
554 d_int64_t=''
555 d_isascii=''
556 d_isfinite=''
557 d_isinf=''
558 d_isnan=''
559 d_isnanl=''
560 d_killpg=''
561 d_lchown=''
562 d_ldbl_dig=''
563 d_libm_lib_version=''
564 d_link=''
565 d_localtime_r=''
566 d_localtime_r_needs_tzset=''
567 localtime_r_proto=''
568 d_locconv=''
569 d_lockf=''
570 d_longdbl=''
571 longdblsize=''
572 d_longlong=''
573 longlongsize=''
574 d_lseekproto=''
575 d_lstat=''
576 d_madvise=''
577 d_malloc_good_size=''
578 d_malloc_size=''
579 d_mblen=''
580 d_mbstowcs=''
581 d_mbtowc=''
582 d_memchr=''
583 d_memcmp=''
584 d_memcpy=''
585 d_memmove=''
586 d_memset=''
587 d_mkdir=''
588 d_mkdtemp=''
589 d_mkfifo=''
590 d_mkstemp=''
591 d_mkstemps=''
592 d_mktime=''
593 d_mmap=''
594 mmaptype=''
595 d_modfl=''
596 d_modfl_pow32_bug=''
597 d_modflproto=''
598 d_mprotect=''
599 d_msg=''
600 d_msgctl=''
601 d_msgget=''
602 d_msghdr_s=''
603 d_msgrcv=''
604 d_msgsnd=''
605 d_msync=''
606 d_munmap=''
607 d_nice=''
608 d_nl_langinfo=''
609 d_off64_t=''
610 d_open3=''
611 d_fpathconf=''
612 d_pathconf=''
613 d_pause=''
614 d_pipe=''
615 d_poll=''
616 d_portable=''
617 d_procselfexe=''
618 procselfexe=''
619 d_old_pthread_create_joinable=''
620 old_pthread_create_joinable=''
621 d_pthread_atfork=''
622 d_pthread_attr_setscope=''
623 d_pthread_yield=''
624 d_sched_yield=''
625 sched_yield=''
626 d_qgcvt=''
627 d_random_r=''
628 random_r_proto=''
629 d_readdir64_r=''
630 readdir64_r_proto=''
631 d_readdir=''
632 d_rewinddir=''
633 d_seekdir=''
634 d_telldir=''
635 d_readdir_r=''
636 readdir_r_proto=''
637 d_readlink=''
638 d_readv=''
639 d_recvmsg=''
640 d_rename=''
641 d_rmdir=''
642 d_safebcpy=''
643 d_safemcpy=''
644 d_sanemcmp=''
645 d_sbrkproto=''
646 d_scalbnl=''
647 d_select=''
648 d_sem=''
649 d_semctl=''
650 d_semget=''
651 d_semop=''
652 d_sendmsg=''
653 d_setegid=''
654 d_seteuid=''
655 d_setgrent=''
656 d_setgrent_r=''
657 setgrent_r_proto=''
658 d_setgrps=''
659 d_sethent=''
660 d_sethostent_r=''
661 sethostent_r_proto=''
662 d_setitimer=''
663 d_setlinebuf=''
664 d_setlocale=''
665 d_setlocale_r=''
666 setlocale_r_proto=''
667 d_setnent=''
668 d_setnetent_r=''
669 setnetent_r_proto=''
670 d_setpent=''
671 d_setpgid=''
672 d_setpgrp2=''
673 d_bsdsetpgrp=''
674 d_setpgrp=''
675 d_setprior=''
676 d_setproctitle=''
677 d_setprotoent_r=''
678 setprotoent_r_proto=''
679 d_setpwent=''
680 d_setpwent_r=''
681 setpwent_r_proto=''
682 d_setregid=''
683 d_setresgid=''
684 d_setresuid=''
685 d_setreuid=''
686 d_setrgid=''
687 d_setruid=''
688 d_setsent=''
689 d_setservent_r=''
690 setservent_r_proto=''
691 d_setsid=''
692 d_setvbuf=''
693 d_sfio=''
694 usesfio=''
695 d_shm=''
696 d_shmat=''
697 d_shmatprototype=''
698 shmattype=''
699 d_shmctl=''
700 d_shmdt=''
701 d_shmget=''
702 d_sigaction=''
703 d_signbit=''
704 d_sigprocmask=''
705 d_sigsetjmp=''
706 usesitecustomize=''
707 d_snprintf=''
708 d_vsnprintf=''
709 d_sockatmark=''
710 d_sockatmarkproto=''
711 d_msg_ctrunc=''
712 d_msg_dontroute=''
713 d_msg_oob=''
714 d_msg_peek=''
715 d_msg_proxy=''
716 d_oldsock=''
717 d_scm_rights=''
718 d_socket=''
719 d_sockpair=''
720 sockethdr=''
721 socketlib=''
722 d_socklen_t=''
723 d_socks5_init=''
724 d_sprintf_returns_strlen=''
725 d_sqrtl=''
726 d_srand48_r=''
727 srand48_r_proto=''
728 d_srandom_r=''
729 srandom_r_proto=''
730 d_sresgproto=''
731 d_sresuproto=''
732 d_statblks=''
733 d_statfs_f_flags=''
734 d_statfs_s=''
735 d_fstatvfs=''
736 d_statvfs=''
737 d_stdio_cnt_lval=''
738 d_stdio_ptr_lval=''
739 d_stdio_ptr_lval_nochange_cnt=''
740 d_stdio_ptr_lval_sets_cnt=''
741 d_stdiobase=''
742 d_stdstdio=''
743 stdio_base=''
744 stdio_bufsiz=''
745 stdio_cnt=''
746 stdio_filbuf=''
747 stdio_ptr=''
748 d_index=''
749 d_strchr=''
750 d_strcoll=''
751 d_strctcpy=''
752 d_strerrm=''
753 d_strerror=''
754 d_sysernlst=''
755 d_syserrlst=''
756 d_strerror_r=''
757 strerror_r_proto=''
758 d_strftime=''
759 d_strlcat=''
760 d_strlcpy=''
761 d_strtod=''
762 d_strtol=''
763 d_strtold=''
764 d_strtoll=''
765 d_strtoq=''
766 d_strtoul=''
767 d_strtoull=''
768 d_strtouq=''
769 d_strxfrm=''
770 d_symlink=''
771 d_syscall=''
772 d_syscallproto=''
773 d_sysconf=''
774 d_system=''
775 d_tcgetpgrp=''
776 d_tcsetpgrp=''
777 d_telldirproto=''
778 d_time=''
779 timetype=''
780 d_timegm=''
781 clocktype=''
782 d_times=''
783 d_tmpnam_r=''
784 tmpnam_r_proto=''
785 d_truncate=''
786 d_ttyname_r=''
787 ttyname_r_proto=''
788 d_tzname=''
789 d_u32align=''
790 d_ualarm=''
791 d_umask=''
792 d_semctl_semid_ds=''
793 d_semctl_semun=''
794 d_union_semun=''
795 d_unordered=''
796 d_unsetenv=''
797 d_usleep=''
798 d_usleepproto=''
799 d_ustat=''
800 d_pseudofork=''
801 d_vfork=''
802 usevfork=''
803 d_voidsig=''
804 signal_t=''
805 d_volatile=''
806 d_charvspr=''
807 d_vprintf=''
808 d_wait4=''
809 d_waitpid=''
810 d_wcstombs=''
811 d_wctomb=''
812 d_writev=''
813 dlext=''
814 cccdlflags=''
815 ccdlflags=''
816 dlsrc=''
817 ld=''
818 lddlflags=''
819 usedl=''
820 doublesize=''
821 ebcdic=''
822 fflushNULL=''
823 fflushall=''
824 fpossize=''
825 fpostype=''
826 gccansipedantic=''
827 gccosandvers=''
828 gccversion=''
829 gidformat=''
830 gidsign=''
831 gidsize=''
832 gidtype=''
833 groupstype=''
834 h_fcntl=''
835 h_sysfile=''
836 html1dir=''
837 html1direxp=''
838 installhtml1dir=''
839 html3dir=''
840 html3direxp=''
841 installhtml3dir=''
842 i_arpainet=''
843 i_assert=''
844 i_crypt=''
845 db_hashtype=''
846 db_prefixtype=''
847 db_version_major=''
848 db_version_minor=''
849 db_version_patch=''
850 i_db=''
851 i_dbm=''
852 i_rpcsvcdbm=''
853 d_dirnamlen=''
854 direntrytype=''
855 i_dirent=''
856 i_dld=''
857 i_dlfcn=''
858 i_fcntl=''
859 i_float=''
860 i_fp=''
861 i_fp_class=''
862 i_gdbm=''
863 d_grpasswd=''
864 i_grp=''
865 i_ieeefp=''
866 i_inttypes=''
867 i_langinfo=''
868 i_libutil=''
869 i_limits=''
870 i_locale=''
871 i_machcthr=''
872 i_malloc=''
873 i_mallocmalloc=''
874 i_math=''
875 i_memory=''
876 i_mntent=''
877 d_ndbm=''
878 i_gdbm_ndbm=''
879 i_gdbmndbm=''
880 i_ndbm=''
881 i_netdb=''
882 i_neterrno=''
883 i_netinettcp=''
884 i_niin=''
885 i_sysin=''
886 i_poll=''
887 i_prot=''
888 i_pthread=''
889 d_pwage=''
890 d_pwchange=''
891 d_pwclass=''
892 d_pwcomment=''
893 d_pwexpire=''
894 d_pwgecos=''
895 d_pwpasswd=''
896 d_pwquota=''
897 i_pwd=''
898 i_sfio=''
899 i_shadow=''
900 i_socks=''
901 i_stddef=''
902 i_stdlib=''
903 i_string=''
904 strings=''
905 i_sunmath=''
906 i_sysaccess=''
907 i_sysdir=''
908 i_sysfile=''
909 d_voidtty=''
910 i_bsdioctl=''
911 i_sysfilio=''
912 i_sysioctl=''
913 i_syssockio=''
914 i_syslog=''
915 i_sysmman=''
916 i_sysmode=''
917 i_sysmount=''
918 i_sysndir=''
919 i_sysparam=''
920 i_syspoll=''
921 i_sysresrc=''
922 i_syssecrt=''
923 i_sysselct=''
924 i_sysstat=''
925 i_sysstatfs=''
926 i_sysstatvfs=''
927 i_systimes=''
928 i_systypes=''
929 i_sysuio=''
930 i_sysun=''
931 i_sysutsname=''
932 i_sysvfs=''
933 i_syswait=''
934 i_sgtty=''
935 i_termio=''
936 i_termios=''
937 d_tm_tm_gmtoff=''
938 d_tm_tm_zone=''
939 i_systime=''
940 i_systimek=''
941 i_time=''
942 timeincl=''
943 i_unistd=''
944 i_ustat=''
945 i_utime=''
946 i_values=''
947 i_stdarg=''
948 i_varargs=''
949 i_varhdr=''
950 i_vfork=''
951 d_inc_version_list=''
952 inc_version_list=''
953 inc_version_list_init=''
954 installprefix=''
955 installprefixexp=''
956 installstyle=''
957 installusrbinperl=''
958 intsize=''
959 longsize=''
960 shortsize=''
961 issymlink=''
962 libc=''
963 ldlibpthname=''
964 libperl=''
965 shrpenv=''
966 useshrplib=''
967 glibpth=''
968 libpth=''
969 loclibpth=''
970 plibpth=''
971 xlibpth=''
972 ignore_versioned_solibs=''
973 libs=''
974 libsdirs=''
975 libsfiles=''
976 libsfound=''
977 libspath=''
978 lns=''
979 d_PRIEUldbl=''
980 d_PRIFUldbl=''
981 d_PRIGUldbl=''
982 d_PRIeldbl=''
983 d_PRIfldbl=''
984 d_PRIgldbl=''
985 d_SCNfldbl=''
986 sPRIEUldbl=''
987 sPRIFUldbl=''
988 sPRIGUldbl=''
989 sPRIeldbl=''
990 sPRIfldbl=''
991 sPRIgldbl=''
992 sSCNfldbl=''
993 lseeksize=''
994 lseektype=''
995 mad=''
996 madlyh=''
997 madlyobj=''
998 madlysrc=''
999 make_set_make=''
1000 d_mymalloc=''
1001 freetype=''
1002 mallocobj=''
1003 mallocsrc=''
1004 malloctype=''
1005 usemallocwrap=''
1006 usemymalloc=''
1007 installman1dir=''
1008 man1dir=''
1009 man1direxp=''
1010 man1ext=''
1011 installman3dir=''
1012 man3dir=''
1013 man3direxp=''
1014 man3ext=''
1015 modetype=''
1016 multiarch=''
1017 mydomain=''
1018 myhostname=''
1019 phostname=''
1020 c=''
1021 n=''
1022 d_eofnblk=''
1023 eagain=''
1024 o_nonblock=''
1025 rd_nodata=''
1026 need_va_copy=''
1027 netdb_hlen_type=''
1028 netdb_host_type=''
1029 netdb_name_type=''
1030 netdb_net_type=''
1031 groupcat=''
1032 hostcat=''
1033 passcat=''
1034 orderlib=''
1035 ranlib=''
1036 d_perl_otherlibdirs=''
1037 otherlibdirs=''
1038 package=''
1039 spackage=''
1040 pager=''
1041 api_revision=''
1042 api_subversion=''
1043 api_version=''
1044 api_versionstring=''
1045 patchlevel=''
1046 perl_patchlevel=''
1047 revision=''
1048 subversion=''
1049 version=''
1050 version_patchlevel_string=''
1051 perl5=''
1052 perladmin=''
1053 perlpath=''
1054 d_nv_preserves_uv=''
1055 d_nv_zero_is_allbits_zero=''
1056 i16size=''
1057 i16type=''
1058 i32size=''
1059 i32type=''
1060 i64size=''
1061 i64type=''
1062 i8size=''
1063 i8type=''
1064 ivsize=''
1065 ivtype=''
1066 nv_overflows_integers_at=''
1067 nv_preserves_uv_bits=''
1068 nvsize=''
1069 nvtype=''
1070 u16size=''
1071 u16type=''
1072 u32size=''
1073 u32type=''
1074 u64size=''
1075 u64type=''
1076 u8size=''
1077 u8type=''
1078 uvsize=''
1079 uvtype=''
1080 ivdformat=''
1081 nvEUformat=''
1082 nvFUformat=''
1083 nvGUformat=''
1084 nveformat=''
1085 nvfformat=''
1086 nvgformat=''
1087 uvXUformat=''
1088 uvoformat=''
1089 uvuformat=''
1090 uvxformat=''
1091 pidtype=''
1092 prefix=''
1093 prefixexp=''
1094 installprivlib=''
1095 privlib=''
1096 privlibexp=''
1097 prototype=''
1098 ptrsize=''
1099 d_PRIXU64=''
1100 d_PRId64=''
1101 d_PRIi64=''
1102 d_PRIo64=''
1103 d_PRIu64=''
1104 d_PRIx64=''
1105 sPRIXU64=''
1106 sPRId64=''
1107 sPRIi64=''
1108 sPRIo64=''
1109 sPRIu64=''
1110 sPRIx64=''
1111 d_quad=''
1112 quadkind=''
1113 quadtype=''
1114 uquadtype=''
1115 drand01=''
1116 randbits=''
1117 randfunc=''
1118 randseedtype=''
1119 seedfunc=''
1120 installscript=''
1121 scriptdir=''
1122 scriptdirexp=''
1123 selectminbits=''
1124 selecttype=''
1125 sh=''
1126 sig_count=''
1127 sig_name=''
1128 sig_name_init=''
1129 sig_num=''
1130 sig_num_init=''
1131 sig_size=''
1132 d_sitearch=''
1133 installsitearch=''
1134 sitearch=''
1135 sitearchexp=''
1136 installsitebin=''
1137 sitebin=''
1138 sitebinexp=''
1139 installsitehtml1dir=''
1140 sitehtml1dir=''
1141 sitehtml1direxp=''
1142 installsitehtml3dir=''
1143 sitehtml3dir=''
1144 sitehtml3direxp=''
1145 installsitelib=''
1146 sitelib=''
1147 sitelib_stem=''
1148 sitelibexp=''
1149 installsiteman1dir=''
1150 siteman1dir=''
1151 siteman1direxp=''
1152 installsiteman3dir=''
1153 siteman3dir=''
1154 siteman3direxp=''
1155 siteprefix=''
1156 siteprefixexp=''
1157 installsitescript=''
1158 sitescript=''
1159 sitescriptexp=''
1160 sizesize=''
1161 sizetype=''
1162 so=''
1163 socksizetype=''
1164 sharpbang=''
1165 shsharp=''
1166 spitshell=''
1167 src=''
1168 ssizetype=''
1169 startperl=''
1170 startsh=''
1171 stdchar=''
1172 d_stdio_stream_array=''
1173 stdio_stream_array=''
1174 sysman=''
1175 sGMTIME_max=''
1176 sGMTIME_min=''
1177 trnl=''
1178 uidformat=''
1179 uidsign=''
1180 uidsize=''
1181 uidtype=''
1182 archname64=''
1183 use64bitall=''
1184 use64bitint=''
1185 dtrace=''
1186 usedtrace=''
1187 usefaststdio=''
1188 ccflags_uselargefiles=''
1189 ldflags_uselargefiles=''
1190 libswanted_uselargefiles=''
1191 uselargefiles=''
1192 uselongdouble=''
1193 usemorebits=''
1194 usemultiplicity=''
1195 nm_opt=''
1196 nm_so_opt=''
1197 runnm=''
1198 usenm=''
1199 useperlio=''
1200 usesocks=''
1201 d_oldpthreads=''
1202 use5005threads=''
1203 useithreads=''
1204 usereentrant=''
1205 usethreads=''
1206 incpath=''
1207 mips_type=''
1208 usrinc=''
1209 d_vendorarch=''
1210 installvendorarch=''
1211 vendorarch=''
1212 vendorarchexp=''
1213 d_vendorbin=''
1214 installvendorbin=''
1215 vendorbin=''
1216 vendorbinexp=''
1217 installvendorhtml1dir=''
1218 vendorhtml1dir=''
1219 vendorhtml1direxp=''
1220 installvendorhtml3dir=''
1221 vendorhtml3dir=''
1222 vendorhtml3direxp=''
1223 d_vendorlib=''
1224 installvendorlib=''
1225 vendorlib=''
1226 vendorlib_stem=''
1227 vendorlibexp=''
1228 installvendorman1dir=''
1229 vendorman1dir=''
1230 vendorman1direxp=''
1231 installvendorman3dir=''
1232 vendorman3dir=''
1233 vendorman3direxp=''
1234 usevendorprefix=''
1235 vendorprefix=''
1236 vendorprefixexp=''
1237 d_vendorscript=''
1238 installvendorscript=''
1239 vendorscript=''
1240 vendorscriptexp=''
1241 versiononly=''
1242 defvoidused=''
1243 voidflags=''
1244 yacc=''
1245 yaccflags=''
1246 CONFIG=''
1247
1248 : Detect odd OSs
1249 define='define'
1250 undef='undef'
1251 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1252 rmlist=''
1253
1254 : We must find out about Eunice early
1255 eunicefix=':'
1256 if test -f /etc/unixtovms; then
1257         eunicefix=/etc/unixtovms
1258 fi
1259 if test -f /etc/unixtovms.exe; then
1260         eunicefix=/etc/unixtovms.exe
1261 fi
1262
1263 : Set executable suffix now -- needed before hints available
1264 if test -f "/libs/version.library"; then
1265 : Amiga OS
1266     _exe=""
1267 elif test -f "/system/gnu_library/bin/ar.pm"; then
1268 : Stratus VOS
1269     _exe=".pm"
1270 elif test -n "$DJGPP"; then
1271 : DOS DJGPP
1272     _exe=".exe"
1273 elif test -d c:/. -o -n "$is_os2" ; then
1274 : OS/2 or cygwin
1275     _exe=".exe"
1276 fi
1277
1278 groupstype=''
1279 i_whoami=''
1280 : Trailing extension.  Override this in a hint file, if needed.
1281 : Extra object files, if any, needed on this platform.
1282 archobjs=''
1283 archname=''
1284 libnames=''
1285 : change the next line if compiling for Xenix/286 on Xenix/386
1286 xlibpth='/usr/lib/386 /lib/386'
1287 : Possible local library directories to search.
1288 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1289 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1290
1291 : general looking path for locating libraries
1292 glibpth="/lib /usr/lib $xlibpth"
1293 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1294 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1295 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1296 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1297
1298 : Private path used by Configure to find libraries.  Its value
1299 : is prepended to libpth. This variable takes care of special
1300 : machines, like the mips.  Usually, it should be empty.
1301 plibpth=''
1302
1303 : default library list
1304 libswanted=''
1305 : some systems want to use only the non-versioned libso:s
1306 ignore_versioned_solibs=''
1307 : set usethreads on the Configure command line to enable threads.
1308 usereentrant='undef'
1309 : full support for void wanted by default
1310 defvoidused=15
1311
1312 : Possible local include directories to search.
1313 : Set locincpth to "" in a hint file to defeat local include searches.
1314 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1315 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1316 :
1317 : no include file wanted by default
1318 inclwanted=''
1319
1320 : Enable -DEBUGGING and -DDEBUGGING from the command line
1321 EBUGGING=''
1322 DEBUGGING=old
1323
1324 ccname=''
1325 ccversion=''
1326 perllibs=''
1327 : set useposix=false in your hint file to disable the POSIX extension.
1328 useposix=true
1329 : set useopcode=false in your hint file to disable the Opcode extension.
1330 useopcode=true
1331 archname64=''
1332 ccflags_uselargefiles=''
1333 ldflags_uselargefiles=''
1334 libswanted_uselargefiles=''
1335 : set usemultiplicity on the Configure command line to enable multiplicity.
1336 : set usesocks on the Configure command line to enable socks.
1337 : List of libraries we want.
1338 : If anyone needs extra -lxxx, put those in a hint file.
1339 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1340 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1341 : We probably want to search /usr/shlib before most other libraries.
1342 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1343 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1344 glibpth="/usr/shlib $glibpth"
1345 : Do not use vfork unless overridden by a hint file.
1346 usevfork=false
1347
1348 : Find the basic shell for Bourne shell scripts
1349 case "$sh" in
1350 '')
1351         case "$SYSTYPE" in
1352         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1353         *) xxx='/bin/sh';;
1354         esac
1355         if test -f "$xxx"; then
1356                 sh="$xxx"
1357         else
1358                 : Build up a list and do a single loop so we can 'break' out.
1359                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1360                 for xxx in sh bash ksh pdksh ash; do
1361                         for p in $pth; do
1362                                 try="$try ${p}/${xxx}"
1363                         done
1364                 done
1365                 for xxx in $try; do
1366                         if test -f "$xxx"; then
1367                                 sh="$xxx";
1368                                 break
1369                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1370                                 sh="$xxx";
1371                                 break
1372                         elif test -f "$xxx.exe"; then
1373                                 sh="$xxx";
1374                                 break
1375                         fi
1376                 done
1377         fi
1378         ;;
1379 esac
1380
1381 case "$sh" in
1382 '')     cat >&2 <<EOM
1383 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1384
1385 Usually it's in /bin/sh.  How did you even get this far?
1386 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1387 we'll try to straighten this all out.
1388 EOM
1389         exit 1
1390         ;;
1391 esac
1392
1393 : see if sh knows # comments
1394 if `$sh -c '#' >/dev/null 2>&1`; then
1395         shsharp=true
1396         spitshell=cat
1397         xcat=/bin/cat
1398         test -f $xcat$_exe || xcat=/usr/bin/cat
1399         if test ! -f $xcat$_exe; then
1400                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1401                         if test -f $p/cat$_exe; then
1402                                 xcat=$p/cat
1403                                 break
1404                         fi
1405                 done
1406                 if test ! -f $xcat$_exe; then
1407                         echo "Can't find cat anywhere!"
1408                         exit 1
1409                 fi
1410         fi
1411         echo "#!$xcat" >sharp
1412         $eunicefix sharp
1413         chmod +x sharp
1414         ./sharp > today 2>/dev/null
1415         if test -s today; then
1416                 sharpbang='#!'
1417         else
1418                 echo "#! $xcat" > sharp
1419                 $eunicefix sharp
1420                 chmod +x sharp
1421                 ./sharp > today 2>/dev/null
1422                 if test -s today; then
1423                         sharpbang='#! '
1424                 else
1425                         sharpbang=': use '
1426                 fi
1427         fi
1428 else
1429         echo " "
1430         echo "Your $sh doesn't grok # comments--I will strip them later on."
1431         shsharp=false
1432         cd ..
1433         echo "exec grep -v '^[  ]*#'" >spitshell
1434         chmod +x spitshell
1435         $eunicefix spitshell
1436         spitshell=`pwd`/spitshell
1437         cd UU
1438         echo "I presume that if # doesn't work, #! won't work either!"
1439         sharpbang=': use '
1440 fi
1441 rm -f sharp today
1442
1443 : figure out how to guarantee sh startup
1444 case "$startsh" in
1445 '') startsh=${sharpbang}${sh} ;;
1446 *)
1447 esac
1448 cat >sharp <<EOSS
1449 $startsh
1450 set abc
1451 test "$?abc" != 1
1452 EOSS
1453
1454 chmod +x sharp
1455 $eunicefix sharp
1456 if ./sharp; then
1457         : echo "Yup, it does."
1458 else
1459         echo "Hmm... '$startsh' does not guarantee sh startup..."
1460         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1461 fi
1462 rm -f sharp
1463
1464 : Save command line options in file UU/cmdline.opt for later use in
1465 : generating config.sh.
1466 cat > cmdline.opt <<EOSH
1467 : Configure command line arguments.
1468 config_arg0='$0'
1469 config_args='$*'
1470 config_argc=$#
1471 EOSH
1472 argn=1
1473 args_exp=''
1474 args_sep=''
1475 for arg in "$@"; do
1476         cat >>cmdline.opt <<EOSH
1477 config_arg$argn='$arg'
1478 EOSH
1479         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1480 $arg
1481 EOC
1482         arg_exp=`cat cmdl.opt`
1483         args_exp="$args_exp$args_sep'$arg_exp'"
1484         argn=`expr $argn + 1`
1485         args_sep=' '
1486 done
1487 rm -f cmdl.opt
1488
1489 : produce awk script to parse command line options
1490 cat >options.awk <<'EOF'
1491 BEGIN {
1492         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1493
1494         len = length(optstr);
1495         for (i = 1; i <= len; i++) {
1496                 c = substr(optstr, i, 1);
1497                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1498                 if (a == ":") {
1499                         arg[c] = 1;
1500                         i++;
1501                 }
1502                 opt[c] = 1;
1503         }
1504 }
1505 {
1506         expect = 0;
1507         str = $0;
1508         if (substr(str, 1, 1) != "-") {
1509                 printf("'%s'\n", str);
1510                 next;
1511         }
1512         len = length($0);
1513         for (i = 2; i <= len; i++) {
1514                 c = substr(str, i, 1);
1515                 if (!opt[c]) {
1516                         printf("-%s\n", substr(str, i));
1517                         next;
1518                 }
1519                 printf("-%s\n", c);
1520                 if (arg[c]) {
1521                         if (i < len)
1522                                 printf("'%s'\n", substr(str, i + 1));
1523                         else
1524                                 expect = 1;
1525                         next;
1526                 }
1527         }
1528 }
1529 END {
1530         if (expect)
1531                 print "?";
1532 }
1533 EOF
1534
1535 : process the command line options
1536 set X `for arg in "$@"; do echo "X$arg"; done |
1537         sed -e s/X// | awk -f options.awk`
1538 eval "set $*"
1539 shift
1540 rm -f options.awk
1541
1542 : set up default values
1543 fastread=''
1544 reuseval=false
1545 config_sh=''
1546 alldone=''
1547 error=''
1548 silent=''
1549 extractsh=''
1550 override=''
1551 knowitall=''
1552 rm -f optdef.sh posthint.sh
1553 cat >optdef.sh <<EOS
1554 $startsh
1555 EOS
1556
1557
1558 : option parsing
1559 while test $# -gt 0; do
1560         case "$1" in
1561         -d) shift; fastread=yes;;
1562         -e) shift; alldone=cont;;
1563         -f)
1564                 shift
1565                 cd ..
1566                 if test -r "$1"; then
1567                         config_sh="$1"
1568                 else
1569                         echo "$me: cannot read config file $1." >&2
1570                         error=true
1571                 fi
1572                 cd UU
1573                 shift;;
1574         --help|\
1575         -h) shift; error=true;;
1576         -r) shift; reuseval=true;;
1577         -s) shift; silent=true; realsilent=true;;
1578         -E) shift; alldone=exit;;
1579         -K) shift; knowitall=true;;
1580         -O) shift; override=true;;
1581         -S) shift; silent=true; extractsh=true;;
1582         -D)
1583                 shift
1584                 case "$1" in
1585                 *=)
1586                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1587                         echo "$me: ignoring -D $1" >&2
1588                         ;;
1589                 *=*) echo "$1" | \
1590                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1591                 *) echo "$1='define'" >> optdef.sh;;
1592                 esac
1593                 shift
1594                 ;;
1595         -U)
1596                 shift
1597                 case "$1" in
1598                 *=) echo "$1" >> optdef.sh;;
1599                 *=*)
1600                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1601                         echo "$me: ignoring -U $1" >&2
1602                         ;;
1603                 *) echo "$1='undef'" >> optdef.sh;;
1604                 esac
1605                 shift
1606                 ;;
1607         -A)
1608             shift
1609             xxx=''
1610             yyy="$1"
1611             zzz=''
1612             uuu=undef
1613             case "$yyy" in
1614             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1615                  case "$zzz" in
1616                  *:*) zzz='' ;;
1617                  *)   xxx=append
1618                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1619                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1620                  esac
1621                  ;;
1622             esac
1623             case "$xxx" in
1624             '')  case "$yyy" in
1625                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1626                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1627                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1628                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1629                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1630                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1631                  esac
1632                  ;;
1633             esac
1634             case "$xxx" in
1635             append)
1636                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1637             clear)
1638                 echo "$yyy=''"                  >> posthint.sh ;;
1639             define)
1640                 case "$zzz" in
1641                 '') zzz=define ;;
1642                 esac
1643                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1644             eval)
1645                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1646             prepend)
1647                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1648             undef)
1649                 case "$zzz" in
1650                 '') zzz="$uuu" ;;
1651                 esac
1652                 echo "$yyy=$zzz"                >> posthint.sh ;;
1653             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1654             esac
1655             shift
1656             ;;
1657         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1658             exit 0;;
1659         --) break;;
1660         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1661         *) break;;
1662         esac
1663 done
1664
1665 case "$error" in
1666 true)
1667         cat >&2 <<EOM
1668 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1669                  [-U symbol] [-U symbol=] [-A command:symbol...]
1670   -d : use defaults for all answers.
1671   -e : go on without questioning past the production of config.sh.
1672   -f : specify an alternate default configuration file.
1673   -h : print this help message and exit (with an error status).
1674   -r : reuse C symbols value if possible (skips costly nm extraction).
1675   -s : silent mode, only echoes questions and essential information.
1676   -D : define symbol to have some value:
1677          -D symbol         symbol gets the value 'define'
1678          -D symbol=value   symbol gets the value 'value'
1679        common used examples (see INSTALL for more info):
1680          -Duse64bitint            use 64bit integers
1681          -Duse64bitall            use 64bit integers and pointers
1682          -Dusethreads             use thread support
1683          -Dinc_version_list=none  do not include older perl trees in @INC
1684          -DEBUGGING=none          DEBUGGING options
1685          -Dcc=gcc                 choose your compiler
1686          -Dprefix=/opt/perl5      choose your destination
1687   -E : stop at the end of questions, after having produced config.sh.
1688   -K : do not use unless you know what you are doing.
1689   -O : let -D and -U override definitions from loaded configuration file.
1690   -S : perform variable substitutions on all .SH files (can mix with -f)
1691   -U : undefine symbol:
1692          -U symbol    symbol gets the value 'undef'
1693          -U symbol=   symbol gets completely empty
1694        e.g.:  -Uversiononly
1695   -A : manipulate symbol after the platform specific hints have been applied:
1696          -A append:symbol=value   append value to symbol
1697          -A symbol=value          like append:, but with a separating space
1698          -A define:symbol=value   define symbol to have value
1699          -A clear:symbol          define symbol to be ''
1700          -A define:symbol         define symbol to be 'define'
1701          -A eval:symbol=value     define symbol to be eval of value
1702          -A prepend:symbol=value  prepend value to symbol
1703          -A undef:symbol          define symbol to be 'undef'
1704          -A undef:symbol=         define symbol to be ''
1705        e.g.:  -A prepend:libswanted='cl pthread '
1706               -A ccflags=-DSOME_MACRO
1707   -V : print version number and exit (with a zero status).
1708 EOM
1709         exit 1
1710         ;;
1711 esac
1712
1713 : Sanity checks
1714 case "$fastread$alldone" in
1715 yescont|yesexit) ;;
1716 *)
1717         case "$extractsh" in
1718         true) ;;
1719         *)
1720                 if test ! -t 0; then
1721                         echo "Say 'sh Configure', not 'sh <Configure'"
1722                         exit 1
1723                 fi
1724                 ;;
1725         esac
1726         ;;
1727 esac
1728
1729 exec 4>&1
1730 case "$silent" in
1731 true) exec 1>/dev/null;;
1732 esac
1733
1734 : run the defines and the undefines, if any, but leave the file out there...
1735 touch optdef.sh
1736 . ./optdef.sh
1737 : create the posthint manipulation script and leave the file out there...
1738 touch posthint.sh
1739
1740 : set package name
1741 package='perl5'
1742 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1743 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1744 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1745 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1746 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1747 esac
1748
1749 : Some greps do not return status, grrr.
1750 echo "grimblepritz" >grimble
1751 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1752         contains=contains
1753 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1754         contains=grep
1755 else
1756         contains=contains
1757 fi
1758 rm -f grimble
1759 : the following should work in any shell
1760 case "$contains" in
1761 contains*)
1762         echo " "
1763         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1764         cat >contains <<'EOSS'
1765 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1766 EOSS
1767 chmod +x contains
1768 esac
1769
1770 : Find the path to the source tree
1771 case "$src" in
1772 '') case "$0" in
1773     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1774          case "$src" in
1775          /*)    ;;
1776          .)     ;;
1777          *)     src=`cd ../$src && pwd` ;;
1778          esac
1779          ;;
1780     *)   src='.';;
1781     esac;;
1782 esac
1783 case "$src" in
1784 '')     src=/
1785         rsrc=/
1786         ;;
1787 /*)     rsrc="$src";;
1788 *)      rsrc="../$src";;
1789 esac
1790 if test -f $rsrc/Configure && \
1791         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1792 then
1793    : found it, so we are ok.
1794 else
1795         rsrc=''
1796         for src in . .. ../.. ../../.. ../../../..; do
1797                 if test -f ../$src/Configure && \
1798                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1799                 then
1800                         rsrc=../$src
1801                         break
1802                 fi
1803         done
1804 fi
1805 case "$rsrc" in
1806 '')
1807         cat <<EOM >&4
1808
1809 Sorry, I can't seem to locate the source dir for $package.  Please start
1810 Configure with an explicit path -- i.e. /some/path/Configure.
1811
1812 EOM
1813         exit 1
1814         ;;
1815 ../.)   rsrc='..';;
1816 *)
1817         echo " "
1818         echo "Sources for $package found in \"$src\"." >&4
1819         ;;
1820 esac
1821
1822 : script used to extract .SH files with variable substitutions
1823 cat >extract <<'EOS'
1824 PERL_CONFIG_SH=true
1825 echo "Doing variable substitutions on .SH files..."
1826 if test -f MANIFEST; then
1827         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1828 else
1829         echo "(Looking for .SH files under the source directory.)"
1830         set x `(cd "$src"; find . -name "*.SH" -print)`
1831 fi
1832 shift
1833 case $# in
1834 0) set x `(cd "$src"; echo *.SH)`; shift;;
1835 esac
1836 if test ! -f "$src/$1"; then
1837         shift
1838 fi
1839 mkdir_p='
1840 name=$1;
1841 create="";
1842 while test $name; do
1843         if test ! -d "$name"; then
1844                 create="$name $create";
1845                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1846                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1847         else
1848                 name="";
1849         fi;
1850 done;
1851 for file in $create; do
1852         mkdir $file;
1853 done
1854 '
1855 for file in $*; do
1856         case "$src" in
1857         ".")
1858                 case "$file" in
1859                 */*)
1860                         dir=`expr X$file : 'X\(.*\)/'`
1861                         file=`expr X$file : 'X.*/\(.*\)'`
1862                         (cd "$dir" && . ./$file)
1863                         ;;
1864                 *)
1865                         . ./$file
1866                         ;;
1867                 esac
1868                 ;;
1869         *)
1870                 case "$file" in
1871                 */*)
1872                         dir=`expr X$file : 'X\(.*\)/'`
1873                         file=`expr X$file : 'X.*/\(.*\)'`
1874                         (set x $dir; shift; eval $mkdir_p)
1875                         sh <"$src/$dir/$file"
1876                         ;;
1877                 *)
1878                         sh <"$src/$file"
1879                         ;;
1880                 esac
1881                 ;;
1882         esac
1883 done
1884 if test -f "$src/config_h.SH"; then
1885         if test ! -f config.h; then
1886         : oops, they left it out of MANIFEST, probably, so do it anyway.
1887         . "$src/config_h.SH"
1888         fi
1889 fi
1890 EOS
1891
1892 : extract files and exit if asked to do so
1893 case "$extractsh" in
1894 true)
1895         case "$realsilent" in
1896         true) ;;
1897         *) exec 1>&4;;
1898         esac
1899         case "$config_sh" in
1900         '') config_sh='config.sh';;
1901         esac
1902         echo " "
1903         echo "Fetching answers from $config_sh..."
1904         cd ..
1905         . $config_sh
1906         test "$override" && . ./optdef.sh
1907         echo " "
1908         . UU/extract
1909         rm -rf UU
1910         echo "Extraction done."
1911         exit 0
1912         ;;
1913 esac
1914
1915 : Eunice requires " " instead of "", can you believe it
1916 echo " "
1917 : Here we go...
1918 echo "Beginning of configuration questions for $package."
1919
1920 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1921
1922 : first determine how to suppress newline on echo command
1923 echo " "
1924 echo "Checking echo to see how to suppress newlines..."
1925 (echo "hi there\c" ; echo " ") >.echotmp
1926 if $contains c .echotmp >/dev/null 2>&1 ; then
1927         echo "...using -n."
1928         n='-n'
1929         c=''
1930 else
1931         cat <<'EOM'
1932 ...using \c
1933 EOM
1934         n=''
1935         c='\c'
1936 fi
1937 echo $n "The star should be here-->$c"
1938 echo '*'
1939 rm -f .echotmp
1940
1941 : Now test for existence of everything in MANIFEST
1942 echo " "
1943 if test -f "$rsrc/MANIFEST"; then
1944         echo "First let's make sure your kit is complete.  Checking..." >&4
1945         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1946                 (split -l 50 2>/dev/null || split -50)
1947         rm -f missing
1948         tmppwd=`pwd`
1949         for filelist in x??; do
1950                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1951                         >/dev/null 2>>"$tmppwd/missing")
1952         done
1953         if test -s missing; then
1954                 cat missing >&4
1955                 cat >&4 <<'EOM'
1956
1957 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1958
1959 You have the option of continuing the configuration process, despite the
1960 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1961 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1962 and contact the author (perlbug@perl.org).
1963
1964 EOM
1965                 echo $n "Continue? [n] $c" >&4
1966                 read ans
1967                 case "$ans" in
1968                 y*)
1969                         echo "Continuing..." >&4
1970                         rm -f missing
1971                         ;;
1972                 *)
1973                         echo "ABORTING..." >&4
1974                         kill $$
1975                         ;;
1976                 esac
1977         else
1978                 echo "Looks good..."
1979         fi
1980 else
1981         echo "There is no MANIFEST file.  I hope your kit is complete !"
1982 fi
1983 rm -f missing x??
1984
1985 : Find the appropriate value for a newline for tr
1986 echo " "
1987 if test -n "$DJGPP"; then
1988        trnl='\012'
1989 fi
1990 if test X"$trnl" = X; then
1991         case "`echo foo|tr '\n' x 2>/dev/null`" in
1992         foox) trnl='\n' ;;
1993         esac
1994 fi
1995 if test X"$trnl" = X; then
1996         case "`echo foo|tr '\012' x 2>/dev/null`" in
1997         foox) trnl='\012' ;;
1998         esac
1999 fi
2000 if test X"$trnl" = X; then
2001        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2002        fooxy) trnl='\n\r' ;;
2003        esac
2004 fi
2005 if test X"$trnl" = X; then
2006         cat <<EOM >&2
2007
2008 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2009
2010 EOM
2011         exit 1
2012 fi
2013
2014 : compute the number of columns on the terminal for proper question formatting
2015 case "$COLUMNS" in
2016 '') COLUMNS='80';;
2017 esac
2018
2019 : set up the echo used in my read
2020 myecho="case \"\$xxxm\" in
2021 '') echo $n \"\$rp $c\" >&4;;
2022 *) case \"\$rp\" in
2023         '') echo $n \"[\$xxxm] $c\";;
2024         *)
2025                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2026                         echo \"\$rp\" >&4
2027                         echo $n \"[\$xxxm] $c\" >&4
2028                 else
2029                         echo $n \"\$rp [\$xxxm] $c\" >&4
2030                 fi
2031                 ;;
2032         esac;;
2033 esac"
2034
2035 : now set up to do reads with possible shell escape and default assignment
2036 cat <<EOSC >myread
2037 $startsh
2038 xxxm=\$dflt
2039 $myecho
2040 ans='!'
2041 case "\$fastread" in
2042 yes) case "\$dflt" in
2043         '') ;;
2044         *) ans='';
2045                 case "\$silent-\$rp" in
2046                 true-) ;;
2047                 *) echo " " >&4;;
2048                 esac;;
2049         esac;;
2050 *) case "\$silent" in
2051         true) case "\$rp" in
2052                 '') ans='';;
2053                 esac;;
2054         esac;;
2055 esac
2056 while expr "X\$ans" : "X!" >/dev/null; do
2057         read answ
2058         set x \$xxxm
2059         shift
2060         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2061         case  "\$answ" in
2062         "!")
2063                 sh 1>&4
2064                 echo " "
2065                 $myecho
2066                 ;;
2067         !*)
2068                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2069                 shift
2070                 sh 1>&4 -c "\$*"
2071                 echo " "
2072                 $myecho
2073                 ;;
2074         "\$ans")
2075                 case "\$ans" in
2076                 \\&*)
2077                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2078                         shift
2079                         case "\$1" in
2080                         -d)
2081                                 fastread=yes
2082                                 echo "(OK, I'll run with -d after this question.)" >&4
2083                                 ;;
2084                         -*)
2085                                 echo "*** Sorry, \$1 not supported yet." >&4
2086                                 ;;
2087                         esac
2088                         $myecho
2089                         ans=!
2090                         ;;
2091                 esac;;
2092         *)
2093                 case "\$aok" in
2094                 y)
2095                         echo "*** Substitution done -- please confirm."
2096                         xxxm="\$ans"
2097                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2098                         xxxm="\$ans"
2099                         ans=!
2100                         ;;
2101                 *)
2102                         echo "*** Error -- try again."
2103                         ans=!
2104                         ;;
2105                 esac
2106                 $myecho
2107                 ;;
2108         esac
2109         case "\$ans\$xxxm\$nostick" in
2110         '')
2111                 ans=!
2112                 $myecho
2113                 ;;
2114         esac
2115 done
2116 case "\$ans" in
2117 '') ans="\$xxxm";;
2118 esac
2119 EOSC
2120
2121 : create .config dir to save info across Configure sessions
2122 test -d ../.config || mkdir ../.config
2123 cat >../.config/README <<EOF
2124 This directory created by Configure to save information that should
2125 persist across sessions for $package.
2126
2127 You may safely delete it if you wish.
2128 EOF
2129
2130 : See if we are using a devel version and want that
2131 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2132 case "$usedevel" in
2133 $define|true|[yY]*) ;;
2134 *) case "$xversion" in
2135    *[13579])
2136         cat >&4 <<EOH
2137 *** WHOA THERE!!! ***
2138
2139     This is an UNSTABLE DEVELOPMENT release.
2140     The version of this $package distribution is $xversion, that is, odd,
2141     (as opposed to even) and that signifies a development release.
2142     If you want a maintenance release, you want an even-numbered version.
2143
2144     Do ***NOT*** install this into production use.
2145     Data corruption and crashes are possible.
2146
2147     It is most seriously suggested that you do not continue any further
2148     unless you want to help in developing and debugging Perl.
2149
2150     If you *still* want to build perl, you can answer 'y' now,
2151     or pass -Dusedevel to Configure.
2152
2153 EOH
2154         rp='Do you really want to continue?'
2155         dflt='n'
2156         . ./myread
2157         case "$ans" in
2158         [yY]) echo >&4 "Okay, continuing."
2159               usedevel="$define" ;;
2160         *) echo >&4 "Okay, bye."
2161            exit 1
2162            ;;
2163         esac
2164         ;;
2165     esac
2166     ;;
2167 esac
2168 case "$usedevel" in
2169 $define|true|[yY]*)
2170         case "$versiononly" in
2171         '') versiononly="$define" ;;
2172         esac
2173         case "$installusrbinperl" in
2174         '') installusrbinperl="$undef" ;;
2175         esac
2176         ;;
2177 esac
2178
2179 : general instructions
2180 needman=true
2181 firsttime=true
2182 user=`(logname) 2>/dev/null`
2183 case "$user" in
2184 '') user=`whoami 2>&1`;;
2185 esac
2186 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2187         firsttime=false
2188         echo " "
2189         rp='Would you like to see the instructions?'
2190         dflt=n
2191         . ./myread
2192         case "$ans" in
2193         [yY]*) ;;
2194         *) needman=false;;
2195         esac
2196 fi
2197 if $needman; then
2198         cat <<EOH
2199
2200 This installation shell script will examine your system and ask you questions
2201 to determine how the perl5 package should be installed. If you get
2202 stuck on a question, you may use a ! shell escape to start a subshell or
2203 execute a command.  Many of the questions will have default answers in square
2204 brackets; typing carriage return will give you the default.
2205
2206 On some of the questions which ask for file or directory names you are allowed
2207 to use the ~name construct to specify the login directory belonging to "name",
2208 even if you don't have a shell which knows about that.  Questions where this is
2209 allowed will be marked "(~name ok)".
2210
2211 EOH
2212         rp=''
2213         dflt='Type carriage return to continue'
2214         . ./myread
2215         cat <<'EOH'
2216
2217 The prompter used in this script allows you to use shell variables and
2218 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2219 in the default answer, as if the default line was a set of arguments given to a
2220 script shell.  This means you may also use $* to repeat the whole default line,
2221 so you do not have to re-type everything to add something to the default.
2222
2223 Everytime there is a substitution, you will have to confirm.  If there is an
2224 error (e.g. an unmatched backtick), the default answer will remain unchanged
2225 and you will be prompted again.
2226
2227 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2228 the questions and use the computed defaults (or the previous answers if there
2229 was already a config.sh file). Type 'Configure -h' for a list of options.
2230 You may also start interactively and then answer '& -d' at any prompt to turn
2231 on the non-interactive behaviour for the remainder of the execution.
2232
2233 EOH
2234         . ./myread
2235         cat <<EOH
2236
2237 Much effort has been expended to ensure that this shell script will run on any
2238 Unix system.  If despite that it blows up on yours, your best bet is to edit
2239 Configure and run it again.  If you can't run Configure for some reason,
2240 you'll have to generate a config.sh file by hand.  Whatever problems you
2241 have, let me (perlbug@perl.org) know how I blew it.
2242
2243 This installation script affects things in two ways:
2244
2245 1) it may do direct variable substitutions on some of the files included
2246    in this kit.
2247 2) it builds a config.h file for inclusion in C programs.  You may edit
2248    any of these files as the need arises after running this script.
2249
2250 If you make a mistake on a question, there is no easy way to back up to it
2251 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2252 files.  Configure will offer to let you do this before it runs the SH files.
2253
2254 EOH
2255         dflt='Type carriage return to continue'
2256         . ./myread
2257         case "$firsttime" in
2258         true) echo $user >>../.config/instruct;;
2259         esac
2260 fi
2261
2262 : find out where common programs are
2263 echo " "
2264 echo "Locating common programs..." >&4
2265 cat <<EOSC >loc
2266 $startsh
2267 case \$# in
2268 0) exit 1;;
2269 esac
2270 thing=\$1
2271 shift
2272 dflt=\$1
2273 shift
2274 for dir in \$*; do
2275         case "\$thing" in
2276         .)
2277         if test -d \$dir/\$thing; then
2278                 echo \$dir
2279                 exit 0
2280         fi
2281         ;;
2282         *)
2283         for thisthing in \$dir/\$thing; do
2284                 : just loop through to pick last item
2285         done
2286         if test -f \$thisthing; then
2287                 echo \$thisthing
2288                 exit 0
2289         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2290                 echo \$thisthing
2291                 exit 0
2292         elif test -f \$dir/\$thing.exe; then
2293                 if test -n "$DJGPP"; then
2294                         echo \$dir/\$thing.exe
2295                 elif test "$eunicefix" != ":"; then
2296                         : on Eunice apparently
2297                         echo \$dir/\$thing
2298                 fi
2299                 exit 0
2300         fi
2301         ;;
2302         esac
2303 done
2304 echo \$dflt
2305 exit 1
2306 EOSC
2307 chmod +x loc
2308 $eunicefix loc
2309 loclist="
2310 awk
2311 cat
2312 chmod
2313 comm
2314 cp
2315 echo
2316 expr
2317 grep
2318 ls
2319 mkdir
2320 rm
2321 sed
2322 sort
2323 touch
2324 tr
2325 uniq
2326 "
2327 trylist="
2328 ar
2329 bison
2330 byacc
2331 cpp
2332 csh
2333 date
2334 egrep
2335 gmake
2336 gzip
2337 less
2338 ln
2339 make
2340 more
2341 nm
2342 nroff
2343 pg
2344 test
2345 uname
2346 zip
2347 "
2348 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2349 pth="$pth /lib /usr/lib"
2350 for file in $loclist; do
2351         eval xxx=\$$file
2352         case "$xxx" in
2353         /*|?:[\\/]*)
2354                 if test -f "$xxx"; then
2355                         : ok
2356                 else
2357                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2358                         xxx=`./loc $file $file $pth`
2359                 fi
2360                 ;;
2361         '') xxx=`./loc $file $file $pth`;;
2362         *) xxx=`./loc $xxx $xxx $pth`;;
2363         esac
2364         eval $file=$xxx$_exe
2365         eval _$file=$xxx
2366         case "$xxx" in
2367         /*)
2368                 echo $file is in $xxx.
2369                 ;;
2370         ?:[\\/]*)
2371                 echo $file is in $xxx.
2372                 ;;
2373         *)
2374                 echo "I don't know where '$file' is, and my life depends on it." >&4
2375                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2376                 exit 1
2377                 ;;
2378         esac
2379 done
2380 echo " "
2381 echo "Don't worry if any of the following aren't found..."
2382 say=offhand
2383 for file in $trylist; do
2384         eval xxx=\$$file
2385         case "$xxx" in
2386         /*|?:[\\/]*)
2387                 if test -f "$xxx"; then
2388                         : ok
2389                 else
2390                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2391                         xxx=`./loc $file $file $pth`
2392                 fi
2393                 ;;
2394         '') xxx=`./loc $file $file $pth`;;
2395         *) xxx=`./loc $xxx $xxx $pth`;;
2396         esac
2397         eval $file=$xxx$_exe
2398         eval _$file=$xxx
2399         case "$xxx" in
2400         /*)
2401                 echo $file is in $xxx.
2402                 ;;
2403         ?:[\\/]*)
2404                 echo $file is in $xxx.
2405                 ;;
2406         *)
2407                 echo "I don't see $file out there, $say."
2408                 say=either
2409                 ;;
2410         esac
2411 done
2412 case "$egrep" in
2413 egrep)
2414         echo "Substituting grep for egrep."
2415         egrep=$grep
2416         _egrep=$grep
2417         ;;
2418 esac
2419 case "$ln" in
2420 ln)
2421         echo "Substituting cp for ln."
2422         ln=$cp
2423         _ln=$cp
2424         ;;
2425 esac
2426 case "$make" in
2427 make)
2428         case "$gmake" in
2429         gmake)
2430         echo "I can't find make or gmake, and my life depends on it." >&4
2431         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2432         exit 1
2433         ;;
2434         esac
2435         ;;
2436 esac
2437 case "$gmake" in
2438 gmake)  ;;
2439 *)      # We can't have osname yet.
2440         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2441                 # Assume that gmake, if found, is definitely GNU make
2442                 # and prefer it over the system make.
2443                 echo "Substituting gmake for make."
2444                 make=$gmake
2445                 _make=$gmake
2446         fi
2447         ;;
2448 esac
2449 case "$test" in
2450 test)
2451         echo "Hopefully test is built into your sh."
2452         ;;
2453 *)
2454         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2455                 echo "Using the test built into your sh."
2456                 test=test
2457                 _test=test
2458         fi
2459         ;;
2460 esac
2461 case "$echo" in
2462 echo)
2463         echo "Hopefully echo is built into your sh."
2464         ;;
2465 '') ;;
2466 *)
2467         echo " "
2468 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2469         $echo $n "hi there$c" >foo1
2470         echo $n "hi there$c" >foo2
2471         if cmp foo1 foo2 >/dev/null 2>&1; then
2472                 echo "They are compatible.  In fact, they may be identical."
2473         else
2474                 case "$n" in
2475                 '-n') n='' c='\c';;
2476                 *) n='-n' c='';;
2477                 esac
2478                 cat <<FOO
2479 They are not compatible!  You are probably running ksh on a non-USG system.
2480 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2481 have echo built in and we may have to run some Bourne shell scripts.  That
2482 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2483
2484 FOO
2485                 $echo $n "The star should be here-->$c"
2486                 $echo "*"
2487         fi
2488         $rm -f foo1 foo2
2489         ;;
2490 esac
2491
2492 # This question was auctioned at YAPC::Europe-2007 in Vienna
2493 # I never promised you could answer it. I only auctioned the question.
2494 cat <<FOO
2495 The following message is sponsored by
2496
2497   Dresden.pm<--The stars should be here.
2498
2499 Dear Perl user, system administrator or package
2500 maintainer, the Perl community sends greetings to
2501 you. Do you (emblematical) greet back [Y/n]? n
2502
2503 FOO
2504
2505 : Check what type of C compiler we use
2506 cat <<EOS >trygcc
2507 $startsh
2508 EOS
2509 cat <<'EOSC' >>trygcc
2510 case "$cc" in
2511 '') ;;
2512 *)  $rm -f try try.*
2513     $cat >try.c <<EOM
2514 int main(int argc, char *argv[]) {
2515   return 0;
2516 }
2517 EOM
2518     if $cc -o try $ccflags $ldflags try.c; then
2519        :
2520     else
2521         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2522         despair=yes
2523         trygcc=yes
2524         case "$cc" in
2525         *gcc*) trygcc=no ;;
2526         esac
2527         # Skip this test because it gives a false match on output like:
2528         #    ./trygcc: line 23: cc: command not found
2529         # case "`$cc -v -c try.c 2>&1`" in
2530         # *gcc*) trygcc=no ;;
2531         # esac
2532         if $test X"$trygcc" = Xyes; then
2533             if gcc -o try -c try.c; then
2534                 echo " "
2535                 echo "You seem to have a working gcc, though." >&4
2536                 # Switching compilers may undo the work of hints files.
2537                 # The most common problem is -D_REENTRANT for threads.
2538                 # This heuristic catches that case, but gets false positives
2539                 # if -Dusethreads was not actually specified.  Better to
2540                 # bail out here with a useful message than fail 
2541                 # mysteriously later. Should we perhaps just try to
2542                 # re-invoke Configure -Dcc=gcc config_args ?
2543                 if $test -f usethreads.cbu; then
2544                         $cat >&4 <<EOM 
2545
2546 *** However, any setting of the C compiler flags (e.g. for thread support)
2547 *** will be lost.  It may be necessary for you to restart Configure and
2548 *** add -Dcc=gcc to your Configure command line.
2549
2550 EOM
2551                         rp="Would you like to go ahead and try gcc anyway?"
2552                         dflt=n
2553                 else
2554                         rp="Would you like to use it?"
2555                         dflt=y
2556                 fi
2557                 if $test -f myread; then
2558                     . ./myread
2559                 else
2560                     if $test -f UU/myread; then
2561                         . ./UU/myread
2562                     else
2563                         echo "Cannot find myread, sorry.  Aborting." >&2
2564                         exit 1
2565                     fi
2566                 fi  
2567                 case "$ans" in
2568                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2569                 esac
2570             fi
2571         fi
2572     fi
2573     $rm -f try try.*
2574     ;;
2575 esac
2576 EOSC
2577
2578 cat <<EOS >checkcc
2579 $startsh
2580 EOS
2581 cat <<'EOSC' >>checkcc
2582 case "$cc" in        
2583 '') ;;
2584 *)  $rm -f try try.*              
2585     $cat >try.c <<EOM
2586 int main(int argc, char *argv[]) {
2587   return 0;
2588 }
2589 EOM
2590     if $cc -o try $ccflags $ldflags try.c; then
2591        :
2592     else
2593         if $test X"$despair" = Xyes; then
2594            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2595         fi
2596         $cat >&4 <<EOM         
2597 You need to find a working C compiler.
2598 Either (purchase and) install the C compiler supplied by your OS vendor,
2599 or for a free C compiler try http://gcc.gnu.org/
2600 I cannot continue any further, aborting.
2601 EOM
2602         exit 1
2603     fi
2604     $rm -f try try.*
2605     ;;
2606 esac
2607 EOSC
2608
2609 : determine whether symbolic links are supported
2610 echo " "
2611 $touch blurfl
2612 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2613         echo "Symbolic links are supported." >&4
2614         lns="$ln -s"
2615 else
2616         echo "Symbolic links are NOT supported." >&4
2617         lns="$ln"
2618 fi
2619 $rm -f blurfl sym
2620
2621 : determine whether symbolic links are supported
2622 echo " "
2623 case "$lns" in
2624 *"ln"*" -s")
2625         echo "Checking how to test for symbolic links..." >&4
2626         $lns blurfl sym
2627         if $test "X$issymlink" = X; then
2628                 case "$newsh" in
2629                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2630                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2631                 esac
2632                 if test $? = 0; then
2633                         issymlink="test -h"
2634                 else
2635                         echo "Your builtin 'test -h' may be broken." >&4
2636                         case "$test" in
2637                         /*)     ;;
2638                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2639                                 for p in $pth
2640                                 do
2641                                         if test -f "$p/$test"; then
2642                                                 test="$p/$test"
2643                                                 break
2644                                         fi
2645                                 done
2646                                 ;;
2647                         esac
2648                         case "$test" in
2649                         /*)
2650                                 echo "Trying external '$test -h'." >&4
2651                                 issymlink="$test -h"
2652                                 if $test ! -h sym >/dev/null 2>&1; then
2653                                         echo "External '$test -h' is broken, too." >&4
2654                                         issymlink=''
2655                                 fi
2656                                 ;;
2657                         *)      issymlink='' ;;
2658                         esac
2659                 fi              
2660         fi
2661         if $test "X$issymlink" = X; then
2662                 if $test -L sym 2>/dev/null; then
2663                         issymlink="$test -L"
2664                         echo "The builtin '$test -L' worked." >&4
2665                 fi
2666         fi
2667         if $test "X$issymlink" != X; then
2668                 echo "You can test for symbolic links with '$issymlink'." >&4
2669         else
2670                 echo "I do not know how you can test for symbolic links." >&4
2671         fi
2672         $rm -f blurfl sym
2673         ;;
2674 *)      echo "No symbolic links, so not testing for their testing..." >&4
2675         ;;
2676 esac
2677 echo " "
2678
2679 : Make symlinks util
2680 case "$mksymlinks" in
2681 $define|true|[yY]*)
2682         case "$src" in
2683         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2684                 exit 1
2685                 ;;
2686         *)      case "$lns:$issymlink" in
2687                 *"ln"*" -s:"*"test -"?)
2688                         echo "Creating the symbolic links..." >&4
2689                         echo "(First creating the subdirectories...)" >&4
2690                         cd ..
2691                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2692                                 read directory
2693                                 test -z "$directory" && break
2694                                 mkdir -p $directory
2695                         done
2696                         # Sanity check 1.
2697                         if test ! -d t/base; then
2698                                 echo "Failed to create the subdirectories.  Aborting." >&4
2699                                 exit 1
2700                         fi
2701                         echo "(Then creating the symlinks...)" >&4
2702                         awk '{print $1}' $src/MANIFEST | while true; do
2703                                 read filename
2704                                 test -z "$filename" && break
2705                                 if test -f $filename; then
2706                                         if $issymlink $filename; then
2707                                                 rm -f $filename
2708                                         fi
2709                                 fi
2710                                 if test -f $filename; then
2711                                         echo "$filename already exists, not symlinking."
2712                                 else
2713                                         ln -s $src/$filename $filename
2714                                 fi
2715                         done
2716                         # Sanity check 2.
2717                         if test ! -f t/base/lex.t; then
2718                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2719                                 exit 1
2720                         fi
2721                         cd UU
2722                         ;;
2723                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2724                         ;;
2725                 esac
2726                 ;;
2727         esac
2728         ;;
2729 esac
2730
2731 : Check for Cross-Compilation
2732 case "$usecrosscompile" in
2733 $define|true|[yY]*)
2734         $echo "Cross-compiling..."
2735         croak=''
2736         case "$cc" in
2737         *-*-gcc) # A cross-compiling gcc, probably.
2738             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2739             ar=$targetarch-ar
2740             # leave out ld, choosing it is more complex
2741             nm=$targetarch-nm
2742             ranlib=$targetarch-ranlib
2743             $echo 'extern int foo;' > try.c
2744             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2745             shift
2746             if $test $# -gt 0; then
2747                 incpth="$incpth $*"
2748                 incpth="`$echo $incpth|$sed 's/^ //'`"
2749                 echo "Guessing incpth '$incpth'." >&4
2750                 for i in $*; do
2751                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2752                     if $test -d $j; then
2753                         libpth="$libpth $j"
2754                     fi
2755                 done   
2756                 libpth="`$echo $libpth|$sed 's/^ //'`"
2757                 echo "Guessing libpth '$libpth'." >&4
2758             fi
2759             $rm -f try.c
2760             ;;
2761         esac
2762         case "$targetarch" in
2763         '') echo "Targetarch not defined." >&4; croak=y ;;
2764         *)  echo "Using targetarch $targetarch." >&4 ;;
2765         esac
2766         case "$incpth" in
2767         '') echo "Incpth not defined." >&4; croak=y ;;
2768         *)  echo "Using incpth '$incpth'." >&4 ;;
2769         esac
2770         case "$libpth" in
2771         '') echo "Libpth not defined." >&4; croak=y ;;
2772         *)  echo "Using libpth '$libpth'." >&4 ;;
2773         esac
2774         case "$usrinc" in
2775         '') for i in $incpth; do
2776                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2777                     usrinc=$i
2778                     echo "Guessing usrinc $usrinc." >&4
2779                     break
2780                 fi
2781             done
2782             case "$usrinc" in
2783             '') echo "Usrinc not defined." >&4; croak=y ;;
2784             esac
2785             ;;
2786         *)  echo "Using usrinc $usrinc." >&4 ;;
2787         esac
2788         case "$targethost" in
2789         '') echo "Targethost not defined." >&4; croak=y ;;
2790         *)  echo "Using targethost $targethost." >&4
2791         esac
2792         locincpth=' '
2793         loclibpth=' '
2794         case "$croak" in
2795         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2796         esac
2797         case "$src" in
2798         /*) run=$src/Cross/run
2799             targetmkdir=$src/Cross/mkdir
2800             to=$src/Cross/to
2801             from=$src/Cross/from
2802             ;;
2803         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2804             run=$pwd/Cross/run
2805             targetmkdir=$pwd/Cross/mkdir
2806             to=$pwd/Cross/to
2807             from=$pwd/Cross/from
2808             ;;
2809         esac
2810         case "$targetrun" in
2811         '') targetrun=ssh ;;
2812         esac
2813         case "$targetto" in
2814         '') targetto=scp ;;
2815         esac
2816         case "$targetfrom" in
2817         '') targetfrom=scp ;;
2818         esac
2819         run=$run-$targetrun
2820         to=$to-$targetto
2821         from=$from-$targetfrom
2822         case "$targetdir" in
2823         '')  targetdir=/tmp
2824              echo "Guessing targetdir $targetdir." >&4
2825              ;;
2826         esac
2827         case "$targetuser" in
2828         '')  targetuser=root
2829              echo "Guessing targetuser $targetuser." >&4
2830              ;;
2831         esac
2832         case "$targetfrom" in
2833         scp)    q=-q ;;
2834         *)      q='' ;;
2835         esac
2836         case "$targetrun" in
2837         ssh|rsh)
2838             cat >$run <<EOF
2839 #!/bin/sh
2840 case "\$1" in
2841 -cwd)
2842   shift
2843   cwd=\$1
2844   shift
2845   ;;
2846 esac
2847 case "\$cwd" in
2848 '') cwd=$targetdir ;;
2849 esac
2850 exe=\$1
2851 shift
2852 if $test ! -f \$exe.xok; then
2853   $to \$exe
2854   $touch \$exe.xok
2855 fi
2856 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2857 EOF
2858             ;;
2859         *)  echo "Unknown targetrun '$targetrun'" >&4
2860             exit 1
2861             ;;
2862         esac
2863         case "$targetmkdir" in
2864         */Cross/mkdir)
2865             cat >$targetmkdir <<EOF
2866 #!/bin/sh
2867 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2868 EOF
2869             $chmod a+rx $targetmkdir
2870             ;;
2871         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2872             exit 1
2873             ;;
2874         esac
2875         case "$targetto" in
2876         scp|rcp)
2877             cat >$to <<EOF
2878 #!/bin/sh
2879 for f in \$@
2880 do
2881   case "\$f" in
2882   /*)
2883     $targetmkdir \`dirname \$f\`
2884     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2885     ;;
2886   *)
2887     $targetmkdir $targetdir/\`dirname \$f\`
2888     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2889     ;;
2890   esac
2891 done
2892 exit 0
2893 EOF
2894             ;;
2895         cp) cat >$to <<EOF
2896 #!/bin/sh
2897 for f in \$@
2898 do
2899   case "\$f" in
2900   /*)
2901     $mkdir -p $targetdir/\`dirname \$f\`
2902     $cp \$f $targetdir/\$f || exit 1
2903     ;;
2904   *)
2905     $targetmkdir $targetdir/\`dirname \$f\`
2906     $cp \$f $targetdir/\$f || exit 1
2907     ;;
2908   esac
2909 done
2910 exit 0
2911 EOF
2912             ;;
2913         *)  echo "Unknown targetto '$targetto'" >&4
2914             exit 1
2915             ;;
2916         esac
2917         case "$targetfrom" in
2918         scp|rcp)
2919           cat >$from <<EOF
2920 #!/bin/sh
2921 for f in \$@
2922 do
2923   $rm -f \$f
2924   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2925 done
2926 exit 0
2927 EOF
2928             ;;
2929         cp) cat >$from <<EOF
2930 #!/bin/sh
2931 for f in \$@
2932 do
2933   $rm -f \$f
2934   cp $targetdir/\$f . || exit 1
2935 done
2936 exit 0
2937 EOF
2938             ;;
2939         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2940             exit 1
2941             ;;
2942         esac
2943         if $test ! -f $run; then
2944             echo "Target 'run' script '$run' not found." >&4
2945         else
2946             $chmod a+rx $run
2947         fi
2948         if $test ! -f $to; then
2949             echo "Target 'to' script '$to' not found." >&4
2950         else
2951             $chmod a+rx $to
2952         fi
2953         if $test ! -f $from; then
2954             echo "Target 'from' script '$from' not found." >&4
2955         else
2956             $chmod a+rx $from
2957         fi
2958         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2959             exit 1
2960         fi
2961         cat >&4 <<EOF
2962 Using '$run' for remote execution,
2963 and '$from' and '$to'
2964 for remote file transfer.
2965 EOF
2966         ;;
2967 *)      run=''
2968         to=:
2969         from=:
2970         usecrosscompile='undef'
2971         targetarch=''
2972         ;;
2973 esac
2974
2975 : see whether [:lower:] and [:upper:] are supported character classes
2976 echo " "
2977 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2978 ABYZ)
2979         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2980         up='[:upper:]'
2981         low='[:lower:]'
2982         ;;
2983 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2984         # (0xd9 and 0xe2), therefore that is a nice testing point.
2985         if test "X$up" = X -o "X$low" = X; then
2986             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2987             rs) up='[A-Z]'
2988                 low='[a-z]'
2989                 ;;
2990             esac
2991         fi
2992         if test "X$up" = X -o "X$low" = X; then
2993             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2994             rs) up='A-Z'
2995                 low='a-z'
2996                 ;;
2997             esac
2998         fi
2999         if test "X$up" = X -o "X$low" = X; then
3000             case "`echo RS | od -x 2>/dev/null`" in
3001             *D9E2*|*d9e2*)
3002                 echo "Hey, this might be EBCDIC." >&4
3003                 if test "X$up" = X -o "X$low" = X; then
3004                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3005                     rs) up='[A-IJ-RS-Z]'
3006                         low='[a-ij-rs-z]'
3007                         ;;
3008                     esac
3009                 fi
3010                 if test "X$up" = X -o "X$low" = X; then
3011                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3012                     rs) up='A-IJ-RS-Z'
3013                         low='a-ij-rs-z'
3014                         ;;
3015                     esac
3016                 fi
3017                 ;;
3018             esac
3019         fi
3020 esac
3021 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3022 rs)
3023     echo "Using $up and $low to convert case." >&4
3024     ;;
3025 *)
3026     echo "I don't know how to translate letters from upper to lower case." >&4
3027     echo "Your tr is not acting any way I know of." >&4
3028     exit 1
3029     ;;
3030 esac
3031 : set up the translation script tr, must be called with ./tr of course
3032 cat >tr <<EOSC
3033 $startsh
3034 case "\$1\$2" in
3035 '[A-Z][a-z]') exec $tr '$up' '$low';;
3036 '[a-z][A-Z]') exec $tr '$low' '$up';;
3037 esac
3038 exec $tr "\$@"
3039 EOSC
3040 chmod +x tr
3041 $eunicefix tr
3042
3043 : Try to determine whether config.sh was made on this system
3044 case "$config_sh" in
3045 '')
3046 myuname=`$uname -a 2>/dev/null`
3047 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3048 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3049 # because the A-Z/a-z are not consecutive.
3050 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3051         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3052 newmyuname="$myuname"
3053 dflt=n
3054 case "$knowitall" in
3055 '')
3056         if test -f ../config.sh; then
3057                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3058                         eval "`grep myuname= ../config.sh`"
3059                 fi
3060                 if test "X$myuname" = "X$newmyuname"; then
3061                         dflt=y
3062                 fi
3063         fi
3064         ;;
3065 *) dflt=y;;
3066 esac
3067
3068 : Get old answers from old config file if Configure was run on the
3069 : same system, otherwise use the hints.
3070 hint=default
3071 cd ..
3072 if test -f config.sh; then
3073         echo " "
3074         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3075         . UU/myread
3076         case "$ans" in
3077         n*|N*) echo "OK, I'll ignore it."
3078                 mv config.sh config.sh.old
3079                 myuname="$newmyuname"
3080                 ;;
3081         *)  echo "Fetching default answers from your old config.sh file..." >&4
3082                 tmp_n="$n"
3083                 tmp_c="$c"
3084                 tmp_sh="$sh"
3085                 . ./config.sh
3086                 cp config.sh UU
3087                 n="$tmp_n"
3088                 c="$tmp_c"
3089                 : Older versions did not always set $sh.  Catch re-use of such
3090                 : an old config.sh.
3091                 case "$sh" in
3092                 '') sh="$tmp_sh" ;;
3093                 esac
3094                 hint=previous
3095                 ;;
3096         esac
3097 fi
3098 . ./UU/checkcc
3099 if test ! -f config.sh; then
3100         $cat <<EOM
3101
3102 First time through, eh?  I have some defaults handy for some systems
3103 that need some extra help getting the Configure answers right:
3104
3105 EOM
3106         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3107         dflt=''
3108         : Half the following guesses are probably wrong... If you have better
3109         : tests or hints, please send them to perlbug@perl.org
3110         : The metaconfig authors would also appreciate a copy...
3111         $test -f /irix && osname=irix
3112         $test -f /xenix && osname=sco_xenix
3113         $test -f /dynix && osname=dynix
3114         $test -f /dnix && osname=dnix
3115         $test -f /lynx.os && osname=lynxos
3116         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3117         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3118         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3119         $test -f /bin/mips && /bin/mips && osname=mips
3120         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3121                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3122         $test -d /usr/apollo/bin && osname=apollo
3123         $test -f /etc/saf/_sactab && osname=svr4
3124         $test -d /usr/include/minix && osname=minix
3125         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3126         if $test -d /MachTen -o -d /MachTen_Folder; then
3127                 osname=machten
3128                 if $test -x /sbin/version; then
3129                         osvers=`/sbin/version | $awk '{print $2}' |
3130                         $sed -e 's/[A-Za-z]$//'`
3131                 elif $test -x /usr/etc/version; then
3132                         osvers=`/usr/etc/version | $awk '{print $2}' |
3133                         $sed -e 's/[A-Za-z]$//'`
3134                 else
3135                         osvers="$2.$3"
3136                 fi
3137         fi
3138
3139         $test -f /sys/posix.dll &&
3140                 $test -f /usr/bin/what &&
3141                 set X `/usr/bin/what /sys/posix.dll` &&
3142                 $test "$3" = UWIN &&
3143                 osname=uwin &&
3144                 osvers="$5"
3145
3146         if $test -f $uname; then
3147                 set X $myuname
3148                 shift
3149
3150                 case "$5" in
3151                 fps*) osname=fps ;;
3152                 mips*)
3153                         case "$4" in
3154                         umips) osname=umips ;;
3155                         *) osname=mips ;;
3156                         esac;;
3157                 [23]100) osname=mips ;;
3158                 next*) osname=next ;;
3159                 i386*)
3160                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3161                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3162                                 osname='sco'
3163                                 osvers=$tmp
3164                         elif $test -f /etc/kconfig; then
3165                                 osname=isc
3166                                 if test "$lns" = "$ln -s"; then
3167                                         osvers=4
3168                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3169                                         osvers=3
3170                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3171                                         osvers=2
3172                                 fi
3173                         fi
3174                         tmp=''
3175                         ;;
3176                 pc*)
3177                         if test -n "$DJGPP"; then
3178                                 osname=dos
3179                                 osvers=djgpp
3180                         fi
3181                         ;;
3182                 esac
3183
3184                 case "$1" in
3185                 aix) osname=aix
3186                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3187                         case "$tmp" in
3188                         # oslevel can fail with:
3189                         # oslevel: Unable to acquire lock.
3190                         *not\ found) osvers="$4"."$3" ;;
3191                         '<3240'|'<>3240') osvers=3.2.0 ;;
3192                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3193                         '=3250'|'>3250') osvers=3.2.5 ;;
3194                         *) osvers=$tmp;;
3195                         esac
3196                         ;;
3197                 bsd386) osname=bsd386
3198                         osvers=`$uname -r`
3199                         ;;
3200                 cygwin*) osname=cygwin
3201                         osvers="$3"
3202                         ;;
3203                 *dc.osx) osname=dcosx
3204                         osvers="$3"
3205                         ;;
3206                 dnix) osname=dnix
3207                         osvers="$3"
3208                         ;;
3209                 domainos) osname=apollo
3210                         osvers="$3"
3211                         ;;
3212                 dgux)   osname=dgux
3213                         osvers="$3"
3214                         ;;
3215                 dragonfly) osname=dragonfly
3216                         osvers="$3"
3217                         ;;
3218                 dynixptx*) osname=dynixptx
3219                         osvers=`echo "$4"|sed 's/^v//'`
3220                         ;;
3221                 freebsd) osname=freebsd
3222                         osvers="$3" ;;
3223                 genix)  osname=genix ;;
3224                 gnu)    osname=gnu
3225                         osvers="$3" ;;
3226                 hp*)    osname=hpux
3227                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3228                         ;;
3229                 irix*)  osname=irix
3230                         case "$3" in
3231                         4*) osvers=4 ;;
3232                         5*) osvers=5 ;;
3233                         *)      osvers="$3" ;;
3234                         esac
3235                         ;;
3236                 linux)  osname=linux
3237                         case "$3" in
3238                         *)      osvers="$3" ;;
3239                         esac
3240                         ;;
3241                 MiNT)   osname=mint
3242                         ;;
3243                 netbsd*) osname=netbsd
3244                         osvers="$3"
3245                         ;;
3246                 news-os) osvers="$3"
3247                         case "$3" in
3248                         4*) osname=newsos4 ;;
3249                         *) osname=newsos ;;
3250                         esac
3251                         ;;
3252                 next*) osname=next ;;
3253                 nonstop-ux) osname=nonstopux ;;
3254                 openbsd) osname=openbsd
3255                         osvers="$3"
3256                         ;;
3257                 os2)    osname=os2
3258                         osvers="$4"
3259                         ;;
3260                 POSIX-BC | posix-bc ) osname=posix-bc
3261                         osvers="$3"
3262                         ;;
3263                 powerux | power_ux | powermax_os | powermaxos | \
3264                 powerunix | power_unix) osname=powerux
3265                         osvers="$3"
3266                         ;;
3267                 qnx) osname=qnx
3268                         osvers="$4"
3269                         ;;
3270                 solaris) osname=solaris
3271                         case "$3" in
3272                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3273                         *)      osvers="$3" ;;
3274                         esac
3275                         ;;
3276                 sunos) osname=sunos
3277                         case "$3" in
3278                         5*) osname=solaris
3279                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3280                         *)      osvers="$3" ;;
3281                         esac
3282                         ;;
3283                 titanos) osname=titanos
3284                         case "$3" in
3285                         1*) osvers=1 ;;
3286                         2*) osvers=2 ;;
3287                         3*) osvers=3 ;;
3288                         4*) osvers=4 ;;
3289                         *)      osvers="$3" ;;
3290                         esac
3291                         ;;
3292                 ultrix) osname=ultrix
3293                         osvers="$3"
3294                         ;;
3295                 osf1|mls+)      case "$5" in
3296                                 alpha)
3297                                         osname=dec_osf
3298                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3299                                         case "$osvers" in
3300                                         [1-9].[0-9]*) ;;
3301                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3302                                         esac
3303                                         ;;
3304                         hp*)    osname=hp_osf1  ;;
3305                         mips)   osname=mips_osf1 ;;
3306                         esac
3307                         ;;
3308                 # UnixWare 7.1.2 is known as Open UNIX 8
3309                 openunix|unixware) osname=svr5
3310                         osvers="$4"
3311                         ;;
3312                 uts)    osname=uts
3313                         osvers="$3"
3314                         ;;
3315                 vos) osvers="$3"
3316                         ;;
3317                 $2) case "$osname" in
3318                         *isc*) ;;
3319                         *freebsd*) ;;
3320                         svr*)
3321                                 : svr4.x or possibly later
3322                                 case "svr$3" in
3323                                 ${osname}*)
3324                                         osname=svr$3
3325                                         osvers=$4
3326                                         ;;
3327                                 esac
3328                                 case "$osname" in
3329                                 svr4.0)
3330                                         : Check for ESIX
3331                                         if test -f /stand/boot ; then
3332                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3333                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3334                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3335                                                         if test -n "$isesix"; then
3336                                                                 osname=esix4
3337                                                         fi
3338                                                 fi
3339                                         fi
3340                                         ;;
3341                                 esac
3342                                 ;;
3343                         *)      if test -f /etc/systemid; then
3344                                         osname=sco
3345                                         set `echo $3 | $sed 's/\./ /g'` $4
3346                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3347                                                 osvers=$1.$2.$3
3348                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3349                                                 osvers=$1.$2
3350                                         elif $test -f $src/hints/sco_$1.sh; then
3351                                                 osvers=$1
3352                                         fi
3353                                 else
3354                                         case "$osname" in
3355                                         '') : Still unknown.  Probably a generic Sys V.
3356                                                 osname="sysv"
3357                                                 osvers="$3"
3358                                                 ;;
3359                                         esac
3360                                 fi
3361                                 ;;
3362                         esac
3363                         ;;
3364                 *)      case "$osname" in
3365                         '') : Still unknown.  Probably a generic BSD.
3366                                 osname="$1"
3367                                 osvers="$3"
3368                                 ;;
3369                         esac
3370                         ;;
3371                 esac
3372         else
3373                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3374                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3375                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3376                                 osname=news_os
3377                         fi
3378                         $rm -f UU/kernel.what
3379                 elif test -d c:/. -o -n "$is_os2" ; then
3380                         set X $myuname
3381                         osname=os2
3382                         osvers="$5"
3383                 fi
3384         fi
3385
3386         case "$targetarch" in
3387         '') ;;
3388         *)  hostarch=$osname
3389             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3390             osvers=''
3391             ;;
3392         esac
3393
3394         : Now look for a hint file osname_osvers, unless one has been
3395         : specified already.
3396         case "$hintfile" in
3397         ''|' ')
3398                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3399                 : Also try without trailing minor version numbers.
3400                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3401                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3402                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3403                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3404                 case "$file" in
3405                 '') dflt=none ;;
3406                 *)  case "$osvers" in
3407                         '') dflt=$file
3408                                 ;;
3409                         *)  if $test -f $src/hints/$file.sh ; then
3410                                         dflt=$file
3411                                 elif $test -f $src/hints/$xfile.sh ; then
3412                                         dflt=$xfile
3413                                 elif $test -f $src/hints/$xxfile.sh ; then
3414                                         dflt=$xxfile
3415                                 elif $test -f $src/hints/$xxxfile.sh ; then
3416                                         dflt=$xxxfile
3417                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3418                                         dflt=$xxxxfile
3419                                 elif $test -f "$src/hints/${osname}.sh" ; then
3420                                         dflt="${osname}"
3421                                 else
3422                                         dflt=none
3423                                 fi
3424                                 ;;
3425                         esac
3426                         ;;
3427                 esac
3428                 if $test -f Policy.sh ; then
3429                         case "$dflt" in
3430                         *Policy*) ;;
3431                         none) dflt="Policy" ;;
3432                         *) dflt="Policy $dflt" ;;
3433                         esac
3434                 fi
3435                 ;;
3436         *)
3437                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3438                 ;;
3439         esac
3440
3441         if $test -f Policy.sh ; then
3442                 $cat <<EOM
3443
3444 There's also a Policy hint file available, which should make the
3445 site-specific (policy) questions easier to answer.
3446 EOM
3447
3448         fi
3449
3450         $cat <<EOM
3451
3452 You may give one or more space-separated answers, or "none" if appropriate.
3453 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3454 previous run of Configure, you may specify it as well as or instead of
3455 OS-specific hints.  If hints are provided for your OS, you should use them:
3456 although Perl can probably be built without hints on many platforms, using
3457 hints often improve performance and may enable features that Configure can't
3458 set up on its own. If there are no hints that match your OS, specify "none";
3459 DO NOT give a wrong version or a wrong OS.
3460
3461 EOM
3462
3463         rp="Which of these apply, if any?"
3464         . UU/myread
3465         tans=$ans
3466         for file in $tans; do
3467                 if $test X$file = XPolicy -a -f Policy.sh; then
3468                         . Policy.sh
3469                         $cat Policy.sh >> UU/config.sh
3470                 elif $test -f $src/hints/$file.sh; then
3471                         . $src/hints/$file.sh
3472                         $cat $src/hints/$file.sh >> UU/config.sh
3473                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3474                         : nothing
3475                 else
3476                         : Give one chance to correct a possible typo.
3477                         echo "$file.sh does not exist"
3478                         dflt=$file
3479                         rp="hint to use instead?"
3480                         . UU/myread
3481                         for file in $ans; do
3482                                 if $test -f "$src/hints/$file.sh"; then
3483                                         . $src/hints/$file.sh
3484                                         $cat $src/hints/$file.sh >> UU/config.sh
3485                                 elif $test X$ans = X -o X$ans = Xnone ; then
3486                                         : nothing
3487                                 else
3488                                         echo "$file.sh does not exist -- ignored."
3489                                 fi
3490                         done
3491                 fi
3492         done
3493
3494         hint=recommended
3495         : Remember our hint file for later.
3496         if $test -f "$src/hints/$file.sh" ; then
3497                 hintfile="$file"
3498         else
3499                 hintfile=''
3500         fi
3501 fi
3502 cd UU
3503 ;;
3504 *)
3505         echo " "
3506         echo "Fetching default answers from $config_sh..." >&4
3507         tmp_n="$n"
3508         tmp_c="$c"
3509         cd ..
3510         cp $config_sh config.sh 2>/dev/null
3511         chmod +w config.sh
3512         . ./config.sh
3513         cd UU
3514         cp ../config.sh .
3515         n="$tmp_n"
3516         c="$tmp_c"
3517         hint=previous
3518         ;;
3519 esac
3520 test "$override" && . ./optdef.sh
3521
3522 : Restore computed paths
3523 for file in $loclist $trylist; do
3524         eval $file="\$_$file"
3525 done
3526
3527 cat << EOM
3528
3529 Configure uses the operating system name and version to set some defaults.
3530 The default value is probably right if the name rings a bell. Otherwise,
3531 since spelling matters for me, either accept the default or answer "none"
3532 to leave it blank.
3533
3534 EOM
3535 case "$osname" in
3536         ''|' ')
3537                 case "$hintfile" in
3538                 ''|' '|none) dflt=none ;;
3539                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3540                 esac
3541                 ;;
3542         *) dflt="$osname" ;;
3543 esac
3544 rp="Operating system name?"
3545 . ./myread
3546 case "$ans" in
3547 none)  osname='' ;;
3548 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3549 esac
3550 echo " "
3551 case "$osvers" in
3552         ''|' ')
3553                 case "$hintfile" in
3554                 ''|' '|none) dflt=none ;;
3555                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3556                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3557                         case "$dflt" in
3558                         ''|' ') dflt=none ;;
3559                         esac
3560                         ;;
3561                 esac
3562                 ;;
3563         *) dflt="$osvers" ;;
3564 esac
3565 rp="Operating system version?"
3566 . ./myread
3567 case "$ans" in
3568 none)  osvers='' ;;
3569 *) osvers="$ans" ;;
3570 esac
3571
3572
3573 . ./posthint.sh
3574
3575 : who configured the system
3576 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3577 case "$cf_by" in
3578 "")
3579         cf_by=`(logname) 2>/dev/null`
3580         case "$cf_by" in
3581         "")
3582                 cf_by=`(whoami) 2>/dev/null`
3583                 case "$cf_by" in
3584                 "") cf_by=unknown ;;
3585                 esac ;;
3586         esac ;;
3587 esac
3588
3589 : decide how portable to be.  Allow command line overrides.
3590 case "$d_portable" in
3591 "$undef") ;;
3592 *)      d_portable="$define" ;;
3593 esac
3594
3595 : set up shell script to do ~ expansion
3596 cat >filexp <<EOSS
3597 $startsh
3598 : expand filename
3599 case "\$1" in
3600  \~/*|\~)
3601         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3602         ;;
3603  \~*)
3604         if $test -f /bin/csh; then
3605                 /bin/csh -f -c "glob \$1"
3606                 failed=\$?
3607                 echo ""
3608                 exit \$failed
3609         else
3610                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3611                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3612                 if $test ! -d "\$dir"; then
3613                         me=\`basename \$0\`
3614                         echo "\$me: can't locate home directory for: \$name" >&2
3615                         exit 1
3616                 fi
3617                 case "\$1" in
3618                 */*)
3619                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3620                         ;;
3621                 *)
3622                         echo \$dir
3623                         ;;
3624                 esac
3625         fi
3626         ;;
3627 *)
3628         echo \$1
3629         ;;
3630 esac
3631 EOSS
3632 chmod +x filexp
3633 $eunicefix filexp
3634
3635 : now set up to get a file name
3636 cat <<EOS >getfile
3637 $startsh
3638 EOS
3639 cat <<'EOSC' >>getfile
3640 tilde=''
3641 fullpath=''
3642 already=''
3643 skip=''
3644 none_ok=''
3645 exp_file=''
3646 nopath_ok=''
3647 orig_rp="$rp"
3648 orig_dflt="$dflt"
3649 case "$gfpth" in
3650 '') gfpth='.' ;;
3651 esac
3652
3653 case "$fn" in
3654 *\(*)
3655         : getfile will accept an answer from the comma-separated list
3656         : enclosed in parentheses even if it does not meet other criteria.
3657         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3658         fn=`echo $fn | sed 's/(.*)//'`
3659         ;;
3660 esac
3661
3662 case "$fn" in
3663 *:*)
3664         loc_file=`expr $fn : '.*:\(.*\)'`
3665         fn=`expr $fn : '\(.*\):.*'`
3666         ;;
3667 esac
3668
3669 case "$fn" in
3670 *~*) tilde=true;;
3671 esac
3672 case "$fn" in
3673 */*) fullpath=true;;
3674 esac
3675 case "$fn" in
3676 *+*) skip=true;;
3677 esac
3678 case "$fn" in
3679 *n*) none_ok=true;;
3680 esac
3681 case "$fn" in
3682 *e*) exp_file=true;;
3683 esac
3684 case "$fn" in
3685 *p*) nopath_ok=true;;
3686 esac
3687
3688 case "$fn" in
3689 *f*) type='File';;
3690 *d*) type='Directory';;
3691 *l*) type='Locate';;
3692 esac
3693
3694 what="$type"
3695 case "$what" in
3696 Locate) what='File';;
3697 esac
3698
3699 case "$exp_file" in
3700 '')
3701         case "$d_portable" in
3702         "$define") ;;
3703         *) exp_file=true;;
3704         esac
3705         ;;
3706 esac
3707
3708 cd ..
3709 while test "$type"; do
3710         redo=''
3711         rp="$orig_rp"
3712         dflt="$orig_dflt"
3713         case "$tilde" in
3714         true) rp="$rp (~name ok)";;
3715         esac
3716         . UU/myread
3717         if test -f UU/getfile.ok && \
3718                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3719         then
3720                 value="$ans"
3721                 ansexp="$ans"
3722                 break
3723         fi
3724         case "$ans" in
3725         none)
3726                 value=''
3727                 ansexp=''
3728                 case "$none_ok" in
3729                 true) type='';;
3730                 esac
3731                 ;;
3732         *)
3733                 case "$tilde" in
3734                 '') value="$ans"
3735                         ansexp="$ans";;
3736                 *)
3737                         value=`UU/filexp $ans`
3738                         case $? in
3739                         0)
3740                                 if test "$ans" != "$value"; then
3741                                         echo "(That expands to $value on this system.)"
3742                                 fi
3743                                 ;;
3744                         *) value="$ans";;
3745                         esac
3746                         ansexp="$value"
3747                         case "$exp_file" in
3748                         '') value="$ans";;
3749                         esac
3750                         ;;
3751                 esac
3752                 case "$fullpath" in
3753                 true)
3754                         case "$ansexp" in
3755                         /*) value="$ansexp" ;;
3756                         [a-zA-Z]:/*) value="$ansexp" ;;
3757                         *)
3758                                 redo=true
3759                                 case "$already" in
3760                                 true)
3761                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3762                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3763                                         ;;
3764                                 *)
3765                                 echo "Please give a full path name, starting with slash." >&4
3766                                         case "$tilde" in
3767                                         true)
3768                                 echo "Note that using ~name is ok provided it expands well." >&4
3769                                                 already=true
3770                                                 ;;
3771                                         esac
3772                                 esac
3773                                 ;;
3774                         esac
3775                         ;;
3776                 esac
3777                 case "$redo" in
3778                 '')
3779                         case "$type" in
3780                         File)
3781                                 for fp in $gfpth; do
3782                                         if test "X$fp" = X.; then
3783                                             pf="$ansexp"
3784                                         else    
3785                                             pf="$fp/$ansexp"
3786                                         fi
3787                                         if test -f "$pf"; then
3788                                                 type=''
3789                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3790                                         then
3791                                                 echo "($value is not a plain file, but that's ok.)"
3792                                                 type=''
3793                                         fi
3794                                         if test X"$type" = X; then
3795                                             value="$pf"
3796                                             break
3797                                         fi
3798                                 done
3799                                 ;;
3800                         Directory)
3801                                 for fp in $gfpth; do
3802                                         if test "X$fp" = X.; then
3803                                             dir="$ans"
3804                                             direxp="$ansexp"
3805                                         else    
3806                                             dir="$fp/$ansexp"
3807                                             direxp="$fp/$ansexp"
3808                                         fi
3809                                         if test -d "$direxp"; then
3810                                                 type=''
3811                                                 value="$dir"
3812                                                 break
3813                                         fi
3814                                 done
3815                                 ;;
3816                         Locate)
3817                                 if test -d "$ansexp"; then
3818                                         echo "(Looking for $loc_file in directory $value.)"
3819                                         value="$value/$loc_file"
3820                                         ansexp="$ansexp/$loc_file"
3821                                 fi
3822                                 if test -f "$ansexp"; then
3823                                         type=''
3824                                 fi
3825                                 case "$nopath_ok" in
3826                                 true)   case "$value" in
3827                                         */*) ;;
3828                                         *)      echo "Assuming $value will be in people's path."
3829                                                 type=''
3830                                                 ;;
3831                                         esac
3832                                         ;;
3833                                 esac
3834                                 ;;
3835                         esac
3836
3837                         case "$skip" in
3838                         true) type='';
3839                         esac
3840
3841                         case "$type" in
3842                         '') ;;
3843                         *)
3844                                 if test "$fastread" = yes; then
3845                                         dflt=y
3846                                 else
3847                                         dflt=n
3848                                 fi
3849                                 rp="$what $value doesn't exist.  Use that name anyway?"
3850                                 . UU/myread
3851                                 dflt=''
3852                                 case "$ans" in
3853                                 y*) type='';;
3854                                 *) echo " ";;
3855                                 esac
3856                                 ;;
3857                         esac
3858                         ;;
3859                 esac
3860                 ;;
3861         esac
3862 done
3863 cd UU
3864 ans="$value"
3865 rp="$orig_rp"
3866 dflt="$orig_dflt"
3867 rm -f getfile.ok
3868 test "X$gfpthkeep" != Xy && gfpth=""
3869 EOSC
3870
3871 : determine root of directory hierarchy where package will be installed.
3872 case "$prefix" in
3873 '')
3874         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3875         ;;
3876 *?/)
3877         dflt=`echo "$prefix" | sed 's/.$//'`
3878         ;;
3879 *)
3880         dflt="$prefix"
3881         ;;
3882 esac
3883 $cat <<EOM
3884
3885 By default, $package will be installed in $dflt/bin, manual pages
3886 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3887 installation directories. Typically this is something like /usr/local.
3888 If you wish to have binaries under /usr/bin but other parts of the
3889 installation under /usr/local, that's ok: you will be prompted
3890 separately for each of the installation directories, the prefix being
3891 only used to set the defaults.
3892
3893 EOM
3894 fn=d~
3895 rp='Installation prefix to use?'
3896 . ./getfile
3897 oldprefix=''
3898 case "$prefix" in
3899 '') ;;
3900 *)
3901         case "$ans" in
3902         "$prefix") ;;
3903         *) oldprefix="$prefix";;
3904         esac
3905         ;;
3906 esac
3907 prefix="$ans"
3908 prefixexp="$ansexp"
3909
3910 : allow them to override the AFS root
3911 case "$afsroot" in
3912 '')     afsroot=/afs ;;
3913 *)      afsroot=$afsroot ;;
3914 esac
3915
3916 : is AFS running?
3917 echo " "
3918 case "$afs" in
3919 $define|true)   afs=true ;;
3920 $undef|false)   afs=false ;;
3921 *)      if $test -d $afsroot; then
3922                 afs=true
3923         else
3924                 afs=false
3925         fi
3926         ;;
3927 esac
3928 if $afs; then
3929         echo "AFS may be running... I'll be extra cautious then..." >&4
3930 else
3931         echo "AFS does not seem to be running..." >&4
3932 fi
3933
3934 : determine installation prefix for where package is to be installed.
3935 if $afs; then 
3936 $cat <<EOM
3937
3938 Since you are running AFS, I need to distinguish the directory in which
3939 files will reside from the directory in which they are installed (and from
3940 which they are presumably copied to the former directory by occult means).
3941
3942 EOM
3943         case "$installprefix" in
3944         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3945         *) dflt="$installprefix";;
3946         esac
3947 else
3948 $cat <<EOM
3949
3950 In some special cases, particularly when building $package for distribution,
3951 it is convenient to distinguish the directory in which files should be
3952 installed from the directory ($prefix) in which they will
3953 eventually reside.  For most users, these two directories are the same.
3954
3955 EOM
3956         case "$installprefix" in
3957         '') dflt=$prefix ;;
3958         *) dflt=$installprefix;;
3959         esac
3960 fi
3961 fn=d~
3962 rp='What installation prefix should I use for installing files?'
3963 . ./getfile
3964 installprefix="$ans"
3965 installprefixexp="$ansexp"
3966
3967 : Perform the prefixexp/installprefixexp correction if necessary
3968 cat <<EOS >installprefix
3969 $startsh
3970 EOS
3971 cat <<'EOSC' >>installprefix
3972 : Change installation prefix, if necessary.
3973 if $test X"$prefix" != X"$installprefix"; then
3974     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3975 else
3976     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3977 fi
3978 EOSC
3979 chmod +x installprefix
3980 $eunicefix installprefix
3981
3982 : Set variables such as privlib and privlibexp from the output of ./getfile
3983 : performing the prefixexp/installprefixexp correction if necessary.
3984 cat <<EOS >setprefixvar
3985 $startsh
3986 EOS
3987 cat <<'EOSC' >>setprefixvar
3988 eval "${prefixvar}=\"\$ans\""
3989 eval "${prefixvar}exp=\"\$ansexp\""
3990 . ./installprefix
3991 EOSC
3992 chmod +x setprefixvar
3993 $eunicefix setprefixvar
3994
3995 : set up the script used to warn in case of inconsistency
3996 cat <<EOS >whoa
3997 $startsh
3998 EOS
3999 cat <<'EOSC' >>whoa
4000 dflt=y
4001 case "$hint" in
4002     recommended)
4003         case "$hintfile" in
4004         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4005                 ;;
4006         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4007                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4008                 ;;
4009         esac
4010         ;;
4011     *)  echo " "
4012         echo "*** WHOA THERE!!! ***" >&4
4013         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4014         ;;
4015 esac
4016 rp="    Keep the $hint value?"
4017 . ./myread
4018 case "$ans" in
4019 y) td=$was; tu=$was;;
4020 esac
4021 EOSC
4022
4023 : function used to set '$1' to '$val'
4024 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4025 case "$val$was" in
4026 $define$undef) . ./whoa; eval "$var=\$td";;
4027 $undef$define) . ./whoa; eval "$var=\$tu";;
4028 *) eval "$var=$val";;
4029 esac'
4030
4031 : Check is we will use socks
4032 case "$usesocks" in
4033 $define|true|[yY]*)     dflt='y';;
4034 *) dflt='n';;
4035 esac
4036 cat <<EOM
4037
4038 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4039 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4040 to use the PerlIO abstraction layer, this will be implicitly selected.
4041
4042 If this doesn't make any sense to you, just accept the default '$dflt'.
4043 EOM
4044 rp='Build Perl for SOCKS?'
4045 . ./myread
4046 case "$ans" in
4047 y|Y)    val="$define" ;;
4048 *)      val="$undef" ;;
4049 esac
4050 set usesocks
4051 eval $setvar
4052
4053 case "$usesocks" in
4054 $define|true|[yY]*) useperlio="$define";;
4055 esac
4056
4057 : Check if we want perlio
4058 case "$useperlio" in
4059 $define|true|[yY]*|'')  dflt='y';;
4060 *) dflt='n';;
4061 esac
4062 cat <<EOM
4063
4064 Previous version of $package used the standard IO mechanisms as
4065 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4066 alternate IO mechanisms via the PerlIO abstraction layer, but the
4067 stdio mechanism is still available if needed.  The abstraction layer
4068 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4069 Using PerlIO with sfio may cause problems with some extension modules.
4070
4071 If this doesn't make any sense to you, just accept the default '$dflt'.
4072 EOM
4073 rp='Use the PerlIO abstraction layer?'
4074 . ./myread
4075 case "$ans" in
4076 y|Y)
4077         val="$define"
4078         ;;
4079 *)
4080         echo "Ok, doing things the stdio way."
4081         val="$undef"
4082         ;;
4083 esac
4084 set useperlio
4085 eval $setvar
4086
4087 case "$usesocks" in
4088 $define|true|[yY]*)
4089         case "$useperlio" in
4090         $define|true|[yY]*) ;;
4091         *)      cat >&4 <<EOM
4092
4093 You are using the SOCKS proxy protocol library which means that you
4094 should also use the PerlIO layer.  You may be headed for trouble.
4095
4096 EOM
4097                 ;;
4098         esac
4099         ;;
4100 esac
4101
4102 : get the patchlevel
4103 echo " "
4104 echo "Getting the current patchlevel..." >&4
4105 if $test -r $rsrc/patchlevel.h;then
4106         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4107         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4108         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4109         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4110         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4111         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4112         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4113 else
4114         revision=0
4115         patchlevel=0
4116         subversion=0
4117         api_revision=0
4118         api_version=0
4119         api_subversion=0
4120         perl_patchlevel=0
4121         $echo "(You do not have patchlevel.h.  Eek.)"
4122 fi
4123 if $test -r $rsrc/.patch ; then
4124         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4125                 perl_patchlevel=`cat $rsrc/.patch`
4126         fi
4127 fi
4128 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4129 version_patchlevel_string="version $patchlevel subversion $subversion"
4130 case "$perl_patchlevel" in
4131 0|'') ;;
4132 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4133 esac
4134
4135 $echo "(You have $package $version_patchlevel_string.)"
4136
4137 case "$osname" in
4138 dos|vms)
4139         : XXX Should be a Configure test for double-dots in filenames.
4140         version=`echo $revision $patchlevel $subversion | \
4141                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4142         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4143                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4144         ;;
4145 *)
4146         version=`echo $revision $patchlevel $subversion | \
4147                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4148         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4149                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4150         ;;
4151 esac
4152 : Special case the 5.005_xx maintenance series, which used 5.005
4153 : without any subversion label as a subdirectory in $sitelib
4154 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4155         api_versionstring='5.005'
4156 fi
4157
4158 : Do we want threads support and if so, what type
4159 case "$usethreads" in
4160 $define|true|[yY]*)     dflt='y';;
4161 *)     # Catch case where user specified ithreads or 5005threads but
4162        # forgot -Dusethreads (A.D. 4/2002)
4163        case "$useithreads$use5005threads" in
4164        *$define*)
4165                 case "$useperlio" in
4166                 "$define")      dflt='y' ;;
4167                 *)              dflt='n' ;;
4168                 esac
4169                 ;;
4170        *)       dflt='n';;
4171        esac
4172        ;;
4173 esac
4174 cat <<EOM
4175
4176 Perl can be built to take advantage of threads on some systems.
4177 To do so, Configure can be run with -Dusethreads.
4178
4179 Note that Perl built with threading support runs slightly slower
4180 and uses more memory than plain Perl. The current implementation
4181 is believed to be stable, but it is fairly new, and so should be
4182 treated with caution.
4183
4184 If this doesn't make any sense to you, just accept the default '$dflt'.
4185 EOM
4186 rp='Build a threading Perl?'
4187 . ./myread
4188 case "$ans" in
4189 y|Y)    val="$define" ;;
4190 *)      val="$undef" ;;
4191 esac
4192 set usethreads
4193 eval $setvar
4194
4195 if $test $patchlevel -lt 9; then
4196     case "$usethreads" in
4197     $define)
4198         $cat <<EOM
4199
4200 Since release 5.6, Perl has had two different threading implementations,
4201 the newer interpreter-based version (ithreads) with one interpreter per
4202 thread, and the older 5.005 version (5005threads).
4203 The 5005threads version is effectively unmaintained and will probably be
4204 removed in Perl 5.10, so there should be no need to build a Perl using it
4205 unless needed for backwards compatibility with some existing 5.005threads
4206 code.
4207
4208 EOM
4209         : Default to ithreads unless overridden on command line or with
4210         : old config.sh
4211         dflt='y'
4212         case "$use5005threads" in
4213                 $define|true|[yY]*) dflt='n';;
4214         esac
4215         case "$useithreads" in
4216                 $undef|false|[nN]*) dflt='n';;
4217         esac
4218         rp='Use the newer interpreter-based ithreads?'
4219         . ./myread
4220         case "$ans" in
4221         y|Y)    val="$define" ;;
4222         *)      val="$undef" ;;
4223         esac
4224         set useithreads
4225         eval $setvar
4226         : Now set use5005threads to the opposite value.
4227         case "$useithreads" in
4228         $define) val="$undef" ;;
4229         *) val="$define" ;;
4230         esac
4231         set use5005threads
4232         eval $setvar
4233         ;;
4234     *)
4235         useithreads="$undef"
4236         use5005threads="$undef"
4237         ;;
4238     esac
4239
4240     case "$useithreads$use5005threads" in
4241     "$define$define")
4242         $cat >&4 <<EOM
4243
4244 You cannot have both the ithreads and the 5.005 threads enabled
4245 at the same time.  Disabling the 5.005 threads since they are
4246 much less stable than the ithreads.
4247
4248 EOM
4249         use5005threads="$undef"
4250         ;;
4251     esac
4252
4253 else
4254 : perl-5.9.x and later
4255
4256     if test X"$usethreads" = "X$define"; then
4257         case "$use5005threads" in
4258             $define|true|[yY]*)
4259                 $cat >&4 <<EOM
4260
4261 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4262
4263 EOM
4264             ;;
4265         esac
4266     fi
4267
4268     use5005threads="$undef"
4269     useithreads="$usethreads"
4270 fi
4271
4272 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4273         cat >&4 <<EOF
4274 ***
4275 *** To build with ithreads you must also use the PerlIO layer.
4276 *** Cannot continue, aborting.
4277 ***
4278 EOF
4279         exit 1
4280 fi
4281
4282 case "$d_oldpthreads" in
4283 '')     : Configure tests would be welcome here.  For now, assume undef.
4284         val="$undef" ;;
4285 *)      val="$d_oldpthreads" ;;
4286 esac
4287 set d_oldpthreads
4288 eval $setvar
4289
4290
4291 : Look for a hint-file generated 'call-back-unit'.  If the
4292 : user has specified that a threading perl is to be built,
4293 : we may need to set or change some other defaults.
4294 if $test -f usethreads.cbu; then
4295     echo "Your platform has some specific hints regarding threaded builds, using them..."
4296     . ./usethreads.cbu
4297 else
4298     case "$usethreads" in
4299         "$define"|true|[yY]*)
4300                 $cat <<EOM
4301 (Your platform does not have any specific hints for threaded builds.
4302  Assuming POSIX threads, then.)
4303 EOM
4304         ;;
4305     esac
4306 fi
4307
4308 : Check if multiplicity is required
4309 cat <<EOM
4310
4311 Perl can be built so that multiple Perl interpreters can coexist
4312 within the same Perl executable.
4313 EOM
4314
4315 case "$useithreads" in
4316 $define)
4317         cat <<EOM
4318 This multiple interpreter support is required for interpreter-based threads.
4319 EOM
4320         val="$define"
4321         ;;
4322 *)      case "$usemultiplicity" in
4323         $define|true|[yY]*)     dflt='y';;
4324         *) dflt='n';;
4325         esac
4326         echo " "
4327         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4328         rp='Build Perl for multiplicity?'
4329         . ./myread
4330         case "$ans" in
4331         y|Y)    val="$define" ;;
4332         *)      val="$undef" ;;
4333         esac
4334         ;;
4335 esac
4336 set usemultiplicity
4337 eval $setvar
4338
4339 : Check if morebits is requested
4340 case "$usemorebits" in
4341 "$define"|true|[yY]*)
4342         use64bitint="$define"
4343         uselongdouble="$define"
4344         usemorebits="$define"
4345         ;;
4346 *)      usemorebits="$undef"
4347         ;;
4348 esac
4349
4350 : Determine the C compiler to be used
4351 echo " "
4352 case "$cc" in
4353 '') dflt=cc;;
4354 *) dflt="$cc";;
4355 esac
4356 rp="Use which C compiler?"
4357 . ./myread
4358 cc="$ans"
4359
4360 : See whether they have no cc but they do have gcc
4361 . ./trygcc
4362 if $test -f cc.cbu; then
4363     . ./cc.cbu
4364 fi
4365 . ./checkcc
4366
4367 : make some quick guesses about what we are up against
4368 echo " "
4369 $echo $n "Hmm...  $c"
4370 echo exit 1 >bsd
4371 echo exit 1 >usg
4372 echo exit 1 >v7
4373 echo exit 1 >osf1
4374 echo exit 1 >eunice
4375 echo exit 1 >xenix
4376 echo exit 1 >venix
4377 echo exit 1 >os2
4378 d_bsd="$undef"
4379 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4380 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4381 then
4382         echo "Looks kind of like an OSF/1 system, but we'll see..."
4383         echo exit 0 >osf1
4384 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4385         xxx=`./loc addbib blurfl $pth`
4386         if $test -f $xxx; then
4387         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4388                 echo exit 0 >bsd
4389                 echo exit 0 >usg
4390         else
4391                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4392                         echo "Looks kind of like an extended USG system, but we'll see..."
4393                 else
4394                         echo "Looks kind of like a USG system, but we'll see..."
4395                 fi
4396                 echo exit 0 >usg
4397         fi
4398 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4399         echo "Looks kind of like a BSD system, but we'll see..."
4400         d_bsd="$define"
4401         echo exit 0 >bsd
4402 else
4403         echo "Looks kind of like a Version 7 system, but we'll see..."
4404         echo exit 0 >v7
4405 fi
4406 case "$eunicefix" in
4407 *unixtovms*)
4408         $cat <<'EOI'
4409 There is, however, a strange, musty smell in the air that reminds me of
4410 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4411 EOI
4412         echo exit 0 >eunice
4413         d_eunice="$define"
4414 : it so happens the Eunice I know will not run shell scripts in Unix format
4415         ;;
4416 *)
4417         echo " "
4418         echo "Congratulations.  You aren't running Eunice."
4419         d_eunice="$undef"
4420         ;;
4421 esac
4422 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4423 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4424 : semicolon as a patch separator
4425 case "$p_" in
4426 :) ;;
4427 *)
4428         $cat <<'EOI'
4429 I have the feeling something is not exactly right, however...don't tell me...
4430 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4431 (Or you may be running DOS with DJGPP.)
4432 EOI
4433         echo exit 0 >os2
4434         ;;
4435 esac
4436 if test -f /xenix; then
4437         echo "Actually, this looks more like a XENIX system..."
4438         echo exit 0 >xenix
4439         d_xenix="$define"
4440 else
4441         echo " "
4442         echo "It's not Xenix..."
4443         d_xenix="$undef"
4444 fi
4445 chmod +x xenix
4446 $eunicefix xenix
4447 if test -f /venix; then
4448         echo "Actually, this looks more like a VENIX system..."
4449         echo exit 0 >venix
4450 else
4451         echo " "
4452         if ./xenix; then
4453                 : null
4454         else
4455                 echo "Nor is it Venix..."
4456         fi
4457 fi
4458 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4459 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4460 $rm -f foo
4461
4462 : Check if we are using GNU gcc and what its version is
4463 echo " "
4464 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4465 $cat >try.c <<EOM
4466 #include <stdio.h>
4467 int main() {
4468 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4469 #ifdef __VERSION__
4470         printf("%s\n", __VERSION__);
4471 #else
4472         printf("%s\n", "1");
4473 #endif
4474 #endif
4475         return(0);
4476 }
4477 EOM
4478 if $cc -o try $ccflags $ldflags try.c; then
4479         gccversion=`$run ./try`
4480         case "$gccversion" in
4481         '') echo "You are not using GNU cc." ;;
4482         *)  echo "You are using GNU cc $gccversion."
4483             ccname=gcc
4484             ;;
4485         esac
4486 else
4487         echo " "
4488         echo "*** WHOA THERE!!! ***" >&4
4489         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4490         case "$knowitall" in
4491         '')
4492         echo "    You'd better start hunting for one and let me know about it." >&4
4493                 exit 1
4494                 ;;
4495         esac
4496 fi
4497 $rm -f try try.*
4498 case "$gccversion" in
4499 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4500 esac
4501 case "$gccversion" in
4502 '') gccosandvers='' ;;
4503 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4504    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4505    gccshortvers=''
4506    case "$gccosandvers" in
4507    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4508    $osname$osvers) ;; # looking good
4509    $osname*) cat <<EOM >&4
4510
4511 *** WHOA THERE!!! ***
4512
4513     Your gcc has not been compiled for the exact release of
4514     your operating system ($gccosandvers versus $osname$osvers).
4515
4516     In general it is a good idea to keep gcc synchronized with
4517     the operating system because otherwise serious problems
4518     may ensue when trying to compile software, like Perl.
4519
4520     I'm trying to be optimistic here, though, and will continue.
4521     If later during the configuration and build icky compilation
4522     problems appear (headerfile conflicts being the most common
4523     manifestation), I suggest reinstalling the gcc to match
4524     your operating system release.
4525
4526 EOM
4527       ;;
4528    *) gccosandvers='' ;; # failed to parse, better be silent
4529    esac
4530    ;;
4531 esac
4532 case "$ccname" in
4533 '') ccname="$cc" ;;
4534 esac
4535
4536 # gcc 3.* complain about adding -Idirectories that they already know about,
4537 # so we will take those off from locincpth.
4538 case "$gccversion" in
4539 3*)
4540     echo "main(){}">try.c
4541     for incdir in $locincpth; do
4542        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4543              grep '^c[cp]p*[01]: warning: changing search order '`
4544        if test "X$warn" != X; then
4545            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4546        fi
4547     done
4548     $rm -f try try.*
4549 esac
4550
4551 : What should the include directory be ?
4552 echo " "
4553 $echo $n "Hmm...  $c"
4554 dflt='/usr/include'
4555 incpath=''
4556 mips_type=''
4557 if $test -f /bin/mips && /bin/mips; then
4558         echo "Looks like a MIPS system..."
4559         $cat >usr.c <<'EOCP'
4560 #ifdef SYSTYPE_BSD43
4561 /bsd43
4562 #endif
4563 EOCP
4564         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4565                 dflt='/bsd43/usr/include'
4566                 incpath='/bsd43'
4567                 mips_type='BSD 4.3'
4568         else
4569                 mips_type='System V'
4570         fi
4571         $rm -f usr.c usr.out
4572         echo "and you're compiling with the $mips_type compiler and libraries."
4573         xxx_prompt=y
4574         echo "exit 0" >mips
4575 else
4576         echo "Doesn't look like a MIPS system."
4577         xxx_prompt=n
4578         echo "exit 1" >mips
4579 fi
4580 chmod +x mips
4581 $eunicefix mips
4582 case "$usrinc" in
4583 '') ;;
4584 *) dflt="$usrinc";;
4585 esac
4586 case "$xxx_prompt" in
4587 y)      fn=d/
4588         echo " "
4589         rp='Where are the include files you want to use?'
4590         . ./getfile
4591         usrinc="$ans"
4592         ;;
4593 *)      usrinc="$dflt"
4594         ;;
4595 esac
4596
4597 : see how we invoke the C preprocessor
4598 echo " "
4599 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4600 cat <<'EOT' >testcpp.c
4601 #define ABC abc
4602 #define XYZ xyz
4603 ABC.XYZ
4604 EOT
4605 cd ..
4606 if test ! -f cppstdin; then
4607         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4608                 # AIX cc -E doesn't show the absolute headerfile
4609                 # locations but we'll cheat by using the -M flag.
4610                 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
4611         else
4612                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4613         fi
4614 else
4615         echo "Keeping your $hint cppstdin wrapper."
4616 fi
4617 chmod 755 cppstdin
4618 wrapper=`pwd`/cppstdin
4619 ok='false'
4620 cd UU
4621
4622 if $test "X$cppstdin" != "X" && \
4623         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4624         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4625 then
4626         echo "You used to use $cppstdin $cppminus so we'll use that again."
4627         case "$cpprun" in
4628         '') echo "But let's see if we can live without a wrapper..." ;;
4629         *)
4630                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4631                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4632                 then
4633                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4634                         ok='true'
4635                 else
4636                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4637                 fi
4638                 ;;
4639         esac
4640 else
4641         case "$cppstdin" in
4642         '') ;;
4643         *)
4644                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4645                 ;;
4646         esac
4647 fi
4648
4649 if $ok; then
4650         : nothing
4651 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4652         $cc -E <testcpp.c >testcpp.out 2>&1; \
4653         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4654         echo "Yup, it does."
4655         x_cpp="$cc -E"
4656         x_minus='';
4657 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4658         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4659         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4660         echo "Yup, it does."
4661         x_cpp="$cc -E"
4662         x_minus='-';
4663 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4664         $cc -P <testcpp.c >testcpp.out 2>&1; \
4665         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4666         echo "Yipee, that works!"
4667         x_cpp="$cc -P"
4668         x_minus='';
4669 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4670         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4671         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4672         echo "At long last!"
4673         x_cpp="$cc -P"
4674         x_minus='-';
4675 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4676         $cpp <testcpp.c >testcpp.out 2>&1; \
4677         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4678         echo "It works!"
4679         x_cpp="$cpp"
4680         x_minus='';
4681 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4682         $cpp - <testcpp.c >testcpp.out 2>&1; \
4683         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4684         echo "Hooray, it works!  I was beginning to wonder."
4685         x_cpp="$cpp"
4686         x_minus='-';
4687 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4688         $wrapper <testcpp.c >testcpp.out 2>&1; \
4689         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4690         x_cpp="$wrapper"
4691         x_minus=''
4692         echo "Eureka!"
4693 else
4694         dflt=''
4695         rp="No dice.  I can't find a C preprocessor.  Name one:"
4696         . ./myread
4697         x_cpp="$ans"
4698         x_minus=''
4699         $x_cpp <testcpp.c >testcpp.out 2>&1
4700         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4701                 echo "OK, that will do." >&4
4702         else
4703 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4704                 exit 1
4705         fi
4706 fi
4707
4708 case "$ok" in
4709 false)
4710         cppstdin="$x_cpp"
4711         cppminus="$x_minus"
4712         cpprun="$x_cpp"
4713         cpplast="$x_minus"
4714         set X $x_cpp
4715         shift
4716         case "$1" in
4717         "$cpp")
4718                 echo "Perhaps can we force $cc -E using a wrapper..."
4719                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4720                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4721                 then
4722                         echo "Yup, we can."
4723                         cppstdin="$wrapper"
4724                         cppminus='';
4725                 else
4726                         echo "Nope, we'll have to live without it..."
4727                 fi
4728                 ;;
4729         esac
4730         case "$cpprun" in
4731         "$wrapper")
4732                 cpprun=''
4733                 cpplast=''
4734                 ;;
4735         esac
4736         ;;
4737 esac
4738
4739 case "$cppstdin" in
4740 "$wrapper"|'cppstdin') ;;
4741 *) $rm -f $wrapper;;
4742 esac
4743 $rm -f testcpp.c testcpp.out
4744
4745 : Set private lib path
4746 case "$plibpth" in
4747 '') if ./mips; then
4748                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4749         fi;;
4750 esac
4751 case "$libpth" in
4752 ' ') dlist='';;
4753 '') dlist="$loclibpth $plibpth $glibpth";;
4754 *) dlist="$libpth";;
4755 esac
4756
4757 : Now check and see which directories actually exist, avoiding duplicates
4758 libpth=''
4759 for xxx in $dlist
4760 do
4761     if $test -d $xxx; then
4762                 case " $libpth " in
4763                 *" $xxx "*) ;;
4764                 *) libpth="$libpth $xxx";;
4765                 esac
4766     fi
4767 done
4768 $cat <<'EOM'
4769
4770 Some systems have incompatible or broken versions of libraries.  Among
4771 the directories listed in the question below, please remove any you
4772 know not to be holding relevant libraries, and add any that are needed.
4773 Say "none" for none.
4774
4775 EOM
4776 case "$libpth" in
4777 '') dflt='none';;
4778 *)
4779         set X $libpth
4780         shift
4781         dflt=${1+"$@"}
4782         ;;
4783 esac
4784 rp="Directories to use for library searches?"
4785 . ./myread
4786 case "$ans" in
4787 none) libpth=' ';;
4788 *) libpth="$ans";;
4789 esac
4790
4791 : compute shared library extension
4792 case "$so" in
4793 '')
4794         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4795                 dflt='sl'
4796         else
4797                 dflt='so'
4798         fi
4799         ;;
4800 *) dflt="$so";;
4801 esac
4802 $cat <<EOM
4803
4804 On some systems, shared libraries may be available.  Answer 'none' if
4805 you want to suppress searching of shared libraries for the remainder
4806 of this configuration.
4807
4808 EOM
4809 rp='What is the file extension used for shared libraries?'
4810 . ./myread
4811 so="$ans"
4812
4813 : Define several unixisms.
4814 : Hints files or command line option can be used to override them.
4815 : The convoluted testing is in case hints files set either the old
4816 : or the new name.
4817 case "$_exe" in
4818 '')     case "$exe_ext" in
4819         '')     ;;
4820         *)      _exe="$exe_ext" ;;
4821         esac
4822         ;;
4823 esac
4824 case "$_a" in
4825 '')     case "$lib_ext" in
4826     '') _a='.a';;
4827         *)      _a="$lib_ext" ;;
4828         esac
4829         ;;
4830 esac
4831 case "$_o" in
4832 '') case "$obj_ext" in
4833         '')     _o='.o';;
4834         *)      _o="$obj_ext";;
4835         esac
4836         ;;
4837 esac
4838 case "$p_" in
4839 '') case "$path_sep" in
4840         '')     p_=':';;
4841         *)      p_="$path_sep";;
4842         esac
4843         ;;
4844 esac
4845 exe_ext=$_exe
4846 lib_ext=$_a
4847 obj_ext=$_o
4848 path_sep=$p_
4849
4850 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4851
4852 : Which makefile gets called first.  This is used by make depend.
4853 case "$firstmakefile" in
4854 '') firstmakefile='makefile';;
4855 esac
4856
4857 : Check for uselongdouble support
4858 case "$ccflags" in
4859 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4860 esac
4861
4862 case "$uselongdouble" in
4863 $define|true|[yY]*)     dflt='y';;
4864 *) dflt='n';;
4865 esac
4866 cat <<EOM
4867
4868 Perl can be built to take advantage of long doubles which
4869 (if available) may give more accuracy and range for floating point numbers.
4870
4871 If this doesn't make any sense to you, just accept the default '$dflt'.
4872 EOM
4873 rp='Try to use long doubles if available?'
4874 . ./myread
4875 case "$ans" in
4876 y|Y)    val="$define"   ;;
4877 *)      val="$undef"    ;;
4878 esac
4879 set uselongdouble
4880 eval $setvar
4881
4882 case "$uselongdouble" in
4883 true|[yY]*) uselongdouble="$define" ;;
4884 esac
4885
4886 : Look for a hint-file generated 'call-back-unit'.  If the
4887 : user has specified that long doubles should be used,
4888 : we may need to set or change some other defaults.
4889 if $test -f uselongdouble.cbu; then
4890     echo "Your platform has some specific hints regarding long doubles, using them..."
4891     . ./uselongdouble.cbu
4892 else
4893     case "$uselongdouble" in
4894         $define)
4895                 $cat <<EOM
4896 (Your platform does not have any specific hints for long doubles.)
4897 EOM
4898         ;;
4899     esac
4900 fi
4901
4902 : Looking for optional libraries
4903 echo " "
4904 echo "Checking for optional libraries..." >&4
4905 case "$libs" in
4906 ' '|'') dflt='';;
4907 *) dflt="$libs";;
4908 esac
4909 case "$libswanted" in
4910 '') libswanted='c_s';;
4911 esac
4912 case "$usesocks" in
4913 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4914 esac
4915 libsfound=''
4916 libsfiles=''
4917 libsdirs=''
4918 libspath=''
4919 for thisdir in $libpth $xlibpth; do
4920   test -d $thisdir && libspath="$libspath $thisdir"
4921 done
4922 for thislib in $libswanted; do
4923         for thisdir in $libspath; do
4924             xxx=''
4925             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4926                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4927                 $test -f "$xxx" && eval $libscheck
4928                 $test -f "$xxx" && libstyle=shared
4929             fi
4930             if test ! -f "$xxx"; then
4931                 xxx=$thisdir/lib$thislib.$so
4932                 $test -f "$xxx" && eval $libscheck
4933                 $test -f "$xxx" && libstyle=shared
4934             fi
4935             if test ! -f "$xxx"; then
4936                 xxx=$thisdir/lib$thislib$_a
4937                 $test -f "$xxx" && eval $libscheck
4938                 $test -f "$xxx" && libstyle=static
4939             fi
4940             if test ! -f "$xxx"; then
4941                 xxx=$thisdir/$thislib$_a
4942                 $test -f "$xxx" && eval $libscheck
4943                 $test -f "$xxx" && libstyle=static
4944             fi
4945             if test ! -f "$xxx"; then
4946                 xxx=$thisdir/lib${thislib}_s$_a
4947                 $test -f "$xxx" && eval $libscheck
4948                 $test -f "$xxx" && libstyle=static
4949                 $test -f "$xxx" && thislib=${thislib}_s
4950             fi
4951             if test ! -f "$xxx"; then
4952                 xxx=$thisdir/Slib$thislib$_a
4953                 $test -f "$xxx" && eval $libscheck
4954                 $test -f "$xxx" && libstyle=static
4955             fi
4956             if $test -f "$xxx"; then
4957                 case "$libstyle" in
4958                 shared) echo "Found -l$thislib (shared)." ;;
4959                 static) echo "Found -l$thislib." ;;
4960                 *)      echo "Found -l$thislib ($libstyle)." ;;
4961                 esac
4962                 case " $dflt " in
4963                 *"-l$thislib "*);;
4964                 *) dflt="$dflt -l$thislib"
4965                    libsfound="$libsfound $xxx"
4966                    yyy=`basename $xxx`
4967                    libsfiles="$libsfiles $yyy"
4968                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4969                    case " $libsdirs " in
4970                    *" $yyy "*) ;;
4971                    *) libsdirs="$libsdirs $yyy" ;;
4972                    esac
4973                    ;;
4974                 esac
4975                 break
4976             fi
4977         done
4978         if $test ! -f "$xxx"; then
4979             echo "No -l$thislib."
4980         fi
4981 done
4982 set X $dflt
4983 shift
4984 dflt="$*"
4985 case "$libs" in
4986 '') dflt="$dflt";;
4987 *) dflt="$libs";;
4988 esac
4989 case "$dflt" in
4990 ' '|'') dflt='none';;
4991 esac
4992
4993 $cat <<EOM
4994
4995 In order to compile $package on your machine, a number of libraries
4996 are usually needed.  Include any other special libraries here as well.
4997 Say "none" for none.  The default list is almost always right.
4998 EOM
4999
5000 echo " "
5001 rp="What libraries to use?"
5002 . ./myread
5003 case "$ans" in
5004 none) libs=' ';;
5005 *) libs="$ans";;
5006 esac
5007
5008 : determine optimization, if desired, or use for debug flag also
5009 case "$optimize" in
5010 ' '|$undef) dflt='none';;
5011 '') dflt='-O';;
5012 *) dflt="$optimize";;
5013 esac
5014 $cat <<EOH
5015
5016 By default, $package compiles with the -O flag to use the optimizer.
5017 Alternately, you might want to use the symbolic debugger, which uses
5018 the -g flag (on traditional Unix systems).  Either flag can be
5019 specified here.  To use neither flag, specify the word "none".
5020
5021 EOH
5022 rp="What optimizer/debugger flag should be used?"
5023 . ./myread
5024 optimize="$ans"
5025 case "$optimize" in
5026 'none') optimize=" ";;
5027 esac
5028
5029 : Check what DEBUGGING is required from the command line
5030 : -DEBUGGING      or -DDEBUGGING or
5031 : -DEBUGGING=both                       = -g + -DDEBUGGING
5032 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5033 : -DEBUGGING=none or -UDEBUGGING        =
5034 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5035 case "$EBUGGING" in
5036 '')     ;;
5037 *)      DEBUGGING=$EBUGGING ;;
5038 esac
5039
5040 case "$DEBUGGING" in
5041 -g|both|$define)
5042     case "$optimize" in
5043         *-g*) ;;
5044         *)    optimize="$optimize -g" ;;
5045     esac ;;
5046 none|$undef)
5047     case "$optimize" in
5048         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5049                 shift
5050                 optimize="$*"
5051                 ;;
5052     esac ;;
5053 esac
5054
5055 dflt=''
5056 case "$DEBUGGING" in
5057 both|$define) dflt='-DDEBUGGING'
5058 esac
5059
5060 : argument order is deliberate, as the flag will start with - which set could
5061 : think is an option
5062 checkccflag='check=$1; flag=$2; callback=$3;
5063 echo " ";
5064 echo "Checking if your compiler accepts $flag" 2>&1;
5065 echo "int main(void) { return 0; }" > gcctest.c;
5066 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5067     echo "Yes, it does." 2>&1;
5068     if $test -s gcctest.out ; then
5069         echo "But your platform does not like it:";
5070         cat gcctest.out;
5071     else
5072         case "$ccflags" in
5073         *$check*)
5074             echo "Leaving current flags $ccflags alone." 2>&1
5075             ;;
5076         *) dflt="$dflt $flag";
5077             eval $callback
5078             ;;
5079         esac
5080     fi
5081 else
5082     echo "Nope, it does not, but that is ok." 2>&1;
5083 fi
5084 '
5085
5086 : We will not override a previous value, but we might want to
5087 : augment a hint file
5088 case "$hint" in
5089 default|recommended)
5090         case "$gccversion" in
5091         1*) dflt="$dflt -fpcc-struct-return" ;;
5092         esac
5093         case "$optimize:$DEBUGGING" in
5094         *-g*:old) dflt="$dflt -DDEBUGGING";;
5095         esac
5096         case "$gccversion" in
5097         2*) if $test -d /etc/conf/kconfig.d &&
5098                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5099                 then
5100                         # Interactive Systems (ISC) POSIX mode.
5101                         dflt="$dflt -posix"
5102                 fi
5103                 ;;
5104         esac
5105         case "$gccversion" in
5106         1*) ;;
5107         2.[0-8]*) ;;
5108         ?*)     set strict-aliasing -fno-strict-aliasing
5109                 eval $checkccflag
5110                 ;;
5111         esac
5112         # For gcc, adding -pipe speeds up compilations for some, but apparently
5113         # some assemblers can't read from stdin.  (It also slows down compilations
5114         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5115         case "$gccversion" in
5116         ?*)     set pipe -pipe
5117                 eval $checkccflag
5118                 ;;
5119         esac
5120
5121         # on x86_64 (at least) we require an extra library (libssp) in the
5122         # link command line. This library is not named, so I infer that it is
5123         # an implementation detail that may change. Hence the safest approach
5124         # is to add the flag to the flags passed to the compiler at link time,
5125         # as that way the compiler can do the right implementation dependant
5126         # thing. (NWC)
5127         case "$gccversion" in
5128         ?*)     set stack-protector -fstack-protector
5129                 eval $checkccflag
5130                 ;;
5131         esac
5132         ;;
5133 esac
5134
5135 case "$mips_type" in
5136 *BSD*|'') inclwanted="$locincpth $usrinc";;
5137 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5138 esac
5139 for thisincl in $inclwanted; do
5140         if $test -d $thisincl; then
5141                 if $test x$thisincl != x$usrinc; then
5142                         case "$dflt" in
5143                         *" -I$thisincl "*);;
5144                         *) dflt="$dflt -I$thisincl ";;
5145                         esac
5146                 fi
5147         fi
5148 done
5149
5150 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5151         xxx=true;
5152 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5153         xxx=true;
5154 else
5155         xxx=false;
5156 fi;
5157 if $xxx; then
5158         case "$dflt" in
5159         *$2*);;
5160         *) dflt="$dflt -D$2";;
5161         esac;
5162 fi'
5163
5164 set signal.h LANGUAGE_C; eval $inctest
5165
5166 case "$usesocks" in
5167 $define)
5168         ccflags="$ccflags -DSOCKS"
5169         ;;
5170 esac
5171
5172 case "$hint" in
5173 default|recommended) dflt="$ccflags $dflt" ;;
5174 *) dflt="$ccflags";;
5175 esac
5176
5177 case "$dflt" in
5178 ''|' ') dflt=none;;
5179 esac
5180
5181 $cat <<EOH
5182
5183 Your C compiler may want other flags.  For this question you should include
5184 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5185 but you should NOT include libraries or ld flags like -lwhatever.  If you
5186 want $package to honor its debug switch, you should include -DDEBUGGING here.
5187 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5188
5189 To use no flags, specify the word "none".
5190
5191 EOH
5192 set X $dflt
5193 shift
5194 dflt=${1+"$@"}
5195 rp="Any additional cc flags?"
5196 . ./myread
5197 case "$ans" in
5198 none) ccflags='';;
5199 *) ccflags="$ans";;
5200 esac
5201
5202 : the following weeds options from ccflags that are of no interest to cpp
5203 case "$cppflags" in
5204 '') cppflags="$ccflags" ;;
5205 *)  cppflags="$cppflags $ccflags" ;;
5206 esac
5207 case "$gccversion" in
5208 1*) cppflags="$cppflags -D__GNUC__"
5209 esac
5210 case "$mips_type" in
5211 '');;
5212 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5213 esac
5214 case "$cppflags" in
5215 '');;
5216 *)
5217         echo " "
5218         echo "Let me guess what the preprocessor flags are..." >&4
5219         set X $cppflags
5220         shift
5221         cppflags=''
5222         $cat >cpp.c <<'EOM'
5223 #define BLURFL foo
5224
5225 BLURFL xx LFRULB
5226 EOM
5227         previous=''
5228         for flag in $*
5229         do
5230                 case "$flag" in
5231                 -*) ftry="$flag";;
5232                 *) ftry="$previous $flag";;
5233                 esac
5234                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5235                         >cpp1.out 2>/dev/null && \
5236                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5237                         >cpp2.out 2>/dev/null && \
5238                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5239                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5240                 then
5241                         cppflags="$cppflags $ftry"
5242                         previous=''
5243                 else
5244                         previous="$flag"
5245                 fi
5246         done
5247         set X $cppflags
5248         shift
5249         cppflags=${1+"$@"}
5250         case "$cppflags" in
5251         *-*)  echo "They appear to be: $cppflags";;
5252         esac
5253         $rm -f cpp.c cpp?.out
5254         ;;
5255 esac
5256
5257 : flags used in final linking phase
5258 case "$ldflags" in
5259 '') if ./venix; then
5260                 dflt='-i -z'
5261         else
5262                 dflt=''
5263         fi
5264         case "$ccflags" in
5265         *-posix*) dflt="$dflt -posix" ;;
5266         esac
5267         ;;
5268 *) dflt="$ldflags";;
5269 esac
5270 # See note above about -fstack-protector
5271 case "$ccflags" in
5272 *-fstack-protector*) 
5273         case "$dflt" in
5274         *-fstack-protector*) ;; # Don't add it again
5275         *) dflt="$dflt -fstack-protector" ;; 
5276         esac
5277         ;;
5278 esac
5279
5280 : Try to guess additional flags to pick up local libraries.
5281 for thislibdir in $libpth; do
5282         case " $loclibpth " in
5283         *" $thislibdir "*)
5284                 case "$dflt " in
5285                 *"-L$thislibdir "*) ;;
5286                 *)  dflt="$dflt -L$thislibdir" ;;
5287                 esac
5288                 ;;
5289         esac
5290 done
5291
5292 case "$dflt" in
5293 '') dflt='none' ;;
5294 esac
5295
5296 $cat <<EOH
5297
5298 Your C linker may need flags.  For this question you should
5299 include -L/whatever and any other flags used by the C linker, but you
5300 should NOT include libraries like -lwhatever.
5301
5302 Make sure you include the appropriate -L/path flags if your C linker
5303 does not normally search all of the directories you specified above,
5304 namely
5305         $libpth
5306 To use no flags, specify the word "none".
5307
5308 EOH
5309
5310 rp="Any additional ld flags (NOT including libraries)?"
5311 . ./myread
5312 case "$ans" in
5313 none) ldflags='';;
5314 *) ldflags="$ans";;
5315 esac
5316 rmlist="$rmlist pdp11"
5317
5318 : coherency check
5319 echo " "
5320 echo "Checking your choice of C compiler and flags for coherency..." >&4
5321 $cat > try.c <<'EOF'
5322 #include <stdio.h>
5323 int main() { printf("Ok\n"); return(0); }
5324 EOF
5325 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5326 shift
5327 $cat >try.msg <<'EOM'
5328 I've tried to compile and run the following simple program:
5329
5330 EOM
5331 $cat try.c >> try.msg
5332
5333 $cat >> try.msg <<EOM
5334
5335 I used the command:
5336
5337         $*
5338         $run ./try
5339
5340 and I got the following output:
5341
5342 EOM
5343 dflt=y
5344 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5345         if $sh -c "$run ./try " >>try.msg 2>&1; then
5346                 xxx=`$run ./try`
5347                 case "$xxx" in
5348                 "Ok") dflt=n ;;
5349                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5350                         case " $libs " in
5351                         *" -lsfio "*)
5352                                 cat >> try.msg <<'EOQS'
5353 If $libs contains -lsfio, and sfio is mis-configured, then it
5354 sometimes (apparently) runs and exits with a 0 status, but with no
5355 output!  It may have to do with sfio's use of _exit vs. exit.
5356
5357 EOQS
5358                                 rp="You have a big problem.  Shall I abort Configure"
5359                                 dflt=y
5360                                 ;;
5361                         esac
5362                         ;;
5363                 esac
5364         else
5365                 echo "The program compiled OK, but exited with status $?." >>try.msg
5366                 rp="You have a problem.  Shall I abort Configure"
5367                 dflt=y
5368         fi
5369 else
5370         echo "I can't compile the test program." >>try.msg
5371         rp="You have a BIG problem.  Shall I abort Configure"
5372         dflt=y
5373 fi
5374 case "$dflt" in
5375 y)
5376         $cat try.msg >&4
5377         case "$knowitall" in
5378         '')
5379                 echo "(The supplied flags or libraries might be incorrect.)"
5380                 ;;
5381         *) dflt=n;;
5382         esac
5383         echo " "
5384         . ./myread
5385         case "$ans" in
5386         n*|N*) ;;
5387         *)      echo "Ok.  Stopping Configure." >&4
5388                 exit 1
5389                 ;;
5390         esac
5391         ;;
5392 n) echo "OK, that should do.";;
5393 esac
5394 $rm_try gcctest gcctest.out
5395
5396 : define a shorthand compile call
5397 compile='
5398 mc_file=$1;
5399 shift;
5400 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5401 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5402 exit 1;
5403 fi;
5404 esac;
5405 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5406 : define a shorthand compile call for compilations that should be ok.
5407 compile_ok='
5408 mc_file=$1;
5409 shift;
5410 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5411
5412 : determine filename position in cpp output
5413 echo " "
5414 echo "Computing filename position in cpp output for #include directives..." >&4
5415 case "$osname" in
5416 vos) testaccess=-e ;;
5417 *)   testaccess=-r ;;
5418 esac
5419 echo '#include <stdio.h>' > foo.c
5420 $cat >fieldn <<EOF
5421 $startsh
5422 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5423 $grep '^[       ]*#.*stdio\.h' | \
5424 while read cline; do
5425         pos=1
5426         set \$cline
5427         while $test \$# -gt 0; do
5428                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5429                         echo "\$pos"
5430                         exit 0
5431                 fi
5432                 shift
5433                 pos=\`expr \$pos + 1\`
5434         done
5435 done
5436 EOF
5437 chmod +x fieldn
5438 fieldn=`./fieldn`
5439 $rm -f foo.c fieldn
5440 case $fieldn in
5441 '') pos='???';;
5442 1) pos=first;;
5443 2) pos=second;;
5444 3) pos=third;;
5445 *) pos="${fieldn}th";;
5446 esac
5447 echo "Your cpp writes the filename in the $pos field of the line."
5448
5449 case "$osname" in
5450 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5451 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5452 *)   cppfilter='' ;;
5453 esac
5454 : locate header file
5455 $cat >findhdr <<EOF
5456 $startsh
5457 wanted=\$1
5458 name=''
5459 for usrincdir in $usrinc
5460 do
5461         if test -f \$usrincdir/\$wanted; then
5462                 echo "\$usrincdir/\$wanted"
5463                 exit 0
5464         fi
5465 done
5466 awkprg='{ print \$$fieldn }'
5467 echo "#include <\$wanted>" > foo\$\$.c
5468 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5469 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5470 while read cline; do
5471         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5472         case "\$name" in
5473         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5474         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5475         *) exit 2;;
5476         esac;
5477 done;
5478 #
5479 # status = 0: grep returned 0 lines, case statement not executed
5480 # status = 1: headerfile found
5481 # status = 2: while loop executed, no headerfile found
5482 #
5483 status=\$?
5484 $rm -f foo\$\$.c;
5485 if test \$status -eq 1; then
5486         exit 0;
5487 fi
5488 exit 1
5489 EOF
5490 chmod +x findhdr
5491
5492 : define an alternate in-header-list? function
5493 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5494 cont=true; xxf="echo \"<\$1> found.\" >&4";
5495 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5496 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5497 esac;
5498 case $# in 4) instead=instead;; *) instead="at last";; esac;
5499 while $test "$cont"; do
5500         xxx=`./findhdr $1`
5501         var=$2; eval "was=\$$2";
5502         if $test "$xxx" && $test -r "$xxx";
5503         then eval $xxf;
5504         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5505                 cont="";
5506         else eval $xxnf;
5507         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5508         set $yyy; shift; shift; yyy=$@;
5509         case $# in 0) cont="";;
5510         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5511                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5512         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5513                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5514         esac;
5515 done;
5516 while $test "$yyy";
5517 do set $yyy; var=$2; eval "was=\$$2";
5518         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5519         set $yyy; shift; shift; yyy=$@;
5520 done'
5521
5522 : see if stdlib is available
5523 set stdlib.h i_stdlib
5524 eval $inhdr
5525
5526 : check for lengths of integral types
5527 echo " "
5528 case "$intsize" in
5529 '')
5530         echo "Checking to see how big your integers are..." >&4
5531         $cat >try.c <<EOCP
5532 #include <stdio.h>
5533 #$i_stdlib I_STDLIB
5534 #ifdef I_STDLIB
5535 #include <stdlib.h>
5536 #endif
5537 int main()
5538 {
5539         printf("intsize=%d;\n", (int)sizeof(int));
5540         printf("longsize=%d;\n", (int)sizeof(long));
5541         printf("shortsize=%d;\n", (int)sizeof(short));
5542         exit(0);
5543 }
5544 EOCP
5545         set try
5546         if eval $compile_ok && $run ./try > /dev/null; then
5547                 eval `$run ./try`
5548                 echo "Your integers are $intsize bytes long."
5549                 echo "Your long integers are $longsize bytes long."
5550                 echo "Your short integers are $shortsize bytes long."
5551         else
5552                 $cat >&4 <<EOM
5553 !
5554 Help! I can't compile and run the intsize test program: please enlighten me!
5555 (This is probably a misconfiguration in your system or libraries, and
5556 you really ought to fix it.  Still, I'll try anyway.)
5557 !
5558 EOM
5559                 dflt=4
5560                 rp="What is the size of an integer (in bytes)?"
5561                 . ./myread
5562                 intsize="$ans"
5563                 dflt=$intsize
5564                 rp="What is the size of a long integer (in bytes)?"
5565                 . ./myread
5566                 longsize="$ans"
5567                 dflt=2
5568                 rp="What is the size of a short integer (in bytes)?"
5569                 . ./myread
5570                 shortsize="$ans"
5571         fi
5572         ;;
5573 esac
5574 $rm_try
5575
5576 : check for long long
5577 echo " "
5578 echo "Checking to see if you have long long..." >&4
5579 echo 'int main() { long long x = 7; return 0; }' > try.c
5580 set try
5581 if eval $compile; then
5582         val="$define"
5583         echo "You have long long."
5584 else
5585         val="$undef"
5586         echo "You do not have long long."
5587 fi
5588 $rm_try
5589 set d_longlong
5590 eval $setvar
5591
5592 : check for length of long long
5593 case "${d_longlong}${longlongsize}" in
5594 $define)
5595         echo " "
5596         echo "Checking to see how big your long longs are..." >&4
5597         $cat >try.c <<'EOCP'
5598 #include <stdio.h>
5599 int main()
5600 {
5601     printf("%d\n", (int)sizeof(long long));
5602     return(0);
5603 }
5604 EOCP
5605         set try
5606         if eval $compile_ok; then
5607                 longlongsize=`$run ./try`
5608                 echo "Your long longs are $longlongsize bytes long."
5609         else
5610                 dflt='8'
5611                 echo " "
5612                 echo "(I can't seem to compile the test program.  Guessing...)"
5613                 rp="What is the size of a long long (in bytes)?"
5614                 . ./myread
5615                 longlongsize="$ans"
5616         fi
5617         if $test "X$longsize" = "X$longlongsize"; then
5618                 echo "(That isn't any different from an ordinary long.)"
5619         fi
5620         ;;
5621 esac
5622 $rm_try
5623
5624 : see if inttypes.h is available
5625 : we want a real compile instead of Inhdr because some systems
5626 : have an inttypes.h which includes non-existent headers
5627 echo " "
5628 $cat >try.c <<EOCP
5629 #include <inttypes.h>
5630 int main() {
5631         static int32_t foo32 = 0x12345678;
5632 }
5633 EOCP
5634 set try
5635 if eval $compile; then
5636         echo "<inttypes.h> found." >&4
5637         val="$define"
5638 else
5639         echo "<inttypes.h> NOT found." >&4
5640         val="$undef"
5641 fi
5642 $rm_try
5643 set i_inttypes
5644 eval $setvar
5645
5646 : check for int64_t
5647 echo " "
5648 echo "Checking to see if you have int64_t..." >&4
5649 $cat >try.c <<EOCP
5650 #include <sys/types.h>
5651 #$i_inttypes I_INTTYPES
5652 #ifdef I_INTTYPES
5653 #include <inttypes.h>
5654 #endif
5655 int main() { int64_t x = 7; }
5656 EOCP
5657 set try
5658 if eval $compile; then
5659         val="$define"
5660         echo "You have int64_t."
5661 else
5662         val="$undef"
5663         echo "You do not have int64_t."
5664 fi
5665 $rm_try
5666 set d_int64_t
5667 eval $setvar
5668
5669 : Check if 64bit ints have a quad type
5670 echo " "
5671 echo "Checking which 64-bit integer type we could use..." >&4
5672
5673 case "$intsize" in
5674 8) val=int
5675    set quadtype
5676    eval $setvar
5677    val='"unsigned int"'
5678    set uquadtype
5679    eval $setvar
5680    quadkind=1
5681    ;;
5682 *) case "$longsize" in
5683    8) val=long
5684       set quadtype
5685       eval $setvar
5686       val='"unsigned long"'
5687       set uquadtype
5688       eval $setvar
5689       quadkind=2
5690       ;;
5691    *) case "$d_longlong:$longlongsize" in
5692       define:8)
5693         val='"long long"'
5694         set quadtype
5695         eval $setvar
5696         val='"unsigned long long"'
5697         set uquadtype
5698         eval $setvar
5699         quadkind=3
5700         ;;
5701       *) case "$d_int64_t" in
5702          define)
5703            val=int64_t
5704            set quadtype
5705            eval $setvar
5706            val=uint64_t
5707            set uquadtype
5708            eval $setvar
5709            quadkind=4
5710            ;;
5711          esac
5712          ;;
5713       esac
5714       ;;
5715    esac
5716    ;;
5717 esac
5718
5719 case "$quadtype" in
5720 '')     echo "Alas, no 64-bit integer types in sight." >&4
5721         d_quad="$undef"
5722         ;;
5723 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5724         d_quad="$define"
5725         ;;
5726 esac
5727
5728 : Do we want 64bit support
5729 case "$uselonglong" in
5730 "$define"|true|[yY]*)
5731         cat <<EOM >&4
5732
5733 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5734 EOM
5735         use64bitint="$define"
5736         ;;
5737 esac
5738 case "$use64bits" in
5739 "$define"|true|[yY]*)
5740         cat <<EOM >&4
5741
5742 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5743 EOM
5744         use64bitint="$define"
5745         ;;
5746 esac
5747 case "$use64bitints" in
5748 "$define"|true|[yY]*)
5749         cat <<EOM >&4
5750
5751 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5752 EOM
5753         use64bitint="$define"
5754         ;;
5755 esac
5756 case "$use64bitsint" in
5757 "$define"|true|[yY]*)
5758         cat <<EOM >&4
5759
5760 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5761 EOM
5762         use64bitint="$define"
5763         ;;
5764 esac
5765 case "$uselonglongs" in
5766 "$define"|true|[yY]*)
5767         cat <<EOM >&4
5768
5769 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5770 EOM
5771         use64bitint="$define"
5772         ;;
5773 esac
5774 case "$use64bitsall" in
5775 "$define"|true|[yY]*)
5776         cat <<EOM >&4
5777
5778 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5779 EOM
5780         use64bitall="$define"
5781         ;;
5782 esac
5783
5784 case "$ccflags" in
5785 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5786 esac
5787 case "$use64bitall" in
5788 "$define"|true|[yY]*) use64bitint="$define" ;;
5789 esac
5790
5791 case "$longsize" in
5792 8) cat <<EOM
5793
5794 You have natively 64-bit long integers.
5795 EOM
5796    val="$define"
5797    ;;
5798 *) case "$use64bitint" in
5799    "$define"|true|[yY]*) dflt='y';;
5800    *) dflt='n';;
5801    esac
5802    case "$d_quad" in
5803    "$define") ;;
5804    *) dflt='n' ;;
5805    esac
5806    cat <<EOM
5807
5808 Perl can be built to take advantage of 64-bit integer types
5809 on some systems.  To do so, Configure can be run with -Duse64bitint.
5810 Choosing this option will most probably introduce binary incompatibilities.
5811
5812 If this doesn't make any sense to you, just accept the default '$dflt'.
5813 (The default has been chosen based on your configuration.)
5814 EOM
5815    rp='Try to use 64-bit integers, if available?'
5816    . ./myread
5817    case "$ans" in
5818    [yY]*) val="$define" ;;
5819    *)     val="$undef"  ;;
5820    esac
5821    ;;
5822 esac
5823 set use64bitint
5824 eval $setvar
5825
5826 case "$use64bitall" in
5827 "$define"|true|[yY]*) dflt='y' ;;
5828 *) case "$longsize" in
5829    8) dflt='y' ;;
5830    *) dflt='n' ;;
5831    esac
5832    ;;
5833 esac
5834 cat <<EOM
5835
5836 You may also choose to try maximal 64-bitness.  It means using as much
5837 64-bitness as possible on the platform.  This in turn means even more
5838 binary incompatibilities.  On the other hand, your platform may not
5839 have any more 64-bitness available than what you already have chosen.
5840
5841 If this doesn't make any sense to you, just accept the default '$dflt'.
5842 (The default has been chosen based on your configuration.)
5843 EOM
5844 rp='Try to use maximal 64-bit support, if available?'
5845 . ./myread
5846 case "$ans" in
5847 [yY]*) val="$define" ;;
5848 *)     val="$undef"  ;;
5849 esac
5850 set use64bitall
5851 eval $setvar
5852 case "$use64bitall" in
5853 "$define")
5854         case "$use64bitint" in
5855         "$undef")
5856                 cat <<EOM
5857
5858 Since you have chosen a maximally 64-bit build, I'm also turning on
5859 the use of 64-bit integers.
5860 EOM
5861                 use64bitint="$define" ;;
5862         esac
5863         ;;
5864 esac
5865
5866 : Look for a hint-file generated 'call-back-unit'.  If the
5867 : user has specified that a 64-bit perl is to be built,
5868 : we may need to set or change some other defaults.
5869 if $test -f use64bitint.cbu; then
5870         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5871         . ./use64bitint.cbu
5872 fi
5873 case "$use64bitint" in
5874 "$define"|true|[yY]*)
5875         case "$longsize" in
5876         4) case "$archname64" in
5877            '') archname64=64int ;;
5878            esac
5879            ;;
5880         esac
5881         ;;
5882 esac
5883
5884 : Look for a hint-file generated 'call-back-unit'.  If the
5885 : user has specified that a maximally 64-bit perl is to be built,
5886 : we may need to set or change some other defaults.
5887 if $test -f use64bitall.cbu; then
5888         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5889         . ./use64bitall.cbu
5890 fi
5891 case "$use64bitall" in
5892 "$define"|true|[yY]*)
5893         case "$longsize" in
5894         4) case "$archname64" in
5895            ''|64int) archname64=64all ;;
5896            esac
5897            ;;
5898         esac
5899         ;;
5900 esac
5901
5902 case "$d_quad:$use64bitint" in
5903 $undef:$define)
5904         cat >&4 <<EOF
5905
5906 *** You have chosen to use 64-bit integers,
5907 *** but none can be found.
5908 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5909 *** Cannot continue, aborting.
5910
5911 EOF
5912         exit 1
5913         ;;
5914 esac
5915
5916 : check for length of double
5917 echo " "
5918 case "$doublesize" in
5919 '')
5920         echo "Checking to see how big your double precision numbers are..." >&4
5921         $cat >try.c <<EOCP
5922 #include <stdio.h>
5923 #$i_stdlib I_STDLIB
5924 #ifdef I_STDLIB
5925 #include <stdlib.h>
5926 #endif
5927 int main()
5928 {
5929     printf("%d\n", (int)sizeof(double));
5930     exit(0);
5931 }
5932 EOCP
5933         set try
5934         if eval $compile_ok; then
5935                 doublesize=`$run ./try`
5936                 echo "Your double is $doublesize bytes long."
5937         else
5938                 dflt='8'
5939                 echo "(I can't seem to compile the test program.  Guessing...)"
5940                 rp="What is the size of a double precision number (in bytes)?"
5941                 . ./myread
5942                 doublesize="$ans"
5943         fi
5944         ;;
5945 esac
5946 $rm_try
5947
5948 : check for long doubles
5949 echo " "
5950 echo "Checking to see if you have long double..." >&4
5951 echo 'int main() { long double x = 7.0; }' > try.c
5952 set try
5953 if eval $compile; then
5954         val="$define"
5955         echo "You have long double."
5956 else
5957         val="$undef"
5958         echo "You do not have long double."
5959 fi
5960 $rm_try
5961 set d_longdbl
5962 eval $setvar
5963
5964 : check for length of long double
5965 case "${d_longdbl}${longdblsize}" in
5966 $define)
5967         echo " "
5968         echo "Checking to see how big your long doubles are..." >&4
5969         $cat >try.c <<'EOCP'
5970 #include <stdio.h>
5971 int main()
5972 {
5973         printf("%d\n", sizeof(long double));
5974 }
5975 EOCP
5976         set try
5977         set try
5978         if eval $compile; then
5979                 longdblsize=`$run ./try`
5980                 echo "Your long doubles are $longdblsize bytes long."
5981         else
5982                 dflt='8'
5983                 echo " "
5984                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5985                 rp="What is the size of a long double (in bytes)?"
5986                 . ./myread
5987                 longdblsize="$ans"
5988         fi
5989         if $test "X$doublesize" = "X$longdblsize"; then
5990                 echo "That isn't any different from an ordinary double."
5991                 echo "I'll keep your setting anyway, but you may see some"
5992                 echo "harmless compilation warnings."
5993         fi
5994         ;;
5995 esac
5996 $rm_try
5997
5998 : determine the architecture name
5999 echo " "
6000 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6001         tarch=`arch`"-$osname"
6002 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6003         if uname -m > tmparch 2>&1 ; then
6004                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6005                         -e 's/$/'"-$osname/" tmparch`
6006         else
6007                 tarch="$osname"
6008         fi
6009         $rm -f tmparch
6010 else
6011         tarch="$osname"
6012 fi
6013 case "$myarchname" in
6014 ''|"$tarch") ;;
6015 *)
6016         echo "(Your architecture name used to be $myarchname.)"
6017         archname=''
6018         ;;
6019 esac
6020 case "$targetarch" in
6021 '') ;;
6022 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6023 esac
6024 myarchname="$tarch"
6025 case "$archname" in
6026 '') dflt="$tarch";;
6027 *) dflt="$archname";;
6028 esac
6029 rp='What is your architecture name'
6030 . ./myread
6031 archname="$ans"
6032 case "$usethreads" in
6033 $define)
6034         echo "Threads selected." >&4
6035         case "$archname" in
6036         *-thread*) echo "...and architecture name already has -thread." >&4
6037                 ;;
6038         *)      archname="$archname-thread"
6039                 echo "...setting architecture name to $archname." >&4
6040                 ;;
6041         esac
6042         ;;
6043 esac
6044 case "$usemultiplicity" in
6045 $define)
6046         echo "Multiplicity selected." >&4
6047         case "$archname" in
6048         *-multi*) echo "...and architecture name already has -multi." >&4
6049                 ;;
6050         *)      archname="$archname-multi"
6051                 echo "...setting architecture name to $archname." >&4
6052                 ;;
6053         esac
6054         ;;
6055 esac
6056 case "$use64bitint$use64bitall" in
6057 *"$define"*)
6058         case "$archname64" in
6059         '')
6060                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6061                 ;;
6062         *)
6063                 case "$use64bitint" in
6064                 "$define") echo "64 bit integers selected." >&4 ;;
6065                 esac
6066                 case "$use64bitall" in
6067                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6068                 esac
6069                 case "$archname" in
6070                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6071                         ;;
6072                 *)      archname="$archname-$archname64"
6073                         echo "...setting architecture name to $archname." >&4
6074                         ;;
6075                 esac
6076                 ;;
6077         esac
6078 esac
6079 case "$uselongdouble" in
6080 $define)
6081         echo "Long doubles selected." >&4
6082         case "$longdblsize" in
6083         $doublesize)
6084                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6085                 ;;
6086         *)
6087                 case "$archname" in
6088                 *-ld*) echo "...and architecture name already has -ld." >&4
6089                         ;;
6090                 *)      archname="$archname-ld"
6091                         echo "...setting architecture name to $archname." >&4
6092                         ;;
6093                 esac
6094                 ;;
6095         esac
6096         ;;
6097 esac
6098 case "$useperlio" in
6099 $define)
6100         echo "Perlio selected." >&4
6101         ;;
6102 *)
6103         echo "Perlio not selected, using stdio." >&4
6104         case "$archname" in
6105         *-stdio*) echo "...and architecture name already has -stdio." >&4
6106                 ;;
6107         *)      archname="$archname-stdio"
6108                 echo "...setting architecture name to $archname." >&4
6109                 ;;
6110         esac
6111         ;;
6112 esac
6113 if $test -f archname.cbu; then
6114         echo "Your platform has some specific hints for architecture name, using them..."
6115         . ./archname.cbu
6116 fi
6117
6118 : set the prefixit variable, to compute a suitable default value
6119 prefixit='case "$3" in
6120 ""|none)
6121         case "$oldprefix" in
6122         "") eval "$1=\"\$$2\"";;
6123         *)
6124                 case "$3" in
6125                 "") eval "$1=";;
6126                 none)
6127                         eval "tp=\"\$$2\"";
6128                         case "$tp" in
6129                         ""|" ") eval "$1=\"\$$2\"";;
6130                         *) eval "$1=";;
6131                         esac;;
6132                 esac;;
6133         esac;;
6134 *)
6135         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6136         case "$tp" in
6137         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6138         /*-$oldprefix/*|\~*-$oldprefix/*)
6139                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6140         *) eval "$1=\"\$$2\"";;
6141         esac;;
6142 esac'
6143
6144 : determine installation style
6145 : For now, try to deduce it from prefix unless it is already set.
6146 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6147 case "$installstyle" in
6148 '')     case "$prefix" in
6149                 *perl*) dflt='lib';;
6150                 *) dflt='lib/perl5' ;;
6151         esac
6152         ;;
6153 *)      dflt="$installstyle" ;;
6154 esac
6155 : Probably not worth prompting for this since we prompt for all
6156 : the directories individually, and the prompt would be too long and
6157 : confusing anyway.
6158 installstyle=$dflt
6159
6160 : determine where public executables go
6161 echo " "
6162 set dflt bin bin
6163 eval $prefixit
6164 fn=d~
6165 rp='Pathname where the public executables will reside?'
6166 . ./getfile
6167 if $test "X$ansexp" != "X$binexp"; then
6168         installbin=''
6169 fi
6170 prefixvar=bin
6171 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6172 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6173 :     this via initialinstalllocation
6174 . ./setprefixvar
6175
6176 case "$userelocatableinc" in
6177 $define|true|[yY]*)     dflt='y' ;;
6178 *)                      dflt='n' ;;
6179 esac
6180 cat <<EOM
6181
6182 Would you like to build Perl so that the installation is relocatable, so that
6183 library paths in @INC are determined relative to the path of the perl binary?
6184 This is not advised for system Perl installs, or if you need to run setid
6185 scripts or scripts under taint mode.
6186
6187 If this doesn't make any sense to you, just accept the default '$dflt'.
6188 EOM
6189 rp='Use relocatable @INC?'
6190 . ./myread
6191 case "$ans" in
6192 y|Y)    val="$define" ;;
6193 *)      val="$undef"  ;;
6194 esac
6195 set userelocatableinc
6196 eval $setvar
6197
6198 initialinstalllocation="$binexp"
6199 : Default prefix is now "up one level from where the binaries are"
6200 case "$userelocatableinc" in
6201 $define|true|[yY]*)
6202     bin=".../"
6203     binexp=".../"
6204     prefix=".../.."
6205     prefixexp=".../.."
6206     installprefixexp=".../.."
6207     ;;
6208 esac
6209
6210 : determine where private library files go
6211 : Usual default is /usr/local/lib/perl5/$version.
6212 : Also allow things like /opt/perl/lib/$version, since
6213 : /opt/perl/lib/perl5... would be redundant.
6214 : The default "style" setting is made in installstyle.U
6215 case "$installstyle" in
6216 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6217 *)       set dflt privlib lib/$version ;;
6218 esac
6219 eval $prefixit
6220 $cat <<EOM
6221
6222 There are some auxiliary files for $package that need to be put into a
6223 private library directory that is accessible by everyone.
6224
6225 EOM
6226 fn=$binexp
6227 fn=d~+
6228 rp='Pathname where the private library files will reside?'
6229 . ./getfile
6230 prefixvar=privlib
6231 . ./setprefixvar
6232
6233 : set the prefixup variable, to restore leading tilda escape
6234 prefixup='case "$prefixexp" in
6235 "$prefix") ;;
6236 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6237 esac'
6238
6239 : determine where public architecture dependent libraries go
6240 set archlib archlib
6241 eval $prefixit
6242 : privlib default is /usr/local/lib/$package/$version
6243 : archlib default is /usr/local/lib/$package/$version/$archname
6244 : privlib may have an optional trailing /share.
6245 tdflt=`echo $privlib | $sed 's,/share$,,'`
6246 tdflt=$tdflt/$archname
6247 case "$archlib" in
6248 '')     dflt=$tdflt
6249         ;;
6250 *)      dflt="$archlib"
6251     ;;
6252 esac
6253 $cat <<EOM
6254
6255 $spackage contains architecture-dependent library files.  If you are
6256 sharing libraries in a heterogeneous environment, you might store
6257 these files in a separate location.  Otherwise, you can just include
6258 them with the rest of the public library files.
6259
6260 EOM
6261 fn=$binexp
6262 fn=d+~
6263 rp='Where do you want to put the public architecture-dependent libraries?'
6264 . ./getfile
6265 prefixvar=archlib
6266 . ./setprefixvar
6267 if $test X"$archlib" = X"$privlib"; then
6268         d_archlib="$undef"
6269 else
6270         d_archlib="$define"
6271 fi
6272
6273 : see if setuid scripts can be secure
6274 $cat <<EOM
6275
6276 Some kernels have a bug that prevents setuid #! scripts from being
6277 secure.  Some sites have disabled setuid #! scripts because of this.
6278
6279 First let's decide if your kernel supports secure setuid #! scripts.
6280 (If setuid #! scripts would be secure but have been disabled anyway,
6281 don't say that they are secure if asked.)
6282
6283 EOM
6284
6285 val="$undef"
6286 if $test -d /dev/fd; then
6287         echo "#!$ls" >reflect
6288         chmod +x,u+s reflect
6289         ./reflect >flect 2>&1
6290         if $contains "/dev/fd" flect >/dev/null; then
6291                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6292                 val="$define"
6293         else
6294                 $cat <<EOM
6295 If you are not sure if they are secure, I can check but I'll need a
6296 username and password different from the one you are using right now.
6297 If you don't have such a username or don't want me to test, simply
6298 enter 'none'.
6299
6300 EOM
6301                 rp='Other username to test security of setuid scripts with?'
6302                 dflt='none'
6303                 . ./myread
6304                 case "$ans" in
6305                 n|none)
6306                         case "$d_suidsafe" in
6307                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6308                                 dflt=n;;
6309                         "$undef")
6310                                 echo "Well, the $hint value is *not* secure." >&4
6311                                 dflt=n;;
6312                         *)      echo "Well, the $hint value *is* secure." >&4
6313                                 dflt=y;;
6314                         esac
6315                         ;;
6316                 *)
6317                         $rm -f reflect flect
6318                         echo "#!$ls" >reflect
6319                         chmod +x,u+s reflect
6320                         echo >flect
6321                         chmod a+w flect
6322                         echo '"su" will (probably) prompt you for '"$ans's password."
6323                         su $ans -c './reflect >flect'
6324                         if $contains "/dev/fd" flect >/dev/null; then
6325                                 echo "Okay, it looks like setuid scripts are secure." >&4
6326                                 dflt=y
6327                         else
6328                                 echo "I don't think setuid scripts are secure." >&4
6329                                 dflt=n
6330                         fi
6331                         ;;
6332                 esac
6333                 rp='Does your kernel have *secure* setuid scripts?'
6334                 . ./myread
6335                 case "$ans" in
6336                 [yY]*)  val="$define";;
6337                 *)      val="$undef";;
6338                 esac
6339         fi
6340 else
6341         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6342         echo "(That's for file descriptors, not floppy disks.)"
6343         val="$undef"
6344 fi
6345 set d_suidsafe
6346 eval $setvar
6347
6348 $rm -f reflect flect
6349
6350 : now see if they want to do setuid emulation
6351 echo " "
6352 val="$undef"
6353 case "$d_suidsafe" in
6354 "$define")
6355         val="$undef"
6356         echo "No need to emulate SUID scripts since they are secure here." >&4
6357         ;;
6358 *)
6359         $cat <<EOM
6360 Some systems have disabled setuid scripts, especially systems where
6361 setuid scripts cannot be secure.  On systems where setuid scripts have
6362 been disabled, the setuid/setgid bits on scripts are currently
6363 useless.  It is possible for $package to detect those bits and emulate
6364 setuid/setgid in a secure fashion.  This emulation will only work if
6365 setuid scripts have been disabled in your kernel.
6366
6367 EOM
6368         case "$d_dosuid" in
6369         "$define") dflt=y ;;
6370         *) dflt=n ;;
6371         esac
6372         rp="Do you want to do setuid/setgid emulation?"
6373         . ./myread
6374         case "$ans" in
6375         [yY]*)  val="$define";;
6376         *)      val="$undef";;
6377         esac
6378         ;;
6379 esac
6380 set d_dosuid
6381 eval $setvar
6382
6383 : Find perl5.005 or later.
6384 echo "Looking for a previously installed perl5.005 or later... "
6385 case "$perl5" in
6386 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6387                 : Check if this perl is recent and can load a simple module
6388                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6389                         perl5=$tdir/perl
6390                         break;
6391                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6392                         perl5=$tdir/perl5
6393                         break;
6394                 fi
6395         done
6396         ;;
6397 *)      perl5="$perl5"
6398         ;;
6399 esac
6400 case "$perl5" in
6401 '')     echo "None found.  That's ok.";;
6402 *)      echo "Using $perl5." ;;
6403 esac
6404
6405 : Set the siteprefix variables
6406 $cat <<EOM
6407
6408 After $package is installed, you may wish to install various
6409 add-on modules and utilities.  Typically, these add-ons will
6410 be installed under $prefix with the rest
6411 of this package.  However, you may wish to install such add-ons
6412 elsewhere under a different prefix.
6413
6414 If you do not wish to put everything under a single prefix, that's
6415 ok.  You will be prompted for the individual locations; this siteprefix
6416 is only used to suggest the defaults.
6417
6418 The default should be fine for most people.
6419
6420 EOM
6421 fn=d~+
6422 rp='Installation prefix to use for add-on modules and utilities?'
6423 : XXX Here might be another good place for an installstyle setting.
6424 case "$siteprefix" in
6425 '') dflt=$prefix ;;
6426 *)  dflt=$siteprefix ;;
6427 esac
6428 . ./getfile
6429 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6430 oldsiteprefix=''
6431 case "$siteprefix" in
6432 '') ;;
6433 *)      case "$ans" in
6434         "$prefix") ;;
6435         *) oldsiteprefix="$prefix";;
6436         esac
6437         ;;
6438 esac
6439 siteprefix="$ans"
6440 siteprefixexp="$ansexp"
6441
6442 : determine where site specific libraries go.
6443 : Usual default is /usr/local/lib/perl5/site_perl/$version
6444 : The default "style" setting is made in installstyle.U
6445 : XXX No longer works with Prefixit stuff.
6446 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6447 case "$sitelib" in
6448 '') case "$installstyle" in
6449         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6450         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6451         esac
6452         ;;
6453 *)      dflt="$sitelib"
6454         ;;
6455 esac
6456 $cat <<EOM
6457
6458 The installation process will create a directory for
6459 site-specific extensions and modules.  Most users find it convenient
6460 to place all site-specific files in this directory rather than in the
6461 main distribution directory.
6462
6463 EOM
6464 fn=d~+
6465 rp='Pathname for the site-specific library files?'
6466 . ./getfile
6467 prefixvar=sitelib
6468 . ./setprefixvar
6469 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6470
6471 : Determine list of previous versions to include in @INC
6472 $cat > getverlist <<EOPL
6473 #!$perl5 -w
6474 use File::Basename;
6475 \$api_versionstring = "$api_versionstring";
6476 \$version = "$version";
6477 \$stem = "$sitelib_stem";
6478 \$archname = "$archname";
6479 EOPL
6480         $cat >> getverlist <<'EOPL'
6481 # The list found is store twice for each entry: the original name, and
6482 # the binary broken down version as pack "sss", so sorting is easy and
6483 # unambiguous. This will work for all versions that have a maximum of
6484 # three digit groups, separate by '.'s or '_'s. Names are extended with
6485 # ".0.0" to ensure at least three elements for the pack.
6486 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6487
6488 # Can't have leading @ because metaconfig interprets it as a command!
6489 ;@inc_version_list=();
6490 # XXX Redo to do opendir/readdir?
6491 if (-d $stem) {
6492     chdir($stem);
6493     ;@candidates = map {
6494         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6495 }
6496 else {
6497     ;@candidates = ();
6498 }
6499
6500 ($pversion, $aversion, $vsn5005) = map {
6501     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6502 foreach $d (@candidates) {
6503     if ($d->[1] lt $pversion) {
6504         if ($d->[1] ge $aversion) {
6505             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6506         }
6507         elsif ($d->[1] ge $vsn5005) {
6508             unshift(@inc_version_list, grep { -d } $d->[0]);
6509         }
6510     }
6511     else {
6512         # Skip newer version.  I.e. don't look in
6513         # 5.7.0 if we're installing 5.6.1.
6514     }
6515 }
6516
6517 if (@inc_version_list) {
6518     print join(' ', @inc_version_list);
6519 }
6520 else {
6521     # Blank space to preserve value for next Configure run.
6522     print " ";
6523 }
6524 EOPL
6525 chmod +x getverlist
6526 case "$inc_version_list" in
6527 '')     if test -x "$perl5$exe_ext"; then
6528                 dflt=`$perl5 getverlist`
6529         else
6530                 dflt='none'
6531         fi
6532         ;;
6533 $undef) dflt='none' ;;
6534 *)  eval dflt=\"$inc_version_list\" ;;
6535 esac
6536 case "$dflt" in
6537 ''|' ') dflt=none ;;
6538 esac
6539 case "$dflt" in
6540 5.005) dflt=none ;;
6541 esac
6542 $cat <<EOM
6543
6544 In order to ease the process of upgrading, this version of perl
6545 can be configured to use modules built and installed with earlier
6546 versions of perl that were installed under $prefix.  Specify here
6547 the list of earlier versions that this version of perl should check.
6548 If Configure detected no earlier versions of perl installed under
6549 $prefix, then the list will be empty.  Answer 'none' to tell perl
6550 to not search earlier versions.
6551
6552 The default should almost always be sensible, so if you're not sure,
6553 just accept the default.
6554 EOM
6555
6556 rp='List of earlier versions to include in @INC?'
6557 . ./myread
6558 case "$ans" in
6559 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6560 *) inc_version_list="$ans" ;;
6561 esac
6562 case "$inc_version_list" in
6563 ''|' ')
6564         inc_version_list_init='0'
6565         d_inc_version_list="$undef"
6566         ;;
6567 *)      inc_version_list_init=`echo $inc_version_list |
6568                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6569         d_inc_version_list="$define"
6570         ;;
6571 esac
6572 $rm -f getverlist
6573
6574 : see if malloc/malloc.h has to be included
6575 set malloc/malloc.h i_mallocmalloc
6576 eval $inhdr
6577
6578 : see if this is a malloc.h system
6579 : we want a real compile instead of Inhdr because some systems have a
6580 : malloc.h that just gives a compile error saying to use stdlib.h instead
6581 echo " "
6582 $cat >try.c <<EOCP
6583 #include <stdlib.h>
6584 #include <malloc.h>
6585 #$i_mallocmalloc I_MALLOCMALLOC
6586 #ifdef I_MALLOCMALLOC
6587 # include <malloc/malloc.h>
6588 #endif
6589
6590 int main () { return 0; }
6591 EOCP
6592 set try
6593 if eval $compile; then
6594     echo "<malloc.h> found." >&4
6595     val="$define"
6596 else
6597     echo "<malloc.h> NOT found." >&4
6598     val="$undef"
6599 fi
6600 $rm_try
6601 set i_malloc
6602 eval $setvar
6603
6604 : check for void type
6605 echo " "
6606 echo "Checking to see how well your C compiler groks the void type..." >&4
6607 case "$voidflags" in
6608 '')
6609         $cat >try.c <<EOCP
6610 #$i_stdlib I_STDLIB
6611 #ifdef I_STDLIB
6612 #include <stdlib.h>
6613 #endif
6614 #if TRY & 1
6615 void sub() {
6616 #else
6617 sub() {
6618 #endif
6619         extern void moo();      /* function returning void */
6620         void (*goo)();          /* ptr to func returning void */
6621 #if TRY & 8
6622         void *hue;              /* generic ptr */
6623 #endif
6624 #if TRY & 2
6625         void (*foo[10])();
6626 #endif
6627
6628 #if TRY & 4
6629         if(goo == moo) {
6630                 exit(0);
6631         }
6632 #endif
6633         exit(0);
6634 }
6635 int main() { sub(); }
6636 EOCP
6637         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6638                 voidflags=$defvoidused
6639         echo "Good.  It appears to support void to the level $package wants.">&4
6640                 if $contains warning .out >/dev/null 2>&1; then
6641                         echo "However, you might get some warnings that look like this:"
6642                         $cat .out
6643                 fi
6644         else
6645 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6646                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6647                         echo "It supports 1..."
6648                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6649                                 echo "It also supports 2..."
6650                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6651                                         voidflags=7
6652                                         echo "And it supports 4 but not 8 definitely."
6653                                 else
6654                                         echo "It doesn't support 4..."
6655                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6656                                                 voidflags=11
6657                                                 echo "But it supports 8."
6658                                         else
6659                                                 voidflags=3
6660                                                 echo "Neither does it support 8."
6661                                         fi
6662                                 fi
6663                         else
6664                                 echo "It does not support 2..."
6665                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6666                                         voidflags=13
6667                                         echo "But it supports 4 and 8."
6668                                 else
6669                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6670                                                 voidflags=5
6671                                                 echo "And it supports 4 but has not heard about 8."
6672                                         else
6673                                                 echo "However it supports 8 but not 4."
6674                                         fi
6675                                 fi
6676                         fi
6677                 else
6678                         echo "There is no support at all for void."
6679                         voidflags=0
6680                 fi
6681         fi
6682 esac
6683 case "$voidflags" in
6684 "$defvoidused") ;;
6685 *)      $cat >&4 <<'EOM'
6686   Support flag bits are:
6687     1: basic void declarations.
6688     2: arrays of pointers to functions returning void.
6689     4: operations between pointers to and addresses of void functions.
6690     8: generic void pointers.
6691 EOM
6692         dflt="$voidflags";
6693         rp="Your void support flags add up to what?"
6694         . ./myread
6695         voidflags="$ans"
6696         ;;
6697 esac
6698 $rm_try
6699
6700 : check for length of pointer
6701 echo " "
6702 case "$ptrsize" in
6703 '')
6704         echo "Checking to see how big your pointers are..." >&4
6705         if test "$voidflags" -gt 7; then
6706                 echo '#define VOID_PTR char *' > try.c
6707         else
6708                 echo '#define VOID_PTR void *' > try.c
6709         fi
6710         $cat >>try.c <<EOCP
6711 #include <stdio.h>
6712 #$i_stdlib I_STDLIB
6713 #ifdef I_STDLIB
6714 #include <stdlib.h>
6715 #endif
6716 int main()
6717 {
6718     printf("%d\n", (int)sizeof(VOID_PTR));
6719     exit(0);
6720 }
6721 EOCP
6722         set try
6723         if eval $compile_ok; then
6724                 ptrsize=`$run ./try`
6725                 echo "Your pointers are $ptrsize bytes long."
6726         else
6727                 dflt='4'
6728                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6729                 rp="What is the size of a pointer (in bytes)?"
6730                 . ./myread
6731                 ptrsize="$ans"
6732         fi
6733         ;;
6734 esac
6735 $rm_try
6736 case "$use64bitall" in
6737 "$define"|true|[yY]*)
6738         case "$ptrsize" in
6739         4)      cat <<EOM >&4
6740
6741 *** You have chosen a maximally 64-bit build,
6742 *** but your pointers are only 4 bytes wide.
6743 *** Please rerun Configure without -Duse64bitall.
6744 EOM
6745                 case "$d_quad" in
6746                 define)
6747                         cat <<EOM >&4
6748 *** Since you have quads, you could possibly try with -Duse64bitint.
6749 EOM
6750                         ;;
6751                 esac
6752                 cat <<EOM >&4
6753 *** Cannot continue, aborting.
6754
6755 EOM
6756
6757                 exit 1
6758                 ;;
6759         esac
6760         ;;
6761 esac
6762
6763
6764 : determine whether to use malloc wrapping
6765 echo " "
6766 case "$usemallocwrap" in
6767 [yY]*|true|$define)     dflt='y' ;;
6768 [nN]*|false|$undef)     dflt='n' ;;
6769 *)      case "$usedevel" in
6770         [yY]*|true|$define)     dflt='y' ;;
6771         *) dflt='n' ;;
6772         esac
6773         ;;
6774 esac
6775 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6776 . ./myread
6777 usemallocwrap="$ans"
6778 case "$ans" in
6779 y*|true)
6780         usemallocwrap="$define" ;;
6781 *)
6782         usemallocwrap="$undef" ;;
6783 esac
6784
6785 : determine which malloc to compile in
6786 echo " "
6787 case "$usemymalloc" in
6788 [yY]*|true|$define)     dflt='y' ;;
6789 [nN]*|false|$undef)     dflt='n' ;;
6790 *)      case "$ptrsize" in
6791         4) dflt='y' ;;
6792         *) dflt='n' ;;
6793         esac
6794         ;;
6795 esac
6796 rp="Do you wish to attempt to use the malloc that comes with $package?"
6797 . ./myread
6798 usemymalloc="$ans"
6799 case "$ans" in
6800 y*|true)
6801         usemymalloc='y'
6802         mallocsrc='malloc.c'
6803         mallocobj="malloc$_o"
6804         d_mymalloc="$define"
6805         case "$libs" in
6806         *-lmalloc*)
6807                 : Remove malloc from list of libraries to use
6808                 echo "Removing unneeded -lmalloc from library list" >&4
6809                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6810                 shift
6811                 libs="$*"
6812                 echo "libs = $libs" >&4
6813                 ;;
6814         esac
6815         ;;
6816 *)
6817         usemymalloc='n'
6818         mallocsrc=''
6819         mallocobj=''
6820         d_mymalloc="$undef"
6821         ;;
6822 esac
6823
6824 : compute the return types of malloc and free
6825 echo " "
6826 $cat >malloc.c <<END
6827 #$i_malloc I_MALLOC
6828 #$i_stdlib I_STDLIB
6829 #include <stdio.h>
6830 #include <sys/types.h>
6831 #ifdef I_MALLOC
6832 #include <malloc.h>
6833 #endif
6834 #ifdef I_STDLIB
6835 #include <stdlib.h>
6836 #endif
6837 #ifdef TRY_MALLOC
6838 void *malloc();
6839 #endif
6840 #ifdef TRY_FREE
6841 void free();
6842 #endif
6843 END
6844 case "$malloctype" in
6845 '')
6846         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6847                 malloctype='void *'
6848         else
6849                 malloctype='char *'
6850         fi
6851         ;;
6852 esac
6853 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6854
6855 case "$freetype" in
6856 '')
6857         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6858                 freetype='void'
6859         else
6860                 freetype='int'
6861         fi
6862         ;;
6863 esac
6864 echo "Your system uses $freetype free(), it would seem." >&4
6865 $rm -f malloc.[co]
6866 : determine where site specific architecture-dependent libraries go.
6867 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6868 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6869 : sitelib may have an optional trailing /share.
6870 case "$sitearch" in
6871 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6872         dflt="$dflt/$archname"
6873         ;;
6874 *)      dflt="$sitearch"
6875         ;;
6876 esac
6877 set sitearch sitearch none
6878 eval $prefixit
6879 $cat <<EOM
6880
6881 The installation process will also create a directory for
6882 architecture-dependent site-specific extensions and modules.
6883
6884 EOM
6885 fn=d~+
6886 rp='Pathname for the site-specific architecture-dependent library files?'
6887 . ./getfile
6888 prefixvar=sitearch
6889 . ./setprefixvar
6890 if $test X"$sitearch" = X"$sitelib"; then
6891         d_sitearch="$undef"
6892 else
6893         d_sitearch="$define"
6894 fi
6895
6896 : Set the vendorprefix variables
6897 $cat <<EOM
6898
6899 The installation process will also create a directory for
6900 vendor-supplied add-ons.  Vendors who supply perl with their system
6901 may find it convenient to place all vendor-supplied files in this
6902 directory rather than in the main distribution directory.  This will
6903 ease upgrades between binary-compatible maintenance versions of perl.
6904
6905 Of course you may also use these directories in whatever way you see
6906 fit.  For example, you might use them to access modules shared over a
6907 company-wide network.
6908
6909 The default answer should be fine for most people.
6910 This causes further questions about vendor add-ons to be skipped
6911 and no vendor-specific directories will be configured for perl.
6912
6913 EOM
6914 rp='Do you want to configure vendor-specific add-on directories?'
6915 case "$usevendorprefix" in
6916 define|true|[yY]*) dflt=y ;;
6917 *)      : User may have set vendorprefix directly on Configure command line.
6918         case "$vendorprefix" in
6919         ''|' ') dflt=n ;;
6920         *)      dflt=y ;;
6921         esac
6922         ;;
6923 esac
6924 . ./myread
6925 case "$ans" in
6926 [yY]*)  fn=d~+
6927         rp='Installation prefix to use for vendor-supplied add-ons?'
6928         case "$vendorprefix" in
6929         '') dflt='' ;;
6930         *)  dflt=$vendorprefix ;;
6931         esac
6932         . ./getfile
6933         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6934         oldvendorprefix=''
6935         case "$vendorprefix" in
6936         '') ;;
6937         *)      case "$ans" in
6938                 "$prefix") ;;
6939                 *) oldvendorprefix="$prefix";;
6940                 esac
6941                 ;;
6942         esac
6943         usevendorprefix="$define"
6944         vendorprefix="$ans"
6945         vendorprefixexp="$ansexp"
6946         ;;
6947 *)      usevendorprefix="$undef"
6948         vendorprefix=''
6949         vendorprefixexp=''
6950         ;;
6951 esac
6952
6953 : Set the vendorlib variables
6954 case "$vendorprefix" in
6955 '')     d_vendorlib="$undef"
6956         vendorlib=''
6957         vendorlibexp=''
6958         ;;
6959 *)      d_vendorlib="$define"
6960         : determine where vendor-supplied modules go.
6961         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6962         case "$vendorlib" in
6963         '')
6964                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6965                 case "$installstyle" in
6966                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6967                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6968                 esac
6969                 ;;
6970         *)      dflt="$vendorlib"
6971                 ;;
6972         esac
6973         fn=d~+
6974         rp='Pathname for the vendor-supplied library files?'
6975         . ./getfile
6976         vendorlib="$ans"
6977         vendorlibexp="$ansexp"
6978         ;;
6979 esac
6980 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6981 prefixvar=vendorlib
6982 . ./installprefix
6983
6984 : Set the vendorarch variables
6985 case "$vendorprefix" in
6986 '')     d_vendorarch="$undef"
6987         vendorarch=''
6988         vendorarchexp=''
6989         ;;
6990 *)      d_vendorarch="$define"
6991         : determine where vendor-supplied architecture-dependent libraries go.
6992         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6993         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6994         : vendorlib may have an optional trailing /share.
6995         case "$vendorarch" in
6996         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6997                 dflt="$dflt/$archname"
6998                 ;;
6999         *)      dflt="$vendorarch" ;;
7000         esac
7001         fn=d~+
7002         rp='Pathname for vendor-supplied architecture-dependent files?'
7003         . ./getfile
7004         vendorarch="$ans"
7005         vendorarchexp="$ansexp"
7006         ;;
7007 esac
7008 prefixvar=vendorarch
7009 . ./installprefix
7010
7011 : Final catch-all directories to search
7012 $cat <<EOM
7013
7014 Lastly, you can have perl look in other directories for extensions and
7015 modules in addition to those already specified.
7016 These directories will be searched after 
7017         $sitearch 
7018         $sitelib 
7019 EOM
7020 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7021 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7022 echo ' '
7023 case "$otherlibdirs" in
7024 ''|' ') dflt='none' ;;
7025 *)      dflt="$otherlibdirs" ;;
7026 esac
7027 $cat <<EOM
7028 Enter a colon-separated set of extra paths to include in perl's @INC
7029 search path, or enter 'none' for no extra paths.
7030
7031 EOM
7032
7033 rp='Colon-separated list of additional directories for perl to search?'
7034 . ./myread
7035 case "$ans" in
7036 ' '|''|none)    otherlibdirs=' ' ;;     
7037 *)      otherlibdirs="$ans" ;;
7038 esac
7039 case "$otherlibdirs" in
7040 ' ') val=$undef ;;
7041 *)      val=$define ;;
7042 esac
7043 set d_perl_otherlibdirs
7044 eval $setvar
7045
7046 : Cruising for prototypes
7047 echo " "
7048 echo "Checking out function prototypes..." >&4
7049 $cat >prototype.c <<EOCP
7050 #$i_stdlib I_STDLIB
7051 #ifdef I_STDLIB
7052 #include <stdlib.h>
7053 #endif
7054 int main(int argc, char *argv[]) {
7055         exit(0);}
7056 EOCP
7057 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7058         echo "Your C compiler appears to support function prototypes."
7059         val="$define"
7060 else
7061         echo "Your C compiler doesn't seem to understand function prototypes."
7062         val="$undef"
7063 fi
7064 set prototype
7065 eval $setvar
7066 $rm -f prototype*
7067
7068 : Check if ansi2knr is required
7069 case "$prototype" in
7070 "$define") ;;
7071 *)      ansi2knr='ansi2knr'
7072         echo " "
7073         cat <<EOM >&4
7074
7075 $me:  FATAL ERROR:
7076 This version of $package can only be compiled by a compiler that 
7077 understands function prototypes.  Unfortunately, your C compiler 
7078         $cc $ccflags
7079 doesn't seem to understand them.  Sorry about that.
7080
7081 If GNU cc is available for your system, perhaps you could try that instead.  
7082
7083 Eventually, we hope to support building Perl with pre-ANSI compilers.
7084 If you would like to help in that effort, please contact <perlbug@perl.org>.
7085
7086 Aborting Configure now.
7087 EOM
7088         exit 2
7089         ;;
7090 esac
7091
7092 : DTrace support
7093 dflt_dtrace='/usr/sbin/dtrace'
7094 cat <<EOM
7095
7096 Perl can be built to support DTrace on platforms that support it.
7097 DTrace is a diagnosis and performance analysis tool from Sun.
7098
7099 If this doesn't make any sense to you, just accept the default '$dflt'.
7100 EOM
7101
7102 while $test 1 ; do
7103         case "$usedtrace" in
7104         $define|true|[yY]*)
7105                 dflt='y'
7106                 ;;
7107         ?*)
7108                 dflt='y'
7109                 dflt_dtrace=$usedtrace
7110                 ;;
7111         *)
7112                 dflt='n'
7113                 ;;
7114         esac
7115
7116         rp='Support DTrace if available?'
7117         . ./myread
7118         case "$ans" in
7119         y|Y)    val="$define" ;;
7120         *)      val="$undef" ;;
7121         esac
7122         set usedtrace
7123         eval $setvar
7124
7125         test "X$usedtrace" != "X$define" && break
7126
7127         echo " "
7128         rp='Where is the dtrace executable?'
7129         dflt=$dflt_dtrace
7130         . ./getfile
7131         val="$ans"
7132         set dtrace
7133         eval $setvar
7134
7135         if $test -f $dtrace
7136         then
7137                 if $dtrace -h -s ../perldtrace.d \
7138                         -o perldtrace.tmp >/dev/null 2>&1 \
7139                         && rm -f perldtrace.tmp
7140                 then
7141                         echo " "
7142                         echo "Good: your $dtrace knows about the -h flag."
7143                 else
7144                         cat >&2 <<EOM
7145
7146 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7147 ***
7148 *** Your installed dtrace doesn't support the -h switch to compile a D
7149 *** program into a C header. Can't continue.
7150
7151 EOM
7152                         exit 1
7153                 fi
7154                 break;
7155         fi
7156
7157         case "$fastread" in
7158         yes)
7159                 cat >&2 <<EOM
7160
7161 *** $me:  Fatal Error:  $dtrace not found.
7162 *** Can't continue.
7163
7164 EOM
7165                 exit 1
7166                 ;;
7167         *)
7168                 echo "*** $dtrace was not found."
7169                 echo " "
7170                 ;;
7171         esac
7172 done
7173
7174 : See if we want extra modules installed
7175 echo " "
7176 case "$extras" in
7177 '') dflt='n';;
7178 *) dflt='y';;
7179 esac
7180 cat <<EOM
7181 Perl can be built with extra modules or bundles of modules which
7182 will be fetched from the CPAN and installed alongside Perl.
7183
7184 Notice that you will need access to the CPAN; either via the Internet,
7185 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7186 be asked later to configure the CPAN.pm module which will in turn do
7187 the installation of the rest of the extra modules or bundles.)
7188
7189 Notice also that if the modules require any external software such as
7190 libraries and headers (the libz library and the zlib.h header for the
7191 Compress::Zlib module, for example) you MUST have any such software
7192 already installed, this configuration process will NOT install such
7193 things for you.
7194
7195 If this doesn't make any sense to you, just accept the default '$dflt'.
7196 EOM
7197 rp='Install any extra modules (y or n)?'
7198 . ./myread
7199 case "$ans" in
7200 y|Y)
7201         cat <<EOM
7202
7203 Please list any extra modules or bundles to be installed from CPAN,
7204 with spaces between the names.  The names can be in any format the
7205 'install' command of CPAN.pm will understand.  (Answer 'none',
7206 without the quotes, to install no extra modules or bundles.)
7207 EOM
7208         rp='Extras?'
7209         dflt="$extras"
7210         . ./myread
7211         extras="$ans"
7212 esac
7213 case "$extras" in
7214 ''|'none')
7215         val=''
7216         $rm -f ../extras.lst
7217         ;;
7218 *)      echo "(Saving the list of extras for later...)"
7219         echo "$extras" > ../extras.lst
7220         val="'$extras'"
7221         ;;
7222 esac
7223 set extras
7224 eval $setvar
7225 echo " "
7226
7227 : determine where html pages for programs go
7228 set html1dir html1dir none
7229 eval $prefixit
7230 $cat <<EOM
7231
7232 If you wish to install html files for programs in $spackage, indicate
7233 the appropriate directory here.  To skip installing html files,
7234 answer "none".
7235 EOM
7236 case "$html1dir" in
7237 ''|none|$undef|' ') dflt=none ;;
7238 *) dflt=$html1dir ;;
7239 esac
7240 fn=dn+~
7241 rp="Directory for the main $spackage html pages?"
7242 . ./getfile
7243 prefixvar=html1dir
7244 . ./setprefixvar
7245 : Use ' ' for none so value is preserved next time through Configure
7246 $test X"$html1dir" = "X" && html1dir=' '
7247
7248 : determine where html pages for libraries and modules go
7249 set html3dir html3dir none
7250 eval $prefixit
7251 $cat <<EOM
7252
7253 If you wish to install html files for modules associated with $spackage,
7254 indicate the appropriate directory here.  To skip installing html files,
7255 answer "none".
7256 EOM
7257 : There is no obvious default.  If they have specified html1dir, then
7258 : try to key off that, possibly changing .../html1 into .../html3.
7259 case "$html3dir" in
7260 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7261 *) dflt=$html3dir ;;
7262 esac
7263 fn=dn+~
7264 rp="Directory for the $spackage module html pages?"
7265 . ./getfile
7266 prefixvar=html3dir
7267 . ./setprefixvar
7268 : Use ' ' for none so value is preserved next time through Configure
7269 $test X"$html3dir" = "X" && html3dir=' '
7270
7271 : determine whether to install perl also as /usr/bin/perl
7272
7273 echo " "
7274 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7275         $cat <<EOM
7276 Many scripts expect perl to be installed as /usr/bin/perl.
7277
7278 If you want to, I can install the perl you are about to compile
7279 as /usr/bin/perl (in addition to $bin/perl).
7280 EOM
7281         if test -f /usr/bin/perl; then
7282             $cat <<EOM
7283
7284 However, please note that because you already have a /usr/bin/perl,
7285 overwriting that with a new Perl would very probably cause problems.
7286 Therefore I'm assuming you don't want to do that (unless you insist).
7287
7288 EOM
7289             case "$installusrbinperl" in
7290             "$define"|[yY]*)    dflt='y';;
7291             *)                  dflt='n';;
7292             esac
7293         else
7294             $cat <<EOM
7295
7296 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7297
7298 EOM
7299             case "$installusrbinperl" in
7300             "$undef"|[nN]*)     dflt='n';;
7301             *)                  dflt='y';;
7302             esac
7303         fi
7304         rp="Do you want to install perl as /usr/bin/perl?"
7305         . ./myread
7306         case "$ans" in
7307         [yY]*)  val="$define";;
7308         *)      val="$undef" ;;
7309         esac
7310 else
7311         val="$undef"
7312 fi
7313 set installusrbinperl
7314 eval $setvar
7315
7316 : Check if we are using the GNU C library
7317 echo " "
7318 echo "Checking for GNU C Library..." >&4
7319 cat >try.c <<'EOCP'
7320 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7321    alone are insufficient to distinguish different versions, such as
7322    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7323    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7324 */
7325 #include <stdio.h>
7326 int main(void)
7327 {
7328 #ifdef __GLIBC__
7329 #   ifdef __GLIBC_MINOR__
7330 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7331 #           include <gnu/libc-version.h>
7332             printf("%s\n",  gnu_get_libc_version());
7333 #       else
7334             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7335 #       endif
7336 #   else
7337         printf("%d\n",  __GLIBC__);
7338 #   endif
7339     return 0;
7340 #else
7341     return 1;
7342 #endif
7343 }
7344 EOCP
7345 set try
7346 if eval $compile_ok && $run ./try > glibc.ver; then
7347         val="$define"
7348         gnulibc_version=`$cat glibc.ver`
7349         echo "You are using the GNU C Library version $gnulibc_version"
7350 else
7351         val="$undef"
7352         gnulibc_version=''
7353         echo "You are not using the GNU C Library"
7354 fi
7355 $rm_try glibc.ver
7356 set d_gnulibc
7357 eval $setvar
7358
7359 : see if nm is to be used to determine whether a symbol is defined or not
7360 case "$usenm" in
7361 '')
7362         dflt=''
7363         case "$d_gnulibc" in
7364         "$define")
7365                 echo " "
7366                 echo "nm probably won't work on the GNU C Library." >&4
7367                 dflt=n
7368                 ;;
7369         esac
7370         case "$dflt" in
7371         '') 
7372                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7373                         echo " "
7374                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7375                         echo "'nm' won't be sufficient on this sytem." >&4
7376                         dflt=n
7377                 fi
7378                 ;;
7379         esac
7380         case "$dflt" in
7381         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7382                 if $test $dflt -gt 20; then
7383                         dflt=y
7384                 else
7385                         dflt=n
7386                 fi
7387                 ;;
7388         esac
7389         ;;
7390 *)
7391         case "$usenm" in
7392         true|$define) dflt=y;;
7393         *) dflt=n;;
7394         esac
7395         ;;
7396 esac
7397 $cat <<EOM
7398
7399 I can use $nm to extract the symbols from your C libraries. This
7400 is a time consuming task which may generate huge output on the disk (up
7401 to 3 megabytes) but that should make the symbols extraction faster. The
7402 alternative is to skip the 'nm' extraction part and to compile a small
7403 test program instead to determine whether each symbol is present. If
7404 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7405 this may be the best solution.
7406
7407 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7408
7409 EOM
7410 rp="Shall I use $nm to extract C symbols from the libraries?"
7411 . ./myread
7412 case "$ans" in
7413 [Nn]*) usenm=false;;
7414 *) usenm=true;;
7415 esac
7416
7417 runnm=$usenm
7418 case "$reuseval" in
7419 true) runnm=false;;
7420 esac
7421
7422 : nm options which may be necessary
7423 case "$nm_opt" in
7424 '') if $test -f /mach_boot; then
7425                 nm_opt=''       # Mach
7426         elif $test -d /usr/ccs/lib; then
7427                 nm_opt='-p'     # Solaris (and SunOS?)
7428         elif $test -f /dgux; then
7429                 nm_opt='-p'     # DG-UX
7430         elif $test -f /lib64/rld; then
7431                 nm_opt='-p'     # 64-bit Irix
7432         else
7433                 nm_opt=''
7434         fi;;
7435 esac
7436
7437 : nm options which may be necessary for shared libraries but illegal
7438 : for archive libraries.  Thank you, Linux.
7439 case "$nm_so_opt" in
7440 '')     case "$myuname" in
7441         *linux*|gnu*)
7442                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7443                         nm_so_opt='--dynamic'
7444                 fi
7445                 ;;
7446         esac
7447         ;;
7448 esac
7449
7450 : Figure out where the libc is located
7451 case "$runnm" in
7452 true)
7453 : get list of predefined functions in a handy place
7454 echo " "
7455 case "$libc" in
7456 '') libc=unknown
7457         case "$libs" in
7458         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7459         esac
7460         ;;
7461 esac
7462 case "$libs" in
7463 '') ;;
7464 *)  for thislib in $libs; do
7465         case "$thislib" in
7466         -lc|-lc_s)
7467                 : Handle C library specially below.
7468                 ;;
7469         -l*)
7470                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7471                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7472                         :
7473                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7474                         :
7475                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7476                         :
7477                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7478                         :
7479                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7480                         :
7481                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7482                         :
7483                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7484                         :
7485                 else
7486                         try=''
7487                 fi
7488                 libnames="$libnames $try"
7489                 ;;
7490         *) libnames="$libnames $thislib" ;;
7491         esac
7492         done
7493         ;;
7494 esac
7495 xxx=normal
7496 case "$libc" in
7497 unknown)
7498         set /lib/libc.$so
7499         for xxx in $libpth; do
7500                 $test -r $1 || set $xxx/libc.$so
7501                 : The messy sed command sorts on library version numbers.
7502                 $test -r $1 || \
7503                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7504                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7505                                 h
7506                                 s/[0-9][0-9]*/0000&/g
7507                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7508                                 G
7509                                 s/\n/ /' | \
7510                          $sort | $sed -e 's/^.* //'`
7511                 eval set \$$#
7512         done
7513         $test -r $1 || set /usr/ccs/lib/libc.$so
7514         $test -r $1 || set /lib/libsys_s$_a
7515         ;;
7516 *)
7517         set blurfl
7518         ;;
7519 esac
7520 if $test -r "$1"; then
7521         echo "Your (shared) C library seems to be in $1."
7522         libc="$1"
7523 elif $test -r /lib/libc && $test -r /lib/clib; then
7524         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7525         xxx=apollo
7526         libc='/lib/clib /lib/libc'
7527         if $test -r /lib/syslib; then
7528                 echo "(Your math library is in /lib/syslib.)"
7529                 libc="$libc /lib/syslib"
7530         fi
7531 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7532         echo "Your C library seems to be in $libc, as you said before."
7533 elif $test -r $incpath/usr/lib/libc$_a; then
7534         libc=$incpath/usr/lib/libc$_a;
7535         echo "Your C library seems to be in $libc.  That's fine."
7536 elif $test -r /lib/libc$_a; then
7537         libc=/lib/libc$_a;
7538         echo "Your C library seems to be in $libc.  You're normal."
7539 else
7540         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7541                 :
7542         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7543                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7544         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7545                 :
7546         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7547                 :
7548         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7549                 :
7550         else
7551                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7552         fi
7553         if $test -r "$tans"; then
7554                 echo "Your C library seems to be in $tans, of all places."
7555                 libc=$tans
7556         else
7557                 libc='blurfl'
7558         fi
7559 fi
7560 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7561         dflt="$libc"
7562         cat <<EOM
7563
7564 If the guess above is wrong (which it might be if you're using a strange
7565 compiler, or your machine supports multiple models), you can override it here.
7566
7567 EOM
7568 else
7569         dflt=''
7570         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7571         cat >&4 <<EOM
7572 I can't seem to find your C library.  I've looked in the following places:
7573
7574 EOM
7575         $sed 's/^/      /' libpath
7576         cat <<EOM
7577
7578 None of these seems to contain your C library. I need to get its name...
7579
7580 EOM
7581 fi
7582 fn=f
7583 rp='Where is your C library?'
7584 . ./getfile
7585 libc="$ans"
7586
7587 echo " "
7588 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7589 set X `cat libnames`
7590 shift
7591 xxx=files
7592 case $# in 1) xxx=file; esac
7593 echo "Extracting names from the following $xxx for later perusal:" >&4
7594 echo " "
7595 $sed 's/^/      /' libnames >&4
7596 echo " "
7597 $echo $n "This may take a while...$c" >&4
7598
7599 for file in $*; do
7600         case $file in
7601         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7602         *) $nm $nm_opt $file 2>/dev/null;;
7603         esac
7604 done >libc.tmp
7605
7606 $echo $n ".$c"
7607 $grep fprintf libc.tmp > libc.ptf
7608 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7609 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7610 xxx='[ADTSIW]'
7611 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7612         eval $xscan;\
7613         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7614                 eval $xrun
7615 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7616         eval $xscan;\
7617         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7618                 eval $xrun
7619 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7620         eval $xscan;\
7621         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7622                 eval $xrun
7623 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7624         eval $xscan;\
7625         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7626                 eval $xrun
7627 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7628         eval $xscan;\
7629         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7630                 eval $xrun
7631 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7632         eval $xscan;\
7633         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7634                 eval $xrun
7635 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7636                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7637         eval $xscan;\
7638         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7639                 eval $xrun
7640 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7641         eval $xscan;\
7642         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7643                 eval $xrun
7644 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7645         eval $xscan;\
7646         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7647                 eval $xrun
7648 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7649         eval $xscan;\
7650         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7651                 eval $xrun
7652 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7653         eval $xscan;\
7654         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7655                 eval $xrun
7656 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7657         eval $xscan;\
7658         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7659                 eval $xrun
7660 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7661         eval $xscan;\
7662         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7663                 eval $xrun
7664 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7665         eval $xscan;\
7666         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7667                 eval $xrun
7668 else
7669         $nm -p $* 2>/dev/null >libc.tmp
7670         $grep fprintf libc.tmp > libc.ptf
7671         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7672                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7673         then
7674                 nm_opt='-p'
7675                 eval $xrun
7676         else
7677                 echo " "
7678                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7679                 com=''
7680                 if $ar t $libc > libc.tmp && \
7681                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7682                 then
7683                         for thisname in $libnames $libc; do
7684                                 $ar t $thisname >>libc.tmp
7685                         done
7686                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7687                         echo "Ok." >&4
7688                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7689                         for thisname in $libnames $libc; do
7690                                 $ar tv $thisname >>libc.tmp
7691                                 emximp -o tmp.imp $thisname \
7692                                     2>/dev/null && \
7693                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7694                                     < tmp.imp >>libc.tmp
7695                                 $rm -f tmp.imp
7696                         done
7697                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7698                         echo "Ok." >&4
7699                 else
7700                         echo "$ar didn't seem to work right." >&4
7701                         echo "Maybe this is a Cray...trying bld instead..." >&4
7702                         if  bld t $libc | \
7703                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7704                                 $test -s libc.list
7705                         then
7706                                 for thisname in $libnames; do
7707                                         bld t $libnames | \
7708                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7709                                         $ar t $thisname >>libc.tmp
7710                                 done
7711                                 echo "Ok." >&4
7712                         else
7713                                 echo "That didn't work either.  Giving up." >&4
7714                                 exit 1
7715                         fi
7716                 fi
7717         fi
7718 fi
7719 nm_extract="$com"
7720 case "$PASE" in
7721 define)
7722     echo " "
7723     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7724     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7725     ;;
7726 *)  if $test -f /lib/syscalls.exp; then
7727         echo " "
7728         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7729         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7730                 /lib/syscalls.exp >>libc.list
7731     fi
7732     ;;
7733 esac
7734 ;;
7735 esac
7736 $rm -f libnames libpath
7737
7738 : see if dld is available
7739 set dld.h i_dld
7740 eval $inhdr
7741
7742 : Check if we are using C++
7743 echo " "
7744 echo "Checking for C++..." >&4
7745 $cat >try.c <<'EOCP'
7746 #include <stdio.h>
7747 int main(void)
7748 {
7749 #ifdef __cplusplus
7750     return 0;
7751 #else
7752     return 1;
7753 #endif
7754 }
7755 EOCP
7756 set try
7757 if eval $compile_ok && $run ./try; then
7758         val="$define"
7759         echo "You are using a C++ compiler."
7760 else
7761         val="$undef"
7762         echo "You are not using a C++ compiler."
7763 fi
7764 $rm_try cplusplus$$
7765 set d_cplusplus
7766 eval $setvar
7767
7768 : is a C symbol defined?
7769 csym='tlook=$1;
7770 case "$3" in
7771 -v) tf=libc.tmp; tdc="";;
7772 -a) tf=libc.tmp; tdc="[]";;
7773 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7774 esac;
7775 tx=yes;
7776 case "$reuseval-$4" in
7777 true-) ;;
7778 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7779 esac;
7780 case "$tx" in
7781 yes)
7782         tval=false;
7783         case "$d_cplusplus" in
7784                 $define) extern_C=\"C\";;
7785         esac;
7786         if $test "$runnm" = true; then
7787                 if $contains $tlook $tf >/dev/null 2>&1; then
7788                         tval=true;
7789                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7790                         echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7791                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7792                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7793                         $rm_try;
7794                 fi;
7795         else
7796                 echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7797                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7798                 $rm_try;
7799         fi;
7800         ;;
7801 *)
7802         case "$tval" in
7803         $define) tval=true;;
7804         *) tval=false;;
7805         esac;
7806         ;;
7807 esac;
7808 eval "$2=$tval"'
7809
7810 : define an is-in-libc? function
7811 inlibc='echo " "; td=$define; tu=$undef;
7812 sym=$1; var=$2; eval "was=\$$2";
7813 tx=yes;
7814 case "$reuseval$was" in
7815 true) ;;
7816 true*) tx=no;;
7817 esac;
7818 case "$tx" in
7819 yes)
7820         set $sym tres -f;
7821         eval $csym;
7822         case "$tres" in
7823         true)
7824                 echo "$sym() found." >&4;
7825                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7826         *)
7827                 echo "$sym() NOT found." >&4;
7828                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7829         esac;;
7830 *)
7831         case "$was" in
7832         $define) echo "$sym() found." >&4;;
7833         *) echo "$sym() NOT found." >&4;;
7834         esac;;
7835 esac'
7836
7837 : see if dlopen exists
7838 xxx_runnm="$runnm"
7839 xxx_ccflags="$ccflags"
7840 runnm=false
7841 : with g++ one needs -shared to get is-in-libc to work for dlopen
7842 case "$gccversion" in
7843 '')     ;;
7844 *)      case "$d_cplusplus" in
7845         "$define") ccflags="$ccflags -shared" ;;
7846         esac
7847         ;;
7848 esac
7849 set dlopen d_dlopen
7850 eval $inlibc
7851 runnm="$xxx_runnm"
7852 ccflags="$xxx_ccflags"
7853
7854 : see if this is a unistd.h system
7855 set unistd.h i_unistd
7856 eval $inhdr
7857
7858 : determine which dynamic loading, if any, to compile in
7859 echo " "
7860 dldir="ext/DynaLoader"
7861 case "$usedl" in
7862 $define|y|true)
7863         dflt='y'
7864         usedl="$define"
7865         ;;
7866 $undef|n|false)
7867         dflt='n'
7868         usedl="$undef"
7869         ;;
7870 *)
7871         dflt='n'
7872         case "$d_dlopen" in
7873             $define) dflt='y' ;;
7874         esac
7875         case "$i_dld" in
7876             $define) dflt='y' ;;
7877         esac
7878         : Does a dl_xxx.xs file exist for this operating system
7879         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7880         ;;
7881 esac
7882 rp="Do you wish to use dynamic loading?"
7883 . ./myread
7884 usedl="$ans"
7885 case "$ans" in
7886 y*) usedl="$define"
7887         case "$dlsrc" in
7888         '')
7889                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7890                         dflt="$dldir/dl_${osname}.xs"
7891                 elif $test "$d_dlopen" = "$define" ; then
7892                         dflt="$dldir/dl_dlopen.xs"
7893                 elif $test "$i_dld" = "$define" ; then
7894                         dflt="$dldir/dl_dld.xs"
7895                 else
7896                         dflt=''
7897                 fi
7898                 ;;
7899         *)      dflt="$dldir/$dlsrc"
7900                 ;;
7901         esac
7902     echo "The following dynamic loading files are available:"
7903         : Can not go over to $dldir because getfile has path hard-coded in.
7904         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7905         rp="Source file to use for dynamic loading"
7906         fn="fne"
7907         gfpth="$src"
7908         . ./getfile
7909         usedl="$define"
7910         : emulate basename
7911         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7912
7913         $cat << EOM
7914
7915 Some systems may require passing special flags to $cc -c to
7916 compile modules that will be used to create a shared library.
7917 To use no flags, say "none".
7918
7919 EOM
7920     case "$cccdlflags" in
7921     '') case "$gccversion" in
7922                 '') case "$osname" in
7923                         hpux)   dflt='+z' ;;
7924                         next)   dflt='none' ;;
7925                         irix*)  dflt='-KPIC' ;;
7926                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7927                         sunos)  dflt='-pic' ;;
7928                         *)      dflt='none' ;;
7929                     esac
7930                         ;;
7931                 *)  case "$osname" in
7932                         darwin) dflt='none' ;;
7933                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7934                         *)      dflt='-fpic' ;;
7935                     esac ;;
7936             esac ;;
7937         ' ') dflt='none' ;;
7938     *)  dflt="$cccdlflags" ;;
7939     esac
7940     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7941     . ./myread
7942     case "$ans" in
7943     none) cccdlflags=' ' ;;
7944     *) cccdlflags="$ans" ;;
7945     esac
7946
7947     cat << EOM
7948
7949 Some systems use ld to create libraries that can be dynamically loaded,
7950 while other systems (such as those using ELF) use $cc.
7951
7952 EOM
7953         case "$ld" in
7954         '')     $cat >try.c <<EOM
7955 /* Test for whether ELF binaries are produced */
7956 #include <fcntl.h>
7957 #$i_stdlib I_STDLIB
7958 #ifdef I_STDLIB
7959 #include <stdlib.h>
7960 #endif
7961 #$i_unistd I_UNISTD
7962 #ifdef I_UNISTD
7963 #include <unistd.h>
7964 #endif
7965 int main() {
7966         char b[4];
7967         int i = open("a.out",O_RDONLY);
7968         if(i == -1)
7969                 exit(1); /* fail */
7970         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7971                 exit(0); /* succeed (yes, it's ELF) */
7972         else
7973                 exit(1); /* fail */
7974 }
7975 EOM
7976                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7977                         cat <<EOM
7978 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7979 EOM
7980                         dflt="$cc"
7981                 else
7982                         echo "I'll use ld to build dynamic libraries."
7983                         dflt='ld'
7984                 fi
7985                 $rm_try
7986                 ;;
7987         *)      dflt="$ld"
7988                 ;;
7989         esac
7990
7991     rp="What command should be used to create dynamic libraries?"
7992     . ./myread
7993         ld="$ans"
7994
7995     cat << EOM
7996
7997 Some systems may require passing special flags to $ld to create a
7998 library that can be dynamically loaded.  If your ld flags include
7999 -L/other/path options to locate libraries outside your loader's normal
8000 search path, you may need to specify those -L options here as well.  To
8001 use no flags, say "none".
8002
8003 EOM
8004     case "$lddlflags" in
8005     '') case "$osname" in
8006                         beos) dflt='-nostart' ;;
8007                         hpux) dflt='-b';
8008                               case "$gccversion" in
8009                               '') dflt="$dflt +vnocompatwarnings" ;;
8010                               esac
8011                               ;;
8012                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8013                         next)  dflt='none' ;;
8014                         solaris) dflt='-G' ;;
8015                         sunos) dflt='-assert nodefinitions' ;;
8016                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8017                 *)     dflt='none' ;;
8018                         esac
8019                         ;;
8020     *) dflt="$lddlflags" ;;
8021     esac
8022
8023         : Try to guess additional flags to pick up local libraries.
8024         : Be careful not to append to a plain 'none'
8025         case "$dflt" in
8026         none) dflt='' ;;
8027         esac
8028         for thisflag in $ldflags; do
8029                 case "$thisflag" in
8030                 -L*|-R*|-Wl,-R*)
8031                         case " $dflt " in
8032                         *" $thisflag "*) ;;
8033                         *) dflt="$dflt $thisflag" ;;
8034                         esac
8035                         ;;
8036                 esac
8037         done
8038
8039         case "$dflt" in
8040         ''|' ') dflt='none' ;;
8041         esac
8042
8043         case "$ldflags" in
8044         *-fstack-protector*)
8045             case "$dflt" in
8046                         *-fstack-protector*) ;; # Don't add it again
8047                         *) dflt="$dflt -fstack-protector" ;; 
8048                 esac
8049                 ;;
8050         esac
8051
8052
8053     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8054     . ./myread
8055     case "$ans" in
8056     none) lddlflags=' ' ;;
8057     *) lddlflags="$ans" ;;
8058     esac
8059
8060         cat <<EOM
8061
8062 Some systems may require passing special flags to $cc to indicate that
8063 the resulting executable will use dynamic linking.  To use no flags,
8064 say "none".
8065
8066 EOM
8067     case "$ccdlflags" in
8068     '') case "$osname" in
8069             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8070             next|sunos) dflt='none' ;;
8071             *)          dflt='none' ;;
8072             esac ;;
8073     ' ')  dflt='none' ;;
8074     *)  dflt="$ccdlflags" ;;
8075     esac
8076     rp="Any special flags to pass to $cc to use dynamic linking?"
8077     . ./myread
8078     case "$ans" in
8079     none) ccdlflags=' ' ;;
8080     *) ccdlflags="$ans" ;;
8081     esac
8082     ;;
8083 *)  usedl="$undef"
8084         ld='ld'
8085     dlsrc='dl_none.xs'
8086     lddlflags=''
8087     ccdlflags=''
8088     ;;
8089 esac
8090
8091 : Do we want a shared libperl?
8092 also=''
8093 case "$usedl" in
8094 $undef)
8095         # No dynamic loading being used, so don't bother even to prompt.
8096         useshrplib='false'
8097         ;;
8098 *)      case "$useshrplib" in
8099         '')     case "$osname" in
8100                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
8101                         dflt=y
8102                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8103                         ;;
8104                 next*)
8105                         case "$osvers" in
8106                         4*)     dflt=y
8107                                 also='Building a shared libperl is needed for MAB support.'
8108                                 ;;
8109                         *)      dflt=n
8110                                 ;;
8111                         esac
8112                         ;;
8113                 *)      dflt=n
8114                         ;;
8115                 esac
8116                 ;;
8117         $define|true|[Yy]*)
8118                 dflt=y
8119                 ;;
8120         *)      dflt=n
8121                 ;;
8122         esac
8123         $cat << EOM
8124
8125 The perl executable is normally obtained by linking perlmain.c with
8126 libperl${_a}, any static extensions (usually just DynaLoader), and
8127 any other libraries needed on this system (such as -lm, etc.).  Since
8128 your system supports dynamic loading, it is probably possible to build
8129 a shared libperl.$so.  If you will have more than one executable linked
8130 to libperl.$so, this will significantly reduce the size of each
8131 executable, but it may have a noticeable effect on performance.  The
8132 default is probably sensible for your system.
8133 $also
8134
8135 EOM
8136         rp="Build a shared libperl.$so (y/n)"
8137         . ./myread
8138         case "$ans" in
8139         true|$define|[Yy]*)
8140                 useshrplib='true'  ;;
8141         *)      useshrplib='false' ;;
8142         esac
8143         ;;
8144 esac
8145
8146 case "$useshrplib" in
8147 true)
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.3.1
8155                 majmin="libperl.$so.$patchlevel.$subversion"
8156                 # A name such as libperl.so.301
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 against an importlib
8171                         dflt=libperl$lib_ext
8172                         ;;
8173                 *)      # Try to guess based on whether libc has major.minor.
8174                         case "$libc" in
8175                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8176                         *libc.$so.[0-9]*) dflt=$majonly ;;
8177                         *)      dflt=libperl.$so ;;
8178                         esac
8179                         ;;
8180                 esac
8181                 ;;
8182         *)      dflt=$libperl
8183                 ;;
8184         esac
8185         cat << EOM
8186
8187 I need to select a good name for the shared libperl.  If your system uses
8188 library names with major and minor numbers, then you might want something
8189 like $majmin.  Alternatively, if your system uses a single version
8190 number for shared libraries, then you might want to use $majonly.
8191 Or, your system might be quite happy with a simple libperl.$so.
8192
8193 Since the shared libperl will get installed into a version-specific
8194 architecture-dependent directory, the version number of the shared perl
8195 library probably isn't important, so the default should be o.k.
8196
8197 EOM
8198         rp='What name do you want to give to the shared libperl?'
8199         . ./myread
8200         libperl=$ans
8201         echo "Ok, I'll use $libperl"
8202         ;;
8203 *)
8204         libperl="libperl${_a}"
8205         ;;
8206 esac
8207
8208 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8209 case "$shrpdir" in
8210 '') ;;
8211 *)      $cat >&4 <<EOM
8212 WARNING:  Use of the shrpdir variable for the installation location of
8213 the shared $libperl is not supported.  It was never documented and
8214 will not work in this version.  Let me (perlbug@perl.org)
8215 know of any problems this may cause.
8216
8217 EOM
8218         case "$shrpdir" in
8219         "$archlibexp/CORE")
8220                 $cat >&4 <<EOM
8221 But your current setting of $shrpdir is
8222 the default anyway, so it's harmless.
8223 EOM
8224                 ;;
8225         *)
8226                 $cat >&4 <<EOM
8227 Further, your current attempted setting of $shrpdir
8228 conflicts with the value of $archlibexp/CORE
8229 that installperl will use.
8230 EOM
8231                 ;;
8232         esac
8233         ;;
8234 esac
8235
8236 # How will the perl executable find the installed shared $libperl?
8237 # Add $xxx to ccdlflags.
8238 # If we can't figure out a command-line option, use $shrpenv to
8239 # set env LD_RUN_PATH.  The main perl makefile uses this.
8240 shrpdir=$archlibexp/CORE
8241 xxx=''
8242 tmp_shrpenv=''
8243 if "$useshrplib"; then
8244     case "$osname" in
8245         aix)
8246                 # We'll set it in Makefile.SH...
8247                 ;;
8248         solaris)
8249                 xxx="-R $shrpdir"
8250                 ;;
8251         freebsd|netbsd|openbsd|interix|dragonfly)
8252                 xxx="-Wl,-R$shrpdir"
8253                 ;;
8254         bsdos|linux|irix*|dec_osf|gnu*)
8255                 xxx="-Wl,-rpath,$shrpdir"
8256                 ;;
8257         next)
8258                 # next doesn't like the default...
8259                 ;;
8260         beos)
8261                 # beos doesn't like the default, either.
8262                 ;;
8263         hpux*)
8264                 # hpux doesn't like the default, either.
8265                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8266                 ;;
8267         *)
8268                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8269                 ;;
8270         esac
8271         case "$xxx" in
8272         '') ;;
8273         *)
8274                 # Only add $xxx if it isn't already in ccdlflags.
8275                 case " $ccdlflags " in
8276                 *" $xxx "*)     ;;
8277                 *)      ccdlflags="$ccdlflags $xxx"
8278                         cat <<EOM >&4
8279
8280 Adding $xxx to the flags
8281 passed to $ld so that the perl executable will find the
8282 installed shared $libperl.
8283
8284 EOM
8285                         ;;
8286                 esac
8287                 ;;
8288         esac
8289 fi
8290 # Fix ccdlflags in AIX for building external extensions.
8291 # (For building Perl itself bare -bE:perl.exp is needed,
8292 #  Makefile.SH takes care of this.)
8293 case "$osname" in
8294 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8295 esac
8296 # Respect a hint or command-line value.
8297 case "$shrpenv" in
8298 '') shrpenv="$tmp_shrpenv" ;;
8299 esac
8300 case "$ldlibpthname" in
8301 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8302 none)   ldlibpthname='' ;;
8303 esac
8304
8305 : determine where manual pages are on this system
8306 echo " "
8307 case "$sysman" in
8308 '') 
8309         syspath='/usr/share/man/man1 /usr/man/man1'
8310         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8311         syspath="$syspath /usr/man/u_man/man1"
8312         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8313         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8314         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8315         sysman=`./loc . /usr/man/man1 $syspath`
8316         ;;
8317 esac
8318 if $test -d "$sysman"; then
8319         echo "System manual is in $sysman." >&4
8320 else
8321         echo "Could not find manual pages in source form." >&4
8322 fi
8323
8324 : determine where manual pages go
8325 set man1dir man1dir none
8326 eval $prefixit
8327 $cat <<EOM
8328
8329 $spackage has manual pages available in source form.
8330 EOM
8331 case "$nroff" in
8332 nroff)
8333         echo "However, you don't have nroff, so they're probably useless to you."
8334         case "$man1dir" in
8335         '') man1dir="none";;
8336         esac;;
8337 esac
8338 echo "If you don't want the manual sources installed, answer 'none'."
8339 case "$man1dir" in
8340 ' ') dflt=none
8341         ;;
8342 '')
8343         lookpath="$prefixexp/share/man/man1"
8344         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8345         lookpath="$lookpath $prefixexp/man/p_man/man1"
8346         lookpath="$lookpath $prefixexp/man/u_man/man1"
8347         lookpath="$lookpath $prefixexp/man/man.1"
8348         case "$sysman" in
8349         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8350         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8351         esac
8352         set dflt
8353         eval $prefixup
8354         ;;
8355 *)  dflt="$man1dir"
8356         ;;
8357 esac
8358 echo " "
8359 fn=dn+~
8360 rp="Where do the main $spackage manual pages (source) go?"
8361 . ./getfile
8362 if $test "X$man1direxp" != "X$ansexp"; then
8363         installman1dir=''
8364 fi
8365 prefixvar=man1dir
8366 . ./setprefixvar
8367
8368 case "$man1dir" in
8369 '')     man1dir=' '
8370         installman1dir='';;
8371 esac
8372
8373 : What suffix to use on installed man pages
8374
8375 case "$man1dir" in
8376 ' ')
8377         man1ext='0'
8378         ;;
8379 *)
8380         rp="What suffix should be used for the main $spackage man pages?"
8381         case "$man1ext" in
8382         '')     case "$man1dir" in
8383                 *1)  dflt=1 ;;
8384                 *1p) dflt=1p ;;
8385                 *1pm) dflt=1pm ;;
8386                 *l) dflt=l;;
8387                 *n) dflt=n;;
8388                 *o) dflt=o;;
8389                 *p) dflt=p;;
8390                 *C) dflt=C;;
8391                 *L) dflt=L;;
8392                 *L1) dflt=L1;;
8393                 *) dflt=1;;
8394                 esac
8395                 ;;
8396         *)      dflt="$man1ext";;
8397         esac
8398         . ./myread
8399         man1ext="$ans"
8400         ;;
8401 esac
8402
8403 : see if we can have long filenames
8404 echo " "
8405 first=123456789abcdef
8406 $rm -f $first
8407 if (echo hi >$first) 2>/dev/null; then
8408         if $test -f 123456789abcde; then
8409                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8410                 val="$undef"
8411         else
8412                 echo 'You can have filenames longer than 14 characters.'>&4
8413                 val="$define"
8414         fi
8415 else
8416         $cat <<'EOM'
8417 You can't have filenames longer than 14 chars.
8418 You can't even think about them!
8419 EOM
8420         val="$undef"
8421 fi
8422 set d_flexfnam
8423 eval $setvar
8424 $rm -rf 123456789abcde*
8425
8426 : determine where library module manual pages go
8427 set man3dir man3dir none
8428 eval $prefixit
8429 $cat <<EOM
8430
8431 $spackage has manual pages for many of the library modules.
8432 EOM
8433
8434 case "$nroff" in
8435 nroff)
8436         $cat <<'EOM'
8437 However, you don't have nroff, so they're probably useless to you.
8438 EOM
8439         case "$man3dir" in
8440         '') man3dir="none";;
8441         esac;;
8442 esac
8443
8444 case "$d_flexfnam" in
8445 undef)
8446         $cat <<'EOM'
8447 However, your system can't handle the long file names like File::Basename.3.
8448 EOM
8449         case "$man3dir" in
8450         '') man3dir="none";;
8451         esac;;
8452 esac
8453
8454 echo "If you don't want the manual sources installed, answer 'none'."
8455 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8456 case "$man3dir" in
8457 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8458         if $test -d "$privlib/man/man3"; then
8459                 cat <<EOM >&4
8460
8461 WARNING:  Previous versions of perl installed man3 pages into
8462 $privlib/man/man3.  This version will suggest a
8463 new default of $dflt.
8464 EOM
8465                 tdflt=$dflt
8466                 dflt='n'
8467                 rp='Do you wish to preserve the old behavior?(y/n)'
8468                 . ./myread
8469                 case "$ans" in
8470                 y*) dflt="$privlib/man/man3" ;;
8471                 *)  dflt=$tdflt ;;
8472                 esac
8473     fi
8474         ;;
8475 *)      dflt="$man3dir" ;;
8476 esac
8477 case "$dflt" in
8478 ' ') dflt=none ;;
8479 esac
8480 echo " "
8481 fn=dn+~
8482 rp="Where do the $package library man pages (source) go?"
8483 . ./getfile
8484 prefixvar=man3dir
8485 . ./setprefixvar
8486
8487 case "$man3dir" in
8488 '')     man3dir=' '
8489         installman3dir='';;
8490 esac
8491
8492 : What suffix to use on installed man pages
8493 case "$man3dir" in
8494 ' ')
8495         man3ext='0'
8496         ;;
8497 *)
8498         rp="What suffix should be used for the $package library man pages?"
8499         case "$man3ext" in
8500         '')     case "$man3dir" in
8501                 *3)  dflt=3 ;;
8502                 *3p) dflt=3p ;;
8503                 *3pm) dflt=3pm ;;
8504                 *l) dflt=l;;
8505                 *n) dflt=n;;
8506                 *o) dflt=o;;
8507                 *p) dflt=p;;
8508                 *C) dflt=C;;
8509                 *L) dflt=L;;
8510                 *L3) dflt=L3;;
8511                 *) dflt=3;;
8512                 esac
8513                 ;;
8514         *)      dflt="$man3ext";;
8515         esac
8516         . ./myread
8517         man3ext="$ans"
8518         ;;
8519 esac
8520
8521 : see if we have to deal with yellow pages, now NIS.
8522 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8523         if $test -f /usr/etc/nibindd; then
8524                 echo " "
8525                 echo "I'm fairly confident you're on a NeXT."
8526                 echo " "
8527                 rp='Do you get the hosts file via NetInfo?'
8528                 dflt=y
8529                 case "$hostcat" in
8530                 nidump*) ;;
8531                 '') ;;
8532                 *) dflt=n;;
8533                 esac
8534                 . ./myread
8535                 case "$ans" in
8536                 y*) hostcat='nidump hosts .';;
8537                 *)      case "$hostcat" in
8538                         nidump*) hostcat='';;
8539                         esac
8540                         ;;
8541                 esac
8542         fi
8543         case "$hostcat" in
8544         nidump*) ;;
8545         *)
8546                 case "$hostcat" in
8547                 *ypcat*) dflt=y;;
8548                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8549                                 dflt=y
8550                         else
8551                                 dflt=n
8552                         fi;;
8553                 *) dflt=n;;
8554                 esac
8555                 echo " "
8556                 rp='Are you getting the hosts file via yellow pages?'
8557                 . ./myread
8558                 case "$ans" in
8559                 y*) hostcat='ypcat hosts';;
8560                 *) hostcat='cat /etc/hosts';;
8561                 esac
8562                 ;;
8563         esac
8564 fi
8565 case "$hostcat" in
8566 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8567 esac
8568 case "$groupcat" in
8569 '') test -f /etc/group && groupcat='cat /etc/group';;
8570 esac
8571 case "$passcat" in
8572 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8573 esac
8574
8575 : now get the host name
8576 echo " "
8577 echo "Figuring out host name..." >&4
8578 case "$myhostname" in
8579 '') cont=true
8580         echo 'Maybe "hostname" will work...'
8581         if tans=`sh -c hostname 2>&1` ; then
8582                 myhostname=$tans
8583                 phostname=hostname
8584                 cont=''
8585         fi
8586         ;;
8587 *) cont='';;
8588 esac
8589 if $test "$cont"; then
8590         if ./xenix; then
8591                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8592                 if tans=`cat /etc/systemid 2>&1` ; then
8593                         myhostname=$tans
8594                         phostname='cat /etc/systemid'
8595                         echo "Whadyaknow.  Xenix always was a bit strange..."
8596                         cont=''
8597                 fi
8598         elif $test -r /etc/systemid; then
8599                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8600         fi
8601 fi
8602 if $test "$cont"; then
8603         echo 'No, maybe "uuname -l" will work...'
8604         if tans=`sh -c 'uuname -l' 2>&1` ; then
8605                 myhostname=$tans
8606                 phostname='uuname -l'
8607         else
8608                 echo 'Strange.  Maybe "uname -n" will work...'
8609                 if tans=`sh -c 'uname -n' 2>&1` ; then
8610                         myhostname=$tans
8611                         phostname='uname -n'
8612                 else
8613                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8614                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8615                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8616                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8617                         else
8618                                 case "$myhostname" in
8619                                 '') echo "Does this machine have an identity crisis or something?"
8620                                         phostname='';;
8621                                 *)
8622                                         echo "Well, you said $myhostname before..."
8623                                         phostname='echo $myhostname';;
8624                                 esac
8625                         fi
8626                 fi
8627         fi
8628 fi
8629 case "$myhostname" in
8630 '') myhostname=noname ;;
8631 esac
8632 : you do not want to know about this
8633 set $myhostname
8634 myhostname=$1
8635
8636 : verify guess
8637 if $test "$myhostname" ; then
8638         dflt=y
8639         rp='Your host name appears to be "'$myhostname'".'" Right?"
8640         . ./myread
8641         case "$ans" in
8642         y*) ;;
8643         *) myhostname='';;
8644         esac
8645 fi
8646
8647 : bad guess or no guess
8648 while $test "X$myhostname" = X ; do
8649         dflt=''
8650         rp="Please type the (one word) name of your host:"
8651         . ./myread
8652         myhostname="$ans"
8653 done
8654
8655 : translate upper to lower if necessary
8656 case "$myhostname" in
8657 *[A-Z]*)
8658         echo "(Normalizing case in your host name)"
8659         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8660         ;;
8661 esac
8662
8663 case "$myhostname" in
8664 *.*)
8665         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8666         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8667         echo "(Trimming domain name from host name--host name is now $myhostname)"
8668         ;;
8669 *) case "$mydomain" in
8670         '')
8671                 {
8672                         test "X$hostcat" = "Xypcat hosts" &&
8673                         ypmatch "$myhostname" hosts 2>/dev/null |\
8674                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8675                         $test -s hosts
8676                 } || {
8677                         test "X$hostcat" != "X" &&
8678                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8679                                         /[       ]$myhostname[  . ]/p" > hosts
8680                 }
8681                 tmp_re="[       . ]"
8682                 if $test -f hosts; then
8683                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8684                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8685                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8686                                 hosts | $sort | $uniq | \
8687                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8688                         case `$echo X$dflt` in
8689                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8690                                 dflt=.
8691                                 ;;
8692                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8693                                 ;;
8694                         esac
8695                 else
8696                         echo "(I cannot locate a hosts database anywhere)"
8697                         dflt=.
8698                 fi
8699                 case "$dflt" in
8700                 .)
8701                         tans=`./loc resolv.conf X /etc /usr/etc`
8702                         if $test -f "$tans"; then
8703                                 echo "(Attempting domain name extraction from $tans)"
8704                                 dflt=.`$sed -n -e 's/   / /g' \
8705                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8706                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8707                                 case "$dflt" in
8708                                 .) dflt=.`$sed -n -e 's/        / /g' \
8709                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8710                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8711                                         ;;
8712                                 esac
8713                         fi
8714                         ;;
8715                 esac
8716                 case "$dflt" in
8717                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8718                         dflt=.`sh -c domainname 2>/dev/null`
8719                         case "$dflt" in
8720                         '') dflt='.';;
8721                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8722                         esac
8723                         ;;
8724                 esac
8725                 case "$dflt$osname" in
8726                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8727                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8728                         ;;
8729                 esac
8730                 case "$dflt" in
8731                 .) echo "(Lost all hope -- silly guess then)"
8732                         dflt='.nonet'
8733                         ;;
8734                 esac
8735                 $rm -f hosts
8736                 ;;
8737         *) dflt="$mydomain";;
8738         esac;;
8739 esac
8740 echo " "
8741 rp="What is your domain name?"
8742 . ./myread
8743 tans="$ans"
8744 case "$ans" in
8745 '') ;;
8746 .*) ;;
8747 *) tans=".$tans";;
8748 esac
8749 mydomain="$tans"
8750
8751 : translate upper to lower if necessary
8752 case "$mydomain" in
8753 *[A-Z]*)
8754         echo "(Normalizing case in your domain name)"
8755         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8756         ;;
8757 esac
8758
8759 : a little sanity check here
8760 case "$phostname" in
8761 '') ;;
8762 *)
8763         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8764         $myhostname$mydomain|$myhostname) ;;
8765         *)
8766                 case "$phostname" in
8767                 sed*)
8768                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8769                         ;;
8770                 *)
8771                         echo "(That doesn't agree with your $phostname command, by the way.)"
8772                         ;;
8773                 esac
8774         ;;
8775         esac
8776         ;;
8777 esac
8778
8779 : determine the e-mail address of the user who is running us
8780 $cat <<EOM
8781
8782 I need to get your e-mail address in Internet format if possible, i.e.
8783 something like user@host.domain. Please answer accurately since I have
8784 no easy means to double check it. The default value provided below
8785 is most probably close to reality but may not be valid from outside
8786 your organization...
8787
8788 EOM
8789 cont=x
8790 while test "$cont"; do
8791         case "$cf_email" in
8792         '') dflt="$cf_by@$myhostname$mydomain";;
8793         *) dflt="$cf_email";;
8794         esac
8795         rp='What is your e-mail address?'
8796         . ./myread
8797         cf_email="$ans"
8798         case "$cf_email" in
8799         *@*.*) cont='' ;;
8800         *)
8801                 rp='Address does not look like an Internet one.  Use it anyway?'
8802                 case "$fastread" in
8803                 yes) dflt=y ;;
8804                 *) dflt=n ;;
8805                 esac
8806                 . ./myread
8807                 case "$ans" in
8808                 y*) cont='' ;;
8809                 *) echo " " ;;
8810                 esac
8811                 ;;
8812         esac
8813 done
8814
8815 : Ask e-mail of administrator
8816 $cat <<EOM
8817
8818 If you or somebody else will be maintaining perl at your site, please
8819 fill in the correct e-mail address here so that they may be contacted
8820 if necessary. Currently, the "perlbug" program included with perl
8821 will send mail to this address in addition to perlbug@perl.org. You may
8822 enter "none" for no administrator.
8823
8824 EOM
8825 case "$perladmin" in
8826 '') dflt="$cf_email";;
8827 *) dflt="$perladmin";;
8828 esac
8829 rp='Perl administrator e-mail address'
8830 . ./myread
8831 perladmin="$ans"
8832
8833 : determine whether to only install version-specific parts.
8834 echo " "
8835 $cat <<EOM
8836 Do you want to install only the version-specific parts of the perl
8837 distribution?  Usually you do *not* want to do this.
8838 EOM
8839 case "$versiononly" in
8840 "$define"|[Yy]*|true) dflt='y' ;;
8841 *) dflt='n';
8842 esac
8843 rp="Do you want to install only the version-specific parts of perl?"
8844 . ./myread
8845 case "$ans" in
8846 [yY]*)  val="$define";;
8847 *)      val="$undef" ;;
8848 esac
8849 set versiononly
8850 eval $setvar
8851
8852 case "$versiononly" in
8853 "$define") inc_version_list=''
8854            inc_version_list_init=0
8855            ;;
8856 esac
8857
8858 : figure out how to guarantee perl startup
8859 : XXX Note that this currently takes advantage of the bug that binexp ignores
8860 :     the Configure -Dinstallprefix setting, which in turn means that under
8861 :     relocatable @INC, initialinstalllocation is what binexp started as.
8862 case "$startperl" in
8863 '')
8864         case "$sharpbang" in
8865         *!)
8866                 $cat <<EOH
8867
8868 I can use the #! construct to start perl on your system. This will
8869 make startup of perl scripts faster, but may cause problems if you
8870 want to share those scripts and perl is not in a standard place
8871 ($initialinstalllocation/perl) on all your platforms. The alternative
8872 is to force a shell by starting the script with a single ':' character.
8873
8874 EOH
8875                 case "$versiononly" in
8876                 "$define")      dflt="$initialinstalllocation/perl$version";;
8877                 *)              dflt="$initialinstalllocation/perl";;
8878                 esac
8879                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8880                 . ./myread
8881                 case "$ans" in
8882                 none)   startperl=": # use perl";;
8883                 *)      startperl="#!$ans"
8884                         if $test 30 -lt `echo "$ans" | wc -c`; then
8885                                 $cat >&4 <<EOM
8886
8887 WARNING:  Some systems limit the #! command to 32 characters.
8888 If you experience difficulty running Perl scripts with #!, try
8889 installing Perl in a directory with a shorter pathname.
8890
8891 EOM
8892                         fi ;;
8893                 esac
8894                 ;;
8895         *) startperl=": # use perl"
8896                 ;;
8897         esac
8898         ;;
8899 esac
8900 echo "I'll use $startperl to start perl scripts."
8901
8902 : figure best path for perl in scripts
8903 case "$perlpath" in
8904 '')
8905         case "$versiononly" in
8906         "$define")      perlpath="$initialinstalllocation/perl$version";;
8907         *)              perlpath="$initialinstalllocation/perl";;
8908         esac
8909         case "$startperl" in
8910         *!*) ;;
8911         *)
8912                 $cat <<EOH
8913
8914 I will use the "eval 'exec'" idiom to start Perl on your system.
8915 I can use the full path of your Perl binary for this purpose, but
8916 doing so may cause problems if you want to share those scripts and
8917 Perl is not always in a standard place ($initialinstalllocation/perl).
8918
8919 EOH
8920                 dflt="$initialinstalllocation/perl"
8921                 rp="What path shall I use in \"eval 'exec'\"?"
8922                 . ./myread
8923                 perlpath="$ans"
8924                 ;;
8925         esac
8926         ;;
8927 esac
8928 case "$startperl" in
8929 *!*)    ;;
8930 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8931 esac
8932
8933 : determine where public executable scripts go
8934 set scriptdir scriptdir
8935 eval $prefixit
8936 case "$scriptdir" in
8937 '')
8938         dflt="$bin"
8939         : guess some guesses
8940         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8941         $test -d /usr/share/bin     && dflt=/usr/share/bin
8942         $test -d /usr/local/script  && dflt=/usr/local/script
8943         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8944         $test -d $prefixexp/script  && dflt=$prefixexp/script
8945         set dflt
8946         eval $prefixup
8947         ;;
8948 *)  dflt="$scriptdir"
8949         ;;
8950 esac
8951 $cat <<EOM
8952
8953 Some installations have a separate directory just for executable scripts so
8954 that they can mount it across multiple architectures but keep the scripts in
8955 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8956 Or you might just lump your scripts in with all your other executables.
8957
8958 EOM
8959 fn=d~
8960 rp='Where do you keep publicly executable scripts?'
8961 . ./getfile
8962 if $test "X$ansexp" != "X$scriptdirexp"; then
8963         installscript=''
8964 fi
8965 installscriptdir=''
8966 prefixvar=scriptdir
8967 . ./setprefixvar
8968 : A little fix up for an irregularly named variable.
8969 installscript="$installscriptdir"
8970
8971 : determine where add-on public executables go
8972 case "$sitebin" in
8973 '')     dflt=$siteprefix/bin ;;
8974 *)      dflt=$sitebin ;;
8975 esac
8976 fn=d~
8977 rp='Pathname where the add-on public executables should be installed?'
8978 . ./getfile
8979 prefixvar=sitebin
8980 . ./setprefixvar
8981
8982 : determine where add-on html pages go
8983 : There is no standard location, so try to copy the previously-selected
8984 : directory structure for the core html pages.
8985 case "$sitehtml1dir" in
8986 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8987 *)     dflt=$sitehtml1dir ;;
8988 esac
8989 case "$dflt" in
8990 ''|' ') dflt=none ;;
8991 esac
8992 fn=dn+~
8993 rp='Pathname where the site-specific html pages should be installed?'
8994 . ./getfile
8995 prefixvar=sitehtml1dir
8996 . ./setprefixvar
8997
8998 : determine where add-on library html pages go
8999 : There is no standard location, so try to copy the previously-selected
9000 : directory structure for the core html pages.
9001 case "$sitehtml3dir" in
9002 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9003 *)     dflt=$sitehtml3dir ;;
9004 esac
9005 case "$dflt" in
9006 ''|' ') dflt=none ;;
9007 esac
9008 fn=dn+~
9009 rp='Pathname where the site-specific library html pages should be installed?'
9010 . ./getfile
9011 prefixvar=sitehtml3dir
9012 . ./setprefixvar
9013
9014 : determine where add-on manual pages go
9015 case "$siteman1dir" in
9016 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9017 *)      dflt=$siteman1dir ;;
9018 esac
9019 case "$dflt" in
9020 ''|' ') dflt=none ;;
9021 esac
9022 fn=dn+~
9023 rp='Pathname where the site-specific manual pages should be installed?'
9024 . ./getfile
9025 prefixvar=siteman1dir
9026 . ./setprefixvar
9027
9028 : determine where add-on library man pages go
9029 case "$siteman3dir" in
9030 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9031 *)      dflt=$siteman3dir ;;
9032 esac
9033 case "$dflt" in
9034 ''|' ') dflt=none ;;
9035 esac
9036 fn=dn+~
9037 rp='Pathname where the site-specific library manual pages should be installed?'
9038 . ./getfile
9039 prefixvar=siteman3dir
9040 . ./setprefixvar
9041
9042 : determine where add-on public executable scripts go
9043 case "$sitescript" in
9044 '')     dflt=$siteprefix/script
9045         $test -d $dflt || dflt=$sitebin ;;
9046 *)  dflt="$sitescript" ;;
9047 esac
9048 fn=d~+
9049 rp='Pathname where add-on public executable scripts should be installed?'
9050 . ./getfile
9051 prefixvar=sitescript
9052 . ./setprefixvar
9053
9054 : Check if faststdio is requested and available
9055 case "$usefaststdio" in
9056 $define|true|[yY]*|'')
9057         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9058         case "$xversion" in
9059         [68])   dflt='y' ;;
9060         *)      dflt='n' ;;
9061         esac
9062         ;;
9063 *) dflt='n';;
9064 esac
9065 cat <<EOM
9066
9067 Perl can be built to use 'fast stdio', which means using the stdio
9068 library but also directly manipulating the stdio buffers to enable
9069 faster I/O.  Using stdio is better for backward compatibility (especially
9070 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9071 interface has been preferred instead of stdio.
9072
9073 If this doesn't make any sense to you, just accept the default '$dflt'.
9074 EOM
9075 rp='Use the "fast stdio" if available?'
9076 . ./myread
9077 case "$ans" in
9078 y|Y)    val="$define" ;;
9079 *)      val="$undef" ;;
9080 esac
9081 set usefaststdio
9082 eval $setvar
9083
9084
9085 : define an is-a-typedef? function
9086 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9087 case "$inclist" in
9088 "") inclist="sys/types.h";;
9089 esac;
9090 eval "varval=\$$var";
9091 case "$varval" in
9092 "")
9093         $rm -f temp.c;
9094         for inc in $inclist; do
9095                 echo "#include <$inc>" >>temp.c;
9096         done;
9097         echo "#ifdef $type" >> temp.c;
9098         echo "printf(\"We have $type\");" >> temp.c;
9099         echo "#endif" >> temp.c;
9100         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9101         if $contains $type temp.E >/dev/null 2>&1; then
9102                 eval "$var=\$type";
9103         else
9104                 eval "$var=\$def";
9105         fi;
9106         $rm -f temp.?;;
9107 *) eval "$var=\$varval";;
9108 esac'
9109
9110 : define an is-a-typedef? function that prompts if the type is not available.
9111 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9112 case "$inclist" in
9113 "") inclist="sys/types.h";;
9114 esac;
9115 eval "varval=\$$var";
9116 case "$varval" in
9117 "")
9118         $rm -f temp.c;
9119         for inc in $inclist; do
9120                 echo "#include <$inc>" >>temp.c;
9121         done;
9122         echo "#ifdef $type" >> temp.c;
9123         echo "printf(\"We have $type\");" >> temp.c;
9124         echo "#endif" >> temp.c;
9125         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9126         echo " " ;
9127         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9128         if $contains $type temp.E >/dev/null 2>&1; then
9129                 echo "$type found." >&4;
9130                 eval "$var=\$type";
9131         else
9132                 echo "$type NOT found." >&4;
9133                 dflt="$def";
9134                 . ./myread ;
9135                 eval "$var=\$ans";
9136         fi;
9137         $rm -f temp.?;;
9138 *) eval "$var=\$varval";;
9139 esac'
9140
9141 : see what type lseek is declared as in the kernel
9142 rp="What is the type used for lseek's offset on this system?"
9143 set off_t lseektype long stdio.h sys/types.h
9144 eval $typedef_ask
9145
9146 echo " "
9147 echo "Checking to see how big your file offsets are..." >&4
9148 $cat >try.c <<EOCP
9149 #include <sys/types.h>
9150 #include <stdio.h>
9151 int main()
9152 {
9153     printf("%d\n", (int)sizeof($lseektype));
9154     return(0);
9155 }
9156 EOCP
9157 set try
9158 if eval $compile_ok; then
9159         lseeksize=`$run ./try`
9160         echo "Your file offsets are $lseeksize bytes long."
9161 else
9162         dflt=$longsize
9163         echo " "
9164         echo "(I can't seem to compile the test program.  Guessing...)"
9165         rp="What is the size of your file offsets (in bytes)?"
9166         . ./myread
9167         lseeksize="$ans"
9168 fi
9169 $rm_try
9170
9171 : see what type file positions are declared as in the library
9172 rp="What is the type for file position used by fsetpos()?"
9173 set fpos_t fpostype long stdio.h sys/types.h
9174 eval $typedef_ask
9175
9176 : Check size for Fpos_t
9177 echo " "
9178 case "$fpostype" in
9179 *_t) zzz="$fpostype"    ;;
9180 *)   zzz="fpos_t"       ;;
9181 esac
9182 echo "Checking the size of $zzz..." >&4
9183 cat > try.c <<EOCP
9184 #include <sys/types.h>
9185 #include <stdio.h>
9186 #$i_stdlib I_STDLIB
9187 #ifdef I_STDLIB
9188 #include <stdlib.h>
9189 #endif
9190 int main() {
9191     printf("%d\n", (int)sizeof($fpostype));
9192     exit(0);
9193 }
9194 EOCP
9195 set try
9196 if eval $compile_ok; then
9197         yyy=`$run ./try`
9198         case "$yyy" in
9199         '')     fpossize=4
9200                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9201                 ;;
9202         *)      fpossize=$yyy
9203                 echo "Your $zzz is $fpossize bytes long."
9204                 ;;
9205         esac
9206 else
9207         dflt="$longsize"
9208         echo " " >&4
9209         echo "(I can't compile the test program.  Guessing...)" >&4
9210         rp="What is the size of your file positions (in bytes)?"
9211         . ./myread
9212         fpossize="$ans"
9213 fi
9214
9215 : Check for large file support
9216 # Backward compatibility (uselfs is deprecated).
9217 case "$uselfs" in
9218 "$define"|true|[yY]*)
9219         cat <<EOM >&4
9220
9221 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9222 EOM
9223         uselargefiles="$define"
9224         ;;
9225 esac
9226
9227 case "$lseeksize:$fpossize" in
9228 8:8) cat <<EOM
9229
9230 You can have files larger than 2 gigabytes.
9231 EOM
9232    val="$define" ;;
9233 *)    case "$uselargefiles" in
9234    "$undef"|false|[nN]*) dflt='n' ;;
9235    *)   dflt='y' ;;
9236    esac
9237    cat <<EOM
9238
9239 Perl can be built to understand large files (files larger than 2 gigabytes)
9240 on some systems.  To do so, Configure can be run with -Duselargefiles.
9241
9242 If this doesn't make any sense to you, just accept the default '$dflt'.
9243 EOM
9244    rp='Try to understand large files, if available?'
9245    . ./myread
9246    case "$ans" in
9247    y|Y)         val="$define" ;;
9248    *)           val="$undef"  ;;
9249    esac
9250    ;;
9251 esac
9252 set uselargefiles
9253 eval $setvar
9254 : Look for a hint-file generated 'call-back-unit'.  If the
9255 : user has specified that a large files perl is to be built,
9256 : we may need to set or change some other defaults.
9257 if $test -f uselargefiles.cbu; then
9258         echo "Your platform has some specific hints regarding large file builds, using them..."
9259         . ./uselargefiles.cbu
9260 fi
9261 case "$uselargefiles" in
9262 "$define")
9263         if $test -f uselargefiles.cbu; then
9264                 echo " "
9265                 echo "Rechecking to see how big your file offsets are..." >&4
9266                 $cat >try.c <<EOCP
9267 #include <sys/types.h>
9268 #include <stdio.h>
9269 int main()
9270 {
9271     printf("%d\n", (int)sizeof($lseektype));
9272     return(0);
9273 }
9274 EOCP
9275                 set try
9276                 if eval $compile_ok; then
9277                         lseeksize=`$run ./try`
9278                         $echo "Your file offsets are now $lseeksize bytes long."
9279                 else
9280                         dflt="$lseeksize"
9281                         echo " "
9282                         echo "(I can't seem to compile the test program.  Guessing...)"
9283                         rp="What is the size of your file offsets (in bytes)?"
9284                         . ./myread
9285                         lseeksize="$ans"
9286                 fi
9287                 case "$fpostype" in
9288                 *_t) zzz="$fpostype"    ;;
9289                 *)   zzz="fpos_t"       ;;
9290                 esac
9291                 $echo $n "Rechecking the size of $zzz...$c" >&4
9292                 $cat > try.c <<EOCP
9293 #include <sys/types.h>
9294 #include <stdio.h>
9295 #$i_stdlib I_STDLIB
9296 #ifdef I_STDLIB
9297 #include <stdlib.h>
9298 #endif
9299 int main() {
9300     printf("%d\n", (int)sizeof($fpostype));
9301     return(0);
9302 }
9303 EOCP
9304                 set try
9305                 if eval $compile_ok; then
9306                         yyy=`$run ./try`
9307                         dflt="$lseeksize"
9308                         case "$yyy" in
9309                         '')     echo " "
9310                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9311                                 ;;
9312                         *)      fpossize=$yyy
9313                                 echo " $fpossize bytes." >&4
9314                                 ;;
9315                         esac
9316                 else
9317                         dflt="$fpossize"
9318                         echo " "
9319                         echo "(I can't compile the test program.  Guessing...)" >&4
9320                         rp="What is the size of your file positions (in bytes)?"
9321                         . ./myread
9322                         fpossize="$ans"
9323                 fi
9324                 $rm_try
9325         fi
9326         ;;
9327 esac
9328
9329 : Set the vendorbin variables
9330 case "$vendorprefix" in
9331 '')     d_vendorbin="$undef"
9332         vendorbin=''
9333         vendorbinexp=''
9334         ;;
9335 *)      d_vendorbin="$define"
9336         : determine where vendor-supplied executables go.
9337         case "$vendorbin" in
9338         '') dflt=$vendorprefix/bin ;;
9339         *)      dflt="$vendorbin" ;;
9340         esac
9341         fn=d~+
9342         rp='Pathname for the vendor-supplied executables directory?'
9343         . ./getfile
9344         vendorbin="$ans"
9345         vendorbinexp="$ansexp"
9346         ;;
9347 esac
9348 prefixvar=vendorbin
9349 . ./installprefix
9350
9351 : Set the vendorhtml1dir variables
9352 case "$vendorprefix" in
9353 '')     vendorhtml1dir=''
9354         vendorhtml1direxp=''
9355         ;;
9356 *)      : determine where vendor-supplied html pages go.
9357         : There is no standard location, so try to copy the previously-selected
9358         : directory structure for the core html pages.
9359         : XXX Better default suggestions would be welcome.
9360         case "$vendorhtml1dir" in
9361         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9362         *)      dflt=$vendorhtml1dir ;;
9363         esac
9364         case "$dflt" in
9365         ''|' ') dflt=none ;;
9366         esac
9367         fn=dn+~
9368         rp='Pathname for the vendor-supplied html pages?'
9369         . ./getfile
9370         vendorhtml1dir="$ans"
9371         vendorhtml1direxp="$ansexp"
9372         ;;
9373 esac
9374 : Use ' ' for none so value is preserved next time through Configure
9375 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9376 prefixvar=vendorhtml1dir
9377 . ./installprefix
9378
9379 : Set the vendorhtml3dir variables
9380 case "$vendorprefix" in
9381 '')     vendorhtml3dir=''
9382         vendorhtml3direxp=''
9383         ;;
9384 *)      : determine where vendor-supplied module html pages go.
9385         : There is no standard location, so try to copy the previously-selected
9386         : directory structure for the core html pages.
9387         : XXX Better default suggestions would be welcome.
9388         case "$vendorhtml3dir" in
9389         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9390         *)      dflt=$vendorhtml3dir ;;
9391         esac
9392         case "$dflt" in
9393         ''|' ') dflt=none ;;
9394         esac
9395         fn=dn+~
9396         rp='Pathname for the vendor-supplied html pages?'
9397         . ./getfile
9398         vendorhtml3dir="$ans"
9399         vendorhtml3direxp="$ansexp"
9400         ;;
9401 esac
9402 : Use ' ' for none so value is preserved next time through Configure
9403 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9404 prefixvar=vendorhtml3dir
9405 . ./installprefix
9406
9407 : Set the vendorman1dir variables
9408 case "$vendorprefix" in
9409 '')     vendorman1dir=''
9410         vendorman1direxp=''
9411         ;;
9412 *)      : determine where vendor-supplied manual pages go.
9413         case "$vendorman1dir" in
9414         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9415         *)      dflt=$vendorman1dir ;;
9416         esac
9417         case "$dflt" in
9418         ''|' ') dflt=none ;;
9419         esac
9420         fn=nd~+
9421         rp='Pathname for the vendor-supplied manual section 1 pages?'
9422         . ./getfile
9423         vendorman1dir="$ans"
9424         vendorman1direxp="$ansexp"
9425         ;;
9426 esac
9427 : Use ' ' for none so value is preserved next time through Configure
9428 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9429 prefixvar=vendorman1dir
9430 . ./installprefix
9431
9432 : Set the vendorman3dir variables
9433 case "$vendorprefix" in
9434 '')     vendorman3dir=''
9435         vendorman3direxp=''
9436         ;;
9437 *)      : determine where vendor-supplied module manual pages go.
9438         case "$vendorman3dir" in
9439         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9440         *)      dflt=$vendorman3dir ;;
9441         esac
9442         case "$dflt" in
9443         ''|' ') dflt=none ;;
9444         esac
9445         fn=nd~+
9446         rp='Pathname for the vendor-supplied manual section 3 pages?'
9447         . ./getfile
9448         vendorman3dir="$ans"
9449         vendorman3direxp="$ansexp"
9450         ;;
9451 esac
9452 : Use ' ' for none so value is preserved next time through Configure
9453 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9454 prefixvar=vendorman3dir
9455 . ./installprefix
9456
9457 : Set the vendorscript variables
9458 case "$vendorprefix" in
9459 '')     d_vendorscript="$undef"
9460         vendorscript=''
9461         vendorscriptexp=''
9462         ;;
9463 *)      d_vendorscript="$define"
9464         : determine where vendor-supplied scripts go.
9465         case "$vendorscript" in
9466         '')     dflt=$vendorprefix/script
9467                 $test -d $dflt || dflt=$vendorbin ;;
9468         *)  dflt="$vendorscript" ;;
9469         esac
9470         $cat <<EOM
9471
9472 The installation process will create a directory for
9473 vendor-supplied scripts.
9474
9475 EOM
9476         fn=d~+
9477         rp='Pathname for the vendor-supplied scripts directory?'
9478         . ./getfile
9479         vendorscript="$ans"
9480         vendorscriptexp="$ansexp"
9481         ;;
9482 esac
9483 prefixvar=vendorscript
9484 . ./installprefix
9485
9486 : see if qgcvt exists
9487 set qgcvt d_qgcvt
9488 eval $inlibc
9489
9490 : Check print/scan long double stuff
9491 echo " "
9492
9493 if $test X"$d_longdbl" = X"$define"; then
9494
9495 echo "Checking how to print long doubles..." >&4
9496
9497 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9498         $cat >try.c <<'EOCP'
9499 #include <sys/types.h>
9500 #include <stdio.h>
9501 int main() {
9502   double d = 123.456;
9503   printf("%.3f\n", d);
9504 }
9505 EOCP
9506         set try
9507         if eval $compile; then
9508                 yyy=`$run ./try`
9509                 case "$yyy" in
9510                 123.456)
9511                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9512                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9513                         echo "We will use %f."
9514                         ;;
9515                 esac
9516         fi
9517 fi
9518
9519 if $test X"$sPRIfldbl" = X; then
9520         $cat >try.c <<'EOCP'
9521 #include <sys/types.h>
9522 #include <stdio.h>
9523 int main() {
9524   long double d = 123.456;
9525   printf("%.3Lf\n", d);
9526 }
9527 EOCP
9528         set try
9529         if eval $compile; then
9530                 yyy=`$run ./try`
9531                 case "$yyy" in
9532                 123.456)
9533                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9534                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9535                         echo "We will use %Lf."
9536                         ;;
9537                 esac
9538         fi
9539 fi
9540
9541 if $test X"$sPRIfldbl" = X; then
9542         $cat >try.c <<'EOCP'
9543 #include <sys/types.h>
9544 #include <stdio.h>
9545 int main() {
9546   long double d = 123.456;
9547   printf("%.3llf\n", d);
9548 }
9549 EOCP
9550         set try
9551         if eval $compile; then
9552                 yyy=`$run ./try`
9553                 case "$yyy" in
9554                 123.456)
9555                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9556                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9557                         echo "We will use %llf."
9558                         ;;
9559                 esac
9560         fi
9561 fi
9562
9563 if $test X"$sPRIfldbl" = X; then
9564         $cat >try.c <<'EOCP'
9565 #include <sys/types.h>
9566 #include <stdio.h>
9567 int main() {
9568   long double d = 123.456;
9569   printf("%.3lf\n", d);
9570 }
9571 EOCP
9572         set try
9573         if eval $compile; then
9574                 yyy=`$run ./try`
9575                 case "$yyy" in
9576                 123.456)
9577                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9578                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9579                         echo "We will use %lf."
9580                         ;;
9581                 esac
9582         fi
9583 fi
9584
9585 if $test X"$sPRIfldbl" = X; then
9586         echo "Cannot figure out how to print long doubles." >&4
9587 else
9588         sSCNfldbl=$sPRIfldbl    # expect consistency
9589 fi
9590
9591 $rm_try
9592
9593 fi # d_longdbl
9594
9595 case "$sPRIfldbl" in
9596 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9597         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9598         d_SCNfldbl="$undef";
9599         ;;
9600 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9601         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9602         d_SCNfldbl="$define";
9603         ;;
9604 esac
9605
9606 : Check how to convert floats to strings.
9607
9608 if test "X$d_Gconvert" = X; then
9609
9610 echo " "
9611 echo "Checking for an efficient way to convert floats to strings."
9612 echo " " > try.c
9613 case "$uselongdouble" in
9614 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9615 esac
9616 case "$d_longdbl" in
9617 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9618 esac
9619 case "$d_PRIgldbl" in
9620 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9621 esac
9622 $cat >>try.c <<EOP
9623 #ifdef TRY_gconvert
9624 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9625 char *myname = "gconvert";
9626 #endif
9627 #ifdef TRY_gcvt
9628 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9629 char *myname = "gcvt";
9630 #endif
9631 #ifdef TRY_qgcvt
9632 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9633 char *myname = "qgcvt";
9634 #define DOUBLETYPE long double
9635 #endif
9636 #ifdef TRY_sprintf
9637 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9638 #ifdef HAS_PRIgldbl
9639 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9640 #else
9641 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9642 #endif
9643 #else
9644 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9645 #endif
9646 char *myname = "sprintf";
9647 #endif
9648
9649 #ifndef DOUBLETYPE
9650 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9651 #define DOUBLETYPE long double
9652 #else
9653 #define DOUBLETYPE double
9654 #endif
9655 #endif
9656
9657 #include <stdio.h>
9658
9659 #define I_STDLIB $i_stdlib
9660 #ifdef I_STDLIB
9661 #include <stdlib.h>
9662 #endif
9663
9664 int
9665 checkit(expect, got)
9666 char *expect;
9667 char *got;
9668 {
9669     if (strcmp(expect, got)) {
9670                 printf("%s oddity:  Expected %s, got %s\n",
9671                         myname, expect, got);
9672                 exit(1);
9673         }
9674 }
9675
9676 int main()
9677 {
9678         char buf[64];
9679         buf[63] = '\0';
9680
9681         /* This must be 1st test on (which?) platform */
9682         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9683         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9684         checkit("0.1", buf);
9685
9686         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9687         checkit("0.01", buf);
9688
9689         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9690         checkit("0.001", buf);
9691
9692         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9693         checkit("0.0001", buf);
9694
9695         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9696         if (strlen(buf) > 5)
9697             checkit("9e-005", buf); /* for Microsoft ?? */
9698         else
9699             checkit("9e-05", buf);
9700
9701         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9702         checkit("1", buf);
9703
9704         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9705         checkit("1.1", buf);
9706
9707         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9708         checkit("1.01", buf);
9709
9710         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9711         checkit("1.001", buf);
9712
9713         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9714         checkit("1.0001", buf);
9715
9716         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9717         checkit("1.00001", buf);
9718
9719         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9720         checkit("1.000001", buf);
9721
9722         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9723         checkit("0", buf);
9724
9725         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9726         checkit("-1", buf);
9727
9728         /* Some Linux gcvt's give 1.e+5 here. */
9729         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9730         checkit("100000", buf);
9731
9732         /* Some Linux gcvt's give -1.e+5 here. */
9733         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9734         checkit("-100000", buf);
9735
9736         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9737         checkit("123.456", buf);
9738
9739         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9740         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9741         /* 34 should be enough to scare even long double
9742          * places into using the e notation. */
9743         if (strlen(buf) > 5)
9744             checkit("1e+034", buf); /* for Microsoft */
9745         else
9746             checkit("1e+34", buf);
9747
9748         /* For Perl, if you add additional tests here, also add them to
9749          * t/base/num.t for benefit of platforms not using Configure or
9750          * overriding d_Gconvert */
9751
9752         exit(0);
9753 }
9754 EOP
9755 : first add preferred functions to our list
9756 xxx_list=""
9757 for xxx_convert in $gconvert_preference; do
9758     case $xxx_convert in
9759     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9760     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9761     esac
9762 done
9763 : then add any others
9764 for xxx_convert in gconvert gcvt sprintf; do
9765     case "$xxx_list" in
9766     *$xxx_convert*) ;;
9767     *) xxx_list="$xxx_list $xxx_convert" ;;
9768     esac
9769 done
9770
9771 case "$d_longdbl$uselongdouble" in
9772 "$define$define")
9773     : again, add prefered functions to our list first
9774     xxx_ld_list=""
9775     for xxx_convert in $gconvert_ld_preference; do
9776         case $xxx_convert in
9777         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9778         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9779         esac
9780     done
9781     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9782     for xxx_convert in qgcvt sprintf $xxx_list; do
9783         case "$xxx_ld_list" in
9784         $xxx_convert*|*" $xxx_convert"*) ;;
9785         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9786         esac
9787     done
9788     : if sprintf cannot do long doubles, move it to the end
9789     if test "$d_PRIgldbl" != "$define"; then
9790         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9791     fi
9792     : if no qgcvt, remove it
9793     if test "$d_qgcvt" != "$define"; then
9794         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9795     fi
9796     : use the ld_list
9797     xxx_list="$xxx_ld_list"
9798     ;;
9799 esac
9800
9801 for xxx_convert in $xxx_list; do
9802         echo "Trying $xxx_convert..."
9803         $rm -f try try$_o core
9804         set try -DTRY_$xxx_convert
9805         if eval $compile; then
9806                 echo "$xxx_convert() found." >&4
9807                 if $run ./try; then
9808                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9809                         break;
9810                 else
9811                         echo "...But $xxx_convert didn't work as I expected."
9812                         xxx_convert=''
9813                 fi
9814         else
9815                 echo "$xxx_convert NOT found." >&4
9816         fi
9817 done
9818
9819 if test X$xxx_convert = X; then
9820     echo "*** WHOA THERE!!! ***" >&4
9821     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9822     xxx_convert=sprintf
9823 fi
9824
9825 case "$xxx_convert" in
9826 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9827 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9828 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9829 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9830    "$define$define$define")
9831       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9832    "$define$define$undef")
9833       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9834    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9835    esac
9836    ;;
9837 esac
9838
9839 fi
9840 $rm_try
9841
9842 : see if _fwalk exists
9843 set fwalk d__fwalk
9844 eval $inlibc
9845
9846 : Initialize h_fcntl
9847 h_fcntl=false
9848
9849 : Initialize h_sysfile
9850 h_sysfile=false
9851
9852 : access call always available on UNIX
9853 set access d_access
9854 eval $inlibc
9855
9856 : locate the flags for 'access()'
9857 case "$d_access" in
9858 "$define")
9859         echo " "
9860         $cat >access.c <<EOCP
9861 #include <sys/types.h>
9862 #ifdef I_FCNTL
9863 #include <fcntl.h>
9864 #endif
9865 #ifdef I_SYS_FILE
9866 #include <sys/file.h>
9867 #endif
9868 #ifdef I_UNISTD
9869 #include <unistd.h>
9870 #endif
9871 #$i_stdlib I_STDLIB
9872 #ifdef I_STDLIB
9873 #include <stdlib.h>
9874 #endif
9875 int main() {
9876         exit(R_OK);
9877 }
9878 EOCP
9879         : check sys/file.h first, no particular reason here
9880         if $test `./findhdr sys/file.h` && \
9881                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9882                 h_sysfile=true;
9883                 echo "<sys/file.h> defines the *_OK access constants." >&4
9884         elif $test `./findhdr fcntl.h` && \
9885                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9886                 h_fcntl=true;
9887                 echo "<fcntl.h> defines the *_OK access constants." >&4
9888         elif $test `./findhdr unistd.h` && \
9889                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9890                 echo "<unistd.h> defines the *_OK access constants." >&4
9891         else
9892                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9893         fi
9894         ;;
9895 esac
9896 $rm -f access*
9897
9898 : see if accessx exists
9899 set accessx d_accessx
9900 eval $inlibc
9901
9902 : see if aintl exists
9903 set aintl d_aintl
9904 eval $inlibc
9905
9906 : see if alarm exists
9907 set alarm d_alarm
9908 eval $inlibc
9909
9910 : see if POSIX threads are available
9911 set pthread.h i_pthread
9912 eval $inhdr
9913
9914 : define a fucntion to check prototypes
9915 $cat > protochk <<EOSH
9916 $startsh
9917 cc="$cc"
9918 optimize="$optimize"
9919 ccflags="$ccflags"
9920 prototype="$prototype"
9921 define="$define"
9922 rm_try="$rm_try"
9923 usethreads=$usethreads
9924 i_pthread=$i_pthread
9925 pthread_h_first=$pthread_h_first
9926 EOSH
9927
9928 $cat >> protochk <<'EOSH'
9929
9930 $rm_try
9931 foo="$1"
9932 shift
9933 while test $# -ge 2; do
9934         case "$1" in
9935                 $define) echo "#include <$2>" >> try.c ;;
9936                 literal) echo "$2" >> try.c ;;
9937         esac
9938     # Extra magic for the benefit of systems that need pthread.h
9939     # to be included early to correctly detect threadsafe functions.
9940     # Such functions must guarantee themselves, though, that the usethreads
9941     # and i_pthread have been defined, before calling protochk.
9942     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9943         echo "#include <pthread.h>" >> try.c
9944         pthread_h_done=yes
9945     fi
9946     shift 2
9947 done
9948 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9949 cat >> try.c <<'EOCP'
9950 #ifdef CAN_PROTOTYPE
9951 #define _(args) args
9952 #else
9953 #define _(args) ()
9954 #endif
9955 EOCP
9956 echo "$foo" >> try.c
9957 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9958 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9959 status=$?
9960 $rm_try
9961 exit $status
9962 EOSH
9963 chmod +x protochk
9964 $eunicefix protochk
9965
9966 : Define hasproto macro for Configure internal use
9967 hasproto='varname=$1; func=$2; shift; shift;
9968 while $test $# -ge 2; do
9969         case "$1" in
9970         $define) echo "#include <$2>";;
9971         esac ;
9972     shift 2;
9973 done > try.c;
9974 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9975 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9976         echo "$func() prototype found.";
9977         val="$define";
9978 else
9979         echo "$func() prototype NOT found.";
9980         val="$undef";
9981 fi;
9982 set $varname;
9983 eval $setvar;
9984 $rm_try tryout.c'
9985
9986 : see if sys/types.h has to be included
9987 set sys/types.h i_systypes
9988 eval $inhdr
9989
9990 : see if sys/select.h has to be included
9991 set sys/select.h i_sysselct
9992 eval $inhdr
9993
9994 : Define hasfield macro for Configure internal use
9995 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9996 while $test $# -ge 2; do
9997         case "$1" in
9998         $define) echo "#include <$2>";;
9999         esac ;
10000     shift 2;
10001 done > try.c;
10002 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10003 set try;
10004 if eval $compile; then
10005         val="$define";
10006 else
10007         val="$undef";
10008 fi;
10009 set $varname;
10010 eval $setvar;
10011 $rm_try'
10012
10013 : see if we should include time.h, sys/time.h, or both
10014 echo " "
10015 if test "X$timeincl" = X; then
10016         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10017         $echo $n "I'm now running the test program...$c"
10018         $cat >try.c <<EOCP
10019 #include <sys/types.h>
10020 #ifdef I_TIME
10021 #include <time.h>
10022 #endif
10023 #ifdef I_SYSTIME
10024 #ifdef SYSTIMEKERNEL
10025 #define KERNEL
10026 #endif
10027 #include <sys/time.h>
10028 #endif
10029 #ifdef I_SYSSELECT
10030 #include <sys/select.h>
10031 #endif
10032 #$i_stdlib I_STDLIB
10033 #ifdef I_STDLIB
10034 #include <stdlib.h>
10035 #endif
10036 int main()
10037 {
10038         struct tm foo;
10039 #ifdef S_TIMEVAL
10040         struct timeval bar;
10041 #endif
10042 #ifdef S_TIMEZONE
10043         struct timezone tzp;
10044 #endif
10045         if (foo.tm_sec == foo.tm_sec)
10046                 exit(0);
10047 #ifdef S_TIMEVAL
10048         if (bar.tv_sec == bar.tv_sec)
10049                 exit(0);
10050 #endif
10051         exit(1);
10052 }
10053 EOCP
10054         flags=''
10055         for s_timezone in '-DS_TIMEZONE' ''; do
10056         sysselect=''
10057         for s_timeval in '-DS_TIMEVAL' ''; do
10058         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10059         for i_time in '' '-DI_TIME'; do
10060         for i_systime in '-DI_SYSTIME' ''; do
10061                 case "$flags" in
10062                 '') $echo $n ".$c"
10063                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10064                         if eval $compile; then
10065                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10066                                 shift
10067                                 flags="$*"
10068                                 echo " "
10069                                 $echo $n "Succeeded with $flags$c"
10070                         fi
10071                         ;;
10072                 esac
10073         done
10074         done
10075         done
10076         done
10077         done
10078         timeincl=''
10079         echo " "
10080         case "$flags" in
10081         *SYSTIMEKERNEL*) i_systimek="$define"
10082                 timeincl=`./findhdr sys/time.h`
10083                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10084         *) i_systimek="$undef";;
10085         esac
10086         case "$flags" in
10087         *I_TIME*) i_time="$define"
10088                 timeincl=`./findhdr time.h`" $timeincl"
10089                 echo "We'll include <time.h>." >&4;;
10090         *) i_time="$undef";;
10091         esac
10092         case "$flags" in
10093         *I_SYSTIME*) i_systime="$define"
10094                 timeincl=`./findhdr sys/time.h`" $timeincl"
10095                 echo "We'll include <sys/time.h>." >&4;;
10096         *) i_systime="$undef";;
10097         esac
10098         $rm_try
10099 fi
10100 : see if struct tm knows about tm_zone
10101 case "$i_systime$i_time" in
10102 *$define*)
10103         echo " "
10104         echo "Checking to see if your struct tm has tm_zone field..." >&4
10105         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10106         eval $hasfield
10107         ;;
10108 *)      val="$undef"
10109         set d_tm_tm_zone
10110         eval $setvar
10111         ;;
10112 esac
10113 case "$d_tm_tm_zone" in
10114 "$define")      echo "Yes, it does."   ;;
10115 *)              echo "No, it doesn't." ;;
10116 esac
10117 : see if struct tm knows about tm_gmtoff
10118 case "$i_systime$i_time" in
10119 *$define*)
10120         echo " "
10121         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10122         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10123         eval $hasfield
10124         ;;
10125 *)      val="$undef"
10126         set d_tm_tm_gmtoff
10127         eval $setvar
10128         ;;
10129 esac
10130 case "$d_tm_tm_gmtoff" in
10131 "$define")      echo "Yes, it does."   ;;
10132 *)              echo "No, it doesn't." ;;
10133 esac
10134
10135 : see if asctime_r exists
10136 set asctime_r d_asctime_r
10137 eval $inlibc
10138 case "$d_asctime_r" in
10139 "$define")
10140         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10141         case "$d_asctime_r_proto:$usethreads" in
10142         ":define")      d_asctime_r_proto=define
10143                 set d_asctime_r_proto asctime_r $hdrs
10144                 eval $hasproto ;;
10145         *)      ;;
10146         esac
10147         case "$d_asctime_r_proto" in
10148         define)
10149         case "$asctime_r_proto" in
10150         ''|0) try='char* asctime_r(const struct tm*, char*);'
10151         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
10152         esac
10153         case "$asctime_r_proto" in
10154         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10155         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
10156         esac
10157         case "$asctime_r_proto" in
10158         ''|0) try='int asctime_r(const struct tm*, char*);'
10159         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
10160         esac
10161         case "$asctime_r_proto" in
10162         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10163         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
10164         esac
10165         case "$asctime_r_proto" in
10166         ''|0)   d_asctime_r=undef
10167                 asctime_r_proto=0
10168                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10169         * )     case "$asctime_r_proto" in
10170                 REENTRANT_PROTO*) ;;
10171                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10172                 esac
10173                 echo "Prototype: $try" ;;
10174         esac
10175         ;;
10176         *)      case "$usethreads" in
10177                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10178                 esac
10179                 d_asctime_r=undef
10180                 asctime_r_proto=0
10181                 ;;
10182         esac
10183         ;;
10184 *)      asctime_r_proto=0
10185         ;;
10186 esac
10187
10188 : see if atolf exists
10189 set atolf d_atolf
10190 eval $inlibc
10191
10192 : see if atoll exists
10193 set atoll d_atoll
10194 eval $inlibc
10195
10196 : Look for GCC-style attribute format
10197 case "$d_attribute_format" in
10198 '')
10199 echo " "
10200 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10201 $cat >attrib.c <<'EOCP'
10202 #include <stdio.h>
10203 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10204 EOCP
10205 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10206         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10207                 echo "Your C compiler doesn't support __attribute__((format))."
10208                 val="$undef"
10209         else
10210                 echo "Your C compiler supports __attribute__((format))."
10211                 val="$define"
10212         fi
10213 else
10214         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10215         val="$undef"
10216 fi
10217 ;;
10218 *) val="$d_attribute_format" ;;
10219 esac
10220 set d_attribute_format
10221 eval $setvar
10222 $rm -f attrib*
10223
10224 : Look for GCC-style attribute format with null format allowed
10225 case "$d_printf_format_null" in
10226 '') case "$d_attribute_format" in
10227     $define)
10228         echo " "
10229         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10230 $cat >attrib.c <<EOCP
10231 #include <stdio.h>
10232 #$i_stdlib I_STDLIB
10233 #ifdef I_STDLIB
10234 #include <stdlib.h>
10235 #endif
10236 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10237 int null_printf (char* pat,...) { return (int)pat; }
10238 int main () { exit(null_printf(NULL)); }
10239 EOCP
10240         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10241             : run the executable in case it produces a run-time warning
10242             if $run ./attrib >>attrib.out 2>&1; then
10243                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10244                     echo "Your C compiler doesn't allow __printf__ format to be null."
10245                     val="$undef"
10246                 else
10247                     echo "Your C compiler allows __printf__ format to be null."
10248                     val="$define"
10249                 fi
10250             else
10251             echo "Your C compiler executable failed with __printf__ format null."
10252             val="$undef"
10253         fi
10254     else
10255         echo "Your C compiler fails with __printf__ format null."
10256         val="$undef"
10257     fi
10258     ;;
10259     *)  val="$undef" ;;
10260     esac
10261 ;;
10262 *)  val="$d_printf_format_null" ;;
10263 esac
10264 set d_printf_format_null
10265 eval $setvar
10266 $rm -f attrib*
10267
10268 : Look for GCC-style attribute malloc
10269 case "$d_attribute_malloc" in
10270 '')
10271 echo " "
10272 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10273 $cat >attrib.c <<'EOCP'
10274 #include <stdio.h>
10275 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10276 EOCP
10277 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10278         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10279                 echo "Your C compiler doesn't support __attribute__((malloc))."
10280                 val="$undef"
10281         else
10282                 echo "Your C compiler supports __attribute__((malloc))."
10283                 val="$define"
10284         fi
10285 else
10286         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10287         val="$undef"
10288 fi
10289 ;;
10290 *) val="$d_attribute_malloc" ;;
10291 esac
10292 set d_attribute_malloc
10293 eval $setvar
10294 $rm -f attrib*
10295
10296 : Look for GCC-style attribute nonnull
10297 case "$d_attribute_nonnull" in
10298 '')
10299 echo " "
10300 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10301 $cat >attrib.c <<'EOCP'
10302 #include <stdio.h>
10303 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10304 EOCP
10305 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10306         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10307                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10308                 val="$undef"
10309         else
10310                 echo "Your C compiler supports __attribute__((nonnull))."
10311                 val="$define"
10312         fi
10313 else
10314         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10315         val="$undef"
10316 fi
10317 ;;
10318 *) val="$d_attribute_nonnull" ;;
10319 esac
10320 set d_attribute_nonnull
10321 eval $setvar
10322 $rm -f attrib*
10323
10324 : Look for GCC-style attribute noreturn
10325 case "$d_attribute_noreturn" in
10326 '')
10327 echo " "
10328 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10329 $cat >attrib.c <<'EOCP'
10330 #include <stdio.h>
10331 void fall_over_dead( void ) __attribute__((noreturn));
10332 EOCP
10333 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10334         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10335                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10336                 val="$undef"
10337         else
10338                 echo "Your C compiler supports __attribute__((noreturn))."
10339                 val="$define"
10340         fi
10341 else
10342         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10343         val="$undef"
10344 fi
10345 ;;
10346 *) val="$d_attribute_noreturn" ;;
10347 esac
10348 set d_attribute_noreturn
10349 eval $setvar
10350 $rm -f attrib*
10351
10352 : Look for GCC-style attribute pure
10353 case "$d_attribute_pure" in
10354 '')
10355 echo " "
10356 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10357 $cat >attrib.c <<'EOCP'
10358 #include <stdio.h>
10359 int square( int n ) __attribute__((pure));
10360 EOCP
10361 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10362         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10363                 echo "Your C compiler doesn't support __attribute__((pure))."
10364                 val="$undef"
10365         else
10366                 echo "Your C compiler supports __attribute__((pure))."
10367                 val="$define"
10368         fi
10369 else
10370         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10371         val="$undef"
10372 fi
10373 ;;
10374 *) val="$d_attribute_pure" ;;
10375 esac
10376 set d_attribute_pure
10377 eval $setvar
10378 $rm -f attrib*
10379
10380 : Look for GCC-style attribute unused
10381 case "$d_attribute_unused" in
10382 '')
10383 echo " "
10384 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10385 $cat >attrib.c <<'EOCP'
10386 #include <stdio.h>
10387 int do_something( int dummy __attribute__((unused)), int n );
10388 EOCP
10389 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10390         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10391                 echo "Your C compiler doesn't support __attribute__((unused))."
10392                 val="$undef"
10393         else
10394                 echo "Your C compiler supports __attribute__((unused))."
10395                 val="$define"
10396         fi
10397 else
10398         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10399         val="$undef"
10400 fi
10401 ;;
10402 *) val="$d_attribute_unused" ;;
10403 esac
10404 set d_attribute_unused
10405 eval $setvar
10406 $rm -f attrib*
10407
10408 : Look for GCC-style attribute warn_unused_result
10409 case "$d_attribute_warn_unused_result" in
10410 '')
10411 echo " "
10412 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10413 $cat >attrib.c <<'EOCP'
10414 #include <stdio.h>
10415 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10416 EOCP
10417 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10418         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10419                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10420                 val="$undef"
10421         else
10422                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10423                 val="$define"
10424         fi
10425 else
10426         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10427         val="$undef"
10428 fi
10429 ;;
10430 *) val="$d_attribute_warn_unused_result" ;;
10431 esac
10432 set d_attribute_warn_unused_result
10433 eval $setvar
10434 $rm -f attrib*
10435
10436 : see if bcmp exists
10437 set bcmp d_bcmp
10438 eval $inlibc
10439
10440 : see if bcopy exists
10441 set bcopy d_bcopy
10442 eval $inlibc
10443
10444 : see if getpgrp exists
10445 set getpgrp d_getpgrp
10446 eval $inlibc
10447
10448 case "$d_getpgrp" in
10449 "$define")
10450         echo " "
10451         echo "Checking to see which flavor of getpgrp is in use..."
10452         $cat >try.c <<EOP
10453 #$i_unistd I_UNISTD
10454 #include <sys/types.h>
10455 #ifdef I_UNISTD
10456 #  include <unistd.h>
10457 #endif
10458 #$i_stdlib I_STDLIB
10459 #ifdef I_STDLIB
10460 #include <stdlib.h>
10461 #endif
10462 int main()
10463 {
10464         if (getuid() == 0) {
10465                 printf("(I see you are running Configure as super-user...)\n");
10466                 setuid(1);
10467         }
10468 #ifdef TRY_BSD_PGRP
10469         if (getpgrp(1) == 0)
10470                 exit(0);
10471 #else
10472         if (getpgrp() > 0)
10473                 exit(0);
10474 #endif
10475         exit(1);
10476 }
10477 EOP
10478         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10479                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10480                 val="$define"
10481         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10482                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10483                 val="$undef"
10484         else
10485                 echo "I can't seem to compile and run the test program."
10486                 if ./usg; then
10487                         xxx="a USG one, i.e. you use getpgrp()."
10488                 else
10489                         # SVR4 systems can appear rather BSD-ish.
10490                         case "$i_unistd" in
10491                         $undef)
10492                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10493                                 val="$define"
10494                                 ;;
10495                         $define)
10496                                 xxx="probably a USG one, i.e. you use getpgrp()."
10497                                 val="$undef"
10498                                 ;;
10499                         esac
10500                 fi
10501                 echo "Assuming your getpgrp is $xxx" >&4
10502         fi
10503         ;;
10504 *) val="$undef";;
10505 esac
10506 set d_bsdgetpgrp
10507 eval $setvar
10508 $rm_try
10509
10510 : see if setpgrp exists
10511 set setpgrp d_setpgrp
10512 eval $inlibc
10513
10514 case "$d_setpgrp" in
10515 "$define")
10516         echo " "
10517         echo "Checking to see which flavor of setpgrp is in use..."
10518         $cat >try.c <<EOP
10519 #$i_unistd I_UNISTD
10520 #include <sys/types.h>
10521 #ifdef I_UNISTD
10522 #  include <unistd.h>
10523 #endif
10524 #$i_stdlib I_STDLIB
10525 #ifdef I_STDLIB
10526 #include <stdlib.h>
10527 #endif
10528 int main()
10529 {
10530         if (getuid() == 0) {
10531                 printf("(I see you are running Configure as super-user...)\n");
10532                 setuid(1);
10533         }
10534 #ifdef TRY_BSD_PGRP
10535         if (-1 == setpgrp(1, 1))
10536                 exit(0);
10537 #else
10538         if (setpgrp() != -1)
10539                 exit(0);
10540 #endif
10541         exit(1);
10542 }
10543 EOP
10544         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10545                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10546                 val="$define"
10547         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10548                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10549                 val="$undef"
10550         else
10551                 echo "(I can't seem to compile and run the test program.)"
10552                 if ./usg; then
10553                         xxx="a USG one, i.e. you use setpgrp()."
10554                 else
10555                         # SVR4 systems can appear rather BSD-ish.
10556                         case "$i_unistd" in
10557                         $undef)
10558                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10559                                 val="$define"
10560                                 ;;
10561                         $define)
10562                                 xxx="probably a USG one, i.e. you use setpgrp()."
10563                                 val="$undef"
10564                                 ;;
10565                         esac
10566                 fi
10567                 echo "Assuming your setpgrp is $xxx" >&4
10568         fi
10569         ;;
10570 *) val="$undef";;
10571 esac
10572 set d_bsdsetpgrp
10573 eval $setvar
10574 $rm_try
10575
10576 : Look for GCC-style __builtin_choose_expr
10577 case "$d_builtin_choose_expr" in
10578 '')
10579     echo " "
10580     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10581     $cat >try.c <<'EOCP'
10582 #include <assert.h>
10583 #include <stdlib.h>
10584 #include <stdio.h>
10585
10586 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10587
10588 int main(void) {
10589     assert( SYRINX(1) == 2112 );
10590     assert( SYRINX(1) != 5150 );
10591     assert( SYRINX(0) == 5150 );
10592     assert( SYRINX(0) != 2112 );
10593     puts( "All good!" );
10594     exit(0);
10595 }
10596
10597 EOCP
10598     set try
10599     if eval $compile && $run ./try; then
10600         echo "Your C compiler supports __builtin_choose_expr."
10601         val="$define"
10602     else
10603         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10604         val="$undef"
10605     fi
10606 ;;
10607 *) val="$d_builtin_choose_expr" ;;
10608 esac
10609
10610 set d_builtin_choose_expr
10611 eval $setvar
10612 $rm_try
10613
10614 : Look for GCC-style __builtin_expect
10615 case "$d_builtin_expect" in
10616 '')
10617     echo " "
10618     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10619     $cat >try.c <<'EOCP'
10620 int main(void) {
10621     int n = 50;
10622     if ( __builtin_expect(n, 0) ) n = 1;
10623     /* Remember shell exit code truth is 0, C truth is non-zero */
10624     return !(n == 1);
10625 }
10626 EOCP
10627     set try
10628     if eval $compile && $run ./try; then
10629         echo "Your C compiler supports __builtin_expect."
10630         val="$define"
10631     else
10632         echo "Your C compiler doesn't seem to understand __builtin_expect."
10633         val="$undef"
10634     fi
10635     ;;
10636 *) val="$d_builtin_expect" ;;
10637 esac
10638
10639 set d_builtin_expect
10640 eval $setvar
10641 $rm_try
10642
10643 : see if bzero exists
10644 set bzero d_bzero
10645 eval $inlibc
10646
10647 : see if stdarg is available
10648 echo " "
10649 if $test `./findhdr stdarg.h`; then
10650         echo "<stdarg.h> found." >&4
10651         valstd="$define"
10652 else
10653         echo "<stdarg.h> NOT found." >&4
10654         valstd="$undef"
10655 fi
10656
10657 : see if varags is available
10658 echo " "
10659 if $test `./findhdr varargs.h`; then
10660         echo "<varargs.h> found." >&4
10661 else
10662         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10663 fi
10664
10665 : set up the varargs testing programs
10666 $cat > varargs.c <<EOP
10667 #ifdef I_STDARG
10668 #include <stdarg.h>
10669 #endif
10670 #ifdef I_VARARGS
10671 #include <varargs.h>
10672 #endif
10673
10674 #ifdef I_STDARG
10675 int f(char *p, ...)
10676 #else
10677 int f(va_alist)
10678 va_dcl
10679 #endif
10680 {
10681         va_list ap;
10682 #ifndef I_STDARG
10683         char *p;
10684 #endif
10685 #ifdef I_STDARG
10686         va_start(ap,p);
10687 #else
10688         va_start(ap);
10689         p = va_arg(ap, char *);
10690 #endif
10691         va_end(ap);
10692         return 0;
10693 }
10694 EOP
10695 $cat > varargs <<EOP
10696 $startsh
10697 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10698         echo "true"
10699 else
10700         echo "false"
10701 fi
10702 $rm -f varargs$_o
10703 EOP
10704 chmod +x varargs
10705
10706 : now check which varargs header should be included
10707 echo " "
10708 i_varhdr=''
10709 case "$valstd" in
10710 "$define")
10711         if `./varargs I_STDARG`; then
10712                 val='stdarg.h'
10713         elif `./varargs I_VARARGS`; then
10714                 val='varargs.h'
10715         fi
10716         ;;
10717 *)
10718         if `./varargs I_VARARGS`; then
10719                 val='varargs.h'
10720         fi
10721         ;;
10722 esac
10723 case "$val" in
10724 '')
10725 echo "I could not find the definition for va_dcl... You have problems..." >&4
10726         val="$undef"; set i_stdarg; eval $setvar
10727         val="$undef"; set i_varargs; eval $setvar
10728         ;;
10729 *)
10730         set i_varhdr
10731         eval $setvar
10732         case "$i_varhdr" in
10733         stdarg.h)
10734                 val="$define"; set i_stdarg; eval $setvar
10735                 val="$undef"; set i_varargs; eval $setvar
10736                 ;;
10737         varargs.h)
10738                 val="$undef"; set i_stdarg; eval $setvar
10739                 val="$define"; set i_varargs; eval $setvar
10740                 ;;
10741         esac
10742         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10743 esac
10744 $rm -f varargs*
10745
10746 : see if the Compiler supports C99 variadic macros
10747 case "$i_stdarg$i_stdlib" in
10748     "$define$define")
10749     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10750     $cat >try.c <<EOCP
10751 #include <stdio.h>
10752 #include <stdarg.h>
10753
10754 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10755
10756 int main() {
10757   char buf[20];
10758   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10759   puts(buf);
10760   return 0;
10761 }
10762 EOCP
10763     set try
10764     if eval $compile && $run ./try 2>&1 >/dev/null; then
10765         case "`$run ./try`" in
10766             "123 456 789")
10767             echo "You have C99 variadic macros." >&4
10768             d_c99_variadic_macros="$define"
10769             ;;
10770             *)
10771             echo "You don't have functional C99 variadic macros." >&4
10772             d_c99_variadic_macros="$undef"
10773             ;;
10774         esac
10775     else
10776         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10777         d_c99_variadic_macros="$undef"
10778     fi
10779     $rm_try
10780     ;;
10781     *)
10782     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10783     d_c99_variadic_macros="$undef"
10784     ;;
10785 esac
10786
10787 : see if signal is declared as pointer to function returning int or void
10788 echo " "
10789 xxx=`./findhdr signal.h`
10790 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10791 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10792         echo "You have int (*signal())() instead of void." >&4
10793         val="$undef"
10794 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10795         echo "You have void (*signal())()." >&4
10796         val="$define"
10797 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10798         echo "You have int (*signal())() instead of void." >&4
10799         val="$undef"
10800 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10801         echo "You have void (*signal())()." >&4
10802         val="$define"
10803 else
10804         case "$d_voidsig" in
10805         '')
10806         echo "I can't determine whether signal handler returns void or int..." >&4
10807                 dflt=void
10808                 rp="What type does your signal handler return?"
10809                 . ./myread
10810                 case "$ans" in
10811                 v*) val="$define";;
10812                 *) val="$undef";;
10813                 esac;;
10814         "$define")
10815                 echo "As you already told me, signal handler returns void." >&4
10816                 val="$define"
10817                 ;;
10818         *)      echo "As you already told me, signal handler returns int." >&4
10819                 val="$undef"
10820                 ;;
10821         esac
10822 fi
10823 set d_voidsig
10824 eval $setvar
10825 case "$d_voidsig" in
10826 "$define") signal_t="void";;
10827 *) signal_t="int";;
10828 esac
10829 $rm -f $$.tmp
10830
10831 : check for ability to cast large floats to 32-bit ints.
10832 echo " "
10833 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10834 if $test "$intsize" -ge 4; then
10835         xxx=int
10836 else
10837         xxx=long
10838 fi
10839 $cat >try.c <<EOCP
10840 #include <stdio.h>
10841 #$i_stdlib I_STDLIB
10842 #ifdef I_STDLIB
10843 #include <stdlib.h>
10844 #endif
10845 #include <sys/types.h>
10846 #include <signal.h>
10847 $signal_t blech(int s) { exit(3); }
10848 int main()
10849 {
10850         $xxx i32;
10851         double f, g;
10852         int result = 0;
10853         char str[16];
10854         signal(SIGFPE, blech);
10855
10856         /* Don't let compiler optimize the test away.  Store the number
10857            in a writable string for gcc to pass to sscanf under HP/UX.
10858         */
10859         sprintf(str, "2147483647");
10860         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10861         g = 10 * f;
10862         i32  = ($xxx) g;
10863
10864         /* x86 processors will probably give 0x8000 0000, which is a
10865            sign change.  We don't want that.  We want to mimic SPARC
10866            behavior here, which is to preserve the sign and give
10867            back 0x7fff ffff.
10868         */
10869         if (i32 != ($xxx) f)
10870                 result |= 1;
10871         exit(result);
10872 }
10873 EOCP
10874 set try
10875 if eval $compile_ok; then
10876         $run ./try
10877         yyy=$?
10878 else
10879         echo "(I can't seem to compile the test program--assuming it can't)"
10880         yyy=1
10881 fi
10882 case "$yyy" in
10883 0)      val="$define"
10884         echo "Yup, it can."
10885         ;;
10886 *)      val="$undef"
10887         echo "Nope, it can't."
10888         ;;
10889 esac
10890 set d_casti32
10891 eval $setvar
10892 $rm_try
10893
10894 : check for ability to cast negative floats to unsigned
10895 echo " "
10896 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10897 $cat >try.c <<EOCP
10898 #include <stdio.h>
10899 #$i_stdlib I_STDLIB
10900 #ifdef I_STDLIB
10901 #include <stdlib.h>
10902 #endif
10903 #include <sys/types.h>
10904 #include <signal.h>
10905 $signal_t blech(int s) { exit(7); }
10906 $signal_t blech_in_list(int s) { exit(4); }
10907 unsigned long dummy_long(unsigned long p) { return p; }
10908 unsigned int dummy_int(unsigned int p) { return p; }
10909 unsigned short dummy_short(unsigned short p) { return p; }
10910 int main()
10911 {
10912         double f;
10913         unsigned long along;
10914         unsigned int aint;
10915         unsigned short ashort;
10916         int result = 0;
10917         char str[16];
10918
10919         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10920            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10921            optimized the whole file away
10922         */
10923         /* Store the number in a writable string for gcc to pass to
10924            sscanf under HP/UX.
10925         */
10926         sprintf(str, "-123");
10927         sscanf(str, "%lf", &f);  /* f = -123.; */
10928
10929         signal(SIGFPE, blech);
10930         along = (unsigned long)f;
10931         aint = (unsigned int)f;
10932         ashort = (unsigned short)f;
10933         if (along != (unsigned long)-123)
10934                 result |= 1;
10935         if (aint != (unsigned int)-123)
10936                 result |= 1;
10937         if (ashort != (unsigned short)-123)
10938                 result |= 1;
10939         sprintf(str, "1073741824.");
10940         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10941         f = f + f;
10942         along = 0;
10943         along = (unsigned long)f;
10944         if (along != 0x80000000)
10945                 result |= 2;
10946         f -= 1.;
10947         along = 0;
10948         along = (unsigned long)f;
10949         if (along != 0x7fffffff)
10950                 result |= 1;
10951         f += 2.;
10952         along = 0;
10953         along = (unsigned long)f;
10954         if (along != 0x80000001)
10955                 result |= 2;
10956         if (result)
10957                 exit(result);
10958         signal(SIGFPE, blech_in_list);
10959         sprintf(str, "123.");
10960         sscanf(str, "%lf", &f);  /* f = 123.; */
10961         along = dummy_long((unsigned long)f);
10962         aint = dummy_int((unsigned int)f);
10963         ashort = dummy_short((unsigned short)f);
10964         if (along != (unsigned long)123)
10965                 result |= 4;
10966         if (aint != (unsigned int)123)
10967                 result |= 4;
10968         if (ashort != (unsigned short)123)
10969                 result |= 4;
10970         exit(result);
10971
10972 }
10973 EOCP
10974 set try
10975 if eval $compile_ok; then
10976         $run ./try
10977         castflags=$?
10978 else
10979         echo "(I can't seem to compile the test program--assuming it can't)"
10980         castflags=7
10981 fi
10982 case "$castflags" in
10983 0)      val="$define"
10984         echo "Yup, it can."
10985         ;;
10986 *)      val="$undef"
10987         echo "Nope, it can't."
10988         ;;
10989 esac
10990 set d_castneg
10991 eval $setvar
10992 $rm_try
10993
10994 : see if vprintf exists
10995 echo " "
10996 if set vprintf val -f d_vprintf; eval $csym; $val; then
10997         echo 'vprintf() found.' >&4
10998         val="$define"
10999         $cat >try.c <<EOF
11000 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11001 #$i_varargs I_VARARGS
11002
11003 #$i_stdlib I_STDLIB
11004 #$i_unistd I_UNISTD
11005
11006 #ifdef I_STDARG
11007 #  include <stdarg.h>
11008 #else /* I_VARARGS */
11009 #  include <varargs.h>
11010 #endif
11011
11012 #ifdef I_UNISTD
11013 #  include <unistd.h>
11014 #endif
11015
11016 #ifdef I_STDLIB
11017 #  include <stdlib.h>
11018 #endif
11019
11020 #include <stdio.h> /* vsprintf prototype */
11021
11022 #ifdef I_STDARG
11023 void xxx(int n, ...)
11024 {
11025     va_list args;
11026     char buf[10];
11027     va_start(args, n);
11028     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11029 }
11030 int main() { xxx(1, "foo"); }
11031
11032 #else /* I_VARARGS */
11033
11034 xxx(va_alist)
11035 va_dcl
11036 {
11037     va_list args;
11038     char buf[10];
11039     va_start(args);
11040     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11041 }
11042 int main() { xxx("foo"); }
11043
11044 #endif
11045
11046 EOF
11047         set try
11048         if eval $compile_ok; then
11049                 if $run ./try; then
11050                         echo "Your vsprintf() returns (int)." >&4
11051                         val2="$undef"
11052                 else
11053                         echo "Your vsprintf() returns (char*)." >&4
11054                         val2="$define"
11055                 fi
11056         else
11057                 echo 'I am unable to compile the vsprintf() test program.' >&4
11058                 # We shouldn't get here.  If we do, assume the standard signature,
11059                 # not the old BSD one.
11060                 echo 'Guessing that vsprintf() returns (int).' >&4
11061                 val2="$undef"
11062         fi
11063 else
11064         echo 'vprintf() NOT found.' >&4
11065         val="$undef"
11066         val2="$undef"
11067 fi
11068 $rm_try
11069 set d_vprintf
11070 eval $setvar
11071 val=$val2
11072 set d_charvspr
11073 eval $setvar
11074
11075 : see if chown exists
11076 set chown d_chown
11077 eval $inlibc
11078
11079 : see if chroot exists
11080 set chroot d_chroot
11081 eval $inlibc
11082
11083 : see if chsize exists
11084 set chsize d_chsize
11085 eval $inlibc
11086
11087 : see if class exists
11088 set class d_class
11089 eval $inlibc
11090
11091 : see if clearenv exists
11092 set clearenv d_clearenv
11093 eval $inlibc
11094
11095 : Define hasstruct macro for Configure internal use
11096 hasstruct='varname=$1; struct=$2; shift; shift;
11097 while $test $# -ge 2; do
11098         case "$1" in
11099         $define) echo "#include <$2>";;
11100         esac ;
11101     shift 2;
11102 done > try.c;
11103 echo "int main () { struct $struct foo; }" >> try.c;
11104 set try;
11105 if eval $compile; then
11106         val="$define";
11107 else
11108         val="$undef";
11109 fi;
11110 set $varname;
11111 eval $setvar;
11112 $rm_try'
11113
11114 : see whether socket exists
11115 socketlib=''
11116 sockethdr=''
11117 echo " "
11118 $echo $n "Hmm... $c" >&4
11119 if set socket val -f d_socket; eval $csym; $val; then
11120         echo "Looks like you have Berkeley networking support." >&4
11121         d_socket="$define"
11122         if set setsockopt val -f; eval $csym; $val; then
11123                 d_oldsock="$undef"
11124         else
11125                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11126                 d_oldsock="$define"
11127         fi
11128 else
11129         if $contains socklib libc.list >/dev/null 2>&1; then
11130                 echo "Looks like you have Berkeley networking support." >&4
11131                 d_socket="$define"
11132                 : we will have to assume that it supports the 4.2 BSD interface
11133                 d_oldsock="$undef"
11134         else
11135                 echo "You don't have Berkeley networking in libc$_a..." >&4
11136                 if test "X$d_socket" = "X$define"; then
11137                    echo "...but you seem to believe that you have sockets." >&4
11138                 else
11139                         for net in net socket
11140                         do
11141                                 if test -f /usr/lib/lib$net$_a; then
11142                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11143                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11144                                         if $contains socket libc.list >/dev/null 2>&1; then
11145                                                 d_socket="$define"
11146                                                 socketlib="-l$net"
11147                                                 case "$net" in
11148                                                 net)
11149                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11150                                                         sockethdr="-I/usr/netinclude"
11151                                                         ;;
11152                                                 esac
11153                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11154                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11155                                                         d_oldsock="$undef"
11156                                                 else
11157                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11158                                                         d_oldsock="$define"
11159                                                 fi
11160                                                 break
11161                                         fi
11162                                 fi
11163                         done
11164                         if test "X$d_socket" != "X$define"; then
11165                            echo "or anywhere else I see." >&4
11166                            d_socket="$undef"
11167                            d_oldsock="$undef"
11168                         fi
11169                 fi
11170         fi
11171 fi
11172
11173 : see if socketpair exists
11174 set socketpair d_sockpair
11175 eval $inlibc
11176
11177
11178 echo " "
11179 echo "Checking the availability of certain socket constants..." >&4
11180 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11181         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11182         $cat >try.c <<EOF
11183 #include <sys/types.h>
11184 #include <sys/socket.h>
11185 int main() {
11186     int i = $ENUM;
11187 }
11188 EOF
11189         val="$undef"
11190         set try; if eval $compile; then
11191                 val="$define"
11192         fi
11193         set d_${enum}; eval $setvar
11194         $rm_try
11195 done
11196
11197 : see if this is a sys/uio.h system
11198 set sys/uio.h i_sysuio
11199 eval $inhdr
11200
11201 : Check for cmsghdr support
11202 echo " "
11203 echo "Checking to see if your system supports struct cmsghdr..." >&4
11204 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11205 eval $hasstruct
11206 case "$d_cmsghdr_s" in
11207 "$define")      echo "Yes, it does."   ;;
11208 *)              echo "No, it doesn't." ;;
11209 esac
11210
11211
11212 : check for const keyword
11213 echo " "
11214 echo 'Checking to see if your C compiler knows about "const"...' >&4
11215 $cat >const.c <<'EOCP'
11216 typedef struct spug { int drokk; } spug;
11217 int main()
11218 {
11219         const char *foo;
11220         const spug y = { 0 };
11221 }
11222 EOCP
11223 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11224         val="$define"
11225         echo "Yup, it does."
11226 else
11227         val="$undef"
11228         echo "Nope, it doesn't."
11229 fi
11230 set d_const
11231 eval $setvar
11232
11233 : see if copysignl exists
11234 set copysignl d_copysignl
11235 eval $inlibc
11236
11237 : see if crypt exists
11238 echo " "
11239 set crypt d_crypt
11240 eval $inlibc
11241 case "$d_crypt" in
11242 $define) cryptlib='' ;;
11243 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11244                 echo 'crypt() found.' >&4
11245                 val="$define"
11246                 cryptlib=''
11247         else
11248                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11249                 if $test -z "$cryptlib"; then
11250                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11251                 else
11252                         cryptlib=-lcrypt
11253                 fi
11254                 if $test -z "$cryptlib"; then
11255                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11256                 else
11257                         cryptlib=-lcrypt
11258                 fi
11259                 if $test -z "$cryptlib"; then
11260                         cryptlib=`./loc libcrypt$_a "" $libpth`
11261                 else
11262                         cryptlib=-lcrypt
11263                 fi
11264                 if $test -z "$cryptlib"; then
11265                         echo 'crypt() NOT found.' >&4
11266                         val="$undef"
11267                 else
11268                         val="$define"
11269                 fi
11270         fi
11271         set d_crypt
11272         eval $setvar
11273         ;;
11274 esac
11275
11276 : see if this is a crypt.h system
11277 set crypt.h i_crypt
11278 eval $inhdr
11279
11280 : see if crypt_r exists
11281 set crypt_r d_crypt_r
11282 eval $inlibc
11283 case "$d_crypt_r" in
11284 "$define")
11285         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11286         case "$d_crypt_r_proto:$usethreads" in
11287         ":define")      d_crypt_r_proto=define
11288                 set d_crypt_r_proto crypt_r $hdrs
11289                 eval $hasproto ;;
11290         *)      ;;
11291         esac
11292         case "$d_crypt_r_proto" in
11293         define)
11294         case "$crypt_r_proto" in
11295         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11296         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
11297         esac
11298         case "$crypt_r_proto" in
11299         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11300         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
11301         esac
11302         case "$crypt_r_proto" in
11303         ''|0)   d_crypt_r=undef
11304                 crypt_r_proto=0
11305                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11306         * )     case "$crypt_r_proto" in
11307                 REENTRANT_PROTO*) ;;
11308                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11309                 esac
11310                 echo "Prototype: $try" ;;
11311         esac
11312         ;;
11313         *)      case "$usethreads" in
11314                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11315                 esac
11316                 d_crypt_r=undef
11317                 crypt_r_proto=0
11318                 ;;
11319         esac
11320         ;;
11321 *)      crypt_r_proto=0
11322         ;;
11323 esac
11324
11325 : get csh whereabouts
11326 case "$csh" in
11327 'csh') val="$undef" ;;
11328 *) val="$define" ;;
11329 esac
11330 set d_csh
11331 eval $setvar
11332 : Respect a hint or command line value for full_csh.
11333 case "$full_csh" in
11334 '') full_csh=$csh ;;
11335 esac
11336
11337 : see if ctermid exists
11338 set ctermid d_ctermid
11339 eval $inlibc
11340
11341 : see if ctermid_r exists
11342 set ctermid_r d_ctermid_r
11343 eval $inlibc
11344 case "$d_ctermid_r" in
11345 "$define")
11346         hdrs="$i_systypes sys/types.h define stdio.h "
11347         case "$d_ctermid_r_proto:$usethreads" in
11348         ":define")      d_ctermid_r_proto=define
11349                 set d_ctermid_r_proto ctermid_r $hdrs
11350                 eval $hasproto ;;
11351         *)      ;;
11352         esac
11353         case "$d_ctermid_r_proto" in
11354         define)
11355         case "$ctermid_r_proto" in
11356         ''|0) try='char* ctermid_r(char*);'
11357         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11358         esac
11359         case "$ctermid_r_proto" in
11360         ''|0)   d_ctermid_r=undef
11361                 ctermid_r_proto=0
11362                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11363         * )     case "$ctermid_r_proto" in
11364                 REENTRANT_PROTO*) ;;
11365                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11366                 esac
11367                 echo "Prototype: $try" ;;
11368         esac
11369         ;;
11370         *)      case "$usethreads" in
11371                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11372                 esac
11373                 d_ctermid_r=undef
11374                 ctermid_r_proto=0
11375                 ;;
11376         esac
11377         ;;
11378 *)      ctermid_r_proto=0
11379         ;;
11380 esac
11381
11382 : see if ctime_r exists
11383 set ctime_r d_ctime_r
11384 eval $inlibc
11385 case "$d_ctime_r" in
11386 "$define")
11387         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11388         case "$d_ctime_r_proto:$usethreads" in
11389         ":define")      d_ctime_r_proto=define
11390                 set d_ctime_r_proto ctime_r $hdrs
11391                 eval $hasproto ;;
11392         *)      ;;
11393         esac
11394         case "$d_ctime_r_proto" in
11395         define)
11396         case "$ctime_r_proto" in
11397         ''|0) try='char* ctime_r(const time_t*, char*);'
11398         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11399         esac
11400         case "$ctime_r_proto" in
11401         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11402         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11403         esac
11404         case "$ctime_r_proto" in
11405         ''|0) try='int ctime_r(const time_t*, char*);'
11406         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11407         esac
11408         case "$ctime_r_proto" in
11409         ''|0) try='int ctime_r(const time_t*, char*, int);'
11410         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11411         esac
11412         case "$ctime_r_proto" in
11413         ''|0)   d_ctime_r=undef
11414                 ctime_r_proto=0
11415                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11416         * )     case "$ctime_r_proto" in
11417                 REENTRANT_PROTO*) ;;
11418                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11419                 esac
11420                 echo "Prototype: $try" ;;
11421         esac
11422         ;;
11423         *)      case "$usethreads" in
11424                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11425                 esac
11426                 d_ctime_r=undef
11427                 ctime_r_proto=0
11428                 ;;
11429         esac
11430         ;;
11431 *)      ctime_r_proto=0
11432         ;;
11433 esac
11434
11435 : see if cuserid exists
11436 set cuserid d_cuserid
11437 eval $inlibc
11438
11439 : see if this is a limits.h system
11440 set limits.h i_limits
11441 eval $inhdr
11442
11443 : see if this is a float.h system
11444 set float.h i_float
11445 eval $inhdr
11446
11447 : See if number of significant digits in a double precision number is known
11448 echo " "
11449 $cat >dbl_dig.c <<EOM
11450 #$i_limits I_LIMITS
11451 #$i_float I_FLOAT
11452 #ifdef I_LIMITS
11453 #include <limits.h>
11454 #endif
11455 #ifdef I_FLOAT
11456 #include <float.h>
11457 #endif
11458 #ifdef DBL_DIG
11459 printf("Contains DBL_DIG");
11460 #endif
11461 EOM
11462 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11463 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11464         echo "DBL_DIG found." >&4
11465         val="$define"
11466 else
11467         echo "DBL_DIG NOT found." >&4
11468         val="$undef"
11469 fi
11470 $rm -f dbl_dig.?
11471 set d_dbl_dig
11472 eval $setvar
11473
11474 : see if dbm.h is available
11475 : see if dbmclose exists
11476 set dbmclose d_dbmclose
11477 eval $inlibc
11478
11479 case "$d_dbmclose" in
11480 $define)
11481         set dbm.h i_dbm
11482         eval $inhdr
11483         case "$i_dbm" in
11484         $define)
11485                 val="$undef"
11486                 set i_rpcsvcdbm
11487                 eval $setvar
11488                 ;;
11489         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11490                 eval $inhdr
11491                 ;;
11492         esac
11493         ;;
11494 *)      echo "We won't be including <dbm.h>"
11495         val="$undef"
11496         set i_dbm
11497         eval $setvar
11498         val="$undef"
11499         set i_rpcsvcdbm
11500         eval $setvar
11501         ;;
11502 esac
11503
11504 : see if prototype for dbminit is available
11505 echo " "
11506 set d_dbminitproto dbminit $i_dbm dbm.h
11507 eval $hasproto
11508
11509 : see if difftime exists
11510 set difftime d_difftime
11511 eval $inlibc
11512
11513 : see if this is a dirent system
11514 echo " "
11515 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11516         val="$define"
11517         echo "<dirent.h> found." >&4
11518 else
11519         val="$undef"
11520         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11521                 echo "<sys/dir.h> found." >&4
11522                 echo " "
11523         else
11524                 xinc=`./findhdr sys/ndir.h`
11525         fi
11526         echo "<dirent.h> NOT found." >&4
11527 fi
11528 set i_dirent
11529 eval $setvar
11530
11531 : Look for type of directory structure.
11532 echo " "
11533 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11534
11535 case "$direntrytype" in
11536 ''|' ')
11537         case "$i_dirent" in
11538         $define) guess1='struct dirent' ;;
11539         *) guess1='struct direct'  ;;
11540         esac
11541         ;;
11542 *)      guess1="$direntrytype"
11543         ;;
11544 esac
11545
11546 case "$guess1" in
11547 'struct dirent') guess2='struct direct' ;;
11548 *) guess2='struct dirent' ;;
11549 esac
11550
11551 if $contains "$guess1" try.c >/dev/null 2>&1; then
11552         direntrytype="$guess1"
11553         echo "Your directory entries are $direntrytype." >&4
11554 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11555         direntrytype="$guess2"
11556         echo "Your directory entries seem to be $direntrytype." >&4
11557 else
11558         echo "I don't recognize your system's directory entries." >&4
11559         rp="What type is used for directory entries on this system?"
11560         dflt="$guess1"
11561         . ./myread
11562         direntrytype="$ans"
11563 fi
11564 $rm_try
11565
11566 : see if the directory entry stores field length
11567 echo " "
11568 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11569 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11570         echo "Good, your directory entry keeps length information in d_namlen." >&4
11571         val="$define"
11572 else
11573         echo "Your directory entry does not know about the d_namlen field." >&4
11574         val="$undef"
11575 fi
11576 set d_dirnamlen
11577 eval $setvar
11578 $rm_try
11579
11580 : Look for DIR.dd_fd
11581 case "$i_dirent" in
11582 "$define")
11583     echo "Checking to see if DIR has a dd_fd member variable" >&4
11584     $cat >try.c <<EOCP
11585 #$i_stdlib I_STDLIB
11586 #ifdef I_STDLIB
11587 #include <stdlib.h>
11588 #endif
11589 #include <dirent.h>
11590
11591 int main() {
11592     DIR dir;
11593     dir.dd_fd = 1;
11594     return 0;
11595 }
11596 EOCP
11597     val=$undef
11598     set try
11599     if eval $compile; then
11600         echo "Yes, it does."
11601         val="$define"
11602     else
11603         echo "No, it does not."
11604         val="$undef"
11605     fi
11606     ;;
11607 *)
11608     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11609     val="$undef"
11610     ;;
11611 esac
11612 set d_dir_dd_fd
11613 eval $setvar
11614 $rm_try
11615
11616 : see if this is an sysdir system
11617 set sys/dir.h i_sysdir
11618 eval $inhdr
11619
11620 : see if this is an sysndir system
11621 set sys/ndir.h i_sysndir
11622 eval $inhdr
11623
11624 : Look for dirfd
11625 echo " "
11626 $cat >dirfd.c <<EOM
11627 #include <stdio.h>
11628 #$i_stdlib I_STDLIB
11629 #ifdef I_STDLIB
11630 #include <stdlib.h>
11631 #endif
11632 #$i_dirent I_DIRENT             /**/
11633 #$i_sysdir I_SYS_DIR            /**/
11634 #$i_sysndir I_SYS_NDIR          /**/
11635 #$i_systypes I_SYS_TYPES        /**/
11636 #if defined(I_SYS_TYPES)
11637 #include <sys/types.h>
11638 #endif
11639 #if defined(I_DIRENT)
11640 #include <dirent.h>
11641 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11642 #include <sys/dir.h>
11643 #endif
11644 #else
11645 #ifdef I_SYS_NDIR
11646 #include <sys/ndir.h>
11647 #else
11648 #ifdef I_SYS_DIR
11649 #ifdef hp9000s500
11650 #include <ndir.h>       /* may be wrong in the future */
11651 #else
11652 #include <sys/dir.h>
11653 #endif
11654 #endif
11655 #endif
11656 #endif 
11657 int main() {
11658         DIR *dirp = opendir(".");
11659         if (dirfd(dirp) >= 0)
11660                 exit(0);
11661         else
11662                 exit(1);
11663 }
11664 EOM
11665 val=$undef
11666 set dirfd
11667 if eval $compile; then
11668         val="$define"
11669 fi
11670 case "$val" in
11671 $define)        echo "dirfd() found." >&4       ;;
11672 *)              echo "dirfd() NOT found." >&4   ;;
11673 esac
11674 set d_dirfd
11675 eval $setvar
11676 $rm -f dirfd*
11677
11678 : see if dlerror exists
11679 xxx_runnm="$runnm"
11680 runnm=false
11681 set dlerror d_dlerror
11682 eval $inlibc
11683 runnm="$xxx_runnm"
11684
11685 : see if dlfcn is available
11686 set dlfcn.h i_dlfcn
11687 eval $inhdr
11688
11689 : Check what extension to use for shared libs
11690 case "$usedl" in
11691 $define|y|true)
11692         $cat << EOM
11693
11694 On a few systems, the dynamically loaded modules that perl generates and uses
11695 will need a different extension than shared libs. The default will probably
11696 be appropriate.
11697
11698 EOM
11699         case "$dlext" in
11700         '')     dflt="$so" ;;
11701         *)      dflt="$dlext" ;;
11702         esac
11703         rp='What is the extension of dynamically loaded modules'
11704         . ./myread
11705         dlext="$ans"
11706         ;;
11707 *)
11708         dlext="none"
11709         ;;
11710 esac
11711
11712 : Check if dlsym need a leading underscore
11713 echo " "
11714 val="$undef"
11715
11716 case "$dlsrc" in
11717 dl_dlopen.xs)
11718         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11719         $cat >dyna.c <<'EOM'
11720 fred () { }
11721 EOM
11722
11723 $cat >fred.c<<EOM
11724
11725 #include <stdio.h>
11726 #$i_stdlib I_STDLIB
11727 #ifdef I_STDLIB
11728 #include <stdlib.h>
11729 #endif
11730 #$i_dlfcn I_DLFCN
11731 #ifdef I_DLFCN
11732 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11733 #else
11734 #include <sys/types.h>
11735 #include <nlist.h>
11736 #include <link.h>
11737 #endif
11738
11739 extern int fred() ;
11740
11741 int main()
11742 {
11743     void * handle ;
11744     void * symbol ;
11745 #ifndef RTLD_LAZY
11746     int mode = 1 ;
11747 #else
11748     int mode = RTLD_LAZY ;
11749 #endif
11750     handle = dlopen("./dyna.$dlext", mode) ;
11751     if (handle == NULL) {
11752         printf ("1\n") ;
11753         fflush (stdout) ;
11754         exit(0);
11755     }
11756     symbol = dlsym(handle, "fred") ;
11757     if (symbol == NULL) {
11758         /* try putting a leading underscore */
11759         symbol = dlsym(handle, "_fred") ;
11760         if (symbol == NULL) {
11761             printf ("2\n") ;
11762             fflush (stdout) ;
11763             exit(0);
11764         }
11765         printf ("3\n") ;
11766     }
11767     else
11768         printf ("4\n") ;
11769     fflush (stdout) ;
11770     exit(0);
11771 }
11772 EOM
11773         : Call the object file tmp-dyna.o in case dlext=o.
11774         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11775                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11776                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11777                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11778                 xxx=`$run ./fred`
11779                 case $xxx in
11780                 1)      echo "Test program failed using dlopen." >&4
11781                         echo "Perhaps you should not use dynamic loading." >&4;;
11782                 2)      echo "Test program failed using dlsym." >&4
11783                         echo "Perhaps you should not use dynamic loading." >&4;;
11784                 3)      echo "dlsym needs a leading underscore" >&4
11785                         val="$define" ;;
11786                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11787                 esac
11788         else
11789                 echo "I can't compile and run the test program." >&4
11790                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11791         fi
11792         ;;
11793 esac
11794
11795 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11796
11797 set d_dlsymun
11798 eval $setvar
11799
11800 : see if drand48_r exists
11801 set drand48_r d_drand48_r
11802 eval $inlibc
11803 case "$d_drand48_r" in
11804 "$define")
11805         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11806         case "$d_drand48_r_proto:$usethreads" in
11807         ":define")      d_drand48_r_proto=define
11808                 set d_drand48_r_proto drand48_r $hdrs
11809                 eval $hasproto ;;
11810         *)      ;;
11811         esac
11812         case "$d_drand48_r_proto" in
11813         define)
11814         case "$drand48_r_proto" in
11815         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11816         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11817         esac
11818         case "$drand48_r_proto" in
11819         ''|0)   d_drand48_r=undef
11820                 drand48_r_proto=0
11821                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11822         * )     case "$drand48_r_proto" in
11823                 REENTRANT_PROTO*) ;;
11824                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11825                 esac
11826                 echo "Prototype: $try" ;;
11827         esac
11828         ;;
11829         *)      case "$usethreads" in
11830                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11831                 esac
11832                 d_drand48_r=undef
11833                 drand48_r_proto=0
11834                 ;;
11835         esac
11836         ;;
11837 *)      drand48_r_proto=0
11838         ;;
11839 esac
11840
11841 : see if prototype for drand48 is available
11842 echo " "
11843 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11844 eval $hasproto
11845
11846 : see if dup2 exists
11847 set dup2 d_dup2
11848 eval $inlibc
11849
11850 : see if eaccess exists
11851 set eaccess d_eaccess
11852 eval $inlibc
11853
11854 : see if endgrent exists
11855 set endgrent d_endgrent
11856 eval $inlibc
11857
11858 : see if this is an grp system
11859 set grp.h i_grp
11860 eval $inhdr
11861
11862 case "$i_grp" in
11863 $define)
11864         xxx=`./findhdr grp.h`
11865         $cppstdin $cppflags $cppminus < $xxx >$$.h
11866
11867         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11868                 val="$define"
11869         else
11870                 val="$undef"
11871         fi
11872         set d_grpasswd
11873         eval $setvar
11874
11875         $rm -f $$.h
11876         ;;
11877 *)
11878         val="$undef";
11879         set d_grpasswd; eval $setvar
11880         ;;
11881 esac
11882
11883 : see if endgrent_r exists
11884 set endgrent_r d_endgrent_r
11885 eval $inlibc
11886 case "$d_endgrent_r" in
11887 "$define")
11888         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11889         case "$d_endgrent_r_proto:$usethreads" in
11890         ":define")      d_endgrent_r_proto=define
11891                 set d_endgrent_r_proto endgrent_r $hdrs
11892                 eval $hasproto ;;
11893         *)      ;;
11894         esac
11895         case "$d_endgrent_r_proto" in
11896         define)
11897         case "$endgrent_r_proto" in
11898         ''|0) try='int endgrent_r(FILE**);'
11899         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11900         esac
11901         case "$endgrent_r_proto" in
11902         ''|0) try='void endgrent_r(FILE**);'
11903         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11904         esac
11905         case "$endgrent_r_proto" in
11906         ''|0)   d_endgrent_r=undef
11907                 endgrent_r_proto=0
11908                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11909         * )     case "$endgrent_r_proto" in
11910                 REENTRANT_PROTO*) ;;
11911                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11912                 esac
11913                 echo "Prototype: $try" ;;
11914         esac
11915         ;;
11916         *)      case "$usethreads" in
11917                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11918                 esac
11919                 d_endgrent_r=undef
11920                 endgrent_r_proto=0
11921                 ;;
11922         esac
11923         ;;
11924 *)      endgrent_r_proto=0
11925         ;;
11926 esac
11927
11928 : see if endhostent exists
11929 set endhostent d_endhent
11930 eval $inlibc
11931
11932 : see if this is a netdb.h system
11933 set netdb.h i_netdb
11934 eval $inhdr
11935
11936 : see if endhostent_r exists
11937 set endhostent_r d_endhostent_r
11938 eval $inlibc
11939 case "$d_endhostent_r" in
11940 "$define")
11941         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11942         case "$d_endhostent_r_proto:$usethreads" in
11943         ":define")      d_endhostent_r_proto=define
11944                 set d_endhostent_r_proto endhostent_r $hdrs
11945                 eval $hasproto ;;
11946         *)      ;;
11947         esac
11948         case "$d_endhostent_r_proto" in
11949         define)
11950         case "$endhostent_r_proto" in
11951         ''|0) try='int endhostent_r(struct hostent_data*);'
11952         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11953         esac
11954         case "$endhostent_r_proto" in
11955         ''|0) try='void endhostent_r(struct hostent_data*);'
11956         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11957         esac
11958         case "$endhostent_r_proto" in
11959         ''|0)   d_endhostent_r=undef
11960                 endhostent_r_proto=0
11961                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11962         * )     case "$endhostent_r_proto" in
11963                 REENTRANT_PROTO*) ;;
11964                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11965                 esac
11966                 echo "Prototype: $try" ;;
11967         esac
11968         ;;
11969         *)      case "$usethreads" in
11970                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11971                 esac
11972                 d_endhostent_r=undef
11973                 endhostent_r_proto=0
11974                 ;;
11975         esac
11976         ;;
11977 *)      endhostent_r_proto=0
11978         ;;
11979 esac
11980
11981 : see if endnetent exists
11982 set endnetent d_endnent
11983 eval $inlibc
11984
11985 : see if endnetent_r exists
11986 set endnetent_r d_endnetent_r
11987 eval $inlibc
11988 case "$d_endnetent_r" in
11989 "$define")
11990         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11991         case "$d_endnetent_r_proto:$usethreads" in
11992         ":define")      d_endnetent_r_proto=define
11993                 set d_endnetent_r_proto endnetent_r $hdrs
11994                 eval $hasproto ;;
11995         *)      ;;
11996         esac
11997         case "$d_endnetent_r_proto" in
11998         define)
11999         case "$endnetent_r_proto" in
12000         ''|0) try='int endnetent_r(struct netent_data*);'
12001         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
12002         esac
12003         case "$endnetent_r_proto" in
12004         ''|0) try='void endnetent_r(struct netent_data*);'
12005         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
12006         esac
12007         case "$endnetent_r_proto" in
12008         ''|0)   d_endnetent_r=undef
12009                 endnetent_r_proto=0
12010                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12011         * )     case "$endnetent_r_proto" in
12012                 REENTRANT_PROTO*) ;;
12013                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12014                 esac
12015                 echo "Prototype: $try" ;;
12016         esac
12017         ;;
12018         *)      case "$usethreads" in
12019                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12020                 esac
12021                 d_endnetent_r=undef
12022                 endnetent_r_proto=0
12023                 ;;
12024         esac
12025         ;;
12026 *)      endnetent_r_proto=0
12027         ;;
12028 esac
12029
12030 : see if endprotoent exists
12031 set endprotoent d_endpent
12032 eval $inlibc
12033
12034 : see if endprotoent_r exists
12035 set endprotoent_r d_endprotoent_r
12036 eval $inlibc
12037 case "$d_endprotoent_r" in
12038 "$define")
12039         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12040         case "$d_endprotoent_r_proto:$usethreads" in
12041         ":define")      d_endprotoent_r_proto=define
12042                 set d_endprotoent_r_proto endprotoent_r $hdrs
12043                 eval $hasproto ;;
12044         *)      ;;
12045         esac
12046         case "$d_endprotoent_r_proto" in
12047         define)
12048         case "$endprotoent_r_proto" in
12049         ''|0) try='int endprotoent_r(struct protoent_data*);'
12050         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
12051         esac
12052         case "$endprotoent_r_proto" in
12053         ''|0) try='void endprotoent_r(struct protoent_data*);'
12054         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
12055         esac
12056         case "$endprotoent_r_proto" in
12057         ''|0)   d_endprotoent_r=undef
12058                 endprotoent_r_proto=0
12059                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12060         * )     case "$endprotoent_r_proto" in
12061                 REENTRANT_PROTO*) ;;
12062                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12063                 esac
12064                 echo "Prototype: $try" ;;
12065         esac
12066         ;;
12067         *)      case "$usethreads" in
12068                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12069                 esac
12070                 d_endprotoent_r=undef
12071                 endprotoent_r_proto=0
12072                 ;;
12073         esac
12074         ;;
12075 *)      endprotoent_r_proto=0
12076         ;;
12077 esac
12078
12079 : see if endpwent exists
12080 set endpwent d_endpwent
12081 eval $inlibc
12082
12083 : see if this is a pwd.h system
12084 set pwd.h i_pwd
12085 eval $inhdr
12086
12087 case "$i_pwd" in
12088 $define)
12089         xxx=`./findhdr pwd.h`
12090         $cppstdin $cppflags $cppminus < $xxx >$$.h
12091
12092         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12093                 val="$define"
12094         else
12095                 val="$undef"
12096         fi
12097         set d_pwquota
12098         eval $setvar
12099
12100         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12101                 val="$define"
12102         else
12103                 val="$undef"
12104         fi
12105         set d_pwage
12106         eval $setvar
12107
12108         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12109                 val="$define"
12110         else
12111                 val="$undef"
12112         fi
12113         set d_pwchange
12114         eval $setvar
12115
12116         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12117                 val="$define"
12118         else
12119                 val="$undef"
12120         fi
12121         set d_pwclass
12122         eval $setvar
12123
12124         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12125                 val="$define"
12126         else
12127                 val="$undef"
12128         fi
12129         set d_pwexpire
12130         eval $setvar
12131
12132         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12133                 val="$define"
12134         else
12135                 val="$undef"
12136         fi
12137         set d_pwcomment
12138         eval $setvar
12139
12140         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12141                 val="$define"
12142         else
12143                 val="$undef"
12144         fi
12145         set d_pwgecos
12146         eval $setvar
12147
12148         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12149                 val="$define"
12150         else
12151                 val="$undef"
12152         fi
12153         set d_pwpasswd
12154         eval $setvar
12155
12156         $rm -f $$.h
12157         ;;
12158 *)
12159         val="$undef"; 
12160         set d_pwquota; eval $setvar
12161         set d_pwage; eval $setvar
12162         set d_pwchange; eval $setvar
12163         set d_pwclass; eval $setvar
12164         set d_pwexpire; eval $setvar
12165         set d_pwcomment; eval $setvar
12166         set d_pwgecos; eval $setvar
12167         set d_pwpasswd; eval $setvar
12168         ;;
12169 esac
12170
12171 : see if endpwent_r exists
12172 set endpwent_r d_endpwent_r
12173 eval $inlibc
12174 case "$d_endpwent_r" in
12175 "$define")
12176         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12177         case "$d_endpwent_r_proto:$usethreads" in
12178         ":define")      d_endpwent_r_proto=define
12179                 set d_endpwent_r_proto endpwent_r $hdrs
12180                 eval $hasproto ;;
12181         *)      ;;
12182         esac
12183         case "$d_endpwent_r_proto" in
12184         define)
12185         case "$endpwent_r_proto" in
12186         ''|0) try='int endpwent_r(FILE**);'
12187         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
12188         esac
12189         case "$endpwent_r_proto" in
12190         ''|0) try='void endpwent_r(FILE**);'
12191         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
12192         esac
12193         case "$endpwent_r_proto" in
12194         ''|0)   d_endpwent_r=undef
12195                 endpwent_r_proto=0
12196                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12197         * )     case "$endpwent_r_proto" in
12198                 REENTRANT_PROTO*) ;;
12199                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12200                 esac
12201                 echo "Prototype: $try" ;;
12202         esac
12203         ;;
12204         *)      case "$usethreads" in
12205                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12206                 esac
12207                 d_endpwent_r=undef
12208                 endpwent_r_proto=0
12209                 ;;
12210         esac
12211         ;;
12212 *)      endpwent_r_proto=0
12213         ;;
12214 esac
12215
12216 : see if endservent exists
12217 set endservent d_endsent
12218 eval $inlibc
12219
12220 : see if endservent_r exists
12221 set endservent_r d_endservent_r
12222 eval $inlibc
12223 case "$d_endservent_r" in
12224 "$define")
12225         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12226         case "$d_endservent_r_proto:$usethreads" in
12227         ":define")      d_endservent_r_proto=define
12228                 set d_endservent_r_proto endservent_r $hdrs
12229                 eval $hasproto ;;
12230         *)      ;;
12231         esac
12232         case "$d_endservent_r_proto" in
12233         define)
12234         case "$endservent_r_proto" in
12235         ''|0) try='int endservent_r(struct servent_data*);'
12236         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
12237         esac
12238         case "$endservent_r_proto" in
12239         ''|0) try='void endservent_r(struct servent_data*);'
12240         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
12241         esac
12242         case "$endservent_r_proto" in
12243         ''|0)   d_endservent_r=undef
12244                 endservent_r_proto=0
12245                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12246         * )     case "$endservent_r_proto" in
12247                 REENTRANT_PROTO*) ;;
12248                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12249                 esac
12250                 echo "Prototype: $try" ;;
12251         esac
12252         ;;
12253         *)      case "$usethreads" in
12254                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12255                 esac
12256                 d_endservent_r=undef
12257                 endservent_r_proto=0
12258                 ;;
12259         esac
12260         ;;
12261 *)      endservent_r_proto=0
12262         ;;
12263 esac
12264
12265 : Locate the flags for 'open()'
12266 echo " "
12267 $cat >try.c <<EOCP
12268 #include <sys/types.h>
12269 #ifdef I_FCNTL
12270 #include <fcntl.h>
12271 #endif
12272 #ifdef I_SYS_FILE
12273 #include <sys/file.h>
12274 #endif
12275 #$i_stdlib I_STDLIB
12276 #ifdef I_STDLIB
12277 #include <stdlib.h>
12278 #endif
12279 int main() {
12280         if(O_RDONLY);
12281 #ifdef O_TRUNC
12282         exit(0);
12283 #else
12284         exit(1);
12285 #endif
12286 }
12287 EOCP
12288 : check sys/file.h first to get FREAD on Sun
12289 if $test `./findhdr sys/file.h` && \
12290                 set try -DI_SYS_FILE && eval $compile; then
12291         h_sysfile=true;
12292         echo "<sys/file.h> defines the O_* constants..." >&4
12293         if $run ./try; then
12294                 echo "and you have the 3 argument form of open()." >&4
12295                 val="$define"
12296         else
12297                 echo "but not the 3 argument form of open().  Oh, well." >&4
12298                 val="$undef"
12299         fi
12300 elif $test `./findhdr fcntl.h` && \
12301                 set try -DI_FCNTL && eval $compile; then
12302         h_fcntl=true;
12303         echo "<fcntl.h> defines the O_* constants..." >&4
12304         if $run ./try; then
12305                 echo "and you have the 3 argument form of open()." >&4
12306                 val="$define"
12307         else
12308                 echo "but not the 3 argument form of open().  Oh, well." >&4
12309                 val="$undef"
12310         fi
12311 else
12312         val="$undef"
12313         echo "I can't find the O_* constant definitions!  You got problems." >&4
12314 fi
12315 set d_open3
12316 eval $setvar
12317 $rm_try
12318
12319 : script used to emit important warnings
12320 cat >warn <<EOS
12321 $startsh
12322 if test \$# -gt 0; then
12323         echo "\$@" >msg
12324 else
12325         cat >msg
12326 fi
12327 echo "*** WARNING:" >&4
12328 sed -e 's/^/*** /' <msg >&4
12329 echo "*** " >&4
12330 cat msg >>config.msg
12331 echo " " >>config.msg
12332 rm -f msg
12333 EOS
12334 chmod +x warn
12335 $eunicefix warn
12336
12337 : see which of string.h or strings.h is needed
12338 echo " "
12339 strings=`./findhdr string.h`
12340 if $test "$strings" && $test -r "$strings"; then
12341         echo "Using <string.h> instead of <strings.h>." >&4
12342         val="$define"
12343 else
12344         val="$undef"
12345         strings=`./findhdr strings.h`
12346         if $test "$strings" && $test -r "$strings"; then
12347                 echo "Using <strings.h> instead of <string.h>." >&4
12348         else
12349                 ./warn "No string header found -- You'll surely have problems."
12350         fi
12351 fi
12352 set i_string
12353 eval $setvar
12354 case "$i_string" in
12355 "$undef") strings=`./findhdr strings.h`;;
12356 *)        strings=`./findhdr string.h`;;
12357 esac
12358
12359 : see if this is a sys/file.h system
12360 val=''
12361 set sys/file.h val
12362 eval $inhdr
12363
12364 : do we need to include sys/file.h ?
12365 case "$val" in
12366 "$define")
12367         echo " "
12368         if $h_sysfile; then
12369                 val="$define"
12370                 echo "We'll be including <sys/file.h>." >&4
12371         else
12372                 val="$undef"
12373                 echo "We won't be including <sys/file.h>." >&4
12374         fi
12375         ;;
12376 *)
12377         h_sysfile=false
12378         ;;
12379 esac
12380 set i_sysfile
12381 eval $setvar
12382
12383 : see if fcntl.h is there
12384 val=''
12385 set fcntl.h val
12386 eval $inhdr
12387
12388 : see if we can include fcntl.h
12389 case "$val" in
12390 "$define")
12391         echo " "
12392         if $h_fcntl; then
12393                 val="$define"
12394                 echo "We'll be including <fcntl.h>." >&4
12395         else
12396                 val="$undef"
12397                 if $h_sysfile; then
12398         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12399                 else
12400                         echo "We won't be including <fcntl.h>." >&4
12401                 fi
12402         fi
12403         ;;
12404 *)
12405         h_fcntl=false
12406         val="$undef"
12407         ;;
12408 esac
12409 set i_fcntl
12410 eval $setvar
12411
12412 : see if fork exists
12413 set fork d_fork
12414 eval $inlibc
12415
12416 : see if pipe exists
12417 set pipe d_pipe
12418 eval $inlibc
12419
12420 : check for non-blocking I/O stuff
12421 case "$h_sysfile" in
12422 true) echo "#include <sys/file.h>" > head.c;;
12423 *)
12424        case "$h_fcntl" in
12425        true) echo "#include <fcntl.h>" > head.c;;
12426        *) echo "#include <sys/fcntl.h>" > head.c;;
12427        esac
12428        ;;
12429 esac
12430 echo " "
12431 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12432 case "$o_nonblock" in
12433 '')
12434         $cat head.c > try.c
12435         $cat >>try.c <<EOCP
12436 #include <stdio.h>
12437 #$i_stdlib I_STDLIB
12438 #ifdef I_STDLIB
12439 #include <stdlib.h>
12440 #endif
12441 #$i_fcntl I_FCNTL
12442 #ifdef I_FCNTL
12443 #include <fcntl.h>
12444 #endif
12445 int main() {
12446 #ifdef O_NONBLOCK
12447         printf("O_NONBLOCK\n");
12448         exit(0);
12449 #endif
12450 #ifdef O_NDELAY
12451         printf("O_NDELAY\n");
12452         exit(0);
12453 #endif
12454 #ifdef FNDELAY
12455         printf("FNDELAY\n");
12456         exit(0);
12457 #endif
12458         exit(0);
12459 }
12460 EOCP
12461         set try
12462         if eval $compile_ok; then
12463                 o_nonblock=`$run ./try`
12464                 case "$o_nonblock" in
12465                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12466                 *) echo "Seems like we can use $o_nonblock.";;
12467                 esac
12468         else
12469                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12470         fi
12471         ;;
12472 *) echo "Using $hint value $o_nonblock.";;
12473 esac
12474 $rm_try
12475
12476 echo " "
12477 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12478 case "$eagain" in
12479 '')
12480         case "$d_fork:$d_pipe" in
12481         define:define)
12482         $cat head.c > try.c
12483         $cat >>try.c <<EOCP
12484 #include <errno.h>
12485 #include <sys/types.h>
12486 #include <signal.h>
12487 #include <stdio.h>
12488 #$i_stdlib I_STDLIB
12489 #ifdef I_STDLIB
12490 #include <stdlib.h>
12491 #endif
12492 #$i_fcntl I_FCNTL
12493 #ifdef I_FCNTL
12494 #include <fcntl.h>
12495 #endif
12496 #define MY_O_NONBLOCK $o_nonblock
12497 #ifndef errno  /* XXX need better Configure test */
12498 extern int errno;
12499 #endif
12500 #$i_unistd I_UNISTD
12501 #ifdef I_UNISTD
12502 #include <unistd.h>
12503 #endif
12504 #$i_string I_STRING
12505 #ifdef I_STRING
12506 #include <string.h>
12507 #else
12508 #include <strings.h>
12509 #endif
12510 $signal_t blech(int x) { exit(3); }
12511 EOCP
12512         $cat >> try.c <<'EOCP'
12513 int main()
12514 {
12515         int pd[2];
12516         int pu[2];
12517         char buf[1];
12518         char string[100];
12519
12520         pipe(pd);       /* Down: child -> parent */
12521         pipe(pu);       /* Up: parent -> child */
12522         if (0 != fork()) {
12523                 int ret;
12524                 close(pd[1]);   /* Parent reads from pd[0] */
12525                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12526 #ifdef F_SETFL
12527                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12528                         exit(1);
12529 #else
12530                 exit(4);
12531 #endif
12532                 signal(SIGALRM, blech);
12533                 alarm(5);
12534                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12535                         exit(2);
12536                 sprintf(string, "%d\n", ret);
12537                 write(2, string, strlen(string));
12538                 alarm(0);
12539 #ifdef EAGAIN
12540                 if (errno == EAGAIN) {
12541                         printf("EAGAIN\n");
12542                         goto ok;
12543                 }
12544 #endif
12545 #ifdef EWOULDBLOCK
12546                 if (errno == EWOULDBLOCK)
12547                         printf("EWOULDBLOCK\n");
12548 #endif
12549         ok:
12550                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12551                 sleep(2);                               /* Give it time to close our pipe */
12552                 alarm(5);
12553                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12554                 alarm(0);
12555                 sprintf(string, "%d\n", ret);
12556                 write(4, string, strlen(string));
12557                 exit(0);
12558         }
12559
12560         close(pd[0]);                   /* We write to pd[1] */
12561         close(pu[1]);                   /* We read from pu[0] */
12562         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12563         close(pd[1]);                   /* Pipe pd is now fully closed! */
12564         exit(0);                                /* Bye bye, thank you for playing! */
12565 }
12566 EOCP
12567         set try
12568         if eval $compile_ok; then
12569                 echo "$startsh" >mtry
12570                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12571                 chmod +x mtry
12572                 ./mtry >/dev/null 2>&1
12573                 case $? in
12574                 0) eagain=`$cat try.out`;;
12575                 1) echo "Could not perform non-blocking setting!";;
12576                 2) echo "I did a successful read() for something that was not there!";;
12577                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12578                 4) echo "Could not find F_SETFL!";;
12579                 *) echo "Something terribly wrong happened during testing.";;
12580                 esac
12581                 rd_nodata=`$cat try.ret`
12582                 echo "A read() system call with no data present returns $rd_nodata."
12583                 case "$rd_nodata" in
12584                 0|-1) ;;
12585                 *)
12586                         echo "(That's peculiar, fixing that to be -1.)"
12587                         rd_nodata=-1
12588                         ;;
12589                 esac
12590                 case "$eagain" in
12591                 '')
12592                         echo "Forcing errno EAGAIN on read() with no data available."
12593                         eagain=EAGAIN
12594                         ;;
12595                 *)
12596                         echo "Your read() sets errno to $eagain when no data is available."
12597                         ;;
12598                 esac
12599                 status=`$cat try.err`
12600                 case "$status" in
12601                 0) echo "And it correctly returns 0 to signal EOF.";;
12602                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12603                 *) echo "However, your read() returns '$status' on EOF??";;
12604                 esac
12605                 val="$define"
12606                 if test "$status" = "$rd_nodata"; then
12607                         echo "WARNING: you can't distinguish between EOF and no data!"
12608                         val="$undef"
12609                 fi
12610         else
12611                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12612                 eagain=EAGAIN
12613         fi
12614         ;;
12615         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12616                 eagain=EAGAIN
12617                 val="$define"
12618                 ;;
12619         esac
12620         set d_eofnblk
12621         eval $setvar
12622         ;;
12623 *)
12624         echo "Using $hint value $eagain."
12625         echo "Your read() returns $rd_nodata when no data is present."
12626         case "$d_eofnblk" in
12627         "$define") echo "And you can see EOF because read() returns 0.";;
12628         "$undef") echo "But you can't see EOF status from read() returned value.";;
12629         *)
12630                 echo "(Assuming you can't see EOF status from read anyway.)"
12631                 d_eofnblk=$undef
12632                 ;;
12633         esac
12634         ;;
12635 esac
12636 $rm_try head.c mtry
12637
12638 : see if _ptr and _cnt from stdio act std
12639 echo " "
12640
12641 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12642         echo "(Looks like you have stdio.h from BSD.)"
12643         case "$stdio_ptr" in
12644         '') stdio_ptr='((fp)->_p)'
12645                 ptr_lval=$define
12646                 ;;
12647         *)      ptr_lval=$d_stdio_ptr_lval;;
12648         esac
12649         case "$stdio_cnt" in
12650         '') stdio_cnt='((fp)->_r)'
12651                 cnt_lval=$define
12652                 ;;
12653         *)      cnt_lval=$d_stdio_cnt_lval;;
12654         esac
12655         case "$stdio_base" in
12656         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12657         esac
12658         case "$stdio_bufsiz" in
12659         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12660         esac
12661 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12662         echo "(Looks like you have stdio.h from Linux.)"
12663         case "$stdio_ptr" in
12664         '') stdio_ptr='((fp)->_IO_read_ptr)'
12665                 ptr_lval=$define
12666                 ;;
12667         *)      ptr_lval=$d_stdio_ptr_lval;;
12668         esac
12669         case "$stdio_cnt" in
12670         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12671                 cnt_lval=$undef
12672                 ;;
12673         *)      cnt_lval=$d_stdio_cnt_lval;;
12674         esac
12675         case "$stdio_base" in
12676         '') stdio_base='((fp)->_IO_read_base)';;
12677         esac
12678         case "$stdio_bufsiz" in
12679         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12680         esac
12681 else
12682         case "$stdio_ptr" in
12683         '') stdio_ptr='((fp)->_ptr)'
12684                 ptr_lval=$define
12685                 ;;
12686         *)      ptr_lval=$d_stdio_ptr_lval;;
12687         esac
12688         case "$stdio_cnt" in
12689         '') stdio_cnt='((fp)->_cnt)'
12690                 cnt_lval=$define
12691                 ;;
12692         *)      cnt_lval=$d_stdio_cnt_lval;;
12693         esac
12694         case "$stdio_base" in
12695         '') stdio_base='((fp)->_base)';;
12696         esac
12697         case "$stdio_bufsiz" in
12698         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12699         esac
12700 fi
12701
12702 : test whether _ptr and _cnt really work
12703 echo "Checking how std your stdio is..." >&4
12704 $cat >try.c <<EOP
12705 #include <stdio.h>
12706 #$i_stdlib I_STDLIB
12707 #ifdef I_STDLIB
12708 #include <stdlib.h>
12709 #endif
12710 #define FILE_ptr(fp)    $stdio_ptr
12711 #define FILE_cnt(fp)    $stdio_cnt
12712 int main() {
12713         FILE *fp = fopen("try.c", "r");
12714         char c = getc(fp);
12715         if (
12716                 18 <= FILE_cnt(fp) &&
12717                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12718         )
12719                 exit(0);
12720         exit(1);
12721 }
12722 EOP
12723 val="$undef"
12724 set try
12725 if eval $compile && $to try.c; then
12726         if $run ./try; then
12727                 echo "Your stdio acts pretty std."
12728                 val="$define"
12729         else
12730                 echo "Your stdio isn't very std."
12731         fi
12732 else
12733         echo "Your stdio doesn't appear very std."
12734 fi
12735 $rm_try
12736
12737 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12738 # direct buffer manipulation no longer works.  The Configure tests
12739 # should be changed to correctly detect this, but until then,
12740 # the following check should at least let perl compile and run.
12741 # (This quick fix should be updated before 5.8.1.)
12742 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12743 # A. Dougherty, June 3, 2002.
12744 case "$d_gnulibc" in
12745 $define)
12746         case "$gnulibc_version" in
12747         2.[01]*)  ;;
12748         2.2) ;;
12749         2.2.[0-9]) ;;
12750         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12751                 val="$undef"
12752                 ;;
12753         esac
12754         ;;
12755 esac
12756 set d_stdstdio
12757 eval $setvar
12758
12759 : Can _ptr be used as an lvalue?
12760 case "$d_stdstdio$ptr_lval" in
12761 $define$define) val=$define ;;
12762 *) val=$undef ;;
12763 esac
12764 set d_stdio_ptr_lval
12765 eval $setvar
12766
12767 : Can _cnt be used as an lvalue?
12768 case "$d_stdstdio$cnt_lval" in
12769 $define$define) val=$define ;;
12770 *) val=$undef ;;
12771 esac
12772 set d_stdio_cnt_lval
12773 eval $setvar
12774
12775
12776 : test whether setting _ptr sets _cnt as a side effect
12777 d_stdio_ptr_lval_sets_cnt="$undef"
12778 d_stdio_ptr_lval_nochange_cnt="$undef"
12779 case "$d_stdio_ptr_lval$d_stdstdio" in
12780 $define$define)
12781         echo "Checking to see what happens if we set the stdio ptr..." >&4
12782 $cat >try.c <<EOP
12783 #include <stdio.h>
12784 /* Can we scream? */
12785 /* Eat dust sed :-) */
12786 /* In the buffer space, no one can hear you scream. */
12787 #$i_stdlib I_STDLIB
12788 #ifdef I_STDLIB
12789 #include <stdlib.h>
12790 #endif
12791 #define FILE_ptr(fp)    $stdio_ptr
12792 #define FILE_cnt(fp)    $stdio_cnt
12793 #include <sys/types.h>
12794 int main() {
12795         FILE *fp = fopen("try.c", "r");
12796         int c;
12797         char *ptr;
12798         size_t cnt;
12799         if (!fp) {
12800             puts("Fail even to read");
12801             exit(1);
12802         }
12803         c = getc(fp); /* Read away the first # */
12804         if (c == EOF) {
12805             puts("Fail even to read");
12806             exit(1);
12807         }
12808         if (!(
12809                 18 <= FILE_cnt(fp) &&
12810                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12811         )) {
12812                 puts("Fail even to read");
12813                 exit (1);
12814         }
12815         ptr = (char*) FILE_ptr(fp);
12816         cnt = (size_t)FILE_cnt(fp);
12817
12818         FILE_ptr(fp) += 42;
12819
12820         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12821                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12822                 exit (1);
12823         }
12824         if (FILE_cnt(fp) <= 20) {
12825                 printf ("Fail (<20 chars to test)");
12826                 exit (1);
12827         }
12828         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12829                 puts("Fail compare");
12830                 exit (1);
12831         }
12832         if (cnt == FILE_cnt(fp)) {
12833                 puts("Pass_unchanged");
12834                 exit (0);
12835         }
12836         if (FILE_cnt(fp) == (cnt - 42)) {
12837                 puts("Pass_changed");
12838                 exit (0);
12839         }
12840         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12841         return 1;
12842
12843 }
12844 EOP
12845         set try
12846         if eval $compile && $to try.c; then
12847                 case `$run ./try` in
12848                 Pass_changed)
12849                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12850                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12851                 Pass_unchanged)
12852                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12853                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12854                 Fail*)
12855                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12856                 *)
12857                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12858         esac
12859         else
12860                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12861         fi
12862         $rm_try
12863         ;;
12864 esac
12865
12866 : see if _base is also standard
12867 val="$undef"
12868 case "$d_stdstdio" in
12869 $define)
12870         $cat >try.c <<EOP
12871 #include <stdio.h>
12872 #$i_stdlib I_STDLIB
12873 #ifdef I_STDLIB
12874 #include <stdlib.h>
12875 #endif
12876 #define FILE_base(fp)   $stdio_base
12877 #define FILE_bufsiz(fp) $stdio_bufsiz
12878 int main() {
12879         FILE *fp = fopen("try.c", "r");
12880         char c = getc(fp);
12881         if (
12882                 19 <= FILE_bufsiz(fp) &&
12883                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12884         )
12885                 exit(0);
12886         exit(1);
12887 }
12888 EOP
12889         set try
12890         if eval $compile && $to try.c; then
12891                 if $run ./try; then
12892                         echo "And its _base field acts std."
12893                         val="$define"
12894                 else
12895                         echo "But its _base field isn't std."
12896                 fi
12897         else
12898                 echo "However, it seems to be lacking the _base field."
12899         fi
12900         $rm_try
12901         ;;
12902 esac
12903 set d_stdiobase
12904 eval $setvar
12905
12906 : see if fast_stdio exists
12907 val="$undef"
12908 case "$d_stdstdio:$d_stdio_ptr_lval" in
12909 "$define:$define")
12910         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12911         *$define*)
12912                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12913                 val="$define"
12914                 ;;
12915         esac
12916         ;;
12917 esac
12918 set d_faststdio
12919 eval $setvar
12920
12921
12922
12923 : see if fchdir exists
12924 set fchdir d_fchdir
12925 eval $inlibc
12926
12927 : see if fchmod exists
12928 set fchmod d_fchmod
12929 eval $inlibc
12930
12931 : see if fchown exists
12932 set fchown d_fchown
12933 eval $inlibc
12934
12935 : see if this is an fcntl system
12936 set fcntl d_fcntl
12937 eval $inlibc
12938
12939 : See if fcntl-based locking works.
12940 echo " "
12941 $cat >try.c <<EOCP
12942 #$i_stdlib I_STDLIB
12943 #ifdef I_STDLIB
12944 #include <stdlib.h>
12945 #endif
12946 #include <unistd.h>
12947 #include <fcntl.h>
12948 #include <signal.h>
12949 $signal_t blech(int x) { exit(3); }
12950 int main() {
12951 #if defined(F_SETLK) && defined(F_SETLKW)
12952      struct flock flock;
12953      int retval, fd;
12954      fd = open("try.c", O_RDONLY);
12955      flock.l_type = F_RDLCK;
12956      flock.l_whence = SEEK_SET;
12957      flock.l_start = flock.l_len = 0;
12958      signal(SIGALRM, blech);
12959      alarm(10);
12960      retval = fcntl(fd, F_SETLK, &flock);
12961      close(fd);
12962      (retval < 0 ? exit(2) : exit(0));
12963 #else
12964      exit(2);
12965 #endif
12966 }
12967 EOCP
12968 echo "Checking if fcntl-based file locking works... "
12969 case "$d_fcntl" in
12970 "$define")
12971         set try
12972         if eval $compile_ok; then
12973                 if $run ./try; then
12974                         echo "Yes, it seems to work."
12975                         val="$define"
12976                 else
12977                         echo "Nope, it didn't work."
12978                         val="$undef"
12979                         case "$?" in
12980                         3) $cat >&4 <<EOM
12981 ***
12982 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12983 *** This is (almost) impossible.
12984 *** If your NFS lock daemons are not feeling well, something like
12985 *** this may happen, please investigate.  Cannot continue, aborting.
12986 ***
12987 EOM
12988                                 exit 1
12989                                 ;;
12990                         esac
12991                 fi
12992         else
12993                 echo "I'm unable to compile the test program, so I'll assume not."
12994                 val="$undef"
12995         fi
12996         ;;
12997 *) val="$undef";
12998         echo "Nope, since you don't even have fcntl()."
12999         ;;
13000 esac
13001 set d_fcntl_can_lock
13002 eval $setvar
13003 $rm_try
13004
13005 : check for fd_set items
13006 $cat <<EOM
13007
13008 Checking to see how well your C compiler handles fd_set and friends ...
13009 EOM
13010 $cat >try.c <<EOCP
13011 #$i_stdlib I_STDLIB
13012 #ifdef I_STDLIB
13013 #include <stdlib.h>
13014 #endif
13015 #$i_systime I_SYS_TIME
13016 #$i_sysselct I_SYS_SELECT
13017 #$d_socket HAS_SOCKET
13018 #include <sys/types.h>
13019 #ifdef HAS_SOCKET
13020 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13021 #endif
13022 #ifdef I_SYS_TIME
13023 #include <sys/time.h>
13024 #endif
13025 #ifdef I_SYS_SELECT
13026 #include <sys/select.h>
13027 #endif
13028 int main() {
13029         fd_set fds;
13030
13031 #ifdef TRYBITS
13032         if(fds.fds_bits);
13033 #endif
13034
13035 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13036         exit(0);
13037 #else
13038         exit(1);
13039 #endif
13040 }
13041 EOCP
13042 set try -DTRYBITS
13043 if eval $compile; then
13044         d_fds_bits="$define"
13045         d_fd_set="$define"
13046         echo "Well, your system knows about the normal fd_set typedef..." >&4
13047         if $run ./try; then
13048                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13049                 d_fd_macros="$define"
13050         else
13051                 $cat >&4 <<'EOM'
13052 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13053 EOM
13054                 d_fd_macros="$undef"
13055         fi
13056 else
13057         $cat <<'EOM'
13058 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13059 EOM
13060         set try
13061         if eval $compile; then
13062                 d_fds_bits="$undef"
13063                 d_fd_set="$define"
13064                 echo "Well, your system has some sort of fd_set available..." >&4
13065                 if $run ./try; then
13066                         echo "and you have the normal fd_set macros." >&4
13067                         d_fd_macros="$define"
13068                 else
13069                         $cat <<'EOM'
13070 but not the normal fd_set macros!  Gross!  More work for me...
13071 EOM
13072                         d_fd_macros="$undef"
13073                 fi
13074         else
13075         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13076                 d_fd_set="$undef"
13077                 d_fds_bits="$undef"
13078                 d_fd_macros="$undef"
13079         fi
13080 fi
13081 $rm_try
13082
13083 : see if fgetpos exists
13084 set fgetpos d_fgetpos
13085 eval $inlibc
13086
13087 : see if finite exists
13088 set finite d_finite
13089 eval $inlibc
13090
13091 : see if finitel exists
13092 set finitel d_finitel
13093 eval $inlibc
13094
13095 : see if flock exists
13096 set flock d_flock
13097 eval $inlibc
13098
13099 : see if prototype for flock is available
13100 echo " "
13101 set d_flockproto flock $i_sysfile sys/file.h
13102 eval $hasproto
13103
13104 : see if fp_class exists
13105 set fp_class d_fp_class
13106 eval $inlibc
13107
13108 : see if pathconf exists
13109 set pathconf d_pathconf
13110 eval $inlibc
13111
13112 : see if fpathconf exists
13113 set fpathconf d_fpathconf
13114 eval $inlibc
13115
13116 : see if fpclass exists
13117 set fpclass d_fpclass
13118 eval $inlibc
13119
13120 : see if fpclassify exists
13121 set fpclassify d_fpclassify
13122 eval $inlibc
13123
13124 : see if fpclassl exists
13125 set fpclassl d_fpclassl
13126 eval $inlibc
13127
13128 : check for fpos64_t
13129 echo " "
13130 echo "Checking to see if you have fpos64_t..." >&4
13131 $cat >try.c <<EOCP
13132 #include <stdio.h>
13133 int main() { fpos64_t x = 7; }
13134 EOCP
13135 set try
13136 if eval $compile; then
13137         val="$define"
13138         echo "You have fpos64_t."
13139 else
13140         val="$undef"
13141         echo "You do not have fpos64_t."
13142         case "$fpossize" in
13143         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13144         esac
13145 fi
13146 $rm_try
13147 set d_fpos64_t
13148 eval $setvar
13149
13150 : see if frexpl exists
13151 set frexpl d_frexpl
13152 eval $inlibc
13153
13154 : see if this is a sys/param system
13155 set sys/param.h i_sysparam
13156 eval $inhdr
13157
13158 : see if this is a sys/mount.h system
13159 set sys/mount.h i_sysmount
13160 eval $inhdr
13161
13162 : Check for fs_data_s
13163 echo " "
13164 echo "Checking to see if your system supports struct fs_data..." >&4
13165 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13166 eval $hasstruct
13167 case "$d_fs_data_s" in
13168 "$define")      echo "Yes, it does."   ;;
13169 *)              echo "No, it doesn't." ;;
13170 esac
13171
13172 : see if fseeko exists
13173 set fseeko d_fseeko
13174 eval $inlibc
13175 case "$longsize" in
13176 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13177 esac
13178
13179 : see if fsetpos exists
13180 set fsetpos d_fsetpos
13181 eval $inlibc
13182
13183 : see if fstatfs exists
13184 set fstatfs d_fstatfs
13185 eval $inlibc
13186
13187 : see if statvfs exists
13188 set statvfs d_statvfs
13189 eval $inlibc
13190
13191 : see if fstatvfs exists
13192 set fstatvfs d_fstatvfs
13193 eval $inlibc
13194
13195
13196 : see if fsync exists
13197 set fsync d_fsync
13198 eval $inlibc
13199
13200 : see if ftello exists
13201 set ftello d_ftello
13202 eval $inlibc
13203 case "$longsize" in
13204 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13205 esac
13206
13207 : check for a working futimes
13208 d_futimes="$undef"
13209 echo " "
13210 echo "Checking if you have a working futimes()" >&4
13211 $cat >try.c <<EOCP
13212 #include <stdio.h>
13213 #include <sys/time.h>
13214 #include <errno.h>
13215 #include <fcntl.h>
13216
13217 int main ()
13218 {
13219     int fd, rv;
13220     fd = open ("try.c", O_RDWR);
13221     if (-1 == fd) exit (1);
13222     rv = futimes (fd, NULL);
13223     exit (rv == -1 ? errno : 0);
13224 }
13225 EOCP
13226 set try
13227 if eval $compile; then
13228     `$run ./try`
13229     rc=$?
13230     case "$rc" in
13231         0)  echo "Yes, you have" >&4
13232             d_futimes="$define"
13233             ;;
13234         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13235             ;;
13236     esac
13237 else
13238     echo "No, it does not (probably harmless)" >&4
13239 fi
13240 $rm_try
13241
13242 : see if getcwd exists
13243 set getcwd d_getcwd
13244 eval $inlibc
13245
13246 : see if getespwnam exists
13247 set getespwnam d_getespwnam
13248 eval $inlibc
13249
13250 : see if getfsstat exists
13251 set getfsstat d_getfsstat
13252 eval $inlibc
13253
13254 : see if getgrent exists
13255 set getgrent d_getgrent
13256 eval $inlibc
13257
13258 : see if getgrent_r exists
13259 set getgrent_r d_getgrent_r
13260 eval $inlibc
13261 case "$d_getgrent_r" in
13262 "$define")
13263         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13264         case "$d_getgrent_r_proto:$usethreads" in
13265         ":define")      d_getgrent_r_proto=define
13266                 set d_getgrent_r_proto getgrent_r $hdrs
13267                 eval $hasproto ;;
13268         *)      ;;
13269         esac
13270         case "$d_getgrent_r_proto" in
13271         define)
13272         case "$getgrent_r_proto" in
13273         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13274         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13275         esac
13276         case "$getgrent_r_proto" in
13277         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13278         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13279         esac
13280         case "$getgrent_r_proto" in
13281         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13282         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
13283         esac
13284         case "$getgrent_r_proto" in
13285         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13286         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
13287         esac
13288         case "$getgrent_r_proto" in
13289         ''|0) try='int getgrent_r(struct group*, char*, int);'
13290         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
13291         esac
13292         case "$getgrent_r_proto" in
13293         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13294         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13295         esac
13296         case "$getgrent_r_proto" in
13297         ''|0)   d_getgrent_r=undef
13298                 getgrent_r_proto=0
13299                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13300         * )     case "$getgrent_r_proto" in
13301                 REENTRANT_PROTO*) ;;
13302                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13303                 esac
13304                 echo "Prototype: $try" ;;
13305         esac
13306         ;;
13307         *)      case "$usethreads" in
13308                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13309                 esac
13310                 d_getgrent_r=undef
13311                 getgrent_r_proto=0
13312                 ;;
13313         esac
13314         ;;
13315 *)      getgrent_r_proto=0
13316         ;;
13317 esac
13318
13319 : see if getgrgid_r exists
13320 set getgrgid_r d_getgrgid_r
13321 eval $inlibc
13322 case "$d_getgrgid_r" in
13323 "$define")
13324         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13325         case "$d_getgrgid_r_proto:$usethreads" in
13326         ":define")      d_getgrgid_r_proto=define
13327                 set d_getgrgid_r_proto getgrgid_r $hdrs
13328                 eval $hasproto ;;
13329         *)      ;;
13330         esac
13331         case "$d_getgrgid_r_proto" in
13332         define)
13333         case "$getgrgid_r_proto" in
13334         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13335         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13336         esac
13337         case "$getgrgid_r_proto" in
13338         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13339         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13340         esac
13341         case "$getgrgid_r_proto" in
13342         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13343         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13344         esac
13345         case "$getgrgid_r_proto" in
13346         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13347         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13348         esac
13349         case "$getgrgid_r_proto" in
13350         ''|0)   d_getgrgid_r=undef
13351                 getgrgid_r_proto=0
13352                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13353         * )     case "$getgrgid_r_proto" in
13354                 REENTRANT_PROTO*) ;;
13355                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13356                 esac
13357                 echo "Prototype: $try" ;;
13358         esac
13359         ;;
13360         *)      case "$usethreads" in
13361                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13362                 esac
13363                 d_getgrgid_r=undef
13364                 getgrgid_r_proto=0
13365                 ;;
13366         esac
13367         ;;
13368 *)      getgrgid_r_proto=0
13369         ;;
13370 esac
13371
13372 : see if getgrnam_r exists
13373 set getgrnam_r d_getgrnam_r
13374 eval $inlibc
13375 case "$d_getgrnam_r" in
13376 "$define")
13377         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13378         case "$d_getgrnam_r_proto:$usethreads" in
13379         ":define")      d_getgrnam_r_proto=define
13380                 set d_getgrnam_r_proto getgrnam_r $hdrs
13381                 eval $hasproto ;;
13382         *)      ;;
13383         esac
13384         case "$d_getgrnam_r_proto" in
13385         define)
13386         case "$getgrnam_r_proto" in
13387         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13388         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13389         esac
13390         case "$getgrnam_r_proto" in
13391         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13392         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13393         esac
13394         case "$getgrnam_r_proto" in
13395         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13396         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13397         esac
13398         case "$getgrnam_r_proto" in
13399         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13400         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13401         esac
13402         case "$getgrnam_r_proto" in
13403         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13404         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13405         esac
13406         case "$getgrnam_r_proto" in
13407         ''|0)   d_getgrnam_r=undef
13408                 getgrnam_r_proto=0
13409                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13410         * )     case "$getgrnam_r_proto" in
13411                 REENTRANT_PROTO*) ;;
13412                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13413                 esac
13414                 echo "Prototype: $try" ;;
13415         esac
13416         ;;
13417         *)      case "$usethreads" in
13418                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13419                 esac
13420                 d_getgrnam_r=undef
13421                 getgrnam_r_proto=0
13422                 ;;
13423         esac
13424         ;;
13425 *)      getgrnam_r_proto=0
13426         ;;
13427 esac
13428
13429 : see if gethostbyaddr exists
13430 set gethostbyaddr d_gethbyaddr
13431 eval $inlibc
13432
13433 : see if gethostbyname exists
13434 set gethostbyname d_gethbyname
13435 eval $inlibc
13436
13437 : see if gethostent exists
13438 set gethostent d_gethent
13439 eval $inlibc
13440
13441 : see how we will look up host name
13442 echo " "
13443 call=''
13444 if set gethostname val -f d_gethname; eval $csym; $val; then
13445         echo 'gethostname() found.' >&4
13446         d_gethname="$define"
13447         call=gethostname
13448 fi
13449 if set uname val -f d_uname; eval $csym; $val; then
13450         if ./xenix; then
13451                 $cat <<'EOM'
13452 uname() was found, but you're running xenix, and older versions of xenix
13453 have a broken uname(). If you don't really know whether your xenix is old
13454 enough to have a broken system call, use the default answer.
13455
13456 EOM
13457                 dflt=y
13458                 case "$d_uname" in
13459                 "$define") dflt=n;;
13460                 esac
13461                 rp='Is your uname() broken?'
13462                 . ./myread
13463                 case "$ans" in
13464                 n*) d_uname="$define"; call=uname;;
13465                 esac
13466         else
13467                 echo 'uname() found.' >&4
13468                 d_uname="$define"
13469                 case "$call" in
13470                 '') call=uname ;;
13471                 esac
13472         fi
13473 fi
13474 case "$d_gethname" in
13475 '') d_gethname="$undef";;
13476 esac
13477 case "$d_uname" in
13478 '') d_uname="$undef";;
13479 esac
13480 case "$d_uname$d_gethname" in
13481 *define*)
13482         dflt=n
13483         cat <<EOM
13484
13485 Every now and then someone has a $call() that lies about the hostname
13486 but can't be fixed for political or economic reasons.  If you wish, I can
13487 pretend $call() isn't there and maybe compute hostname at run-time
13488 thanks to the '$phostname' command.
13489
13490 EOM
13491         rp="Shall I ignore $call() from now on?"
13492         . ./myread
13493         case "$ans" in
13494         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13495         esac;;
13496 esac
13497 case "$phostname" in
13498 '') aphostname='';;
13499 *) case "$aphostname" in
13500         /*) ;;
13501         *) set X $phostname
13502                 shift
13503                 file=$1
13504                 shift
13505                 file=`./loc $file $file $pth`
13506                 aphostname=`echo $file $*`
13507                 ;;
13508         esac
13509         ;;
13510 esac
13511 case "$d_uname$d_gethname" in
13512 *define*) ;;
13513 *)
13514         case "$phostname" in
13515         '')
13516                 echo "There will be no way for $package to get your hostname." >&4;;
13517         *)
13518         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13519                 ;;
13520         esac;;
13521 esac
13522 case "$d_phostname" in
13523 '') d_phostname="$undef";;
13524 esac
13525
13526 : see if gethostbyaddr_r exists
13527 set gethostbyaddr_r d_gethostbyaddr_r
13528 eval $inlibc
13529 case "$d_gethostbyaddr_r" in
13530 "$define")
13531         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13532         case "$d_gethostbyaddr_r_proto:$usethreads" in
13533         ":define")      d_gethostbyaddr_r_proto=define
13534                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13535                 eval $hasproto ;;
13536         *)      ;;
13537         esac
13538         case "$d_gethostbyaddr_r_proto" in
13539         define)
13540         case "$gethostbyaddr_r_proto" in
13541         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13542         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13543         esac
13544         case "$gethostbyaddr_r_proto" in
13545         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13546         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13547         esac
13548         case "$gethostbyaddr_r_proto" in
13549         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13550         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13551         esac
13552         case "$gethostbyaddr_r_proto" in
13553         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13554         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13555         esac
13556         case "$gethostbyaddr_r_proto" in
13557         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13558         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13559         esac
13560         case "$gethostbyaddr_r_proto" in
13561         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13562         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13563         esac
13564         case "$gethostbyaddr_r_proto" in
13565         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13566         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13567         esac
13568         case "$gethostbyaddr_r_proto" in
13569         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13570         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13571         esac
13572         case "$gethostbyaddr_r_proto" in
13573         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13574         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13575         esac
13576         case "$gethostbyaddr_r_proto" in
13577         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13578         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13579         esac
13580         case "$gethostbyaddr_r_proto" in
13581         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13582         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13583         esac
13584         case "$gethostbyaddr_r_proto" in
13585         ''|0)   d_gethostbyaddr_r=undef
13586                 gethostbyaddr_r_proto=0
13587                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13588         * )     case "$gethostbyaddr_r_proto" in
13589                 REENTRANT_PROTO*) ;;
13590                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13591                 esac
13592                 echo "Prototype: $try" ;;
13593         esac
13594         ;;
13595         *)      case "$usethreads" in
13596                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13597                 esac
13598                 d_gethostbyaddr_r=undef
13599                 gethostbyaddr_r_proto=0
13600                 ;;
13601         esac
13602         ;;
13603 *)      gethostbyaddr_r_proto=0
13604         ;;
13605 esac
13606
13607 : see if gethostbyname_r exists
13608 set gethostbyname_r d_gethostbyname_r
13609 eval $inlibc
13610 case "$d_gethostbyname_r" in
13611 "$define")
13612         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13613         case "$d_gethostbyname_r_proto:$usethreads" in
13614         ":define")      d_gethostbyname_r_proto=define
13615                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13616                 eval $hasproto ;;
13617         *)      ;;
13618         esac
13619         case "$d_gethostbyname_r_proto" in
13620         define)
13621         case "$gethostbyname_r_proto" in
13622         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13623         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13624         esac
13625         case "$gethostbyname_r_proto" in
13626         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13627         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13628         esac
13629         case "$gethostbyname_r_proto" in
13630         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13631         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13632         esac
13633         case "$gethostbyname_r_proto" in
13634         ''|0)   d_gethostbyname_r=undef
13635                 gethostbyname_r_proto=0
13636                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13637         * )     case "$gethostbyname_r_proto" in
13638                 REENTRANT_PROTO*) ;;
13639                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13640                 esac
13641                 echo "Prototype: $try" ;;
13642         esac
13643         ;;
13644         *)      case "$usethreads" in
13645                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13646                 esac
13647                 d_gethostbyname_r=undef
13648                 gethostbyname_r_proto=0
13649                 ;;
13650         esac
13651         ;;
13652 *)      gethostbyname_r_proto=0
13653         ;;
13654 esac
13655
13656 : see if gethostent_r exists
13657 set gethostent_r d_gethostent_r
13658 eval $inlibc
13659 case "$d_gethostent_r" in
13660 "$define")
13661         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13662         case "$d_gethostent_r_proto:$usethreads" in
13663         ":define")      d_gethostent_r_proto=define
13664                 set d_gethostent_r_proto gethostent_r $hdrs
13665                 eval $hasproto ;;
13666         *)      ;;
13667         esac
13668         case "$d_gethostent_r_proto" in
13669         define)
13670         case "$gethostent_r_proto" in
13671         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13672         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13673         esac
13674         case "$gethostent_r_proto" in
13675         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13676         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13677         esac
13678         case "$gethostent_r_proto" in
13679         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13680         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13681         esac
13682         case "$gethostent_r_proto" in
13683         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13684         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13685         esac
13686         case "$gethostent_r_proto" in
13687         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13688         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13689         esac
13690         case "$gethostent_r_proto" in
13691         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13692         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13693         esac
13694         case "$gethostent_r_proto" in
13695         ''|0)   d_gethostent_r=undef
13696                 gethostent_r_proto=0
13697                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13698         * )     case "$gethostent_r_proto" in
13699                 REENTRANT_PROTO*) ;;
13700                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13701                 esac
13702                 echo "Prototype: $try" ;;
13703         esac
13704         ;;
13705         *)      case "$usethreads" in
13706                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13707                 esac
13708                 d_gethostent_r=undef
13709                 gethostent_r_proto=0
13710                 ;;
13711         esac
13712         ;;
13713 *)      gethostent_r_proto=0
13714         ;;
13715 esac
13716
13717 : see if prototypes for various gethostxxx netdb.h functions are available
13718 echo " "
13719 set d_gethostprotos gethostent $i_netdb netdb.h
13720 eval $hasproto
13721
13722 : see if getitimer exists
13723 set getitimer d_getitimer
13724 eval $inlibc
13725
13726 : see if getlogin exists
13727 set getlogin d_getlogin
13728 eval $inlibc
13729
13730 : see if getlogin_r exists
13731 set getlogin_r d_getlogin_r
13732 eval $inlibc
13733 case "$d_getlogin_r" in
13734 "$define")
13735         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13736         case "$d_getlogin_r_proto:$usethreads" in
13737         ":define")      d_getlogin_r_proto=define
13738                 set d_getlogin_r_proto getlogin_r $hdrs
13739                 eval $hasproto ;;
13740         *)      ;;
13741         esac
13742         case "$d_getlogin_r_proto" in
13743         define)
13744         case "$getlogin_r_proto" in
13745         ''|0) try='int getlogin_r(char*, size_t);'
13746         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13747         esac
13748         case "$getlogin_r_proto" in
13749         ''|0) try='int getlogin_r(char*, int);'
13750         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13751         esac
13752         case "$getlogin_r_proto" in
13753         ''|0) try='char* getlogin_r(char*, size_t);'
13754         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13755         esac
13756         case "$getlogin_r_proto" in
13757         ''|0) try='char* getlogin_r(char*, int);'
13758         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13759         esac
13760         case "$getlogin_r_proto" in
13761         ''|0)   d_getlogin_r=undef
13762                 getlogin_r_proto=0
13763                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13764         * )     case "$getlogin_r_proto" in
13765                 REENTRANT_PROTO*) ;;
13766                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13767                 esac
13768                 echo "Prototype: $try" ;;
13769         esac
13770         ;;
13771         *)      case "$usethreads" in
13772                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13773                 esac
13774                 d_getlogin_r=undef
13775                 getlogin_r_proto=0
13776                 ;;
13777         esac
13778         ;;
13779 *)      getlogin_r_proto=0
13780         ;;
13781 esac
13782
13783 : see if getmnt exists
13784 set getmnt d_getmnt
13785 eval $inlibc
13786
13787 : see if getmntent exists
13788 set getmntent d_getmntent
13789 eval $inlibc
13790
13791 : see if getnetbyaddr exists
13792 set getnetbyaddr d_getnbyaddr
13793 eval $inlibc
13794
13795 : see if getnetbyname exists
13796 set getnetbyname d_getnbyname
13797 eval $inlibc
13798
13799 : see if getnetent exists
13800 set getnetent d_getnent
13801 eval $inlibc
13802
13803 : see if getnetbyaddr_r exists
13804 set getnetbyaddr_r d_getnetbyaddr_r
13805 eval $inlibc
13806 case "$d_getnetbyaddr_r" in
13807 "$define")
13808         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13809         case "$d_getnetbyaddr_r_proto:$usethreads" in
13810         ":define")      d_getnetbyaddr_r_proto=define
13811                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13812                 eval $hasproto ;;
13813         *)      ;;
13814         esac
13815         case "$d_getnetbyaddr_r_proto" in
13816         define)
13817         case "$getnetbyaddr_r_proto" in
13818         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13819         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13820         esac
13821         case "$getnetbyaddr_r_proto" in
13822         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13823         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13824         esac
13825         case "$getnetbyaddr_r_proto" in
13826         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13827         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13828         esac
13829         case "$getnetbyaddr_r_proto" in
13830         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13831         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13832         esac
13833         case "$getnetbyaddr_r_proto" in
13834         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13835         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13836         esac
13837         case "$getnetbyaddr_r_proto" in
13838         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13839         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13840         esac
13841         case "$getnetbyaddr_r_proto" in
13842         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13843         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13844         esac
13845         case "$getnetbyaddr_r_proto" in
13846         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13847         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13848         esac
13849         case "$getnetbyaddr_r_proto" in
13850         ''|0)   d_getnetbyaddr_r=undef
13851                 getnetbyaddr_r_proto=0
13852                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13853         * )     case "$getnetbyaddr_r_proto" in
13854                 REENTRANT_PROTO*) ;;
13855                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13856                 esac
13857                 echo "Prototype: $try" ;;
13858         esac
13859         ;;
13860         *)      case "$usethreads" in
13861                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13862                 esac
13863                 d_getnetbyaddr_r=undef
13864                 getnetbyaddr_r_proto=0
13865                 ;;
13866         esac
13867         ;;
13868 *)      getnetbyaddr_r_proto=0
13869         ;;
13870 esac
13871
13872 : see if getnetbyname_r exists
13873 set getnetbyname_r d_getnetbyname_r
13874 eval $inlibc
13875 case "$d_getnetbyname_r" in
13876 "$define")
13877         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13878         case "$d_getnetbyname_r_proto:$usethreads" in
13879         ":define")      d_getnetbyname_r_proto=define
13880                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13881                 eval $hasproto ;;
13882         *)      ;;
13883         esac
13884         case "$d_getnetbyname_r_proto" in
13885         define)
13886         case "$getnetbyname_r_proto" in
13887         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13888         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13889         esac
13890         case "$getnetbyname_r_proto" in
13891         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13892         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13893         esac
13894         case "$getnetbyname_r_proto" in
13895         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13896         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13897         esac
13898         case "$getnetbyname_r_proto" in
13899         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13900         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13901         esac
13902         case "$getnetbyname_r_proto" in
13903         ''|0)   d_getnetbyname_r=undef
13904                 getnetbyname_r_proto=0
13905                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13906         * )     case "$getnetbyname_r_proto" in
13907                 REENTRANT_PROTO*) ;;
13908                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13909                 esac
13910                 echo "Prototype: $try" ;;
13911         esac
13912         ;;
13913         *)      case "$usethreads" in
13914                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13915                 esac
13916                 d_getnetbyname_r=undef
13917                 getnetbyname_r_proto=0
13918                 ;;
13919         esac
13920         ;;
13921 *)      getnetbyname_r_proto=0
13922         ;;
13923 esac
13924
13925 : see if getnetent_r exists
13926 set getnetent_r d_getnetent_r
13927 eval $inlibc
13928 case "$d_getnetent_r" in
13929 "$define")
13930         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13931         case "$d_getnetent_r_proto:$usethreads" in
13932         ":define")      d_getnetent_r_proto=define
13933                 set d_getnetent_r_proto getnetent_r $hdrs
13934                 eval $hasproto ;;
13935         *)      ;;
13936         esac
13937         case "$d_getnetent_r_proto" in
13938         define)
13939         case "$getnetent_r_proto" in
13940         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13941         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13942         esac
13943         case "$getnetent_r_proto" in
13944         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13945         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13946         esac
13947         case "$getnetent_r_proto" in
13948         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13949         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13950         esac
13951         case "$getnetent_r_proto" in
13952         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13953         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13954         esac
13955         case "$getnetent_r_proto" in
13956         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13957         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13958         esac
13959         case "$getnetent_r_proto" in
13960         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13961         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13962         esac
13963         case "$getnetent_r_proto" in
13964         ''|0)   d_getnetent_r=undef
13965                 getnetent_r_proto=0
13966                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13967         * )     case "$getnetent_r_proto" in
13968                 REENTRANT_PROTO*) ;;
13969                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13970                 esac
13971                 echo "Prototype: $try" ;;
13972         esac
13973         ;;
13974         *)      case "$usethreads" in
13975                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13976                 esac
13977                 d_getnetent_r=undef
13978                 getnetent_r_proto=0
13979                 ;;
13980         esac
13981         ;;
13982 *)      getnetent_r_proto=0
13983         ;;
13984 esac
13985
13986 : see if prototypes for various getnetxxx netdb.h functions are available
13987 echo " "
13988 set d_getnetprotos getnetent $i_netdb netdb.h
13989 eval $hasproto
13990
13991 : see if getpagesize exists
13992 set getpagesize d_getpagsz
13993 eval $inlibc
13994
13995 : Optional checks for getprotobyname and getprotobynumber
13996
13997 : see if getprotobyname exists
13998 set getprotobyname d_getpbyname
13999 eval $inlibc
14000
14001 : see if getprotobynumber exists
14002 set getprotobynumber d_getpbynumber
14003 eval $inlibc
14004
14005 : see if getprotoent exists
14006 set getprotoent d_getpent
14007 eval $inlibc
14008
14009 : see if getpgid exists
14010 set getpgid d_getpgid
14011 eval $inlibc
14012
14013 : see if getpgrp2 exists
14014 set getpgrp2 d_getpgrp2
14015 eval $inlibc
14016
14017 : see if getppid exists
14018 set getppid d_getppid
14019 eval $inlibc
14020
14021 : see if getpriority exists
14022 set getpriority d_getprior
14023 eval $inlibc
14024
14025 : see if getprotobyname_r exists
14026 set getprotobyname_r d_getprotobyname_r
14027 eval $inlibc
14028 case "$d_getprotobyname_r" in
14029 "$define")
14030         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14031         case "$d_getprotobyname_r_proto:$usethreads" in
14032         ":define")      d_getprotobyname_r_proto=define
14033                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14034                 eval $hasproto ;;
14035         *)      ;;
14036         esac
14037         case "$d_getprotobyname_r_proto" in
14038         define)
14039         case "$getprotobyname_r_proto" in
14040         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14041         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14042         esac
14043         case "$getprotobyname_r_proto" in
14044         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14045         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14046         esac
14047         case "$getprotobyname_r_proto" in
14048         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14049         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14050         esac
14051         case "$getprotobyname_r_proto" in
14052         ''|0)   d_getprotobyname_r=undef
14053                 getprotobyname_r_proto=0
14054                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14055         * )     case "$getprotobyname_r_proto" in
14056                 REENTRANT_PROTO*) ;;
14057                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14058                 esac
14059                 echo "Prototype: $try" ;;
14060         esac
14061         ;;
14062         *)      case "$usethreads" in
14063                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14064                 esac
14065                 d_getprotobyname_r=undef
14066                 getprotobyname_r_proto=0
14067                 ;;
14068         esac
14069         ;;
14070 *)      getprotobyname_r_proto=0
14071         ;;
14072 esac
14073
14074 : see if getprotobynumber_r exists
14075 set getprotobynumber_r d_getprotobynumber_r
14076 eval $inlibc
14077 case "$d_getprotobynumber_r" in
14078 "$define")
14079         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14080         case "$d_getprotobynumber_r_proto:$usethreads" in
14081         ":define")      d_getprotobynumber_r_proto=define
14082                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14083                 eval $hasproto ;;
14084         *)      ;;
14085         esac
14086         case "$d_getprotobynumber_r_proto" in
14087         define)
14088         case "$getprotobynumber_r_proto" in
14089         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14090         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14091         esac
14092         case "$getprotobynumber_r_proto" in
14093         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14094         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14095         esac
14096         case "$getprotobynumber_r_proto" in
14097         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14098         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14099         esac
14100         case "$getprotobynumber_r_proto" in
14101         ''|0)   d_getprotobynumber_r=undef
14102                 getprotobynumber_r_proto=0
14103                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14104         * )     case "$getprotobynumber_r_proto" in
14105                 REENTRANT_PROTO*) ;;
14106                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14107                 esac
14108                 echo "Prototype: $try" ;;
14109         esac
14110         ;;
14111         *)      case "$usethreads" in
14112                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14113                 esac
14114                 d_getprotobynumber_r=undef
14115                 getprotobynumber_r_proto=0
14116                 ;;
14117         esac
14118         ;;
14119 *)      getprotobynumber_r_proto=0
14120         ;;
14121 esac
14122
14123 : see if getprotoent_r exists
14124 set getprotoent_r d_getprotoent_r
14125 eval $inlibc
14126 case "$d_getprotoent_r" in
14127 "$define")
14128         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14129         case "$d_getprotoent_r_proto:$usethreads" in
14130         ":define")      d_getprotoent_r_proto=define
14131                 set d_getprotoent_r_proto getprotoent_r $hdrs
14132                 eval $hasproto ;;
14133         *)      ;;
14134         esac
14135         case "$d_getprotoent_r_proto" in
14136         define)
14137         case "$getprotoent_r_proto" in
14138         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14139         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14140         esac
14141         case "$getprotoent_r_proto" in
14142         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14143         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14144         esac
14145         case "$getprotoent_r_proto" in
14146         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14147         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14148         esac
14149         case "$getprotoent_r_proto" in
14150         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14151         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
14152         esac
14153         case "$getprotoent_r_proto" in
14154         ''|0)   d_getprotoent_r=undef
14155                 getprotoent_r_proto=0
14156                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14157         * )     case "$getprotoent_r_proto" in
14158                 REENTRANT_PROTO*) ;;
14159                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14160                 esac
14161                 echo "Prototype: $try" ;;
14162         esac
14163         ;;
14164         *)      case "$usethreads" in
14165                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14166                 esac
14167                 d_getprotoent_r=undef
14168                 getprotoent_r_proto=0
14169                 ;;
14170         esac
14171         ;;
14172 *)      getprotoent_r_proto=0
14173         ;;
14174 esac
14175
14176 : see if prototypes for various getprotoxxx netdb.h functions are available
14177 echo " "
14178 set d_getprotoprotos getprotoent $i_netdb netdb.h
14179 eval $hasproto
14180
14181 : see if getprpwnam exists
14182 set getprpwnam d_getprpwnam
14183 eval $inlibc
14184
14185 : see if getpwent exists
14186 set getpwent d_getpwent
14187 eval $inlibc
14188
14189 : see if getpwent_r exists
14190 set getpwent_r d_getpwent_r
14191 eval $inlibc
14192 case "$d_getpwent_r" in
14193 "$define")
14194         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14195         case "$d_getpwent_r_proto:$usethreads" in
14196         ":define")      d_getpwent_r_proto=define
14197                 set d_getpwent_r_proto getpwent_r $hdrs
14198                 eval $hasproto ;;
14199         *)      ;;
14200         esac
14201         case "$d_getpwent_r_proto" in
14202         define)
14203         case "$getpwent_r_proto" in
14204         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14205         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14206         esac
14207         case "$getpwent_r_proto" in
14208         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14209         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14210         esac
14211         case "$getpwent_r_proto" in
14212         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14213         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
14214         esac
14215         case "$getpwent_r_proto" in
14216         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14217         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
14218         esac
14219         case "$getpwent_r_proto" in
14220         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14221         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
14222         esac
14223         case "$getpwent_r_proto" in
14224         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14225         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14226         esac
14227         case "$getpwent_r_proto" in
14228         ''|0)   d_getpwent_r=undef
14229                 getpwent_r_proto=0
14230                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14231         * )     case "$getpwent_r_proto" in
14232                 REENTRANT_PROTO*) ;;
14233                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14234                 esac
14235                 echo "Prototype: $try" ;;
14236         esac
14237         ;;
14238         *)      case "$usethreads" in
14239                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14240                 esac
14241                 d_getpwent_r=undef
14242                 getpwent_r_proto=0
14243                 ;;
14244         esac
14245         ;;
14246 *)      getpwent_r_proto=0
14247         ;;
14248 esac
14249
14250 : see if getpwnam_r exists
14251 set getpwnam_r d_getpwnam_r
14252 eval $inlibc
14253 case "$d_getpwnam_r" in
14254 "$define")
14255         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14256         case "$d_getpwnam_r_proto:$usethreads" in
14257         ":define")      d_getpwnam_r_proto=define
14258                 set d_getpwnam_r_proto getpwnam_r $hdrs
14259                 eval $hasproto ;;
14260         *)      ;;
14261         esac
14262         case "$d_getpwnam_r_proto" in
14263         define)
14264         case "$getpwnam_r_proto" in
14265         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14266         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14267         esac
14268         case "$getpwnam_r_proto" in
14269         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14270         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14271         esac
14272         case "$getpwnam_r_proto" in
14273         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14274         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14275         esac
14276         case "$getpwnam_r_proto" in
14277         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14278         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14279         esac
14280         case "$getpwnam_r_proto" in
14281         ''|0)   d_getpwnam_r=undef
14282                 getpwnam_r_proto=0
14283                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14284         * )     case "$getpwnam_r_proto" in
14285                 REENTRANT_PROTO*) ;;
14286                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14287                 esac
14288                 echo "Prototype: $try" ;;
14289         esac
14290         ;;
14291         *)      case "$usethreads" in
14292                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14293                 esac
14294                 d_getpwnam_r=undef
14295                 getpwnam_r_proto=0
14296                 ;;
14297         esac
14298         ;;
14299 *)      getpwnam_r_proto=0
14300         ;;
14301 esac
14302
14303 : see if getpwuid_r exists
14304 set getpwuid_r d_getpwuid_r
14305 eval $inlibc
14306 case "$d_getpwuid_r" in
14307 "$define")
14308         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14309         case "$d_getpwuid_r_proto:$usethreads" in
14310         ":define")      d_getpwuid_r_proto=define
14311                 set d_getpwuid_r_proto getpwuid_r $hdrs
14312                 eval $hasproto ;;
14313         *)      ;;
14314         esac
14315         case "$d_getpwuid_r_proto" in
14316         define)
14317         case "$getpwuid_r_proto" in
14318         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14319         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14320         esac
14321         case "$getpwuid_r_proto" in
14322         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14323         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14324         esac
14325         case "$getpwuid_r_proto" in
14326         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14327         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14328         esac
14329         case "$getpwuid_r_proto" in
14330         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14331         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14332         esac
14333         case "$getpwuid_r_proto" in
14334         ''|0)   d_getpwuid_r=undef
14335                 getpwuid_r_proto=0
14336                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14337         * )     case "$getpwuid_r_proto" in
14338                 REENTRANT_PROTO*) ;;
14339                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14340                 esac
14341                 echo "Prototype: $try" ;;
14342         esac
14343         ;;
14344         *)      case "$usethreads" in
14345                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14346                 esac
14347                 d_getpwuid_r=undef
14348                 getpwuid_r_proto=0
14349                 ;;
14350         esac
14351         ;;
14352 *)      getpwuid_r_proto=0
14353         ;;
14354 esac
14355
14356 : Optional checks for getsbyname and getsbyport
14357
14358 : see if getservbyname exists
14359 set getservbyname d_getsbyname
14360 eval $inlibc
14361
14362 : see if getservbyport exists
14363 set getservbyport d_getsbyport
14364 eval $inlibc
14365
14366 : see if getservent exists
14367 set getservent d_getsent
14368 eval $inlibc
14369
14370 : see if getservbyname_r exists
14371 set getservbyname_r d_getservbyname_r
14372 eval $inlibc
14373 case "$d_getservbyname_r" in
14374 "$define")
14375         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14376         case "$d_getservbyname_r_proto:$usethreads" in
14377         ":define")      d_getservbyname_r_proto=define
14378                 set d_getservbyname_r_proto getservbyname_r $hdrs
14379                 eval $hasproto ;;
14380         *)      ;;
14381         esac
14382         case "$d_getservbyname_r_proto" in
14383         define)
14384         case "$getservbyname_r_proto" in
14385         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14386         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14387         esac
14388         case "$getservbyname_r_proto" in
14389         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14390         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14391         esac
14392         case "$getservbyname_r_proto" in
14393         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14394         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14395         esac
14396         case "$getservbyname_r_proto" in
14397         ''|0)   d_getservbyname_r=undef
14398                 getservbyname_r_proto=0
14399                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14400         * )     case "$getservbyname_r_proto" in
14401                 REENTRANT_PROTO*) ;;
14402                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14403                 esac
14404                 echo "Prototype: $try" ;;
14405         esac
14406         ;;
14407         *)      case "$usethreads" in
14408                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14409                 esac
14410                 d_getservbyname_r=undef
14411                 getservbyname_r_proto=0
14412                 ;;
14413         esac
14414         ;;
14415 *)      getservbyname_r_proto=0
14416         ;;
14417 esac
14418
14419 : see if getservbyport_r exists
14420 set getservbyport_r d_getservbyport_r
14421 eval $inlibc
14422 case "$d_getservbyport_r" in
14423 "$define")
14424         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14425         case "$d_getservbyport_r_proto:$usethreads" in
14426         ":define")      d_getservbyport_r_proto=define
14427                 set d_getservbyport_r_proto getservbyport_r $hdrs
14428                 eval $hasproto ;;
14429         *)      ;;
14430         esac
14431         case "$d_getservbyport_r_proto" in
14432         define)
14433         case "$getservbyport_r_proto" in
14434         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14435         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14436         esac
14437         case "$getservbyport_r_proto" in
14438         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14439         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14440         esac
14441         case "$getservbyport_r_proto" in
14442         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14443         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14444         esac
14445         case "$getservbyport_r_proto" in
14446         ''|0)   d_getservbyport_r=undef
14447                 getservbyport_r_proto=0
14448                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14449         * )     case "$getservbyport_r_proto" in
14450                 REENTRANT_PROTO*) ;;
14451                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14452                 esac
14453                 echo "Prototype: $try" ;;
14454         esac
14455         ;;
14456         *)      case "$usethreads" in
14457                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14458                 esac
14459                 d_getservbyport_r=undef
14460                 getservbyport_r_proto=0
14461                 ;;
14462         esac
14463         ;;
14464 *)      getservbyport_r_proto=0
14465         ;;
14466 esac
14467
14468 : see if getservent_r exists
14469 set getservent_r d_getservent_r
14470 eval $inlibc
14471 case "$d_getservent_r" in
14472 "$define")
14473         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14474         case "$d_getservent_r_proto:$usethreads" in
14475         ":define")      d_getservent_r_proto=define
14476                 set d_getservent_r_proto getservent_r $hdrs
14477                 eval $hasproto ;;
14478         *)      ;;
14479         esac
14480         case "$d_getservent_r_proto" in
14481         define)
14482         case "$getservent_r_proto" in
14483         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14484         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14485         esac
14486         case "$getservent_r_proto" in
14487         ''|0) try='int getservent_r(struct servent*, char*, int);'
14488         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14489         esac
14490         case "$getservent_r_proto" in
14491         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14492         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14493         esac
14494         case "$getservent_r_proto" in
14495         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14496         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14497         esac
14498         case "$getservent_r_proto" in
14499         ''|0)   d_getservent_r=undef
14500                 getservent_r_proto=0
14501                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14502         * )     case "$getservent_r_proto" in
14503                 REENTRANT_PROTO*) ;;
14504                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14505                 esac
14506                 echo "Prototype: $try" ;;
14507         esac
14508         ;;
14509         *)      case "$usethreads" in
14510                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14511                 esac
14512                 d_getservent_r=undef
14513                 getservent_r_proto=0
14514                 ;;
14515         esac
14516         ;;
14517 *)      getservent_r_proto=0
14518         ;;
14519 esac
14520
14521 : see if prototypes for various getservxxx netdb.h functions are available
14522 echo " "
14523 set d_getservprotos getservent $i_netdb netdb.h
14524 eval $hasproto
14525
14526 : see if getspnam exists
14527 set getspnam d_getspnam
14528 eval $inlibc
14529
14530 : see if this is a shadow.h system
14531 set shadow.h i_shadow
14532 eval $inhdr
14533
14534 : see if getspnam_r exists
14535 set getspnam_r d_getspnam_r
14536 eval $inlibc
14537 case "$d_getspnam_r" in
14538 "$define")
14539         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14540         case "$d_getspnam_r_proto:$usethreads" in
14541         ":define")      d_getspnam_r_proto=define
14542                 set d_getspnam_r_proto getspnam_r $hdrs
14543                 eval $hasproto ;;
14544         *)      ;;
14545         esac
14546         case "$d_getspnam_r_proto" in
14547         define)
14548         case "$getspnam_r_proto" in
14549         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14550         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14551         esac
14552         case "$getspnam_r_proto" in
14553         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14554         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14555         esac
14556         case "$getspnam_r_proto" in
14557         ''|0)   d_getspnam_r=undef
14558                 getspnam_r_proto=0
14559                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14560         * )     case "$getspnam_r_proto" in
14561                 REENTRANT_PROTO*) ;;
14562                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14563                 esac
14564                 echo "Prototype: $try" ;;
14565         esac
14566         ;;
14567         *)      case "$usethreads" in
14568                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14569                 esac
14570                 d_getspnam_r=undef
14571                 getspnam_r_proto=0
14572                 ;;
14573         esac
14574         ;;
14575 *)      getspnam_r_proto=0
14576         ;;
14577 esac
14578
14579 : see if gettimeofday or ftime exists
14580 set gettimeofday d_gettimeod
14581 eval $inlibc
14582 case "$d_gettimeod" in
14583 "$undef")
14584         set ftime d_ftime 
14585         eval $inlibc
14586         ;;
14587 *)
14588         val="$undef"; set d_ftime; eval $setvar
14589         ;;
14590 esac
14591 case "$d_gettimeod$d_ftime" in
14592 "$undef$undef")
14593         echo " "
14594         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14595         ;;
14596 esac
14597
14598 : see if gmtime_r exists
14599 set gmtime_r d_gmtime_r
14600 eval $inlibc
14601 case "$d_gmtime_r" in
14602 "$define")
14603         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14604         case "$d_gmtime_r_proto:$usethreads" in
14605         ":define")      d_gmtime_r_proto=define
14606                 set d_gmtime_r_proto gmtime_r $hdrs
14607                 eval $hasproto ;;
14608         *)      ;;
14609         esac
14610         case "$d_gmtime_r_proto" in
14611         define)
14612         case "$gmtime_r_proto" in
14613         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14614         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14615         esac
14616         case "$gmtime_r_proto" in
14617         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14618         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14619         esac
14620         case "$gmtime_r_proto" in
14621         ''|0)   d_gmtime_r=undef
14622                 gmtime_r_proto=0
14623                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14624         * )     case "$gmtime_r_proto" in
14625                 REENTRANT_PROTO*) ;;
14626                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14627                 esac
14628                 echo "Prototype: $try" ;;
14629         esac
14630         ;;
14631         *)      case "$usethreads" in
14632                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14633                 esac
14634                 d_gmtime_r=undef
14635                 gmtime_r_proto=0
14636                 ;;
14637         esac
14638         ;;
14639 *)      gmtime_r_proto=0
14640         ;;
14641 esac
14642
14643 : see if hasmntopt exists
14644 set hasmntopt d_hasmntopt
14645 eval $inlibc
14646
14647 : see if this is a netinet/in.h or sys/in.h system
14648 set netinet/in.h i_niin sys/in.h i_sysin
14649 eval $inhdr
14650
14651 : see if arpa/inet.h has to be included
14652 set arpa/inet.h i_arpainet
14653 eval $inhdr
14654
14655 : see if htonl --and friends-- exists
14656 val=''
14657 set htonl val
14658 eval $inlibc
14659
14660 : Maybe they are macros.
14661 case "$val" in
14662 $undef)
14663         $cat >htonl.c <<EOM
14664 #include <stdio.h>
14665 #include <sys/types.h>
14666 #$i_niin I_NETINET_IN
14667 #$i_sysin I_SYS_IN
14668 #$i_arpainet I_ARPA_INET
14669 #ifdef I_NETINET_IN
14670 #include <netinet/in.h>
14671 #endif
14672 #ifdef I_SYS_IN
14673 #include <sys/in.h>
14674 #endif
14675 #ifdef I_ARPA_INET
14676 #include <arpa/inet.h>
14677 #endif
14678 #ifdef htonl
14679 printf("Defined as a macro.");
14680 #endif
14681 EOM
14682         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14683         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14684                 val="$define"
14685                 echo "But it seems to be defined as a macro." >&4
14686         fi
14687         $rm -f htonl.?
14688         ;;
14689 esac
14690 set d_htonl
14691 eval $setvar
14692
14693 : see if ilogbl exists
14694 set ilogbl d_ilogbl
14695 eval $inlibc
14696
14697 : index or strchr
14698 echo " "
14699 if set index val -f; eval $csym; $val; then
14700         if set strchr val -f d_strchr; eval $csym; $val; then
14701                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14702                         val="$define"
14703                         vali="$undef"
14704                         echo "strchr() found." >&4
14705                 else
14706                         val="$undef"
14707                         vali="$define"
14708                         echo "index() found." >&4
14709                 fi
14710         else
14711                 val="$undef"
14712                 vali="$define"
14713                 echo "index() found." >&4
14714         fi
14715 else
14716         if set strchr val -f d_strchr; eval $csym; $val; then
14717                 val="$define"
14718                 vali="$undef"
14719                 echo "strchr() found." >&4
14720         else
14721                 echo "No index() or strchr() found!" >&4
14722                 val="$undef"
14723                 vali="$undef"
14724         fi
14725 fi
14726 set d_strchr; eval $setvar
14727 val="$vali"
14728 set d_index; eval $setvar
14729
14730 : check whether inet_aton exists
14731 set inet_aton d_inetaton
14732 eval $inlibc
14733
14734 : Look for isascii
14735 echo " "
14736 $cat >isascii.c <<EOCP
14737 #include <stdio.h>
14738 #include <ctype.h>
14739 #$i_stdlib I_STDLIB
14740 #ifdef I_STDLIB
14741 #include <stdlib.h>
14742 #endif
14743 int main() {
14744         int c = 'A';
14745         if (isascii(c))
14746                 exit(0);
14747         else
14748                 exit(1);
14749 }
14750 EOCP
14751 set isascii
14752 if eval $compile; then
14753         echo "isascii() found." >&4
14754         val="$define"
14755 else
14756         echo "isascii() NOT found." >&4
14757         val="$undef"
14758 fi
14759 set d_isascii
14760 eval $setvar
14761 $rm -f isascii*
14762
14763 : see if isfinite exists
14764 set isfinite d_isfinite
14765 eval $inlibc
14766
14767 : see if isinf exists
14768 set isinf d_isinf
14769 eval $inlibc
14770
14771 : see if isnan exists
14772 set isnan d_isnan
14773 eval $inlibc
14774
14775 : see if isnanl exists
14776 set isnanl d_isnanl
14777 eval $inlibc
14778
14779 : see if killpg exists
14780 set killpg d_killpg
14781 eval $inlibc
14782
14783 : see if lchown exists
14784 echo " "
14785 $cat > try.c <<'EOCP'
14786 /* System header to define __stub macros and hopefully few prototypes,
14787     which can conflict with char lchown(); below.  */
14788 #include <assert.h>
14789 /* Override any gcc2 internal prototype to avoid an error.  */
14790 /* We use char because int might match the return type of a gcc2
14791    builtin and then its argument prototype would still apply.  */
14792 char lchown();
14793 int main() {
14794     /*  The GNU C library defines this for functions which it implements
14795         to always fail with ENOSYS.  Some functions are actually named
14796         something starting with __ and the normal name is an alias.  */
14797 #if defined (__stub_lchown) || defined (__stub___lchown)
14798 choke me
14799 #else
14800 lchown();
14801 #endif
14802 ; return 0; }
14803 EOCP
14804 set try
14805 if eval $compile; then
14806     $echo "lchown() found." >&4
14807     val="$define"
14808 else
14809     $echo "lchown() NOT found." >&4
14810     val="$undef"
14811 fi
14812 set d_lchown
14813 eval $setvar
14814
14815 : See if number of significant digits in a double precision number is known
14816 echo " "
14817 $cat >ldbl_dig.c <<EOM
14818 #$i_limits I_LIMITS
14819 #$i_float I_FLOAT
14820 #ifdef I_LIMITS
14821 #include <limits.h>
14822 #endif
14823 #ifdef I_FLOAT
14824 #include <float.h>
14825 #endif
14826 #ifdef LDBL_DIG
14827 printf("Contains LDBL_DIG");
14828 #endif
14829 EOM
14830 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14831 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14832         echo "LDBL_DIG found." >&4
14833         val="$define"
14834 else
14835         echo "LDBL_DIG NOT found." >&4
14836         val="$undef"
14837 fi
14838 $rm -f ldbl_dig.?
14839 set d_ldbl_dig
14840 eval $setvar
14841
14842 : see if this is a math.h system
14843 set math.h i_math
14844 eval $inhdr
14845
14846 : check to see if math.h defines _LIB_VERSION
14847 d_libm_lib_version="$undef"
14848 case $i_math in
14849     $define)
14850         echo " "
14851         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14852         $cat >try.c <<EOCP
14853 #include <unistd.h>
14854 #include <math.h>
14855 int main (int argc, char *argv[])
14856 {
14857     printf ("%d\n", _LIB_VERSION);
14858     return (0);
14859     } /* main */
14860 EOCP
14861         set try
14862         if eval $compile; then
14863             foo=`$run ./try`
14864             echo "Yes, it does ($foo)" >&4
14865             d_libm_lib_version="$define"
14866         else
14867             echo "No, it does not (probably harmless)" >&4
14868             fi
14869         $rm_try
14870         ;;
14871
14872     esac
14873
14874 : see if link exists
14875 set link d_link
14876 eval $inlibc
14877
14878 : see if localtime_r exists
14879 set localtime_r d_localtime_r
14880 eval $inlibc
14881 case "$d_localtime_r" in
14882 "$define")
14883         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14884         case "$d_localtime_r_proto:$usethreads" in
14885         ":define")      d_localtime_r_proto=define
14886                 set d_localtime_r_proto localtime_r $hdrs
14887                 eval $hasproto ;;
14888         *)      ;;
14889         esac
14890         case "$d_localtime_r_proto" in
14891         define)
14892         case "$localtime_r_proto" in
14893         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14894         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14895         esac
14896         case "$localtime_r_proto" in
14897         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14898         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14899         esac
14900         case "$localtime_r_proto" in
14901         ''|0)   d_localtime_r=undef
14902                 localtime_r_proto=0
14903                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14904         * )     case "$localtime_r_proto" in
14905                 REENTRANT_PROTO*) ;;
14906                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14907                 esac
14908                 echo "Prototype: $try" ;;
14909         esac
14910         ;;
14911         *)      case "$usethreads" in
14912                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14913                 esac
14914                 d_localtime_r=undef
14915                 localtime_r_proto=0
14916                 ;;
14917         esac
14918         ;;
14919 *)      localtime_r_proto=0
14920         ;;
14921 esac
14922
14923 : see if localtime_r calls tzset
14924 case "$localtime_r_proto" in
14925 REENTRANT_PROTO*)
14926         $cat >try.c <<EOCP
14927 /*  Does our libc's localtime_r call tzset ?
14928  *  return 0 if so, 1 otherwise.
14929  */
14930 #include <sys/types.h>
14931 #include <unistd.h>
14932 #include <time.h>
14933 #include <string.h>
14934 #include <malloc.h>
14935 int main()
14936 {
14937     time_t t = time(0L);
14938     char w_tz[]="TZ" "=GMT+5",
14939          e_tz[]="TZ" "=GMT-5",
14940         *tz_e = (char*)malloc(16),
14941         *tz_w = (char*)malloc(16);
14942     struct tm tm_e, tm_w;
14943     memset(&tm_e,'\0',sizeof(struct tm));
14944     memset(&tm_w,'\0',sizeof(struct tm));
14945     strcpy(tz_e,e_tz);
14946     strcpy(tz_w,w_tz);
14947
14948     putenv(tz_e);
14949     localtime_r(&t, &tm_e);
14950
14951     putenv(tz_w);
14952     localtime_r(&t, &tm_w);
14953
14954     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14955         return 1;
14956     return 0;
14957 }
14958 EOCP
14959         set try
14960         if eval $compile; then
14961             if $run ./try; then
14962                 d_localtime_r_needs_tzset=undef;
14963             else
14964                 d_localtime_r_needs_tzset=define;
14965             fi;
14966         else
14967             d_localtime_r_needs_tzset=undef;
14968         fi;
14969      ;;
14970   *)
14971      d_localtime_r_needs_tzset=undef;
14972      ;;
14973 esac
14974 $rm_try
14975
14976 : see if localeconv exists
14977 set localeconv d_locconv
14978 eval $inlibc
14979
14980 : see if lockf exists
14981 set lockf d_lockf
14982 eval $inlibc
14983
14984 : see if prototype for lseek is available
14985 echo " "
14986 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14987 eval $hasproto
14988
14989 : see if lstat exists
14990 set lstat d_lstat
14991 eval $inlibc
14992
14993 : see if madvise exists
14994 set madvise d_madvise
14995 eval $inlibc
14996
14997 : see if malloc_size exists
14998 set malloc_size d_malloc_size
14999 eval $inlibc
15000
15001 : see if malloc_size_good exists
15002 set malloc_good_size d_malloc_good_size
15003 eval $inlibc
15004
15005 : see if mblen exists
15006 set mblen d_mblen
15007 eval $inlibc
15008
15009 : see if mbstowcs exists
15010 set mbstowcs d_mbstowcs
15011 eval $inlibc
15012
15013 : see if mbtowc exists
15014 set mbtowc d_mbtowc
15015 eval $inlibc
15016
15017 : see if memchr exists
15018 set memchr d_memchr
15019 eval $inlibc
15020
15021 : see if memcmp exists
15022 set memcmp d_memcmp
15023 eval $inlibc
15024
15025 : see if memcpy exists
15026 set memcpy d_memcpy
15027 eval $inlibc
15028
15029 : see if memmove exists
15030 set memmove d_memmove
15031 eval $inlibc
15032
15033 : see if memset exists
15034 set memset d_memset
15035 eval $inlibc
15036
15037 : see if mkdir exists
15038 set mkdir d_mkdir
15039 eval $inlibc
15040
15041 : see if mkdtemp exists
15042 set mkdtemp d_mkdtemp
15043 eval $inlibc
15044
15045 : see if mkfifo exists
15046 set mkfifo d_mkfifo
15047 eval $inlibc
15048
15049 : see if mkstemp exists
15050 set mkstemp d_mkstemp
15051 eval $inlibc
15052
15053 : see if mkstemps exists
15054 set mkstemps d_mkstemps
15055 eval $inlibc
15056
15057 : see if mktime exists
15058 set mktime d_mktime
15059 eval $inlibc
15060
15061 : see if this is a sys/mman.h system
15062 set sys/mman.h i_sysmman
15063 eval $inhdr
15064
15065 : see if mmap exists
15066 set mmap d_mmap
15067 eval $inlibc
15068 : see what shmat returns
15069 : default to something harmless
15070 mmaptype='void *'
15071 case "$i_sysmman$d_mmap" in
15072 "$define$define")
15073         $cat >mmap.c <<'END'
15074 #include <sys/mman.h>
15075 void *mmap();
15076 END
15077         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15078                 mmaptype='void *'
15079         else
15080                 mmaptype='caddr_t'
15081         fi
15082         echo "and it returns ($mmaptype)." >&4
15083         ;;
15084 esac
15085
15086
15087
15088 : see if sqrtl exists
15089 set sqrtl d_sqrtl
15090 eval $inlibc
15091
15092 : see if scalbnl exists
15093 set scalbnl d_scalbnl
15094 eval $inlibc
15095
15096 : see if modfl exists
15097 set modfl d_modfl
15098 eval $inlibc
15099
15100 : see if prototype for modfl is available
15101 echo " "
15102 set d_modflproto modfl $i_math math.h
15103 eval $hasproto
15104
15105 d_modfl_pow32_bug="$undef"
15106
15107 case "$d_longdbl$d_modfl" in
15108 $define$define)
15109         $cat <<EOM
15110 Checking to see whether your modfl() is okay for large values...
15111 EOM
15112 $cat >try.c <<EOCP
15113 #include <math.h>
15114 #include <stdio.h>
15115 EOCP
15116 if $test "X$d_modflproto" != "X$define"; then
15117         $cat >>try.c <<EOCP
15118 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15119 long double modfl (long double, long double *);
15120 EOCP
15121 fi
15122 $cat >>try.c <<EOCP
15123 int main() {
15124     long double nv = 4294967303.15;
15125     long double v, w;
15126     v = modfl(nv, &w);
15127 #ifdef __GLIBC__
15128     printf("glibc");
15129 #endif
15130     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15131     return 0;
15132 }
15133 EOCP
15134         case "$osname:$gccversion" in
15135         aix:)   saveccflags="$ccflags"
15136                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15137         esac
15138         set try
15139         if eval $compile; then
15140                 foo=`$run ./try`
15141                 case "$foo" in
15142                 *" 4294967303.150000 1.150000 4294967302.000000")
15143                         echo >&4 "Your modfl() is broken for large values."
15144                         d_modfl_pow32_bug="$define"
15145                         case "$foo" in
15146                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15147                         ;;
15148                         esac
15149                         ;;
15150                 *" 4294967303.150000 0.150000 4294967303.000000")
15151                         echo >&4 "Your modfl() seems okay for large values."
15152                         ;;
15153                 *)      echo >&4 "I don't understand your modfl() at all."
15154                         d_modfl="$undef"
15155                         ;;
15156                 esac
15157                 $rm_try
15158         else
15159                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15160                 d_modfl="$undef"
15161         fi
15162         case "$osname:$gccversion" in
15163         aix:)   ccflags="$saveccflags" ;; # restore
15164         esac
15165         ;;
15166 esac
15167
15168 if $test "$uselongdouble" = "$define"; then
15169     message=""
15170     if $test "$d_sqrtl" != "$define"; then
15171         message="$message sqrtl"
15172     fi
15173     if $test "$d_modfl" != "$define"; then
15174         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15175             echo "You have both aintl and copysignl, so I can emulate modfl."
15176         else
15177             message="$message modfl"
15178         fi
15179     fi
15180     if $test "$d_frexpl" != "$define"; then
15181         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15182             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15183         else
15184             message="$message frexpl"
15185         fi
15186     fi
15187
15188     if $test "$message" != ""; then
15189         $cat <<EOM >&4
15190
15191 *** You requested the use of long doubles but you do not seem to have
15192 *** the following mathematical functions needed for long double support:
15193 ***    $message
15194 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15195 *** Cannot continue, aborting.
15196
15197 EOM
15198
15199         exit 1
15200     fi
15201 fi
15202
15203 : see if mprotect exists
15204 set mprotect d_mprotect
15205 eval $inlibc
15206
15207 : see if msgctl exists
15208 set msgctl d_msgctl
15209 eval $inlibc
15210
15211 : see if msgget exists
15212 set msgget d_msgget
15213 eval $inlibc
15214
15215 : see if msgsnd exists
15216 set msgsnd d_msgsnd
15217 eval $inlibc
15218
15219 : see if msgrcv exists
15220 set msgrcv d_msgrcv
15221 eval $inlibc
15222
15223 : see how much of the 'msg*(2)' library is present.
15224 h_msg=true
15225 echo " "
15226 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15227 *"$undef"*) h_msg=false;;
15228 esac
15229 case "$osname" in
15230 freebsd)
15231     case "`ipcs 2>&1`" in
15232     "SVID messages"*"not configured"*)
15233         echo "Your $osname does not have the msg*(2) configured." >&4
15234         h_msg=false
15235         val="$undef"
15236         set msgctl d_msgctl
15237         eval $setvar
15238         set msgget d_msgget
15239         eval $setvar
15240         set msgsnd d_msgsnd
15241         eval $setvar
15242         set msgrcv d_msgrcv
15243         eval $setvar
15244         ;;
15245     esac
15246     ;;
15247 esac
15248 : we could also check for sys/ipc.h ...
15249 if $h_msg && $test `./findhdr sys/msg.h`; then
15250         echo "You have the full msg*(2) library." >&4
15251         val="$define"
15252 else
15253         echo "You don't have the full msg*(2) library." >&4
15254         val="$undef"
15255 fi
15256 set d_msg
15257 eval $setvar
15258
15259 : Check for msghdr_s
15260 echo " "
15261 echo "Checking to see if your system supports struct msghdr..." >&4
15262 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15263 eval $hasstruct
15264 case "$d_msghdr_s" in
15265 "$define")      echo "Yes, it does."   ;;
15266 *)              echo "No, it doesn't." ;;
15267 esac
15268
15269
15270 : see if msync exists
15271 set msync d_msync
15272 eval $inlibc
15273
15274 : see if munmap exists
15275 set munmap d_munmap
15276 eval $inlibc
15277
15278 : see if nice exists
15279 set nice d_nice
15280 eval $inlibc
15281
15282 : see if this is a langinfo.h system
15283 set langinfo.h i_langinfo
15284 eval $inhdr
15285
15286 : see if nl_langinfo exists
15287 set nl_langinfo d_nl_langinfo
15288 eval $inlibc
15289
15290 : check for volatile keyword
15291 echo " "
15292 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15293 $cat >try.c <<'EOCP'
15294 int main()
15295 {
15296         typedef struct _goo_struct goo_struct;
15297         goo_struct * volatile goo = ((goo_struct *)0);
15298         struct _goo_struct {
15299                 long long_int;
15300                 int reg_int;
15301                 char char_var;
15302         };
15303         typedef unsigned short foo_t;
15304         char *volatile foo;
15305         volatile int bar;
15306         volatile foo_t blech;
15307         foo = foo;
15308 }
15309 EOCP
15310 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15311         val="$define"
15312         echo "Yup, it does."
15313 else
15314         val="$undef"
15315         echo "Nope, it doesn't."
15316 fi
15317 set d_volatile
15318 eval $setvar
15319 $rm_try
15320
15321 : Check basic sizes
15322 echo " "
15323 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15324
15325 case "$use64bitint:$d_quad:$quadtype" in
15326 define:define:?*)
15327         ivtype="$quadtype"
15328         uvtype="$uquadtype"
15329         ivsize=8
15330         uvsize=8
15331         ;;
15332 *)      ivtype="long"
15333         uvtype="unsigned long"
15334         ivsize=$longsize
15335         uvsize=$longsize
15336         ;;
15337 esac
15338
15339 case "$uselongdouble:$d_longdbl" in
15340 define:define)
15341         nvtype="long double"
15342         nvsize=$longdblsize
15343         ;;
15344 *)      nvtype=double
15345         nvsize=$doublesize
15346         ;;
15347 esac
15348
15349 $echo "(IV will be "$ivtype", $ivsize bytes)"
15350 $echo "(UV will be "$uvtype", $uvsize bytes)"
15351 $echo "(NV will be "$nvtype", $nvsize bytes)"
15352
15353 $cat >try.c <<EOCP
15354 #$i_inttypes I_INTTYPES
15355 #ifdef I_INTTYPES
15356 #include <inttypes.h>
15357 #endif
15358 #include <stdio.h>
15359 int main() {
15360 #ifdef INT8
15361    int8_t i =  INT8_MAX;
15362   uint8_t u = UINT8_MAX;
15363   printf("int8_t\n");
15364 #endif
15365 #ifdef INT16
15366    int16_t i =  INT16_MAX;
15367   uint16_t i = UINT16_MAX;
15368   printf("int16_t\n");
15369 #endif
15370 #ifdef INT32
15371    int32_t i =  INT32_MAX;
15372   uint32_t u = UINT32_MAX;
15373   printf("int32_t\n");
15374 #endif
15375 }
15376 EOCP
15377
15378 i8type="signed char"
15379 u8type="unsigned char"
15380 i8size=1
15381 u8size=1
15382
15383 case "$i16type" in
15384 '')     case "$shortsize" in
15385         2)      i16type=short
15386                 u16type="unsigned short"
15387                 i16size=$shortsize
15388                 u16size=$shortsize
15389                 ;;
15390         esac
15391         ;;
15392 esac
15393 case "$i16type" in
15394 '')     set try -DINT16
15395         if eval $compile; then
15396                 case "`$run ./try`" in
15397                 int16_t)
15398                         i16type=int16_t
15399                         u16type=uint16_t
15400                         i16size=2
15401                         u16size=2
15402                         ;;
15403                 esac
15404         fi
15405         ;;
15406 esac
15407 case "$i16type" in
15408 '')     if $test $shortsize -ge 2; then
15409                 i16type=short
15410                 u16type="unsigned short"
15411                 i16size=$shortsize
15412                 u16size=$shortsize
15413         fi
15414         ;;
15415 esac
15416
15417 case "$i32type" in
15418 '')     case "$longsize" in
15419         4)      i32type=long
15420                 u32type="unsigned long"
15421                 i32size=$longsize
15422                 u32size=$longsize
15423                 ;;
15424         *)      case "$intsize" in
15425                 4)      i32type=int
15426                         u32type="unsigned int"
15427                         i32size=$intsize
15428                         u32size=$intsize
15429                         ;;
15430                 esac
15431                 ;;
15432         esac
15433         ;;
15434 esac
15435 case "$i32type" in
15436 '')     set try -DINT32
15437         if eval $compile; then
15438                 case "`$run ./try`" in
15439                 int32_t)
15440                         i32type=int32_t
15441                         u32type=uint32_t
15442                         i32size=4
15443                         u32size=4
15444                         ;;
15445                 esac
15446         fi
15447         ;;
15448 esac
15449 case "$i32type" in
15450 '')     if $test $intsize -ge 4; then
15451                 i32type=int
15452                 u32type="unsigned int"
15453                 i32size=$intsize
15454                 u32size=$intsize
15455         fi
15456         ;;
15457 esac
15458
15459 case "$i64type" in
15460 '')     case "$d_quad:$quadtype" in
15461         define:?*)
15462                 i64type="$quadtype"
15463                 u64type="$uquadtype"
15464                 i64size=8
15465                 u64size=8
15466                 ;;
15467         esac
15468         ;;
15469 esac
15470
15471 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15472 : volatile so that the compiler has to store it out to memory.
15473 if test X"$d_volatile" = X"$define"; then
15474         volatile=volatile
15475 fi
15476 $cat <<EOP >try.c
15477 #include <stdio.h>
15478 #$i_stdlib I_STDLIB
15479 #ifdef I_STDLIB
15480 #include <stdlib.h>
15481 #endif
15482 #include <sys/types.h>
15483 #include <signal.h>
15484 #ifdef SIGFPE
15485 $volatile int bletched = 0;
15486 $signal_t blech(int s) { bletched = 1; }
15487 #endif
15488 int main() {
15489     $uvtype u = 0;
15490     $nvtype d;
15491     int     n = 8 * $uvsize;
15492     int     i;
15493 #ifdef SIGFPE
15494     signal(SIGFPE, blech);
15495 #endif
15496
15497     for (i = 0; i < n; i++) {
15498       u = u << 1 | ($uvtype)1;
15499       d = ($nvtype)u;
15500       if (($uvtype)d != u)
15501         break;
15502       if (d <= 0)
15503         break;
15504       d = ($nvtype)(u - 1);
15505       if (($uvtype)d != (u - 1))
15506         break;
15507 #ifdef SIGFPE
15508       if (bletched)
15509         break;
15510 #endif
15511     }
15512     printf("%d\n", ((i == n) ? -n : i));
15513     exit(0);
15514 }
15515 EOP
15516 set try
15517
15518 d_nv_preserves_uv="$undef"
15519 if eval $compile; then
15520         nv_preserves_uv_bits="`$run ./try`"
15521 fi
15522 case "$nv_preserves_uv_bits" in
15523 \-[1-9]*)
15524         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15525         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15526         d_nv_preserves_uv="$define"
15527         ;;
15528 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15529         d_nv_preserves_uv="$undef" ;;
15530 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15531         nv_preserves_uv_bits="0" ;;
15532 esac
15533 $rm_try
15534
15535 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15536 : volatile so that the compiler has to store it out to memory.
15537 if test X"$d_volatile" = X"$define"; then
15538         volatile=volatile
15539 fi
15540 $cat <<EOP >try.c
15541 #include <stdio.h>
15542
15543 typedef $nvtype NV;
15544
15545 int
15546 main() {
15547   NV value = 2;
15548   int count = 1;
15549
15550   while(count < 256) {
15551     $volatile NV up = value + 1.0;
15552     $volatile NV negated = -value;
15553     $volatile NV down = negated - 1.0;
15554     $volatile NV got_up = up - value;
15555     int up_good = got_up == 1.0;
15556     int got_down = down - negated;
15557     int down_good = got_down == -1.0;
15558
15559     if (down_good != up_good) {
15560       fprintf(stderr,
15561               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15562               up_good, (double) got_up, down_good, (double) got_down,
15563               count, (double) value);
15564       return 1;
15565     }
15566     if (!up_good) {
15567       while (1) {
15568         if (count > 8) {
15569           count -= 8;
15570           fputs("256.0", stdout);
15571         } else {
15572           count--;
15573           fputs("2.0", stdout);
15574         }
15575         if (!count) {
15576           puts("");
15577           return 0;
15578         }
15579         fputs("*", stdout);
15580       }
15581     }
15582     value *= 2;
15583     ++count;
15584   }
15585   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15586           count, (double) value);
15587   return 1;
15588 }
15589 EOP
15590 set try
15591
15592 nv_overflows_integers_at='0'
15593 if eval $compile; then
15594     xxx="`$run ./try`"
15595     case "$?" in
15596         0)
15597             case "$xxx" in
15598                 2*)  cat >&4 <<EOM
15599 The largest integer your NVs can preserve is equal to $xxx
15600 EOM
15601                     nv_overflows_integers_at="$xxx"
15602                     ;;
15603                 *)  cat >&4 <<EOM
15604 Cannot determine the largest integer value your NVs can hold, unexpected output
15605 '$xxx'
15606 EOM
15607                     ;;
15608             esac
15609             ;;
15610         *)  cat >&4 <<EOM
15611 Cannot determine the largest integer value your NVs can hold
15612 EOM
15613             ;;
15614     esac
15615 fi
15616 $rm_try
15617
15618 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15619 : volatile so that the compiler has to store it out to memory.
15620 if test X"$d_volatile" = X"$define"; then
15621         volatile=volatile
15622 fi
15623 $cat <<EOP >try.c
15624 #include <stdio.h>
15625 #$i_stdlib I_STDLIB
15626 #ifdef I_STDLIB
15627 #include <stdlib.h>
15628 #endif
15629 #$i_string I_STRING
15630 #ifdef I_STRING
15631 #  include <string.h>
15632 #else
15633 #  include <strings.h>
15634 #endif
15635 #include <sys/types.h>
15636 #include <signal.h>
15637 #ifdef SIGFPE
15638 $volatile int bletched = 0;
15639 $signal_t blech(int s) { bletched = 1; }
15640 #endif
15641
15642 int checkit($nvtype d, char *where) {
15643     unsigned char *p = (char *)&d;
15644     unsigned char *end = p + sizeof(d);
15645     int fail = 0;
15646
15647     while (p < end)
15648         fail += *p++;
15649
15650     if (!fail)
15651         return 0;
15652
15653     p = (char *)&d;
15654     printf("No - %s: 0x", where);
15655     while (p < end)
15656         printf ("%02X", *p++);
15657     printf("\n");
15658     return 1;
15659 }
15660
15661 int main(int argc, char **argv) {
15662     $nvtype d = 0.0;
15663     int fail = 0;
15664     fail += checkit(d, "0.0");
15665
15666     /* The compiler shouldn't be assuming that bletched is 0  */
15667     d = bletched;
15668
15669     fail += checkit(d, "bleched");
15670
15671 #ifdef SIGFPE
15672     signal(SIGFPE, blech);
15673 #endif
15674
15675     /* Paranoia - the compiler should have no way of knowing that ANSI says
15676        that argv[argc] will always be NULL.  Actually, if it did assume this it
15677        would be buggy, as this is C and main() can be called from elsewhere in
15678        the program.  */
15679     d = argv[argc] ? 1 : 0;
15680
15681     if (d) {
15682         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15683     }
15684
15685     fail += checkit(d, "ternary");
15686
15687     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15688
15689     if (d != 0.0) {
15690         printf("No - memset doesn't give 0.0\n");
15691         /* This might just blow up:  */
15692         printf("(gives %g)\n", d);
15693         return 1;
15694     }
15695
15696 #ifdef SIGFPE
15697     if (bletched) {
15698         printf("No - something bleched\n");
15699         return 1;
15700     }
15701 #endif
15702     if (fail) {
15703       printf("No - %d fail(s)\n", fail);
15704       return 1;
15705     }
15706     printf("Yes\n");
15707     return 0;
15708 }
15709 EOP
15710 set try
15711
15712 d_nv_zero_is_allbits_zero="$undef"
15713 if eval $compile; then
15714     xxx="`$run ./try`"
15715     case "$?" in
15716         0)
15717             case "$xxx" in
15718                 Yes)  cat >&4 <<EOM
15719 0.0 is represented as all bits zero in memory
15720 EOM
15721                     d_nv_zero_is_allbits_zero="$define"
15722                     ;;
15723                 *)  cat >&4 <<EOM
15724 0.0 is not represented as all bits zero in memory
15725 EOM
15726                     d_nv_zero_is_allbits_zero="$undef"
15727                     ;;
15728             esac
15729             ;;
15730         *)  cat >&4 <<EOM
15731 0.0 is not represented as all bits zero in memory
15732 EOM
15733             d_nv_zero_is_allbits_zero="$undef"
15734             ;;
15735     esac
15736 fi
15737 $rm_try
15738
15739 : check for off64_t
15740 echo " "
15741 echo "Checking to see if you have off64_t..." >&4
15742 $cat >try.c <<EOCP
15743 #include <sys/types.h>
15744 #include <unistd.h>
15745 int main() { off64_t x = 7; }
15746 EOCP
15747 set try
15748 if eval $compile; then
15749         val="$define"
15750         echo "You have off64_t."
15751 else
15752         val="$undef"
15753         echo "You do not have off64_t."
15754         case "$lseeksize" in
15755         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15756         esac
15757 fi
15758 $rm_try
15759 set d_off64_t
15760 eval $setvar
15761
15762 : how to create joinable pthreads
15763 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15764         echo " "
15765         echo "Checking what constant to use for creating joinable pthreads..." >&4
15766         $cat >try.c <<'EOCP'
15767 #include <pthread.h>
15768 int main() {
15769     int detachstate = JOINABLE;
15770 }
15771 EOCP
15772         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15773         if eval $compile; then
15774                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15775                 val="$undef" # Yes, undef.
15776                 set d_old_pthread_create_joinable
15777                 eval $setvar
15778                 val=""
15779                 set old_pthread_create_joinable
15780                 eval $setvar
15781         else
15782                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15783                 if eval $compile; then
15784                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15785                         val="$define"
15786                         set d_old_pthread_create_joinable
15787                         eval $setvar
15788                         val=PTHREAD_CREATE_UNDETACHED
15789                         set old_pthread_create_joinable
15790                         eval $setvar
15791                 else
15792                         set try -DJOINABLE=__UNDETACHED
15793                         if eval $compile; then
15794                                 echo "You seem to use __UNDETACHED." >&4
15795                                 val="$define"
15796                                 set d_old_pthread_create_joinable
15797                                 eval $setvar
15798                                 val=__UNDETACHED
15799                                 set old_pthread_create_joinable
15800                                 eval $setvar
15801                         else
15802                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15803                                 val="$define"
15804                                 set d_old_pthread_create_joinable
15805                                 eval $setvar
15806                                 val=0
15807                                 set old_pthread_create_joinable
15808                                 eval $setvar
15809                         fi
15810                 fi
15811         fi
15812         $rm_try
15813 else
15814     d_old_pthread_create_joinable="$undef"
15815     old_pthread_create_joinable=""
15816 fi
15817
15818 : see if pause exists
15819 set pause d_pause
15820 eval $inlibc
15821
15822 : see if poll exists
15823 set poll d_poll
15824 eval $inlibc
15825
15826 : see if readlink exists
15827 set readlink d_readlink
15828 eval $inlibc
15829
15830 : Check if exe is symlink to abs path of executing program
15831 echo " "
15832 procselfexe=''
15833 val="$undef"
15834 case "$d_readlink" in
15835 "$define")
15836         if $issymlink /proc/self/exe ; then
15837                 $ls -l /proc/self/exe > reflect
15838                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15839                         echo "You have Linux-like /proc/self/exe."
15840                         procselfexe='"/proc/self/exe"'
15841                         val="$define"
15842                 fi
15843         fi
15844         if $issymlink /proc/curproc/file ; then
15845                 $ls -l /proc/curproc/file > reflect
15846                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15847                         echo "You have BSD-like /proc/curproc/file."
15848                         procselfexe='"/proc/curproc/file"'
15849                         val="$define"
15850                 fi
15851         fi
15852         ;;
15853 esac
15854 $rm -f reflect
15855 set d_procselfexe
15856 eval $setvar
15857
15858 : backward compatibility for d_hvfork
15859 if test X$d_hvfork != X; then
15860         d_vfork="$d_hvfork"
15861         d_hvfork=''
15862 fi
15863 : see if there is a vfork
15864 val=''
15865 set vfork val
15866 eval $inlibc
15867
15868 d_pseudofork=$undef
15869
15870 : Ok, but do we want to use it. vfork is reportedly unreliable in
15871 : perl on Solaris 2.x, and probably elsewhere.
15872 case "$val" in
15873 $define)
15874         echo " "
15875         case "$usevfork" in
15876         false) dflt='n';;
15877         *) dflt='y';;
15878         esac
15879         cat <<'EOM'
15880
15881 Perl can only use a vfork() that doesn't suffer from strict
15882 restrictions on calling functions or modifying global data in
15883 the child.  For example, glibc-2.1 contains such a vfork()
15884 that is unsuitable.  If your system provides a proper fork()
15885 call, chances are that you do NOT want perl to use vfork().
15886
15887 EOM
15888         rp="Do you still want to use vfork()?"
15889         . ./myread
15890         case "$ans" in
15891         y|Y) ;;
15892         *)
15893                 echo "Ok, we won't use vfork()."
15894                 val="$undef"
15895                 ;;
15896         esac
15897         ;;
15898 esac
15899 set d_vfork
15900 eval $setvar
15901 case "$d_vfork" in
15902 $define) usevfork='true';;
15903 *) usevfork='false';;
15904 esac
15905
15906 : see whether the pthread_atfork exists
15907 $cat >try.c <<EOP
15908 #include <pthread.h>
15909 #include <stdio.h>
15910 int main() {
15911 #ifdef  PTHREAD_ATFORK
15912         pthread_atfork(NULL,NULL,NULL);
15913 #endif
15914 }
15915 EOP
15916
15917 : see if pthread_atfork exists
15918 set try -DPTHREAD_ATFORK
15919 if eval $compile; then
15920     val="$define"
15921 else
15922     val="$undef"
15923 fi
15924 case "$usethreads" in
15925 $define)
15926         case "$val" in
15927         $define) echo 'pthread_atfork found.' >&4        ;;
15928         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15929         esac
15930 esac
15931 set d_pthread_atfork
15932 eval $setvar
15933
15934 : see if pthread_attr_setscope exists
15935 set pthread_attr_setscope d_pthread_attr_setscope
15936 eval $inlibc
15937
15938 : see whether the various POSIXish _yields exist
15939 $cat >try.c <<EOP
15940 #include <pthread.h>
15941 #include <stdio.h>
15942 int main() {
15943 #ifdef SCHED_YIELD
15944         sched_yield();
15945 #else
15946 #ifdef PTHREAD_YIELD
15947         pthread_yield();
15948 #else
15949 #ifdef PTHREAD_YIELD_NULL
15950         pthread_yield(NULL);
15951 #endif
15952 #endif
15953 #endif
15954 }
15955 EOP
15956 : see if sched_yield exists
15957 set try -DSCHED_YIELD
15958 if eval $compile; then
15959     val="$define"
15960     sched_yield='sched_yield()'
15961 else
15962     val="$undef"
15963 fi
15964 case "$usethreads" in
15965 $define)
15966         case "$val" in
15967         $define) echo 'sched_yield() found.' >&4        ;;
15968         *)       echo 'sched_yield() NOT found.' >&4    ;;
15969         esac
15970 esac
15971 set d_sched_yield
15972 eval $setvar
15973
15974 : see if pthread_yield exists
15975 set try -DPTHREAD_YIELD
15976 if eval $compile; then
15977     val="$define"
15978     case "$sched_yield" in
15979     '') sched_yield='pthread_yield()' ;;
15980     esac
15981 else
15982     set try -DPTHREAD_YIELD_NULL
15983     if eval $compile; then
15984         val="$define"
15985         case "$sched_yield" in
15986         '') sched_yield='pthread_yield(NULL)' ;;
15987         esac
15988     else
15989         val="$undef"
15990     fi
15991 fi
15992 case "$usethreads" in
15993 $define)
15994         case "$val" in
15995         $define) echo 'pthread_yield() found.' >&4      ;;
15996         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15997         esac
15998         ;;
15999 esac
16000 set d_pthread_yield
16001 eval $setvar
16002 case "$sched_yield" in
16003 '') sched_yield=undef ;;
16004 esac
16005 $rm_try
16006
16007 : see if random_r exists
16008 set random_r d_random_r
16009 eval $inlibc
16010 case "$d_random_r" in
16011 "$define")
16012         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16013         case "$d_random_r_proto:$usethreads" in
16014         ":define")      d_random_r_proto=define
16015                 set d_random_r_proto random_r $hdrs
16016                 eval $hasproto ;;
16017         *)      ;;
16018         esac
16019         case "$d_random_r_proto" in
16020         define)
16021         case "$random_r_proto" in
16022         ''|0) try='int random_r(int*, struct random_data*);'
16023         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
16024         esac
16025         case "$random_r_proto" in
16026         ''|0) try='int random_r(long*, struct random_data*);'
16027         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
16028         esac
16029         case "$random_r_proto" in
16030         ''|0) try='int random_r(struct random_data*, int32_t*);'
16031         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
16032         esac
16033         case "$random_r_proto" in
16034         ''|0)   d_random_r=undef
16035                 random_r_proto=0
16036                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16037         * )     case "$random_r_proto" in
16038                 REENTRANT_PROTO*) ;;
16039                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16040                 esac
16041                 echo "Prototype: $try" ;;
16042         esac
16043         ;;
16044         *)      case "$usethreads" in
16045                 define) echo "random_r has no prototype, not using it." >&4 ;;
16046                 esac
16047                 d_random_r=undef
16048                 random_r_proto=0
16049                 ;;
16050         esac
16051         ;;
16052 *)      random_r_proto=0
16053         ;;
16054 esac
16055
16056 : see if readdir and friends exist
16057 set readdir d_readdir
16058 eval $inlibc
16059 set seekdir d_seekdir
16060 eval $inlibc
16061 set telldir d_telldir
16062 eval $inlibc
16063 set rewinddir d_rewinddir
16064 eval $inlibc
16065
16066 : see if readdir64_r exists
16067 set readdir64_r d_readdir64_r
16068 eval $inlibc
16069 case "$d_readdir64_r" in
16070 "$define")
16071         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16072         case "$d_readdir64_r_proto:$usethreads" in
16073         ":define")      d_readdir64_r_proto=define
16074                 set d_readdir64_r_proto readdir64_r $hdrs
16075                 eval $hasproto ;;
16076         *)      ;;
16077         esac
16078         case "$d_readdir64_r_proto" in
16079         define)
16080         case "$readdir64_r_proto" in
16081         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16082         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
16083         esac
16084         case "$readdir64_r_proto" in
16085         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16086         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
16087         esac
16088         case "$readdir64_r_proto" in
16089         ''|0)   d_readdir64_r=undef
16090                 readdir64_r_proto=0
16091                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16092         * )     case "$readdir64_r_proto" in
16093                 REENTRANT_PROTO*) ;;
16094                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16095                 esac
16096                 echo "Prototype: $try" ;;
16097         esac
16098         ;;
16099         *)      case "$usethreads" in
16100                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16101                 esac
16102                 d_readdir64_r=undef
16103                 readdir64_r_proto=0
16104                 ;;
16105         esac
16106         ;;
16107 *)      readdir64_r_proto=0
16108         ;;
16109 esac
16110
16111 : see if readdir_r exists
16112 set readdir_r d_readdir_r
16113 eval $inlibc
16114 case "$d_readdir_r" in
16115 "$define")
16116         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16117         case "$d_readdir_r_proto:$usethreads" in
16118         ":define")      d_readdir_r_proto=define
16119                 set d_readdir_r_proto readdir_r $hdrs
16120                 eval $hasproto ;;
16121         *)      ;;
16122         esac
16123         case "$d_readdir_r_proto" in
16124         define)
16125         case "$readdir_r_proto" in
16126         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16127         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
16128         esac
16129         case "$readdir_r_proto" in
16130         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16131         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
16132         esac
16133         case "$readdir_r_proto" in
16134         ''|0)   d_readdir_r=undef
16135                 readdir_r_proto=0
16136                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16137         * )     case "$readdir_r_proto" in
16138                 REENTRANT_PROTO*) ;;
16139                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16140                 esac
16141                 echo "Prototype: $try" ;;
16142         esac
16143         ;;
16144         *)      case "$usethreads" in
16145                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16146                 esac
16147                 d_readdir_r=undef
16148                 readdir_r_proto=0
16149                 ;;
16150         esac
16151         ;;
16152 *)      readdir_r_proto=0
16153         ;;
16154 esac
16155
16156 : see if readv exists
16157 set readv d_readv
16158 eval $inlibc
16159
16160 : see if recvmsg exists
16161 set recvmsg d_recvmsg
16162 eval $inlibc
16163
16164 : see if rename exists
16165 set rename d_rename
16166 eval $inlibc
16167
16168 : see if rmdir exists
16169 set rmdir d_rmdir
16170 eval $inlibc
16171
16172 : see if memory.h is available.
16173 val=''
16174 set memory.h val
16175 eval $inhdr
16176
16177 : See if it conflicts with string.h
16178 case "$val" in
16179 $define)
16180         case "$strings" in
16181         '') ;;
16182         *)
16183                 $cppstdin $cppflags $cppminus < $strings > mem.h
16184                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16185                         echo " "
16186                         echo "We won't be including <memory.h>."
16187                         val="$undef"
16188                 fi
16189                 $rm -f mem.h
16190                 ;;
16191         esac
16192 esac
16193 set i_memory
16194 eval $setvar
16195
16196 : can bcopy handle overlapping blocks?
16197 echo " "
16198 val="$undef"
16199 case "$d_memmove" in
16200 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16201 *)      case "$d_bcopy" in
16202         "$define")
16203                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16204                 $cat >try.c <<EOCP
16205 #$i_memory I_MEMORY
16206 #$i_stdlib I_STDLIB
16207 #$i_string I_STRING
16208 #$i_unistd I_UNISTD
16209 EOCP
16210         $cat >>try.c <<'EOCP'
16211 #include <stdio.h>
16212 #ifdef I_MEMORY
16213 #  include <memory.h>
16214 #endif
16215 #ifdef I_STDLIB
16216 #  include <stdlib.h>
16217 #endif
16218 #ifdef I_STRING
16219 #  include <string.h>
16220 #else
16221 #  include <strings.h>
16222 #endif
16223 #ifdef I_UNISTD
16224 #  include <unistd.h>  /* Needed for NetBSD */
16225 #endif
16226 int main()
16227 {
16228 char buf[128], abc[128];
16229 char *b;
16230 int len;
16231 int off;
16232 int align;
16233
16234 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16235    try to store the string in read-only memory. */
16236 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16237
16238 for (align = 7; align >= 0; align--) {
16239         for (len = 36; len; len--) {
16240                 b = buf+align;
16241                 bcopy(abc, b, len);
16242                 for (off = 1; off <= len; off++) {
16243                         bcopy(b, b+off, len);
16244                         bcopy(b+off, b, len);
16245                         if (bcmp(b, abc, len))
16246                                 exit(1);
16247                 }
16248         }
16249 }
16250 exit(0);
16251 }
16252 EOCP
16253                 set try
16254                 if eval $compile_ok; then
16255                         if $run ./try 2>/dev/null; then
16256                                 echo "Yes, it can."
16257                                 val="$define"
16258                         else
16259                                 echo "It can't, sorry."
16260                         fi
16261                 else
16262                         echo "(I can't compile the test program, so we'll assume not...)"
16263                 fi
16264                 ;;
16265         esac
16266         $rm_try
16267         ;;
16268 esac
16269 set d_safebcpy
16270 eval $setvar
16271
16272 : can memcpy handle overlapping blocks?
16273 echo " "
16274 val="$undef"
16275 case "$d_memmove" in
16276 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16277 *)      case "$d_memcpy" in
16278         "$define")
16279                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16280                 $cat >try.c <<EOCP
16281 #$i_memory I_MEMORY
16282 #$i_stdlib I_STDLIB
16283 #$i_string I_STRING
16284 #$i_unistd I_UNISTD
16285 EOCP
16286         $cat >>try.c <<'EOCP'
16287 #include <stdio.h>
16288 #ifdef I_MEMORY
16289 #  include <memory.h>
16290 #endif
16291 #ifdef I_STDLIB
16292 #  include <stdlib.h>
16293 #endif
16294 #ifdef I_STRING
16295 #  include <string.h>
16296 #else
16297 #  include <strings.h>
16298 #endif
16299 #ifdef I_UNISTD
16300 #  include <unistd.h>  /* Needed for NetBSD */
16301 #endif
16302 int main()
16303 {
16304 char buf[128], abc[128];
16305 char *b;
16306 int len;
16307 int off;
16308 int align;
16309
16310 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16311    try to store the string in read-only memory. */
16312 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16313
16314 for (align = 7; align >= 0; align--) {
16315         for (len = 36; len; len--) {
16316                 b = buf+align;
16317                 memcpy(b, abc, len);
16318                 for (off = 1; off <= len; off++) {
16319                         memcpy(b+off, b, len);
16320                         memcpy(b, b+off, len);
16321                         if (memcmp(b, abc, len))
16322                                 exit(1);
16323                 }
16324         }
16325 }
16326 exit(0);
16327 }
16328 EOCP
16329                 set try
16330                 if eval $compile_ok; then
16331                         if $run ./try 2>/dev/null; then
16332                                 echo "Yes, it can."
16333                                 val="$define"
16334                         else
16335                                 echo "It can't, sorry."
16336                         fi
16337                 else
16338                         echo "(I can't compile the test program, so we'll assume not...)"
16339                 fi
16340                 ;;
16341         esac
16342         $rm_try
16343         ;;
16344 esac
16345 set d_safemcpy
16346 eval $setvar
16347
16348 : can memcmp be trusted to compare relative magnitude?
16349 val="$undef"
16350 case "$d_memcmp" in
16351 "$define")
16352         echo " "
16353         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16354         $cat >try.c <<EOCP
16355 #$i_memory I_MEMORY
16356 #$i_stdlib I_STDLIB
16357 #$i_string I_STRING
16358 #$i_unistd I_UNISTD
16359 EOCP
16360         $cat >>try.c <<'EOCP'
16361 #include <stdio.h>
16362 #ifdef I_MEMORY
16363 #  include <memory.h>
16364 #endif
16365 #ifdef I_STDLIB
16366 #  include <stdlib.h>
16367 #endif
16368 #ifdef I_STRING
16369 #  include <string.h>
16370 #else
16371 #  include <strings.h>
16372 #endif
16373 #ifdef I_UNISTD
16374 #  include <unistd.h>  /* Needed for NetBSD */
16375 #endif
16376 int main()
16377 {
16378 char a = -1;
16379 char b = 0;
16380 if ((a < b) && memcmp(&a, &b, 1) < 0)
16381         exit(1);
16382 exit(0);
16383 }
16384 EOCP
16385         set try
16386         if eval $compile_ok; then
16387                 if $run ./try 2>/dev/null; then
16388                         echo "Yes, it can."
16389                         val="$define"
16390                 else
16391                         echo "No, it can't (it uses signed chars)."
16392                 fi
16393         else
16394                 echo "(I can't compile the test program, so we'll assume not...)"
16395         fi
16396         ;;
16397 esac
16398 $rm_try
16399 set d_sanemcmp
16400 eval $setvar
16401
16402 : see if prototype for sbrk is available
16403 echo " "
16404 set d_sbrkproto sbrk $i_unistd unistd.h
16405 eval $hasproto
16406
16407 : see if select exists
16408 set select d_select
16409 eval $inlibc
16410
16411 : see if semctl exists
16412 set semctl d_semctl
16413 eval $inlibc
16414
16415 : see if semget exists
16416 set semget d_semget
16417 eval $inlibc
16418
16419 : see if semop exists
16420 set semop d_semop
16421 eval $inlibc
16422
16423 : see how much of the 'sem*(2)' library is present.
16424 h_sem=true
16425 echo " "
16426 case "$d_semctl$d_semget$d_semop" in
16427 *"$undef"*) h_sem=false;;
16428 esac
16429 case "$osname" in
16430 freebsd)
16431     case "`ipcs 2>&1`" in
16432     "SVID messages"*"not configured"*)
16433         echo "Your $osname does not have the sem*(2) configured." >&4
16434         h_sem=false
16435         val="$undef"
16436         set semctl d_semctl
16437         eval $setvar
16438         set semget d_semget
16439         eval $setvar
16440         set semop d_semop
16441         eval $setvar
16442         ;;
16443     esac
16444     ;;
16445 esac
16446 : we could also check for sys/ipc.h ...
16447 if $h_sem && $test `./findhdr sys/sem.h`; then
16448         echo "You have the full sem*(2) library." >&4
16449         val="$define"
16450 else
16451         echo "You don't have the full sem*(2) library." >&4
16452         val="$undef"
16453 fi
16454 set d_sem
16455 eval $setvar
16456
16457 : see whether sys/sem.h defines union semun
16458 echo " "
16459 $cat > try.c <<'END'
16460 #include <sys/types.h>
16461 #include <sys/ipc.h>
16462 #include <sys/sem.h>
16463 int main () { union semun semun; semun.buf = 0; }
16464 END
16465 set try
16466 if eval $compile; then
16467     echo "You have union semun in <sys/sem.h>." >&4
16468     val="$define"
16469 else
16470     echo "You do not have union semun in <sys/sem.h>." >&4
16471     val="$undef"
16472 fi
16473 $rm_try
16474 set d_union_semun
16475 eval $setvar
16476
16477 : see how to do semctl IPC_STAT
16478 case "$d_sem" in
16479 $define)
16480     echo " "
16481     $cat > tryh.h <<END
16482 #ifndef S_IRUSR
16483 #   ifdef S_IREAD
16484 #       define S_IRUSR S_IREAD
16485 #       define S_IWUSR S_IWRITE
16486 #       define S_IXUSR S_IEXEC
16487 #   else
16488 #       define S_IRUSR 0400
16489 #       define S_IWUSR 0200
16490 #       define S_IXUSR 0100
16491 #   endif
16492 #   define S_IRGRP (S_IRUSR>>3)
16493 #   define S_IWGRP (S_IWUSR>>3)
16494 #   define S_IXGRP (S_IXUSR>>3)
16495 #   define S_IROTH (S_IRUSR>>6)
16496 #   define S_IWOTH (S_IWUSR>>6)
16497 #   define S_IXOTH (S_IXUSR>>6)
16498 #endif
16499 #ifndef S_IRWXU
16500 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16501 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16502 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16503 #endif
16504 END
16505     : see whether semctl IPC_STAT can use union semun
16506     case "$d_semctl_semun" in
16507     '')
16508       val="$undef"
16509       $cat > try.c <<END
16510 #include <sys/types.h>
16511 #include <sys/ipc.h>
16512 #include <sys/sem.h>
16513 #include <sys/stat.h>
16514 #include <stdio.h>
16515 #include <errno.h>
16516 #include "tryh.h"
16517 #ifndef errno
16518 extern int errno;
16519 #endif
16520 #$d_union_semun HAS_UNION_SEMUN
16521 int main() {
16522     union semun
16523 #ifndef HAS_UNION_SEMUN
16524     {
16525         int val;
16526         struct semid_ds *buf;
16527         unsigned short *array;
16528     }
16529 #endif
16530     arg;
16531     int sem, st;
16532
16533 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16534     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16535     if (sem > -1) {
16536         struct semid_ds argbuf;
16537         arg.buf = &argbuf;
16538 #       ifdef IPC_STAT
16539         st = semctl(sem, 0, IPC_STAT, arg);
16540         if (st == 0)
16541             printf("semun\n");
16542         else
16543 #       endif /* IPC_STAT */
16544             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16545 #       ifdef IPC_RMID
16546         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16547 #       endif /* IPC_RMID */
16548             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16549     } else
16550 #endif /* IPC_PRIVATE && ... */
16551         printf("semget failed: errno = %d\n", errno);
16552   return 0;
16553 }
16554 END
16555       set try
16556       if eval $compile; then
16557           xxx=`$run ./try`
16558           case "$xxx" in
16559           semun) val="$define" ;;
16560           esac
16561       fi
16562       $rm_try
16563       set d_semctl_semun
16564       eval $setvar
16565       ;;
16566     esac
16567     case "$d_semctl_semun" in
16568     $define)
16569         echo "You can use union semun for semctl IPC_STAT." >&4
16570         also='also'
16571         ;;
16572     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16573         also=''
16574         ;;
16575     esac
16576
16577     : see whether semctl IPC_STAT can use struct semid_ds pointer
16578     case "$d_semctl_semid_ds" in
16579     '')
16580       val="$undef"
16581       $cat > try.c <<'END'
16582 #include <sys/types.h>
16583 #include <sys/ipc.h>
16584 #include <sys/sem.h>
16585 #include <sys/stat.h>
16586 #include "tryh.h"
16587 #include <stdio.h>
16588 #include <errno.h>
16589 #ifndef errno
16590 extern int errno;
16591 #endif
16592 int main() {
16593     struct semid_ds arg;
16594     int sem, st;
16595
16596 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16597     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16598     if (sem > -1) {
16599 #       ifdef IPC_STAT
16600         st = semctl(sem, 0, IPC_STAT, &arg);
16601         if (st == 0)
16602             printf("semid_ds\n");
16603         else
16604 #       endif /* IPC_STAT */
16605             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16606 #       ifdef IPC_RMID
16607         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16608 #       endif /* IPC_RMID */
16609             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16610     } else
16611 #endif /* IPC_PRIVATE && ... */
16612         printf("semget failed: errno = %d\n", errno);
16613
16614     return 0;
16615 }
16616 END
16617       set try
16618       if eval $compile; then
16619           xxx=`$run ./try`
16620           case "$xxx" in
16621           semid_ds) val="$define" ;;
16622           esac
16623       fi
16624       $rm_try
16625       set d_semctl_semid_ds
16626       eval $setvar
16627       ;;
16628     esac
16629     case "$d_semctl_semid_ds" in
16630     $define)
16631         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16632         ;;
16633     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16634         ;;
16635     esac
16636     ;;
16637 *)  val="$undef"
16638
16639     # We do not have the full sem*(2) library, so assume we can not
16640     # use either.
16641
16642     set d_semctl_semun
16643     eval $setvar
16644
16645     set d_semctl_semid_ds
16646     eval $setvar
16647     ;;
16648 esac
16649 $rm_try tryh.h
16650
16651 : see if sendmsg exists
16652 set sendmsg d_sendmsg
16653 eval $inlibc
16654
16655 : see if setegid exists
16656 set setegid d_setegid
16657 eval $inlibc
16658
16659 : see if seteuid exists
16660 set seteuid d_seteuid
16661 eval $inlibc
16662
16663 : see if setgrent exists
16664 set setgrent d_setgrent
16665 eval $inlibc
16666
16667 : see if setgrent_r exists
16668 set setgrent_r d_setgrent_r
16669 eval $inlibc
16670 case "$d_setgrent_r" in
16671 "$define")
16672         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16673         case "$d_setgrent_r_proto:$usethreads" in
16674         ":define")      d_setgrent_r_proto=define
16675                 set d_setgrent_r_proto setgrent_r $hdrs
16676                 eval $hasproto ;;
16677         *)      ;;
16678         esac
16679         case "$d_setgrent_r_proto" in
16680         define)
16681         case "$setgrent_r_proto" in
16682         ''|0) try='int setgrent_r(FILE**);'
16683         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16684         esac
16685         case "$setgrent_r_proto" in
16686         ''|0) try='void setgrent_r(FILE**);'
16687         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16688         esac
16689         case "$setgrent_r_proto" in
16690         ''|0)   d_setgrent_r=undef
16691                 setgrent_r_proto=0
16692                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16693         * )     case "$setgrent_r_proto" in
16694                 REENTRANT_PROTO*) ;;
16695                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16696                 esac
16697                 echo "Prototype: $try" ;;
16698         esac
16699         ;;
16700         *)      case "$usethreads" in
16701                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16702                 esac
16703                 d_setgrent_r=undef
16704                 setgrent_r_proto=0
16705                 ;;
16706         esac
16707         ;;
16708 *)      setgrent_r_proto=0
16709         ;;
16710 esac
16711
16712 : see if sethostent exists
16713 set sethostent d_sethent
16714 eval $inlibc
16715
16716 : see if sethostent_r exists
16717 set sethostent_r d_sethostent_r
16718 eval $inlibc
16719 case "$d_sethostent_r" in
16720 "$define")
16721         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16722         case "$d_sethostent_r_proto:$usethreads" in
16723         ":define")      d_sethostent_r_proto=define
16724                 set d_sethostent_r_proto sethostent_r $hdrs
16725                 eval $hasproto ;;
16726         *)      ;;
16727         esac
16728         case "$d_sethostent_r_proto" in
16729         define)
16730         case "$sethostent_r_proto" in
16731         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16732         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16733         esac
16734         case "$sethostent_r_proto" in
16735         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16736         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16737         esac
16738         case "$sethostent_r_proto" in
16739         ''|0)   d_sethostent_r=undef
16740                 sethostent_r_proto=0
16741                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16742         * )     case "$sethostent_r_proto" in
16743                 REENTRANT_PROTO*) ;;
16744                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16745                 esac
16746                 echo "Prototype: $try" ;;
16747         esac
16748         ;;
16749         *)      case "$usethreads" in
16750                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16751                 esac
16752                 d_sethostent_r=undef
16753                 sethostent_r_proto=0
16754                 ;;
16755         esac
16756         ;;
16757 *)      sethostent_r_proto=0
16758         ;;
16759 esac
16760
16761 : see if setitimer exists
16762 set setitimer d_setitimer
16763 eval $inlibc
16764
16765 : see if setlinebuf exists
16766 set setlinebuf d_setlinebuf
16767 eval $inlibc
16768
16769 : see if setlocale exists
16770 set setlocale d_setlocale
16771 eval $inlibc
16772
16773 : see if locale.h is available
16774 set locale.h i_locale
16775 eval $inhdr
16776
16777 : see if setlocale_r exists
16778 set setlocale_r d_setlocale_r
16779 eval $inlibc
16780 case "$d_setlocale_r" in
16781 "$define")
16782         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16783         case "$d_setlocale_r_proto:$usethreads" in
16784         ":define")      d_setlocale_r_proto=define
16785                 set d_setlocale_r_proto setlocale_r $hdrs
16786                 eval $hasproto ;;
16787         *)      ;;
16788         esac
16789         case "$d_setlocale_r_proto" in
16790         define)
16791         case "$setlocale_r_proto" in
16792         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16793         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16794         esac
16795         case "$setlocale_r_proto" in
16796         ''|0)   d_setlocale_r=undef
16797                 setlocale_r_proto=0
16798                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16799         * )     case "$setlocale_r_proto" in
16800                 REENTRANT_PROTO*) ;;
16801                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16802                 esac
16803                 echo "Prototype: $try" ;;
16804         esac
16805         ;;
16806         *)      case "$usethreads" in
16807                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16808                 esac
16809                 d_setlocale_r=undef
16810                 setlocale_r_proto=0
16811                 ;;
16812         esac
16813         ;;
16814 *)      setlocale_r_proto=0
16815         ;;
16816 esac
16817
16818 : see if setnetent exists
16819 set setnetent d_setnent
16820 eval $inlibc
16821
16822 : see if setnetent_r exists
16823 set setnetent_r d_setnetent_r
16824 eval $inlibc
16825 case "$d_setnetent_r" in
16826 "$define")
16827         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16828         case "$d_setnetent_r_proto:$usethreads" in
16829         ":define")      d_setnetent_r_proto=define
16830                 set d_setnetent_r_proto setnetent_r $hdrs
16831                 eval $hasproto ;;
16832         *)      ;;
16833         esac
16834         case "$d_setnetent_r_proto" in
16835         define)
16836         case "$setnetent_r_proto" in
16837         ''|0) try='int setnetent_r(int, struct netent_data*);'
16838         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16839         esac
16840         case "$setnetent_r_proto" in
16841         ''|0) try='void setnetent_r(int, struct netent_data*);'
16842         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16843         esac
16844         case "$setnetent_r_proto" in
16845         ''|0)   d_setnetent_r=undef
16846                 setnetent_r_proto=0
16847                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16848         * )     case "$setnetent_r_proto" in
16849                 REENTRANT_PROTO*) ;;
16850                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16851                 esac
16852                 echo "Prototype: $try" ;;
16853         esac
16854         ;;
16855         *)      case "$usethreads" in
16856                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16857                 esac
16858                 d_setnetent_r=undef
16859                 setnetent_r_proto=0
16860                 ;;
16861         esac
16862         ;;
16863 *)      setnetent_r_proto=0
16864         ;;
16865 esac
16866
16867 : see if setprotoent exists
16868 set setprotoent d_setpent
16869 eval $inlibc
16870
16871 : see if setpgid exists
16872 set setpgid d_setpgid
16873 eval $inlibc
16874
16875 : see if setpgrp2 exists
16876 set setpgrp2 d_setpgrp2
16877 eval $inlibc
16878
16879 : see if setpriority exists
16880 set setpriority d_setprior
16881 eval $inlibc
16882
16883 : see if setproctitle exists
16884 set setproctitle d_setproctitle
16885 eval $inlibc
16886
16887 : see if setprotoent_r exists
16888 set setprotoent_r d_setprotoent_r
16889 eval $inlibc
16890 case "$d_setprotoent_r" in
16891 "$define")
16892         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16893         case "$d_setprotoent_r_proto:$usethreads" in
16894         ":define")      d_setprotoent_r_proto=define
16895                 set d_setprotoent_r_proto setprotoent_r $hdrs
16896                 eval $hasproto ;;
16897         *)      ;;
16898         esac
16899         case "$d_setprotoent_r_proto" in
16900         define)
16901         case "$setprotoent_r_proto" in
16902         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16903         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16904         esac
16905         case "$setprotoent_r_proto" in
16906         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16907         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16908         esac
16909         case "$setprotoent_r_proto" in
16910         ''|0)   d_setprotoent_r=undef
16911                 setprotoent_r_proto=0
16912                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16913         * )     case "$setprotoent_r_proto" in
16914                 REENTRANT_PROTO*) ;;
16915                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16916                 esac
16917                 echo "Prototype: $try" ;;
16918         esac
16919         ;;
16920         *)      case "$usethreads" in
16921                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16922                 esac
16923                 d_setprotoent_r=undef
16924                 setprotoent_r_proto=0
16925                 ;;
16926         esac
16927         ;;
16928 *)      setprotoent_r_proto=0
16929         ;;
16930 esac
16931
16932 : see if setpwent exists
16933 set setpwent d_setpwent
16934 eval $inlibc
16935
16936 : see if setpwent_r exists
16937 set setpwent_r d_setpwent_r
16938 eval $inlibc
16939 case "$d_setpwent_r" in
16940 "$define")
16941         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16942         case "$d_setpwent_r_proto:$usethreads" in
16943         ":define")      d_setpwent_r_proto=define
16944                 set d_setpwent_r_proto setpwent_r $hdrs
16945                 eval $hasproto ;;
16946         *)      ;;
16947         esac
16948         case "$d_setpwent_r_proto" in
16949         define)
16950         case "$setpwent_r_proto" in
16951         ''|0) try='int setpwent_r(FILE**);'
16952         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16953         esac
16954         case "$setpwent_r_proto" in
16955         ''|0) try='void setpwent_r(FILE**);'
16956         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16957         esac
16958         case "$setpwent_r_proto" in
16959         ''|0)   d_setpwent_r=undef
16960                 setpwent_r_proto=0
16961                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16962         * )     case "$setpwent_r_proto" in
16963                 REENTRANT_PROTO*) ;;
16964                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16965                 esac
16966                 echo "Prototype: $try" ;;
16967         esac
16968         ;;
16969         *)      case "$usethreads" in
16970                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16971                 esac
16972                 d_setpwent_r=undef
16973                 setpwent_r_proto=0
16974                 ;;
16975         esac
16976         ;;
16977 *)      setpwent_r_proto=0
16978         ;;
16979 esac
16980
16981 : see if setregid exists
16982 set setregid d_setregid
16983 eval $inlibc
16984 set setresgid d_setresgid
16985 eval $inlibc
16986
16987 : see if setreuid exists
16988 set setreuid d_setreuid
16989 eval $inlibc
16990 set setresuid d_setresuid
16991 eval $inlibc
16992
16993 : see if setrgid exists
16994 set setrgid d_setrgid
16995 eval $inlibc
16996
16997 : see if setruid exists
16998 set setruid d_setruid
16999 eval $inlibc
17000
17001 : see if setservent exists
17002 set setservent d_setsent
17003 eval $inlibc
17004
17005 : see if setservent_r exists
17006 set setservent_r d_setservent_r
17007 eval $inlibc
17008 case "$d_setservent_r" in
17009 "$define")
17010         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17011         case "$d_setservent_r_proto:$usethreads" in
17012         ":define")      d_setservent_r_proto=define
17013                 set d_setservent_r_proto setservent_r $hdrs
17014                 eval $hasproto ;;
17015         *)      ;;
17016         esac
17017         case "$d_setservent_r_proto" in
17018         define)
17019         case "$setservent_r_proto" in
17020         ''|0) try='int setservent_r(int, struct servent_data*);'
17021         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
17022         esac
17023         case "$setservent_r_proto" in
17024         ''|0) try='void setservent_r(int, struct servent_data*);'
17025         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
17026         esac
17027         case "$setservent_r_proto" in
17028         ''|0)   d_setservent_r=undef
17029                 setservent_r_proto=0
17030                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17031         * )     case "$setservent_r_proto" in
17032                 REENTRANT_PROTO*) ;;
17033                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17034                 esac
17035                 echo "Prototype: $try" ;;
17036         esac
17037         ;;
17038         *)      case "$usethreads" in
17039                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17040                 esac
17041                 d_setservent_r=undef
17042                 setservent_r_proto=0
17043                 ;;
17044         esac
17045         ;;
17046 *)      setservent_r_proto=0
17047         ;;
17048 esac
17049
17050 : see if setsid exists
17051 set setsid d_setsid
17052 eval $inlibc
17053
17054 : see if setvbuf exists
17055 set setvbuf d_setvbuf
17056 eval $inlibc
17057
17058 : see if sfio.h is available
17059 set sfio.h i_sfio
17060 eval $inhdr
17061
17062 : see if sfio library is available
17063 case "$i_sfio" in
17064 $define)
17065         val=''
17066         set sfreserve val
17067         eval $inlibc
17068         ;;
17069 *)
17070         val="$undef"
17071         ;;
17072 esac
17073 : Ok, but do we want to use it.
17074 case "$val" in
17075 $define)
17076         case "$usesfio" in
17077         true|$define|[yY]*) dflt='y';;
17078         *) dflt='n';;
17079         esac
17080         echo "$package can use the sfio library, but it is experimental."
17081         case "$useperlio" in
17082         "$undef")
17083             echo "For sfio also the PerlIO abstraction layer is needed."
17084             echo "Earlier you said you wouldn't want that."
17085             ;;
17086         esac
17087         rp="You seem to have sfio available, do you want to try using it?"
17088         . ./myread
17089         case "$ans" in
17090         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
17091                 useperlio="$define"
17092                 val="$define"
17093                 ;;
17094         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17095                 val="$undef"
17096                 ;;
17097         esac
17098         ;;
17099 *)      case "$usesfio" in
17100         true|$define|[yY]*)
17101                 echo "Sorry, cannot find sfio on this machine." >&4
17102                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17103                 val="$undef"
17104                 ;;
17105         esac
17106         ;;
17107 esac
17108 set d_sfio
17109 eval $setvar
17110 case "$d_sfio" in
17111 $define) usesfio='true';;
17112 *) usesfio='false';;
17113 esac
17114 case "$d_sfio" in
17115 $define) ;;
17116 *)      : Remove sfio from list of libraries to use
17117         case "$libs" in
17118         *-lsfio*)
17119                 echo "Removing unneeded -lsfio from library list" >&4
17120                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17121                 shift
17122                 libs="$*"
17123                 echo "libs = $libs" >&4
17124                 ;;
17125         esac
17126 ;;
17127 esac
17128
17129
17130 : see if shmctl exists
17131 set shmctl d_shmctl
17132 eval $inlibc
17133
17134 : see if shmget exists
17135 set shmget d_shmget
17136 eval $inlibc
17137
17138 : see if shmat exists
17139 set shmat d_shmat
17140 eval $inlibc
17141 : see what shmat returns
17142 case "$d_shmat" in
17143 "$define")
17144         $cat >shmat.c <<'END'
17145 #include <sys/shm.h>
17146 void *shmat();
17147 END
17148         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17149                 shmattype='void *'
17150         else
17151                 shmattype='char *'
17152         fi
17153         echo "and it returns ($shmattype)." >&4
17154         : see if a prototype for shmat is available
17155         xxx=`./findhdr sys/shm.h`
17156         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17157         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17158                 val="$define"
17159         else
17160                 val="$undef"
17161         fi
17162         $rm -f shmat.[co]
17163         ;;
17164 *)
17165         val="$undef"
17166         ;;
17167 esac
17168 set d_shmatprototype
17169 eval $setvar
17170
17171 : see if shmdt exists
17172 set shmdt d_shmdt
17173 eval $inlibc
17174
17175 : see how much of the 'shm*(2)' library is present.
17176 h_shm=true
17177 echo " "
17178 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17179 *"$undef"*) h_shm=false;;
17180 esac
17181 case "$osname" in
17182 freebsd)
17183     case "`ipcs 2>&1`" in
17184     "SVID shared memory"*"not configured"*)
17185         echo "Your $osname does not have the shm*(2) configured." >&4
17186         h_shm=false
17187         val="$undef"
17188         set shmctl d_shmctl
17189         evat $setvar
17190         set shmget d_shmget
17191         evat $setvar
17192         set shmat d_shmat
17193         evat $setvar
17194         set shmdt d_shmdt
17195         evat $setvar
17196         ;;
17197     esac
17198     ;;
17199 esac
17200 : we could also check for sys/ipc.h ...
17201 if $h_shm && $test `./findhdr sys/shm.h`; then
17202         echo "You have the full shm*(2) library." >&4
17203         val="$define"
17204 else
17205         echo "You don't have the full shm*(2) library." >&4
17206         val="$undef"
17207 fi
17208 set d_shm
17209 eval $setvar
17210
17211 : see if we have sigaction
17212 echo " "
17213 if set sigaction val -f d_sigaction; eval $csym; $val; then
17214         echo 'sigaction() found.' >&4
17215         $cat > try.c <<EOP
17216 #include <stdio.h>
17217 #include <sys/types.h>
17218 #include <signal.h>
17219 #$i_stdlib I_STDLIB
17220 #ifdef I_STDLIB
17221 #include <stdlib.h>
17222 #endif
17223 int main()
17224 {
17225     struct sigaction act, oact;
17226     act.sa_flags = 0;
17227     oact.sa_handler = 0;
17228     /* so that act and oact are used */
17229     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17230 }
17231 EOP
17232         set try
17233         if eval $compile_ok; then
17234                 val="$define"
17235         else
17236                 echo "But you don't seem to have a useable struct sigaction." >&4
17237                 val="$undef"
17238         fi
17239 else
17240         echo 'sigaction NOT found.' >&4
17241         val="$undef"
17242 fi
17243 set d_sigaction; eval $setvar
17244 $rm_try
17245
17246 : see if this is a sunmath.h system
17247 set sunmath.h i_sunmath
17248 eval $inhdr
17249
17250 : see if signbit exists
17251 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17252 $cat >try.c <<EOCP
17253 #$i_math I_MATH
17254 #$i_sunmath I_SUNMATH
17255 #ifdef I_MATH
17256 #  include <math.h>
17257 #endif
17258 #ifdef I_SUNMATH  /* Solaris special math library */
17259 #  include <sunmath.h>
17260 #endif
17261 #define NV $nvtype
17262 int main(int argc, char **argv)
17263 {
17264     NV x = 0.0;
17265     NV y = -0.0;
17266     if ((signbit(x) == 0) && (signbit(y) != 0))
17267         return 0;
17268     else
17269         return 1;
17270 }
17271 EOCP
17272 val="$undef"
17273 set try
17274 if eval $compile; then
17275     if $run ./try; then
17276         $echo "Yes." >&4
17277         val="$define"
17278     else
17279         $echo "Signbit seems to be available, but doesn't work as I expected."
17280         $echo "I won't use it." >&4
17281         val="$undef"
17282     fi
17283 else
17284     $echo "Nope." >&4
17285     dflt="$undef"
17286 fi
17287 set d_signbit
17288 eval $setvar
17289 $rm_try
17290
17291 : see if sigprocmask exists
17292 set sigprocmask d_sigprocmask
17293 eval $inlibc
17294
17295 : see if sigsetjmp exists
17296 echo " "
17297 case "$d_sigsetjmp" in
17298 '')
17299         $cat >try.c <<EOP
17300 #include <setjmp.h>
17301 #$i_stdlib I_STDLIB
17302 #ifdef I_STDLIB
17303 #include <stdlib.h>
17304 #endif
17305 sigjmp_buf env;
17306 int set = 1;
17307 int main()
17308 {
17309         if (sigsetjmp(env,1))
17310                 exit(set);
17311         set = 0;
17312         siglongjmp(env, 1);
17313         exit(1);
17314 }
17315 EOP
17316         set try
17317         if eval $compile; then
17318                 if $run ./try >/dev/null 2>&1; then
17319                         echo "POSIX sigsetjmp found." >&4
17320                         val="$define"
17321                 else
17322                         $cat >&4 <<EOM
17323 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17324 I'll ignore them.
17325 EOM
17326                         val="$undef"
17327                 fi
17328         else
17329                 echo "sigsetjmp not found." >&4
17330                 val="$undef"
17331         fi
17332         ;;
17333 *) val="$d_sigsetjmp"
17334         case "$d_sigsetjmp" in
17335         $define) echo "POSIX sigsetjmp found." >&4;;
17336         $undef) echo "sigsetjmp not found." >&4;;
17337         esac
17338         ;;
17339 esac
17340 set d_sigsetjmp
17341 eval $setvar
17342 $rm_try
17343
17344 : see if snprintf exists
17345 set snprintf d_snprintf
17346 eval $inlibc
17347
17348 : see if vsnprintf exists
17349 set vsnprintf d_vsnprintf
17350 eval $inlibc
17351
17352 case "$d_snprintf-$d_vsnprintf" in
17353 "$define-$define")
17354     $cat <<EOM
17355 Checking whether your snprintf() and vsnprintf() work okay...
17356 EOM
17357     $cat >try.c <<'EOCP'
17358 /* v?snprintf testing logic courtesy of Russ Allbery.
17359  * According to C99:
17360  * - if the buffer is too short it still must be \0-terminated
17361  * - if the buffer is too short the potentially required length
17362  *   must be returned and not -1
17363  * - if the buffer is NULL the potentially required length
17364  *   must be returned and not -1 or core dump
17365  */
17366 #include <stdio.h>
17367 #include <stdarg.h>
17368
17369 char buf[2];
17370
17371 int test (char *format, ...)
17372 {
17373     va_list args;
17374     int count;
17375
17376     va_start (args, format);
17377     count = vsnprintf (buf, sizeof buf, format, args);
17378     va_end (args);
17379     return count;
17380 }
17381
17382 int main ()
17383 {
17384     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17385              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17386 }
17387 EOCP
17388     set try
17389     if eval $compile; then
17390         `$run ./try`
17391         case "$?" in
17392         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17393         *) cat <<EOM >&4
17394 Your snprintf() and snprintf() don't seem to be working okay.
17395 EOM
17396            d_snprintf="$undef"
17397            d_vsnprintf="$undef"
17398            ;;
17399         esac
17400     else
17401         echo "(I can't seem to compile the test program--assuming they don't)"
17402         d_snprintf="$undef"
17403         d_vsnprintf="$undef"
17404     fi
17405     $rm_try
17406     ;;
17407 esac
17408
17409 : see if sockatmark exists
17410 set sockatmark d_sockatmark
17411 eval $inlibc
17412
17413 : see if prototype for sockatmark is available
17414 echo " "
17415 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17416 eval $hasproto
17417
17418 : see if socks5_init exists
17419 set socks5_init d_socks5_init
17420 eval $inlibc
17421
17422 : see if sprintf returns the length of the string in the buffer as per ANSI
17423 $echo "Checking whether sprintf returns the length of the string..." >&4
17424 $cat <<EOP >try.c
17425 #include <stdio.h>
17426 #$i_stdlib I_STDLIB
17427 #ifdef I_STDLIB
17428 #include <stdlib.h>
17429 #endif
17430 #$i_string I_STRING
17431 #ifdef I_STRING
17432 #  include <string.h>
17433 #else
17434 #  include <strings.h>
17435 #endif
17436 #$i_math I_MATH
17437 #ifdef I_MATH
17438 #include <math.h>
17439 #endif
17440
17441 char buffer[256];
17442
17443 int check (size_t expect, int test) {
17444   size_t got = strlen(buffer);
17445   if (expect == got)
17446     return 0;
17447
17448   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17449        test, buffer);
17450   exit (test);
17451 }
17452
17453 int main(int argc, char **argv) {
17454   int test = 0;
17455
17456   check(sprintf(buffer, ""), ++test);
17457   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17458   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17459
17460   return 0;
17461 }
17462 EOP
17463 set try
17464
17465 d_sprintf_returns_strlen="$undef"
17466 if eval $compile; then
17467     xxx="`$run ./try`"
17468     case "$?" in
17469         0) cat >&4 <<EOM
17470 sprintf returns the length of the string (as ANSI says it should)
17471 EOM
17472         d_sprintf_returns_strlen="$define"
17473         ;;
17474         *) cat >&4 <<EOM
17475 sprintf does not return the length of the string (how old is this system?)
17476 EOM
17477         d_sprintf_returns_strlen="$undef"
17478         ;;
17479     esac
17480 fi
17481 $rm_try
17482
17483 : see if srand48_r exists
17484 set srand48_r d_srand48_r
17485 eval $inlibc
17486 case "$d_srand48_r" in
17487 "$define")
17488         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17489         case "$d_srand48_r_proto:$usethreads" in
17490         ":define")      d_srand48_r_proto=define
17491                 set d_srand48_r_proto srand48_r $hdrs
17492                 eval $hasproto ;;
17493         *)      ;;
17494         esac
17495         case "$d_srand48_r_proto" in
17496         define)
17497         case "$srand48_r_proto" in
17498         ''|0) try='int srand48_r(long, struct drand48_data*);'
17499         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17500         esac
17501         case "$srand48_r_proto" in
17502         ''|0)   d_srand48_r=undef
17503                 srand48_r_proto=0
17504                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17505         * )     case "$srand48_r_proto" in
17506                 REENTRANT_PROTO*) ;;
17507                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17508                 esac
17509                 echo "Prototype: $try" ;;
17510         esac
17511         ;;
17512         *)      case "$usethreads" in
17513                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17514                 esac
17515                 d_srand48_r=undef
17516                 srand48_r_proto=0
17517                 ;;
17518         esac
17519         ;;
17520 *)      srand48_r_proto=0
17521         ;;
17522 esac
17523
17524 : see if srandom_r exists
17525 set srandom_r d_srandom_r
17526 eval $inlibc
17527 case "$d_srandom_r" in
17528 "$define")
17529         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17530         case "$d_srandom_r_proto:$usethreads" in
17531         ":define")      d_srandom_r_proto=define
17532                 set d_srandom_r_proto srandom_r $hdrs
17533                 eval $hasproto ;;
17534         *)      ;;
17535         esac
17536         case "$d_srandom_r_proto" in
17537         define)
17538         case "$srandom_r_proto" in
17539         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17540         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17541         esac
17542         case "$srandom_r_proto" in
17543         ''|0)   d_srandom_r=undef
17544                 srandom_r_proto=0
17545                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17546         * )     case "$srandom_r_proto" in
17547                 REENTRANT_PROTO*) ;;
17548                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17549                 esac
17550                 echo "Prototype: $try" ;;
17551         esac
17552         ;;
17553         *)      case "$usethreads" in
17554                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17555                 esac
17556                 d_srandom_r=undef
17557                 srandom_r_proto=0
17558                 ;;
17559         esac
17560         ;;
17561 *)      srandom_r_proto=0
17562         ;;
17563 esac
17564
17565 : see if prototype for setresgid is available
17566 echo " "
17567 set d_sresgproto setresgid $i_unistd unistd.h
17568 eval $hasproto
17569
17570 : see if prototype for setresuid is available
17571 echo " "
17572 set d_sresuproto setresuid $i_unistd unistd.h
17573 eval $hasproto
17574
17575 : see if sys/stat.h is available
17576 set sys/stat.h i_sysstat
17577 eval $inhdr
17578
17579 : see if stat knows about block sizes
17580 echo " "
17581 echo "Checking to see if your struct stat has st_blocks field..." >&4
17582 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17583 eval $hasfield
17584
17585 : see if this is a sys/vfs.h system
17586 set sys/vfs.h i_sysvfs
17587 eval $inhdr
17588
17589 : see if this is a sys/statfs.h system
17590 set sys/statfs.h i_sysstatfs
17591 eval $inhdr
17592
17593 : Check for statfs_s
17594 echo " "
17595 echo "Checking to see if your system supports struct statfs..." >&4
17596 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
17597 eval $hasstruct
17598 case "$d_statfs_s" in
17599 "$define")      echo "Yes, it does."   ;;
17600 *)              echo "No, it doesn't." ;;
17601 esac
17602
17603
17604 : see if struct statfs knows about f_flags
17605 case "$d_statfs_s" in
17606 define)
17607         echo " "
17608         echo "Checking to see if your struct statfs has f_flags field..." >&4
17609         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
17610         eval $hasfield
17611         ;;
17612 *)      val="$undef"
17613         set d_statfs_f_flags
17614         eval $setvar
17615         ;;
17616 esac
17617 case "$d_statfs_f_flags" in
17618 "$define")      echo "Yes, it does."   ;;
17619 *)              echo "No, it doesn't." ;;
17620 esac
17621
17622 : Check stream access
17623 $cat >&4 <<EOM
17624 Checking how to access stdio streams by file descriptor number...
17625 EOM
17626 case "$stdio_stream_array" in
17627 '')     $cat >try.c <<EOCP
17628 #include <stdio.h>
17629 int main() {
17630   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17631     printf("yes\n");
17632 }
17633 EOCP
17634         for s in _iob __iob __sF
17635         do
17636                 set try -DSTDIO_STREAM_ARRAY=$s
17637                 if eval $compile; then
17638                         case "`$run ./try`" in
17639                         yes)    stdio_stream_array=$s; break ;;
17640                         esac
17641                 fi
17642         done
17643         $rm_try
17644 esac
17645 case "$stdio_stream_array" in
17646 '')     $cat >&4 <<EOM
17647 I can't figure out how to access stdio streams by file descriptor number.
17648 EOM
17649         d_stdio_stream_array="$undef"
17650         ;;
17651 *)      $cat >&4 <<EOM
17652 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17653 EOM
17654         d_stdio_stream_array="$define"
17655         ;;
17656 esac
17657
17658 : see if strcoll exists
17659 set strcoll d_strcoll
17660 eval $inlibc
17661
17662 : check for structure copying
17663 echo " "
17664 echo "Checking to see if your C compiler can copy structs..." >&4
17665 $cat >try.c <<'EOCP'
17666 int main()
17667 {
17668         struct blurfl {
17669                 int dyick;
17670         } foo, bar;
17671
17672         foo = bar;
17673 }
17674 EOCP
17675 if $cc -c try.c >/dev/null 2>&1 ; then
17676         val="$define"
17677         echo "Yup, it can."
17678 else
17679         val="$undef"
17680         echo "Nope, it can't."
17681 fi
17682 set d_strctcpy
17683 eval $setvar
17684 $rm_try
17685
17686 : see if strerror and/or sys_errlist[] exist
17687 echo " "
17688 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17689     if set strerror val -f d_strerror; eval $csym; $val; then
17690                 echo 'strerror() found.' >&4
17691                 d_strerror="$define"
17692                 d_strerrm='strerror(e)'
17693                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17694                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17695                         d_syserrlst="$define"
17696                 else
17697                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17698                         d_syserrlst="$undef"
17699                 fi
17700     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17701                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17702                 echo 'strerror() found in string header.' >&4
17703                 d_strerror="$define"
17704                 d_strerrm='strerror(e)'
17705                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17706                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17707                                 d_syserrlst="$define"
17708                 else
17709                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17710                         d_syserrlst="$undef"
17711                 fi
17712     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17713                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17714                 d_strerror="$undef"
17715                 d_syserrlst="$define"
17716                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17717     else
17718                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17719                 d_strerror="$undef"
17720                 d_syserrlst="$undef"
17721                 d_strerrm='"unknown"'
17722     fi
17723 fi
17724
17725 : see if strerror_r exists
17726 set strerror_r d_strerror_r
17727 eval $inlibc
17728 case "$d_strerror_r" in
17729 "$define")
17730         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17731         case "$d_strerror_r_proto:$usethreads" in
17732         ":define")      d_strerror_r_proto=define
17733                 set d_strerror_r_proto strerror_r $hdrs
17734                 eval $hasproto ;;
17735         *)      ;;
17736         esac
17737         case "$d_strerror_r_proto" in
17738         define)
17739         case "$strerror_r_proto" in
17740         ''|0) try='int strerror_r(int, char*, size_t);'
17741         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17742         esac
17743         case "$strerror_r_proto" in
17744         ''|0) try='int strerror_r(int, char*, int);'
17745         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17746         esac
17747         case "$strerror_r_proto" in
17748         ''|0) try='char* strerror_r(int, char*, size_t);'
17749         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17750         esac
17751         case "$strerror_r_proto" in
17752         ''|0)   d_strerror_r=undef
17753                 strerror_r_proto=0
17754                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17755         * )     case "$strerror_r_proto" in
17756                 REENTRANT_PROTO*) ;;
17757                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17758                 esac
17759                 echo "Prototype: $try" ;;
17760         esac
17761         ;;
17762         *)      case "$usethreads" in
17763                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17764                 esac
17765                 d_strerror_r=undef
17766                 strerror_r_proto=0
17767                 ;;
17768         esac
17769         ;;
17770 *)      strerror_r_proto=0
17771         ;;
17772 esac
17773
17774 : see if strftime exists
17775 set strftime d_strftime
17776 eval $inlibc
17777
17778 : see if strlcat exists
17779 set strlcat d_strlcat
17780 eval $inlibc
17781
17782 : see if strlcpy exists
17783 set strlcpy d_strlcpy
17784 eval $inlibc
17785
17786 : see if strtod exists
17787 set strtod d_strtod
17788 eval $inlibc
17789
17790 : see if strtol exists
17791 set strtol d_strtol
17792 eval $inlibc
17793
17794 : see if strtold exists
17795 set strtold d_strtold
17796 eval $inlibc
17797
17798 : see if strtoll exists
17799 set strtoll d_strtoll
17800 eval $inlibc
17801
17802 case "$d_longlong-$d_strtoll" in
17803 "$define-$define")
17804         $cat <<EOM
17805 Checking whether your strtoll() works okay...
17806 EOM
17807         $cat >try.c <<'EOCP'
17808 #include <errno.h>
17809 #ifdef __hpux
17810 #define strtoll __strtoll
17811 #endif
17812 #ifdef __EMX__
17813 #define strtoll _strtoll
17814 #endif
17815 #include <stdio.h>
17816 extern long long int strtoll(char *s, char **, int);
17817 static int bad = 0;
17818 int check(char *s, long long ell, int een) {
17819         long long gll;
17820         errno = 0;
17821         gll = strtoll(s, 0, 10);
17822         if (!((gll == ell) && (errno == een)))
17823                 bad++;
17824 }
17825 int main() {
17826         check(" 1",                                      1LL, 0);
17827         check(" 0",                                      0LL, 0);
17828         check("-1",                                     -1LL, 0);
17829         check("-9223372036854775808", -9223372036854775808LL, 0);
17830         check("-9223372036854775808", -9223372036854775808LL, 0);
17831         check(" 9223372036854775807",  9223372036854775807LL, 0);
17832         check("-9223372036854775808", -9223372036854775808LL, 0);
17833         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17834         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17835         if (!bad)
17836                 printf("ok\n");
17837 }
17838 EOCP
17839         set try
17840         if eval $compile; then
17841                 yyy=`$run ./try`
17842                 case "$yyy" in
17843                 ok) echo "Your strtoll() seems to be working okay." ;;
17844                 *) cat <<EOM >&4
17845 Your strtoll() doesn't seem to be working okay.
17846 EOM
17847                    d_strtoll="$undef"
17848                    ;;
17849                 esac
17850         else
17851                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17852                 d_strtoll="$undef"
17853         fi
17854         ;;
17855 esac
17856
17857 : see if strtoq exists
17858 set strtoq d_strtoq
17859 eval $inlibc
17860
17861 : see if strtoul exists
17862 set strtoul d_strtoul
17863 eval $inlibc
17864
17865 case "$d_strtoul" in
17866 "$define")
17867         $cat <<EOM
17868 Checking whether your strtoul() works okay...
17869 EOM
17870         $cat >try.c <<'EOCP'
17871 #include <errno.h>
17872 #include <stdio.h>
17873 extern unsigned long int strtoul(char *s, char **, int);
17874 static int bad = 0;
17875 void check(char *s, unsigned long eul, int een) {
17876         unsigned long gul;
17877         errno = 0;
17878         gul = strtoul(s, 0, 10);
17879         if (!((gul == eul) && (errno == een)))
17880                 bad++;
17881 }
17882 int main() {
17883         check(" 1", 1L, 0);
17884         check(" 0", 0L, 0);
17885 EOCP
17886         case "$longsize" in
17887         8)
17888             $cat >>try.c <<'EOCP'
17889         check("18446744073709551615", 18446744073709551615UL, 0);
17890         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17891 #if 0 /* strtoul() for /^-/ strings is undefined. */
17892         check("-1", 18446744073709551615UL, 0);
17893         check("-18446744073709551614", 2, 0);
17894         check("-18446744073709551615", 1, 0);
17895         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17896         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17897 #endif
17898 EOCP
17899                 ;;
17900         4)
17901                     $cat >>try.c <<'EOCP'
17902         check("4294967295", 4294967295UL, 0);
17903         check("4294967296", 4294967295UL, ERANGE);
17904 #if 0 /* strtoul() for /^-/ strings is undefined. */
17905         check("-1", 4294967295UL, 0);
17906         check("-4294967294", 2, 0);
17907         check("-4294967295", 1, 0);
17908         check("-4294967296", 4294967295UL, ERANGE);
17909         check("-4294967297", 4294967295UL, ERANGE);
17910 #endif
17911 EOCP
17912                 ;;
17913         *)
17914 : Should we write these tests to be more portable by sprintf-ing
17915 : ~0 and then manipulating that char string as input for strtol?
17916                 ;;
17917         esac
17918         $cat >>try.c <<'EOCP'
17919         if (!bad)
17920                 printf("ok\n");
17921         return 0;
17922 }
17923 EOCP
17924         set try
17925         if eval $compile; then
17926                 case "`$run ./try`" in
17927                 ok) echo "Your strtoul() seems to be working okay." ;;
17928                 *) cat <<EOM >&4
17929 Your strtoul() doesn't seem to be working okay.
17930 EOM
17931                    d_strtoul="$undef"
17932                    ;;
17933                 esac
17934         else
17935                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17936                 d_strtoul="$undef"
17937         fi
17938         ;;
17939 esac
17940
17941 : see if strtoull exists
17942 set strtoull d_strtoull
17943 eval $inlibc
17944
17945 case "$d_longlong-$d_strtoull" in
17946 "$define-$define")
17947         $cat <<EOM
17948 Checking whether your strtoull() works okay...
17949 EOM
17950         $cat >try.c <<'EOCP'
17951 #include <errno.h>
17952 #ifdef __hpux
17953 #define strtoull __strtoull
17954 #endif
17955 #include <stdio.h>
17956 extern unsigned long long int strtoull(char *s, char **, int);
17957 static int bad = 0;
17958 int check(char *s, long long eull, int een) {
17959         long long gull;
17960         errno = 0;
17961         gull = strtoull(s, 0, 10);
17962         if (!((gull == eull) && (errno == een)))
17963                 bad++;
17964 }
17965 int main() {
17966         check(" 1",                                        1LL, 0);
17967         check(" 0",                                        0LL, 0);
17968         check("18446744073709551615",  18446744073709551615ULL, 0);
17969         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17970 #if 0 /* strtoull() for /^-/ strings is undefined. */
17971         check("-1",                    18446744073709551615ULL, 0);
17972         check("-18446744073709551614",                     2LL, 0);
17973         check("-18446744073709551615",                     1LL, 0);
17974         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17975         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17976 #endif
17977         if (!bad)
17978                 printf("ok\n");
17979 }
17980 EOCP
17981         set try
17982         if eval $compile; then
17983                 case "`$run ./try`" in
17984                 ok) echo "Your strtoull() seems to be working okay." ;;
17985                 *) cat <<EOM >&4
17986 Your strtoull() doesn't seem to be working okay.
17987 EOM
17988                    d_strtoull="$undef"
17989                    ;;
17990                 esac
17991         else
17992                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17993                 d_strtoull="$undef"
17994         fi
17995         ;;
17996 esac
17997
17998 : see if strtouq exists
17999 set strtouq d_strtouq
18000 eval $inlibc
18001
18002 case "$d_strtouq" in
18003 "$define")
18004         $cat <<EOM
18005 Checking whether your strtouq() works okay...
18006 EOM
18007         $cat >try.c <<'EOCP'
18008 #include <errno.h>
18009 #include <stdio.h>
18010 extern unsigned long long int strtouq(char *s, char **, int);
18011 static int bad = 0;
18012 void check(char *s, unsigned long long eull, int een) {
18013         unsigned long long gull;
18014         errno = 0;
18015         gull = strtouq(s, 0, 10);
18016         if (!((gull == eull) && (errno == een)))
18017                 bad++;
18018 }
18019 int main() {
18020         check(" 1",                                        1LL, 0);
18021         check(" 0",                                        0LL, 0);
18022         check("18446744073709551615",  18446744073709551615ULL, 0);
18023         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18024 #if 0 /* strtouq() for /^-/ strings is undefined. */
18025         check("-1",                    18446744073709551615ULL, 0);
18026         check("-18446744073709551614",                     2LL, 0);
18027         check("-18446744073709551615",                     1LL, 0);
18028         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18029         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18030 #endif
18031         if (!bad)
18032                 printf("ok\n");
18033         return 0;
18034 }
18035 EOCP
18036         set try
18037         if eval $compile; then
18038                 case "`$run ./try`" in
18039                 ok) echo "Your strtouq() seems to be working okay." ;;
18040                 *) cat <<EOM >&4
18041 Your strtouq() doesn't seem to be working okay.
18042 EOM
18043                    d_strtouq="$undef"
18044                    ;;
18045                 esac
18046         else
18047                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18048                 d_strtouq="$undef"
18049         fi
18050         ;;
18051 esac
18052
18053 : see if strxfrm exists
18054 set strxfrm d_strxfrm
18055 eval $inlibc
18056
18057 : see if symlink exists
18058 set symlink d_symlink
18059 eval $inlibc
18060
18061 : see if syscall exists
18062 set syscall d_syscall
18063 eval $inlibc
18064
18065 : see if prototype for syscall is available
18066 echo " "
18067 set d_syscallproto syscall $i_unistd unistd.h
18068 eval $hasproto
18069
18070 : see if sysconf exists
18071 set sysconf d_sysconf
18072 eval $inlibc
18073
18074 : see if system exists
18075 set system d_system
18076 eval $inlibc
18077
18078 : see if tcgetpgrp exists
18079 set tcgetpgrp d_tcgetpgrp
18080 eval $inlibc
18081
18082 : see if tcsetpgrp exists
18083 set tcsetpgrp d_tcsetpgrp
18084 eval $inlibc
18085
18086 : see if prototype for telldir is available
18087 echo " "
18088 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18089 eval $hasproto
18090
18091 : see if time exists
18092 echo " "
18093 if test "X$d_time" = X -o X"$timetype" = X; then
18094     if set time val -f d_time; eval $csym; $val; then
18095                 echo 'time() found.' >&4
18096                 val="$define"
18097                 rp="What is the type returned by time() on this system?"
18098                 set time_t timetype long stdio.h sys/types.h
18099                 eval $typedef_ask
18100     else
18101                 echo 'time() not found, hope that will do.' >&4
18102                 val="$undef"
18103                 timetype='int';
18104     fi
18105     set d_time
18106     eval $setvar
18107 fi
18108
18109 : see if timegm exists
18110 set timegm d_timegm
18111 eval $inlibc
18112
18113 : see if this is a sys/times.h system
18114 set sys/times.h i_systimes
18115 eval $inhdr
18116
18117 : see if times exists
18118 echo " "
18119 if set times val -f d_times; eval $csym; $val; then
18120         echo 'times() found.' >&4
18121         d_times="$define"
18122         inc=''
18123         case "$i_systimes" in
18124         "$define") inc='sys/times.h';;
18125         esac
18126         rp="What is the type returned by times() on this system?"
18127         set clock_t clocktype long stdio.h sys/types.h $inc
18128         eval $typedef_ask
18129 else
18130         echo 'times() NOT found, hope that will do.' >&4
18131         d_times="$undef"
18132         clocktype='int'
18133 fi
18134
18135 : see if tmpnam_r exists
18136 set tmpnam_r d_tmpnam_r
18137 eval $inlibc
18138 case "$d_tmpnam_r" in
18139 "$define")
18140         hdrs="$i_systypes sys/types.h define stdio.h "
18141         case "$d_tmpnam_r_proto:$usethreads" in
18142         ":define")      d_tmpnam_r_proto=define
18143                 set d_tmpnam_r_proto tmpnam_r $hdrs
18144                 eval $hasproto ;;
18145         *)      ;;
18146         esac
18147         case "$d_tmpnam_r_proto" in
18148         define)
18149         case "$tmpnam_r_proto" in
18150         ''|0) try='char* tmpnam_r(char*);'
18151         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
18152         esac
18153         case "$tmpnam_r_proto" in
18154         ''|0)   d_tmpnam_r=undef
18155                 tmpnam_r_proto=0
18156                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18157         * )     case "$tmpnam_r_proto" in
18158                 REENTRANT_PROTO*) ;;
18159                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18160                 esac
18161                 echo "Prototype: $try" ;;
18162         esac
18163         ;;
18164         *)      case "$usethreads" in
18165                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18166                 esac
18167                 d_tmpnam_r=undef
18168                 tmpnam_r_proto=0
18169                 ;;
18170         esac
18171         ;;
18172 *)      tmpnam_r_proto=0
18173         ;;
18174 esac
18175
18176 : see if truncate exists
18177 set truncate d_truncate
18178 eval $inlibc
18179
18180 : see if ttyname_r exists
18181 set ttyname_r d_ttyname_r
18182 eval $inlibc
18183 case "$d_ttyname_r" in
18184 "$define")
18185         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18186         case "$d_ttyname_r_proto:$usethreads" in
18187         ":define")      d_ttyname_r_proto=define
18188                 set d_ttyname_r_proto ttyname_r $hdrs
18189                 eval $hasproto ;;
18190         *)      ;;
18191         esac
18192         case "$d_ttyname_r_proto" in
18193         define)
18194         case "$ttyname_r_proto" in
18195         ''|0) try='int ttyname_r(int, char*, size_t);'
18196         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
18197         esac
18198         case "$ttyname_r_proto" in
18199         ''|0) try='int ttyname_r(int, char*, int);'
18200         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
18201         esac
18202         case "$ttyname_r_proto" in
18203         ''|0) try='char* ttyname_r(int, char*, int);'
18204         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
18205         esac
18206         case "$ttyname_r_proto" in
18207         ''|0)   d_ttyname_r=undef
18208                 ttyname_r_proto=0
18209                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18210         * )     case "$ttyname_r_proto" in
18211                 REENTRANT_PROTO*) ;;
18212                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18213                 esac
18214                 echo "Prototype: $try" ;;
18215         esac
18216         ;;
18217         *)      case "$usethreads" in
18218                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18219                 esac
18220                 d_ttyname_r=undef
18221                 ttyname_r_proto=0
18222                 ;;
18223         esac
18224         ;;
18225 *)      ttyname_r_proto=0
18226         ;;
18227 esac
18228
18229 : see if tzname[] exists
18230 echo " "
18231 if set tzname val -a d_tzname; eval $csym; $val; then
18232         val="$define"
18233         echo 'tzname[] found.' >&4
18234 else
18235         val="$undef"
18236         echo 'tzname[] NOT found.' >&4
18237 fi
18238 set d_tzname
18239 eval $setvar
18240
18241 : Check if is a multiplatform env
18242 case "$osname" in
18243 next|rhapsody|darwin) multiarch="$define" ;;
18244 esac
18245 case "$multiarch" in
18246 ''|[nN]*) multiarch="$undef" ;;
18247 esac
18248
18249 : check for ordering of bytes in a UV
18250 echo " "
18251 case "$usecrosscompile$multiarch" in
18252 *$define*)
18253         $cat <<EOM
18254 You seem to be either cross-compiling or doing a multiarchitecture build,
18255 skipping the byteorder check.
18256
18257 EOM
18258         byteorder='ffff'
18259         ;;
18260 *)
18261         case "$byteorder" in
18262         '')
18263                 $cat <<'EOM'
18264 In the following, larger digits indicate more significance.  A big-endian
18265 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18266 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18267 machines may have weird orders like 3412.  A Cray will report 87654321,
18268 an Alpha will report 12345678. If the test program works the default is
18269 probably right.
18270 I'm now running the test program...
18271 EOM
18272                 $cat >try.c <<EOCP
18273 #include <stdio.h>
18274 #$i_stdlib I_STDLIB
18275 #ifdef I_STDLIB
18276 #include <stdlib.h>
18277 #endif
18278 #include <sys/types.h>
18279 typedef $uvtype UV;
18280 int main()
18281 {
18282         int i;
18283         union {
18284                 UV l;
18285                 char c[$uvsize];
18286         } u;
18287
18288         if ($uvsize > 4)
18289                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18290         else
18291                 u.l = (UV)0x04030201;
18292         for (i = 0; i < $uvsize; i++)
18293                 printf("%c", u.c[i]+'0');
18294         printf("\n");
18295         exit(0);
18296 }
18297 EOCP
18298                 xxx_prompt=y
18299                 set try
18300                 if eval $compile && $run ./try > /dev/null; then
18301                         dflt=`$run ./try`
18302                         case "$dflt" in
18303                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18304                                 echo "(The test program ran ok.)"
18305                                 echo "byteorder=$dflt"
18306                                 xxx_prompt=n
18307                         ;;
18308                         ????|????????) echo "(The test program ran ok.)" ;;
18309                         *) echo "(The test program didn't run right for some reason.)" ;;
18310                         esac
18311                 else
18312                         dflt='4321'
18313                         cat <<'EOM'
18314 (I can't seem to compile the test program.  Guessing big-endian...)
18315 EOM
18316                 fi
18317                 case "$xxx_prompt" in
18318                 y)
18319                         rp="What is the order of bytes in $uvtype?"
18320                         . ./myread
18321                         byteorder="$ans"
18322                         ;;
18323                 *)      byteorder=$dflt
18324                         ;;
18325                 esac
18326                 ;;
18327         esac
18328         $rm_try
18329         ;;
18330 esac
18331
18332 : Checking 32bit aligndness
18333 $cat <<EOM
18334
18335 Checking to see whether you can access character data unalignedly...
18336 EOM
18337 case "$d_u32align" in
18338 '')   $cat >try.c <<EOCP
18339 #include <stdio.h>
18340 #$i_stdlib I_STDLIB
18341 #ifdef I_STDLIB
18342 #include <stdlib.h>
18343 #endif
18344 #define U32 $u32type
18345 #define BYTEORDER 0x$byteorder
18346 #define U8 $u8type
18347 #include <signal.h>
18348 #ifdef SIGBUS
18349 $signal_t bletch(int s) { exit(4); }
18350 #endif
18351 int main() {
18352 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18353     U8 buf[8];
18354     U32 *up;
18355     int i;
18356
18357     if (sizeof(U32) != 4) {
18358         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18359         exit(1);
18360     }
18361
18362     fflush(stdout);
18363
18364 #ifdef SIGBUS
18365     signal(SIGBUS, bletch);
18366 #endif
18367
18368     buf[0] = 0;
18369     buf[1] = 0;
18370     buf[2] = 0;
18371     buf[3] = 1;
18372     buf[4] = 0;
18373     buf[5] = 0;
18374     buf[6] = 0;
18375     buf[7] = 1;
18376
18377     for (i = 0; i < 4; i++) {
18378         up = (U32*)(buf + i);
18379         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18380                (*up == 1 << (8*(3-i)))  /* little-endian */
18381               )
18382            )
18383         {
18384             printf("read failed (%x)\n", *up);
18385             exit(2);
18386         }
18387     }
18388
18389     /* write test */
18390     for (i = 0; i < 4; i++) {
18391         up = (U32*)(buf + i);
18392         *up = 0xBeef;
18393         if (*up != 0xBeef) {
18394             printf("write failed (%x)\n", *up);
18395             exit(3);
18396         }
18397     }
18398
18399     exit(0);
18400 #else
18401     printf("1\n");
18402     exit(1);
18403 #endif
18404     return 0;
18405 }
18406 EOCP
18407 set try
18408 if eval $compile_ok; then
18409         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18410         $run ./try 2>&1 >/dev/null
18411         case "$?" in
18412         0)      cat >&4 <<EOM
18413 You can access character data pretty unalignedly.
18414 EOM
18415                 d_u32align="$undef"
18416                 ;;
18417         *)      cat >&4 <<EOM
18418 It seems that you must access character data in an aligned manner.
18419 EOM
18420                 d_u32align="$define"
18421                 ;;
18422         esac
18423 else
18424         rp='Can you access character data at unaligned addresses?'
18425         dflt='n'
18426         . ./myread
18427         case "$ans" in
18428         [yY]*)  d_u32align="$undef"  ;;
18429         *)      d_u32align="$define" ;;
18430         esac
18431 fi
18432 $rm_try
18433 ;;
18434 esac
18435
18436 : see if ualarm exists
18437 set ualarm d_ualarm
18438 eval $inlibc
18439
18440 : see if umask exists
18441 set umask d_umask
18442 eval $inlibc
18443
18444 : see if unordered exists
18445 set unordered d_unordered
18446 eval $inlibc
18447
18448 : see if unsetenv exists
18449 set unsetenv d_unsetenv
18450 eval $inlibc
18451
18452 : see if usleep exists
18453 set usleep d_usleep
18454 eval $inlibc
18455
18456 : see if prototype for usleep is available
18457 echo " "
18458 set d_usleepproto usleep $i_unistd unistd.h
18459 eval $hasproto
18460
18461 : see if ustat exists
18462 set ustat d_ustat
18463 eval $inlibc
18464
18465 : see if closedir exists
18466 set closedir d_closedir
18467 eval $inlibc
18468
18469 case "$d_closedir" in
18470 "$define")
18471         echo " "
18472         echo "Checking whether closedir() returns a status..." >&4
18473         cat > try.c <<EOM
18474 #$i_dirent I_DIRENT             /**/
18475 #$i_sysdir I_SYS_DIR            /**/
18476 #$i_sysndir I_SYS_NDIR          /**/
18477 #$i_systypes I_SYS_TYPES        /**/
18478
18479 #if defined(I_SYS_TYPES)
18480 #include <sys/types.h>
18481 #endif
18482 #if defined(I_DIRENT)
18483 #include <dirent.h>
18484 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18485 #include <sys/dir.h>
18486 #endif
18487 #else
18488 #ifdef I_SYS_NDIR
18489 #include <sys/ndir.h>
18490 #else
18491 #ifdef I_SYS_DIR
18492 #ifdef hp9000s500
18493 #include <ndir.h>       /* may be wrong in the future */
18494 #else
18495 #include <sys/dir.h>
18496 #endif
18497 #endif
18498 #endif
18499 #endif
18500 int main() { return closedir(opendir(".")); }
18501 EOM
18502         set try
18503         if eval $compile_ok; then
18504                 if $run ./try > /dev/null 2>&1 ; then
18505                         echo "Yes, it does."
18506                         val="$undef"
18507                 else
18508                         echo "No, it doesn't."
18509                         val="$define"
18510                 fi
18511         else
18512                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18513                 val="$define"
18514         fi
18515         ;;
18516 *)
18517         val="$undef";
18518         ;;
18519 esac
18520 set d_void_closedir
18521 eval $setvar
18522 $rm_try
18523
18524 : see if there is a wait4
18525 set wait4 d_wait4
18526 eval $inlibc
18527
18528 : see if waitpid exists
18529 set waitpid d_waitpid
18530 eval $inlibc
18531
18532 : see if wcstombs exists
18533 set wcstombs d_wcstombs
18534 eval $inlibc
18535
18536 : see if wctomb exists
18537 set wctomb d_wctomb
18538 eval $inlibc
18539
18540 : see if writev exists
18541 set writev d_writev
18542 eval $inlibc
18543
18544 : preserve RCS keywords in files with variable substitution, grrr
18545 Date='$Date'
18546 Id='$Id'
18547 Log='$Log'
18548 RCSfile='$RCSfile'
18549 Revision='$Revision'
18550
18551 : check for alignment requirements
18552 echo " "
18553 case "$usecrosscompile$multiarch" in
18554 *$define*)
18555         $cat <<EOM
18556 You seem to be either cross-compiling or doing a multiarchitecture build,
18557 skipping the memory alignment check.
18558
18559 EOM
18560         case "$alignbytes" in
18561         '') alignbytes=8 ;;
18562         esac
18563         ;;
18564 *)
18565         case "$alignbytes" in
18566         '') echo "Checking alignment constraints..." >&4
18567                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18568                         $cat >try.c <<'EOCP'
18569 typedef long double NV;
18570 EOCP
18571                 else
18572                         $cat >try.c <<'EOCP'
18573 typedef double NV;
18574 EOCP
18575                 fi
18576                 $cat >>try.c <<'EOCP'
18577 #include <stdio.h>
18578 struct foobar {
18579         char foo;
18580         NV bar;
18581 } try_algn;
18582 int main()
18583 {
18584     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18585     return(0);
18586 }
18587 EOCP
18588                 set try
18589                 if eval $compile_ok; then
18590                         dflt=`$run ./try`
18591                 else
18592                         dflt='8'
18593                         echo "(I can't seem to compile the test program...)"
18594                 fi
18595                 ;;
18596         *) dflt="$alignbytes"
18597                 ;;
18598         esac
18599         rp="Doubles must be aligned on a how-many-byte boundary?"
18600         . ./myread
18601         alignbytes="$ans"
18602         $rm_try
18603         ;;
18604 esac
18605
18606
18607 : set the base revision
18608 baserev=5.0
18609
18610 : how do we concatenate cpp tokens here?
18611 echo " "
18612 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18613 $cat >cpp_stuff.c <<'EOCP'
18614 #define RCAT(a,b)a/**/b
18615 #define ACAT(a,b)a ## b
18616 RCAT(Rei,ser)
18617 ACAT(Cir,cus)
18618 EOCP
18619 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18620 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18621         echo "Oh!  Smells like ANSI's been here." >&4
18622         echo "We can catify or stringify, separately or together!"
18623         cpp_stuff=42
18624 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18625         echo "Ah, yes!  The good old days!" >&4
18626         echo "However, in the good old days we don't know how to stringify and"
18627         echo "catify at the same time."
18628         cpp_stuff=1
18629 else
18630         $cat >&4 <<EOM
18631 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18632 You're going to have to edit the values of CAT[2-5] in config.h...
18633 EOM
18634         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18635 fi
18636 $rm -f cpp_stuff.*
18637
18638 : see if this is a db.h system
18639 set db.h i_db
18640 eval $inhdr
18641
18642 case "$i_db" in
18643 $define)
18644         : Check db version.
18645         echo " "
18646         echo "Checking Berkeley DB version ..." >&4
18647         $cat >try.c <<EOCP
18648 #$d_const HASCONST
18649 #ifndef HASCONST
18650 #define const
18651 #endif
18652 #include <sys/types.h>
18653 #include <stdio.h>
18654 #$i_stdlib I_STDLIB
18655 #ifdef I_STDLIB
18656 #include <stdlib.h>
18657 #endif
18658 #include <db.h>
18659 int main(int argc, char *argv[])
18660 {
18661 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18662     int Major, Minor, Patch ;
18663     unsigned long Version ;
18664     (void)db_version(&Major, &Minor, &Patch) ;
18665     if (argc == 2) {
18666         printf("%d %d %d %d %d %d\n",
18667                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18668                Major, Minor, Patch);
18669         exit(0);
18670     }
18671     printf("You have Berkeley DB Version 2 or greater.\n");
18672
18673     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18674                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18675     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18676                 Major, Minor, Patch) ;
18677
18678     /* check that db.h & libdb are compatible */
18679     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18680         printf("db.h and libdb are incompatible.\n") ;
18681         exit(3);
18682     }
18683
18684     printf("db.h and libdb are compatible.\n") ;
18685
18686     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18687                 + DB_VERSION_PATCH ;
18688
18689     /* needs to be >= 2.3.4 */
18690     if (Version < 2003004) {
18691     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18692         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18693         exit(2);
18694     }
18695
18696     exit(0);
18697 #else
18698 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18699     if (argc == 2) {
18700         printf("1 0 0\n");
18701         exit(0);
18702     }
18703     printf("You have Berkeley DB Version 1.\n");
18704     exit(0);    /* DB version < 2: the coast is clear. */
18705 #else
18706     exit(1);    /* <db.h> not Berkeley DB? */
18707 #endif
18708 #endif
18709 }
18710 EOCP
18711         set try
18712         if eval $compile_ok && $run ./try; then
18713                 echo 'Looks OK.' >&4
18714                 set `$run ./try 1`
18715                 db_version_major=$1
18716                 db_version_minor=$2
18717                 db_version_patch=$3
18718         else
18719                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18720                 i_db=$undef
18721                 case " $libs " in
18722                 *"-ldb "*)
18723                         : Remove db from list of libraries to use
18724                         echo "Removing unusable -ldb from library list" >&4
18725                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18726                         shift
18727                         libs="$*"
18728                         echo "libs = $libs" >&4
18729                         ;;
18730                 esac
18731         fi
18732         $rm_try
18733         ;;
18734 esac
18735
18736 case "$i_db" in
18737 define)
18738         : Check the return type needed for hash
18739         echo " "
18740         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18741         $cat >try.c <<EOCP
18742 #$d_const HASCONST
18743 #ifndef HASCONST
18744 #define const
18745 #endif
18746 #include <sys/types.h>
18747 #include <db.h>
18748
18749 #ifndef DB_VERSION_MAJOR
18750 u_int32_t hash_cb (ptr, size)
18751 const void *ptr;
18752 size_t size;
18753 {
18754 }
18755 HASHINFO info;
18756 int main()
18757 {
18758         info.hash = hash_cb;
18759 }
18760 #endif
18761 EOCP
18762         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18763                 if $contains warning try.out >>/dev/null 2>&1 ; then
18764                         db_hashtype='int'
18765                 else
18766                         db_hashtype='u_int32_t'
18767                 fi
18768         else
18769                 : XXX Maybe we should just give up here.
18770                 db_hashtype=u_int32_t
18771                 $cat try.out >&4
18772                 echo "Help:  I can't seem to compile the db test program." >&4
18773                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18774         fi
18775         $rm_try
18776         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18777         ;;
18778 *)      db_hashtype=u_int32_t
18779         ;;
18780 esac
18781 case "$i_db" in
18782 define)
18783         : Check the return type needed for prefix
18784         echo " "
18785         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18786         cat >try.c <<EOCP
18787 #$d_const HASCONST
18788 #ifndef HASCONST
18789 #define const
18790 #endif
18791 #include <sys/types.h>
18792 #include <db.h>
18793
18794 #ifndef DB_VERSION_MAJOR
18795 size_t prefix_cb (key1, key2)
18796 const DBT *key1;
18797 const DBT *key2;
18798 {
18799 }
18800 BTREEINFO info;
18801 int main()
18802 {
18803         info.prefix = prefix_cb;
18804 }
18805 #endif
18806 EOCP
18807         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18808                 if $contains warning try.out >>/dev/null 2>&1 ; then
18809                         db_prefixtype='int'
18810                 else
18811                         db_prefixtype='size_t'
18812                 fi
18813         else
18814                 db_prefixtype='size_t'
18815                 : XXX Maybe we should just give up here.
18816                 $cat try.out >&4
18817                 echo "Help:  I can't seem to compile the db test program." >&4
18818                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18819         fi
18820         $rm_try
18821         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18822         ;;
18823 *)      db_prefixtype='size_t'
18824         ;;
18825 esac
18826
18827 : How can we generate normalized random numbers ?
18828 echo " "
18829 echo "Looking for a random number function..." >&4
18830 case "$randfunc" in
18831 '')
18832         if set drand48 val -f; eval $csym; $val; then
18833                 dflt="drand48"
18834                 echo "Good, found drand48()." >&4
18835         elif set random val -f; eval $csym; $val; then
18836                 dflt="random"
18837                 echo "OK, found random()." >&4
18838         else
18839                 dflt="rand"
18840                 echo "Yick, looks like I have to use rand()." >&4
18841         fi
18842         echo " "
18843         ;;
18844 *)
18845         dflt="$randfunc"
18846         ;;
18847 esac
18848 cont=true
18849
18850 case "$ccflags" in
18851 *-Dmy_rand=*|*-Dmy_srand=*)
18852         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18853         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18854         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18855         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18856         ;;
18857 esac
18858
18859 while $test "$cont"; do
18860         rp="Use which function to generate random numbers?"
18861         . ./myread
18862         if $test "$ans" = "$dflt"; then
18863                 : null
18864         else
18865                 randbits=''
18866         fi
18867         randfunc="$ans"
18868         if set $ans val -f; eval $csym; $val; then
18869                 cont=''
18870         else
18871                 dflt=y
18872                 rp="I cannot find function $ans. Use that name anyway?"
18873                 . ./myread
18874                 dflt=rand
18875                 case "$ans" in
18876                         [yY]*) cont='';;
18877                 esac
18878         fi
18879         case "$cont" in
18880         '')
18881                 case "$randfunc" in
18882                 drand48)
18883                         drand01="drand48()"
18884                         seedfunc="srand48"
18885                         randbits=48
18886                         randseedtype=long
18887                         ;;
18888                 rand|random)
18889                         case "$randbits" in
18890                         '')
18891 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18892                                 $cat >try.c <<EOCP
18893 #$i_unistd I_UNISTD
18894 #$i_stdlib I_STDLIB
18895 #include <stdio.h>
18896 #ifdef I_UNISTD
18897 #  include <unistd.h>
18898 #endif
18899 #ifdef I_STDLIB
18900 #  include <stdlib.h>
18901 #endif
18902 int main()
18903 {
18904         register int i;
18905         register unsigned long tmp;
18906         register unsigned long max = 0L;
18907
18908         for (i = 1000; i; i--) {
18909                 tmp = (unsigned long) $randfunc();
18910                 if (tmp > max) max = tmp;
18911         }
18912         for (i = 0; max; i++)
18913                 max /= 2;
18914         printf("%d\n",i);
18915 }
18916 EOCP
18917                                 set try
18918                                 if eval $compile_ok; then
18919                                         dflt=`try`
18920                                 else
18921                                         dflt='?'
18922                                         echo "(I can't seem to compile the test program...)"
18923                                 fi
18924                                 ;;
18925                         *)
18926                                 dflt="$randbits"
18927                                 ;;
18928                         esac
18929                         rp="How many bits does your $randfunc() function produce?"
18930                         . ./myread
18931                         randbits="$ans"
18932                         $rm_try
18933                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18934                         seedfunc="s$randfunc"
18935                         randseedtype=unsigned
18936                         ;;
18937                 *)
18938                         dflt="31"
18939                         rp="How many bits does your $randfunc() function produce?"
18940                         . ./myread
18941                         randbits="$ans"
18942                         seedfunc="s$randfunc"
18943                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18944                         if set $seedfunc val -f; eval $csym; $val; then
18945                                 echo "(Using $seedfunc() to seed random generator)"
18946                         else
18947                                 echo "(Warning: no $seedfunc() to seed random generator)"
18948                                 seedfunc=rand
18949                         fi
18950                         randseedtype=unsigned
18951                         ;;
18952                 esac
18953                 ;;
18954         esac
18955 done
18956
18957 : Determine if this is an EBCDIC system
18958 echo " "
18959 echo "Determining whether or not we are on an EBCDIC system..." >&4
18960 $cat >try.c <<'EOM'
18961 int main()
18962 {
18963   if ('M'==0xd4) return 0;
18964   return 1;
18965 }
18966 EOM
18967
18968 val=$undef
18969 set try
18970 if eval $compile_ok; then
18971         if $run ./try; then
18972                 echo "You seem to speak EBCDIC." >&4
18973                 val="$define"
18974         else
18975                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18976         fi
18977 else
18978         echo "I'm unable to compile the test program." >&4
18979         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18980 fi
18981 $rm_try
18982 set ebcdic
18983 eval $setvar
18984
18985 : Check how to flush
18986 echo " "
18987 $cat >&4 <<EOM
18988 Checking how to flush all pending stdio output...
18989 EOM
18990 # I only know how to find the first 32 possibly open files on SunOS.
18991 # See also hints/sunos_4_1.sh and util.c  --AD
18992 case "$osname" in
18993 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18994 esac
18995 $cat >>try.c <<EOCP
18996 #include <stdio.h>
18997 #$i_stdlib I_STDLIB
18998 #ifdef I_STDLIB
18999 #include <stdlib.h>
19000 #endif
19001 #$i_unistd I_UNISTD
19002 #ifdef I_UNISTD
19003 # include <unistd.h>
19004 #endif
19005 #$d_sysconf HAS_SYSCONF
19006 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19007 #ifdef HAS_STDIO_STREAM_ARRAY
19008 # define STDIO_STREAM_ARRAY $stdio_stream_array
19009 #endif
19010 int main() {
19011   FILE* p;
19012   unlink("try.out");
19013   p = fopen("try.out", "w");
19014 #ifdef TRY_FPUTC
19015   fputc('x', p);
19016 #else
19017 # ifdef TRY_FPRINTF
19018   fprintf(p, "x");
19019 # endif
19020 #endif
19021 #ifdef TRY_FFLUSH_NULL
19022   fflush(NULL);
19023 #endif
19024 #ifdef TRY_FFLUSH_ALL
19025   {
19026     long open_max = -1;
19027 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19028     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19029 # else
19030 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19031     open_max = sysconf(_SC_OPEN_MAX);
19032 #  else
19033 #   ifdef FOPEN_MAX
19034     open_max = FOPEN_MAX;
19035 #   else
19036 #    ifdef OPEN_MAX
19037     open_max = OPEN_MAX;
19038 #    else
19039 #     ifdef _NFILE
19040     open_max = _NFILE;
19041 #     endif
19042 #    endif
19043 #   endif
19044 #  endif
19045 # endif
19046 # ifdef HAS_STDIO_STREAM_ARRAY
19047     if (open_max > 0) {
19048       long i;
19049       for (i = 0; i < open_max; i++)
19050             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19051                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19052                 STDIO_STREAM_ARRAY[i]._flag)
19053                 fflush(&STDIO_STREAM_ARRAY[i]);
19054     }
19055   }
19056 # endif
19057 #endif
19058   _exit(42);
19059 }
19060 EOCP
19061 : first we have to find out how _not_ to flush
19062 $to try.c
19063 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19064     output=''
19065     set try -DTRY_FPUTC
19066     if eval $compile; then
19067             $run ./try 2>/dev/null
19068             code="$?"
19069             $from try.out
19070             if $test ! -s try.out -a "X$code" = X42; then
19071                 output=-DTRY_FPUTC
19072             fi
19073     fi
19074     case "$output" in
19075     '')
19076             set try -DTRY_FPRINTF
19077             if eval $compile; then
19078                     $run ./try 2>/dev/null
19079                     code="$?"
19080                     $from try.out
19081                     if $test ! -s try.out -a "X$code" = X42; then
19082                         output=-DTRY_FPRINTF
19083                     fi
19084             fi
19085         ;;
19086     esac
19087 fi
19088 : check for fflush NULL behaviour
19089 case "$fflushNULL" in
19090 '')     set try -DTRY_FFLUSH_NULL $output
19091         if eval $compile; then
19092                 $run ./try 2>/dev/null
19093                 code="$?"
19094                 $from try.out
19095                 if $test -s try.out -a "X$code" = X42; then
19096                         fflushNULL="`$cat try.out`"
19097                 else
19098                         if $test "X$code" != X42; then
19099                                 $cat >&4 <<EOM
19100 (If this test failed, don't worry, we'll try another method shortly.)
19101 EOM
19102                         fi
19103                 fi
19104         fi
19105         $rm -f core try.core core.try.*
19106         case "$fflushNULL" in
19107         x)      $cat >&4 <<EOM
19108 Your fflush(NULL) works okay for output streams.
19109 Let's see if it clobbers input pipes...
19110 EOM
19111 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19112 # bug that improperly flushes the input end of pipes.  So we avoid the
19113 # autoflush on fork/system/exec support for now. :-(
19114 $cat >tryp.c <<EOCP
19115 #include <stdio.h>
19116 int
19117 main(int argc, char **argv)
19118 {
19119     char buf[1024];
19120     int i;
19121     char *bp = buf;
19122     while (1) {
19123         while ((i = getc(stdin)) != -1
19124                && (*bp++ = i) != '\n'
19125                && bp < &buf[1024])
19126         /* DO NOTHING */ ;
19127         *bp = '\0';
19128         fprintf(stdout, "%s", buf);
19129         fflush(NULL);
19130         if (i == -1)
19131             return 0;
19132         bp = buf;
19133     }
19134 }
19135 EOCP
19136                 fflushNULL="$define"
19137                 set tryp
19138                 if eval $compile; then
19139                     $rm -f tryp.out
19140                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19141                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19142                        $cat >&4 <<EOM
19143 fflush(NULL) seems to behave okay with input streams.
19144 EOM
19145                         fflushNULL="$define"
19146                     else
19147                         $cat >&4 <<EOM
19148 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19149 EOM
19150                         fflushNULL="$undef"
19151                     fi
19152                 fi
19153                 $rm -f core tryp.c tryp.core core.tryp.*
19154                 ;;
19155         '')     $cat >&4 <<EOM
19156 Your fflush(NULL) isn't working (contrary to ANSI C).
19157 EOM
19158                 fflushNULL="$undef"
19159                 ;;
19160         *)      $cat >&4 <<EOM
19161 Cannot figure out whether your fflush(NULL) works or not.
19162 I'm assuming it doesn't (contrary to ANSI C).
19163 EOM
19164                 fflushNULL="$undef"
19165                 ;;
19166         esac
19167         ;;
19168 $define|true|[yY]*)
19169         fflushNULL="$define"
19170         ;;
19171 *)
19172         fflushNULL="$undef"
19173         ;;
19174 esac
19175 : check explicit looping only if NULL did not work, and if the pipe
19176 : bug does not show up on an explicit flush too
19177 case "$fflushNULL" in
19178 "$undef")
19179         $cat >tryp.c <<EOCP
19180 #include <stdio.h>
19181 int
19182 main(int argc, char **argv)
19183 {
19184     char buf[1024];
19185     int i;
19186     char *bp = buf;
19187     while (1) {
19188         while ((i = getc(stdin)) != -1
19189                && (*bp++ = i) != '\n'
19190                && bp < &buf[1024])
19191         /* DO NOTHING */ ;
19192         *bp = '\0';
19193         fprintf(stdout, "%s", buf);
19194         fflush(stdin);
19195         if (i == -1)
19196             return 0;
19197         bp = buf;
19198     }
19199 }
19200 EOCP
19201         set tryp
19202         if eval $compile; then
19203             $rm -f tryp.out
19204             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19205             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19206                $cat >&4 <<EOM
19207 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19208 EOM
19209                 : now check for fflushall behaviour
19210                 case "$fflushall" in
19211                 '')     set try -DTRY_FFLUSH_ALL $output
19212                         if eval $compile; then
19213                                 $cat >&4 <<EOM
19214 (Now testing the other method--but note that this also may fail.)
19215 EOM
19216                                 $run ./try 2>/dev/null
19217                                 code=$?
19218                                 $from try.out
19219                                 if $test -s try.out -a "X$code" = X42; then
19220                                         fflushall="`$cat try.out`"
19221                                 fi
19222                         fi
19223                         $rm_try
19224                         case "$fflushall" in
19225                         x)      $cat >&4 <<EOM
19226 Whew. Flushing explicitly all the stdio streams works.
19227 EOM
19228                                 fflushall="$define"
19229                                 ;;
19230                         '')     $cat >&4 <<EOM
19231 Sigh. Flushing explicitly all the stdio streams doesn't work.
19232 EOM
19233                                 fflushall="$undef"
19234                                 ;;
19235                         *)      $cat >&4 <<EOM
19236 Cannot figure out whether flushing stdio streams explicitly works or not.
19237 I'm assuming it doesn't.
19238 EOM
19239                                 fflushall="$undef"
19240                                 ;;
19241                         esac
19242                         ;;
19243                 "$define"|true|[yY]*)
19244                         fflushall="$define"
19245                         ;;
19246                 *)
19247                         fflushall="$undef"
19248                         ;;
19249                 esac
19250             else
19251                 $cat >&4 <<EOM
19252 All is futile.  Even fflush(stdin) clobbers input pipes!
19253 EOM
19254                 fflushall="$undef"
19255             fi
19256         else
19257             fflushall="$undef"
19258         fi
19259         $rm -f core tryp.c tryp.core core.tryp.*
19260         ;;
19261 *)      fflushall="$undef"
19262         ;;
19263 esac
19264
19265 case "$fflushNULL$fflushall" in
19266 undefundef)
19267         $cat <<EOM
19268 OK, I give up.  I cannot figure out how to flush pending stdio output.
19269 We won't be flushing handles at all before fork/exec/popen.
19270 EOM
19271         ;;
19272 esac
19273 $rm_try tryp
19274
19275 : Store the full pathname to the ar program for use in the C program
19276 : Respect a hint or command line value for full_ar.
19277 case "$full_ar" in
19278 '') full_ar=$ar ;;
19279 esac
19280
19281 : Store the full pathname to the sed program for use in the C program
19282 full_sed=$sed
19283
19284 : see what type gids are declared as in the kernel
19285 echo " "
19286 echo "Looking for the type for group ids returned by getgid()."
19287 set gid_t gidtype xxx stdio.h sys/types.h
19288 eval $typedef
19289 case "$gidtype" in
19290 xxx)
19291         xxx=`./findhdr sys/user.h`
19292         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19293         case $1 in
19294         unsigned) dflt="$1 $2" ;;
19295         *) dflt="$1" ;;
19296         esac
19297         ;;
19298 *) dflt="$gidtype";;
19299 esac
19300 case "$gidtype" in
19301 gid_t) echo "gid_t found." ;;
19302 *)      rp="What is the type for group ids returned by getgid()?"
19303         . ./myread
19304         gidtype="$ans"
19305         ;;
19306 esac
19307
19308 : Check the size of GID
19309 echo " "
19310 case "$gidtype" in
19311 *_t) zzz="$gidtype"     ;;
19312 *)   zzz="gid"          ;;
19313 esac
19314 echo "Checking the size of $zzz..." >&4
19315 cat > try.c <<EOCP
19316 #include <sys/types.h>
19317 #include <stdio.h>
19318 #$i_stdlib I_STDLIB
19319 #ifdef I_STDLIB
19320 #include <stdlib.h>
19321 #endif
19322 int main() {
19323     printf("%d\n", (int)sizeof($gidtype));
19324     exit(0);
19325 }
19326 EOCP
19327 set try
19328 if eval $compile_ok; then
19329         yyy=`$run ./try`
19330         case "$yyy" in
19331         '')     gidsize=4
19332                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19333                 ;;
19334         *)      gidsize=$yyy
19335                 echo "Your $zzz is $gidsize bytes long."
19336                 ;;
19337         esac
19338 else
19339         gidsize=4
19340         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19341 fi
19342
19343
19344 : Check if GID is signed
19345 echo " "
19346 case "$gidtype" in
19347 *_t) zzz="$gidtype"     ;;
19348 *)   zzz="gid"          ;;
19349 esac
19350 echo "Checking the sign of $zzz..." >&4
19351 cat > try.c <<EOCP
19352 #include <sys/types.h>
19353 #include <stdio.h>
19354 int main() {
19355         $gidtype foo = -1;
19356         if (foo < 0)
19357                 printf("-1\n");
19358         else
19359                 printf("1\n");
19360 }
19361 EOCP
19362 set try
19363 if eval $compile; then
19364         yyy=`$run ./try`
19365         case "$yyy" in
19366         '')     gidsign=1
19367                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19368                 ;;
19369         *)      gidsign=$yyy
19370                 case "$gidsign" in
19371                  1) echo "Your $zzz is unsigned." ;;
19372                 -1) echo "Your $zzz is signed."   ;;
19373                 esac
19374                 ;;
19375         esac
19376 else
19377         gidsign=1
19378         echo "(I can't compile the test program--guessing unsigned.)" >&4
19379 fi
19380
19381
19382 : Check 64bit sizes
19383 echo " "
19384
19385 if $test X"$quadtype" != X; then
19386
19387 echo "Checking how to print 64-bit integers..." >&4
19388
19389 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19390         $cat >try.c <<'EOCP'
19391 #include <sys/types.h>
19392 #include <stdio.h>
19393 int main() {
19394   int q = 12345678901;
19395   printf("%ld\n", q);
19396 }
19397 EOCP
19398         set try
19399         if eval $compile; then
19400                 yyy=`$run ./try`
19401                 case "$yyy" in
19402                 12345678901)
19403                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19404                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19405                         echo "We will use %d."
19406                         ;;
19407                 esac
19408         fi
19409 fi
19410
19411 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19412         $cat >try.c <<'EOCP'
19413 #include <sys/types.h>
19414 #include <stdio.h>
19415 int main() {
19416   long q = 12345678901;
19417   printf("%ld\n", q);
19418 }
19419 EOCP
19420         set try
19421         if eval $compile; then
19422                 yyy=`$run ./try`
19423                 case "$yyy" in
19424                 12345678901)
19425                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19426                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19427                         echo "We will use %ld."
19428                         ;;
19429                 esac
19430         fi
19431 fi
19432
19433 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19434         $cat >try.c <<'EOCP'
19435 #include <sys/types.h>
19436 #include <inttypes.h>
19437 #include <stdio.h>
19438 int main() {
19439   int64_t q = 12345678901;
19440   printf("%" PRId64 "\n", q);
19441 }
19442 EOCP
19443         set try
19444         if eval $compile; then
19445                 yyy=`$run ./try`
19446                 case "$yyy" in
19447                 12345678901)
19448                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19449                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19450                         echo "We will use the C9X style."
19451                         ;;
19452                 esac
19453         fi
19454 fi
19455
19456 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19457         $cat >try.c <<EOCP
19458 #include <sys/types.h>
19459 #include <stdio.h>
19460 int main() {
19461   $quadtype q = 12345678901;
19462   printf("%Ld\n", q);
19463 }
19464 EOCP
19465         set try
19466         if eval $compile; then
19467                 yyy=`$run ./try`
19468                 case "$yyy" in
19469                 12345678901)
19470                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19471                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19472                         echo "We will use %Ld."
19473                         ;;
19474                 esac
19475         fi
19476 fi
19477
19478 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19479         $cat >try.c <<'EOCP'
19480 #include <sys/types.h>
19481 #include <stdio.h>
19482 int main() {
19483   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19484   printf("%lld\n", q);
19485 }
19486 EOCP
19487         set try
19488         if eval $compile; then
19489                 yyy=`$run ./try`
19490                 case "$yyy" in
19491                 12345678901)
19492                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19493                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19494                         echo "We will use the %lld style."
19495                         ;;
19496                 esac
19497         fi
19498 fi
19499
19500 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19501         $cat >try.c <<EOCP
19502 #include <sys/types.h>
19503 #include <stdio.h>
19504 int main() {
19505   $quadtype q = 12345678901;
19506   printf("%qd\n", q);
19507 }
19508 EOCP
19509         set try
19510         if eval $compile; then
19511                 yyy=`$run ./try`
19512                 case "$yyy" in
19513                 12345678901)
19514                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19515                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19516                         echo "We will use %qd."
19517                         ;;
19518                 esac
19519         fi
19520 fi
19521
19522 if $test X"$sPRId64" = X; then
19523         echo "Cannot figure out how to print 64-bit integers." >&4
19524 fi
19525 $rm_try
19526
19527 fi
19528
19529 case "$sPRId64" in
19530 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19531         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19532         ;;
19533 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19534         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19535         ;;
19536 esac
19537
19538 : Check format strings for internal types
19539 echo " "
19540 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19541
19542 if $test X"$ivsize" = X8; then
19543         ivdformat="$sPRId64"
19544         uvuformat="$sPRIu64"
19545         uvoformat="$sPRIo64"
19546         uvxformat="$sPRIx64"
19547         uvXUformat="$sPRIXU64"
19548 else
19549         if $test X"$ivsize" = X"$longsize"; then
19550                 ivdformat='"ld"'
19551                 uvuformat='"lu"'
19552                 uvoformat='"lo"'
19553                 uvxformat='"lx"'
19554                 uvXUformat='"lX"'
19555         else
19556                 if $test X"$ivsize" = X"$intsize"; then
19557                         ivdformat='"d"'
19558                         uvuformat='"u"'
19559                         uvoformat='"o"'
19560                         uvxformat='"x"'
19561                         uvXUformat='"X"'
19562                 else
19563                         : far out
19564                         if $test X"$ivsize" = X"$shortsize"; then
19565                                 ivdformat='"hd"'
19566                                 uvuformat='"hu"'
19567                                 uvoformat='"ho"'
19568                                 uvxformat='"hx"'
19569                                 uvXUformat='"hX"'
19570                         fi
19571                 fi
19572         fi
19573 fi
19574
19575 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19576         nveformat="$sPRIeldbl"
19577         nvfformat="$sPRIfldbl"
19578         nvgformat="$sPRIgldbl"
19579         nvEUformat="$sPRIEUldbl"
19580         nvFUformat="$sPRIFUldbl"
19581         nvGUformat="$sPRIGUldbl"
19582 else
19583         nveformat='"e"'
19584         nvfformat='"f"'
19585         nvgformat='"g"'
19586         nvEUformat='"E"'
19587         nvFUformat='"F"'
19588         nvGUformat='"G"'
19589 fi
19590
19591 case "$ivdformat" in
19592 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19593     exit 1
19594     ;;
19595 esac
19596
19597 : Check format string for GID
19598
19599 echo " "
19600 $echo "Checking the format string to be used for gids..." >&4
19601
19602 case "$gidsign" in
19603 -1)     if $test X"$gidsize" = X"$ivsize"; then
19604                 gidformat="$ivdformat"
19605         else
19606                 if $test X"$gidsize" = X"$longsize"; then
19607                         gidformat='"ld"'
19608                 else
19609                         if $test X"$gidsize" = X"$intsize"; then
19610                                 gidformat='"d"'
19611                         else
19612                                 if $test X"$gidsize" = X"$shortsize"; then
19613                                         gidformat='"hd"'
19614                                 fi
19615                         fi
19616                 fi
19617         fi
19618         ;;
19619 *)      if $test X"$gidsize" = X"$uvsize"; then
19620                 gidformat="$uvuformat"
19621         else
19622                 if $test X"$gidsize" = X"$longsize"; then
19623                         gidformat='"lu"'
19624                 else
19625                         if $test X"$gidsize" = X"$intsize"; then
19626                                 gidformat='"u"'
19627                         else
19628                                 if $test X"$gidsize" = X"$shortsize"; then
19629                                         gidformat='"hu"'
19630                                 fi
19631                         fi
19632                 fi
19633         fi
19634         ;;
19635 esac
19636
19637 : see if getgroups exists
19638 set getgroups d_getgrps
19639 eval $inlibc
19640
19641 : see if setgroups exists
19642 set setgroups d_setgrps
19643 eval $inlibc
19644
19645 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19646 echo " "
19647 case "$d_getgrps$d_setgrps" in
19648 *define*)
19649         case "$groupstype" in
19650         '') dflt="$gidtype" ;;
19651         *)  dflt="$groupstype" ;;
19652         esac
19653         $cat <<EOM
19654 What type of pointer is the second argument to getgroups() and setgroups()?
19655 Usually this is the same as group ids, $gidtype, but not always.
19656
19657 EOM
19658         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19659         . ./myread
19660         groupstype="$ans"
19661         ;;
19662 *)  groupstype="$gidtype";;
19663 esac
19664
19665 : MAD = Misc Attribute Definition
19666
19667 if $test $patchlevel -lt 9; then
19668 : MAD is not available in 5.8.x or earlier.
19669     ans=n;
19670 else
19671     case "$mad" in
19672     $define|true|[yY]*) dflt='y' ;;
19673     *)                  dflt='n' ;;
19674     esac
19675     cat <<EOM
19676
19677 Would you like to build with Misc Attribute Decoration? This is development
19678 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19679 overhead on the interpreter.
19680
19681 If this doesn't make any sense to you, just accept the default '$dflt'.
19682 EOM
19683     rp='Build Perl with MAD?'
19684     . ./myread
19685 fi
19686 case "$ans" in
19687 y|Y)    val="$define"
19688         madlyh='madly.h madly.act madly.tab'
19689         madlysrc='madly.c'
19690         madlyobj="madly$_o" ;;
19691 *)      val="$undef"
19692         madlyh=''
19693         madlysrc=''
19694         madlyobj='' ;;
19695 esac
19696 set mad
19697 eval $setvar
19698
19699 : check whether make sets MAKE
19700 echo " "
19701 echo "Checking if your $make program sets \$(MAKE)..." >&4
19702 case "$make_set_make" in
19703 '')
19704         $sed 's/^X //' > testmake.mak << 'EOF'
19705 Xall:
19706 X       @echo 'maketemp="$(MAKE)"'
19707 EOF
19708         case "`$make -f testmake.mak 2>/dev/null`" in
19709         *maketemp=*) make_set_make='#' ;;
19710         *)      make_set_make="MAKE=$make" ;;
19711         esac
19712         $rm -f testmake.mak
19713         ;;
19714 esac
19715 case "$make_set_make" in
19716 '#') echo "Yup, it does.";;
19717 *) echo "Nope, it doesn't.";;
19718 esac
19719
19720 : see what type is used for mode_t
19721 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19722 set mode_t modetype int stdio.h sys/types.h
19723 eval $typedef_ask
19724
19725 : see if we need va_copy
19726 echo " "
19727 case "$i_stdarg" in
19728 "$define")
19729         $cat >try.c <<EOCP
19730 #include <stdarg.h>
19731 #include <stdio.h>
19732 #$i_stdlib I_STDLIB
19733 #ifdef I_STDLIB
19734 #include <stdlib.h>
19735 #endif
19736 #include <signal.h>
19737
19738 int
19739 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19740 {
19741   return vfprintf(f, fmt, *valp);
19742 }
19743
19744 int
19745 myvfprintf(FILE *f, const  char *fmt, va_list val)
19746 {
19747   return ivfprintf(f, fmt, &val);
19748 }
19749
19750 int
19751 myprintf(char *fmt, ...)
19752 {
19753   va_list val;
19754   va_start(val, fmt);
19755   return myvfprintf(stdout, fmt, val);
19756 }
19757
19758 int
19759 main(int ac, char **av)
19760 {
19761   signal(SIGSEGV, exit);
19762
19763   myprintf("%s%cs all right, then\n", "that", '\'');
19764   exit(0);
19765 }
19766 EOCP
19767         set try
19768         if eval $compile && $run ./try 2>&1 >/dev/null; then
19769                 case "`$run ./try`" in
19770                 "that's all right, then")
19771                         okay=yes
19772                         ;;
19773                 esac
19774         fi
19775         case "$okay" in
19776         yes)    echo "It seems that you don't need va_copy()." >&4
19777                 need_va_copy="$undef"
19778                 ;;
19779         *)      echo "It seems that va_copy() or similar will be needed." >&4
19780                 need_va_copy="$define"
19781                 ;;
19782         esac
19783         $rm_try
19784         ;;
19785 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19786         ;;
19787 esac
19788
19789 : see what type is used for size_t
19790 rp="What is the type used for the length parameter for string functions?"
19791 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19792 eval $typedef_ask
19793
19794 : check for type of arguments to gethostbyaddr. 
19795 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19796         case "$d_gethbyaddr" in
19797         $define)
19798                 $cat <<EOM
19799
19800 Checking to see what type of arguments are accepted by gethostbyaddr().
19801 EOM
19802                 hdrs="$define sys/types.h
19803                         $d_socket sys/socket.h 
19804                         $i_niin netinet/in.h 
19805                         $i_netdb netdb.h
19806                         $i_unistd unistd.h"
19807                 : The first arg can 'char *' or 'void *'
19808                 : The second arg is some of integral type
19809                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19810                         for yyy in size_t long int; do
19811                                 case "$netdb_host_type" in
19812                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19813                                         if ./protochk "$try" $hdrs; then
19814                                                 echo "Your system accepts $xxx for the first arg."
19815                                                 echo "...and $yyy for the second arg."
19816                                                 netdb_host_type="$xxx"
19817                                                 netdb_hlen_type="$yyy"
19818                                         fi
19819                                         ;;
19820                                 esac
19821                         done
19822                 done
19823                 : In case none of those worked, prompt the user.
19824                 case "$netdb_host_type" in
19825                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19826                         dflt='char *'
19827                         . ./myread
19828                         netdb_host_type=$ans
19829                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19830                         dflt="$sizetype"
19831                         . ./myread
19832                         netdb_hlen_type=$ans
19833                         ;;
19834                 esac
19835                 ;;
19836         *)      : no gethostbyaddr, so pick harmless defaults
19837                 netdb_host_type='char *'
19838                 netdb_hlen_type="$sizetype"
19839                 ;;
19840         esac
19841         # Remove the "const" if needed. -- but then we'll have a 
19842         # prototype clash!
19843         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19844 fi
19845
19846 : check for type of argument to gethostbyname. 
19847 if test "X$netdb_name_type" = X ; then
19848         case "$d_gethbyname" in
19849         $define)
19850                 $cat <<EOM
19851
19852 Checking to see what type of argument is accepted by gethostbyname().
19853 EOM
19854                 hdrs="$define sys/types.h
19855                         $d_socket sys/socket.h 
19856                         $i_niin netinet/in.h 
19857                         $i_netdb netdb.h
19858                         $i_unistd unistd.h"
19859                 for xxx in "const char *" "char *"; do
19860                         case "$netdb_name_type" in
19861                         '')     try="extern struct hostent *gethostbyname($xxx);"
19862                                 if ./protochk "$try" $hdrs; then
19863                                         echo "Your system accepts $xxx."
19864                                         netdb_name_type="$xxx"
19865                                 fi
19866                                 ;;
19867                         esac
19868                 done
19869                 : In case none of those worked, prompt the user.
19870                 case "$netdb_name_type" in
19871                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19872                         dflt='char *'
19873                         . ./myread
19874                         netdb_name_type=$ans
19875                         ;;
19876                 esac
19877                 ;;
19878         *)      : no gethostbyname, so pick harmless default
19879                 netdb_name_type='char *'
19880                 ;;
19881         esac
19882 fi
19883
19884 : check for type of 1st argument to getnetbyaddr. 
19885 if test "X$netdb_net_type" = X ; then
19886         case "$d_getnbyaddr" in
19887         $define)
19888                 $cat <<EOM
19889
19890 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19891 EOM
19892                 hdrs="$define sys/types.h
19893                         $d_socket sys/socket.h 
19894                         $i_niin netinet/in.h 
19895                         $i_netdb netdb.h
19896                         $i_unistd unistd.h"
19897                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19898                         case "$netdb_net_type" in
19899                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19900                                 if ./protochk "$try" $hdrs; then
19901                                         echo "Your system accepts $xxx."
19902                                         netdb_net_type="$xxx"
19903                                 fi
19904                                 ;;
19905                         esac
19906                 done
19907                 : In case none of those worked, prompt the user.
19908                 case "$netdb_net_type" in
19909                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19910                         dflt='long'
19911                         . ./myread
19912                         netdb_net_type=$ans
19913                         ;;
19914                 esac
19915                 ;;
19916         *)      : no getnetbyaddr, so pick harmless default
19917                 netdb_net_type='long'
19918                 ;;
19919         esac
19920 fi
19921 : locate the preferred pager for this system
19922 fn=f/
19923 case "$pager" in
19924 '')
19925         dflt=''
19926         case "$pg" in
19927         /*) dflt=$pg;;
19928         [a-zA-Z]:/*) dflt=$pg;;
19929         esac
19930         case "$more" in
19931         /*) dflt=$more;;
19932         [a-zA-Z]:/*) dflt=$more;;
19933         esac
19934         case "$less" in
19935         /*) dflt=$less;;
19936         [a-zA-Z]:/*) dflt=$less;;
19937         esac
19938         case "$dflt" in
19939         '') dflt=/usr/ucb/more;;
19940         esac
19941         ;;
19942 *)      dflt="$pager"
19943         fn="f/($pager)"
19944         ;;
19945 esac
19946 echo " "
19947 rp='What pager is used on your system?'
19948 . ./getfile
19949 pager="$ans"
19950
19951 : see what type pids are declared as in the kernel
19952 rp="What is the type of process ids on this system?"
19953 set pid_t pidtype int stdio.h sys/types.h
19954 eval $typedef_ask
19955
19956 : see if ar generates random libraries by itself
19957 echo " "
19958 echo "Checking how to generate random libraries on your machine..." >&4
19959 echo 'int bar1() { return bar2(); }' > bar1.c
19960 echo 'int bar2() { return 2; }' > bar2.c
19961 $cat > foo.c <<EOP
19962 #$i_stdlib I_STDLIB
19963 #ifdef I_STDLIB
19964 #include <stdlib.h>
19965 #endif
19966 int main() { printf("%d\n", bar1()); exit(0); }
19967 EOP
19968 $cc $ccflags -c bar1.c >/dev/null 2>&1
19969 $cc $ccflags -c bar2.c >/dev/null 2>&1
19970 $cc $ccflags -c foo.c >/dev/null 2>&1
19971 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19972 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19973         $run ./foobar >/dev/null 2>&1; then
19974         echo "$ar appears to generate random libraries itself."
19975         orderlib=false
19976         if [ "X$ranlib" = "X" ]; then
19977             ranlib=":"
19978         fi
19979 elif $ar s bar$_a >/dev/null 2>&1 &&
19980         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19981         $run ./foobar >/dev/null 2>&1; then
19982                 echo "a table of contents needs to be added with '$ar s'."
19983                 orderlib=false
19984                 ranlib="$ar s"
19985 elif $ar ts bar$_a >/dev/null 2>&1 &&
19986         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19987         $run ./foobar >/dev/null 2>&1; then
19988                 echo "a table of contents needs to be added with '$ar ts'."
19989                 orderlib=false
19990                 ranlib="$ar ts"
19991 else
19992         case "$ranlib" in
19993         :) ranlib='';;
19994         '')
19995                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19996                 $test -f $ranlib || ranlib=''
19997                 ;;
19998         esac
19999         if $test -n "$ranlib"; then
20000                 echo "your system has '$ranlib'; we'll use that."
20001                 orderlib=false
20002         else
20003                 echo "your system doesn't seem to support random libraries"
20004                 echo "so we'll use lorder and tsort to order the libraries."
20005                 orderlib=true
20006                 ranlib=":"
20007         fi
20008 fi
20009 $rm -f foo* bar*
20010
20011 : Check the max offset that gmtime accepts
20012 echo "Checking max offset that gmtime () accepts"
20013
20014 $cat >try.c <<'EOCP'
20015 #include <sys/types.h>
20016 #include <stdio.h>
20017 #include <time.h>
20018 int main () {
20019   struct tm *tmp;
20020   int i, y = 0;
20021   time_t pt = 0;
20022
20023   for (i = 0; i < 78; i++) {
20024     time_t t = ((time_t)1 << i) - 1;
20025     tmp = gmtime (&t);
20026     if (tmp == NULL || tmp->tm_year < y) {
20027       i--;
20028       printf ("%ld\n", pt);
20029       return (i);
20030       }
20031
20032     y = tmp->tm_year;
20033     pt = t;
20034     }
20035   printf ("%ld\n", pt);
20036   return (0);
20037   }
20038 EOCP
20039 set try
20040 if eval $compile; then
20041     sGMTIME_max=`$run ./try`
20042 else
20043     echo "Cannot determine sGMTIME_max"
20044     fi
20045 $rm_try
20046
20047 echo "Checking min offset that gmtime () accepts"
20048
20049 $cat >try.c <<'EOCP'
20050 #include <sys/types.h>
20051 #include <stdio.h>
20052 #include <time.h>
20053 int main () {
20054   struct tm *tmp;
20055   int i, y = 70;
20056   time_t pt = 0;
20057
20058   for (i = 0; i < 78; i++) {
20059     time_t t = - ((time_t)1 << i);
20060     tmp = gmtime (&t);
20061     if (tmp == NULL || tmp->tm_year > y) {
20062       i--;
20063       printf ("%ld\n", pt);
20064       return (i);
20065       }
20066
20067     y = tmp->tm_year;
20068     pt = t;
20069     }
20070   printf ("%ld\n", pt);
20071   return (0);
20072   }
20073 EOCP
20074 set try
20075 if eval $compile; then
20076     sGMTIME_min=`$run ./try`
20077 else
20078     echo "Cannot determine sGMTIME_min"
20079     fi
20080 $rm_try
20081
20082 : check for type of arguments to select.
20083 case "$selecttype" in
20084 '') case "$d_select" in
20085         $define)
20086                 echo " "
20087                 $cat <<EOM
20088 Checking to see what type of arguments are accepted by select().
20089 EOM
20090                 hdrs="$define sys/types.h
20091                         $i_systime sys/time.h
20092                         $i_sysselct sys/select.h
20093                         $d_socket sys/socket.h"
20094                 : The first arg can be int, unsigned, or size_t
20095                 : The last arg may or may not be 'const'
20096                 val=''
20097                 : void pointer has been seen but using that
20098                 : breaks the selectminbits test
20099                 for xxx in 'fd_set *' 'int *'; do
20100                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20101                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20102                                         case "$val" in
20103                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20104                                                 if ./protochk "$try" $hdrs; then
20105                                                         echo "Your system accepts $xxx."
20106                                                         val="$xxx"
20107                                                 fi
20108                                                 ;;
20109                                         esac
20110                                 done
20111                         done
20112                 done
20113                 case "$val" in
20114                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20115                         case "$d_fd_set" in
20116                                 $define) dflt="fd_set *" ;;
20117                                 *)              dflt="int *" ;;
20118                         esac
20119                         . ./myread
20120                         val=$ans
20121                         ;;
20122                 esac
20123                 selecttype="$val"
20124                 ;;
20125         *)      : no select, so pick a harmless default
20126                 selecttype='int *'
20127                 ;;
20128         esac
20129         ;;
20130 esac
20131
20132 : check for the select 'width'
20133 case "$selectminbits" in
20134 '') safebits=`expr $ptrsize \* 8`
20135     case "$d_select" in
20136         $define)
20137                 $cat <<EOM
20138
20139 Checking to see on how many bits at a time your select() operates...
20140 EOM
20141                 $cat >try.c <<EOCP
20142 #include <sys/types.h>
20143 #$i_time I_TIME
20144 #$i_systime I_SYS_TIME
20145 #$i_systimek I_SYS_TIME_KERNEL
20146 #ifdef I_TIME
20147 #   include <time.h>
20148 #endif
20149 #ifdef I_SYS_TIME
20150 #   ifdef I_SYS_TIME_KERNEL
20151 #       define KERNEL
20152 #   endif
20153 #   include <sys/time.h>
20154 #   ifdef I_SYS_TIME_KERNEL
20155 #       undef KERNEL
20156 #   endif
20157 #endif
20158 #$i_sysselct I_SYS_SELECT
20159 #ifdef I_SYS_SELECT
20160 #include <sys/select.h>
20161 #endif
20162 #$d_socket HAS_SOCKET
20163 #ifdef HAS_SOCKET
20164 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20165 #endif
20166 #include <stdio.h>
20167 #$i_stdlib I_STDLIB
20168 #ifdef I_STDLIB
20169 #include <stdlib.h>
20170 #endif
20171 $selecttype b;
20172 #define S sizeof(*(b))
20173 #define MINBITS 64
20174 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20175 #define NBITS  (NBYTES * 8)
20176 int main() {
20177     char *s = (char *)malloc(NBYTES);
20178     struct timeval t;
20179     int i;
20180     FILE* fp;
20181     int fd;
20182
20183     if (!s)
20184         exit(1);
20185     fclose(stdin);
20186     fp = fopen("try.c", "r");
20187     if (fp == 0)
20188       exit(2);
20189     fd = fileno(fp);
20190     if (fd < 0)
20191       exit(3);
20192     b = ($selecttype)s;
20193     for (i = 0; i < NBITS; i++)
20194         FD_SET(i, b);
20195     t.tv_sec  = 0;
20196     t.tv_usec = 0;
20197     select(fd + 1, b, 0, 0, &t);
20198     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20199     free(s);
20200     printf("%d\n", i + 1);
20201     return 0;
20202 }
20203 EOCP
20204                 set try
20205                 if eval $compile_ok; then
20206                         selectminbits=`$run ./try`
20207                         case "$selectminbits" in
20208                         '')     cat >&4 <<EOM
20209 Cannot figure out on how many bits at a time your select() operates.
20210 I'll play safe and guess it is $safebits bits.
20211 EOM
20212                                 selectminbits=$safebits
20213                                 bits="$safebits bits"
20214                                 ;;
20215                         1)      bits="1 bit" ;;
20216                         *)      bits="$selectminbits bits" ;;
20217                         esac
20218                         echo "Your select() operates on $bits at a time." >&4
20219                 else
20220                         rp='What is the minimum number of bits your select() operates on?'
20221                         case "$byteorder" in
20222                         12345678)       dflt=64 ;;
20223                         1234)           dflt=32 ;;
20224                         *)              dflt=1  ;;
20225                         esac
20226                         . ./myread
20227                         val=$ans
20228                         selectminbits="$val"
20229                 fi
20230                 $rm_try
20231                 ;;
20232         *)      : no select, so pick a harmless default
20233                 selectminbits=$safebits
20234                 ;;
20235         esac
20236         ;;
20237 esac
20238
20239 : Trace out the files included by signal.h, then look for SIGxxx names.
20240 if [ "X$fieldn" = X ]; then
20241         : Just make some guesses.  We check them later.
20242         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20243 else
20244         xxx=`echo '#include <signal.h>' |
20245         $cppstdin $cppminus $cppflags 2>/dev/null |
20246         $grep '^[       ]*#.*include' |
20247         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20248                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20249 fi
20250 xxxfiles=''
20251 for xx in $xxx /dev/null ; do
20252         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20253 done
20254 case "$xxxfiles" in
20255 '')     xxxfiles=`./findhdr signal.h` ;;
20256 esac
20257 xxx=`awk '
20258 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20259         print substr($2, 4, 20)
20260 }
20261 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20262         print substr($3, 4, 20)
20263 }' $xxxfiles`
20264 : Append some common names just in case the awk scan failed.
20265 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20266 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20267 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20268 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20269 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20270
20271 : generate a few handy files for later
20272 $cat > signal.c <<EOCP
20273 #include <sys/types.h>
20274 #include <signal.h>
20275 #$i_stdlib I_STDLIB
20276 #ifdef I_STDLIB
20277 #include <stdlib.h>
20278 #endif
20279 #include <stdio.h>
20280 int main() {
20281
20282 /* Strange style to avoid deeply-nested #if/#else/#endif */
20283 #ifndef NSIG
20284 #  ifdef _NSIG
20285 #    define NSIG (_NSIG)
20286 #  endif
20287 #endif
20288
20289 #ifndef NSIG
20290 #  ifdef SIGMAX
20291 #    define NSIG (SIGMAX+1)
20292 #  endif
20293 #endif
20294
20295 #ifndef NSIG
20296 #  ifdef SIG_MAX
20297 #    define NSIG (SIG_MAX+1)
20298 #  endif
20299 #endif
20300
20301 #ifndef NSIG
20302 #  ifdef _SIG_MAX
20303 #    define NSIG (_SIG_MAX+1)
20304 #  endif
20305 #endif
20306
20307 #ifndef NSIG
20308 #  ifdef MAXSIG
20309 #    define NSIG (MAXSIG+1)
20310 #  endif
20311 #endif
20312
20313 #ifndef NSIG
20314 #  ifdef MAX_SIG
20315 #    define NSIG (MAX_SIG+1)
20316 #  endif
20317 #endif
20318
20319 #ifndef NSIG
20320 #  ifdef SIGARRAYSIZE
20321 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20322 #  endif
20323 #endif
20324
20325 #ifndef NSIG
20326 #  ifdef _sys_nsig
20327 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20328 #  endif
20329 #endif
20330
20331 /* Default to some arbitrary number that's big enough to get most
20332    of the common signals.
20333 */
20334 #ifndef NSIG
20335 #    define NSIG 50
20336 #endif
20337
20338 printf("NSIG %d\n", NSIG);
20339
20340 #ifndef JUST_NSIG
20341
20342 EOCP
20343
20344 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20345 {
20346         printf "#ifdef SIG"; printf $1; printf "\n"
20347         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20348         printf $1; printf ");\n"
20349         printf "#endif\n"
20350 }
20351 END {
20352         printf "#endif /* JUST_NSIG */\n";
20353         printf "exit(0);\n}\n";
20354 }
20355 ' >>signal.c
20356 $cat >signal.awk <<'EOP'
20357 BEGIN { ndups = 0 }
20358 $1 ~ /^NSIG$/ { nsig = $2 }
20359 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20360     if ($2 > maxsig) { maxsig = $2 }
20361     if (sig_name[$2]) {
20362         dup_name[ndups] = $1
20363         dup_num[ndups] = $2
20364         ndups++
20365     }
20366     else {
20367         sig_name[$2] = $1
20368         sig_num[$2] = $2
20369     }
20370 }
20371 END {
20372     if (nsig == 0) {
20373         nsig = maxsig + 1
20374     }
20375     printf("NSIG %d\n", nsig);
20376     for (n = 1; n < nsig; n++) {
20377         if (sig_name[n]) {
20378             printf("%s %d\n", sig_name[n], sig_num[n])
20379         }
20380         else {
20381             printf("NUM%d %d\n", n, n)
20382         }
20383     }
20384     for (n = 0; n < ndups; n++) {
20385         printf("%s %d\n", dup_name[n], dup_num[n])
20386     }
20387 }
20388 EOP
20389 $cat >signal_cmd <<EOS
20390 $startsh
20391 if $test -s signal.lst; then
20392     echo "Using your existing signal.lst file"
20393         exit 0
20394 fi
20395 xxx="$xxx"
20396 EOS
20397 $cat >>signal_cmd <<'EOS'
20398
20399 set signal
20400 if eval $compile_ok; then
20401         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20402                 $uniq | $awk -f signal.awk >signal.lst
20403 else
20404         echo "(I can't seem be able to compile the whole test program)" >&4
20405         echo "(I'll try it in little pieces.)" >&4
20406         set signal -DJUST_NSIG
20407         if eval $compile_ok; then
20408                 $run ./signal$_exe > signal.nsg
20409                 $cat signal.nsg
20410         else
20411                 echo "I can't seem to figure out how many signals you have." >&4
20412                 echo "Guessing 50." >&4
20413                 echo 'NSIG 50' > signal.nsg
20414         fi
20415         : Now look at all the signal names, one at a time.
20416         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20417                 $cat > signal.c <<EOCP
20418 #include <sys/types.h>
20419 #include <signal.h>
20420 #include <stdio.h>
20421 int main() {
20422 printf("$xx %d\n", SIG${xx});
20423 return 0;
20424 }
20425 EOCP
20426                 set signal
20427                 if eval $compile; then
20428                         echo "SIG${xx} found."
20429                         $run ./signal$_exe  >> signal.ls1
20430                 else
20431                         echo "SIG${xx} NOT found."
20432                 fi
20433         done
20434         if $test -s signal.ls1; then
20435                 $cat signal.nsg signal.ls1 |
20436                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20437         fi
20438
20439 fi
20440 if $test -s signal.lst; then
20441         :
20442 else
20443         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20444         echo 'kill -l' >signal
20445         set X `csh -f <signal`
20446         $rm -f signal
20447         shift
20448         case $# in
20449         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20450         esac
20451         echo $@ | $tr ' ' $trnl | \
20452             $awk '{ printf "%s %d\n", $1, ++s; }
20453                   END { printf "NSIG %d\n", ++s }' >signal.lst
20454 fi
20455 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20456 EOS
20457 chmod a+x signal_cmd
20458 $eunicefix signal_cmd
20459
20460 : generate list of signal names
20461 echo " "
20462 case "$sig_name_init" in
20463 '') doinit=yes ;;
20464 *)  case "$sig_num_init" in
20465     ''|*,*) doinit=yes ;;
20466     esac ;;
20467 esac
20468 case "$doinit" in
20469 yes)
20470         echo "Generating a list of signal names and numbers..." >&4
20471         . ./signal_cmd
20472         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20473         sig_name=`$awk 'BEGIN { printf "ZERO " }
20474                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20475         sig_num=`$awk  'BEGIN { printf "0 " }
20476                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20477         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20478                              !/^NSIG/   { printf "\"%s\", ", $1 }
20479                              END        { printf "0\n" }' signal.lst`
20480         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20481                              !/^NSIG/   { printf "%d, ", $2}
20482                              END        { printf "0\n"}' signal.lst`
20483         ;;
20484 esac
20485 echo "The following $sig_count signals are available:"
20486 echo " "
20487 echo $sig_name | $awk \
20488 'BEGIN { linelen = 0 }
20489 {
20490         for (i = 1; i <= NF; i++) {
20491                 name = "SIG" $i " "
20492                 linelen = linelen + length(name)
20493                 if (linelen > 70) {
20494                         printf "\n"
20495                         linelen = length(name)
20496                 }
20497                 printf "%s", name
20498         }
20499         printf "\n"
20500 }'
20501 sig_size=`echo $sig_name | awk '{print NF}'`
20502 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20503
20504 : Check size of size
20505 echo " "
20506 case "$sizetype" in
20507 *_t) zzz="$sizetype"    ;;
20508 *)   zzz="filesize"     ;;
20509 esac
20510 echo "Checking the size of $zzz..." >&4
20511 cat > try.c <<EOCP
20512 #include <sys/types.h>
20513 #include <stdio.h>
20514 #$i_stdlib I_STDLIB
20515 #ifdef I_STDLIB
20516 #include <stdlib.h>
20517 #endif
20518 int main() {
20519     printf("%d\n", (int)sizeof($sizetype));
20520     exit(0);
20521 }
20522 EOCP
20523 set try
20524 if eval $compile_ok; then
20525         yyy=`$run ./try`
20526         case "$yyy" in
20527         '')     sizesize=4
20528                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20529                 ;;
20530         *)      sizesize=$yyy
20531                 echo "Your $zzz size is $sizesize bytes."
20532                 ;;
20533         esac
20534 else
20535         sizesize=4
20536         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20537 fi
20538
20539
20540 : check for socklen_t
20541 echo " "
20542 echo "Checking to see if you have socklen_t..." >&4
20543 $cat >try.c <<EOCP
20544 #include <sys/types.h>
20545 #$d_socket HAS_SOCKET
20546 #ifdef HAS_SOCKET
20547 #include <sys/socket.h>
20548 #endif
20549 int main() { socklen_t x = 16; }
20550 EOCP
20551 set try
20552 if eval $compile; then
20553         val="$define"
20554         echo "You have socklen_t."
20555 else
20556         val="$undef"
20557         echo "You do not have socklen_t."
20558         case "$sizetype" in
20559         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20560         esac
20561 fi
20562 $rm_try
20563 set d_socklen_t
20564 eval $setvar
20565
20566 : see if this is a socks.h system
20567 set socks.h i_socks
20568 eval $inhdr
20569
20570 : check for type of the size argument to socket calls
20571 case "$d_socket" in
20572 "$define")
20573         $cat <<EOM
20574
20575 Checking to see what type is the last argument of accept().
20576 EOM
20577         yyy=''
20578         case "$d_socklen_t" in
20579         "$define") yyy="$yyy socklen_t"
20580         esac
20581         yyy="$yyy $sizetype int long unsigned"
20582         for xxx in $yyy; do
20583                 case "$socksizetype" in
20584                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
20585                         case "$usesocks" in
20586                         "$define")
20587                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20588                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20589                                         socksizetype="$xxx"
20590                                 fi
20591                                 ;;
20592                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20593                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20594                                         socksizetype="$xxx"
20595                                 fi
20596                                 ;;
20597                         esac
20598                         ;;
20599                 esac
20600         done
20601 : In case none of those worked, prompt the user.
20602         case "$socksizetype" in
20603         '')     rp='What is the type for socket address structure sizes?'
20604                 dflt='int'
20605                 . ./myread
20606                 socksizetype=$ans
20607                 ;;
20608         esac
20609         ;;
20610 *)      : no sockets, so pick relatively harmless default
20611         socksizetype='int'
20612         ;;
20613 esac
20614
20615 : see what type is used for signed size_t
20616 set ssize_t ssizetype int stdio.h sys/types.h
20617 eval $typedef
20618 dflt="$ssizetype"
20619 $cat > try.c <<EOM
20620 #include <stdio.h>
20621 #$i_stdlib I_STDLIB
20622 #ifdef I_STDLIB
20623 #include <stdlib.h>
20624 #endif
20625 #include <sys/types.h>
20626 #define Size_t $sizetype
20627 #define SSize_t $dflt
20628 int main()
20629 {
20630         if (sizeof(Size_t) == sizeof(SSize_t))
20631                 printf("$dflt\n");
20632         else if (sizeof(Size_t) == sizeof(int))
20633                 printf("int\n");
20634         else
20635                 printf("long\n");
20636         exit(0);
20637 }
20638 EOM
20639 echo " "
20640 set try
20641 if eval $compile_ok && $run ./try > /dev/null; then
20642         ssizetype=`$run ./try`
20643         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20644 else
20645         $cat >&4 <<EOM
20646 Help! I can't compile and run the ssize_t test program: please enlighten me!
20647 (This is probably a misconfiguration in your system or libraries, and
20648 you really ought to fix it.  Still, I'll try anyway.)
20649
20650 I need a type that is the same size as $sizetype, but is guaranteed to
20651 be signed.  Common values are ssize_t, int and long.
20652
20653 EOM
20654         rp="What signed type is the same size as $sizetype?"
20655         . ./myread
20656         ssizetype="$ans"
20657 fi
20658 $rm_try
20659
20660 : see what type of char stdio uses.
20661 echo " "
20662 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
20663 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20664         echo "Your stdio uses unsigned chars." >&4
20665         stdchar="unsigned char"
20666 else
20667         echo "Your stdio uses signed chars." >&4
20668         stdchar="char"
20669 fi
20670 $rm -f stdioh
20671
20672 : see what type uids are declared as in the kernel
20673 echo " "
20674 echo "Looking for the type for user ids returned by getuid()."
20675 set uid_t uidtype xxx stdio.h sys/types.h
20676 eval $typedef
20677 case "$uidtype" in
20678 xxx)
20679         xxx=`./findhdr sys/user.h`
20680         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20681         case $1 in
20682         unsigned) dflt="$1 $2" ;;
20683         *) dflt="$1" ;;
20684         esac
20685         ;;
20686 *) dflt="$uidtype";;
20687 esac
20688 case "$uidtype" in
20689 uid_t)  echo "uid_t found." ;;
20690 *)      rp="What is the type for user ids returned by getuid()?"
20691         . ./myread
20692         uidtype="$ans"
20693         ;;
20694 esac
20695
20696 : Check size of UID
20697 echo " "
20698 case "$uidtype" in
20699 *_t) zzz="$uidtype"     ;;
20700 *)   zzz="uid"          ;;
20701 esac
20702 echo "Checking the size of $zzz..." >&4
20703 cat > try.c <<EOCP
20704 #include <sys/types.h>
20705 #include <stdio.h>
20706 #$i_stdlib I_STDLIB
20707 #ifdef I_STDLIB
20708 #include <stdlib.h>
20709 #endif
20710 int main() {
20711     printf("%d\n", (int)sizeof($uidtype));
20712     exit(0);
20713 }
20714 EOCP
20715 set try
20716 if eval $compile_ok; then
20717         yyy=`$run ./try`
20718         case "$yyy" in
20719         '')     uidsize=4
20720                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20721                 ;;
20722         *)      uidsize=$yyy
20723                 echo "Your $zzz is $uidsize bytes long."
20724                 ;;
20725         esac
20726 else
20727         uidsize=4
20728         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20729 fi
20730
20731 : Check if UID is signed
20732 echo " "
20733 case "$uidtype" in
20734 *_t) zzz="$uidtype"     ;;
20735 *)   zzz="uid"          ;;
20736 esac
20737 echo "Checking the sign of $zzz..." >&4
20738 cat > try.c <<EOCP
20739 #include <sys/types.h>
20740 #include <stdio.h>
20741 int main() {
20742         $uidtype foo = -1;
20743         if (foo < 0)
20744                 printf("-1\n");
20745         else
20746                 printf("1\n");
20747 }
20748 EOCP
20749 set try
20750 if eval $compile; then
20751         yyy=`$run ./try`
20752         case "$yyy" in
20753         '')     uidsign=1
20754                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20755                 ;;
20756         *)      uidsign=$yyy
20757                 case "$uidsign" in
20758                  1) echo "Your $zzz is unsigned." ;;
20759                 -1) echo "Your $zzz is signed."   ;;
20760                 esac
20761                 ;;
20762         esac
20763 else
20764         uidsign=1
20765         echo "(I can't compile the test program--guessing unsigned.)" >&4
20766 fi
20767
20768
20769 : Check format string for UID
20770 echo " "
20771 $echo "Checking the format string to be used for uids..." >&4
20772
20773 case "$uidsign" in
20774 -1)     if $test X"$uidsize" = X"$ivsize"; then
20775                 uidformat="$ivdformat"
20776         else
20777                 if $test X"$uidsize" = X"$longsize"; then
20778                         uidformat='"ld"'
20779                 else
20780                         if $test X"$uidsize" = X"$intsize"; then
20781                                 uidformat='"d"'
20782                         else
20783                                 if $test X"$uidsize" = X"$shortsize"; then
20784                                         uidformat='"hd"'
20785                                 fi
20786                         fi
20787                 fi
20788         fi
20789         ;;
20790 *)      if $test X"$uidsize" = X"$uvsize"; then
20791                 uidformat="$uvuformat"
20792         else
20793                 if $test X"$uidsize" = X"$longsize"; then
20794                         uidformat='"lu"'
20795                 else
20796                         if $test X"$uidsize" = X"$intsize"; then
20797                                 uidformat='"u"'
20798                         else
20799                                 if $test X"$uidsize" = X"$shortsize"; then
20800                                         uidformat='"hu"'
20801                                 fi
20802                         fi
20803                 fi
20804         fi
20805         ;;
20806 esac
20807
20808 : Check if site customization support was requested
20809 case "$usesitecustomize" in
20810     $define|true|[Yy]*)
20811         usesitecustomize="$define"
20812         ;;
20813     *)
20814         usesitecustomize="$undef"
20815         ;;
20816     esac
20817
20818 : determine compiler compiler
20819 case "$yacc" in
20820 '')
20821         dflt=yacc;;
20822 *)
20823         dflt="$yacc";;
20824 esac
20825 echo " "
20826 comp='yacc'
20827 if $test -f "$byacc$_exe"; then
20828         dflt="$byacc"
20829         comp="byacc or $comp"
20830 fi
20831 if $test -f "$bison$_exe"; then
20832         comp="$comp or bison -y"
20833 fi
20834 rp="Which compiler compiler ($comp) shall I use?"
20835 . ./myread
20836 yacc="$ans"
20837 case "$yacc" in
20838 *bis*)
20839         case "$yacc" in
20840         *-y*) ;;
20841         *)
20842                 yacc="$yacc -y"
20843                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20844                 ;;
20845         esac
20846         ;;
20847 esac
20848
20849 : see if this is a assert.h system
20850 set assert.h i_assert
20851 eval $inhdr
20852
20853 : see if this is a fp.h system
20854 set fp.h i_fp
20855 eval $inhdr
20856
20857 : see if this is a fp_class.h system
20858 set fp_class.h i_fp_class
20859 eval $inhdr
20860
20861 : see if gdbm.h is available
20862 set gdbm.h t_gdbm
20863 eval $inhdr
20864 case "$t_gdbm" in
20865 $define)
20866         : see if gdbm_open exists
20867         set gdbm_open d_gdbm_open
20868         eval $inlibc
20869         case "$d_gdbm_open" in
20870         $undef)
20871                 t_gdbm="$undef"
20872                 echo "We won't be including <gdbm.h>"
20873                 ;;
20874         esac
20875         ;;
20876 esac
20877 val="$t_gdbm"
20878 set i_gdbm
20879 eval $setvar
20880
20881 : see if ndbm.h is available
20882 set ndbm.h i_ndbm
20883 eval $inhdr
20884 : Compatibility location for RedHat 7.1
20885 set gdbm/ndbm.h i_gdbmndbm
20886 eval $inhdr
20887 : Compatibility location for Debian 4.0
20888 set gdbm-ndbm.h i_gdbm_ndbm
20889 eval $inhdr
20890
20891 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
20892         : see if dbm_open exists
20893         set dbm_open d_dbm_open
20894         eval $inlibc
20895         case "$d_dbm_open" in
20896         $undef)
20897                 i_ndbm="$undef"
20898                 i_gdbmndbm="$undef"
20899                 i_gdbm_ndbm="$undef"
20900                 echo "We won't be including <ndbm.h>"
20901             val="$undef"
20902                 ;;
20903         *) val="$define"
20904            ;;
20905         esac
20906 fi
20907 set d_ndbm
20908 eval $setvar
20909
20910 : see if this is a ieeefp.h system
20911 case "$i_ieeefp" in
20912 '' ) set ieeefp.h i_ieeefp
20913      eval $inhdr
20914      ;;
20915 esac
20916
20917 : see if this is a libutil.h system
20918 set libutil.h i_libutil
20919 eval $inhdr
20920
20921 : see if mach cthreads are available
20922 if test "X$usethreads" = "X$define"; then
20923         set mach/cthreads.h i_machcthr
20924         eval $inhdr
20925 else
20926         i_machcthr="$undef"
20927 fi
20928
20929 : see if this is a mntent.h system
20930 set mntent.h i_mntent
20931 eval $inhdr
20932
20933 : see if net/errno.h is available
20934 val=''
20935 set net/errno.h val
20936 eval $inhdr
20937
20938 : Unfortunately, it causes problems on some systems.  Arrgh.
20939 case "$val" in
20940 $define)
20941         cat > try.c <<'EOM'
20942 #include <stdio.h>
20943 #include <errno.h>
20944 #include <net/errno.h>
20945 int func()
20946 {
20947         return ENOTSOCK;
20948 }
20949 EOM
20950         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20951                 echo "We'll be including <net/errno.h>." >&4
20952         else
20953                 echo "We won't be including <net/errno.h>." >&4
20954                 val="$undef"
20955         fi
20956         $rm_try
20957         ;;
20958 esac
20959 set i_neterrno
20960 eval $setvar
20961
20962 : see if netinet/tcp.h is available
20963 set netinet/tcp.h i_netinettcp
20964 eval $inhdr
20965
20966 : see if this is a poll.h system
20967 set poll.h i_poll
20968 eval $inhdr
20969
20970 : see if this is a prot.h system
20971 set prot.h i_prot
20972 eval $inhdr
20973
20974 : Preprocessor symbols
20975 echo " "
20976 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20977 $cat <<'EOSH' > Cppsym.know
20978 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20979 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20980 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20981 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20982 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20983 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20984 bull c cadmus clipper CMU COFF COMPILER_VERSION
20985 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20986 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20987 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20988 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20989 GLIBC GLIBC_MINOR
20990 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20991 H3050R H3050RX hbullx20 hcx host_mips
20992 hp200 hp300 hp700 HP700 hp800 hp9000
20993 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20994 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20995 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20996 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20997 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20998 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20999 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21000 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21001 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21002 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21003 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21004 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21005 MATH_HAS_NO_SIDE_EFFECTS
21006 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21007 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21008 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21009 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21010 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21011 NetBSD news1500 news1700 news1800 news1900 news3700
21012 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21013 ns32016 ns32332 ns32k nsc32000
21014 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21015 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21016 pc532 pdp11 PGC PIC plexus PORTAR posix
21017 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21018 POSIX_C_SOURCE POSIX_SOURCE POWER
21019 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21020 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21021 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21022 sony sony_news sonyrisc sparc sparclite spectrum
21023 stardent stdc STDC_EXT stratos sun sun3 sun386
21024 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21025 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21026 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21027 sysV68 sysV88 Tek4132 Tek4300 titan
21028 TM3200 TM5400 TM5600
21029 tower tower32 tower32_200 tower32_600 tower32_700
21030 tower32_800 tower32_850 tss
21031 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21032 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21033 unix UNIX95 UNIX99 unixpc unos
21034 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21035 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21036 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21037 USGr4 USGr4_2
21038 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21039 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21040 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21041 z8000
21042 EOSH
21043 # Maybe put other stuff here too.
21044 cat <<EOSH >>Cppsym.know
21045 $osname
21046 EOSH
21047 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21048 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21049 $cat Cppsym.know > Cppsym.c
21050 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21051 $rm -f Cppsym.a Cppsym.b Cppsym.c
21052 cat <<EOSH > Cppsym
21053 $startsh
21054 if $test \$# -gt 0; then
21055     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21056     if $test -s Cppsym.got; then
21057         $rm -f Cppsym.got
21058         exit 0
21059     fi
21060     $rm -f Cppsym.got
21061     exit 1
21062 else
21063     $tr " " "$trnl" | ./Cppsym.try
21064     exit 0
21065 fi
21066 EOSH
21067 chmod +x Cppsym
21068 $eunicefix Cppsym
21069 cat <<EOSH > Cppsym.try
21070 $startsh
21071 cat <<'EOCP' > try.c
21072 #include <stdio.h>
21073 #if cpp_stuff == 1
21074 #define STRINGIFY(a)    "a"
21075 #endif
21076 #if cpp_stuff == 42
21077 #define StGiFy(a)  #a
21078 #define STRINGIFY(a)    StGiFy(a)
21079 #endif
21080 #if $cpp_stuff != 1 && $cpp_stuff != 42
21081 #   include "Bletch: How does this C preprocessor stringify macros?"
21082 #endif
21083 int main() {
21084 EOCP
21085 $awk \\
21086 EOSH
21087 cat <<'EOSH' >> Cppsym.try
21088 'length($1) > 0 {
21089     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21090     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21091     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21092     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21093 }'       >> try.c
21094 echo 'return 0;}' >> try.c
21095 EOSH
21096 cat <<EOSH >> Cppsym.try
21097 ccflags="$ccflags"
21098 case "$osname-$gccversion" in
21099 irix-) ccflags="\$ccflags -woff 1178" ;;
21100 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21101 esac
21102 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21103 EOSH
21104 chmod +x Cppsym.try
21105 $eunicefix Cppsym.try
21106 ./Cppsym < Cppsym.know > Cppsym.true
21107 : Add in any linux cpp "predefined macros":
21108 case "$osname::$gccversion" in
21109   *linux*::*.*)
21110     tHdrH=_tmpHdr
21111     rm -f $tHdrH'.h' $tHdrH
21112     touch $tHdrH'.h'
21113     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21114        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21115        if [ -s $tHdrH'_cppsym.real' ]; then
21116           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21117        fi
21118     fi
21119     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21120   ;;
21121 esac
21122 : now check the C compiler for additional symbols
21123 postprocess_cc_v=''
21124 case "$osname" in
21125 aix) postprocess_cc_v="|$tr , ' '" ;;
21126 esac
21127 $cat >ccsym <<EOS
21128 $startsh
21129 $cat >tmp.c <<EOF
21130 extern int foo;
21131 EOF
21132 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21133 do
21134         case "\$i" in
21135         -D*) echo "\$i" | $sed 's/^-D//';;
21136         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21137         esac
21138 done
21139 $rm_try
21140 EOS
21141 postprocess_cc_v=''
21142 chmod +x ccsym
21143 $eunicefix ccsym
21144 ./ccsym > ccsym1.raw
21145 if $test -s ccsym1.raw; then
21146        $sort ccsym1.raw | $uniq >ccsym.raw
21147 else
21148        mv ccsym1.raw ccsym.raw
21149 fi
21150
21151 $awk '/\=/ { print $0; next }
21152         { print $0"=1" }' ccsym.raw >ccsym.list
21153 $comm -13 Cppsym.true ccsym.list >ccsym.own
21154 $comm -12 Cppsym.true ccsym.list >ccsym.com
21155 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21156 also=''
21157 if $test -z ccsym.raw; then
21158         echo "Your C compiler doesn't seem to define any symbols!" >&4
21159         echo " "
21160         echo "However, your C preprocessor defines the following symbols:"
21161         $cat Cppsym.true
21162         ccsymbols=''
21163         cppsymbols=`$cat Cppsym.true`
21164         cppsymbols=`echo $cppsymbols`
21165         cppccsymbols="$cppsymbols"
21166 else
21167         if $test -s ccsym.com; then
21168                 echo "Your C compiler and pre-processor define these symbols:"
21169                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21170                 also='also '
21171                 symbols='ones'
21172                 cppccsymbols=`$cat ccsym.com`
21173                 cppccsymbols=`echo $cppccsymbols`
21174                 $test "$silent" || sleep 1
21175         fi
21176         if $test -s ccsym.cpp; then
21177                 $test "$also" && echo " "
21178                 echo "Your C pre-processor ${also}defines the following symbols:"
21179                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21180                 also='further '
21181                 cppsymbols=`$cat ccsym.cpp`
21182                 cppsymbols=`echo $cppsymbols`
21183                 $test "$silent" || sleep 1
21184         fi
21185         if $test -s ccsym.own; then
21186                 $test "$also" && echo " "
21187                 echo "Your C compiler ${also}defines the following cpp symbols:"
21188                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21189                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21190                 ccsymbols=`$cat ccsym.own`
21191                 ccsymbols=`echo $ccsymbols`
21192                 $test "$silent" || sleep 1
21193         fi
21194 fi
21195
21196 : see if this is a termio system
21197 val="$undef"
21198 val2="$undef"
21199 val3="$undef"
21200 if $test `./findhdr termios.h`; then
21201         set tcsetattr i_termios
21202         eval $inlibc
21203         val3="$i_termios"
21204 fi
21205 echo " "
21206 case "$val3" in
21207 "$define") echo "You have POSIX termios.h... good!" >&4;;
21208 *) if ./Cppsym pyr; then
21209                 case "`/bin/universe`" in
21210                 ucb) if $test `./findhdr sgtty.h`; then
21211                                 val2="$define"
21212                                 echo "<sgtty.h> found." >&4
21213                         else
21214                                 echo "System is pyramid with BSD universe."
21215                                 ./warn "<sgtty.h> not found--you could have problems."
21216                         fi;;
21217                 *) if $test `./findhdr termio.h`; then
21218                                 val="$define"
21219                                 echo "<termio.h> found." >&4
21220                         else
21221                                 echo "System is pyramid with USG universe."
21222                                 ./warn "<termio.h> not found--you could have problems."
21223                         fi;;
21224                 esac
21225         elif ./usg; then
21226                 if $test `./findhdr termio.h`; then
21227                         echo "<termio.h> found." >&4
21228                         val="$define"
21229                 elif $test `./findhdr sgtty.h`; then
21230                         echo "<sgtty.h> found." >&4
21231                         val2="$define"
21232                 else
21233                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21234                 fi
21235         else
21236                 if $test `./findhdr sgtty.h`; then
21237                         echo "<sgtty.h> found." >&4
21238                         val2="$define"
21239                 elif $test `./findhdr termio.h`; then
21240                         echo "<termio.h> found." >&4
21241                         val="$define"
21242                 else
21243                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
21244                 fi
21245         fi;;
21246 esac
21247 set i_termio; eval $setvar
21248 val=$val2; set i_sgtty; eval $setvar
21249 val=$val3; set i_termios; eval $setvar
21250
21251 : see if stddef is available
21252 set stddef.h i_stddef
21253 eval $inhdr
21254
21255 : see if sys/access.h is available
21256 set sys/access.h i_sysaccess
21257 eval $inhdr
21258
21259 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21260 set sys/filio.h i_sysfilio
21261 eval $inhdr
21262 echo " "
21263 if $test `./findhdr sys/ioctl.h`; then
21264         val="$define"
21265         echo '<sys/ioctl.h> found.' >&4
21266 else
21267         val="$undef"
21268         if $test $i_sysfilio = "$define"; then
21269             echo '<sys/ioctl.h> NOT found.' >&4
21270         else
21271                 $test $i_sgtty = "$define" && xxx="sgtty.h"
21272                 $test $i_termio = "$define" && xxx="termio.h"
21273                 $test $i_termios = "$define" && xxx="termios.h"
21274 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21275         fi
21276 fi
21277 set i_sysioctl
21278 eval $setvar
21279
21280 : see if socket ioctl defs are in sys/sockio.h
21281 echo " "
21282 xxx=`./findhdr sys/sockio.h`
21283 if $test "$xxx"; then
21284         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21285                 val="$define"
21286                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21287         else
21288                 val="$undef"
21289                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21290         fi
21291 else
21292         val="$undef"
21293         $cat <<EOM
21294 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21295 EOM
21296 fi
21297 set i_syssockio
21298 eval $setvar
21299
21300 : see if this is a syslog.h system
21301 set syslog.h i_syslog
21302 eval $inhdr
21303
21304 : see if this is a sys/mode.h system
21305 set sys/mode.h i_sysmode
21306 eval $inhdr
21307
21308 : see if there is a sys/poll.h file
21309 set sys/poll.h i_syspoll
21310 eval $inhdr
21311
21312 : see if sys/resource.h has to be included
21313 set sys/resource.h i_sysresrc
21314 eval $inhdr
21315
21316 : see if sys/security.h is available
21317 set sys/security.h i_syssecrt
21318 eval $inhdr
21319
21320 : see if this is a sys/statvfs.h system
21321 set sys/statvfs.h i_sysstatvfs
21322 eval $inhdr
21323
21324 : see if this is a sys/un.h system
21325 set sys/un.h i_sysun
21326 eval $inhdr
21327
21328 : see if this is a sys/utsname.h system
21329 set sys/utsname.h i_sysutsname
21330 eval $inhdr
21331
21332 : see if this is a syswait system
21333 set sys/wait.h i_syswait
21334 eval $inhdr
21335
21336 : see if this is a ustat.h system
21337 set ustat.h i_ustat
21338 eval $inhdr
21339
21340 : see if this is an utime system
21341 set utime.h i_utime
21342 eval $inhdr
21343
21344 : see if this is a values.h system
21345 set values.h i_values
21346 eval $inhdr
21347
21348 : see if this is a vfork system
21349 case "$d_vfork" in
21350 "$define")
21351         set vfork.h i_vfork
21352         eval $inhdr
21353         ;;
21354 *)
21355         i_vfork="$undef"
21356         ;;
21357 esac
21358
21359 : Check extensions
21360 echo " "
21361 echo "Looking for extensions..." >&4
21362 : If we are using the old config.sh, known_extensions may contain
21363 : old or inaccurate or duplicate values.
21364 known_extensions=''
21365 nonxs_extensions=''
21366 : We do not use find because it might not be available.
21367 : We do not just use MANIFEST because the user may have dropped
21368 : some additional extensions into the source tree and expect them
21369 : to be built.
21370
21371 : Function to recursively find available extensions, ignoring DynaLoader
21372 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21373 find_extensions='
21374     for xxx in *; do
21375         case "$xxx" in
21376             DynaLoader|dynaload) ;;
21377             *)
21378             if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
21379                 known_extensions="$known_extensions $1$xxx";
21380             elif $test -f $xxx/Makefile.PL; then
21381                 nonxs_extensions="$nonxs_extensions $1$xxx";
21382             else
21383                 if $test -d $xxx -a $# -lt 10; then
21384                     set $1$xxx/ $*;
21385                     cd "$xxx";
21386                     eval $find_extensions;
21387                     cd ..;
21388                     shift;
21389                 fi;
21390             fi
21391             ;;
21392         esac;
21393     done'
21394 tdir=`pwd`
21395 cd "$rsrc/ext"
21396 set X
21397 shift
21398 eval $find_extensions
21399 # Special case:  Add in modules that nest beyond the first level.
21400 # Currently threads/shared and Hash/Util/FieldHash, since they are
21401 # not picked up by the recursive find above (and adding in general
21402 # recursive finding breaks SDBM_File/sdbm).
21403 # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21404 known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21405 set X $known_extensions
21406 shift
21407 known_extensions="$*"
21408 set X $nonxs_extensions
21409 shift
21410 nonxs_extensions="$*"
21411 cd "$tdir"
21412
21413 : Now see which are supported on this system.
21414 avail_ext=''
21415 for xxx in $known_extensions ; do
21416         case "$xxx" in
21417         DB_File|db_file)
21418                 case "$i_db" in
21419                 $define) avail_ext="$avail_ext $xxx" ;;
21420                 esac
21421                 ;;
21422         GDBM_File|gdbm_fil)
21423                 case "$i_gdbm" in
21424                 $define) avail_ext="$avail_ext $xxx" ;;
21425                 esac
21426                 ;;
21427         I18N/Langinfo|i18n_lan)
21428                 case "$i_langinfo$d_nl_langinfo" in
21429                 $define$define) avail_ext="$avail_ext $xxx" ;;
21430                 esac
21431                 ;;
21432         IPC/SysV|ipc/sysv)
21433                 : XXX Do we need a useipcsysv variable here
21434                 case "${d_msg}${d_sem}${d_shm}" in
21435                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21436                 esac
21437                 ;;
21438         NDBM_File|ndbm_fil)
21439                 case "$i_ndbm" in
21440                 $define)
21441                     case "$osname-$use64bitint" in
21442                     hpux-define)
21443                         case "$libs" in
21444                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21445                         esac
21446                         ;;
21447                     *) avail_ext="$avail_ext $xxx" ;;
21448                     esac
21449                     ;;
21450                 esac
21451                 ;;
21452         ODBM_File|odbm_fil)
21453                 case "${i_dbm}${i_rpcsvcdbm}" in
21454                 *"${define}"*)
21455                     case "$d_cplusplus" in
21456                     define) ;; # delete as a function name will not work
21457                     *)  case "$osname-$use64bitint" in
21458                         hpux-define)
21459                             case "$libs" in
21460                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21461                             esac
21462                             ;;
21463                         *) avail_ext="$avail_ext $xxx" ;;
21464                         esac
21465                         ;;
21466                     esac
21467                     ;;
21468                 esac
21469                 ;;
21470         Opcode|opcode)
21471                 case "$useopcode" in
21472                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21473                 esac
21474                 ;;
21475         POSIX|posix)
21476                 case "$useposix" in
21477                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21478                 esac
21479                 ;;
21480         Socket|socket)
21481                 case "$d_socket" in
21482                 true|$define|y)
21483                     case "$osname" in
21484                     beos) ;; # not unless BONE
21485                     *) avail_ext="$avail_ext $xxx" ;;
21486                     esac
21487                     ;;
21488                 esac
21489                 ;;
21490         Sys/Syslog|sys/syslog)
21491                 : XXX syslog requires socket
21492                 case "$d_socket" in
21493                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21494                 esac
21495                 ;;
21496         Thread|thread)
21497                 case "$usethreads" in
21498                 true|$define|y)
21499                         case "$use5005threads" in
21500                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21501                         esac
21502                 esac
21503                 ;;
21504         threads|threads/shared)
21505                 # threads and threads::shared are special cases.
21506                 # To stop people from asking "Perl 5.8.0 was supposed
21507                 # to have this new fancy threads implementation but my
21508                 # perl doesn't have it" and from people trying to
21509                 # (re)install the threads module using CPAN.pm and
21510                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21511                 # the threads.pm and threads/shared.pm will always be
21512                 # there, croaking informatively ("you need to rebuild
21513                 # all of Perl with threads, sorry") when threads haven't
21514                 # been compiled in.
21515                 # --jhi
21516                 avail_ext="$avail_ext $xxx"
21517                 ;;
21518         Win32*)
21519                 case "$osname" in
21520                 cygwin) avail_ext="$avail_ext $xxx" ;;
21521                 esac
21522                 ;;
21523         XS/APItest|xs/apitest)
21524                 # This is just for testing.  Skip it unless we have dynamic loading.
21525
21526                 case "$usedl" in
21527                 $define) avail_ext="$avail_ext $xxx" ;;
21528                 esac
21529                 ;;
21530         XS/Typemap|xs/typemap)
21531                 # This is just for testing.  Skip it unless we have dynamic loading.
21532                 case "$usedl" in
21533                 $define) avail_ext="$avail_ext $xxx" ;;
21534                 esac
21535                 ;;
21536         *)      avail_ext="$avail_ext $xxx"
21537                 ;;
21538         esac
21539 done
21540
21541 set X $avail_ext
21542 shift
21543 avail_ext="$*"
21544
21545 case "$onlyextensions" in
21546 '') ;;
21547 *)  keepextensions=''
21548     echo "You have requested that only certains extensions be included..." >&4
21549     for i in $onlyextensions; do
21550         case " $avail_ext " in
21551         *" $i "*)
21552             echo "Keeping extension $i."
21553             keepextensions="$keepextensions $i"
21554             ;;
21555         *) echo "Ignoring extension $i." ;;
21556         esac
21557     done
21558     avail_ext="$keepextensions"
21559     ;;
21560 esac
21561
21562 case "$noextensions" in
21563 '') ;;
21564 *)  keepextensions=''
21565     echo "You have requested that certain extensions be ignored..." >&4
21566     for i in $avail_ext; do
21567         case " $noextensions " in
21568         *" $i "*) echo "Ignoring extension $i." ;;
21569         *) echo "Keeping extension $i.";
21570            keepextensions="$keepextensions $i"
21571            ;;
21572         esac
21573     done
21574     avail_ext="$keepextensions"
21575     ;;
21576 esac
21577
21578 : Now see which nonxs extensions are supported on this system.
21579 : For now assume all are.
21580 nonxs_ext=''
21581 for xxx in $nonxs_extensions ; do
21582         case "$xxx" in
21583         *)      nonxs_ext="$nonxs_ext $xxx"
21584                 ;;
21585         esac
21586 done
21587
21588 set X $nonxs_ext
21589 shift
21590 nonxs_ext="$*"
21591
21592 case $usedl in
21593 $define)
21594         $cat <<EOM
21595 A number of extensions are supplied with $package.  You may choose to
21596 compile these extensions for dynamic loading (the default), compile
21597 them into the $package executable (static loading), or not include
21598 them at all.  Answer "none" to include no extensions.
21599 Note that DynaLoader is always built and need not be mentioned here.
21600
21601 EOM
21602         case "$dynamic_ext" in
21603         '')
21604                 : Exclude those listed in static_ext
21605                 dflt=''
21606                 for xxx in $avail_ext; do
21607                         case " $static_ext " in
21608                         *" $xxx "*) ;;
21609                         *) dflt="$dflt $xxx" ;;
21610                         esac
21611                 done
21612                 set X $dflt
21613                 shift
21614                 dflt="$*"
21615                 ;;
21616         *)      dflt="$dynamic_ext"
21617                 # Perhaps we are reusing an old out-of-date config.sh.
21618                 case "$hint" in
21619                 previous)
21620                         if test X"$dynamic_ext" != X"$avail_ext"; then
21621                                 $cat <<EOM
21622 NOTICE:  Your previous config.sh list may be incorrect.
21623 The extensions now available to you are
21624         ${avail_ext}
21625 but the default list from your previous config.sh is
21626         ${dynamic_ext}
21627
21628 EOM
21629                         fi
21630                         ;;
21631                 esac
21632                 ;;
21633         esac
21634         case "$dflt" in
21635         '')     dflt=none;;
21636         esac
21637         rp="What extensions do you wish to load dynamically?"
21638         . ./myread
21639         case "$ans" in
21640         none) dynamic_ext=' ' ;;
21641         *) dynamic_ext="$ans" ;;
21642         esac
21643
21644         case "$static_ext" in
21645         '')
21646                 : Exclude those already listed in dynamic linking
21647                 dflt=''
21648                 for xxx in $avail_ext; do
21649                         case " $dynamic_ext " in
21650                         *" $xxx "*) ;;
21651                         *) dflt="$dflt $xxx" ;;
21652                         esac
21653                 done
21654                 set X $dflt
21655                 shift
21656                 dflt="$*"
21657                 ;;
21658         *)  dflt="$static_ext"
21659                 ;;
21660         esac
21661
21662         case "$dflt" in
21663         '')     dflt=none;;
21664         esac
21665         rp="What extensions do you wish to load statically?"
21666         . ./myread
21667         case "$ans" in
21668         none) static_ext=' ' ;;
21669         *) static_ext="$ans" ;;
21670         esac
21671         ;;
21672 *)
21673         $cat <<EOM
21674 A number of extensions are supplied with $package.  Answer "none"
21675 to include no extensions.
21676 Note that DynaLoader is always built and need not be mentioned here.
21677
21678 EOM
21679         case "$static_ext" in
21680         '') dflt="$avail_ext" ;;
21681         *)      dflt="$static_ext"
21682                 # Perhaps we are reusing an old out-of-date config.sh.
21683                 case "$hint" in
21684                 previous)
21685                         if test X"$static_ext" != X"$avail_ext"; then
21686                                 $cat <<EOM
21687 NOTICE:  Your previous config.sh list may be incorrect.
21688 The extensions now available to you are
21689         ${avail_ext}
21690 but the default list from your previous config.sh is
21691         ${static_ext}
21692
21693 EOM
21694                         fi
21695                         ;;
21696                 esac
21697                 ;;
21698         esac
21699         : Exclude those that are not xs extensions
21700         case "$dflt" in
21701         '')     dflt=none;;
21702         esac
21703         rp="What extensions do you wish to include?"
21704         . ./myread
21705         case "$ans" in
21706         none) static_ext=' ' ;;
21707         *) static_ext="$ans" ;;
21708         esac
21709         ;;
21710 esac
21711 #
21712 # Encode is a special case.  If we are building Encode as a static
21713 # extension, we need to explicitly list its subextensions as well.
21714 # For other nested extensions, this is handled automatically by
21715 # the appropriate Makefile.PL.
21716 case " $static_ext " in
21717         *" Encode "*) # Add the subextensions of Encode
21718         cd "$rsrc/ext"
21719         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21720                 static_ext="$static_ext Encode/$xxx"
21721         done
21722         cd "$tdir"
21723         ;;
21724 esac
21725
21726 set X $dynamic_ext $static_ext $nonxs_ext
21727 shift
21728 extensions="$*"
21729
21730 # Sanity check:  We require an extension suitable for use with
21731 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21732 # should show up as failures in the test suite, but it's helpful to
21733 # catch them now.) The 'extensions' list is normally sorted
21734 # alphabetically, so we need to accept either
21735 #    DB_File ... Fcntl ... IO  ....
21736 # or something like
21737 #    Fcntl ... NDBM_File ... IO  ....
21738 case " $extensions"  in
21739 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21740 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21741 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21742 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21743    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21744    ;;
21745 esac
21746
21747 : Remove libraries needed only for extensions
21748 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21749 : The exception is SunOS 4.x, which needs them.
21750 case "${osname}X${osvers}" in
21751 sunos*X4*)
21752     perllibs="$libs"
21753     ;;
21754 *) case "$usedl" in
21755     $define|true|[yY]*)
21756             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21757             shift
21758             perllibs="$*"
21759             ;;
21760     *)  perllibs="$libs"
21761             ;;
21762     esac
21763     ;;
21764 esac
21765
21766 : Remove build directory name from cppstdin so it can be used from
21767 : either the present location or the final installed location.
21768 echo " "
21769 : Get out of the UU directory to get correct path name.
21770 cd ..
21771 case "$cppstdin" in
21772 `pwd`/cppstdin)
21773         echo "Stripping down cppstdin path name"
21774         cppstdin=cppstdin
21775         ;;
21776 esac
21777 cd UU
21778
21779 : end of configuration questions
21780 echo " "
21781 echo "End of configuration questions."
21782 echo " "
21783
21784 : back to where it started
21785 if test -d ../UU; then
21786         cd ..
21787 fi
21788
21789 : configuration may be unconditionally patched via a 'config.arch' file
21790 if $test -f config.arch; then
21791         echo "I see a config.arch file, loading it." >&4
21792         . ./config.arch
21793 fi
21794
21795 : configuration may be patched via a 'config.over' file
21796 if $test -f config.over; then
21797         echo " "
21798         dflt=y
21799         rp='I see a config.over file.  Do you wish to load it?'
21800         . UU/myread
21801         case "$ans" in
21802         n*) echo "OK, I'll ignore it.";;
21803         *)      . ./config.over
21804                 echo "Configuration override changes have been loaded."
21805                 ;;
21806         esac
21807 fi
21808
21809 : in case they want portability, strip down executable paths
21810 case "$d_portable" in
21811 "$define")
21812         echo " "
21813         echo "Stripping down executable paths..." >&4
21814         for file in $loclist $trylist; do
21815                 eval temp=\$$file
21816                 eval $file=`basename $temp`
21817         done
21818         ;;
21819 esac
21820
21821 : create config.sh file
21822 echo " "
21823 echo "Creating config.sh..." >&4
21824 $spitshell <<EOT >config.sh
21825 $startsh
21826 #
21827 # This file was produced by running the Configure script. It holds all the
21828 # definitions figured out by Configure. Should you modify one of these values,
21829 # do not forget to propagate your changes by running "Configure -der". You may
21830 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21831 #
21832
21833 # Package name      : $package
21834 # Source directory  : $src
21835 # Configuration time: $cf_time
21836 # Configured by     : $cf_by
21837 # Target system     : $myuname
21838
21839 EOT
21840 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21841 $spitshell <<EOT >>config.sh
21842
21843 Author='$Author'
21844 Date='$Date'
21845 Header='$Header'
21846 Id='$Id'
21847 Locker='$Locker'
21848 Log='$Log'
21849 RCSfile='$RCSfile'
21850 Revision='$Revision'
21851 Source='$Source'
21852 State='$State'
21853 _a='$_a'
21854 _exe='$_exe'
21855 _o='$_o'
21856 afs='$afs'
21857 afsroot='$afsroot'
21858 alignbytes='$alignbytes'
21859 ansi2knr='$ansi2knr'
21860 aphostname='$aphostname'
21861 api_revision='$api_revision'
21862 api_subversion='$api_subversion'
21863 api_version='$api_version'
21864 api_versionstring='$api_versionstring'
21865 ar='$ar'
21866 archlib='$archlib'
21867 archlibexp='$archlibexp'
21868 archname64='$archname64'
21869 archname='$archname'
21870 archobjs='$archobjs'
21871 asctime_r_proto='$asctime_r_proto'
21872 awk='$awk'
21873 baserev='$baserev'
21874 bash='$bash'
21875 bin='$bin'
21876 binexp='$binexp'
21877 bison='$bison'
21878 byacc='$byacc'
21879 byteorder='$byteorder'
21880 c='$c'
21881 castflags='$castflags'
21882 cat='$cat'
21883 cc='$cc'
21884 cccdlflags='$cccdlflags'
21885 ccdlflags='$ccdlflags'
21886 ccflags='$ccflags'
21887 ccflags_uselargefiles='$ccflags_uselargefiles'
21888 ccname='$ccname'
21889 ccsymbols='$ccsymbols'
21890 ccversion='$ccversion'
21891 cf_by='$cf_by'
21892 cf_email='$cf_email'
21893 cf_time='$cf_time'
21894 chgrp='$chgrp'
21895 chmod='$chmod'
21896 chown='$chown'
21897 clocktype='$clocktype'
21898 comm='$comm'
21899 compress='$compress'
21900 contains='$contains'
21901 cp='$cp'
21902 cpio='$cpio'
21903 cpp='$cpp'
21904 cpp_stuff='$cpp_stuff'
21905 cppccsymbols='$cppccsymbols'
21906 cppflags='$cppflags'
21907 cpplast='$cpplast'
21908 cppminus='$cppminus'
21909 cpprun='$cpprun'
21910 cppstdin='$cppstdin'
21911 cppsymbols='$cppsymbols'
21912 crypt_r_proto='$crypt_r_proto'
21913 cryptlib='$cryptlib'
21914 csh='$csh'
21915 ctermid_r_proto='$ctermid_r_proto'
21916 ctime_r_proto='$ctime_r_proto'
21917 d_Gconvert='$d_Gconvert'
21918 d_PRIEUldbl='$d_PRIEUldbl'
21919 d_PRIFUldbl='$d_PRIFUldbl'
21920 d_PRIGUldbl='$d_PRIGUldbl'
21921 d_PRIXU64='$d_PRIXU64'
21922 d_PRId64='$d_PRId64'
21923 d_PRIeldbl='$d_PRIeldbl'
21924 d_PRIfldbl='$d_PRIfldbl'
21925 d_PRIgldbl='$d_PRIgldbl'
21926 d_PRIi64='$d_PRIi64'
21927 d_PRIo64='$d_PRIo64'
21928 d_PRIu64='$d_PRIu64'
21929 d_PRIx64='$d_PRIx64'
21930 d_SCNfldbl='$d_SCNfldbl'
21931 d__fwalk='$d__fwalk'
21932 d_access='$d_access'
21933 d_accessx='$d_accessx'
21934 d_aintl='$d_aintl'
21935 d_alarm='$d_alarm'
21936 d_archlib='$d_archlib'
21937 d_asctime_r='$d_asctime_r'
21938 d_atolf='$d_atolf'
21939 d_atoll='$d_atoll'
21940 d_attribute_format='$d_attribute_format'
21941 d_attribute_malloc='$d_attribute_malloc'
21942 d_attribute_nonnull='$d_attribute_nonnull'
21943 d_attribute_noreturn='$d_attribute_noreturn'
21944 d_attribute_pure='$d_attribute_pure'
21945 d_attribute_unused='$d_attribute_unused'
21946 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21947 d_bcmp='$d_bcmp'
21948 d_bcopy='$d_bcopy'
21949 d_bsd='$d_bsd'
21950 d_bsdgetpgrp='$d_bsdgetpgrp'
21951 d_bsdsetpgrp='$d_bsdsetpgrp'
21952 d_builtin_choose_expr='$d_builtin_choose_expr'
21953 d_builtin_expect='$d_builtin_expect'
21954 d_bzero='$d_bzero'
21955 d_c99_variadic_macros='$d_c99_variadic_macros'
21956 d_casti32='$d_casti32'
21957 d_castneg='$d_castneg'
21958 d_charvspr='$d_charvspr'
21959 d_chown='$d_chown'
21960 d_chroot='$d_chroot'
21961 d_chsize='$d_chsize'
21962 d_class='$d_class'
21963 d_clearenv='$d_clearenv'
21964 d_closedir='$d_closedir'
21965 d_cmsghdr_s='$d_cmsghdr_s'
21966 d_const='$d_const'
21967 d_copysignl='$d_copysignl'
21968 d_cplusplus='$d_cplusplus'
21969 d_crypt='$d_crypt'
21970 d_crypt_r='$d_crypt_r'
21971 d_csh='$d_csh'
21972 d_ctermid='$d_ctermid'
21973 d_ctermid_r='$d_ctermid_r'
21974 d_ctime_r='$d_ctime_r'
21975 d_cuserid='$d_cuserid'
21976 d_dbl_dig='$d_dbl_dig'
21977 d_dbminitproto='$d_dbminitproto'
21978 d_difftime='$d_difftime'
21979 d_dir_dd_fd='$d_dir_dd_fd'
21980 d_dirfd='$d_dirfd'
21981 d_dirnamlen='$d_dirnamlen'
21982 d_dlerror='$d_dlerror'
21983 d_dlopen='$d_dlopen'
21984 d_dlsymun='$d_dlsymun'
21985 d_dosuid='$d_dosuid'
21986 d_drand48_r='$d_drand48_r'
21987 d_drand48proto='$d_drand48proto'
21988 d_dup2='$d_dup2'
21989 d_eaccess='$d_eaccess'
21990 d_endgrent='$d_endgrent'
21991 d_endgrent_r='$d_endgrent_r'
21992 d_endhent='$d_endhent'
21993 d_endhostent_r='$d_endhostent_r'
21994 d_endnent='$d_endnent'
21995 d_endnetent_r='$d_endnetent_r'
21996 d_endpent='$d_endpent'
21997 d_endprotoent_r='$d_endprotoent_r'
21998 d_endpwent='$d_endpwent'
21999 d_endpwent_r='$d_endpwent_r'
22000 d_endsent='$d_endsent'
22001 d_endservent_r='$d_endservent_r'
22002 d_eofnblk='$d_eofnblk'
22003 d_eunice='$d_eunice'
22004 d_faststdio='$d_faststdio'
22005 d_fchdir='$d_fchdir'
22006 d_fchmod='$d_fchmod'
22007 d_fchown='$d_fchown'
22008 d_fcntl='$d_fcntl'
22009 d_fcntl_can_lock='$d_fcntl_can_lock'
22010 d_fd_macros='$d_fd_macros'
22011 d_fd_set='$d_fd_set'
22012 d_fds_bits='$d_fds_bits'
22013 d_fgetpos='$d_fgetpos'
22014 d_finite='$d_finite'
22015 d_finitel='$d_finitel'
22016 d_flexfnam='$d_flexfnam'
22017 d_flock='$d_flock'
22018 d_flockproto='$d_flockproto'
22019 d_fork='$d_fork'
22020 d_fp_class='$d_fp_class'
22021 d_fpathconf='$d_fpathconf'
22022 d_fpclass='$d_fpclass'
22023 d_fpclassify='$d_fpclassify'
22024 d_fpclassl='$d_fpclassl'
22025 d_fpos64_t='$d_fpos64_t'
22026 d_frexpl='$d_frexpl'
22027 d_fs_data_s='$d_fs_data_s'
22028 d_fseeko='$d_fseeko'
22029 d_fsetpos='$d_fsetpos'
22030 d_fstatfs='$d_fstatfs'
22031 d_fstatvfs='$d_fstatvfs'
22032 d_fsync='$d_fsync'
22033 d_ftello='$d_ftello'
22034 d_ftime='$d_ftime'
22035 d_futimes='$d_futimes'
22036 d_getcwd='$d_getcwd'
22037 d_getespwnam='$d_getespwnam'
22038 d_getfsstat='$d_getfsstat'
22039 d_getgrent='$d_getgrent'
22040 d_getgrent_r='$d_getgrent_r'
22041 d_getgrgid_r='$d_getgrgid_r'
22042 d_getgrnam_r='$d_getgrnam_r'
22043 d_getgrps='$d_getgrps'
22044 d_gethbyaddr='$d_gethbyaddr'
22045 d_gethbyname='$d_gethbyname'
22046 d_gethent='$d_gethent'
22047 d_gethname='$d_gethname'
22048 d_gethostbyaddr_r='$d_gethostbyaddr_r'
22049 d_gethostbyname_r='$d_gethostbyname_r'
22050 d_gethostent_r='$d_gethostent_r'
22051 d_gethostprotos='$d_gethostprotos'
22052 d_getitimer='$d_getitimer'
22053 d_getlogin='$d_getlogin'
22054 d_getlogin_r='$d_getlogin_r'
22055 d_getmnt='$d_getmnt'
22056 d_getmntent='$d_getmntent'
22057 d_getnbyaddr='$d_getnbyaddr'
22058 d_getnbyname='$d_getnbyname'
22059 d_getnent='$d_getnent'
22060 d_getnetbyaddr_r='$d_getnetbyaddr_r'
22061 d_getnetbyname_r='$d_getnetbyname_r'
22062 d_getnetent_r='$d_getnetent_r'
22063 d_getnetprotos='$d_getnetprotos'
22064 d_getpagsz='$d_getpagsz'
22065 d_getpbyname='$d_getpbyname'
22066 d_getpbynumber='$d_getpbynumber'
22067 d_getpent='$d_getpent'
22068 d_getpgid='$d_getpgid'
22069 d_getpgrp2='$d_getpgrp2'
22070 d_getpgrp='$d_getpgrp'
22071 d_getppid='$d_getppid'
22072 d_getprior='$d_getprior'
22073 d_getprotobyname_r='$d_getprotobyname_r'
22074 d_getprotobynumber_r='$d_getprotobynumber_r'
22075 d_getprotoent_r='$d_getprotoent_r'
22076 d_getprotoprotos='$d_getprotoprotos'
22077 d_getprpwnam='$d_getprpwnam'
22078 d_getpwent='$d_getpwent'
22079 d_getpwent_r='$d_getpwent_r'
22080 d_getpwnam_r='$d_getpwnam_r'
22081 d_getpwuid_r='$d_getpwuid_r'
22082 d_getsbyname='$d_getsbyname'
22083 d_getsbyport='$d_getsbyport'
22084 d_getsent='$d_getsent'
22085 d_getservbyname_r='$d_getservbyname_r'
22086 d_getservbyport_r='$d_getservbyport_r'
22087 d_getservent_r='$d_getservent_r'
22088 d_getservprotos='$d_getservprotos'
22089 d_getspnam='$d_getspnam'
22090 d_getspnam_r='$d_getspnam_r'
22091 d_gettimeod='$d_gettimeod'
22092 d_gmtime_r='$d_gmtime_r'
22093 d_gnulibc='$d_gnulibc'
22094 d_grpasswd='$d_grpasswd'
22095 d_hasmntopt='$d_hasmntopt'
22096 d_htonl='$d_htonl'
22097 d_ilogbl='$d_ilogbl'
22098 d_inc_version_list='$d_inc_version_list'
22099 d_index='$d_index'
22100 d_inetaton='$d_inetaton'
22101 d_int64_t='$d_int64_t'
22102 d_isascii='$d_isascii'
22103 d_isfinite='$d_isfinite'
22104 d_isinf='$d_isinf'
22105 d_isnan='$d_isnan'
22106 d_isnanl='$d_isnanl'
22107 d_killpg='$d_killpg'
22108 d_lchown='$d_lchown'
22109 d_ldbl_dig='$d_ldbl_dig'
22110 d_libm_lib_version='$d_libm_lib_version'
22111 d_link='$d_link'
22112 d_localtime_r='$d_localtime_r'
22113 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22114 d_locconv='$d_locconv'
22115 d_lockf='$d_lockf'
22116 d_longdbl='$d_longdbl'
22117 d_longlong='$d_longlong'
22118 d_lseekproto='$d_lseekproto'
22119 d_lstat='$d_lstat'
22120 d_madvise='$d_madvise'
22121 d_malloc_good_size='$d_malloc_good_size'
22122 d_malloc_size='$d_malloc_size'
22123 d_mblen='$d_mblen'
22124 d_mbstowcs='$d_mbstowcs'
22125 d_mbtowc='$d_mbtowc'
22126 d_memchr='$d_memchr'
22127 d_memcmp='$d_memcmp'
22128 d_memcpy='$d_memcpy'
22129 d_memmove='$d_memmove'
22130 d_memset='$d_memset'
22131 d_mkdir='$d_mkdir'
22132 d_mkdtemp='$d_mkdtemp'
22133 d_mkfifo='$d_mkfifo'
22134 d_mkstemp='$d_mkstemp'
22135 d_mkstemps='$d_mkstemps'
22136 d_mktime='$d_mktime'
22137 d_mmap='$d_mmap'
22138 d_modfl='$d_modfl'
22139 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22140 d_modflproto='$d_modflproto'
22141 d_mprotect='$d_mprotect'
22142 d_msg='$d_msg'
22143 d_msg_ctrunc='$d_msg_ctrunc'
22144 d_msg_dontroute='$d_msg_dontroute'
22145 d_msg_oob='$d_msg_oob'
22146 d_msg_peek='$d_msg_peek'
22147 d_msg_proxy='$d_msg_proxy'
22148 d_msgctl='$d_msgctl'
22149 d_msgget='$d_msgget'
22150 d_msghdr_s='$d_msghdr_s'
22151 d_msgrcv='$d_msgrcv'
22152 d_msgsnd='$d_msgsnd'
22153 d_msync='$d_msync'
22154 d_munmap='$d_munmap'
22155 d_mymalloc='$d_mymalloc'
22156 d_ndbm='$d_ndbm'
22157 d_nice='$d_nice'
22158 d_nl_langinfo='$d_nl_langinfo'
22159 d_nv_preserves_uv='$d_nv_preserves_uv'
22160 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22161 d_off64_t='$d_off64_t'
22162 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22163 d_oldpthreads='$d_oldpthreads'
22164 d_oldsock='$d_oldsock'
22165 d_open3='$d_open3'
22166 d_pathconf='$d_pathconf'
22167 d_pause='$d_pause'
22168 d_perl_otherlibdirs='$d_perl_otherlibdirs'
22169 d_phostname='$d_phostname'
22170 d_pipe='$d_pipe'
22171 d_poll='$d_poll'
22172 d_portable='$d_portable'
22173 d_printf_format_null='$d_printf_format_null'
22174 d_procselfexe='$d_procselfexe'
22175 d_pseudofork='$d_pseudofork'
22176 d_pthread_atfork='$d_pthread_atfork'
22177 d_pthread_attr_setscope='$d_pthread_attr_setscope'
22178 d_pthread_yield='$d_pthread_yield'
22179 d_pwage='$d_pwage'
22180 d_pwchange='$d_pwchange'
22181 d_pwclass='$d_pwclass'
22182 d_pwcomment='$d_pwcomment'
22183 d_pwexpire='$d_pwexpire'
22184 d_pwgecos='$d_pwgecos'
22185 d_pwpasswd='$d_pwpasswd'
22186 d_pwquota='$d_pwquota'
22187 d_qgcvt='$d_qgcvt'
22188 d_quad='$d_quad'
22189 d_random_r='$d_random_r'
22190 d_readdir64_r='$d_readdir64_r'
22191 d_readdir='$d_readdir'
22192 d_readdir_r='$d_readdir_r'
22193 d_readlink='$d_readlink'
22194 d_readv='$d_readv'
22195 d_recvmsg='$d_recvmsg'
22196 d_rename='$d_rename'
22197 d_rewinddir='$d_rewinddir'
22198 d_rmdir='$d_rmdir'
22199 d_safebcpy='$d_safebcpy'
22200 d_safemcpy='$d_safemcpy'
22201 d_sanemcmp='$d_sanemcmp'
22202 d_sbrkproto='$d_sbrkproto'
22203 d_scalbnl='$d_scalbnl'
22204 d_sched_yield='$d_sched_yield'
22205 d_scm_rights='$d_scm_rights'
22206 d_seekdir='$d_seekdir'
22207 d_select='$d_select'
22208 d_sem='$d_sem'
22209 d_semctl='$d_semctl'
22210 d_semctl_semid_ds='$d_semctl_semid_ds'
22211 d_semctl_semun='$d_semctl_semun'
22212 d_semget='$d_semget'
22213 d_semop='$d_semop'
22214 d_sendmsg='$d_sendmsg'
22215 d_setegid='$d_setegid'
22216 d_seteuid='$d_seteuid'
22217 d_setgrent='$d_setgrent'
22218 d_setgrent_r='$d_setgrent_r'
22219 d_setgrps='$d_setgrps'
22220 d_sethent='$d_sethent'
22221 d_sethostent_r='$d_sethostent_r'
22222 d_setitimer='$d_setitimer'
22223 d_setlinebuf='$d_setlinebuf'
22224 d_setlocale='$d_setlocale'
22225 d_setlocale_r='$d_setlocale_r'
22226 d_setnent='$d_setnent'
22227 d_setnetent_r='$d_setnetent_r'
22228 d_setpent='$d_setpent'
22229 d_setpgid='$d_setpgid'
22230 d_setpgrp2='$d_setpgrp2'
22231 d_setpgrp='$d_setpgrp'
22232 d_setprior='$d_setprior'
22233 d_setproctitle='$d_setproctitle'
22234 d_setprotoent_r='$d_setprotoent_r'
22235 d_setpwent='$d_setpwent'
22236 d_setpwent_r='$d_setpwent_r'
22237 d_setregid='$d_setregid'
22238 d_setresgid='$d_setresgid'
22239 d_setresuid='$d_setresuid'
22240 d_setreuid='$d_setreuid'
22241 d_setrgid='$d_setrgid'
22242 d_setruid='$d_setruid'
22243 d_setsent='$d_setsent'
22244 d_setservent_r='$d_setservent_r'
22245 d_setsid='$d_setsid'
22246 d_setvbuf='$d_setvbuf'
22247 d_sfio='$d_sfio'
22248 d_shm='$d_shm'
22249 d_shmat='$d_shmat'
22250 d_shmatprototype='$d_shmatprototype'
22251 d_shmctl='$d_shmctl'
22252 d_shmdt='$d_shmdt'
22253 d_shmget='$d_shmget'
22254 d_sigaction='$d_sigaction'
22255 d_signbit='$d_signbit'
22256 d_sigprocmask='$d_sigprocmask'
22257 d_sigsetjmp='$d_sigsetjmp'
22258 d_sitearch='$d_sitearch'
22259 d_snprintf='$d_snprintf'
22260 d_sockatmark='$d_sockatmark'
22261 d_sockatmarkproto='$d_sockatmarkproto'
22262 d_socket='$d_socket'
22263 d_socklen_t='$d_socklen_t'
22264 d_sockpair='$d_sockpair'
22265 d_socks5_init='$d_socks5_init'
22266 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22267 d_sqrtl='$d_sqrtl'
22268 d_srand48_r='$d_srand48_r'
22269 d_srandom_r='$d_srandom_r'
22270 d_sresgproto='$d_sresgproto'
22271 d_sresuproto='$d_sresuproto'
22272 d_statblks='$d_statblks'
22273 d_statfs_f_flags='$d_statfs_f_flags'
22274 d_statfs_s='$d_statfs_s'
22275 d_statvfs='$d_statvfs'
22276 d_stdio_cnt_lval='$d_stdio_cnt_lval'
22277 d_stdio_ptr_lval='$d_stdio_ptr_lval'
22278 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22279 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22280 d_stdio_stream_array='$d_stdio_stream_array'
22281 d_stdiobase='$d_stdiobase'
22282 d_stdstdio='$d_stdstdio'
22283 d_strchr='$d_strchr'
22284 d_strcoll='$d_strcoll'
22285 d_strctcpy='$d_strctcpy'
22286 d_strerrm='$d_strerrm'
22287 d_strerror='$d_strerror'
22288 d_strerror_r='$d_strerror_r'
22289 d_strftime='$d_strftime'
22290 d_strlcat='$d_strlcat'
22291 d_strlcpy='$d_strlcpy'
22292 d_strtod='$d_strtod'
22293 d_strtol='$d_strtol'
22294 d_strtold='$d_strtold'
22295 d_strtoll='$d_strtoll'
22296 d_strtoq='$d_strtoq'
22297 d_strtoul='$d_strtoul'
22298 d_strtoull='$d_strtoull'
22299 d_strtouq='$d_strtouq'
22300 d_strxfrm='$d_strxfrm'
22301 d_suidsafe='$d_suidsafe'
22302 d_symlink='$d_symlink'
22303 d_syscall='$d_syscall'
22304 d_syscallproto='$d_syscallproto'
22305 d_sysconf='$d_sysconf'
22306 d_sysernlst='$d_sysernlst'
22307 d_syserrlst='$d_syserrlst'
22308 d_system='$d_system'
22309 d_tcgetpgrp='$d_tcgetpgrp'
22310 d_tcsetpgrp='$d_tcsetpgrp'
22311 d_telldir='$d_telldir'
22312 d_telldirproto='$d_telldirproto'
22313 d_time='$d_time'
22314 d_timegm='$d_timegm'
22315 d_times='$d_times'
22316 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22317 d_tm_tm_zone='$d_tm_tm_zone'
22318 d_tmpnam_r='$d_tmpnam_r'
22319 d_truncate='$d_truncate'
22320 d_ttyname_r='$d_ttyname_r'
22321 d_tzname='$d_tzname'
22322 d_u32align='$d_u32align'
22323 d_ualarm='$d_ualarm'
22324 d_umask='$d_umask'
22325 d_uname='$d_uname'
22326 d_union_semun='$d_union_semun'
22327 d_unordered='$d_unordered'
22328 d_unsetenv='$d_unsetenv'
22329 d_usleep='$d_usleep'
22330 d_usleepproto='$d_usleepproto'
22331 d_ustat='$d_ustat'
22332 d_vendorarch='$d_vendorarch'
22333 d_vendorbin='$d_vendorbin'
22334 d_vendorlib='$d_vendorlib'
22335 d_vendorscript='$d_vendorscript'
22336 d_vfork='$d_vfork'
22337 d_void_closedir='$d_void_closedir'
22338 d_voidsig='$d_voidsig'
22339 d_voidtty='$d_voidtty'
22340 d_volatile='$d_volatile'
22341 d_vprintf='$d_vprintf'
22342 d_vsnprintf='$d_vsnprintf'
22343 d_wait4='$d_wait4'
22344 d_waitpid='$d_waitpid'
22345 d_wcstombs='$d_wcstombs'
22346 d_wctomb='$d_wctomb'
22347 d_writev='$d_writev'
22348 d_xenix='$d_xenix'
22349 date='$date'
22350 db_hashtype='$db_hashtype'
22351 db_prefixtype='$db_prefixtype'
22352 db_version_major='$db_version_major'
22353 db_version_minor='$db_version_minor'
22354 db_version_patch='$db_version_patch'
22355 defvoidused='$defvoidused'
22356 direntrytype='$direntrytype'
22357 dlext='$dlext'
22358 dlsrc='$dlsrc'
22359 doublesize='$doublesize'
22360 drand01='$drand01'
22361 drand48_r_proto='$drand48_r_proto'
22362 dtrace='$dtrace'
22363 dynamic_ext='$dynamic_ext'
22364 eagain='$eagain'
22365 ebcdic='$ebcdic'
22366 echo='$echo'
22367 egrep='$egrep'
22368 emacs='$emacs'
22369 endgrent_r_proto='$endgrent_r_proto'
22370 endhostent_r_proto='$endhostent_r_proto'
22371 endnetent_r_proto='$endnetent_r_proto'
22372 endprotoent_r_proto='$endprotoent_r_proto'
22373 endpwent_r_proto='$endpwent_r_proto'
22374 endservent_r_proto='$endservent_r_proto'
22375 eunicefix='$eunicefix'
22376 exe_ext='$exe_ext'
22377 expr='$expr'
22378 extensions='$extensions'
22379 extras='$extras'
22380 fflushNULL='$fflushNULL'
22381 fflushall='$fflushall'
22382 find='$find'
22383 firstmakefile='$firstmakefile'
22384 flex='$flex'
22385 fpossize='$fpossize'
22386 fpostype='$fpostype'
22387 freetype='$freetype'
22388 from='$from'
22389 full_ar='$full_ar'
22390 full_csh='$full_csh'
22391 full_sed='$full_sed'
22392 gccansipedantic='$gccansipedantic'
22393 gccosandvers='$gccosandvers'
22394 gccversion='$gccversion'
22395 getgrent_r_proto='$getgrent_r_proto'
22396 getgrgid_r_proto='$getgrgid_r_proto'
22397 getgrnam_r_proto='$getgrnam_r_proto'
22398 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22399 gethostbyname_r_proto='$gethostbyname_r_proto'
22400 gethostent_r_proto='$gethostent_r_proto'
22401 getlogin_r_proto='$getlogin_r_proto'
22402 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22403 getnetbyname_r_proto='$getnetbyname_r_proto'
22404 getnetent_r_proto='$getnetent_r_proto'
22405 getprotobyname_r_proto='$getprotobyname_r_proto'
22406 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22407 getprotoent_r_proto='$getprotoent_r_proto'
22408 getpwent_r_proto='$getpwent_r_proto'
22409 getpwnam_r_proto='$getpwnam_r_proto'
22410 getpwuid_r_proto='$getpwuid_r_proto'
22411 getservbyname_r_proto='$getservbyname_r_proto'
22412 getservbyport_r_proto='$getservbyport_r_proto'
22413 getservent_r_proto='$getservent_r_proto'
22414 getspnam_r_proto='$getspnam_r_proto'
22415 gidformat='$gidformat'
22416 gidsign='$gidsign'
22417 gidsize='$gidsize'
22418 gidtype='$gidtype'
22419 glibpth='$glibpth'
22420 gmake='$gmake'
22421 gmtime_r_proto='$gmtime_r_proto'
22422 gnulibc_version='$gnulibc_version'
22423 grep='$grep'
22424 groupcat='$groupcat'
22425 groupstype='$groupstype'
22426 gzip='$gzip'
22427 h_fcntl='$h_fcntl'
22428 h_sysfile='$h_sysfile'
22429 hint='$hint'
22430 hostcat='$hostcat'
22431 html1dir='$html1dir'
22432 html1direxp='$html1direxp'
22433 html3dir='$html3dir'
22434 html3direxp='$html3direxp'
22435 i16size='$i16size'
22436 i16type='$i16type'
22437 i32size='$i32size'
22438 i32type='$i32type'
22439 i64size='$i64size'
22440 i64type='$i64type'
22441 i8size='$i8size'
22442 i8type='$i8type'
22443 i_arpainet='$i_arpainet'
22444 i_assert='$i_assert'
22445 i_bsdioctl='$i_bsdioctl'
22446 i_crypt='$i_crypt'
22447 i_db='$i_db'
22448 i_dbm='$i_dbm'
22449 i_dirent='$i_dirent'
22450 i_dld='$i_dld'
22451 i_dlfcn='$i_dlfcn'
22452 i_fcntl='$i_fcntl'
22453 i_float='$i_float'
22454 i_fp='$i_fp'
22455 i_fp_class='$i_fp_class'
22456 i_gdbm='$i_gdbm'
22457 i_gdbm_ndbm='$i_gdbm_ndbm'
22458 i_gdbmndbm='$i_gdbmndbm'
22459 i_grp='$i_grp'
22460 i_ieeefp='$i_ieeefp'
22461 i_inttypes='$i_inttypes'
22462 i_langinfo='$i_langinfo'
22463 i_libutil='$i_libutil'
22464 i_limits='$i_limits'
22465 i_locale='$i_locale'
22466 i_machcthr='$i_machcthr'
22467 i_malloc='$i_malloc'
22468 i_mallocmalloc='$i_mallocmalloc'
22469 i_math='$i_math'
22470 i_memory='$i_memory'
22471 i_mntent='$i_mntent'
22472 i_ndbm='$i_ndbm'
22473 i_netdb='$i_netdb'
22474 i_neterrno='$i_neterrno'
22475 i_netinettcp='$i_netinettcp'
22476 i_niin='$i_niin'
22477 i_poll='$i_poll'
22478 i_prot='$i_prot'
22479 i_pthread='$i_pthread'
22480 i_pwd='$i_pwd'
22481 i_rpcsvcdbm='$i_rpcsvcdbm'
22482 i_sfio='$i_sfio'
22483 i_sgtty='$i_sgtty'
22484 i_shadow='$i_shadow'
22485 i_socks='$i_socks'
22486 i_stdarg='$i_stdarg'
22487 i_stddef='$i_stddef'
22488 i_stdlib='$i_stdlib'
22489 i_string='$i_string'
22490 i_sunmath='$i_sunmath'
22491 i_sysaccess='$i_sysaccess'
22492 i_sysdir='$i_sysdir'
22493 i_sysfile='$i_sysfile'
22494 i_sysfilio='$i_sysfilio'
22495 i_sysin='$i_sysin'
22496 i_sysioctl='$i_sysioctl'
22497 i_syslog='$i_syslog'
22498 i_sysmman='$i_sysmman'
22499 i_sysmode='$i_sysmode'
22500 i_sysmount='$i_sysmount'
22501 i_sysndir='$i_sysndir'
22502 i_sysparam='$i_sysparam'
22503 i_syspoll='$i_syspoll'
22504 i_sysresrc='$i_sysresrc'
22505 i_syssecrt='$i_syssecrt'
22506 i_sysselct='$i_sysselct'
22507 i_syssockio='$i_syssockio'
22508 i_sysstat='$i_sysstat'
22509 i_sysstatfs='$i_sysstatfs'
22510 i_sysstatvfs='$i_sysstatvfs'
22511 i_systime='$i_systime'
22512 i_systimek='$i_systimek'
22513 i_systimes='$i_systimes'
22514 i_systypes='$i_systypes'
22515 i_sysuio='$i_sysuio'
22516 i_sysun='$i_sysun'
22517 i_sysutsname='$i_sysutsname'
22518 i_sysvfs='$i_sysvfs'
22519 i_syswait='$i_syswait'
22520 i_termio='$i_termio'
22521 i_termios='$i_termios'
22522 i_time='$i_time'
22523 i_unistd='$i_unistd'
22524 i_ustat='$i_ustat'
22525 i_utime='$i_utime'
22526 i_values='$i_values'
22527 i_varargs='$i_varargs'
22528 i_varhdr='$i_varhdr'
22529 i_vfork='$i_vfork'
22530 ignore_versioned_solibs='$ignore_versioned_solibs'
22531 inc_version_list='$inc_version_list'
22532 inc_version_list_init='$inc_version_list_init'
22533 incpath='$incpath'
22534 inews='$inews'
22535 initialinstalllocation='$initialinstalllocation'
22536 installarchlib='$installarchlib'
22537 installbin='$installbin'
22538 installhtml1dir='$installhtml1dir'
22539 installhtml3dir='$installhtml3dir'
22540 installman1dir='$installman1dir'
22541 installman3dir='$installman3dir'
22542 installprefix='$installprefix'
22543 installprefixexp='$installprefixexp'
22544 installprivlib='$installprivlib'
22545 installscript='$installscript'
22546 installsitearch='$installsitearch'
22547 installsitebin='$installsitebin'
22548 installsitehtml1dir='$installsitehtml1dir'
22549 installsitehtml3dir='$installsitehtml3dir'
22550 installsitelib='$installsitelib'
22551 installsiteman1dir='$installsiteman1dir'
22552 installsiteman3dir='$installsiteman3dir'
22553 installsitescript='$installsitescript'
22554 installstyle='$installstyle'
22555 installusrbinperl='$installusrbinperl'
22556 installvendorarch='$installvendorarch'
22557 installvendorbin='$installvendorbin'
22558 installvendorhtml1dir='$installvendorhtml1dir'
22559 installvendorhtml3dir='$installvendorhtml3dir'
22560 installvendorlib='$installvendorlib'
22561 installvendorman1dir='$installvendorman1dir'
22562 installvendorman3dir='$installvendorman3dir'
22563 installvendorscript='$installvendorscript'
22564 intsize='$intsize'
22565 issymlink='$issymlink'
22566 ivdformat='$ivdformat'
22567 ivsize='$ivsize'
22568 ivtype='$ivtype'
22569 known_extensions='$known_extensions'
22570 ksh='$ksh'
22571 ld='$ld'
22572 lddlflags='$lddlflags'
22573 ldflags='$ldflags'
22574 ldflags_uselargefiles='$ldflags_uselargefiles'
22575 ldlibpthname='$ldlibpthname'
22576 less='$less'
22577 lib_ext='$lib_ext'
22578 libc='$libc'
22579 libperl='$libperl'
22580 libpth='$libpth'
22581 libs='$libs'
22582 libsdirs='$libsdirs'
22583 libsfiles='$libsfiles'
22584 libsfound='$libsfound'
22585 libspath='$libspath'
22586 libswanted='$libswanted'
22587 libswanted_uselargefiles='$libswanted_uselargefiles'
22588 line='$line'
22589 lint='$lint'
22590 lkflags='$lkflags'
22591 ln='$ln'
22592 lns='$lns'
22593 localtime_r_proto='$localtime_r_proto'
22594 locincpth='$locincpth'
22595 loclibpth='$loclibpth'
22596 longdblsize='$longdblsize'
22597 longlongsize='$longlongsize'
22598 longsize='$longsize'
22599 lp='$lp'
22600 lpr='$lpr'
22601 ls='$ls'
22602 lseeksize='$lseeksize'
22603 lseektype='$lseektype'
22604 mad='$mad'
22605 madlyh='$madlyh'
22606 madlyobj='$madlyobj'
22607 madlysrc='$madlysrc'
22608 mail='$mail'
22609 mailx='$mailx'
22610 make='$make'
22611 make_set_make='$make_set_make'
22612 mallocobj='$mallocobj'
22613 mallocsrc='$mallocsrc'
22614 malloctype='$malloctype'
22615 man1dir='$man1dir'
22616 man1direxp='$man1direxp'
22617 man1ext='$man1ext'
22618 man3dir='$man3dir'
22619 man3direxp='$man3direxp'
22620 man3ext='$man3ext'
22621 mips_type='$mips_type'
22622 mistrustnm='$mistrustnm'
22623 mkdir='$mkdir'
22624 mmaptype='$mmaptype'
22625 modetype='$modetype'
22626 more='$more'
22627 multiarch='$multiarch'
22628 mv='$mv'
22629 myarchname='$myarchname'
22630 mydomain='$mydomain'
22631 myhostname='$myhostname'
22632 myuname='$myuname'
22633 n='$n'
22634 need_va_copy='$need_va_copy'
22635 netdb_hlen_type='$netdb_hlen_type'
22636 netdb_host_type='$netdb_host_type'
22637 netdb_name_type='$netdb_name_type'
22638 netdb_net_type='$netdb_net_type'
22639 nm='$nm'
22640 nm_opt='$nm_opt'
22641 nm_so_opt='$nm_so_opt'
22642 nonxs_ext='$nonxs_ext'
22643 nroff='$nroff'
22644 nvEUformat='$nvEUformat'
22645 nvFUformat='$nvFUformat'
22646 nvGUformat='$nvGUformat'
22647 nv_overflows_integers_at='$nv_overflows_integers_at'
22648 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22649 nveformat='$nveformat'
22650 nvfformat='$nvfformat'
22651 nvgformat='$nvgformat'
22652 nvsize='$nvsize'
22653 nvtype='$nvtype'
22654 o_nonblock='$o_nonblock'
22655 obj_ext='$obj_ext'
22656 old_pthread_create_joinable='$old_pthread_create_joinable'
22657 optimize='$optimize'
22658 orderlib='$orderlib'
22659 osname='$osname'
22660 osvers='$osvers'
22661 otherlibdirs='$otherlibdirs'
22662 package='$package'
22663 pager='$pager'
22664 passcat='$passcat'
22665 patchlevel='$patchlevel'
22666 path_sep='$path_sep'
22667 perl5='$perl5'
22668 perl='$perl'
22669 perl_patchlevel='$perl_patchlevel'
22670 perladmin='$perladmin'
22671 perllibs='$perllibs'
22672 perlpath='$perlpath'
22673 pg='$pg'
22674 phostname='$phostname'
22675 pidtype='$pidtype'
22676 plibpth='$plibpth'
22677 pmake='$pmake'
22678 pr='$pr'
22679 prefix='$prefix'
22680 prefixexp='$prefixexp'
22681 privlib='$privlib'
22682 privlibexp='$privlibexp'
22683 procselfexe='$procselfexe'
22684 prototype='$prototype'
22685 ptrsize='$ptrsize'
22686 quadkind='$quadkind'
22687 quadtype='$quadtype'
22688 randbits='$randbits'
22689 randfunc='$randfunc'
22690 random_r_proto='$random_r_proto'
22691 randseedtype='$randseedtype'
22692 ranlib='$ranlib'
22693 rd_nodata='$rd_nodata'
22694 readdir64_r_proto='$readdir64_r_proto'
22695 readdir_r_proto='$readdir_r_proto'
22696 revision='$revision'
22697 rm='$rm'
22698 rm_try='$rm_try'
22699 rmail='$rmail'
22700 run='$run'
22701 runnm='$runnm'
22702 sGMTIME_max='$sGMTIME_max'
22703 sGMTIME_min='$sGMTIME_min'
22704 sPRIEUldbl='$sPRIEUldbl'
22705 sPRIFUldbl='$sPRIFUldbl'
22706 sPRIGUldbl='$sPRIGUldbl'
22707 sPRIXU64='$sPRIXU64'
22708 sPRId64='$sPRId64'
22709 sPRIeldbl='$sPRIeldbl'
22710 sPRIfldbl='$sPRIfldbl'
22711 sPRIgldbl='$sPRIgldbl'
22712 sPRIi64='$sPRIi64'
22713 sPRIo64='$sPRIo64'
22714 sPRIu64='$sPRIu64'
22715 sPRIx64='$sPRIx64'
22716 sSCNfldbl='$sSCNfldbl'
22717 sched_yield='$sched_yield'
22718 scriptdir='$scriptdir'
22719 scriptdirexp='$scriptdirexp'
22720 sed='$sed'
22721 seedfunc='$seedfunc'
22722 selectminbits='$selectminbits'
22723 selecttype='$selecttype'
22724 sendmail='$sendmail'
22725 setgrent_r_proto='$setgrent_r_proto'
22726 sethostent_r_proto='$sethostent_r_proto'
22727 setlocale_r_proto='$setlocale_r_proto'
22728 setnetent_r_proto='$setnetent_r_proto'
22729 setprotoent_r_proto='$setprotoent_r_proto'
22730 setpwent_r_proto='$setpwent_r_proto'
22731 setservent_r_proto='$setservent_r_proto'
22732 sh='$sh'
22733 shar='$shar'
22734 sharpbang='$sharpbang'
22735 shmattype='$shmattype'
22736 shortsize='$shortsize'
22737 shrpenv='$shrpenv'
22738 shsharp='$shsharp'
22739 sig_count='$sig_count'
22740 sig_name='$sig_name'
22741 sig_name_init='$sig_name_init'
22742 sig_num='$sig_num'
22743 sig_num_init='$sig_num_init'
22744 sig_size='$sig_size'
22745 signal_t='$signal_t'
22746 sitearch='$sitearch'
22747 sitearchexp='$sitearchexp'
22748 sitebin='$sitebin'
22749 sitebinexp='$sitebinexp'
22750 sitehtml1dir='$sitehtml1dir'
22751 sitehtml1direxp='$sitehtml1direxp'
22752 sitehtml3dir='$sitehtml3dir'
22753 sitehtml3direxp='$sitehtml3direxp'
22754 sitelib='$sitelib'
22755 sitelib_stem='$sitelib_stem'
22756 sitelibexp='$sitelibexp'
22757 siteman1dir='$siteman1dir'
22758 siteman1direxp='$siteman1direxp'
22759 siteman3dir='$siteman3dir'
22760 siteman3direxp='$siteman3direxp'
22761 siteprefix='$siteprefix'
22762 siteprefixexp='$siteprefixexp'
22763 sitescript='$sitescript'
22764 sitescriptexp='$sitescriptexp'
22765 sizesize='$sizesize'
22766 sizetype='$sizetype'
22767 sleep='$sleep'
22768 smail='$smail'
22769 so='$so'
22770 sockethdr='$sockethdr'
22771 socketlib='$socketlib'
22772 socksizetype='$socksizetype'
22773 sort='$sort'
22774 spackage='$spackage'
22775 spitshell='$spitshell'
22776 srand48_r_proto='$srand48_r_proto'
22777 srandom_r_proto='$srandom_r_proto'
22778 src='$src'
22779 ssizetype='$ssizetype'
22780 startperl='$startperl'
22781 startsh='$startsh'
22782 static_ext='$static_ext'
22783 stdchar='$stdchar'
22784 stdio_base='$stdio_base'
22785 stdio_bufsiz='$stdio_bufsiz'
22786 stdio_cnt='$stdio_cnt'
22787 stdio_filbuf='$stdio_filbuf'
22788 stdio_ptr='$stdio_ptr'
22789 stdio_stream_array='$stdio_stream_array'
22790 strerror_r_proto='$strerror_r_proto'
22791 strings='$strings'
22792 submit='$submit'
22793 subversion='$subversion'
22794 sysman='$sysman'
22795 tail='$tail'
22796 tar='$tar'
22797 targetarch='$targetarch'
22798 tbl='$tbl'
22799 tee='$tee'
22800 test='$test'
22801 timeincl='$timeincl'
22802 timetype='$timetype'
22803 tmpnam_r_proto='$tmpnam_r_proto'
22804 to='$to'
22805 touch='$touch'
22806 tr='$tr'
22807 trnl='$trnl'
22808 troff='$troff'
22809 ttyname_r_proto='$ttyname_r_proto'
22810 u16size='$u16size'
22811 u16type='$u16type'
22812 u32size='$u32size'
22813 u32type='$u32type'
22814 u64size='$u64size'
22815 u64type='$u64type'
22816 u8size='$u8size'
22817 u8type='$u8type'
22818 uidformat='$uidformat'
22819 uidsign='$uidsign'
22820 uidsize='$uidsize'
22821 uidtype='$uidtype'
22822 uname='$uname'
22823 uniq='$uniq'
22824 uquadtype='$uquadtype'
22825 use5005threads='$use5005threads'
22826 use64bitall='$use64bitall'
22827 use64bitint='$use64bitint'
22828 usecrosscompile='$usecrosscompile'
22829 usedl='$usedl'
22830 usedtrace='$usedtrace'
22831 usefaststdio='$usefaststdio'
22832 useithreads='$useithreads'
22833 uselargefiles='$uselargefiles'
22834 uselongdouble='$uselongdouble'
22835 usemallocwrap='$usemallocwrap'
22836 usemorebits='$usemorebits'
22837 usemultiplicity='$usemultiplicity'
22838 usemymalloc='$usemymalloc'
22839 usenm='$usenm'
22840 useopcode='$useopcode'
22841 useperlio='$useperlio'
22842 useposix='$useposix'
22843 usereentrant='$usereentrant'
22844 userelocatableinc='$userelocatableinc'
22845 usesfio='$usesfio'
22846 useshrplib='$useshrplib'
22847 usesitecustomize='$usesitecustomize'
22848 usesocks='$usesocks'
22849 usethreads='$usethreads'
22850 usevendorprefix='$usevendorprefix'
22851 usevfork='$usevfork'
22852 usrinc='$usrinc'
22853 uuname='$uuname'
22854 uvXUformat='$uvXUformat'
22855 uvoformat='$uvoformat'
22856 uvsize='$uvsize'
22857 uvtype='$uvtype'
22858 uvuformat='$uvuformat'
22859 uvxformat='$uvxformat'
22860 vendorarch='$vendorarch'
22861 vendorarchexp='$vendorarchexp'
22862 vendorbin='$vendorbin'
22863 vendorbinexp='$vendorbinexp'
22864 vendorhtml1dir='$vendorhtml1dir'
22865 vendorhtml1direxp='$vendorhtml1direxp'
22866 vendorhtml3dir='$vendorhtml3dir'
22867 vendorhtml3direxp='$vendorhtml3direxp'
22868 vendorlib='$vendorlib'
22869 vendorlib_stem='$vendorlib_stem'
22870 vendorlibexp='$vendorlibexp'
22871 vendorman1dir='$vendorman1dir'
22872 vendorman1direxp='$vendorman1direxp'
22873 vendorman3dir='$vendorman3dir'
22874 vendorman3direxp='$vendorman3direxp'
22875 vendorprefix='$vendorprefix'
22876 vendorprefixexp='$vendorprefixexp'
22877 vendorscript='$vendorscript'
22878 vendorscriptexp='$vendorscriptexp'
22879 version='$version'
22880 version_patchlevel_string='$version_patchlevel_string'
22881 versiononly='$versiononly'
22882 vi='$vi'
22883 voidflags='$voidflags'
22884 xlibpth='$xlibpth'
22885 yacc='$yacc'
22886 yaccflags='$yaccflags'
22887 zcat='$zcat'
22888 zip='$zip'
22889 EOT
22890
22891 : Add in command line options if available
22892 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22893
22894 : add special variables
22895 $test -f $src/patchlevel.h && \
22896 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22897 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22898 echo "PERL_CONFIG_SH=true" >>config.sh
22899
22900 : propagate old symbols
22901 if $test -f UU/config.sh; then
22902         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22903         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
22904                 config.sh config.sh UU/oldconfig.sh |\
22905                 $sort | $uniq -u >UU/oldsyms
22906         set X `cat UU/oldsyms`
22907         shift
22908         case $# in
22909         0) ;;
22910         *)
22911                 cat <<EOM
22912 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22913 EOM
22914                 echo ": Variables propagated from previous config.sh file." >>config.sh
22915                 for sym in `cat UU/oldsyms`; do
22916                         echo "    Propagating $hint variable "'$'"$sym..."
22917                         eval 'tmp="$'"${sym}"'"'
22918                         echo "$tmp" | \
22919                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22920                 done
22921                 ;;
22922         esac
22923 fi
22924
22925 : Finish up by extracting the .SH files
22926 case "$alldone" in
22927 exit)
22928         $rm -rf UU
22929         echo "Extraction done."
22930         exit 0
22931         ;;
22932 cont)
22933         ;;
22934 '')
22935         dflt=''
22936         nostick=true
22937         $cat <<EOM
22938
22939 If you'd like to make any changes to the config.sh file before I begin
22940 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22941
22942 EOM
22943         rp="Press return or use a shell escape to edit config.sh:"
22944         . UU/myread
22945         nostick=''
22946         case "$ans" in
22947         '') ;;
22948         *) : in case they cannot read
22949                 sh 1>&4 -c "$ans";;
22950         esac
22951         ;;
22952 esac
22953
22954 : if this fails, just run all the .SH files by hand
22955 . ./config.sh
22956
22957 echo " "
22958 exec 1>&4
22959 pwd=`pwd`
22960 . ./UU/extract
22961 cd "$pwd"
22962
22963 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22964         dflt=y
22965         case "$silent" in
22966         true) ;;
22967         *)
22968                 $cat <<EOM
22969
22970 Now you need to generate make dependencies by running "$make depend".
22971 You might prefer to run it in background: "$make depend > makedepend.out &"
22972 It can take a while, so you might not want to run it right now.
22973
22974 EOM
22975                 ;;
22976         esac
22977         rp="Run $make depend now?"
22978         . UU/myread
22979         case "$ans" in
22980         y*)
22981                 $make depend && echo "Now you must run '$make'."
22982                 ;;
22983         *)
22984                 echo "You must run '$make depend' then '$make'."
22985                 ;;
22986         esac
22987 elif test -f [Mm]akefile; then
22988         echo " "
22989         echo "Now you must run a $make."
22990 else
22991         echo "Configure done."
22992 fi
22993
22994 if $test -f Policy.sh; then
22995     $cat <<EOM
22996
22997 If you compile $package on a different machine or from a different object
22998 directory, copy the Policy.sh file from this object directory to the
22999 new one before you run Configure -- this will help you with most of
23000 the policy defaults.
23001
23002 EOM
23003 fi
23004 if $test -f config.msg; then
23005     echo "Hmm.  I also noted the following information while running:"
23006     echo " "
23007     $cat config.msg >&4
23008     $rm -f config.msg
23009 fi
23010 $rm -f kit*isdone ark*isdone
23011 $rm -rf UU
23012
23013 : End of Configure
23014