Abolish xfm_lines from struct xpvfm. structs xpvfm and xpvcv are now
[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 Thu Jul 10 17:14:53 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 if eval $compile; then
17466     xxx="`$run ./try`"
17467     case "$?" in
17468         0) cat >&4 <<EOM
17469 sprintf returns the length of the string (as ANSI says it should)
17470 EOM
17471         d_sprintf_returns_strlen="$define"
17472         ;;
17473         *) cat >&4 <<EOM
17474 sprintf does not return the length of the string (how old is this system?)
17475 EOM
17476         d_sprintf_returns_strlen="$undef"
17477         ;;
17478     esac
17479 else
17480     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17481     d_sprintf_returns_strlen="$undef"
17482 fi
17483 $rm_try
17484
17485 : see if srand48_r exists
17486 set srand48_r d_srand48_r
17487 eval $inlibc
17488 case "$d_srand48_r" in
17489 "$define")
17490         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17491         case "$d_srand48_r_proto:$usethreads" in
17492         ":define")      d_srand48_r_proto=define
17493                 set d_srand48_r_proto srand48_r $hdrs
17494                 eval $hasproto ;;
17495         *)      ;;
17496         esac
17497         case "$d_srand48_r_proto" in
17498         define)
17499         case "$srand48_r_proto" in
17500         ''|0) try='int srand48_r(long, struct drand48_data*);'
17501         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17502         esac
17503         case "$srand48_r_proto" in
17504         ''|0)   d_srand48_r=undef
17505                 srand48_r_proto=0
17506                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17507         * )     case "$srand48_r_proto" in
17508                 REENTRANT_PROTO*) ;;
17509                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17510                 esac
17511                 echo "Prototype: $try" ;;
17512         esac
17513         ;;
17514         *)      case "$usethreads" in
17515                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17516                 esac
17517                 d_srand48_r=undef
17518                 srand48_r_proto=0
17519                 ;;
17520         esac
17521         ;;
17522 *)      srand48_r_proto=0
17523         ;;
17524 esac
17525
17526 : see if srandom_r exists
17527 set srandom_r d_srandom_r
17528 eval $inlibc
17529 case "$d_srandom_r" in
17530 "$define")
17531         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17532         case "$d_srandom_r_proto:$usethreads" in
17533         ":define")      d_srandom_r_proto=define
17534                 set d_srandom_r_proto srandom_r $hdrs
17535                 eval $hasproto ;;
17536         *)      ;;
17537         esac
17538         case "$d_srandom_r_proto" in
17539         define)
17540         case "$srandom_r_proto" in
17541         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17542         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17543         esac
17544         case "$srandom_r_proto" in
17545         ''|0)   d_srandom_r=undef
17546                 srandom_r_proto=0
17547                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17548         * )     case "$srandom_r_proto" in
17549                 REENTRANT_PROTO*) ;;
17550                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17551                 esac
17552                 echo "Prototype: $try" ;;
17553         esac
17554         ;;
17555         *)      case "$usethreads" in
17556                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17557                 esac
17558                 d_srandom_r=undef
17559                 srandom_r_proto=0
17560                 ;;
17561         esac
17562         ;;
17563 *)      srandom_r_proto=0
17564         ;;
17565 esac
17566
17567 : see if prototype for setresgid is available
17568 echo " "
17569 set d_sresgproto setresgid $i_unistd unistd.h
17570 eval $hasproto
17571
17572 : see if prototype for setresuid is available
17573 echo " "
17574 set d_sresuproto setresuid $i_unistd unistd.h
17575 eval $hasproto
17576
17577 : see if sys/stat.h is available
17578 set sys/stat.h i_sysstat
17579 eval $inhdr
17580
17581 : see if stat knows about block sizes
17582 echo " "
17583 echo "Checking to see if your struct stat has st_blocks field..." >&4
17584 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17585 eval $hasfield
17586
17587 : see if this is a sys/vfs.h system
17588 set sys/vfs.h i_sysvfs
17589 eval $inhdr
17590
17591 : see if this is a sys/statfs.h system
17592 set sys/statfs.h i_sysstatfs
17593 eval $inhdr
17594
17595 : Check for statfs_s
17596 echo " "
17597 echo "Checking to see if your system supports struct statfs..." >&4
17598 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
17599 eval $hasstruct
17600 case "$d_statfs_s" in
17601 "$define")      echo "Yes, it does."   ;;
17602 *)              echo "No, it doesn't." ;;
17603 esac
17604
17605
17606 : see if struct statfs knows about f_flags
17607 case "$d_statfs_s" in
17608 define)
17609         echo " "
17610         echo "Checking to see if your struct statfs has f_flags field..." >&4
17611         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
17612         eval $hasfield
17613         ;;
17614 *)      val="$undef"
17615         set d_statfs_f_flags
17616         eval $setvar
17617         ;;
17618 esac
17619 case "$d_statfs_f_flags" in
17620 "$define")      echo "Yes, it does."   ;;
17621 *)              echo "No, it doesn't." ;;
17622 esac
17623
17624 : Check stream access
17625 $cat >&4 <<EOM
17626 Checking how to access stdio streams by file descriptor number...
17627 EOM
17628 case "$stdio_stream_array" in
17629 '')     $cat >try.c <<EOCP
17630 #include <stdio.h>
17631 int main() {
17632   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17633     printf("yes\n");
17634 }
17635 EOCP
17636         for s in _iob __iob __sF
17637         do
17638                 set try -DSTDIO_STREAM_ARRAY=$s
17639                 if eval $compile; then
17640                         case "`$run ./try`" in
17641                         yes)    stdio_stream_array=$s; break ;;
17642                         esac
17643                 fi
17644         done
17645         $rm_try
17646 esac
17647 case "$stdio_stream_array" in
17648 '')     $cat >&4 <<EOM
17649 I can't figure out how to access stdio streams by file descriptor number.
17650 EOM
17651         d_stdio_stream_array="$undef"
17652         ;;
17653 *)      $cat >&4 <<EOM
17654 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17655 EOM
17656         d_stdio_stream_array="$define"
17657         ;;
17658 esac
17659
17660 : see if strcoll exists
17661 set strcoll d_strcoll
17662 eval $inlibc
17663
17664 : check for structure copying
17665 echo " "
17666 echo "Checking to see if your C compiler can copy structs..." >&4
17667 $cat >try.c <<'EOCP'
17668 int main()
17669 {
17670         struct blurfl {
17671                 int dyick;
17672         } foo, bar;
17673
17674         foo = bar;
17675 }
17676 EOCP
17677 if $cc -c try.c >/dev/null 2>&1 ; then
17678         val="$define"
17679         echo "Yup, it can."
17680 else
17681         val="$undef"
17682         echo "Nope, it can't."
17683 fi
17684 set d_strctcpy
17685 eval $setvar
17686 $rm_try
17687
17688 : see if strerror and/or sys_errlist[] exist
17689 echo " "
17690 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17691     if set strerror val -f d_strerror; eval $csym; $val; then
17692                 echo 'strerror() found.' >&4
17693                 d_strerror="$define"
17694                 d_strerrm='strerror(e)'
17695                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17696                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17697                         d_syserrlst="$define"
17698                 else
17699                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17700                         d_syserrlst="$undef"
17701                 fi
17702     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17703                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17704                 echo 'strerror() found in string header.' >&4
17705                 d_strerror="$define"
17706                 d_strerrm='strerror(e)'
17707                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17708                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17709                                 d_syserrlst="$define"
17710                 else
17711                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17712                         d_syserrlst="$undef"
17713                 fi
17714     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17715                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17716                 d_strerror="$undef"
17717                 d_syserrlst="$define"
17718                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17719     else
17720                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17721                 d_strerror="$undef"
17722                 d_syserrlst="$undef"
17723                 d_strerrm='"unknown"'
17724     fi
17725 fi
17726
17727 : see if strerror_r exists
17728 set strerror_r d_strerror_r
17729 eval $inlibc
17730 case "$d_strerror_r" in
17731 "$define")
17732         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17733         case "$d_strerror_r_proto:$usethreads" in
17734         ":define")      d_strerror_r_proto=define
17735                 set d_strerror_r_proto strerror_r $hdrs
17736                 eval $hasproto ;;
17737         *)      ;;
17738         esac
17739         case "$d_strerror_r_proto" in
17740         define)
17741         case "$strerror_r_proto" in
17742         ''|0) try='int strerror_r(int, char*, size_t);'
17743         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17744         esac
17745         case "$strerror_r_proto" in
17746         ''|0) try='int strerror_r(int, char*, int);'
17747         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17748         esac
17749         case "$strerror_r_proto" in
17750         ''|0) try='char* strerror_r(int, char*, size_t);'
17751         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17752         esac
17753         case "$strerror_r_proto" in
17754         ''|0)   d_strerror_r=undef
17755                 strerror_r_proto=0
17756                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17757         * )     case "$strerror_r_proto" in
17758                 REENTRANT_PROTO*) ;;
17759                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17760                 esac
17761                 echo "Prototype: $try" ;;
17762         esac
17763         ;;
17764         *)      case "$usethreads" in
17765                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17766                 esac
17767                 d_strerror_r=undef
17768                 strerror_r_proto=0
17769                 ;;
17770         esac
17771         ;;
17772 *)      strerror_r_proto=0
17773         ;;
17774 esac
17775
17776 : see if strftime exists
17777 set strftime d_strftime
17778 eval $inlibc
17779
17780 : see if strlcat exists
17781 set strlcat d_strlcat
17782 eval $inlibc
17783
17784 : see if strlcpy exists
17785 set strlcpy d_strlcpy
17786 eval $inlibc
17787
17788 : see if strtod exists
17789 set strtod d_strtod
17790 eval $inlibc
17791
17792 : see if strtol exists
17793 set strtol d_strtol
17794 eval $inlibc
17795
17796 : see if strtold exists
17797 set strtold d_strtold
17798 eval $inlibc
17799
17800 : see if strtoll exists
17801 set strtoll d_strtoll
17802 eval $inlibc
17803
17804 case "$d_longlong-$d_strtoll" in
17805 "$define-$define")
17806         $cat <<EOM
17807 Checking whether your strtoll() works okay...
17808 EOM
17809         $cat >try.c <<'EOCP'
17810 #include <errno.h>
17811 #ifdef __hpux
17812 #define strtoll __strtoll
17813 #endif
17814 #ifdef __EMX__
17815 #define strtoll _strtoll
17816 #endif
17817 #include <stdio.h>
17818 extern long long int strtoll(char *s, char **, int);
17819 static int bad = 0;
17820 int check(char *s, long long ell, int een) {
17821         long long gll;
17822         errno = 0;
17823         gll = strtoll(s, 0, 10);
17824         if (!((gll == ell) && (errno == een)))
17825                 bad++;
17826 }
17827 int main() {
17828         check(" 1",                                      1LL, 0);
17829         check(" 0",                                      0LL, 0);
17830         check("-1",                                     -1LL, 0);
17831         check("-9223372036854775808", -9223372036854775808LL, 0);
17832         check("-9223372036854775808", -9223372036854775808LL, 0);
17833         check(" 9223372036854775807",  9223372036854775807LL, 0);
17834         check("-9223372036854775808", -9223372036854775808LL, 0);
17835         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17836         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17837         if (!bad)
17838                 printf("ok\n");
17839 }
17840 EOCP
17841         set try
17842         if eval $compile; then
17843                 yyy=`$run ./try`
17844                 case "$yyy" in
17845                 ok) echo "Your strtoll() seems to be working okay." ;;
17846                 *) cat <<EOM >&4
17847 Your strtoll() doesn't seem to be working okay.
17848 EOM
17849                    d_strtoll="$undef"
17850                    ;;
17851                 esac
17852         else
17853                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17854                 d_strtoll="$undef"
17855         fi
17856         ;;
17857 esac
17858
17859 : see if strtoq exists
17860 set strtoq d_strtoq
17861 eval $inlibc
17862
17863 : see if strtoul exists
17864 set strtoul d_strtoul
17865 eval $inlibc
17866
17867 case "$d_strtoul" in
17868 "$define")
17869         $cat <<EOM
17870 Checking whether your strtoul() works okay...
17871 EOM
17872         $cat >try.c <<'EOCP'
17873 #include <errno.h>
17874 #include <stdio.h>
17875 extern unsigned long int strtoul(char *s, char **, int);
17876 static int bad = 0;
17877 void check(char *s, unsigned long eul, int een) {
17878         unsigned long gul;
17879         errno = 0;
17880         gul = strtoul(s, 0, 10);
17881         if (!((gul == eul) && (errno == een)))
17882                 bad++;
17883 }
17884 int main() {
17885         check(" 1", 1L, 0);
17886         check(" 0", 0L, 0);
17887 EOCP
17888         case "$longsize" in
17889         8)
17890             $cat >>try.c <<'EOCP'
17891         check("18446744073709551615", 18446744073709551615UL, 0);
17892         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17893 #if 0 /* strtoul() for /^-/ strings is undefined. */
17894         check("-1", 18446744073709551615UL, 0);
17895         check("-18446744073709551614", 2, 0);
17896         check("-18446744073709551615", 1, 0);
17897         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17898         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17899 #endif
17900 EOCP
17901                 ;;
17902         4)
17903                     $cat >>try.c <<'EOCP'
17904         check("4294967295", 4294967295UL, 0);
17905         check("4294967296", 4294967295UL, ERANGE);
17906 #if 0 /* strtoul() for /^-/ strings is undefined. */
17907         check("-1", 4294967295UL, 0);
17908         check("-4294967294", 2, 0);
17909         check("-4294967295", 1, 0);
17910         check("-4294967296", 4294967295UL, ERANGE);
17911         check("-4294967297", 4294967295UL, ERANGE);
17912 #endif
17913 EOCP
17914                 ;;
17915         *)
17916 : Should we write these tests to be more portable by sprintf-ing
17917 : ~0 and then manipulating that char string as input for strtol?
17918                 ;;
17919         esac
17920         $cat >>try.c <<'EOCP'
17921         if (!bad)
17922                 printf("ok\n");
17923         return 0;
17924 }
17925 EOCP
17926         set try
17927         if eval $compile; then
17928                 case "`$run ./try`" in
17929                 ok) echo "Your strtoul() seems to be working okay." ;;
17930                 *) cat <<EOM >&4
17931 Your strtoul() doesn't seem to be working okay.
17932 EOM
17933                    d_strtoul="$undef"
17934                    ;;
17935                 esac
17936         else
17937                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17938                 d_strtoul="$undef"
17939         fi
17940         ;;
17941 esac
17942
17943 : see if strtoull exists
17944 set strtoull d_strtoull
17945 eval $inlibc
17946
17947 case "$d_longlong-$d_strtoull" in
17948 "$define-$define")
17949         $cat <<EOM
17950 Checking whether your strtoull() works okay...
17951 EOM
17952         $cat >try.c <<'EOCP'
17953 #include <errno.h>
17954 #ifdef __hpux
17955 #define strtoull __strtoull
17956 #endif
17957 #include <stdio.h>
17958 extern unsigned long long int strtoull(char *s, char **, int);
17959 static int bad = 0;
17960 int check(char *s, long long eull, int een) {
17961         long long gull;
17962         errno = 0;
17963         gull = strtoull(s, 0, 10);
17964         if (!((gull == eull) && (errno == een)))
17965                 bad++;
17966 }
17967 int main() {
17968         check(" 1",                                        1LL, 0);
17969         check(" 0",                                        0LL, 0);
17970         check("18446744073709551615",  18446744073709551615ULL, 0);
17971         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17972 #if 0 /* strtoull() for /^-/ strings is undefined. */
17973         check("-1",                    18446744073709551615ULL, 0);
17974         check("-18446744073709551614",                     2LL, 0);
17975         check("-18446744073709551615",                     1LL, 0);
17976         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17977         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17978 #endif
17979         if (!bad)
17980                 printf("ok\n");
17981 }
17982 EOCP
17983         set try
17984         if eval $compile; then
17985                 case "`$run ./try`" in
17986                 ok) echo "Your strtoull() seems to be working okay." ;;
17987                 *) cat <<EOM >&4
17988 Your strtoull() doesn't seem to be working okay.
17989 EOM
17990                    d_strtoull="$undef"
17991                    ;;
17992                 esac
17993         else
17994                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17995                 d_strtoull="$undef"
17996         fi
17997         ;;
17998 esac
17999
18000 : see if strtouq exists
18001 set strtouq d_strtouq
18002 eval $inlibc
18003
18004 case "$d_strtouq" in
18005 "$define")
18006         $cat <<EOM
18007 Checking whether your strtouq() works okay...
18008 EOM
18009         $cat >try.c <<'EOCP'
18010 #include <errno.h>
18011 #include <stdio.h>
18012 extern unsigned long long int strtouq(char *s, char **, int);
18013 static int bad = 0;
18014 void check(char *s, unsigned long long eull, int een) {
18015         unsigned long long gull;
18016         errno = 0;
18017         gull = strtouq(s, 0, 10);
18018         if (!((gull == eull) && (errno == een)))
18019                 bad++;
18020 }
18021 int main() {
18022         check(" 1",                                        1LL, 0);
18023         check(" 0",                                        0LL, 0);
18024         check("18446744073709551615",  18446744073709551615ULL, 0);
18025         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18026 #if 0 /* strtouq() for /^-/ strings is undefined. */
18027         check("-1",                    18446744073709551615ULL, 0);
18028         check("-18446744073709551614",                     2LL, 0);
18029         check("-18446744073709551615",                     1LL, 0);
18030         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18031         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18032 #endif
18033         if (!bad)
18034                 printf("ok\n");
18035         return 0;
18036 }
18037 EOCP
18038         set try
18039         if eval $compile; then
18040                 case "`$run ./try`" in
18041                 ok) echo "Your strtouq() seems to be working okay." ;;
18042                 *) cat <<EOM >&4
18043 Your strtouq() doesn't seem to be working okay.
18044 EOM
18045                    d_strtouq="$undef"
18046                    ;;
18047                 esac
18048         else
18049                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18050                 d_strtouq="$undef"
18051         fi
18052         ;;
18053 esac
18054
18055 : see if strxfrm exists
18056 set strxfrm d_strxfrm
18057 eval $inlibc
18058
18059 : see if symlink exists
18060 set symlink d_symlink
18061 eval $inlibc
18062
18063 : see if syscall exists
18064 set syscall d_syscall
18065 eval $inlibc
18066
18067 : see if prototype for syscall is available
18068 echo " "
18069 set d_syscallproto syscall $i_unistd unistd.h
18070 eval $hasproto
18071
18072 : see if sysconf exists
18073 set sysconf d_sysconf
18074 eval $inlibc
18075
18076 : see if system exists
18077 set system d_system
18078 eval $inlibc
18079
18080 : see if tcgetpgrp exists
18081 set tcgetpgrp d_tcgetpgrp
18082 eval $inlibc
18083
18084 : see if tcsetpgrp exists
18085 set tcsetpgrp d_tcsetpgrp
18086 eval $inlibc
18087
18088 : see if prototype for telldir is available
18089 echo " "
18090 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18091 eval $hasproto
18092
18093 : see if time exists
18094 echo " "
18095 if test "X$d_time" = X -o X"$timetype" = X; then
18096     if set time val -f d_time; eval $csym; $val; then
18097                 echo 'time() found.' >&4
18098                 val="$define"
18099                 rp="What is the type returned by time() on this system?"
18100                 set time_t timetype long stdio.h sys/types.h
18101                 eval $typedef_ask
18102     else
18103                 echo 'time() not found, hope that will do.' >&4
18104                 val="$undef"
18105                 timetype='int';
18106     fi
18107     set d_time
18108     eval $setvar
18109 fi
18110
18111 : see if timegm exists
18112 set timegm d_timegm
18113 eval $inlibc
18114
18115 : see if this is a sys/times.h system
18116 set sys/times.h i_systimes
18117 eval $inhdr
18118
18119 : see if times exists
18120 echo " "
18121 if set times val -f d_times; eval $csym; $val; then
18122         echo 'times() found.' >&4
18123         d_times="$define"
18124         inc=''
18125         case "$i_systimes" in
18126         "$define") inc='sys/times.h';;
18127         esac
18128         rp="What is the type returned by times() on this system?"
18129         set clock_t clocktype long stdio.h sys/types.h $inc
18130         eval $typedef_ask
18131 else
18132         echo 'times() NOT found, hope that will do.' >&4
18133         d_times="$undef"
18134         clocktype='int'
18135 fi
18136
18137 : see if tmpnam_r exists
18138 set tmpnam_r d_tmpnam_r
18139 eval $inlibc
18140 case "$d_tmpnam_r" in
18141 "$define")
18142         hdrs="$i_systypes sys/types.h define stdio.h "
18143         case "$d_tmpnam_r_proto:$usethreads" in
18144         ":define")      d_tmpnam_r_proto=define
18145                 set d_tmpnam_r_proto tmpnam_r $hdrs
18146                 eval $hasproto ;;
18147         *)      ;;
18148         esac
18149         case "$d_tmpnam_r_proto" in
18150         define)
18151         case "$tmpnam_r_proto" in
18152         ''|0) try='char* tmpnam_r(char*);'
18153         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
18154         esac
18155         case "$tmpnam_r_proto" in
18156         ''|0)   d_tmpnam_r=undef
18157                 tmpnam_r_proto=0
18158                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18159         * )     case "$tmpnam_r_proto" in
18160                 REENTRANT_PROTO*) ;;
18161                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18162                 esac
18163                 echo "Prototype: $try" ;;
18164         esac
18165         ;;
18166         *)      case "$usethreads" in
18167                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18168                 esac
18169                 d_tmpnam_r=undef
18170                 tmpnam_r_proto=0
18171                 ;;
18172         esac
18173         ;;
18174 *)      tmpnam_r_proto=0
18175         ;;
18176 esac
18177
18178 : see if truncate exists
18179 set truncate d_truncate
18180 eval $inlibc
18181
18182 : see if ttyname_r exists
18183 set ttyname_r d_ttyname_r
18184 eval $inlibc
18185 case "$d_ttyname_r" in
18186 "$define")
18187         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18188         case "$d_ttyname_r_proto:$usethreads" in
18189         ":define")      d_ttyname_r_proto=define
18190                 set d_ttyname_r_proto ttyname_r $hdrs
18191                 eval $hasproto ;;
18192         *)      ;;
18193         esac
18194         case "$d_ttyname_r_proto" in
18195         define)
18196         case "$ttyname_r_proto" in
18197         ''|0) try='int ttyname_r(int, char*, size_t);'
18198         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
18199         esac
18200         case "$ttyname_r_proto" in
18201         ''|0) try='int ttyname_r(int, char*, int);'
18202         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
18203         esac
18204         case "$ttyname_r_proto" in
18205         ''|0) try='char* ttyname_r(int, char*, int);'
18206         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
18207         esac
18208         case "$ttyname_r_proto" in
18209         ''|0)   d_ttyname_r=undef
18210                 ttyname_r_proto=0
18211                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18212         * )     case "$ttyname_r_proto" in
18213                 REENTRANT_PROTO*) ;;
18214                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18215                 esac
18216                 echo "Prototype: $try" ;;
18217         esac
18218         ;;
18219         *)      case "$usethreads" in
18220                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18221                 esac
18222                 d_ttyname_r=undef
18223                 ttyname_r_proto=0
18224                 ;;
18225         esac
18226         ;;
18227 *)      ttyname_r_proto=0
18228         ;;
18229 esac
18230
18231 : see if tzname[] exists
18232 echo " "
18233 if set tzname val -a d_tzname; eval $csym; $val; then
18234         val="$define"
18235         echo 'tzname[] found.' >&4
18236 else
18237         val="$undef"
18238         echo 'tzname[] NOT found.' >&4
18239 fi
18240 set d_tzname
18241 eval $setvar
18242
18243 : Check if is a multiplatform env
18244 case "$osname" in
18245 next|rhapsody|darwin) multiarch="$define" ;;
18246 esac
18247 case "$multiarch" in
18248 ''|[nN]*) multiarch="$undef" ;;
18249 esac
18250
18251 : check for ordering of bytes in a UV
18252 echo " "
18253 case "$usecrosscompile$multiarch" in
18254 *$define*)
18255         $cat <<EOM
18256 You seem to be either cross-compiling or doing a multiarchitecture build,
18257 skipping the byteorder check.
18258
18259 EOM
18260         byteorder='ffff'
18261         ;;
18262 *)
18263         case "$byteorder" in
18264         '')
18265                 $cat <<'EOM'
18266 In the following, larger digits indicate more significance.  A big-endian
18267 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18268 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18269 machines may have weird orders like 3412.  A Cray will report 87654321,
18270 an Alpha will report 12345678. If the test program works the default is
18271 probably right.
18272 I'm now running the test program...
18273 EOM
18274                 $cat >try.c <<EOCP
18275 #include <stdio.h>
18276 #$i_stdlib I_STDLIB
18277 #ifdef I_STDLIB
18278 #include <stdlib.h>
18279 #endif
18280 #include <sys/types.h>
18281 typedef $uvtype UV;
18282 int main()
18283 {
18284         int i;
18285         union {
18286                 UV l;
18287                 char c[$uvsize];
18288         } u;
18289
18290         if ($uvsize > 4)
18291                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18292         else
18293                 u.l = (UV)0x04030201;
18294         for (i = 0; i < $uvsize; i++)
18295                 printf("%c", u.c[i]+'0');
18296         printf("\n");
18297         exit(0);
18298 }
18299 EOCP
18300                 xxx_prompt=y
18301                 set try
18302                 if eval $compile && $run ./try > /dev/null; then
18303                         dflt=`$run ./try`
18304                         case "$dflt" in
18305                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18306                                 echo "(The test program ran ok.)"
18307                                 echo "byteorder=$dflt"
18308                                 xxx_prompt=n
18309                         ;;
18310                         ????|????????) echo "(The test program ran ok.)" ;;
18311                         *) echo "(The test program didn't run right for some reason.)" ;;
18312                         esac
18313                 else
18314                         dflt='4321'
18315                         cat <<'EOM'
18316 (I can't seem to compile the test program.  Guessing big-endian...)
18317 EOM
18318                 fi
18319                 case "$xxx_prompt" in
18320                 y)
18321                         rp="What is the order of bytes in $uvtype?"
18322                         . ./myread
18323                         byteorder="$ans"
18324                         ;;
18325                 *)      byteorder=$dflt
18326                         ;;
18327                 esac
18328                 ;;
18329         esac
18330         $rm_try
18331         ;;
18332 esac
18333
18334 : Checking 32bit aligndness
18335 $cat <<EOM
18336
18337 Checking to see whether you can access character data unalignedly...
18338 EOM
18339 case "$d_u32align" in
18340 '')   $cat >try.c <<EOCP
18341 #include <stdio.h>
18342 #$i_stdlib I_STDLIB
18343 #ifdef I_STDLIB
18344 #include <stdlib.h>
18345 #endif
18346 #define U32 $u32type
18347 #define BYTEORDER 0x$byteorder
18348 #define U8 $u8type
18349 #include <signal.h>
18350 #ifdef SIGBUS
18351 $signal_t bletch(int s) { exit(4); }
18352 #endif
18353 int main() {
18354 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18355     U8 buf[8];
18356     U32 *up;
18357     int i;
18358
18359     if (sizeof(U32) != 4) {
18360         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18361         exit(1);
18362     }
18363
18364     fflush(stdout);
18365
18366 #ifdef SIGBUS
18367     signal(SIGBUS, bletch);
18368 #endif
18369
18370     buf[0] = 0;
18371     buf[1] = 0;
18372     buf[2] = 0;
18373     buf[3] = 1;
18374     buf[4] = 0;
18375     buf[5] = 0;
18376     buf[6] = 0;
18377     buf[7] = 1;
18378
18379     for (i = 0; i < 4; i++) {
18380         up = (U32*)(buf + i);
18381         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18382                (*up == 1 << (8*(3-i)))  /* little-endian */
18383               )
18384            )
18385         {
18386             printf("read failed (%x)\n", *up);
18387             exit(2);
18388         }
18389     }
18390
18391     /* write test */
18392     for (i = 0; i < 4; i++) {
18393         up = (U32*)(buf + i);
18394         *up = 0xBeef;
18395         if (*up != 0xBeef) {
18396             printf("write failed (%x)\n", *up);
18397             exit(3);
18398         }
18399     }
18400
18401     exit(0);
18402 #else
18403     printf("1\n");
18404     exit(1);
18405 #endif
18406     return 0;
18407 }
18408 EOCP
18409 set try
18410 if eval $compile_ok; then
18411         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18412         $run ./try 2>&1 >/dev/null
18413         case "$?" in
18414         0)      cat >&4 <<EOM
18415 You can access character data pretty unalignedly.
18416 EOM
18417                 d_u32align="$undef"
18418                 ;;
18419         *)      cat >&4 <<EOM
18420 It seems that you must access character data in an aligned manner.
18421 EOM
18422                 d_u32align="$define"
18423                 ;;
18424         esac
18425 else
18426         rp='Can you access character data at unaligned addresses?'
18427         dflt='n'
18428         . ./myread
18429         case "$ans" in
18430         [yY]*)  d_u32align="$undef"  ;;
18431         *)      d_u32align="$define" ;;
18432         esac
18433 fi
18434 $rm_try
18435 ;;
18436 esac
18437
18438 : see if ualarm exists
18439 set ualarm d_ualarm
18440 eval $inlibc
18441
18442 : see if umask exists
18443 set umask d_umask
18444 eval $inlibc
18445
18446 : see if unordered exists
18447 set unordered d_unordered
18448 eval $inlibc
18449
18450 : see if unsetenv exists
18451 set unsetenv d_unsetenv
18452 eval $inlibc
18453
18454 : see if usleep exists
18455 set usleep d_usleep
18456 eval $inlibc
18457
18458 : see if prototype for usleep is available
18459 echo " "
18460 set d_usleepproto usleep $i_unistd unistd.h
18461 eval $hasproto
18462
18463 : see if ustat exists
18464 set ustat d_ustat
18465 eval $inlibc
18466
18467 : see if closedir exists
18468 set closedir d_closedir
18469 eval $inlibc
18470
18471 case "$d_closedir" in
18472 "$define")
18473         echo " "
18474         echo "Checking whether closedir() returns a status..." >&4
18475         cat > try.c <<EOM
18476 #$i_dirent I_DIRENT             /**/
18477 #$i_sysdir I_SYS_DIR            /**/
18478 #$i_sysndir I_SYS_NDIR          /**/
18479 #$i_systypes I_SYS_TYPES        /**/
18480
18481 #if defined(I_SYS_TYPES)
18482 #include <sys/types.h>
18483 #endif
18484 #if defined(I_DIRENT)
18485 #include <dirent.h>
18486 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18487 #include <sys/dir.h>
18488 #endif
18489 #else
18490 #ifdef I_SYS_NDIR
18491 #include <sys/ndir.h>
18492 #else
18493 #ifdef I_SYS_DIR
18494 #ifdef hp9000s500
18495 #include <ndir.h>       /* may be wrong in the future */
18496 #else
18497 #include <sys/dir.h>
18498 #endif
18499 #endif
18500 #endif
18501 #endif
18502 int main() { return closedir(opendir(".")); }
18503 EOM
18504         set try
18505         if eval $compile_ok; then
18506                 if $run ./try > /dev/null 2>&1 ; then
18507                         echo "Yes, it does."
18508                         val="$undef"
18509                 else
18510                         echo "No, it doesn't."
18511                         val="$define"
18512                 fi
18513         else
18514                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18515                 val="$define"
18516         fi
18517         ;;
18518 *)
18519         val="$undef";
18520         ;;
18521 esac
18522 set d_void_closedir
18523 eval $setvar
18524 $rm_try
18525
18526 : see if there is a wait4
18527 set wait4 d_wait4
18528 eval $inlibc
18529
18530 : see if waitpid exists
18531 set waitpid d_waitpid
18532 eval $inlibc
18533
18534 : see if wcstombs exists
18535 set wcstombs d_wcstombs
18536 eval $inlibc
18537
18538 : see if wctomb exists
18539 set wctomb d_wctomb
18540 eval $inlibc
18541
18542 : see if writev exists
18543 set writev d_writev
18544 eval $inlibc
18545
18546 : preserve RCS keywords in files with variable substitution, grrr
18547 Date='$Date'
18548 Id='$Id'
18549 Log='$Log'
18550 RCSfile='$RCSfile'
18551 Revision='$Revision'
18552
18553 : check for alignment requirements
18554 echo " "
18555 case "$usecrosscompile$multiarch" in
18556 *$define*)
18557         $cat <<EOM
18558 You seem to be either cross-compiling or doing a multiarchitecture build,
18559 skipping the memory alignment check.
18560
18561 EOM
18562         case "$alignbytes" in
18563         '') alignbytes=8 ;;
18564         esac
18565         ;;
18566 *)
18567         case "$alignbytes" in
18568         '') echo "Checking alignment constraints..." >&4
18569                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18570                         $cat >try.c <<'EOCP'
18571 typedef long double NV;
18572 EOCP
18573                 else
18574                         $cat >try.c <<'EOCP'
18575 typedef double NV;
18576 EOCP
18577                 fi
18578                 $cat >>try.c <<'EOCP'
18579 #include <stdio.h>
18580 struct foobar {
18581         char foo;
18582         NV bar;
18583 } try_algn;
18584 int main()
18585 {
18586     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18587     return(0);
18588 }
18589 EOCP
18590                 set try
18591                 if eval $compile_ok; then
18592                         dflt=`$run ./try`
18593                 else
18594                         dflt='8'
18595                         echo "(I can't seem to compile the test program...)"
18596                 fi
18597                 ;;
18598         *) dflt="$alignbytes"
18599                 ;;
18600         esac
18601         rp="Doubles must be aligned on a how-many-byte boundary?"
18602         . ./myread
18603         alignbytes="$ans"
18604         $rm_try
18605         ;;
18606 esac
18607
18608
18609 : set the base revision
18610 baserev=5.0
18611
18612 : how do we concatenate cpp tokens here?
18613 echo " "
18614 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18615 $cat >cpp_stuff.c <<'EOCP'
18616 #define RCAT(a,b)a/**/b
18617 #define ACAT(a,b)a ## b
18618 RCAT(Rei,ser)
18619 ACAT(Cir,cus)
18620 EOCP
18621 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18622 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18623         echo "Oh!  Smells like ANSI's been here." >&4
18624         echo "We can catify or stringify, separately or together!"
18625         cpp_stuff=42
18626 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18627         echo "Ah, yes!  The good old days!" >&4
18628         echo "However, in the good old days we don't know how to stringify and"
18629         echo "catify at the same time."
18630         cpp_stuff=1
18631 else
18632         $cat >&4 <<EOM
18633 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18634 You're going to have to edit the values of CAT[2-5] in config.h...
18635 EOM
18636         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18637 fi
18638 $rm -f cpp_stuff.*
18639
18640 : see if this is a db.h system
18641 set db.h i_db
18642 eval $inhdr
18643
18644 case "$i_db" in
18645 $define)
18646         : Check db version.
18647         echo " "
18648         echo "Checking Berkeley DB version ..." >&4
18649         $cat >try.c <<EOCP
18650 #$d_const HASCONST
18651 #ifndef HASCONST
18652 #define const
18653 #endif
18654 #include <sys/types.h>
18655 #include <stdio.h>
18656 #$i_stdlib I_STDLIB
18657 #ifdef I_STDLIB
18658 #include <stdlib.h>
18659 #endif
18660 #include <db.h>
18661 int main(int argc, char *argv[])
18662 {
18663 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18664     int Major, Minor, Patch ;
18665     unsigned long Version ;
18666     (void)db_version(&Major, &Minor, &Patch) ;
18667     if (argc == 2) {
18668         printf("%d %d %d %d %d %d\n",
18669                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18670                Major, Minor, Patch);
18671         exit(0);
18672     }
18673     printf("You have Berkeley DB Version 2 or greater.\n");
18674
18675     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18676                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18677     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18678                 Major, Minor, Patch) ;
18679
18680     /* check that db.h & libdb are compatible */
18681     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18682         printf("db.h and libdb are incompatible.\n") ;
18683         exit(3);
18684     }
18685
18686     printf("db.h and libdb are compatible.\n") ;
18687
18688     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18689                 + DB_VERSION_PATCH ;
18690
18691     /* needs to be >= 2.3.4 */
18692     if (Version < 2003004) {
18693     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18694         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18695         exit(2);
18696     }
18697
18698     exit(0);
18699 #else
18700 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18701     if (argc == 2) {
18702         printf("1 0 0\n");
18703         exit(0);
18704     }
18705     printf("You have Berkeley DB Version 1.\n");
18706     exit(0);    /* DB version < 2: the coast is clear. */
18707 #else
18708     exit(1);    /* <db.h> not Berkeley DB? */
18709 #endif
18710 #endif
18711 }
18712 EOCP
18713         set try
18714         if eval $compile_ok && $run ./try; then
18715                 echo 'Looks OK.' >&4
18716                 set `$run ./try 1`
18717                 db_version_major=$1
18718                 db_version_minor=$2
18719                 db_version_patch=$3
18720         else
18721                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18722                 i_db=$undef
18723                 case " $libs " in
18724                 *"-ldb "*)
18725                         : Remove db from list of libraries to use
18726                         echo "Removing unusable -ldb from library list" >&4
18727                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18728                         shift
18729                         libs="$*"
18730                         echo "libs = $libs" >&4
18731                         ;;
18732                 esac
18733         fi
18734         $rm_try
18735         ;;
18736 esac
18737
18738 case "$i_db" in
18739 define)
18740         : Check the return type needed for hash
18741         echo " "
18742         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18743         $cat >try.c <<EOCP
18744 #$d_const HASCONST
18745 #ifndef HASCONST
18746 #define const
18747 #endif
18748 #include <sys/types.h>
18749 #include <db.h>
18750
18751 #ifndef DB_VERSION_MAJOR
18752 u_int32_t hash_cb (ptr, size)
18753 const void *ptr;
18754 size_t size;
18755 {
18756 }
18757 HASHINFO info;
18758 int main()
18759 {
18760         info.hash = hash_cb;
18761 }
18762 #endif
18763 EOCP
18764         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18765                 if $contains warning try.out >>/dev/null 2>&1 ; then
18766                         db_hashtype='int'
18767                 else
18768                         db_hashtype='u_int32_t'
18769                 fi
18770         else
18771                 : XXX Maybe we should just give up here.
18772                 db_hashtype=u_int32_t
18773                 $cat try.out >&4
18774                 echo "Help:  I can't seem to compile the db test program." >&4
18775                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18776         fi
18777         $rm_try
18778         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18779         ;;
18780 *)      db_hashtype=u_int32_t
18781         ;;
18782 esac
18783 case "$i_db" in
18784 define)
18785         : Check the return type needed for prefix
18786         echo " "
18787         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18788         cat >try.c <<EOCP
18789 #$d_const HASCONST
18790 #ifndef HASCONST
18791 #define const
18792 #endif
18793 #include <sys/types.h>
18794 #include <db.h>
18795
18796 #ifndef DB_VERSION_MAJOR
18797 size_t prefix_cb (key1, key2)
18798 const DBT *key1;
18799 const DBT *key2;
18800 {
18801 }
18802 BTREEINFO info;
18803 int main()
18804 {
18805         info.prefix = prefix_cb;
18806 }
18807 #endif
18808 EOCP
18809         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18810                 if $contains warning try.out >>/dev/null 2>&1 ; then
18811                         db_prefixtype='int'
18812                 else
18813                         db_prefixtype='size_t'
18814                 fi
18815         else
18816                 db_prefixtype='size_t'
18817                 : XXX Maybe we should just give up here.
18818                 $cat try.out >&4
18819                 echo "Help:  I can't seem to compile the db test program." >&4
18820                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18821         fi
18822         $rm_try
18823         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18824         ;;
18825 *)      db_prefixtype='size_t'
18826         ;;
18827 esac
18828
18829 : How can we generate normalized random numbers ?
18830 echo " "
18831 echo "Looking for a random number function..." >&4
18832 case "$randfunc" in
18833 '')
18834         if set drand48 val -f; eval $csym; $val; then
18835                 dflt="drand48"
18836                 echo "Good, found drand48()." >&4
18837         elif set random val -f; eval $csym; $val; then
18838                 dflt="random"
18839                 echo "OK, found random()." >&4
18840         else
18841                 dflt="rand"
18842                 echo "Yick, looks like I have to use rand()." >&4
18843         fi
18844         echo " "
18845         ;;
18846 *)
18847         dflt="$randfunc"
18848         ;;
18849 esac
18850 cont=true
18851
18852 case "$ccflags" in
18853 *-Dmy_rand=*|*-Dmy_srand=*)
18854         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18855         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18856         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18857         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18858         ;;
18859 esac
18860
18861 while $test "$cont"; do
18862         rp="Use which function to generate random numbers?"
18863         . ./myread
18864         if $test "$ans" = "$dflt"; then
18865                 : null
18866         else
18867                 randbits=''
18868         fi
18869         randfunc="$ans"
18870         if set $ans val -f; eval $csym; $val; then
18871                 cont=''
18872         else
18873                 dflt=y
18874                 rp="I cannot find function $ans. Use that name anyway?"
18875                 . ./myread
18876                 dflt=rand
18877                 case "$ans" in
18878                         [yY]*) cont='';;
18879                 esac
18880         fi
18881         case "$cont" in
18882         '')
18883                 case "$randfunc" in
18884                 drand48)
18885                         drand01="drand48()"
18886                         seedfunc="srand48"
18887                         randbits=48
18888                         randseedtype=long
18889                         ;;
18890                 rand|random)
18891                         case "$randbits" in
18892                         '')
18893 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18894                                 $cat >try.c <<EOCP
18895 #$i_unistd I_UNISTD
18896 #$i_stdlib I_STDLIB
18897 #include <stdio.h>
18898 #ifdef I_UNISTD
18899 #  include <unistd.h>
18900 #endif
18901 #ifdef I_STDLIB
18902 #  include <stdlib.h>
18903 #endif
18904 int main()
18905 {
18906         register int i;
18907         register unsigned long tmp;
18908         register unsigned long max = 0L;
18909
18910         for (i = 1000; i; i--) {
18911                 tmp = (unsigned long) $randfunc();
18912                 if (tmp > max) max = tmp;
18913         }
18914         for (i = 0; max; i++)
18915                 max /= 2;
18916         printf("%d\n",i);
18917 }
18918 EOCP
18919                                 set try
18920                                 if eval $compile_ok; then
18921                                         dflt=`try`
18922                                 else
18923                                         dflt='?'
18924                                         echo "(I can't seem to compile the test program...)"
18925                                 fi
18926                                 ;;
18927                         *)
18928                                 dflt="$randbits"
18929                                 ;;
18930                         esac
18931                         rp="How many bits does your $randfunc() function produce?"
18932                         . ./myread
18933                         randbits="$ans"
18934                         $rm_try
18935                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18936                         seedfunc="s$randfunc"
18937                         randseedtype=unsigned
18938                         ;;
18939                 *)
18940                         dflt="31"
18941                         rp="How many bits does your $randfunc() function produce?"
18942                         . ./myread
18943                         randbits="$ans"
18944                         seedfunc="s$randfunc"
18945                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18946                         if set $seedfunc val -f; eval $csym; $val; then
18947                                 echo "(Using $seedfunc() to seed random generator)"
18948                         else
18949                                 echo "(Warning: no $seedfunc() to seed random generator)"
18950                                 seedfunc=rand
18951                         fi
18952                         randseedtype=unsigned
18953                         ;;
18954                 esac
18955                 ;;
18956         esac
18957 done
18958
18959 : Determine if this is an EBCDIC system
18960 echo " "
18961 echo "Determining whether or not we are on an EBCDIC system..." >&4
18962 $cat >try.c <<'EOM'
18963 int main()
18964 {
18965   if ('M'==0xd4) return 0;
18966   return 1;
18967 }
18968 EOM
18969
18970 val=$undef
18971 set try
18972 if eval $compile_ok; then
18973         if $run ./try; then
18974                 echo "You seem to speak EBCDIC." >&4
18975                 val="$define"
18976         else
18977                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18978         fi
18979 else
18980         echo "I'm unable to compile the test program." >&4
18981         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18982 fi
18983 $rm_try
18984 set ebcdic
18985 eval $setvar
18986
18987 : Check how to flush
18988 echo " "
18989 $cat >&4 <<EOM
18990 Checking how to flush all pending stdio output...
18991 EOM
18992 # I only know how to find the first 32 possibly open files on SunOS.
18993 # See also hints/sunos_4_1.sh and util.c  --AD
18994 case "$osname" in
18995 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18996 esac
18997 $cat >>try.c <<EOCP
18998 #include <stdio.h>
18999 #$i_stdlib I_STDLIB
19000 #ifdef I_STDLIB
19001 #include <stdlib.h>
19002 #endif
19003 #$i_unistd I_UNISTD
19004 #ifdef I_UNISTD
19005 # include <unistd.h>
19006 #endif
19007 #$d_sysconf HAS_SYSCONF
19008 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19009 #ifdef HAS_STDIO_STREAM_ARRAY
19010 # define STDIO_STREAM_ARRAY $stdio_stream_array
19011 #endif
19012 int main() {
19013   FILE* p;
19014   unlink("try.out");
19015   p = fopen("try.out", "w");
19016 #ifdef TRY_FPUTC
19017   fputc('x', p);
19018 #else
19019 # ifdef TRY_FPRINTF
19020   fprintf(p, "x");
19021 # endif
19022 #endif
19023 #ifdef TRY_FFLUSH_NULL
19024   fflush(NULL);
19025 #endif
19026 #ifdef TRY_FFLUSH_ALL
19027   {
19028     long open_max = -1;
19029 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19030     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19031 # else
19032 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19033     open_max = sysconf(_SC_OPEN_MAX);
19034 #  else
19035 #   ifdef FOPEN_MAX
19036     open_max = FOPEN_MAX;
19037 #   else
19038 #    ifdef OPEN_MAX
19039     open_max = OPEN_MAX;
19040 #    else
19041 #     ifdef _NFILE
19042     open_max = _NFILE;
19043 #     endif
19044 #    endif
19045 #   endif
19046 #  endif
19047 # endif
19048 # ifdef HAS_STDIO_STREAM_ARRAY
19049     if (open_max > 0) {
19050       long i;
19051       for (i = 0; i < open_max; i++)
19052             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19053                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19054                 STDIO_STREAM_ARRAY[i]._flag)
19055                 fflush(&STDIO_STREAM_ARRAY[i]);
19056     }
19057   }
19058 # endif
19059 #endif
19060   _exit(42);
19061 }
19062 EOCP
19063 : first we have to find out how _not_ to flush
19064 $to try.c
19065 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19066     output=''
19067     set try -DTRY_FPUTC
19068     if eval $compile; then
19069             $run ./try 2>/dev/null
19070             code="$?"
19071             $from try.out
19072             if $test ! -s try.out -a "X$code" = X42; then
19073                 output=-DTRY_FPUTC
19074             fi
19075     fi
19076     case "$output" in
19077     '')
19078             set try -DTRY_FPRINTF
19079             if eval $compile; then
19080                     $run ./try 2>/dev/null
19081                     code="$?"
19082                     $from try.out
19083                     if $test ! -s try.out -a "X$code" = X42; then
19084                         output=-DTRY_FPRINTF
19085                     fi
19086             fi
19087         ;;
19088     esac
19089 fi
19090 : check for fflush NULL behaviour
19091 case "$fflushNULL" in
19092 '')     set try -DTRY_FFLUSH_NULL $output
19093         if eval $compile; then
19094                 $run ./try 2>/dev/null
19095                 code="$?"
19096                 $from try.out
19097                 if $test -s try.out -a "X$code" = X42; then
19098                         fflushNULL="`$cat try.out`"
19099                 else
19100                         if $test "X$code" != X42; then
19101                                 $cat >&4 <<EOM
19102 (If this test failed, don't worry, we'll try another method shortly.)
19103 EOM
19104                         fi
19105                 fi
19106         fi
19107         $rm -f core try.core core.try.*
19108         case "$fflushNULL" in
19109         x)      $cat >&4 <<EOM
19110 Your fflush(NULL) works okay for output streams.
19111 Let's see if it clobbers input pipes...
19112 EOM
19113 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19114 # bug that improperly flushes the input end of pipes.  So we avoid the
19115 # autoflush on fork/system/exec support for now. :-(
19116 $cat >tryp.c <<EOCP
19117 #include <stdio.h>
19118 int
19119 main(int argc, char **argv)
19120 {
19121     char buf[1024];
19122     int i;
19123     char *bp = buf;
19124     while (1) {
19125         while ((i = getc(stdin)) != -1
19126                && (*bp++ = i) != '\n'
19127                && bp < &buf[1024])
19128         /* DO NOTHING */ ;
19129         *bp = '\0';
19130         fprintf(stdout, "%s", buf);
19131         fflush(NULL);
19132         if (i == -1)
19133             return 0;
19134         bp = buf;
19135     }
19136 }
19137 EOCP
19138                 fflushNULL="$define"
19139                 set tryp
19140                 if eval $compile; then
19141                     $rm -f tryp.out
19142                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19143                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19144                        $cat >&4 <<EOM
19145 fflush(NULL) seems to behave okay with input streams.
19146 EOM
19147                         fflushNULL="$define"
19148                     else
19149                         $cat >&4 <<EOM
19150 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19151 EOM
19152                         fflushNULL="$undef"
19153                     fi
19154                 fi
19155                 $rm -f core tryp.c tryp.core core.tryp.*
19156                 ;;
19157         '')     $cat >&4 <<EOM
19158 Your fflush(NULL) isn't working (contrary to ANSI C).
19159 EOM
19160                 fflushNULL="$undef"
19161                 ;;
19162         *)      $cat >&4 <<EOM
19163 Cannot figure out whether your fflush(NULL) works or not.
19164 I'm assuming it doesn't (contrary to ANSI C).
19165 EOM
19166                 fflushNULL="$undef"
19167                 ;;
19168         esac
19169         ;;
19170 $define|true|[yY]*)
19171         fflushNULL="$define"
19172         ;;
19173 *)
19174         fflushNULL="$undef"
19175         ;;
19176 esac
19177 : check explicit looping only if NULL did not work, and if the pipe
19178 : bug does not show up on an explicit flush too
19179 case "$fflushNULL" in
19180 "$undef")
19181         $cat >tryp.c <<EOCP
19182 #include <stdio.h>
19183 int
19184 main(int argc, char **argv)
19185 {
19186     char buf[1024];
19187     int i;
19188     char *bp = buf;
19189     while (1) {
19190         while ((i = getc(stdin)) != -1
19191                && (*bp++ = i) != '\n'
19192                && bp < &buf[1024])
19193         /* DO NOTHING */ ;
19194         *bp = '\0';
19195         fprintf(stdout, "%s", buf);
19196         fflush(stdin);
19197         if (i == -1)
19198             return 0;
19199         bp = buf;
19200     }
19201 }
19202 EOCP
19203         set tryp
19204         if eval $compile; then
19205             $rm -f tryp.out
19206             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19207             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19208                $cat >&4 <<EOM
19209 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19210 EOM
19211                 : now check for fflushall behaviour
19212                 case "$fflushall" in
19213                 '')     set try -DTRY_FFLUSH_ALL $output
19214                         if eval $compile; then
19215                                 $cat >&4 <<EOM
19216 (Now testing the other method--but note that this also may fail.)
19217 EOM
19218                                 $run ./try 2>/dev/null
19219                                 code=$?
19220                                 $from try.out
19221                                 if $test -s try.out -a "X$code" = X42; then
19222                                         fflushall="`$cat try.out`"
19223                                 fi
19224                         fi
19225                         $rm_try
19226                         case "$fflushall" in
19227                         x)      $cat >&4 <<EOM
19228 Whew. Flushing explicitly all the stdio streams works.
19229 EOM
19230                                 fflushall="$define"
19231                                 ;;
19232                         '')     $cat >&4 <<EOM
19233 Sigh. Flushing explicitly all the stdio streams doesn't work.
19234 EOM
19235                                 fflushall="$undef"
19236                                 ;;
19237                         *)      $cat >&4 <<EOM
19238 Cannot figure out whether flushing stdio streams explicitly works or not.
19239 I'm assuming it doesn't.
19240 EOM
19241                                 fflushall="$undef"
19242                                 ;;
19243                         esac
19244                         ;;
19245                 "$define"|true|[yY]*)
19246                         fflushall="$define"
19247                         ;;
19248                 *)
19249                         fflushall="$undef"
19250                         ;;
19251                 esac
19252             else
19253                 $cat >&4 <<EOM
19254 All is futile.  Even fflush(stdin) clobbers input pipes!
19255 EOM
19256                 fflushall="$undef"
19257             fi
19258         else
19259             fflushall="$undef"
19260         fi
19261         $rm -f core tryp.c tryp.core core.tryp.*
19262         ;;
19263 *)      fflushall="$undef"
19264         ;;
19265 esac
19266
19267 case "$fflushNULL$fflushall" in
19268 undefundef)
19269         $cat <<EOM
19270 OK, I give up.  I cannot figure out how to flush pending stdio output.
19271 We won't be flushing handles at all before fork/exec/popen.
19272 EOM
19273         ;;
19274 esac
19275 $rm_try tryp
19276
19277 : Store the full pathname to the ar program for use in the C program
19278 : Respect a hint or command line value for full_ar.
19279 case "$full_ar" in
19280 '') full_ar=$ar ;;
19281 esac
19282
19283 : Store the full pathname to the sed program for use in the C program
19284 full_sed=$sed
19285
19286 : see what type gids are declared as in the kernel
19287 echo " "
19288 echo "Looking for the type for group ids returned by getgid()."
19289 set gid_t gidtype xxx stdio.h sys/types.h
19290 eval $typedef
19291 case "$gidtype" in
19292 xxx)
19293         xxx=`./findhdr sys/user.h`
19294         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19295         case $1 in
19296         unsigned) dflt="$1 $2" ;;
19297         *) dflt="$1" ;;
19298         esac
19299         ;;
19300 *) dflt="$gidtype";;
19301 esac
19302 case "$gidtype" in
19303 gid_t) echo "gid_t found." ;;
19304 *)      rp="What is the type for group ids returned by getgid()?"
19305         . ./myread
19306         gidtype="$ans"
19307         ;;
19308 esac
19309
19310 : Check the size of GID
19311 echo " "
19312 case "$gidtype" in
19313 *_t) zzz="$gidtype"     ;;
19314 *)   zzz="gid"          ;;
19315 esac
19316 echo "Checking the size of $zzz..." >&4
19317 cat > try.c <<EOCP
19318 #include <sys/types.h>
19319 #include <stdio.h>
19320 #$i_stdlib I_STDLIB
19321 #ifdef I_STDLIB
19322 #include <stdlib.h>
19323 #endif
19324 int main() {
19325     printf("%d\n", (int)sizeof($gidtype));
19326     exit(0);
19327 }
19328 EOCP
19329 set try
19330 if eval $compile_ok; then
19331         yyy=`$run ./try`
19332         case "$yyy" in
19333         '')     gidsize=4
19334                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19335                 ;;
19336         *)      gidsize=$yyy
19337                 echo "Your $zzz is $gidsize bytes long."
19338                 ;;
19339         esac
19340 else
19341         gidsize=4
19342         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19343 fi
19344
19345
19346 : Check if GID is signed
19347 echo " "
19348 case "$gidtype" in
19349 *_t) zzz="$gidtype"     ;;
19350 *)   zzz="gid"          ;;
19351 esac
19352 echo "Checking the sign of $zzz..." >&4
19353 cat > try.c <<EOCP
19354 #include <sys/types.h>
19355 #include <stdio.h>
19356 int main() {
19357         $gidtype foo = -1;
19358         if (foo < 0)
19359                 printf("-1\n");
19360         else
19361                 printf("1\n");
19362 }
19363 EOCP
19364 set try
19365 if eval $compile; then
19366         yyy=`$run ./try`
19367         case "$yyy" in
19368         '')     gidsign=1
19369                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19370                 ;;
19371         *)      gidsign=$yyy
19372                 case "$gidsign" in
19373                  1) echo "Your $zzz is unsigned." ;;
19374                 -1) echo "Your $zzz is signed."   ;;
19375                 esac
19376                 ;;
19377         esac
19378 else
19379         gidsign=1
19380         echo "(I can't compile the test program--guessing unsigned.)" >&4
19381 fi
19382
19383
19384 : Check 64bit sizes
19385 echo " "
19386
19387 if $test X"$quadtype" != X; then
19388
19389 echo "Checking how to print 64-bit integers..." >&4
19390
19391 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19392         $cat >try.c <<'EOCP'
19393 #include <sys/types.h>
19394 #include <stdio.h>
19395 int main() {
19396   int q = 12345678901;
19397   printf("%ld\n", q);
19398 }
19399 EOCP
19400         set try
19401         if eval $compile; then
19402                 yyy=`$run ./try`
19403                 case "$yyy" in
19404                 12345678901)
19405                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19406                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19407                         echo "We will use %d."
19408                         ;;
19409                 esac
19410         fi
19411 fi
19412
19413 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19414         $cat >try.c <<'EOCP'
19415 #include <sys/types.h>
19416 #include <stdio.h>
19417 int main() {
19418   long q = 12345678901;
19419   printf("%ld\n", q);
19420 }
19421 EOCP
19422         set try
19423         if eval $compile; then
19424                 yyy=`$run ./try`
19425                 case "$yyy" in
19426                 12345678901)
19427                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19428                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19429                         echo "We will use %ld."
19430                         ;;
19431                 esac
19432         fi
19433 fi
19434
19435 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19436         $cat >try.c <<'EOCP'
19437 #include <sys/types.h>
19438 #include <inttypes.h>
19439 #include <stdio.h>
19440 int main() {
19441   int64_t q = 12345678901;
19442   printf("%" PRId64 "\n", q);
19443 }
19444 EOCP
19445         set try
19446         if eval $compile; then
19447                 yyy=`$run ./try`
19448                 case "$yyy" in
19449                 12345678901)
19450                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19451                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19452                         echo "We will use the C9X style."
19453                         ;;
19454                 esac
19455         fi
19456 fi
19457
19458 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19459         $cat >try.c <<EOCP
19460 #include <sys/types.h>
19461 #include <stdio.h>
19462 int main() {
19463   $quadtype q = 12345678901;
19464   printf("%Ld\n", q);
19465 }
19466 EOCP
19467         set try
19468         if eval $compile; then
19469                 yyy=`$run ./try`
19470                 case "$yyy" in
19471                 12345678901)
19472                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19473                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19474                         echo "We will use %Ld."
19475                         ;;
19476                 esac
19477         fi
19478 fi
19479
19480 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19481         $cat >try.c <<'EOCP'
19482 #include <sys/types.h>
19483 #include <stdio.h>
19484 int main() {
19485   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19486   printf("%lld\n", q);
19487 }
19488 EOCP
19489         set try
19490         if eval $compile; then
19491                 yyy=`$run ./try`
19492                 case "$yyy" in
19493                 12345678901)
19494                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19495                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19496                         echo "We will use the %lld style."
19497                         ;;
19498                 esac
19499         fi
19500 fi
19501
19502 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19503         $cat >try.c <<EOCP
19504 #include <sys/types.h>
19505 #include <stdio.h>
19506 int main() {
19507   $quadtype q = 12345678901;
19508   printf("%qd\n", q);
19509 }
19510 EOCP
19511         set try
19512         if eval $compile; then
19513                 yyy=`$run ./try`
19514                 case "$yyy" in
19515                 12345678901)
19516                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19517                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19518                         echo "We will use %qd."
19519                         ;;
19520                 esac
19521         fi
19522 fi
19523
19524 if $test X"$sPRId64" = X; then
19525         echo "Cannot figure out how to print 64-bit integers." >&4
19526 fi
19527 $rm_try
19528
19529 fi
19530
19531 case "$sPRId64" in
19532 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19533         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19534         ;;
19535 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19536         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19537         ;;
19538 esac
19539
19540 : Check format strings for internal types
19541 echo " "
19542 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19543
19544 if $test X"$ivsize" = X8; then
19545         ivdformat="$sPRId64"
19546         uvuformat="$sPRIu64"
19547         uvoformat="$sPRIo64"
19548         uvxformat="$sPRIx64"
19549         uvXUformat="$sPRIXU64"
19550 else
19551         if $test X"$ivsize" = X"$longsize"; then
19552                 ivdformat='"ld"'
19553                 uvuformat='"lu"'
19554                 uvoformat='"lo"'
19555                 uvxformat='"lx"'
19556                 uvXUformat='"lX"'
19557         else
19558                 if $test X"$ivsize" = X"$intsize"; then
19559                         ivdformat='"d"'
19560                         uvuformat='"u"'
19561                         uvoformat='"o"'
19562                         uvxformat='"x"'
19563                         uvXUformat='"X"'
19564                 else
19565                         : far out
19566                         if $test X"$ivsize" = X"$shortsize"; then
19567                                 ivdformat='"hd"'
19568                                 uvuformat='"hu"'
19569                                 uvoformat='"ho"'
19570                                 uvxformat='"hx"'
19571                                 uvXUformat='"hX"'
19572                         fi
19573                 fi
19574         fi
19575 fi
19576
19577 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19578         nveformat="$sPRIeldbl"
19579         nvfformat="$sPRIfldbl"
19580         nvgformat="$sPRIgldbl"
19581         nvEUformat="$sPRIEUldbl"
19582         nvFUformat="$sPRIFUldbl"
19583         nvGUformat="$sPRIGUldbl"
19584 else
19585         nveformat='"e"'
19586         nvfformat='"f"'
19587         nvgformat='"g"'
19588         nvEUformat='"E"'
19589         nvFUformat='"F"'
19590         nvGUformat='"G"'
19591 fi
19592
19593 case "$ivdformat" in
19594 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19595     exit 1
19596     ;;
19597 esac
19598
19599 : Check format string for GID
19600
19601 echo " "
19602 $echo "Checking the format string to be used for gids..." >&4
19603
19604 case "$gidsign" in
19605 -1)     if $test X"$gidsize" = X"$ivsize"; then
19606                 gidformat="$ivdformat"
19607         else
19608                 if $test X"$gidsize" = X"$longsize"; then
19609                         gidformat='"ld"'
19610                 else
19611                         if $test X"$gidsize" = X"$intsize"; then
19612                                 gidformat='"d"'
19613                         else
19614                                 if $test X"$gidsize" = X"$shortsize"; then
19615                                         gidformat='"hd"'
19616                                 fi
19617                         fi
19618                 fi
19619         fi
19620         ;;
19621 *)      if $test X"$gidsize" = X"$uvsize"; then
19622                 gidformat="$uvuformat"
19623         else
19624                 if $test X"$gidsize" = X"$longsize"; then
19625                         gidformat='"lu"'
19626                 else
19627                         if $test X"$gidsize" = X"$intsize"; then
19628                                 gidformat='"u"'
19629                         else
19630                                 if $test X"$gidsize" = X"$shortsize"; then
19631                                         gidformat='"hu"'
19632                                 fi
19633                         fi
19634                 fi
19635         fi
19636         ;;
19637 esac
19638
19639 : see if getgroups exists
19640 set getgroups d_getgrps
19641 eval $inlibc
19642
19643 : see if setgroups exists
19644 set setgroups d_setgrps
19645 eval $inlibc
19646
19647 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19648 echo " "
19649 case "$d_getgrps$d_setgrps" in
19650 *define*)
19651         case "$groupstype" in
19652         '') dflt="$gidtype" ;;
19653         *)  dflt="$groupstype" ;;
19654         esac
19655         $cat <<EOM
19656 What type of pointer is the second argument to getgroups() and setgroups()?
19657 Usually this is the same as group ids, $gidtype, but not always.
19658
19659 EOM
19660         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19661         . ./myread
19662         groupstype="$ans"
19663         ;;
19664 *)  groupstype="$gidtype";;
19665 esac
19666
19667 : MAD = Misc Attribute Definition
19668
19669 if $test $patchlevel -lt 9; then
19670 : MAD is not available in 5.8.x or earlier.
19671     ans=n;
19672 else
19673     case "$mad" in
19674     $define|true|[yY]*) dflt='y' ;;
19675     *)                  dflt='n' ;;
19676     esac
19677     cat <<EOM
19678
19679 Would you like to build with Misc Attribute Decoration? This is development
19680 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19681 overhead on the interpreter.
19682
19683 If this doesn't make any sense to you, just accept the default '$dflt'.
19684 EOM
19685     rp='Build Perl with MAD?'
19686     . ./myread
19687 fi
19688 case "$ans" in
19689 y|Y)    val="$define"
19690         madlyh='madly.h madly.act madly.tab'
19691         madlysrc='madly.c'
19692         madlyobj="madly$_o" ;;
19693 *)      val="$undef"
19694         madlyh=''
19695         madlysrc=''
19696         madlyobj='' ;;
19697 esac
19698 set mad
19699 eval $setvar
19700
19701 : check whether make sets MAKE
19702 echo " "
19703 echo "Checking if your $make program sets \$(MAKE)..." >&4
19704 case "$make_set_make" in
19705 '')
19706         $sed 's/^X //' > testmake.mak << 'EOF'
19707 Xall:
19708 X       @echo 'maketemp="$(MAKE)"'
19709 EOF
19710         case "`$make -f testmake.mak 2>/dev/null`" in
19711         *maketemp=*) make_set_make='#' ;;
19712         *)      make_set_make="MAKE=$make" ;;
19713         esac
19714         $rm -f testmake.mak
19715         ;;
19716 esac
19717 case "$make_set_make" in
19718 '#') echo "Yup, it does.";;
19719 *) echo "Nope, it doesn't.";;
19720 esac
19721
19722 : see what type is used for mode_t
19723 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19724 set mode_t modetype int stdio.h sys/types.h
19725 eval $typedef_ask
19726
19727 : see if we need va_copy
19728 echo " "
19729 case "$i_stdarg" in
19730 "$define")
19731         $cat >try.c <<EOCP
19732 #include <stdarg.h>
19733 #include <stdio.h>
19734 #$i_stdlib I_STDLIB
19735 #ifdef I_STDLIB
19736 #include <stdlib.h>
19737 #endif
19738 #include <signal.h>
19739
19740 int
19741 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19742 {
19743   return vfprintf(f, fmt, *valp);
19744 }
19745
19746 int
19747 myvfprintf(FILE *f, const  char *fmt, va_list val)
19748 {
19749   return ivfprintf(f, fmt, &val);
19750 }
19751
19752 int
19753 myprintf(char *fmt, ...)
19754 {
19755   va_list val;
19756   va_start(val, fmt);
19757   return myvfprintf(stdout, fmt, val);
19758 }
19759
19760 int
19761 main(int ac, char **av)
19762 {
19763   signal(SIGSEGV, exit);
19764
19765   myprintf("%s%cs all right, then\n", "that", '\'');
19766   exit(0);
19767 }
19768 EOCP
19769         set try
19770         if eval $compile && $run ./try 2>&1 >/dev/null; then
19771                 case "`$run ./try`" in
19772                 "that's all right, then")
19773                         okay=yes
19774                         ;;
19775                 esac
19776         fi
19777         case "$okay" in
19778         yes)    echo "It seems that you don't need va_copy()." >&4
19779                 need_va_copy="$undef"
19780                 ;;
19781         *)      echo "It seems that va_copy() or similar will be needed." >&4
19782                 need_va_copy="$define"
19783                 ;;
19784         esac
19785         $rm_try
19786         ;;
19787 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19788         ;;
19789 esac
19790
19791 : see what type is used for size_t
19792 rp="What is the type used for the length parameter for string functions?"
19793 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19794 eval $typedef_ask
19795
19796 : check for type of arguments to gethostbyaddr. 
19797 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19798         case "$d_gethbyaddr" in
19799         $define)
19800                 $cat <<EOM
19801
19802 Checking to see what type of arguments are accepted by gethostbyaddr().
19803 EOM
19804                 hdrs="$define sys/types.h
19805                         $d_socket sys/socket.h 
19806                         $i_niin netinet/in.h 
19807                         $i_netdb netdb.h
19808                         $i_unistd unistd.h"
19809                 : The first arg can 'char *' or 'void *'
19810                 : The second arg is some of integral type
19811                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19812                         for yyy in size_t long int; do
19813                                 case "$netdb_host_type" in
19814                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19815                                         if ./protochk "$try" $hdrs; then
19816                                                 echo "Your system accepts $xxx for the first arg."
19817                                                 echo "...and $yyy for the second arg."
19818                                                 netdb_host_type="$xxx"
19819                                                 netdb_hlen_type="$yyy"
19820                                         fi
19821                                         ;;
19822                                 esac
19823                         done
19824                 done
19825                 : In case none of those worked, prompt the user.
19826                 case "$netdb_host_type" in
19827                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19828                         dflt='char *'
19829                         . ./myread
19830                         netdb_host_type=$ans
19831                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19832                         dflt="$sizetype"
19833                         . ./myread
19834                         netdb_hlen_type=$ans
19835                         ;;
19836                 esac
19837                 ;;
19838         *)      : no gethostbyaddr, so pick harmless defaults
19839                 netdb_host_type='char *'
19840                 netdb_hlen_type="$sizetype"
19841                 ;;
19842         esac
19843         # Remove the "const" if needed. -- but then we'll have a 
19844         # prototype clash!
19845         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19846 fi
19847
19848 : check for type of argument to gethostbyname. 
19849 if test "X$netdb_name_type" = X ; then
19850         case "$d_gethbyname" in
19851         $define)
19852                 $cat <<EOM
19853
19854 Checking to see what type of argument is accepted by gethostbyname().
19855 EOM
19856                 hdrs="$define sys/types.h
19857                         $d_socket sys/socket.h 
19858                         $i_niin netinet/in.h 
19859                         $i_netdb netdb.h
19860                         $i_unistd unistd.h"
19861                 for xxx in "const char *" "char *"; do
19862                         case "$netdb_name_type" in
19863                         '')     try="extern struct hostent *gethostbyname($xxx);"
19864                                 if ./protochk "$try" $hdrs; then
19865                                         echo "Your system accepts $xxx."
19866                                         netdb_name_type="$xxx"
19867                                 fi
19868                                 ;;
19869                         esac
19870                 done
19871                 : In case none of those worked, prompt the user.
19872                 case "$netdb_name_type" in
19873                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19874                         dflt='char *'
19875                         . ./myread
19876                         netdb_name_type=$ans
19877                         ;;
19878                 esac
19879                 ;;
19880         *)      : no gethostbyname, so pick harmless default
19881                 netdb_name_type='char *'
19882                 ;;
19883         esac
19884 fi
19885
19886 : check for type of 1st argument to getnetbyaddr. 
19887 if test "X$netdb_net_type" = X ; then
19888         case "$d_getnbyaddr" in
19889         $define)
19890                 $cat <<EOM
19891
19892 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19893 EOM
19894                 hdrs="$define sys/types.h
19895                         $d_socket sys/socket.h 
19896                         $i_niin netinet/in.h 
19897                         $i_netdb netdb.h
19898                         $i_unistd unistd.h"
19899                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19900                         case "$netdb_net_type" in
19901                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19902                                 if ./protochk "$try" $hdrs; then
19903                                         echo "Your system accepts $xxx."
19904                                         netdb_net_type="$xxx"
19905                                 fi
19906                                 ;;
19907                         esac
19908                 done
19909                 : In case none of those worked, prompt the user.
19910                 case "$netdb_net_type" in
19911                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19912                         dflt='long'
19913                         . ./myread
19914                         netdb_net_type=$ans
19915                         ;;
19916                 esac
19917                 ;;
19918         *)      : no getnetbyaddr, so pick harmless default
19919                 netdb_net_type='long'
19920                 ;;
19921         esac
19922 fi
19923 : locate the preferred pager for this system
19924 fn=f/
19925 case "$pager" in
19926 '')
19927         dflt=''
19928         case "$pg" in
19929         /*) dflt=$pg;;
19930         [a-zA-Z]:/*) dflt=$pg;;
19931         esac
19932         case "$more" in
19933         /*) dflt=$more;;
19934         [a-zA-Z]:/*) dflt=$more;;
19935         esac
19936         case "$less" in
19937         /*) dflt=$less;;
19938         [a-zA-Z]:/*) dflt=$less;;
19939         esac
19940         case "$dflt" in
19941         '') dflt=/usr/ucb/more;;
19942         esac
19943         ;;
19944 *)      dflt="$pager"
19945         fn="f/($pager)"
19946         ;;
19947 esac
19948 echo " "
19949 rp='What pager is used on your system?'
19950 . ./getfile
19951 pager="$ans"
19952
19953 : see what type pids are declared as in the kernel
19954 rp="What is the type of process ids on this system?"
19955 set pid_t pidtype int stdio.h sys/types.h
19956 eval $typedef_ask
19957
19958 : see if ar generates random libraries by itself
19959 echo " "
19960 echo "Checking how to generate random libraries on your machine..." >&4
19961 echo 'int bar1() { return bar2(); }' > bar1.c
19962 echo 'int bar2() { return 2; }' > bar2.c
19963 $cat > foo.c <<EOP
19964 #$i_stdlib I_STDLIB
19965 #ifdef I_STDLIB
19966 #include <stdlib.h>
19967 #endif
19968 int main() { printf("%d\n", bar1()); exit(0); }
19969 EOP
19970 $cc $ccflags -c bar1.c >/dev/null 2>&1
19971 $cc $ccflags -c bar2.c >/dev/null 2>&1
19972 $cc $ccflags -c foo.c >/dev/null 2>&1
19973 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19974 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19975         $run ./foobar >/dev/null 2>&1; then
19976         echo "$ar appears to generate random libraries itself."
19977         orderlib=false
19978         if [ "X$ranlib" = "X" ]; then
19979             ranlib=":"
19980         fi
19981 elif $ar s bar$_a >/dev/null 2>&1 &&
19982         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19983         $run ./foobar >/dev/null 2>&1; then
19984                 echo "a table of contents needs to be added with '$ar s'."
19985                 orderlib=false
19986                 ranlib="$ar s"
19987 elif $ar ts bar$_a >/dev/null 2>&1 &&
19988         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19989         $run ./foobar >/dev/null 2>&1; then
19990                 echo "a table of contents needs to be added with '$ar ts'."
19991                 orderlib=false
19992                 ranlib="$ar ts"
19993 else
19994         case "$ranlib" in
19995         :) ranlib='';;
19996         '')
19997                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19998                 $test -f $ranlib || ranlib=''
19999                 ;;
20000         esac
20001         if $test -n "$ranlib"; then
20002                 echo "your system has '$ranlib'; we'll use that."
20003                 orderlib=false
20004         else
20005                 echo "your system doesn't seem to support random libraries"
20006                 echo "so we'll use lorder and tsort to order the libraries."
20007                 orderlib=true
20008                 ranlib=":"
20009         fi
20010 fi
20011 $rm -f foo* bar*
20012
20013 : see if this is a values.h system
20014 set values.h i_values
20015 eval $inhdr
20016
20017 : Check the max offset that gmtime accepts
20018 echo "Checking max offsets that gmtime () accepts"
20019
20020 case $i_values in
20021     define) yyy="#include <values.h>" ;;
20022     *)      yyy="" ;;
20023     esac
20024
20025 $cat >try.c <<EOCP
20026 #include <sys/types.h>
20027 #include <stdio.h>
20028 #include <time.h>
20029 $yyy
20030
20031 int i;
20032 struct tm *tmp;
20033 time_t pt;
20034
20035 void gm_check (time_t t)
20036 {
20037     tmp = gmtime (&t);
20038     if (tmp == NULL || tmp->tm_year < -1900)
20039         tmp = NULL;
20040     else
20041         pt = t;
20042     } /* gm_check */
20043
20044 int check_max ()
20045 {
20046   tmp = NULL;
20047   pt  = 0;
20048 #ifdef MAXLONG
20049   gm_check (MAXLONG);
20050 #endif
20051   if (tmp == NULL || tmp->tm_year < 0) {
20052     for (i = 63; i >= 0; i--) {
20053       time_t x = pt | ((time_t)1 << i);
20054       if (x < 0) continue;
20055       gm_check (x);
20056       }
20057     }
20058   printf ("sGMTIME_max=%ld\n", pt);
20059   return (0);
20060   }
20061
20062 int check_min ()
20063 {
20064   tmp = NULL;
20065   pt  = 0;
20066 #ifdef MINLONG
20067   gm_check (MINLONG);
20068 #endif
20069   if (tmp == NULL) {
20070     for (i = 36; i >= 0; i--) {
20071       time_t x = pt - ((time_t)1 << i);
20072       if (x > 0) continue;
20073       gm_check (x);
20074       }
20075     }
20076   printf ("sGMTIME_min=%ld\n", pt);
20077   return (0);
20078   }
20079
20080 int main (int argc, char *argv[])
20081 {
20082   fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20083   check_max ();
20084   check_min ();
20085   return (0);
20086   } /* main */
20087 EOCP
20088 set try
20089 if eval $compile; then
20090     yyy=`$run ./try`
20091     eval $yyy
20092 else
20093     echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20094     fi
20095 $rm_try
20096
20097 : check for type of arguments to select.
20098 case "$selecttype" in
20099 '') case "$d_select" in
20100         $define)
20101                 echo " "
20102                 $cat <<EOM
20103 Checking to see what type of arguments are accepted by select().
20104 EOM
20105                 hdrs="$define sys/types.h
20106                         $i_systime sys/time.h
20107                         $i_sysselct sys/select.h
20108                         $d_socket sys/socket.h"
20109                 : The first arg can be int, unsigned, or size_t
20110                 : The last arg may or may not be 'const'
20111                 val=''
20112                 : void pointer has been seen but using that
20113                 : breaks the selectminbits test
20114                 for xxx in 'fd_set *' 'int *'; do
20115                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20116                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20117                                         case "$val" in
20118                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20119                                                 if ./protochk "$try" $hdrs; then
20120                                                         echo "Your system accepts $xxx."
20121                                                         val="$xxx"
20122                                                 fi
20123                                                 ;;
20124                                         esac
20125                                 done
20126                         done
20127                 done
20128                 case "$val" in
20129                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20130                         case "$d_fd_set" in
20131                                 $define) dflt="fd_set *" ;;
20132                                 *)              dflt="int *" ;;
20133                         esac
20134                         . ./myread
20135                         val=$ans
20136                         ;;
20137                 esac
20138                 selecttype="$val"
20139                 ;;
20140         *)      : no select, so pick a harmless default
20141                 selecttype='int *'
20142                 ;;
20143         esac
20144         ;;
20145 esac
20146
20147 : check for the select 'width'
20148 case "$selectminbits" in
20149 '') safebits=`expr $ptrsize \* 8`
20150     case "$d_select" in
20151         $define)
20152                 $cat <<EOM
20153
20154 Checking to see on how many bits at a time your select() operates...
20155 EOM
20156                 $cat >try.c <<EOCP
20157 #include <sys/types.h>
20158 #$i_time I_TIME
20159 #$i_systime I_SYS_TIME
20160 #$i_systimek I_SYS_TIME_KERNEL
20161 #ifdef I_TIME
20162 #   include <time.h>
20163 #endif
20164 #ifdef I_SYS_TIME
20165 #   ifdef I_SYS_TIME_KERNEL
20166 #       define KERNEL
20167 #   endif
20168 #   include <sys/time.h>
20169 #   ifdef I_SYS_TIME_KERNEL
20170 #       undef KERNEL
20171 #   endif
20172 #endif
20173 #$i_sysselct I_SYS_SELECT
20174 #ifdef I_SYS_SELECT
20175 #include <sys/select.h>
20176 #endif
20177 #$d_socket HAS_SOCKET
20178 #ifdef HAS_SOCKET
20179 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20180 #endif
20181 #include <stdio.h>
20182 #$i_stdlib I_STDLIB
20183 #ifdef I_STDLIB
20184 #include <stdlib.h>
20185 #endif
20186 $selecttype b;
20187 #define S sizeof(*(b))
20188 #define MINBITS 64
20189 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20190 #define NBITS  (NBYTES * 8)
20191 int main() {
20192     char *s = (char *)malloc(NBYTES);
20193     struct timeval t;
20194     int i;
20195     FILE* fp;
20196     int fd;
20197
20198     if (!s)
20199         exit(1);
20200     fclose(stdin);
20201     fp = fopen("try.c", "r");
20202     if (fp == 0)
20203       exit(2);
20204     fd = fileno(fp);
20205     if (fd < 0)
20206       exit(3);
20207     b = ($selecttype)s;
20208     for (i = 0; i < NBITS; i++)
20209         FD_SET(i, b);
20210     t.tv_sec  = 0;
20211     t.tv_usec = 0;
20212     select(fd + 1, b, 0, 0, &t);
20213     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20214     free(s);
20215     printf("%d\n", i + 1);
20216     return 0;
20217 }
20218 EOCP
20219                 set try
20220                 if eval $compile_ok; then
20221                         selectminbits=`$run ./try`
20222                         case "$selectminbits" in
20223                         '')     cat >&4 <<EOM
20224 Cannot figure out on how many bits at a time your select() operates.
20225 I'll play safe and guess it is $safebits bits.
20226 EOM
20227                                 selectminbits=$safebits
20228                                 bits="$safebits bits"
20229                                 ;;
20230                         1)      bits="1 bit" ;;
20231                         *)      bits="$selectminbits bits" ;;
20232                         esac
20233                         echo "Your select() operates on $bits at a time." >&4
20234                 else
20235                         rp='What is the minimum number of bits your select() operates on?'
20236                         case "$byteorder" in
20237                         12345678)       dflt=64 ;;
20238                         1234)           dflt=32 ;;
20239                         *)              dflt=1  ;;
20240                         esac
20241                         . ./myread
20242                         val=$ans
20243                         selectminbits="$val"
20244                 fi
20245                 $rm_try
20246                 ;;
20247         *)      : no select, so pick a harmless default
20248                 selectminbits=$safebits
20249                 ;;
20250         esac
20251         ;;
20252 esac
20253
20254 : Trace out the files included by signal.h, then look for SIGxxx names.
20255 if [ "X$fieldn" = X ]; then
20256         : Just make some guesses.  We check them later.
20257         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20258 else
20259         xxx=`echo '#include <signal.h>' |
20260         $cppstdin $cppminus $cppflags 2>/dev/null |
20261         $grep '^[       ]*#.*include' |
20262         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20263                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20264 fi
20265 xxxfiles=''
20266 for xx in $xxx /dev/null ; do
20267         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20268 done
20269 case "$xxxfiles" in
20270 '')     xxxfiles=`./findhdr signal.h` ;;
20271 esac
20272 xxx=`awk '
20273 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20274         print substr($2, 4, 20)
20275 }
20276 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20277         print substr($3, 4, 20)
20278 }' $xxxfiles`
20279 : Append some common names just in case the awk scan failed.
20280 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20281 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20282 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20283 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20284 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20285
20286 : generate a few handy files for later
20287 $cat > signal.c <<EOCP
20288 #include <sys/types.h>
20289 #include <signal.h>
20290 #$i_stdlib I_STDLIB
20291 #ifdef I_STDLIB
20292 #include <stdlib.h>
20293 #endif
20294 #include <stdio.h>
20295 int main() {
20296
20297 /* Strange style to avoid deeply-nested #if/#else/#endif */
20298 #ifndef NSIG
20299 #  ifdef _NSIG
20300 #    define NSIG (_NSIG)
20301 #  endif
20302 #endif
20303
20304 #ifndef NSIG
20305 #  ifdef SIGMAX
20306 #    define NSIG (SIGMAX+1)
20307 #  endif
20308 #endif
20309
20310 #ifndef NSIG
20311 #  ifdef SIG_MAX
20312 #    define NSIG (SIG_MAX+1)
20313 #  endif
20314 #endif
20315
20316 #ifndef NSIG
20317 #  ifdef _SIG_MAX
20318 #    define NSIG (_SIG_MAX+1)
20319 #  endif
20320 #endif
20321
20322 #ifndef NSIG
20323 #  ifdef MAXSIG
20324 #    define NSIG (MAXSIG+1)
20325 #  endif
20326 #endif
20327
20328 #ifndef NSIG
20329 #  ifdef MAX_SIG
20330 #    define NSIG (MAX_SIG+1)
20331 #  endif
20332 #endif
20333
20334 #ifndef NSIG
20335 #  ifdef SIGARRAYSIZE
20336 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20337 #  endif
20338 #endif
20339
20340 #ifndef NSIG
20341 #  ifdef _sys_nsig
20342 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20343 #  endif
20344 #endif
20345
20346 /* Default to some arbitrary number that's big enough to get most
20347    of the common signals.
20348 */
20349 #ifndef NSIG
20350 #    define NSIG 50
20351 #endif
20352
20353 printf("NSIG %d\n", NSIG);
20354
20355 #ifndef JUST_NSIG
20356
20357 EOCP
20358
20359 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20360 {
20361         printf "#ifdef SIG"; printf $1; printf "\n"
20362         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20363         printf $1; printf ");\n"
20364         printf "#endif\n"
20365 }
20366 END {
20367         printf "#endif /* JUST_NSIG */\n";
20368         printf "exit(0);\n}\n";
20369 }
20370 ' >>signal.c
20371 $cat >signal.awk <<'EOP'
20372 BEGIN { ndups = 0 }
20373 $1 ~ /^NSIG$/ { nsig = $2 }
20374 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20375     if ($2 > maxsig) { maxsig = $2 }
20376     if (sig_name[$2]) {
20377         dup_name[ndups] = $1
20378         dup_num[ndups] = $2
20379         ndups++
20380     }
20381     else {
20382         sig_name[$2] = $1
20383         sig_num[$2] = $2
20384     }
20385 }
20386 END {
20387     if (nsig == 0) {
20388         nsig = maxsig + 1
20389     }
20390     printf("NSIG %d\n", nsig);
20391     for (n = 1; n < nsig; n++) {
20392         if (sig_name[n]) {
20393             printf("%s %d\n", sig_name[n], sig_num[n])
20394         }
20395         else {
20396             printf("NUM%d %d\n", n, n)
20397         }
20398     }
20399     for (n = 0; n < ndups; n++) {
20400         printf("%s %d\n", dup_name[n], dup_num[n])
20401     }
20402 }
20403 EOP
20404 $cat >signal_cmd <<EOS
20405 $startsh
20406 if $test -s signal.lst; then
20407     echo "Using your existing signal.lst file"
20408         exit 0
20409 fi
20410 xxx="$xxx"
20411 EOS
20412 $cat >>signal_cmd <<'EOS'
20413
20414 set signal
20415 if eval $compile_ok; then
20416         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20417                 $uniq | $awk -f signal.awk >signal.lst
20418 else
20419         echo "(I can't seem be able to compile the whole test program)" >&4
20420         echo "(I'll try it in little pieces.)" >&4
20421         set signal -DJUST_NSIG
20422         if eval $compile_ok; then
20423                 $run ./signal$_exe > signal.nsg
20424                 $cat signal.nsg
20425         else
20426                 echo "I can't seem to figure out how many signals you have." >&4
20427                 echo "Guessing 50." >&4
20428                 echo 'NSIG 50' > signal.nsg
20429         fi
20430         : Now look at all the signal names, one at a time.
20431         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20432                 $cat > signal.c <<EOCP
20433 #include <sys/types.h>
20434 #include <signal.h>
20435 #include <stdio.h>
20436 int main() {
20437 printf("$xx %d\n", SIG${xx});
20438 return 0;
20439 }
20440 EOCP
20441                 set signal
20442                 if eval $compile; then
20443                         echo "SIG${xx} found."
20444                         $run ./signal$_exe  >> signal.ls1
20445                 else
20446                         echo "SIG${xx} NOT found."
20447                 fi
20448         done
20449         if $test -s signal.ls1; then
20450                 $cat signal.nsg signal.ls1 |
20451                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20452         fi
20453
20454 fi
20455 if $test -s signal.lst; then
20456         :
20457 else
20458         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20459         echo 'kill -l' >signal
20460         set X `csh -f <signal`
20461         $rm -f signal
20462         shift
20463         case $# in
20464         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20465         esac
20466         echo $@ | $tr ' ' $trnl | \
20467             $awk '{ printf "%s %d\n", $1, ++s; }
20468                   END { printf "NSIG %d\n", ++s }' >signal.lst
20469 fi
20470 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20471 EOS
20472 chmod a+x signal_cmd
20473 $eunicefix signal_cmd
20474
20475 : generate list of signal names
20476 echo " "
20477 case "$sig_name_init" in
20478 '') doinit=yes ;;
20479 *)  case "$sig_num_init" in
20480     ''|*,*) doinit=yes ;;
20481     esac ;;
20482 esac
20483 case "$doinit" in
20484 yes)
20485         echo "Generating a list of signal names and numbers..." >&4
20486         . ./signal_cmd
20487         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20488         sig_name=`$awk 'BEGIN { printf "ZERO " }
20489                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20490         sig_num=`$awk  'BEGIN { printf "0 " }
20491                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20492         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20493                              !/^NSIG/   { printf "\"%s\", ", $1 }
20494                              END        { printf "0\n" }' signal.lst`
20495         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20496                              !/^NSIG/   { printf "%d, ", $2}
20497                              END        { printf "0\n"}' signal.lst`
20498         ;;
20499 esac
20500 echo "The following $sig_count signals are available:"
20501 echo " "
20502 echo $sig_name | $awk \
20503 'BEGIN { linelen = 0 }
20504 {
20505         for (i = 1; i <= NF; i++) {
20506                 name = "SIG" $i " "
20507                 linelen = linelen + length(name)
20508                 if (linelen > 70) {
20509                         printf "\n"
20510                         linelen = length(name)
20511                 }
20512                 printf "%s", name
20513         }
20514         printf "\n"
20515 }'
20516 sig_size=`echo $sig_name | awk '{print NF}'`
20517 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20518
20519 : Check size of size
20520 echo " "
20521 case "$sizetype" in
20522 *_t) zzz="$sizetype"    ;;
20523 *)   zzz="filesize"     ;;
20524 esac
20525 echo "Checking the size of $zzz..." >&4
20526 cat > try.c <<EOCP
20527 #include <sys/types.h>
20528 #include <stdio.h>
20529 #$i_stdlib I_STDLIB
20530 #ifdef I_STDLIB
20531 #include <stdlib.h>
20532 #endif
20533 int main() {
20534     printf("%d\n", (int)sizeof($sizetype));
20535     exit(0);
20536 }
20537 EOCP
20538 set try
20539 if eval $compile_ok; then
20540         yyy=`$run ./try`
20541         case "$yyy" in
20542         '')     sizesize=4
20543                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20544                 ;;
20545         *)      sizesize=$yyy
20546                 echo "Your $zzz size is $sizesize bytes."
20547                 ;;
20548         esac
20549 else
20550         sizesize=4
20551         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20552 fi
20553
20554
20555 : check for socklen_t
20556 echo " "
20557 echo "Checking to see if you have socklen_t..." >&4
20558 $cat >try.c <<EOCP
20559 #include <sys/types.h>
20560 #$d_socket HAS_SOCKET
20561 #ifdef HAS_SOCKET
20562 #include <sys/socket.h>
20563 #endif
20564 int main() { socklen_t x = 16; }
20565 EOCP
20566 set try
20567 if eval $compile; then
20568         val="$define"
20569         echo "You have socklen_t."
20570 else
20571         val="$undef"
20572         echo "You do not have socklen_t."
20573         case "$sizetype" in
20574         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20575         esac
20576 fi
20577 $rm_try
20578 set d_socklen_t
20579 eval $setvar
20580
20581 : see if this is a socks.h system
20582 set socks.h i_socks
20583 eval $inhdr
20584
20585 : check for type of the size argument to socket calls
20586 case "$d_socket" in
20587 "$define")
20588         $cat <<EOM
20589
20590 Checking to see what type is the last argument of accept().
20591 EOM
20592         yyy=''
20593         case "$d_socklen_t" in
20594         "$define") yyy="$yyy socklen_t"
20595         esac
20596         yyy="$yyy $sizetype int long unsigned"
20597         for xxx in $yyy; do
20598                 case "$socksizetype" in
20599                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
20600                         case "$usesocks" in
20601                         "$define")
20602                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20603                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20604                                         socksizetype="$xxx"
20605                                 fi
20606                                 ;;
20607                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20608                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20609                                         socksizetype="$xxx"
20610                                 fi
20611                                 ;;
20612                         esac
20613                         ;;
20614                 esac
20615         done
20616 : In case none of those worked, prompt the user.
20617         case "$socksizetype" in
20618         '')     rp='What is the type for socket address structure sizes?'
20619                 dflt='int'
20620                 . ./myread
20621                 socksizetype=$ans
20622                 ;;
20623         esac
20624         ;;
20625 *)      : no sockets, so pick relatively harmless default
20626         socksizetype='int'
20627         ;;
20628 esac
20629
20630 : see what type is used for signed size_t
20631 set ssize_t ssizetype int stdio.h sys/types.h
20632 eval $typedef
20633 dflt="$ssizetype"
20634 $cat > try.c <<EOM
20635 #include <stdio.h>
20636 #$i_stdlib I_STDLIB
20637 #ifdef I_STDLIB
20638 #include <stdlib.h>
20639 #endif
20640 #include <sys/types.h>
20641 #define Size_t $sizetype
20642 #define SSize_t $dflt
20643 int main()
20644 {
20645         if (sizeof(Size_t) == sizeof(SSize_t))
20646                 printf("$dflt\n");
20647         else if (sizeof(Size_t) == sizeof(int))
20648                 printf("int\n");
20649         else
20650                 printf("long\n");
20651         exit(0);
20652 }
20653 EOM
20654 echo " "
20655 set try
20656 if eval $compile_ok && $run ./try > /dev/null; then
20657         ssizetype=`$run ./try`
20658         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20659 else
20660         $cat >&4 <<EOM
20661 Help! I can't compile and run the ssize_t test program: please enlighten me!
20662 (This is probably a misconfiguration in your system or libraries, and
20663 you really ought to fix it.  Still, I'll try anyway.)
20664
20665 I need a type that is the same size as $sizetype, but is guaranteed to
20666 be signed.  Common values are ssize_t, int and long.
20667
20668 EOM
20669         rp="What signed type is the same size as $sizetype?"
20670         . ./myread
20671         ssizetype="$ans"
20672 fi
20673 $rm_try
20674
20675 : see what type of char stdio uses.
20676 echo " "
20677 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
20678 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20679         echo "Your stdio uses unsigned chars." >&4
20680         stdchar="unsigned char"
20681 else
20682         echo "Your stdio uses signed chars." >&4
20683         stdchar="char"
20684 fi
20685 $rm -f stdioh
20686
20687 : see what type uids are declared as in the kernel
20688 echo " "
20689 echo "Looking for the type for user ids returned by getuid()."
20690 set uid_t uidtype xxx stdio.h sys/types.h
20691 eval $typedef
20692 case "$uidtype" in
20693 xxx)
20694         xxx=`./findhdr sys/user.h`
20695         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20696         case $1 in
20697         unsigned) dflt="$1 $2" ;;
20698         *) dflt="$1" ;;
20699         esac
20700         ;;
20701 *) dflt="$uidtype";;
20702 esac
20703 case "$uidtype" in
20704 uid_t)  echo "uid_t found." ;;
20705 *)      rp="What is the type for user ids returned by getuid()?"
20706         . ./myread
20707         uidtype="$ans"
20708         ;;
20709 esac
20710
20711 : Check size of UID
20712 echo " "
20713 case "$uidtype" in
20714 *_t) zzz="$uidtype"     ;;
20715 *)   zzz="uid"          ;;
20716 esac
20717 echo "Checking the size of $zzz..." >&4
20718 cat > try.c <<EOCP
20719 #include <sys/types.h>
20720 #include <stdio.h>
20721 #$i_stdlib I_STDLIB
20722 #ifdef I_STDLIB
20723 #include <stdlib.h>
20724 #endif
20725 int main() {
20726     printf("%d\n", (int)sizeof($uidtype));
20727     exit(0);
20728 }
20729 EOCP
20730 set try
20731 if eval $compile_ok; then
20732         yyy=`$run ./try`
20733         case "$yyy" in
20734         '')     uidsize=4
20735                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20736                 ;;
20737         *)      uidsize=$yyy
20738                 echo "Your $zzz is $uidsize bytes long."
20739                 ;;
20740         esac
20741 else
20742         uidsize=4
20743         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20744 fi
20745
20746 : Check if UID is signed
20747 echo " "
20748 case "$uidtype" in
20749 *_t) zzz="$uidtype"     ;;
20750 *)   zzz="uid"          ;;
20751 esac
20752 echo "Checking the sign of $zzz..." >&4
20753 cat > try.c <<EOCP
20754 #include <sys/types.h>
20755 #include <stdio.h>
20756 int main() {
20757         $uidtype foo = -1;
20758         if (foo < 0)
20759                 printf("-1\n");
20760         else
20761                 printf("1\n");
20762 }
20763 EOCP
20764 set try
20765 if eval $compile; then
20766         yyy=`$run ./try`
20767         case "$yyy" in
20768         '')     uidsign=1
20769                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20770                 ;;
20771         *)      uidsign=$yyy
20772                 case "$uidsign" in
20773                  1) echo "Your $zzz is unsigned." ;;
20774                 -1) echo "Your $zzz is signed."   ;;
20775                 esac
20776                 ;;
20777         esac
20778 else
20779         uidsign=1
20780         echo "(I can't compile the test program--guessing unsigned.)" >&4
20781 fi
20782
20783
20784 : Check format string for UID
20785 echo " "
20786 $echo "Checking the format string to be used for uids..." >&4
20787
20788 case "$uidsign" in
20789 -1)     if $test X"$uidsize" = X"$ivsize"; then
20790                 uidformat="$ivdformat"
20791         else
20792                 if $test X"$uidsize" = X"$longsize"; then
20793                         uidformat='"ld"'
20794                 else
20795                         if $test X"$uidsize" = X"$intsize"; then
20796                                 uidformat='"d"'
20797                         else
20798                                 if $test X"$uidsize" = X"$shortsize"; then
20799                                         uidformat='"hd"'
20800                                 fi
20801                         fi
20802                 fi
20803         fi
20804         ;;
20805 *)      if $test X"$uidsize" = X"$uvsize"; then
20806                 uidformat="$uvuformat"
20807         else
20808                 if $test X"$uidsize" = X"$longsize"; then
20809                         uidformat='"lu"'
20810                 else
20811                         if $test X"$uidsize" = X"$intsize"; then
20812                                 uidformat='"u"'
20813                         else
20814                                 if $test X"$uidsize" = X"$shortsize"; then
20815                                         uidformat='"hu"'
20816                                 fi
20817                         fi
20818                 fi
20819         fi
20820         ;;
20821 esac
20822
20823 : Check if site customization support was requested
20824 case "$usesitecustomize" in
20825     $define|true|[Yy]*)
20826         usesitecustomize="$define"
20827         ;;
20828     *)
20829         usesitecustomize="$undef"
20830         ;;
20831     esac
20832
20833 : determine compiler compiler
20834 case "$yacc" in
20835 '')
20836         dflt=yacc;;
20837 *)
20838         dflt="$yacc";;
20839 esac
20840 echo " "
20841 comp='yacc'
20842 if $test -f "$byacc$_exe"; then
20843         dflt="$byacc"
20844         comp="byacc or $comp"
20845 fi
20846 if $test -f "$bison$_exe"; then
20847         comp="$comp or bison -y"
20848 fi
20849 rp="Which compiler compiler ($comp) shall I use?"
20850 . ./myread
20851 yacc="$ans"
20852 case "$yacc" in
20853 *bis*)
20854         case "$yacc" in
20855         *-y*) ;;
20856         *)
20857                 yacc="$yacc -y"
20858                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20859                 ;;
20860         esac
20861         ;;
20862 esac
20863
20864 : see if this is a assert.h system
20865 set assert.h i_assert
20866 eval $inhdr
20867
20868 : see if this is a fp.h system
20869 set fp.h i_fp
20870 eval $inhdr
20871
20872 : see if this is a fp_class.h system
20873 set fp_class.h i_fp_class
20874 eval $inhdr
20875
20876 : see if gdbm.h is available
20877 set gdbm.h t_gdbm
20878 eval $inhdr
20879 case "$t_gdbm" in
20880 $define)
20881         : see if gdbm_open exists
20882         set gdbm_open d_gdbm_open
20883         eval $inlibc
20884         case "$d_gdbm_open" in
20885         $undef)
20886                 t_gdbm="$undef"
20887                 echo "We won't be including <gdbm.h>"
20888                 ;;
20889         esac
20890         ;;
20891 esac
20892 val="$t_gdbm"
20893 set i_gdbm
20894 eval $setvar
20895
20896 : see if ndbm.h is available
20897 set ndbm.h i_ndbm
20898 eval $inhdr
20899 : Compatibility location for RedHat 7.1
20900 set gdbm/ndbm.h i_gdbmndbm
20901 eval $inhdr
20902 : Compatibility location for Debian 4.0
20903 set gdbm-ndbm.h i_gdbm_ndbm
20904 eval $inhdr
20905
20906 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
20907         : see if dbm_open exists
20908         set dbm_open d_dbm_open
20909         eval $inlibc
20910         case "$d_dbm_open" in
20911         $undef)
20912                 i_ndbm="$undef"
20913                 i_gdbmndbm="$undef"
20914                 i_gdbm_ndbm="$undef"
20915                 echo "We won't be including <ndbm.h>"
20916             val="$undef"
20917                 ;;
20918         *) val="$define"
20919            ;;
20920         esac
20921 fi
20922 set d_ndbm
20923 eval $setvar
20924
20925 : see if this is a ieeefp.h system
20926 case "$i_ieeefp" in
20927 '' ) set ieeefp.h i_ieeefp
20928      eval $inhdr
20929      ;;
20930 esac
20931
20932 : see if this is a libutil.h system
20933 set libutil.h i_libutil
20934 eval $inhdr
20935
20936 : see if mach cthreads are available
20937 if test "X$usethreads" = "X$define"; then
20938         set mach/cthreads.h i_machcthr
20939         eval $inhdr
20940 else
20941         i_machcthr="$undef"
20942 fi
20943
20944 : see if this is a mntent.h system
20945 set mntent.h i_mntent
20946 eval $inhdr
20947
20948 : see if net/errno.h is available
20949 val=''
20950 set net/errno.h val
20951 eval $inhdr
20952
20953 : Unfortunately, it causes problems on some systems.  Arrgh.
20954 case "$val" in
20955 $define)
20956         cat > try.c <<'EOM'
20957 #include <stdio.h>
20958 #include <errno.h>
20959 #include <net/errno.h>
20960 int func()
20961 {
20962         return ENOTSOCK;
20963 }
20964 EOM
20965         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20966                 echo "We'll be including <net/errno.h>." >&4
20967         else
20968                 echo "We won't be including <net/errno.h>." >&4
20969                 val="$undef"
20970         fi
20971         $rm_try
20972         ;;
20973 esac
20974 set i_neterrno
20975 eval $setvar
20976
20977 : see if netinet/tcp.h is available
20978 set netinet/tcp.h i_netinettcp
20979 eval $inhdr
20980
20981 : see if this is a poll.h system
20982 set poll.h i_poll
20983 eval $inhdr
20984
20985 : see if this is a prot.h system
20986 set prot.h i_prot
20987 eval $inhdr
20988
20989 : Preprocessor symbols
20990 echo " "
20991 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20992 $cat <<'EOSH' > Cppsym.know
20993 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20994 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20995 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20996 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20997 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20998 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20999 bull c cadmus clipper CMU COFF COMPILER_VERSION
21000 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21001 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21002 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21003 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21004 GLIBC GLIBC_MINOR
21005 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21006 H3050R H3050RX hbullx20 hcx host_mips
21007 hp200 hp300 hp700 HP700 hp800 hp9000
21008 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21009 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21010 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21011 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21012 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21013 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21014 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21015 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21016 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21017 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21018 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21019 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21020 MATH_HAS_NO_SIDE_EFFECTS
21021 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21022 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21023 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21024 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21025 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21026 NetBSD news1500 news1700 news1800 news1900 news3700
21027 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21028 ns32016 ns32332 ns32k nsc32000
21029 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21030 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21031 pc532 pdp11 PGC PIC plexus PORTAR posix
21032 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21033 POSIX_C_SOURCE POSIX_SOURCE POWER
21034 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21035 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21036 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21037 sony sony_news sonyrisc sparc sparclite spectrum
21038 stardent stdc STDC_EXT stratos sun sun3 sun386
21039 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21040 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21041 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21042 sysV68 sysV88 Tek4132 Tek4300 titan
21043 TM3200 TM5400 TM5600
21044 tower tower32 tower32_200 tower32_600 tower32_700
21045 tower32_800 tower32_850 tss
21046 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21047 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21048 unix UNIX95 UNIX99 unixpc unos
21049 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21050 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21051 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21052 USGr4 USGr4_2
21053 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21054 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21055 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21056 z8000
21057 EOSH
21058 # Maybe put other stuff here too.
21059 cat <<EOSH >>Cppsym.know
21060 $osname
21061 EOSH
21062 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21063 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21064 $cat Cppsym.know > Cppsym.c
21065 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21066 $rm -f Cppsym.a Cppsym.b Cppsym.c
21067 cat <<EOSH > Cppsym
21068 $startsh
21069 if $test \$# -gt 0; then
21070     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21071     if $test -s Cppsym.got; then
21072         $rm -f Cppsym.got
21073         exit 0
21074     fi
21075     $rm -f Cppsym.got
21076     exit 1
21077 else
21078     $tr " " "$trnl" | ./Cppsym.try
21079     exit 0
21080 fi
21081 EOSH
21082 chmod +x Cppsym
21083 $eunicefix Cppsym
21084 cat <<EOSH > Cppsym.try
21085 $startsh
21086 cat <<'EOCP' > try.c
21087 #include <stdio.h>
21088 #if cpp_stuff == 1
21089 #define STRINGIFY(a)    "a"
21090 #endif
21091 #if cpp_stuff == 42
21092 #define StGiFy(a)  #a
21093 #define STRINGIFY(a)    StGiFy(a)
21094 #endif
21095 #if $cpp_stuff != 1 && $cpp_stuff != 42
21096 #   include "Bletch: How does this C preprocessor stringify macros?"
21097 #endif
21098 int main() {
21099 EOCP
21100 $awk \\
21101 EOSH
21102 cat <<'EOSH' >> Cppsym.try
21103 'length($1) > 0 {
21104     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21105     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21106     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21107     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21108 }'       >> try.c
21109 echo 'return 0;}' >> try.c
21110 EOSH
21111 cat <<EOSH >> Cppsym.try
21112 ccflags="$ccflags"
21113 case "$osname-$gccversion" in
21114 irix-) ccflags="\$ccflags -woff 1178" ;;
21115 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21116 esac
21117 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21118 EOSH
21119 chmod +x Cppsym.try
21120 $eunicefix Cppsym.try
21121 ./Cppsym < Cppsym.know > Cppsym.true
21122 : Add in any linux cpp "predefined macros":
21123 case "$osname::$gccversion" in
21124   *linux*::*.*)
21125     tHdrH=_tmpHdr
21126     rm -f $tHdrH'.h' $tHdrH
21127     touch $tHdrH'.h'
21128     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21129        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21130        if [ -s $tHdrH'_cppsym.real' ]; then
21131           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21132        fi
21133     fi
21134     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21135   ;;
21136 esac
21137 : now check the C compiler for additional symbols
21138 postprocess_cc_v=''
21139 case "$osname" in
21140 aix) postprocess_cc_v="|$tr , ' '" ;;
21141 esac
21142 $cat >ccsym <<EOS
21143 $startsh
21144 $cat >tmp.c <<EOF
21145 extern int foo;
21146 EOF
21147 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21148 do
21149         case "\$i" in
21150         -D*) echo "\$i" | $sed 's/^-D//';;
21151         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21152         esac
21153 done
21154 $rm_try
21155 EOS
21156 postprocess_cc_v=''
21157 chmod +x ccsym
21158 $eunicefix ccsym
21159 ./ccsym > ccsym1.raw
21160 if $test -s ccsym1.raw; then
21161        $sort ccsym1.raw | $uniq >ccsym.raw
21162 else
21163        mv ccsym1.raw ccsym.raw
21164 fi
21165
21166 $awk '/\=/ { print $0; next }
21167         { print $0"=1" }' ccsym.raw >ccsym.list
21168 $comm -13 Cppsym.true ccsym.list >ccsym.own
21169 $comm -12 Cppsym.true ccsym.list >ccsym.com
21170 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21171 also=''
21172 if $test -z ccsym.raw; then
21173         echo "Your C compiler doesn't seem to define any symbols!" >&4
21174         echo " "
21175         echo "However, your C preprocessor defines the following symbols:"
21176         $cat Cppsym.true
21177         ccsymbols=''
21178         cppsymbols=`$cat Cppsym.true`
21179         cppsymbols=`echo $cppsymbols`
21180         cppccsymbols="$cppsymbols"
21181 else
21182         if $test -s ccsym.com; then
21183                 echo "Your C compiler and pre-processor define these symbols:"
21184                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21185                 also='also '
21186                 symbols='ones'
21187                 cppccsymbols=`$cat ccsym.com`
21188                 cppccsymbols=`echo $cppccsymbols`
21189                 $test "$silent" || sleep 1
21190         fi
21191         if $test -s ccsym.cpp; then
21192                 $test "$also" && echo " "
21193                 echo "Your C pre-processor ${also}defines the following symbols:"
21194                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21195                 also='further '
21196                 cppsymbols=`$cat ccsym.cpp`
21197                 cppsymbols=`echo $cppsymbols`
21198                 $test "$silent" || sleep 1
21199         fi
21200         if $test -s ccsym.own; then
21201                 $test "$also" && echo " "
21202                 echo "Your C compiler ${also}defines the following cpp symbols:"
21203                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21204                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21205                 ccsymbols=`$cat ccsym.own`
21206                 ccsymbols=`echo $ccsymbols`
21207                 $test "$silent" || sleep 1
21208         fi
21209 fi
21210
21211 : see if this is a termio system
21212 val="$undef"
21213 val2="$undef"
21214 val3="$undef"
21215 if $test `./findhdr termios.h`; then
21216         set tcsetattr i_termios
21217         eval $inlibc
21218         val3="$i_termios"
21219 fi
21220 echo " "
21221 case "$val3" in
21222 "$define") echo "You have POSIX termios.h... good!" >&4;;
21223 *) if ./Cppsym pyr; then
21224                 case "`/bin/universe`" in
21225                 ucb) if $test `./findhdr sgtty.h`; then
21226                                 val2="$define"
21227                                 echo "<sgtty.h> found." >&4
21228                         else
21229                                 echo "System is pyramid with BSD universe."
21230                                 ./warn "<sgtty.h> not found--you could have problems."
21231                         fi;;
21232                 *) if $test `./findhdr termio.h`; then
21233                                 val="$define"
21234                                 echo "<termio.h> found." >&4
21235                         else
21236                                 echo "System is pyramid with USG universe."
21237                                 ./warn "<termio.h> not found--you could have problems."
21238                         fi;;
21239                 esac
21240         elif ./usg; then
21241                 if $test `./findhdr termio.h`; then
21242                         echo "<termio.h> found." >&4
21243                         val="$define"
21244                 elif $test `./findhdr sgtty.h`; then
21245                         echo "<sgtty.h> found." >&4
21246                         val2="$define"
21247                 else
21248                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21249                 fi
21250         else
21251                 if $test `./findhdr sgtty.h`; then
21252                         echo "<sgtty.h> found." >&4
21253                         val2="$define"
21254                 elif $test `./findhdr termio.h`; then
21255                         echo "<termio.h> found." >&4
21256                         val="$define"
21257                 else
21258                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
21259                 fi
21260         fi;;
21261 esac
21262 set i_termio; eval $setvar
21263 val=$val2; set i_sgtty; eval $setvar
21264 val=$val3; set i_termios; eval $setvar
21265
21266 : see if stddef is available
21267 set stddef.h i_stddef
21268 eval $inhdr
21269
21270 : see if sys/access.h is available
21271 set sys/access.h i_sysaccess
21272 eval $inhdr
21273
21274 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21275 set sys/filio.h i_sysfilio
21276 eval $inhdr
21277 echo " "
21278 if $test `./findhdr sys/ioctl.h`; then
21279         val="$define"
21280         echo '<sys/ioctl.h> found.' >&4
21281 else
21282         val="$undef"
21283         if $test $i_sysfilio = "$define"; then
21284             echo '<sys/ioctl.h> NOT found.' >&4
21285         else
21286                 $test $i_sgtty = "$define" && xxx="sgtty.h"
21287                 $test $i_termio = "$define" && xxx="termio.h"
21288                 $test $i_termios = "$define" && xxx="termios.h"
21289 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21290         fi
21291 fi
21292 set i_sysioctl
21293 eval $setvar
21294
21295 : see if socket ioctl defs are in sys/sockio.h
21296 echo " "
21297 xxx=`./findhdr sys/sockio.h`
21298 if $test "$xxx"; then
21299         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21300                 val="$define"
21301                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21302         else
21303                 val="$undef"
21304                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21305         fi
21306 else
21307         val="$undef"
21308         $cat <<EOM
21309 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21310 EOM
21311 fi
21312 set i_syssockio
21313 eval $setvar
21314
21315 : see if this is a syslog.h system
21316 set syslog.h i_syslog
21317 eval $inhdr
21318
21319 : see if this is a sys/mode.h system
21320 set sys/mode.h i_sysmode
21321 eval $inhdr
21322
21323 : see if there is a sys/poll.h file
21324 set sys/poll.h i_syspoll
21325 eval $inhdr
21326
21327 : see if sys/resource.h has to be included
21328 set sys/resource.h i_sysresrc
21329 eval $inhdr
21330
21331 : see if sys/security.h is available
21332 set sys/security.h i_syssecrt
21333 eval $inhdr
21334
21335 : see if this is a sys/statvfs.h system
21336 set sys/statvfs.h i_sysstatvfs
21337 eval $inhdr
21338
21339 : see if this is a sys/un.h system
21340 set sys/un.h i_sysun
21341 eval $inhdr
21342
21343 : see if this is a sys/utsname.h system
21344 set sys/utsname.h i_sysutsname
21345 eval $inhdr
21346
21347 : see if this is a syswait system
21348 set sys/wait.h i_syswait
21349 eval $inhdr
21350
21351 : see if this is a ustat.h system
21352 set ustat.h i_ustat
21353 eval $inhdr
21354
21355 : see if this is an utime system
21356 set utime.h i_utime
21357 eval $inhdr
21358
21359 : see if this is a vfork system
21360 case "$d_vfork" in
21361 "$define")
21362         set vfork.h i_vfork
21363         eval $inhdr
21364         ;;
21365 *)
21366         i_vfork="$undef"
21367         ;;
21368 esac
21369
21370 : Check extensions
21371 echo " "
21372 echo "Looking for extensions..." >&4
21373 : If we are using the old config.sh, known_extensions may contain
21374 : old or inaccurate or duplicate values.
21375 known_extensions=''
21376 nonxs_extensions=''
21377 : We do not use find because it might not be available.
21378 : We do not just use MANIFEST because the user may have dropped
21379 : some additional extensions into the source tree and expect them
21380 : to be built.
21381
21382 : Function to recursively find available extensions, ignoring DynaLoader
21383 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21384 find_extensions='
21385     for xxx in *; do
21386         case "$xxx" in
21387             DynaLoader|dynaload) ;;
21388             *)
21389             if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
21390                 known_extensions="$known_extensions $1$xxx";
21391             elif $test -f $xxx/Makefile.PL; then
21392                 nonxs_extensions="$nonxs_extensions $1$xxx";
21393             else
21394                 if $test -d $xxx -a $# -lt 10; then
21395                     set $1$xxx/ $*;
21396                     cd "$xxx";
21397                     eval $find_extensions;
21398                     cd ..;
21399                     shift;
21400                 fi;
21401             fi
21402             ;;
21403         esac;
21404     done'
21405 tdir=`pwd`
21406 cd "$rsrc/ext"
21407 set X
21408 shift
21409 eval $find_extensions
21410 # Special case:  Add in modules that nest beyond the first level.
21411 # Currently threads/shared and Hash/Util/FieldHash, since they are
21412 # not picked up by the recursive find above (and adding in general
21413 # recursive finding breaks SDBM_File/sdbm).
21414 # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21415 known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21416 set X $known_extensions
21417 shift
21418 known_extensions="$*"
21419 set X $nonxs_extensions
21420 shift
21421 nonxs_extensions="$*"
21422 cd "$tdir"
21423
21424 : Now see which are supported on this system.
21425 avail_ext=''
21426 for xxx in $known_extensions ; do
21427         case "$xxx" in
21428         DB_File|db_file)
21429                 case "$i_db" in
21430                 $define) avail_ext="$avail_ext $xxx" ;;
21431                 esac
21432                 ;;
21433         GDBM_File|gdbm_fil)
21434                 case "$i_gdbm" in
21435                 $define) avail_ext="$avail_ext $xxx" ;;
21436                 esac
21437                 ;;
21438         I18N/Langinfo|i18n_lan)
21439                 case "$i_langinfo$d_nl_langinfo" in
21440                 $define$define) avail_ext="$avail_ext $xxx" ;;
21441                 esac
21442                 ;;
21443         IPC/SysV|ipc/sysv)
21444                 : XXX Do we need a useipcsysv variable here
21445                 case "${d_msg}${d_sem}${d_shm}" in
21446                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21447                 esac
21448                 ;;
21449         NDBM_File|ndbm_fil)
21450                 case "$i_ndbm" in
21451                 $define)
21452                     case "$osname-$use64bitint" in
21453                     hpux-define)
21454                         case "$libs" in
21455                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21456                         esac
21457                         ;;
21458                     *) avail_ext="$avail_ext $xxx" ;;
21459                     esac
21460                     ;;
21461                 esac
21462                 ;;
21463         ODBM_File|odbm_fil)
21464                 case "${i_dbm}${i_rpcsvcdbm}" in
21465                 *"${define}"*)
21466                     case "$d_cplusplus" in
21467                     define) ;; # delete as a function name will not work
21468                     *)  case "$osname-$use64bitint" in
21469                         hpux-define)
21470                             case "$libs" in
21471                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21472                             esac
21473                             ;;
21474                         *) avail_ext="$avail_ext $xxx" ;;
21475                         esac
21476                         ;;
21477                     esac
21478                     ;;
21479                 esac
21480                 ;;
21481         Opcode|opcode)
21482                 case "$useopcode" in
21483                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21484                 esac
21485                 ;;
21486         POSIX|posix)
21487                 case "$useposix" in
21488                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21489                 esac
21490                 ;;
21491         Socket|socket)
21492                 case "$d_socket" in
21493                 true|$define|y)
21494                     case "$osname" in
21495                     beos) ;; # not unless BONE
21496                     *) avail_ext="$avail_ext $xxx" ;;
21497                     esac
21498                     ;;
21499                 esac
21500                 ;;
21501         Sys/Syslog|sys/syslog)
21502                 : XXX syslog requires socket
21503                 case "$d_socket" in
21504                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21505                 esac
21506                 ;;
21507         Thread|thread)
21508                 case "$usethreads" in
21509                 true|$define|y)
21510                         case "$use5005threads" in
21511                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21512                         esac
21513                 esac
21514                 ;;
21515         threads|threads/shared)
21516                 # threads and threads::shared are special cases.
21517                 # To stop people from asking "Perl 5.8.0 was supposed
21518                 # to have this new fancy threads implementation but my
21519                 # perl doesn't have it" and from people trying to
21520                 # (re)install the threads module using CPAN.pm and
21521                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21522                 # the threads.pm and threads/shared.pm will always be
21523                 # there, croaking informatively ("you need to rebuild
21524                 # all of Perl with threads, sorry") when threads haven't
21525                 # been compiled in.
21526                 # --jhi
21527                 avail_ext="$avail_ext $xxx"
21528                 ;;
21529         Win32*)
21530                 case "$osname" in
21531                 cygwin) avail_ext="$avail_ext $xxx" ;;
21532                 esac
21533                 ;;
21534         XS/APItest|xs/apitest)
21535                 # This is just for testing.  Skip it unless we have dynamic loading.
21536
21537                 case "$usedl" in
21538                 $define) avail_ext="$avail_ext $xxx" ;;
21539                 esac
21540                 ;;
21541         XS/Typemap|xs/typemap)
21542                 # This is just for testing.  Skip it unless we have dynamic loading.
21543                 case "$usedl" in
21544                 $define) avail_ext="$avail_ext $xxx" ;;
21545                 esac
21546                 ;;
21547         *)      avail_ext="$avail_ext $xxx"
21548                 ;;
21549         esac
21550 done
21551
21552 set X $avail_ext
21553 shift
21554 avail_ext="$*"
21555
21556 case "$onlyextensions" in
21557 '') ;;
21558 *)  keepextensions=''
21559     echo "You have requested that only certains extensions be included..." >&4
21560     for i in $onlyextensions; do
21561         case " $avail_ext " in
21562         *" $i "*)
21563             echo "Keeping extension $i."
21564             keepextensions="$keepextensions $i"
21565             ;;
21566         *) echo "Ignoring extension $i." ;;
21567         esac
21568     done
21569     avail_ext="$keepextensions"
21570     ;;
21571 esac
21572
21573 case "$noextensions" in
21574 '') ;;
21575 *)  keepextensions=''
21576     echo "You have requested that certain extensions be ignored..." >&4
21577     for i in $avail_ext; do
21578         case " $noextensions " in
21579         *" $i "*) echo "Ignoring extension $i." ;;
21580         *) echo "Keeping extension $i.";
21581            keepextensions="$keepextensions $i"
21582            ;;
21583         esac
21584     done
21585     avail_ext="$keepextensions"
21586     ;;
21587 esac
21588
21589 : Now see which nonxs extensions are supported on this system.
21590 : For now assume all are.
21591 nonxs_ext=''
21592 for xxx in $nonxs_extensions ; do
21593         case "$xxx" in
21594         *)      nonxs_ext="$nonxs_ext $xxx"
21595                 ;;
21596         esac
21597 done
21598
21599 set X $nonxs_ext
21600 shift
21601 nonxs_ext="$*"
21602
21603 case $usedl in
21604 $define)
21605         $cat <<EOM
21606 A number of extensions are supplied with $package.  You may choose to
21607 compile these extensions for dynamic loading (the default), compile
21608 them into the $package executable (static loading), or not include
21609 them at all.  Answer "none" to include no extensions.
21610 Note that DynaLoader is always built and need not be mentioned here.
21611
21612 EOM
21613         case "$dynamic_ext" in
21614         '')
21615                 : Exclude those listed in static_ext
21616                 dflt=''
21617                 for xxx in $avail_ext; do
21618                         case " $static_ext " in
21619                         *" $xxx "*) ;;
21620                         *) dflt="$dflt $xxx" ;;
21621                         esac
21622                 done
21623                 set X $dflt
21624                 shift
21625                 dflt="$*"
21626                 ;;
21627         *)      dflt="$dynamic_ext"
21628                 # Perhaps we are reusing an old out-of-date config.sh.
21629                 case "$hint" in
21630                 previous)
21631                         if test X"$dynamic_ext" != X"$avail_ext"; then
21632                                 $cat <<EOM
21633 NOTICE:  Your previous config.sh list may be incorrect.
21634 The extensions now available to you are
21635         ${avail_ext}
21636 but the default list from your previous config.sh is
21637         ${dynamic_ext}
21638
21639 EOM
21640                         fi
21641                         ;;
21642                 esac
21643                 ;;
21644         esac
21645         case "$dflt" in
21646         '')     dflt=none;;
21647         esac
21648         rp="What extensions do you wish to load dynamically?"
21649         . ./myread
21650         case "$ans" in
21651         none) dynamic_ext=' ' ;;
21652         *) dynamic_ext="$ans" ;;
21653         esac
21654
21655         case "$static_ext" in
21656         '')
21657                 : Exclude those already listed in dynamic linking
21658                 dflt=''
21659                 for xxx in $avail_ext; do
21660                         case " $dynamic_ext " in
21661                         *" $xxx "*) ;;
21662                         *) dflt="$dflt $xxx" ;;
21663                         esac
21664                 done
21665                 set X $dflt
21666                 shift
21667                 dflt="$*"
21668                 ;;
21669         *)  dflt="$static_ext"
21670                 ;;
21671         esac
21672
21673         case "$dflt" in
21674         '')     dflt=none;;
21675         esac
21676         rp="What extensions do you wish to load statically?"
21677         . ./myread
21678         case "$ans" in
21679         none) static_ext=' ' ;;
21680         *) static_ext="$ans" ;;
21681         esac
21682         ;;
21683 *)
21684         $cat <<EOM
21685 A number of extensions are supplied with $package.  Answer "none"
21686 to include no extensions.
21687 Note that DynaLoader is always built and need not be mentioned here.
21688
21689 EOM
21690         case "$static_ext" in
21691         '') dflt="$avail_ext" ;;
21692         *)      dflt="$static_ext"
21693                 # Perhaps we are reusing an old out-of-date config.sh.
21694                 case "$hint" in
21695                 previous)
21696                         if test X"$static_ext" != X"$avail_ext"; then
21697                                 $cat <<EOM
21698 NOTICE:  Your previous config.sh list may be incorrect.
21699 The extensions now available to you are
21700         ${avail_ext}
21701 but the default list from your previous config.sh is
21702         ${static_ext}
21703
21704 EOM
21705                         fi
21706                         ;;
21707                 esac
21708                 ;;
21709         esac
21710         : Exclude those that are not xs extensions
21711         case "$dflt" in
21712         '')     dflt=none;;
21713         esac
21714         rp="What extensions do you wish to include?"
21715         . ./myread
21716         case "$ans" in
21717         none) static_ext=' ' ;;
21718         *) static_ext="$ans" ;;
21719         esac
21720         ;;
21721 esac
21722 #
21723 # Encode is a special case.  If we are building Encode as a static
21724 # extension, we need to explicitly list its subextensions as well.
21725 # For other nested extensions, this is handled automatically by
21726 # the appropriate Makefile.PL.
21727 case " $static_ext " in
21728         *" Encode "*) # Add the subextensions of Encode
21729         cd "$rsrc/ext"
21730         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21731                 static_ext="$static_ext Encode/$xxx"
21732         done
21733         cd "$tdir"
21734         ;;
21735 esac
21736
21737 set X $dynamic_ext $static_ext $nonxs_ext
21738 shift
21739 extensions="$*"
21740
21741 # Sanity check:  We require an extension suitable for use with
21742 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21743 # should show up as failures in the test suite, but it's helpful to
21744 # catch them now.) The 'extensions' list is normally sorted
21745 # alphabetically, so we need to accept either
21746 #    DB_File ... Fcntl ... IO  ....
21747 # or something like
21748 #    Fcntl ... NDBM_File ... IO  ....
21749 case " $extensions"  in
21750 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21751 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21752 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21753 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21754    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21755    ;;
21756 esac
21757
21758 : Remove libraries needed only for extensions
21759 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21760 : The exception is SunOS 4.x, which needs them.
21761 case "${osname}X${osvers}" in
21762 sunos*X4*)
21763     perllibs="$libs"
21764     ;;
21765 *) case "$usedl" in
21766     $define|true|[yY]*)
21767             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21768             shift
21769             perllibs="$*"
21770             ;;
21771     *)  perllibs="$libs"
21772             ;;
21773     esac
21774     ;;
21775 esac
21776
21777 : Remove build directory name from cppstdin so it can be used from
21778 : either the present location or the final installed location.
21779 echo " "
21780 : Get out of the UU directory to get correct path name.
21781 cd ..
21782 case "$cppstdin" in
21783 `pwd`/cppstdin)
21784         echo "Stripping down cppstdin path name"
21785         cppstdin=cppstdin
21786         ;;
21787 esac
21788 cd UU
21789
21790 : end of configuration questions
21791 echo " "
21792 echo "End of configuration questions."
21793 echo " "
21794
21795 : back to where it started
21796 if test -d ../UU; then
21797         cd ..
21798 fi
21799
21800 : configuration may be unconditionally patched via a 'config.arch' file
21801 if $test -f config.arch; then
21802         echo "I see a config.arch file, loading it." >&4
21803         . ./config.arch
21804 fi
21805
21806 : configuration may be patched via a 'config.over' file
21807 if $test -f config.over; then
21808         echo " "
21809         dflt=y
21810         rp='I see a config.over file.  Do you wish to load it?'
21811         . UU/myread
21812         case "$ans" in
21813         n*) echo "OK, I'll ignore it.";;
21814         *)      . ./config.over
21815                 echo "Configuration override changes have been loaded."
21816                 ;;
21817         esac
21818 fi
21819
21820 : in case they want portability, strip down executable paths
21821 case "$d_portable" in
21822 "$define")
21823         echo " "
21824         echo "Stripping down executable paths..." >&4
21825         for file in $loclist $trylist; do
21826                 eval temp=\$$file
21827                 eval $file=`basename $temp`
21828         done
21829         ;;
21830 esac
21831
21832 : create config.sh file
21833 echo " "
21834 echo "Creating config.sh..." >&4
21835 $spitshell <<EOT >config.sh
21836 $startsh
21837 #
21838 # This file was produced by running the Configure script. It holds all the
21839 # definitions figured out by Configure. Should you modify one of these values,
21840 # do not forget to propagate your changes by running "Configure -der". You may
21841 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21842 #
21843
21844 # Package name      : $package
21845 # Source directory  : $src
21846 # Configuration time: $cf_time
21847 # Configured by     : $cf_by
21848 # Target system     : $myuname
21849
21850 EOT
21851 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21852 $spitshell <<EOT >>config.sh
21853
21854 Author='$Author'
21855 Date='$Date'
21856 Header='$Header'
21857 Id='$Id'
21858 Locker='$Locker'
21859 Log='$Log'
21860 RCSfile='$RCSfile'
21861 Revision='$Revision'
21862 Source='$Source'
21863 State='$State'
21864 _a='$_a'
21865 _exe='$_exe'
21866 _o='$_o'
21867 afs='$afs'
21868 afsroot='$afsroot'
21869 alignbytes='$alignbytes'
21870 ansi2knr='$ansi2knr'
21871 aphostname='$aphostname'
21872 api_revision='$api_revision'
21873 api_subversion='$api_subversion'
21874 api_version='$api_version'
21875 api_versionstring='$api_versionstring'
21876 ar='$ar'
21877 archlib='$archlib'
21878 archlibexp='$archlibexp'
21879 archname64='$archname64'
21880 archname='$archname'
21881 archobjs='$archobjs'
21882 asctime_r_proto='$asctime_r_proto'
21883 awk='$awk'
21884 baserev='$baserev'
21885 bash='$bash'
21886 bin='$bin'
21887 binexp='$binexp'
21888 bison='$bison'
21889 byacc='$byacc'
21890 byteorder='$byteorder'
21891 c='$c'
21892 castflags='$castflags'
21893 cat='$cat'
21894 cc='$cc'
21895 cccdlflags='$cccdlflags'
21896 ccdlflags='$ccdlflags'
21897 ccflags='$ccflags'
21898 ccflags_uselargefiles='$ccflags_uselargefiles'
21899 ccname='$ccname'
21900 ccsymbols='$ccsymbols'
21901 ccversion='$ccversion'
21902 cf_by='$cf_by'
21903 cf_email='$cf_email'
21904 cf_time='$cf_time'
21905 chgrp='$chgrp'
21906 chmod='$chmod'
21907 chown='$chown'
21908 clocktype='$clocktype'
21909 comm='$comm'
21910 compress='$compress'
21911 contains='$contains'
21912 cp='$cp'
21913 cpio='$cpio'
21914 cpp='$cpp'
21915 cpp_stuff='$cpp_stuff'
21916 cppccsymbols='$cppccsymbols'
21917 cppflags='$cppflags'
21918 cpplast='$cpplast'
21919 cppminus='$cppminus'
21920 cpprun='$cpprun'
21921 cppstdin='$cppstdin'
21922 cppsymbols='$cppsymbols'
21923 crypt_r_proto='$crypt_r_proto'
21924 cryptlib='$cryptlib'
21925 csh='$csh'
21926 ctermid_r_proto='$ctermid_r_proto'
21927 ctime_r_proto='$ctime_r_proto'
21928 d_Gconvert='$d_Gconvert'
21929 d_PRIEUldbl='$d_PRIEUldbl'
21930 d_PRIFUldbl='$d_PRIFUldbl'
21931 d_PRIGUldbl='$d_PRIGUldbl'
21932 d_PRIXU64='$d_PRIXU64'
21933 d_PRId64='$d_PRId64'
21934 d_PRIeldbl='$d_PRIeldbl'
21935 d_PRIfldbl='$d_PRIfldbl'
21936 d_PRIgldbl='$d_PRIgldbl'
21937 d_PRIi64='$d_PRIi64'
21938 d_PRIo64='$d_PRIo64'
21939 d_PRIu64='$d_PRIu64'
21940 d_PRIx64='$d_PRIx64'
21941 d_SCNfldbl='$d_SCNfldbl'
21942 d__fwalk='$d__fwalk'
21943 d_access='$d_access'
21944 d_accessx='$d_accessx'
21945 d_aintl='$d_aintl'
21946 d_alarm='$d_alarm'
21947 d_archlib='$d_archlib'
21948 d_asctime_r='$d_asctime_r'
21949 d_atolf='$d_atolf'
21950 d_atoll='$d_atoll'
21951 d_attribute_format='$d_attribute_format'
21952 d_attribute_malloc='$d_attribute_malloc'
21953 d_attribute_nonnull='$d_attribute_nonnull'
21954 d_attribute_noreturn='$d_attribute_noreturn'
21955 d_attribute_pure='$d_attribute_pure'
21956 d_attribute_unused='$d_attribute_unused'
21957 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21958 d_bcmp='$d_bcmp'
21959 d_bcopy='$d_bcopy'
21960 d_bsd='$d_bsd'
21961 d_bsdgetpgrp='$d_bsdgetpgrp'
21962 d_bsdsetpgrp='$d_bsdsetpgrp'
21963 d_builtin_choose_expr='$d_builtin_choose_expr'
21964 d_builtin_expect='$d_builtin_expect'
21965 d_bzero='$d_bzero'
21966 d_c99_variadic_macros='$d_c99_variadic_macros'
21967 d_casti32='$d_casti32'
21968 d_castneg='$d_castneg'
21969 d_charvspr='$d_charvspr'
21970 d_chown='$d_chown'
21971 d_chroot='$d_chroot'
21972 d_chsize='$d_chsize'
21973 d_class='$d_class'
21974 d_clearenv='$d_clearenv'
21975 d_closedir='$d_closedir'
21976 d_cmsghdr_s='$d_cmsghdr_s'
21977 d_const='$d_const'
21978 d_copysignl='$d_copysignl'
21979 d_cplusplus='$d_cplusplus'
21980 d_crypt='$d_crypt'
21981 d_crypt_r='$d_crypt_r'
21982 d_csh='$d_csh'
21983 d_ctermid='$d_ctermid'
21984 d_ctermid_r='$d_ctermid_r'
21985 d_ctime_r='$d_ctime_r'
21986 d_cuserid='$d_cuserid'
21987 d_dbl_dig='$d_dbl_dig'
21988 d_dbminitproto='$d_dbminitproto'
21989 d_difftime='$d_difftime'
21990 d_dir_dd_fd='$d_dir_dd_fd'
21991 d_dirfd='$d_dirfd'
21992 d_dirnamlen='$d_dirnamlen'
21993 d_dlerror='$d_dlerror'
21994 d_dlopen='$d_dlopen'
21995 d_dlsymun='$d_dlsymun'
21996 d_dosuid='$d_dosuid'
21997 d_drand48_r='$d_drand48_r'
21998 d_drand48proto='$d_drand48proto'
21999 d_dup2='$d_dup2'
22000 d_eaccess='$d_eaccess'
22001 d_endgrent='$d_endgrent'
22002 d_endgrent_r='$d_endgrent_r'
22003 d_endhent='$d_endhent'
22004 d_endhostent_r='$d_endhostent_r'
22005 d_endnent='$d_endnent'
22006 d_endnetent_r='$d_endnetent_r'
22007 d_endpent='$d_endpent'
22008 d_endprotoent_r='$d_endprotoent_r'
22009 d_endpwent='$d_endpwent'
22010 d_endpwent_r='$d_endpwent_r'
22011 d_endsent='$d_endsent'
22012 d_endservent_r='$d_endservent_r'
22013 d_eofnblk='$d_eofnblk'
22014 d_eunice='$d_eunice'
22015 d_faststdio='$d_faststdio'
22016 d_fchdir='$d_fchdir'
22017 d_fchmod='$d_fchmod'
22018 d_fchown='$d_fchown'
22019 d_fcntl='$d_fcntl'
22020 d_fcntl_can_lock='$d_fcntl_can_lock'
22021 d_fd_macros='$d_fd_macros'
22022 d_fd_set='$d_fd_set'
22023 d_fds_bits='$d_fds_bits'
22024 d_fgetpos='$d_fgetpos'
22025 d_finite='$d_finite'
22026 d_finitel='$d_finitel'
22027 d_flexfnam='$d_flexfnam'
22028 d_flock='$d_flock'
22029 d_flockproto='$d_flockproto'
22030 d_fork='$d_fork'
22031 d_fp_class='$d_fp_class'
22032 d_fpathconf='$d_fpathconf'
22033 d_fpclass='$d_fpclass'
22034 d_fpclassify='$d_fpclassify'
22035 d_fpclassl='$d_fpclassl'
22036 d_fpos64_t='$d_fpos64_t'
22037 d_frexpl='$d_frexpl'
22038 d_fs_data_s='$d_fs_data_s'
22039 d_fseeko='$d_fseeko'
22040 d_fsetpos='$d_fsetpos'
22041 d_fstatfs='$d_fstatfs'
22042 d_fstatvfs='$d_fstatvfs'
22043 d_fsync='$d_fsync'
22044 d_ftello='$d_ftello'
22045 d_ftime='$d_ftime'
22046 d_futimes='$d_futimes'
22047 d_getcwd='$d_getcwd'
22048 d_getespwnam='$d_getespwnam'
22049 d_getfsstat='$d_getfsstat'
22050 d_getgrent='$d_getgrent'
22051 d_getgrent_r='$d_getgrent_r'
22052 d_getgrgid_r='$d_getgrgid_r'
22053 d_getgrnam_r='$d_getgrnam_r'
22054 d_getgrps='$d_getgrps'
22055 d_gethbyaddr='$d_gethbyaddr'
22056 d_gethbyname='$d_gethbyname'
22057 d_gethent='$d_gethent'
22058 d_gethname='$d_gethname'
22059 d_gethostbyaddr_r='$d_gethostbyaddr_r'
22060 d_gethostbyname_r='$d_gethostbyname_r'
22061 d_gethostent_r='$d_gethostent_r'
22062 d_gethostprotos='$d_gethostprotos'
22063 d_getitimer='$d_getitimer'
22064 d_getlogin='$d_getlogin'
22065 d_getlogin_r='$d_getlogin_r'
22066 d_getmnt='$d_getmnt'
22067 d_getmntent='$d_getmntent'
22068 d_getnbyaddr='$d_getnbyaddr'
22069 d_getnbyname='$d_getnbyname'
22070 d_getnent='$d_getnent'
22071 d_getnetbyaddr_r='$d_getnetbyaddr_r'
22072 d_getnetbyname_r='$d_getnetbyname_r'
22073 d_getnetent_r='$d_getnetent_r'
22074 d_getnetprotos='$d_getnetprotos'
22075 d_getpagsz='$d_getpagsz'
22076 d_getpbyname='$d_getpbyname'
22077 d_getpbynumber='$d_getpbynumber'
22078 d_getpent='$d_getpent'
22079 d_getpgid='$d_getpgid'
22080 d_getpgrp2='$d_getpgrp2'
22081 d_getpgrp='$d_getpgrp'
22082 d_getppid='$d_getppid'
22083 d_getprior='$d_getprior'
22084 d_getprotobyname_r='$d_getprotobyname_r'
22085 d_getprotobynumber_r='$d_getprotobynumber_r'
22086 d_getprotoent_r='$d_getprotoent_r'
22087 d_getprotoprotos='$d_getprotoprotos'
22088 d_getprpwnam='$d_getprpwnam'
22089 d_getpwent='$d_getpwent'
22090 d_getpwent_r='$d_getpwent_r'
22091 d_getpwnam_r='$d_getpwnam_r'
22092 d_getpwuid_r='$d_getpwuid_r'
22093 d_getsbyname='$d_getsbyname'
22094 d_getsbyport='$d_getsbyport'
22095 d_getsent='$d_getsent'
22096 d_getservbyname_r='$d_getservbyname_r'
22097 d_getservbyport_r='$d_getservbyport_r'
22098 d_getservent_r='$d_getservent_r'
22099 d_getservprotos='$d_getservprotos'
22100 d_getspnam='$d_getspnam'
22101 d_getspnam_r='$d_getspnam_r'
22102 d_gettimeod='$d_gettimeod'
22103 d_gmtime_r='$d_gmtime_r'
22104 d_gnulibc='$d_gnulibc'
22105 d_grpasswd='$d_grpasswd'
22106 d_hasmntopt='$d_hasmntopt'
22107 d_htonl='$d_htonl'
22108 d_ilogbl='$d_ilogbl'
22109 d_inc_version_list='$d_inc_version_list'
22110 d_index='$d_index'
22111 d_inetaton='$d_inetaton'
22112 d_int64_t='$d_int64_t'
22113 d_isascii='$d_isascii'
22114 d_isfinite='$d_isfinite'
22115 d_isinf='$d_isinf'
22116 d_isnan='$d_isnan'
22117 d_isnanl='$d_isnanl'
22118 d_killpg='$d_killpg'
22119 d_lchown='$d_lchown'
22120 d_ldbl_dig='$d_ldbl_dig'
22121 d_libm_lib_version='$d_libm_lib_version'
22122 d_link='$d_link'
22123 d_localtime_r='$d_localtime_r'
22124 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22125 d_locconv='$d_locconv'
22126 d_lockf='$d_lockf'
22127 d_longdbl='$d_longdbl'
22128 d_longlong='$d_longlong'
22129 d_lseekproto='$d_lseekproto'
22130 d_lstat='$d_lstat'
22131 d_madvise='$d_madvise'
22132 d_malloc_good_size='$d_malloc_good_size'
22133 d_malloc_size='$d_malloc_size'
22134 d_mblen='$d_mblen'
22135 d_mbstowcs='$d_mbstowcs'
22136 d_mbtowc='$d_mbtowc'
22137 d_memchr='$d_memchr'
22138 d_memcmp='$d_memcmp'
22139 d_memcpy='$d_memcpy'
22140 d_memmove='$d_memmove'
22141 d_memset='$d_memset'
22142 d_mkdir='$d_mkdir'
22143 d_mkdtemp='$d_mkdtemp'
22144 d_mkfifo='$d_mkfifo'
22145 d_mkstemp='$d_mkstemp'
22146 d_mkstemps='$d_mkstemps'
22147 d_mktime='$d_mktime'
22148 d_mmap='$d_mmap'
22149 d_modfl='$d_modfl'
22150 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22151 d_modflproto='$d_modflproto'
22152 d_mprotect='$d_mprotect'
22153 d_msg='$d_msg'
22154 d_msg_ctrunc='$d_msg_ctrunc'
22155 d_msg_dontroute='$d_msg_dontroute'
22156 d_msg_oob='$d_msg_oob'
22157 d_msg_peek='$d_msg_peek'
22158 d_msg_proxy='$d_msg_proxy'
22159 d_msgctl='$d_msgctl'
22160 d_msgget='$d_msgget'
22161 d_msghdr_s='$d_msghdr_s'
22162 d_msgrcv='$d_msgrcv'
22163 d_msgsnd='$d_msgsnd'
22164 d_msync='$d_msync'
22165 d_munmap='$d_munmap'
22166 d_mymalloc='$d_mymalloc'
22167 d_ndbm='$d_ndbm'
22168 d_nice='$d_nice'
22169 d_nl_langinfo='$d_nl_langinfo'
22170 d_nv_preserves_uv='$d_nv_preserves_uv'
22171 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22172 d_off64_t='$d_off64_t'
22173 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22174 d_oldpthreads='$d_oldpthreads'
22175 d_oldsock='$d_oldsock'
22176 d_open3='$d_open3'
22177 d_pathconf='$d_pathconf'
22178 d_pause='$d_pause'
22179 d_perl_otherlibdirs='$d_perl_otherlibdirs'
22180 d_phostname='$d_phostname'
22181 d_pipe='$d_pipe'
22182 d_poll='$d_poll'
22183 d_portable='$d_portable'
22184 d_printf_format_null='$d_printf_format_null'
22185 d_procselfexe='$d_procselfexe'
22186 d_pseudofork='$d_pseudofork'
22187 d_pthread_atfork='$d_pthread_atfork'
22188 d_pthread_attr_setscope='$d_pthread_attr_setscope'
22189 d_pthread_yield='$d_pthread_yield'
22190 d_pwage='$d_pwage'
22191 d_pwchange='$d_pwchange'
22192 d_pwclass='$d_pwclass'
22193 d_pwcomment='$d_pwcomment'
22194 d_pwexpire='$d_pwexpire'
22195 d_pwgecos='$d_pwgecos'
22196 d_pwpasswd='$d_pwpasswd'
22197 d_pwquota='$d_pwquota'
22198 d_qgcvt='$d_qgcvt'
22199 d_quad='$d_quad'
22200 d_random_r='$d_random_r'
22201 d_readdir64_r='$d_readdir64_r'
22202 d_readdir='$d_readdir'
22203 d_readdir_r='$d_readdir_r'
22204 d_readlink='$d_readlink'
22205 d_readv='$d_readv'
22206 d_recvmsg='$d_recvmsg'
22207 d_rename='$d_rename'
22208 d_rewinddir='$d_rewinddir'
22209 d_rmdir='$d_rmdir'
22210 d_safebcpy='$d_safebcpy'
22211 d_safemcpy='$d_safemcpy'
22212 d_sanemcmp='$d_sanemcmp'
22213 d_sbrkproto='$d_sbrkproto'
22214 d_scalbnl='$d_scalbnl'
22215 d_sched_yield='$d_sched_yield'
22216 d_scm_rights='$d_scm_rights'
22217 d_seekdir='$d_seekdir'
22218 d_select='$d_select'
22219 d_sem='$d_sem'
22220 d_semctl='$d_semctl'
22221 d_semctl_semid_ds='$d_semctl_semid_ds'
22222 d_semctl_semun='$d_semctl_semun'
22223 d_semget='$d_semget'
22224 d_semop='$d_semop'
22225 d_sendmsg='$d_sendmsg'
22226 d_setegid='$d_setegid'
22227 d_seteuid='$d_seteuid'
22228 d_setgrent='$d_setgrent'
22229 d_setgrent_r='$d_setgrent_r'
22230 d_setgrps='$d_setgrps'
22231 d_sethent='$d_sethent'
22232 d_sethostent_r='$d_sethostent_r'
22233 d_setitimer='$d_setitimer'
22234 d_setlinebuf='$d_setlinebuf'
22235 d_setlocale='$d_setlocale'
22236 d_setlocale_r='$d_setlocale_r'
22237 d_setnent='$d_setnent'
22238 d_setnetent_r='$d_setnetent_r'
22239 d_setpent='$d_setpent'
22240 d_setpgid='$d_setpgid'
22241 d_setpgrp2='$d_setpgrp2'
22242 d_setpgrp='$d_setpgrp'
22243 d_setprior='$d_setprior'
22244 d_setproctitle='$d_setproctitle'
22245 d_setprotoent_r='$d_setprotoent_r'
22246 d_setpwent='$d_setpwent'
22247 d_setpwent_r='$d_setpwent_r'
22248 d_setregid='$d_setregid'
22249 d_setresgid='$d_setresgid'
22250 d_setresuid='$d_setresuid'
22251 d_setreuid='$d_setreuid'
22252 d_setrgid='$d_setrgid'
22253 d_setruid='$d_setruid'
22254 d_setsent='$d_setsent'
22255 d_setservent_r='$d_setservent_r'
22256 d_setsid='$d_setsid'
22257 d_setvbuf='$d_setvbuf'
22258 d_sfio='$d_sfio'
22259 d_shm='$d_shm'
22260 d_shmat='$d_shmat'
22261 d_shmatprototype='$d_shmatprototype'
22262 d_shmctl='$d_shmctl'
22263 d_shmdt='$d_shmdt'
22264 d_shmget='$d_shmget'
22265 d_sigaction='$d_sigaction'
22266 d_signbit='$d_signbit'
22267 d_sigprocmask='$d_sigprocmask'
22268 d_sigsetjmp='$d_sigsetjmp'
22269 d_sitearch='$d_sitearch'
22270 d_snprintf='$d_snprintf'
22271 d_sockatmark='$d_sockatmark'
22272 d_sockatmarkproto='$d_sockatmarkproto'
22273 d_socket='$d_socket'
22274 d_socklen_t='$d_socklen_t'
22275 d_sockpair='$d_sockpair'
22276 d_socks5_init='$d_socks5_init'
22277 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22278 d_sqrtl='$d_sqrtl'
22279 d_srand48_r='$d_srand48_r'
22280 d_srandom_r='$d_srandom_r'
22281 d_sresgproto='$d_sresgproto'
22282 d_sresuproto='$d_sresuproto'
22283 d_statblks='$d_statblks'
22284 d_statfs_f_flags='$d_statfs_f_flags'
22285 d_statfs_s='$d_statfs_s'
22286 d_statvfs='$d_statvfs'
22287 d_stdio_cnt_lval='$d_stdio_cnt_lval'
22288 d_stdio_ptr_lval='$d_stdio_ptr_lval'
22289 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22290 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22291 d_stdio_stream_array='$d_stdio_stream_array'
22292 d_stdiobase='$d_stdiobase'
22293 d_stdstdio='$d_stdstdio'
22294 d_strchr='$d_strchr'
22295 d_strcoll='$d_strcoll'
22296 d_strctcpy='$d_strctcpy'
22297 d_strerrm='$d_strerrm'
22298 d_strerror='$d_strerror'
22299 d_strerror_r='$d_strerror_r'
22300 d_strftime='$d_strftime'
22301 d_strlcat='$d_strlcat'
22302 d_strlcpy='$d_strlcpy'
22303 d_strtod='$d_strtod'
22304 d_strtol='$d_strtol'
22305 d_strtold='$d_strtold'
22306 d_strtoll='$d_strtoll'
22307 d_strtoq='$d_strtoq'
22308 d_strtoul='$d_strtoul'
22309 d_strtoull='$d_strtoull'
22310 d_strtouq='$d_strtouq'
22311 d_strxfrm='$d_strxfrm'
22312 d_suidsafe='$d_suidsafe'
22313 d_symlink='$d_symlink'
22314 d_syscall='$d_syscall'
22315 d_syscallproto='$d_syscallproto'
22316 d_sysconf='$d_sysconf'
22317 d_sysernlst='$d_sysernlst'
22318 d_syserrlst='$d_syserrlst'
22319 d_system='$d_system'
22320 d_tcgetpgrp='$d_tcgetpgrp'
22321 d_tcsetpgrp='$d_tcsetpgrp'
22322 d_telldir='$d_telldir'
22323 d_telldirproto='$d_telldirproto'
22324 d_time='$d_time'
22325 d_timegm='$d_timegm'
22326 d_times='$d_times'
22327 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22328 d_tm_tm_zone='$d_tm_tm_zone'
22329 d_tmpnam_r='$d_tmpnam_r'
22330 d_truncate='$d_truncate'
22331 d_ttyname_r='$d_ttyname_r'
22332 d_tzname='$d_tzname'
22333 d_u32align='$d_u32align'
22334 d_ualarm='$d_ualarm'
22335 d_umask='$d_umask'
22336 d_uname='$d_uname'
22337 d_union_semun='$d_union_semun'
22338 d_unordered='$d_unordered'
22339 d_unsetenv='$d_unsetenv'
22340 d_usleep='$d_usleep'
22341 d_usleepproto='$d_usleepproto'
22342 d_ustat='$d_ustat'
22343 d_vendorarch='$d_vendorarch'
22344 d_vendorbin='$d_vendorbin'
22345 d_vendorlib='$d_vendorlib'
22346 d_vendorscript='$d_vendorscript'
22347 d_vfork='$d_vfork'
22348 d_void_closedir='$d_void_closedir'
22349 d_voidsig='$d_voidsig'
22350 d_voidtty='$d_voidtty'
22351 d_volatile='$d_volatile'
22352 d_vprintf='$d_vprintf'
22353 d_vsnprintf='$d_vsnprintf'
22354 d_wait4='$d_wait4'
22355 d_waitpid='$d_waitpid'
22356 d_wcstombs='$d_wcstombs'
22357 d_wctomb='$d_wctomb'
22358 d_writev='$d_writev'
22359 d_xenix='$d_xenix'
22360 date='$date'
22361 db_hashtype='$db_hashtype'
22362 db_prefixtype='$db_prefixtype'
22363 db_version_major='$db_version_major'
22364 db_version_minor='$db_version_minor'
22365 db_version_patch='$db_version_patch'
22366 defvoidused='$defvoidused'
22367 direntrytype='$direntrytype'
22368 dlext='$dlext'
22369 dlsrc='$dlsrc'
22370 doublesize='$doublesize'
22371 drand01='$drand01'
22372 drand48_r_proto='$drand48_r_proto'
22373 dtrace='$dtrace'
22374 dynamic_ext='$dynamic_ext'
22375 eagain='$eagain'
22376 ebcdic='$ebcdic'
22377 echo='$echo'
22378 egrep='$egrep'
22379 emacs='$emacs'
22380 endgrent_r_proto='$endgrent_r_proto'
22381 endhostent_r_proto='$endhostent_r_proto'
22382 endnetent_r_proto='$endnetent_r_proto'
22383 endprotoent_r_proto='$endprotoent_r_proto'
22384 endpwent_r_proto='$endpwent_r_proto'
22385 endservent_r_proto='$endservent_r_proto'
22386 eunicefix='$eunicefix'
22387 exe_ext='$exe_ext'
22388 expr='$expr'
22389 extensions='$extensions'
22390 extras='$extras'
22391 fflushNULL='$fflushNULL'
22392 fflushall='$fflushall'
22393 find='$find'
22394 firstmakefile='$firstmakefile'
22395 flex='$flex'
22396 fpossize='$fpossize'
22397 fpostype='$fpostype'
22398 freetype='$freetype'
22399 from='$from'
22400 full_ar='$full_ar'
22401 full_csh='$full_csh'
22402 full_sed='$full_sed'
22403 gccansipedantic='$gccansipedantic'
22404 gccosandvers='$gccosandvers'
22405 gccversion='$gccversion'
22406 getgrent_r_proto='$getgrent_r_proto'
22407 getgrgid_r_proto='$getgrgid_r_proto'
22408 getgrnam_r_proto='$getgrnam_r_proto'
22409 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22410 gethostbyname_r_proto='$gethostbyname_r_proto'
22411 gethostent_r_proto='$gethostent_r_proto'
22412 getlogin_r_proto='$getlogin_r_proto'
22413 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22414 getnetbyname_r_proto='$getnetbyname_r_proto'
22415 getnetent_r_proto='$getnetent_r_proto'
22416 getprotobyname_r_proto='$getprotobyname_r_proto'
22417 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22418 getprotoent_r_proto='$getprotoent_r_proto'
22419 getpwent_r_proto='$getpwent_r_proto'
22420 getpwnam_r_proto='$getpwnam_r_proto'
22421 getpwuid_r_proto='$getpwuid_r_proto'
22422 getservbyname_r_proto='$getservbyname_r_proto'
22423 getservbyport_r_proto='$getservbyport_r_proto'
22424 getservent_r_proto='$getservent_r_proto'
22425 getspnam_r_proto='$getspnam_r_proto'
22426 gidformat='$gidformat'
22427 gidsign='$gidsign'
22428 gidsize='$gidsize'
22429 gidtype='$gidtype'
22430 glibpth='$glibpth'
22431 gmake='$gmake'
22432 gmtime_r_proto='$gmtime_r_proto'
22433 gnulibc_version='$gnulibc_version'
22434 grep='$grep'
22435 groupcat='$groupcat'
22436 groupstype='$groupstype'
22437 gzip='$gzip'
22438 h_fcntl='$h_fcntl'
22439 h_sysfile='$h_sysfile'
22440 hint='$hint'
22441 hostcat='$hostcat'
22442 html1dir='$html1dir'
22443 html1direxp='$html1direxp'
22444 html3dir='$html3dir'
22445 html3direxp='$html3direxp'
22446 i16size='$i16size'
22447 i16type='$i16type'
22448 i32size='$i32size'
22449 i32type='$i32type'
22450 i64size='$i64size'
22451 i64type='$i64type'
22452 i8size='$i8size'
22453 i8type='$i8type'
22454 i_arpainet='$i_arpainet'
22455 i_assert='$i_assert'
22456 i_bsdioctl='$i_bsdioctl'
22457 i_crypt='$i_crypt'
22458 i_db='$i_db'
22459 i_dbm='$i_dbm'
22460 i_dirent='$i_dirent'
22461 i_dld='$i_dld'
22462 i_dlfcn='$i_dlfcn'
22463 i_fcntl='$i_fcntl'
22464 i_float='$i_float'
22465 i_fp='$i_fp'
22466 i_fp_class='$i_fp_class'
22467 i_gdbm='$i_gdbm'
22468 i_gdbm_ndbm='$i_gdbm_ndbm'
22469 i_gdbmndbm='$i_gdbmndbm'
22470 i_grp='$i_grp'
22471 i_ieeefp='$i_ieeefp'
22472 i_inttypes='$i_inttypes'
22473 i_langinfo='$i_langinfo'
22474 i_libutil='$i_libutil'
22475 i_limits='$i_limits'
22476 i_locale='$i_locale'
22477 i_machcthr='$i_machcthr'
22478 i_malloc='$i_malloc'
22479 i_mallocmalloc='$i_mallocmalloc'
22480 i_math='$i_math'
22481 i_memory='$i_memory'
22482 i_mntent='$i_mntent'
22483 i_ndbm='$i_ndbm'
22484 i_netdb='$i_netdb'
22485 i_neterrno='$i_neterrno'
22486 i_netinettcp='$i_netinettcp'
22487 i_niin='$i_niin'
22488 i_poll='$i_poll'
22489 i_prot='$i_prot'
22490 i_pthread='$i_pthread'
22491 i_pwd='$i_pwd'
22492 i_rpcsvcdbm='$i_rpcsvcdbm'
22493 i_sfio='$i_sfio'
22494 i_sgtty='$i_sgtty'
22495 i_shadow='$i_shadow'
22496 i_socks='$i_socks'
22497 i_stdarg='$i_stdarg'
22498 i_stddef='$i_stddef'
22499 i_stdlib='$i_stdlib'
22500 i_string='$i_string'
22501 i_sunmath='$i_sunmath'
22502 i_sysaccess='$i_sysaccess'
22503 i_sysdir='$i_sysdir'
22504 i_sysfile='$i_sysfile'
22505 i_sysfilio='$i_sysfilio'
22506 i_sysin='$i_sysin'
22507 i_sysioctl='$i_sysioctl'
22508 i_syslog='$i_syslog'
22509 i_sysmman='$i_sysmman'
22510 i_sysmode='$i_sysmode'
22511 i_sysmount='$i_sysmount'
22512 i_sysndir='$i_sysndir'
22513 i_sysparam='$i_sysparam'
22514 i_syspoll='$i_syspoll'
22515 i_sysresrc='$i_sysresrc'
22516 i_syssecrt='$i_syssecrt'
22517 i_sysselct='$i_sysselct'
22518 i_syssockio='$i_syssockio'
22519 i_sysstat='$i_sysstat'
22520 i_sysstatfs='$i_sysstatfs'
22521 i_sysstatvfs='$i_sysstatvfs'
22522 i_systime='$i_systime'
22523 i_systimek='$i_systimek'
22524 i_systimes='$i_systimes'
22525 i_systypes='$i_systypes'
22526 i_sysuio='$i_sysuio'
22527 i_sysun='$i_sysun'
22528 i_sysutsname='$i_sysutsname'
22529 i_sysvfs='$i_sysvfs'
22530 i_syswait='$i_syswait'
22531 i_termio='$i_termio'
22532 i_termios='$i_termios'
22533 i_time='$i_time'
22534 i_unistd='$i_unistd'
22535 i_ustat='$i_ustat'
22536 i_utime='$i_utime'
22537 i_values='$i_values'
22538 i_varargs='$i_varargs'
22539 i_varhdr='$i_varhdr'
22540 i_vfork='$i_vfork'
22541 ignore_versioned_solibs='$ignore_versioned_solibs'
22542 inc_version_list='$inc_version_list'
22543 inc_version_list_init='$inc_version_list_init'
22544 incpath='$incpath'
22545 inews='$inews'
22546 initialinstalllocation='$initialinstalllocation'
22547 installarchlib='$installarchlib'
22548 installbin='$installbin'
22549 installhtml1dir='$installhtml1dir'
22550 installhtml3dir='$installhtml3dir'
22551 installman1dir='$installman1dir'
22552 installman3dir='$installman3dir'
22553 installprefix='$installprefix'
22554 installprefixexp='$installprefixexp'
22555 installprivlib='$installprivlib'
22556 installscript='$installscript'
22557 installsitearch='$installsitearch'
22558 installsitebin='$installsitebin'
22559 installsitehtml1dir='$installsitehtml1dir'
22560 installsitehtml3dir='$installsitehtml3dir'
22561 installsitelib='$installsitelib'
22562 installsiteman1dir='$installsiteman1dir'
22563 installsiteman3dir='$installsiteman3dir'
22564 installsitescript='$installsitescript'
22565 installstyle='$installstyle'
22566 installusrbinperl='$installusrbinperl'
22567 installvendorarch='$installvendorarch'
22568 installvendorbin='$installvendorbin'
22569 installvendorhtml1dir='$installvendorhtml1dir'
22570 installvendorhtml3dir='$installvendorhtml3dir'
22571 installvendorlib='$installvendorlib'
22572 installvendorman1dir='$installvendorman1dir'
22573 installvendorman3dir='$installvendorman3dir'
22574 installvendorscript='$installvendorscript'
22575 intsize='$intsize'
22576 issymlink='$issymlink'
22577 ivdformat='$ivdformat'
22578 ivsize='$ivsize'
22579 ivtype='$ivtype'
22580 known_extensions='$known_extensions'
22581 ksh='$ksh'
22582 ld='$ld'
22583 lddlflags='$lddlflags'
22584 ldflags='$ldflags'
22585 ldflags_uselargefiles='$ldflags_uselargefiles'
22586 ldlibpthname='$ldlibpthname'
22587 less='$less'
22588 lib_ext='$lib_ext'
22589 libc='$libc'
22590 libperl='$libperl'
22591 libpth='$libpth'
22592 libs='$libs'
22593 libsdirs='$libsdirs'
22594 libsfiles='$libsfiles'
22595 libsfound='$libsfound'
22596 libspath='$libspath'
22597 libswanted='$libswanted'
22598 libswanted_uselargefiles='$libswanted_uselargefiles'
22599 line='$line'
22600 lint='$lint'
22601 lkflags='$lkflags'
22602 ln='$ln'
22603 lns='$lns'
22604 localtime_r_proto='$localtime_r_proto'
22605 locincpth='$locincpth'
22606 loclibpth='$loclibpth'
22607 longdblsize='$longdblsize'
22608 longlongsize='$longlongsize'
22609 longsize='$longsize'
22610 lp='$lp'
22611 lpr='$lpr'
22612 ls='$ls'
22613 lseeksize='$lseeksize'
22614 lseektype='$lseektype'
22615 mad='$mad'
22616 madlyh='$madlyh'
22617 madlyobj='$madlyobj'
22618 madlysrc='$madlysrc'
22619 mail='$mail'
22620 mailx='$mailx'
22621 make='$make'
22622 make_set_make='$make_set_make'
22623 mallocobj='$mallocobj'
22624 mallocsrc='$mallocsrc'
22625 malloctype='$malloctype'
22626 man1dir='$man1dir'
22627 man1direxp='$man1direxp'
22628 man1ext='$man1ext'
22629 man3dir='$man3dir'
22630 man3direxp='$man3direxp'
22631 man3ext='$man3ext'
22632 mips_type='$mips_type'
22633 mistrustnm='$mistrustnm'
22634 mkdir='$mkdir'
22635 mmaptype='$mmaptype'
22636 modetype='$modetype'
22637 more='$more'
22638 multiarch='$multiarch'
22639 mv='$mv'
22640 myarchname='$myarchname'
22641 mydomain='$mydomain'
22642 myhostname='$myhostname'
22643 myuname='$myuname'
22644 n='$n'
22645 need_va_copy='$need_va_copy'
22646 netdb_hlen_type='$netdb_hlen_type'
22647 netdb_host_type='$netdb_host_type'
22648 netdb_name_type='$netdb_name_type'
22649 netdb_net_type='$netdb_net_type'
22650 nm='$nm'
22651 nm_opt='$nm_opt'
22652 nm_so_opt='$nm_so_opt'
22653 nonxs_ext='$nonxs_ext'
22654 nroff='$nroff'
22655 nvEUformat='$nvEUformat'
22656 nvFUformat='$nvFUformat'
22657 nvGUformat='$nvGUformat'
22658 nv_overflows_integers_at='$nv_overflows_integers_at'
22659 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22660 nveformat='$nveformat'
22661 nvfformat='$nvfformat'
22662 nvgformat='$nvgformat'
22663 nvsize='$nvsize'
22664 nvtype='$nvtype'
22665 o_nonblock='$o_nonblock'
22666 obj_ext='$obj_ext'
22667 old_pthread_create_joinable='$old_pthread_create_joinable'
22668 optimize='$optimize'
22669 orderlib='$orderlib'
22670 osname='$osname'
22671 osvers='$osvers'
22672 otherlibdirs='$otherlibdirs'
22673 package='$package'
22674 pager='$pager'
22675 passcat='$passcat'
22676 patchlevel='$patchlevel'
22677 path_sep='$path_sep'
22678 perl5='$perl5'
22679 perl='$perl'
22680 perl_patchlevel='$perl_patchlevel'
22681 perladmin='$perladmin'
22682 perllibs='$perllibs'
22683 perlpath='$perlpath'
22684 pg='$pg'
22685 phostname='$phostname'
22686 pidtype='$pidtype'
22687 plibpth='$plibpth'
22688 pmake='$pmake'
22689 pr='$pr'
22690 prefix='$prefix'
22691 prefixexp='$prefixexp'
22692 privlib='$privlib'
22693 privlibexp='$privlibexp'
22694 procselfexe='$procselfexe'
22695 prototype='$prototype'
22696 ptrsize='$ptrsize'
22697 quadkind='$quadkind'
22698 quadtype='$quadtype'
22699 randbits='$randbits'
22700 randfunc='$randfunc'
22701 random_r_proto='$random_r_proto'
22702 randseedtype='$randseedtype'
22703 ranlib='$ranlib'
22704 rd_nodata='$rd_nodata'
22705 readdir64_r_proto='$readdir64_r_proto'
22706 readdir_r_proto='$readdir_r_proto'
22707 revision='$revision'
22708 rm='$rm'
22709 rm_try='$rm_try'
22710 rmail='$rmail'
22711 run='$run'
22712 runnm='$runnm'
22713 sGMTIME_max='$sGMTIME_max'
22714 sGMTIME_min='$sGMTIME_min'
22715 sPRIEUldbl='$sPRIEUldbl'
22716 sPRIFUldbl='$sPRIFUldbl'
22717 sPRIGUldbl='$sPRIGUldbl'
22718 sPRIXU64='$sPRIXU64'
22719 sPRId64='$sPRId64'
22720 sPRIeldbl='$sPRIeldbl'
22721 sPRIfldbl='$sPRIfldbl'
22722 sPRIgldbl='$sPRIgldbl'
22723 sPRIi64='$sPRIi64'
22724 sPRIo64='$sPRIo64'
22725 sPRIu64='$sPRIu64'
22726 sPRIx64='$sPRIx64'
22727 sSCNfldbl='$sSCNfldbl'
22728 sched_yield='$sched_yield'
22729 scriptdir='$scriptdir'
22730 scriptdirexp='$scriptdirexp'
22731 sed='$sed'
22732 seedfunc='$seedfunc'
22733 selectminbits='$selectminbits'
22734 selecttype='$selecttype'
22735 sendmail='$sendmail'
22736 setgrent_r_proto='$setgrent_r_proto'
22737 sethostent_r_proto='$sethostent_r_proto'
22738 setlocale_r_proto='$setlocale_r_proto'
22739 setnetent_r_proto='$setnetent_r_proto'
22740 setprotoent_r_proto='$setprotoent_r_proto'
22741 setpwent_r_proto='$setpwent_r_proto'
22742 setservent_r_proto='$setservent_r_proto'
22743 sh='$sh'
22744 shar='$shar'
22745 sharpbang='$sharpbang'
22746 shmattype='$shmattype'
22747 shortsize='$shortsize'
22748 shrpenv='$shrpenv'
22749 shsharp='$shsharp'
22750 sig_count='$sig_count'
22751 sig_name='$sig_name'
22752 sig_name_init='$sig_name_init'
22753 sig_num='$sig_num'
22754 sig_num_init='$sig_num_init'
22755 sig_size='$sig_size'
22756 signal_t='$signal_t'
22757 sitearch='$sitearch'
22758 sitearchexp='$sitearchexp'
22759 sitebin='$sitebin'
22760 sitebinexp='$sitebinexp'
22761 sitehtml1dir='$sitehtml1dir'
22762 sitehtml1direxp='$sitehtml1direxp'
22763 sitehtml3dir='$sitehtml3dir'
22764 sitehtml3direxp='$sitehtml3direxp'
22765 sitelib='$sitelib'
22766 sitelib_stem='$sitelib_stem'
22767 sitelibexp='$sitelibexp'
22768 siteman1dir='$siteman1dir'
22769 siteman1direxp='$siteman1direxp'
22770 siteman3dir='$siteman3dir'
22771 siteman3direxp='$siteman3direxp'
22772 siteprefix='$siteprefix'
22773 siteprefixexp='$siteprefixexp'
22774 sitescript='$sitescript'
22775 sitescriptexp='$sitescriptexp'
22776 sizesize='$sizesize'
22777 sizetype='$sizetype'
22778 sleep='$sleep'
22779 smail='$smail'
22780 so='$so'
22781 sockethdr='$sockethdr'
22782 socketlib='$socketlib'
22783 socksizetype='$socksizetype'
22784 sort='$sort'
22785 spackage='$spackage'
22786 spitshell='$spitshell'
22787 srand48_r_proto='$srand48_r_proto'
22788 srandom_r_proto='$srandom_r_proto'
22789 src='$src'
22790 ssizetype='$ssizetype'
22791 startperl='$startperl'
22792 startsh='$startsh'
22793 static_ext='$static_ext'
22794 stdchar='$stdchar'
22795 stdio_base='$stdio_base'
22796 stdio_bufsiz='$stdio_bufsiz'
22797 stdio_cnt='$stdio_cnt'
22798 stdio_filbuf='$stdio_filbuf'
22799 stdio_ptr='$stdio_ptr'
22800 stdio_stream_array='$stdio_stream_array'
22801 strerror_r_proto='$strerror_r_proto'
22802 strings='$strings'
22803 submit='$submit'
22804 subversion='$subversion'
22805 sysman='$sysman'
22806 tail='$tail'
22807 tar='$tar'
22808 targetarch='$targetarch'
22809 tbl='$tbl'
22810 tee='$tee'
22811 test='$test'
22812 timeincl='$timeincl'
22813 timetype='$timetype'
22814 tmpnam_r_proto='$tmpnam_r_proto'
22815 to='$to'
22816 touch='$touch'
22817 tr='$tr'
22818 trnl='$trnl'
22819 troff='$troff'
22820 ttyname_r_proto='$ttyname_r_proto'
22821 u16size='$u16size'
22822 u16type='$u16type'
22823 u32size='$u32size'
22824 u32type='$u32type'
22825 u64size='$u64size'
22826 u64type='$u64type'
22827 u8size='$u8size'
22828 u8type='$u8type'
22829 uidformat='$uidformat'
22830 uidsign='$uidsign'
22831 uidsize='$uidsize'
22832 uidtype='$uidtype'
22833 uname='$uname'
22834 uniq='$uniq'
22835 uquadtype='$uquadtype'
22836 use5005threads='$use5005threads'
22837 use64bitall='$use64bitall'
22838 use64bitint='$use64bitint'
22839 usecrosscompile='$usecrosscompile'
22840 usedl='$usedl'
22841 usedtrace='$usedtrace'
22842 usefaststdio='$usefaststdio'
22843 useithreads='$useithreads'
22844 uselargefiles='$uselargefiles'
22845 uselongdouble='$uselongdouble'
22846 usemallocwrap='$usemallocwrap'
22847 usemorebits='$usemorebits'
22848 usemultiplicity='$usemultiplicity'
22849 usemymalloc='$usemymalloc'
22850 usenm='$usenm'
22851 useopcode='$useopcode'
22852 useperlio='$useperlio'
22853 useposix='$useposix'
22854 usereentrant='$usereentrant'
22855 userelocatableinc='$userelocatableinc'
22856 usesfio='$usesfio'
22857 useshrplib='$useshrplib'
22858 usesitecustomize='$usesitecustomize'
22859 usesocks='$usesocks'
22860 usethreads='$usethreads'
22861 usevendorprefix='$usevendorprefix'
22862 usevfork='$usevfork'
22863 usrinc='$usrinc'
22864 uuname='$uuname'
22865 uvXUformat='$uvXUformat'
22866 uvoformat='$uvoformat'
22867 uvsize='$uvsize'
22868 uvtype='$uvtype'
22869 uvuformat='$uvuformat'
22870 uvxformat='$uvxformat'
22871 vendorarch='$vendorarch'
22872 vendorarchexp='$vendorarchexp'
22873 vendorbin='$vendorbin'
22874 vendorbinexp='$vendorbinexp'
22875 vendorhtml1dir='$vendorhtml1dir'
22876 vendorhtml1direxp='$vendorhtml1direxp'
22877 vendorhtml3dir='$vendorhtml3dir'
22878 vendorhtml3direxp='$vendorhtml3direxp'
22879 vendorlib='$vendorlib'
22880 vendorlib_stem='$vendorlib_stem'
22881 vendorlibexp='$vendorlibexp'
22882 vendorman1dir='$vendorman1dir'
22883 vendorman1direxp='$vendorman1direxp'
22884 vendorman3dir='$vendorman3dir'
22885 vendorman3direxp='$vendorman3direxp'
22886 vendorprefix='$vendorprefix'
22887 vendorprefixexp='$vendorprefixexp'
22888 vendorscript='$vendorscript'
22889 vendorscriptexp='$vendorscriptexp'
22890 version='$version'
22891 version_patchlevel_string='$version_patchlevel_string'
22892 versiononly='$versiononly'
22893 vi='$vi'
22894 voidflags='$voidflags'
22895 xlibpth='$xlibpth'
22896 yacc='$yacc'
22897 yaccflags='$yaccflags'
22898 zcat='$zcat'
22899 zip='$zip'
22900 EOT
22901
22902 : Add in command line options if available
22903 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22904
22905 : add special variables
22906 $test -f $src/patchlevel.h && \
22907 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22908 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22909 echo "PERL_CONFIG_SH=true" >>config.sh
22910
22911 : propagate old symbols
22912 if $test -f UU/config.sh; then
22913         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22914         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
22915                 config.sh config.sh UU/oldconfig.sh |\
22916                 $sort | $uniq -u >UU/oldsyms
22917         set X `cat UU/oldsyms`
22918         shift
22919         case $# in
22920         0) ;;
22921         *)
22922                 cat <<EOM
22923 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22924 EOM
22925                 echo ": Variables propagated from previous config.sh file." >>config.sh
22926                 for sym in `cat UU/oldsyms`; do
22927                         echo "    Propagating $hint variable "'$'"$sym..."
22928                         eval 'tmp="$'"${sym}"'"'
22929                         echo "$tmp" | \
22930                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22931                 done
22932                 ;;
22933         esac
22934 fi
22935
22936 : Finish up by extracting the .SH files
22937 case "$alldone" in
22938 exit)
22939         $rm -rf UU
22940         echo "Extraction done."
22941         exit 0
22942         ;;
22943 cont)
22944         ;;
22945 '')
22946         dflt=''
22947         nostick=true
22948         $cat <<EOM
22949
22950 If you'd like to make any changes to the config.sh file before I begin
22951 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22952
22953 EOM
22954         rp="Press return or use a shell escape to edit config.sh:"
22955         . UU/myread
22956         nostick=''
22957         case "$ans" in
22958         '') ;;
22959         *) : in case they cannot read
22960                 sh 1>&4 -c "$ans";;
22961         esac
22962         ;;
22963 esac
22964
22965 : if this fails, just run all the .SH files by hand
22966 . ./config.sh
22967
22968 echo " "
22969 exec 1>&4
22970 pwd=`pwd`
22971 . ./UU/extract
22972 cd "$pwd"
22973
22974 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22975         dflt=y
22976         case "$silent" in
22977         true) ;;
22978         *)
22979                 $cat <<EOM
22980
22981 Now you need to generate make dependencies by running "$make depend".
22982 You might prefer to run it in background: "$make depend > makedepend.out &"
22983 It can take a while, so you might not want to run it right now.
22984
22985 EOM
22986                 ;;
22987         esac
22988         rp="Run $make depend now?"
22989         . UU/myread
22990         case "$ans" in
22991         y*)
22992                 $make depend && echo "Now you must run '$make'."
22993                 ;;
22994         *)
22995                 echo "You must run '$make depend' then '$make'."
22996                 ;;
22997         esac
22998 elif test -f [Mm]akefile; then
22999         echo " "
23000         echo "Now you must run a $make."
23001 else
23002         echo "Configure done."
23003 fi
23004
23005 if $test -f Policy.sh; then
23006     $cat <<EOM
23007
23008 If you compile $package on a different machine or from a different object
23009 directory, copy the Policy.sh file from this object directory to the
23010 new one before you run Configure -- this will help you with most of
23011 the policy defaults.
23012
23013 EOM
23014 fi
23015 if $test -f config.msg; then
23016     echo "Hmm.  I also noted the following information while running:"
23017     echo " "
23018     $cat config.msg >&4
23019     $rm -f config.msg
23020 fi
23021 $rm -f kit*isdone ark*isdone
23022 $rm -rf UU
23023
23024 : End of Configure
23025