847a90a54db7a3e4530f65924d7e3f540a646164
[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 Sat May 17 15:55:21 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 clocktype=''
781 d_times=''
782 d_tmpnam_r=''
783 tmpnam_r_proto=''
784 d_truncate=''
785 d_ttyname_r=''
786 ttyname_r_proto=''
787 d_tzname=''
788 d_u32align=''
789 d_ualarm=''
790 d_umask=''
791 d_semctl_semid_ds=''
792 d_semctl_semun=''
793 d_union_semun=''
794 d_unordered=''
795 d_unsetenv=''
796 d_usleep=''
797 d_usleepproto=''
798 d_ustat=''
799 d_pseudofork=''
800 d_vfork=''
801 usevfork=''
802 d_voidsig=''
803 signal_t=''
804 d_volatile=''
805 d_charvspr=''
806 d_vprintf=''
807 d_wait4=''
808 d_waitpid=''
809 d_wcstombs=''
810 d_wctomb=''
811 d_writev=''
812 dlext=''
813 cccdlflags=''
814 ccdlflags=''
815 dlsrc=''
816 ld=''
817 lddlflags=''
818 usedl=''
819 doublesize=''
820 ebcdic=''
821 fflushNULL=''
822 fflushall=''
823 fpossize=''
824 fpostype=''
825 gccansipedantic=''
826 gccosandvers=''
827 gccversion=''
828 gidformat=''
829 gidsign=''
830 gidsize=''
831 gidtype=''
832 groupstype=''
833 h_fcntl=''
834 h_sysfile=''
835 html1dir=''
836 html1direxp=''
837 installhtml1dir=''
838 html3dir=''
839 html3direxp=''
840 installhtml3dir=''
841 i_arpainet=''
842 i_assert=''
843 i_crypt=''
844 db_hashtype=''
845 db_prefixtype=''
846 db_version_major=''
847 db_version_minor=''
848 db_version_patch=''
849 i_db=''
850 i_dbm=''
851 i_rpcsvcdbm=''
852 d_dirnamlen=''
853 direntrytype=''
854 i_dirent=''
855 i_dld=''
856 i_dlfcn=''
857 i_fcntl=''
858 i_float=''
859 i_fp=''
860 i_fp_class=''
861 i_gdbm=''
862 d_grpasswd=''
863 i_grp=''
864 i_ieeefp=''
865 i_inttypes=''
866 i_langinfo=''
867 i_libutil=''
868 i_limits=''
869 i_locale=''
870 i_machcthr=''
871 i_malloc=''
872 i_mallocmalloc=''
873 i_math=''
874 i_memory=''
875 i_mntent=''
876 i_ndbm=''
877 i_netdb=''
878 i_neterrno=''
879 i_netinettcp=''
880 i_niin=''
881 i_sysin=''
882 i_poll=''
883 i_prot=''
884 i_pthread=''
885 d_pwage=''
886 d_pwchange=''
887 d_pwclass=''
888 d_pwcomment=''
889 d_pwexpire=''
890 d_pwgecos=''
891 d_pwpasswd=''
892 d_pwquota=''
893 i_pwd=''
894 i_sfio=''
895 i_shadow=''
896 i_socks=''
897 i_stddef=''
898 i_stdlib=''
899 i_string=''
900 strings=''
901 i_sunmath=''
902 i_sysaccess=''
903 i_sysdir=''
904 i_sysfile=''
905 d_voidtty=''
906 i_bsdioctl=''
907 i_sysfilio=''
908 i_sysioctl=''
909 i_syssockio=''
910 i_syslog=''
911 i_sysmman=''
912 i_sysmode=''
913 i_sysmount=''
914 i_sysndir=''
915 i_sysparam=''
916 i_syspoll=''
917 i_sysresrc=''
918 i_syssecrt=''
919 i_sysselct=''
920 i_sysstat=''
921 i_sysstatfs=''
922 i_sysstatvfs=''
923 i_systimes=''
924 i_systypes=''
925 i_sysuio=''
926 i_sysun=''
927 i_sysutsname=''
928 i_sysvfs=''
929 i_syswait=''
930 i_sgtty=''
931 i_termio=''
932 i_termios=''
933 d_tm_tm_gmtoff=''
934 d_tm_tm_zone=''
935 i_systime=''
936 i_systimek=''
937 i_time=''
938 timeincl=''
939 i_unistd=''
940 i_ustat=''
941 i_utime=''
942 i_values=''
943 i_stdarg=''
944 i_varargs=''
945 i_varhdr=''
946 i_vfork=''
947 d_inc_version_list=''
948 inc_version_list=''
949 inc_version_list_init=''
950 installprefix=''
951 installprefixexp=''
952 installstyle=''
953 installusrbinperl=''
954 intsize=''
955 longsize=''
956 shortsize=''
957 issymlink=''
958 libc=''
959 ldlibpthname=''
960 libperl=''
961 shrpenv=''
962 useshrplib=''
963 glibpth=''
964 libpth=''
965 loclibpth=''
966 plibpth=''
967 xlibpth=''
968 ignore_versioned_solibs=''
969 libs=''
970 libsdirs=''
971 libsfiles=''
972 libsfound=''
973 libspath=''
974 lns=''
975 d_PRIEUldbl=''
976 d_PRIFUldbl=''
977 d_PRIGUldbl=''
978 d_PRIeldbl=''
979 d_PRIfldbl=''
980 d_PRIgldbl=''
981 d_SCNfldbl=''
982 sPRIEUldbl=''
983 sPRIFUldbl=''
984 sPRIGUldbl=''
985 sPRIeldbl=''
986 sPRIfldbl=''
987 sPRIgldbl=''
988 sSCNfldbl=''
989 lseeksize=''
990 lseektype=''
991 mad=''
992 madlyh=''
993 madlyobj=''
994 madlysrc=''
995 make_set_make=''
996 d_mymalloc=''
997 freetype=''
998 mallocobj=''
999 mallocsrc=''
1000 malloctype=''
1001 usemallocwrap=''
1002 usemymalloc=''
1003 installman1dir=''
1004 man1dir=''
1005 man1direxp=''
1006 man1ext=''
1007 installman3dir=''
1008 man3dir=''
1009 man3direxp=''
1010 man3ext=''
1011 modetype=''
1012 multiarch=''
1013 mydomain=''
1014 myhostname=''
1015 phostname=''
1016 c=''
1017 n=''
1018 d_eofnblk=''
1019 eagain=''
1020 o_nonblock=''
1021 rd_nodata=''
1022 need_va_copy=''
1023 netdb_hlen_type=''
1024 netdb_host_type=''
1025 netdb_name_type=''
1026 netdb_net_type=''
1027 groupcat=''
1028 hostcat=''
1029 passcat=''
1030 orderlib=''
1031 ranlib=''
1032 d_perl_otherlibdirs=''
1033 otherlibdirs=''
1034 package=''
1035 spackage=''
1036 pager=''
1037 api_revision=''
1038 api_subversion=''
1039 api_version=''
1040 api_versionstring=''
1041 patchlevel=''
1042 perl_patchlevel=''
1043 revision=''
1044 subversion=''
1045 version=''
1046 version_patchlevel_string=''
1047 perl5=''
1048 perladmin=''
1049 perlpath=''
1050 d_nv_preserves_uv=''
1051 d_nv_zero_is_allbits_zero=''
1052 i16size=''
1053 i16type=''
1054 i32size=''
1055 i32type=''
1056 i64size=''
1057 i64type=''
1058 i8size=''
1059 i8type=''
1060 ivsize=''
1061 ivtype=''
1062 nv_overflows_integers_at=''
1063 nv_preserves_uv_bits=''
1064 nvsize=''
1065 nvtype=''
1066 u16size=''
1067 u16type=''
1068 u32size=''
1069 u32type=''
1070 u64size=''
1071 u64type=''
1072 u8size=''
1073 u8type=''
1074 uvsize=''
1075 uvtype=''
1076 ivdformat=''
1077 nvEUformat=''
1078 nvFUformat=''
1079 nvGUformat=''
1080 nveformat=''
1081 nvfformat=''
1082 nvgformat=''
1083 uvXUformat=''
1084 uvoformat=''
1085 uvuformat=''
1086 uvxformat=''
1087 pidtype=''
1088 prefix=''
1089 prefixexp=''
1090 installprivlib=''
1091 privlib=''
1092 privlibexp=''
1093 prototype=''
1094 ptrsize=''
1095 d_PRIXU64=''
1096 d_PRId64=''
1097 d_PRIi64=''
1098 d_PRIo64=''
1099 d_PRIu64=''
1100 d_PRIx64=''
1101 sPRIXU64=''
1102 sPRId64=''
1103 sPRIi64=''
1104 sPRIo64=''
1105 sPRIu64=''
1106 sPRIx64=''
1107 d_quad=''
1108 quadkind=''
1109 quadtype=''
1110 uquadtype=''
1111 drand01=''
1112 randbits=''
1113 randfunc=''
1114 randseedtype=''
1115 seedfunc=''
1116 installscript=''
1117 scriptdir=''
1118 scriptdirexp=''
1119 selectminbits=''
1120 selecttype=''
1121 sh=''
1122 sig_count=''
1123 sig_name=''
1124 sig_name_init=''
1125 sig_num=''
1126 sig_num_init=''
1127 sig_size=''
1128 d_sitearch=''
1129 installsitearch=''
1130 sitearch=''
1131 sitearchexp=''
1132 installsitebin=''
1133 sitebin=''
1134 sitebinexp=''
1135 installsitehtml1dir=''
1136 sitehtml1dir=''
1137 sitehtml1direxp=''
1138 installsitehtml3dir=''
1139 sitehtml3dir=''
1140 sitehtml3direxp=''
1141 installsitelib=''
1142 sitelib=''
1143 sitelib_stem=''
1144 sitelibexp=''
1145 installsiteman1dir=''
1146 siteman1dir=''
1147 siteman1direxp=''
1148 installsiteman3dir=''
1149 siteman3dir=''
1150 siteman3direxp=''
1151 siteprefix=''
1152 siteprefixexp=''
1153 installsitescript=''
1154 sitescript=''
1155 sitescriptexp=''
1156 sizesize=''
1157 sizetype=''
1158 so=''
1159 socksizetype=''
1160 sharpbang=''
1161 shsharp=''
1162 spitshell=''
1163 src=''
1164 ssizetype=''
1165 startperl=''
1166 startsh=''
1167 stdchar=''
1168 d_stdio_stream_array=''
1169 stdio_stream_array=''
1170 sysman=''
1171 trnl=''
1172 uidformat=''
1173 uidsign=''
1174 uidsize=''
1175 uidtype=''
1176 archname64=''
1177 use64bitall=''
1178 use64bitint=''
1179 dtrace=''
1180 usedtrace=''
1181 usefaststdio=''
1182 ccflags_uselargefiles=''
1183 ldflags_uselargefiles=''
1184 libswanted_uselargefiles=''
1185 uselargefiles=''
1186 uselongdouble=''
1187 usemorebits=''
1188 usemultiplicity=''
1189 nm_opt=''
1190 nm_so_opt=''
1191 runnm=''
1192 usenm=''
1193 useperlio=''
1194 usesocks=''
1195 d_oldpthreads=''
1196 use5005threads=''
1197 useithreads=''
1198 usereentrant=''
1199 usethreads=''
1200 incpath=''
1201 mips_type=''
1202 usrinc=''
1203 d_vendorarch=''
1204 installvendorarch=''
1205 vendorarch=''
1206 vendorarchexp=''
1207 d_vendorbin=''
1208 installvendorbin=''
1209 vendorbin=''
1210 vendorbinexp=''
1211 installvendorhtml1dir=''
1212 vendorhtml1dir=''
1213 vendorhtml1direxp=''
1214 installvendorhtml3dir=''
1215 vendorhtml3dir=''
1216 vendorhtml3direxp=''
1217 d_vendorlib=''
1218 installvendorlib=''
1219 vendorlib=''
1220 vendorlib_stem=''
1221 vendorlibexp=''
1222 installvendorman1dir=''
1223 vendorman1dir=''
1224 vendorman1direxp=''
1225 installvendorman3dir=''
1226 vendorman3dir=''
1227 vendorman3direxp=''
1228 usevendorprefix=''
1229 vendorprefix=''
1230 vendorprefixexp=''
1231 d_vendorscript=''
1232 installvendorscript=''
1233 vendorscript=''
1234 vendorscriptexp=''
1235 versiononly=''
1236 defvoidused=''
1237 voidflags=''
1238 yacc=''
1239 yaccflags=''
1240 CONFIG=''
1241
1242 : Detect odd OSs
1243 define='define'
1244 undef='undef'
1245 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1246 rmlist=''
1247
1248 : We must find out about Eunice early
1249 eunicefix=':'
1250 if test -f /etc/unixtovms; then
1251         eunicefix=/etc/unixtovms
1252 fi
1253 if test -f /etc/unixtovms.exe; then
1254         eunicefix=/etc/unixtovms.exe
1255 fi
1256
1257 : Set executable suffix now -- needed before hints available
1258 if test -f "/libs/version.library"; then
1259 : Amiga OS
1260     _exe=""
1261 elif test -f "/system/gnu_library/bin/ar.pm"; then
1262 : Stratus VOS
1263     _exe=".pm"
1264 elif test -n "$DJGPP"; then
1265 : DOS DJGPP
1266     _exe=".exe"
1267 elif test -d c:/. -o -n "$is_os2" ; then
1268 : OS/2 or cygwin
1269     _exe=".exe"
1270 fi
1271
1272 i_whoami=''
1273 : Trailing extension.  Override this in a hint file, if needed.
1274 : Extra object files, if any, needed on this platform.
1275 archobjs=''
1276 archname=''
1277 groupstype=''
1278 libnames=''
1279 : change the next line if compiling for Xenix/286 on Xenix/386
1280 xlibpth='/usr/lib/386 /lib/386'
1281 : Possible local library directories to search.
1282 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1283 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1284
1285 : general looking path for locating libraries
1286 glibpth="/lib /usr/lib $xlibpth"
1287 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1288 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1289 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1290 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1291
1292 : Private path used by Configure to find libraries.  Its value
1293 : is prepended to libpth. This variable takes care of special
1294 : machines, like the mips.  Usually, it should be empty.
1295 plibpth=''
1296
1297 : default library list
1298 libswanted=''
1299 : some systems want to use only the non-versioned libso:s
1300 ignore_versioned_solibs=''
1301 : set usethreads on the Configure command line to enable threads.
1302 usereentrant='undef'
1303 : full support for void wanted by default
1304 defvoidused=15
1305
1306 : Possible local include directories to search.
1307 : Set locincpth to "" in a hint file to defeat local include searches.
1308 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1309 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1310 :
1311 : no include file wanted by default
1312 inclwanted=''
1313
1314 : Enable -DEBUGGING and -DDEBUGGING from the command line
1315 EBUGGING=''
1316 DEBUGGING=old
1317
1318 ccname=''
1319 ccversion=''
1320 perllibs=''
1321 : set useposix=false in your hint file to disable the POSIX extension.
1322 useposix=true
1323 : set useopcode=false in your hint file to disable the Opcode extension.
1324 useopcode=true
1325 archname64=''
1326 ccflags_uselargefiles=''
1327 ldflags_uselargefiles=''
1328 libswanted_uselargefiles=''
1329 : set usemultiplicity on the Configure command line to enable multiplicity.
1330 : set usesocks on the Configure command line to enable socks.
1331 : List of libraries we want.
1332 : If anyone needs extra -lxxx, put those in a hint file.
1333 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1334 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1335 : We probably want to search /usr/shlib before most other libraries.
1336 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1337 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1338 glibpth="/usr/shlib $glibpth"
1339 : Do not use vfork unless overridden by a hint file.
1340 usevfork=false
1341
1342 : Find the basic shell for Bourne shell scripts
1343 case "$sh" in
1344 '')
1345         case "$SYSTYPE" in
1346         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1347         *) xxx='/bin/sh';;
1348         esac
1349         if test -f "$xxx"; then
1350                 sh="$xxx"
1351         else
1352                 : Build up a list and do a single loop so we can 'break' out.
1353                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1354                 for xxx in sh bash ksh pdksh ash; do
1355                         for p in $pth; do
1356                                 try="$try ${p}/${xxx}"
1357                         done
1358                 done
1359                 for xxx in $try; do
1360                         if test -f "$xxx"; then
1361                                 sh="$xxx";
1362                                 break
1363                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1364                                 sh="$xxx";
1365                                 break
1366                         elif test -f "$xxx.exe"; then
1367                                 sh="$xxx";
1368                                 break
1369                         fi
1370                 done
1371         fi
1372         ;;
1373 esac
1374
1375 case "$sh" in
1376 '')     cat >&2 <<EOM
1377 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1378
1379 Usually it's in /bin/sh.  How did you even get this far?
1380 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1381 we'll try to straighten this all out.
1382 EOM
1383         exit 1
1384         ;;
1385 esac
1386
1387 : see if sh knows # comments
1388 if `$sh -c '#' >/dev/null 2>&1`; then
1389         shsharp=true
1390         spitshell=cat
1391         xcat=/bin/cat
1392         test -f $xcat$_exe || xcat=/usr/bin/cat
1393         if test ! -f $xcat$_exe; then
1394                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1395                         if test -f $p/cat$_exe; then
1396                                 xcat=$p/cat
1397                                 break
1398                         fi
1399                 done
1400                 if test ! -f $xcat$_exe; then
1401                         echo "Can't find cat anywhere!"
1402                         exit 1
1403                 fi
1404         fi
1405         echo "#!$xcat" >sharp
1406         $eunicefix sharp
1407         chmod +x sharp
1408         ./sharp > today
1409         if test -s today; then
1410                 sharpbang='#!'
1411         else
1412                 echo "#! $xcat" > sharp
1413                 $eunicefix sharp
1414                 chmod +x sharp
1415                 ./sharp > today
1416                 if test -s today; then
1417                         sharpbang='#! '
1418                 else
1419                         sharpbang=': use '
1420                 fi
1421         fi
1422 else
1423         echo " "
1424         echo "Your $sh doesn't grok # comments--I will strip them later on."
1425         shsharp=false
1426         cd ..
1427         echo "exec grep -v '^[  ]*#'" >spitshell
1428         chmod +x spitshell
1429         $eunicefix spitshell
1430         spitshell=`pwd`/spitshell
1431         cd UU
1432         echo "I presume that if # doesn't work, #! won't work either!"
1433         sharpbang=': use '
1434 fi
1435 rm -f sharp today
1436
1437 : figure out how to guarantee sh startup
1438 case "$startsh" in
1439 '') startsh=${sharpbang}${sh} ;;
1440 *)
1441 esac
1442 cat >sharp <<EOSS
1443 $startsh
1444 set abc
1445 test "$?abc" != 1
1446 EOSS
1447
1448 chmod +x sharp
1449 $eunicefix sharp
1450 if ./sharp; then
1451         : echo "Yup, it does."
1452 else
1453         echo "Hmm... '$startsh' does not guarantee sh startup..."
1454         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1455 fi
1456 rm -f sharp
1457
1458 : Save command line options in file UU/cmdline.opt for later use in
1459 : generating config.sh.
1460 cat > cmdline.opt <<EOSH
1461 : Configure command line arguments.
1462 config_arg0='$0'
1463 config_args='$*'
1464 config_argc=$#
1465 EOSH
1466 argn=1
1467 args_exp=''
1468 args_sep=''
1469 for arg in "$@"; do
1470         cat >>cmdline.opt <<EOSH
1471 config_arg$argn='$arg'
1472 EOSH
1473         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1474 $arg
1475 EOC
1476         arg_exp=`cat cmdl.opt`
1477         args_exp="$args_exp$args_sep'$arg_exp'"
1478         argn=`expr $argn + 1`
1479         args_sep=' '
1480 done
1481 rm -f cmdl.opt
1482
1483 : produce awk script to parse command line options
1484 cat >options.awk <<'EOF'
1485 BEGIN {
1486         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1487
1488         len = length(optstr);
1489         for (i = 1; i <= len; i++) {
1490                 c = substr(optstr, i, 1);
1491                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1492                 if (a == ":") {
1493                         arg[c] = 1;
1494                         i++;
1495                 }
1496                 opt[c] = 1;
1497         }
1498 }
1499 {
1500         expect = 0;
1501         str = $0;
1502         if (substr(str, 1, 1) != "-") {
1503                 printf("'%s'\n", str);
1504                 next;
1505         }
1506         len = length($0);
1507         for (i = 2; i <= len; i++) {
1508                 c = substr(str, i, 1);
1509                 if (!opt[c]) {
1510                         printf("-%s\n", substr(str, i));
1511                         next;
1512                 }
1513                 printf("-%s\n", c);
1514                 if (arg[c]) {
1515                         if (i < len)
1516                                 printf("'%s'\n", substr(str, i + 1));
1517                         else
1518                                 expect = 1;
1519                         next;
1520                 }
1521         }
1522 }
1523 END {
1524         if (expect)
1525                 print "?";
1526 }
1527 EOF
1528
1529 : process the command line options
1530 set X `for arg in "$@"; do echo "X$arg"; done |
1531         sed -e s/X// | awk -f options.awk`
1532 eval "set $*"
1533 shift
1534 rm -f options.awk
1535
1536 : set up default values
1537 fastread=''
1538 reuseval=false
1539 config_sh=''
1540 alldone=''
1541 error=''
1542 silent=''
1543 extractsh=''
1544 override=''
1545 knowitall=''
1546 rm -f optdef.sh posthint.sh
1547 cat >optdef.sh <<EOS
1548 $startsh
1549 EOS
1550
1551
1552 : option parsing
1553 while test $# -gt 0; do
1554         case "$1" in
1555         -d) shift; fastread=yes;;
1556         -e) shift; alldone=cont;;
1557         -f)
1558                 shift
1559                 cd ..
1560                 if test -r "$1"; then
1561                         config_sh="$1"
1562                 else
1563                         echo "$me: cannot read config file $1." >&2
1564                         error=true
1565                 fi
1566                 cd UU
1567                 shift;;
1568         --help|\
1569         -h) shift; error=true;;
1570         -r) shift; reuseval=true;;
1571         -s) shift; silent=true; realsilent=true;;
1572         -E) shift; alldone=exit;;
1573         -K) shift; knowitall=true;;
1574         -O) shift; override=true;;
1575         -S) shift; silent=true; extractsh=true;;
1576         -D)
1577                 shift
1578                 case "$1" in
1579                 *=)
1580                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1581                         echo "$me: ignoring -D $1" >&2
1582                         ;;
1583                 *=*) echo "$1" | \
1584                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1585                 *) echo "$1='define'" >> optdef.sh;;
1586                 esac
1587                 shift
1588                 ;;
1589         -U)
1590                 shift
1591                 case "$1" in
1592                 *=) echo "$1" >> optdef.sh;;
1593                 *=*)
1594                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1595                         echo "$me: ignoring -U $1" >&2
1596                         ;;
1597                 *) echo "$1='undef'" >> optdef.sh;;
1598                 esac
1599                 shift
1600                 ;;
1601         -A)
1602             shift
1603             xxx=''
1604             yyy="$1"
1605             zzz=''
1606             uuu=undef
1607             case "$yyy" in
1608             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1609                  case "$zzz" in
1610                  *:*) zzz='' ;;
1611                  *)   xxx=append
1612                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1613                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1614                  esac
1615                  ;;
1616             esac
1617             case "$xxx" in
1618             '')  case "$yyy" in
1619                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1620                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1621                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1622                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1623                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1624                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1625                  esac
1626                  ;;
1627             esac
1628             case "$xxx" in
1629             append)
1630                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1631             clear)
1632                 echo "$yyy=''"                  >> posthint.sh ;;
1633             define)
1634                 case "$zzz" in
1635                 '') zzz=define ;;
1636                 esac
1637                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1638             eval)
1639                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1640             prepend)
1641                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1642             undef)
1643                 case "$zzz" in
1644                 '') zzz="$uuu" ;;
1645                 esac
1646                 echo "$yyy=$zzz"                >> posthint.sh ;;
1647             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1648             esac
1649             shift
1650             ;;
1651         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1652             exit 0;;
1653         --) break;;
1654         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1655         *) break;;
1656         esac
1657 done
1658
1659 case "$error" in
1660 true)
1661         cat >&2 <<EOM
1662 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1663                  [-U symbol] [-U symbol=] [-A command:symbol...]
1664   -d : use defaults for all answers.
1665   -e : go on without questioning past the production of config.sh.
1666   -f : specify an alternate default configuration file.
1667   -h : print this help message and exit (with an error status).
1668   -r : reuse C symbols value if possible (skips costly nm extraction).
1669   -s : silent mode, only echoes questions and essential information.
1670   -D : define symbol to have some value:
1671          -D symbol         symbol gets the value 'define'
1672          -D symbol=value   symbol gets the value 'value'
1673        common used examples (see INSTALL for more info):
1674          -Duse64bitint            use 64bit integers
1675          -Duse64bitall            use 64bit integers and pointers
1676          -Dusethreads             use thread support
1677          -Dinc_version_list=none  do not include older perl trees in @INC
1678          -DEBUGGING=none          DEBUGGING options
1679          -Dcc=gcc                 choose your compiler
1680          -Dprefix=/opt/perl5      choose your destination
1681   -E : stop at the end of questions, after having produced config.sh.
1682   -K : do not use unless you know what you are doing.
1683   -O : let -D and -U override definitions from loaded configuration file.
1684   -S : perform variable substitutions on all .SH files (can mix with -f)
1685   -U : undefine symbol:
1686          -U symbol    symbol gets the value 'undef'
1687          -U symbol=   symbol gets completely empty
1688        e.g.:  -Uversiononly
1689   -A : manipulate symbol after the platform specific hints have been applied:
1690          -A append:symbol=value   append value to symbol
1691          -A symbol=value          like append:, but with a separating space
1692          -A define:symbol=value   define symbol to have value
1693          -A clear:symbol          define symbol to be ''
1694          -A define:symbol         define symbol to be 'define'
1695          -A eval:symbol=value     define symbol to be eval of value
1696          -A prepend:symbol=value  prepend value to symbol
1697          -A undef:symbol          define symbol to be 'undef'
1698          -A undef:symbol=         define symbol to be ''
1699        e.g.:  -A prepend:libswanted='cl pthread '
1700               -A ccflags=-DSOME_MACRO
1701   -V : print version number and exit (with a zero status).
1702 EOM
1703         exit 1
1704         ;;
1705 esac
1706
1707 : Sanity checks
1708 case "$fastread$alldone" in
1709 yescont|yesexit) ;;
1710 *)
1711         case "$extractsh" in
1712         true) ;;
1713         *)
1714                 if test ! -t 0; then
1715                         echo "Say 'sh Configure', not 'sh <Configure'"
1716                         exit 1
1717                 fi
1718                 ;;
1719         esac
1720         ;;
1721 esac
1722
1723 exec 4>&1
1724 case "$silent" in
1725 true) exec 1>/dev/null;;
1726 esac
1727
1728 : run the defines and the undefines, if any, but leave the file out there...
1729 touch optdef.sh
1730 . ./optdef.sh
1731 : create the posthint manipulation script and leave the file out there...
1732 touch posthint.sh
1733
1734 : set package name
1735 package='perl5'
1736 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1737 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1738 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1739 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1740 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1741 esac
1742
1743 : Some greps do not return status, grrr.
1744 echo "grimblepritz" >grimble
1745 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1746         contains=contains
1747 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1748         contains=grep
1749 else
1750         contains=contains
1751 fi
1752 rm -f grimble
1753 : the following should work in any shell
1754 case "$contains" in
1755 contains*)
1756         echo " "
1757         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1758         cat >contains <<'EOSS'
1759 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1760 EOSS
1761 chmod +x contains
1762 esac
1763
1764 : Find the path to the source tree
1765 case "$src" in
1766 '') case "$0" in
1767     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1768          case "$src" in
1769          /*)    ;;
1770          .)     ;;
1771          *)     src=`cd ../$src && pwd` ;;
1772          esac
1773          ;;
1774     *)   src='.';;
1775     esac;;
1776 esac
1777 case "$src" in
1778 '')     src=/
1779         rsrc=/
1780         ;;
1781 /*)     rsrc="$src";;
1782 *)      rsrc="../$src";;
1783 esac
1784 if test -f $rsrc/Configure && \
1785         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1786 then
1787    : found it, so we are ok.
1788 else
1789         rsrc=''
1790         for src in . .. ../.. ../../.. ../../../..; do
1791                 if test -f ../$src/Configure && \
1792                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1793                 then
1794                         rsrc=../$src
1795                         break
1796                 fi
1797         done
1798 fi
1799 case "$rsrc" in
1800 '')
1801         cat <<EOM >&4
1802
1803 Sorry, I can't seem to locate the source dir for $package.  Please start
1804 Configure with an explicit path -- i.e. /some/path/Configure.
1805
1806 EOM
1807         exit 1
1808         ;;
1809 ../.)   rsrc='..';;
1810 *)
1811         echo " "
1812         echo "Sources for $package found in \"$src\"." >&4
1813         ;;
1814 esac
1815
1816 : script used to extract .SH files with variable substitutions
1817 cat >extract <<'EOS'
1818 PERL_CONFIG_SH=true
1819 echo "Doing variable substitutions on .SH files..."
1820 if test -f MANIFEST; then
1821         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1822 else
1823         echo "(Looking for .SH files under the source directory.)"
1824         set x `(cd "$src"; find . -name "*.SH" -print)`
1825 fi
1826 shift
1827 case $# in
1828 0) set x `(cd "$src"; echo *.SH)`; shift;;
1829 esac
1830 if test ! -f "$src/$1"; then
1831         shift
1832 fi
1833 mkdir_p='
1834 name=$1;
1835 create="";
1836 while test $name; do
1837         if test ! -d "$name"; then
1838                 create="$name $create";
1839                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1840                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1841         else
1842                 name="";
1843         fi;
1844 done;
1845 for file in $create; do
1846         mkdir $file;
1847 done
1848 '
1849 for file in $*; do
1850         case "$src" in
1851         ".")
1852                 case "$file" in
1853                 */*)
1854                         dir=`expr X$file : 'X\(.*\)/'`
1855                         file=`expr X$file : 'X.*/\(.*\)'`
1856                         (cd "$dir" && . ./$file)
1857                         ;;
1858                 *)
1859                         . ./$file
1860                         ;;
1861                 esac
1862                 ;;
1863         *)
1864                 case "$file" in
1865                 */*)
1866                         dir=`expr X$file : 'X\(.*\)/'`
1867                         file=`expr X$file : 'X.*/\(.*\)'`
1868                         (set x $dir; shift; eval $mkdir_p)
1869                         sh <"$src/$dir/$file"
1870                         ;;
1871                 *)
1872                         sh <"$src/$file"
1873                         ;;
1874                 esac
1875                 ;;
1876         esac
1877 done
1878 if test -f "$src/config_h.SH"; then
1879         if test ! -f config.h; then
1880         : oops, they left it out of MANIFEST, probably, so do it anyway.
1881         . "$src/config_h.SH"
1882         fi
1883 fi
1884 EOS
1885
1886 : extract files and exit if asked to do so
1887 case "$extractsh" in
1888 true)
1889         case "$realsilent" in
1890         true) ;;
1891         *) exec 1>&4;;
1892         esac
1893         case "$config_sh" in
1894         '') config_sh='config.sh';;
1895         esac
1896         echo " "
1897         echo "Fetching answers from $config_sh..."
1898         cd ..
1899         . $config_sh
1900         test "$override" && . ./optdef.sh
1901         echo " "
1902         . UU/extract
1903         rm -rf UU
1904         echo "Extraction done."
1905         exit 0
1906         ;;
1907 esac
1908
1909 : Eunice requires " " instead of "", can you believe it
1910 echo " "
1911 : Here we go...
1912 echo "Beginning of configuration questions for $package."
1913
1914 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1915
1916 : first determine how to suppress newline on echo command
1917 echo " "
1918 echo "Checking echo to see how to suppress newlines..."
1919 (echo "hi there\c" ; echo " ") >.echotmp
1920 if $contains c .echotmp >/dev/null 2>&1 ; then
1921         echo "...using -n."
1922         n='-n'
1923         c=''
1924 else
1925         cat <<'EOM'
1926 ...using \c
1927 EOM
1928         n=''
1929         c='\c'
1930 fi
1931 echo $n "The star should be here-->$c"
1932 echo '*'
1933 rm -f .echotmp
1934
1935 : Now test for existence of everything in MANIFEST
1936 echo " "
1937 if test -f "$rsrc/MANIFEST"; then
1938         echo "First let's make sure your kit is complete.  Checking..." >&4
1939         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" |\
1940                 (split -l 50 2>/dev/null || split -50)
1941         rm -f missing
1942         tmppwd=`pwd`
1943         for filelist in x??; do
1944                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1945                         >/dev/null 2>>"$tmppwd/missing")
1946         done
1947         if test -s missing; then
1948                 cat missing >&4
1949                 cat >&4 <<'EOM'
1950
1951 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1952
1953 You have the option of continuing the configuration process, despite the
1954 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1955 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1956 and contact the author (perlbug@perl.org).
1957
1958 EOM
1959                 echo $n "Continue? [n] $c" >&4
1960                 read ans
1961                 case "$ans" in
1962                 y*)
1963                         echo "Continuing..." >&4
1964                         rm -f missing
1965                         ;;
1966                 *)
1967                         echo "ABORTING..." >&4
1968                         kill $$
1969                         ;;
1970                 esac
1971         else
1972                 echo "Looks good..."
1973         fi
1974 else
1975         echo "There is no MANIFEST file.  I hope your kit is complete !"
1976 fi
1977 rm -f missing x??
1978
1979 : Find the appropriate value for a newline for tr
1980 echo " "
1981 if test -n "$DJGPP"; then
1982        trnl='\012'
1983 fi
1984 if test X"$trnl" = X; then
1985         case "`echo foo|tr '\n' x 2>/dev/null`" in
1986         foox) trnl='\n' ;;
1987         esac
1988 fi
1989 if test X"$trnl" = X; then
1990         case "`echo foo|tr '\012' x 2>/dev/null`" in
1991         foox) trnl='\012' ;;
1992         esac
1993 fi
1994 if test X"$trnl" = X; then
1995        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1996        fooxy) trnl='\n\r' ;;
1997        esac
1998 fi
1999 if test X"$trnl" = X; then
2000         cat <<EOM >&2
2001
2002 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2003
2004 EOM
2005         exit 1
2006 fi
2007
2008 : compute the number of columns on the terminal for proper question formatting
2009 case "$COLUMNS" in
2010 '') COLUMNS='80';;
2011 esac
2012
2013 : set up the echo used in my read
2014 myecho="case \"\$xxxm\" in
2015 '') echo $n \"\$rp $c\" >&4;;
2016 *) case \"\$rp\" in
2017         '') echo $n \"[\$xxxm] $c\";;
2018         *)
2019                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2020                         echo \"\$rp\" >&4
2021                         echo $n \"[\$xxxm] $c\" >&4
2022                 else
2023                         echo $n \"\$rp [\$xxxm] $c\" >&4
2024                 fi
2025                 ;;
2026         esac;;
2027 esac"
2028
2029 : now set up to do reads with possible shell escape and default assignment
2030 cat <<EOSC >myread
2031 $startsh
2032 xxxm=\$dflt
2033 $myecho
2034 ans='!'
2035 case "\$fastread" in
2036 yes) case "\$dflt" in
2037         '') ;;
2038         *) ans='';
2039                 case "\$silent-\$rp" in
2040                 true-) ;;
2041                 *) echo " " >&4;;
2042                 esac;;
2043         esac;;
2044 *) case "\$silent" in
2045         true) case "\$rp" in
2046                 '') ans='';;
2047                 esac;;
2048         esac;;
2049 esac
2050 while expr "X\$ans" : "X!" >/dev/null; do
2051         read answ
2052         set x \$xxxm
2053         shift
2054         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2055         case  "\$answ" in
2056         "!")
2057                 sh 1>&4
2058                 echo " "
2059                 $myecho
2060                 ;;
2061         !*)
2062                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2063                 shift
2064                 sh 1>&4 -c "\$*"
2065                 echo " "
2066                 $myecho
2067                 ;;
2068         "\$ans")
2069                 case "\$ans" in
2070                 \\&*)
2071                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2072                         shift
2073                         case "\$1" in
2074                         -d)
2075                                 fastread=yes
2076                                 echo "(OK, I'll run with -d after this question.)" >&4
2077                                 ;;
2078                         -*)
2079                                 echo "*** Sorry, \$1 not supported yet." >&4
2080                                 ;;
2081                         esac
2082                         $myecho
2083                         ans=!
2084                         ;;
2085                 esac;;
2086         *)
2087                 case "\$aok" in
2088                 y)
2089                         echo "*** Substitution done -- please confirm."
2090                         xxxm="\$ans"
2091                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2092                         xxxm="\$ans"
2093                         ans=!
2094                         ;;
2095                 *)
2096                         echo "*** Error -- try again."
2097                         ans=!
2098                         ;;
2099                 esac
2100                 $myecho
2101                 ;;
2102         esac
2103         case "\$ans\$xxxm\$nostick" in
2104         '')
2105                 ans=!
2106                 $myecho
2107                 ;;
2108         esac
2109 done
2110 case "\$ans" in
2111 '') ans="\$xxxm";;
2112 esac
2113 EOSC
2114
2115 : create .config dir to save info across Configure sessions
2116 test -d ../.config || mkdir ../.config
2117 cat >../.config/README <<EOF
2118 This directory created by Configure to save information that should
2119 persist across sessions for $package.
2120
2121 You may safely delete it if you wish.
2122 EOF
2123
2124 : See if we are using a devel version and want that
2125 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2126 case "$usedevel" in
2127 $define|true|[yY]*) ;;
2128 *) case "$xversion" in
2129    *[13579])
2130         cat >&4 <<EOH
2131 *** WHOA THERE!!! ***
2132
2133     This is an UNSTABLE DEVELOPMENT release.
2134     The version of this $package distribution is $xversion, that is, odd,
2135     (as opposed to even) and that signifies a development release.
2136     If you want a maintenance release, you want an even-numbered version.
2137
2138     Do ***NOT*** install this into production use.
2139     Data corruption and crashes are possible.
2140
2141     It is most seriously suggested that you do not continue any further
2142     unless you want to help in developing and debugging Perl.
2143
2144     If you *still* want to build perl, you can answer 'y' now,
2145     or pass -Dusedevel to Configure.
2146
2147 EOH
2148         rp='Do you really want to continue?'
2149         dflt='n'
2150         . ./myread
2151         case "$ans" in
2152         [yY]) echo >&4 "Okay, continuing."
2153               usedevel="$define" ;;
2154         *) echo >&4 "Okay, bye."
2155            exit 1
2156            ;;
2157         esac
2158         ;;
2159     esac
2160     ;;
2161 esac
2162 case "$usedevel" in
2163 $define|true|[yY]*)
2164         case "$versiononly" in
2165         '') versiononly="$define" ;;
2166         esac
2167         case "$installusrbinperl" in
2168         '') installusrbinperl="$undef" ;;
2169         esac
2170         ;;
2171 esac
2172
2173 : general instructions
2174 needman=true
2175 firsttime=true
2176 user=`(logname) 2>/dev/null`
2177 case "$user" in
2178 '') user=`whoami 2>&1`;;
2179 esac
2180 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2181         firsttime=false
2182         echo " "
2183         rp='Would you like to see the instructions?'
2184         dflt=n
2185         . ./myread
2186         case "$ans" in
2187         [yY]*) ;;
2188         *) needman=false;;
2189         esac
2190 fi
2191 if $needman; then
2192         cat <<EOH
2193
2194 This installation shell script will examine your system and ask you questions
2195 to determine how the perl5 package should be installed. If you get
2196 stuck on a question, you may use a ! shell escape to start a subshell or
2197 execute a command.  Many of the questions will have default answers in square
2198 brackets; typing carriage return will give you the default.
2199
2200 On some of the questions which ask for file or directory names you are allowed
2201 to use the ~name construct to specify the login directory belonging to "name",
2202 even if you don't have a shell which knows about that.  Questions where this is
2203 allowed will be marked "(~name ok)".
2204
2205 EOH
2206         rp=''
2207         dflt='Type carriage return to continue'
2208         . ./myread
2209         cat <<'EOH'
2210
2211 The prompter used in this script allows you to use shell variables and
2212 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2213 in the default answer, as if the default line was a set of arguments given to a
2214 script shell.  This means you may also use $* to repeat the whole default line,
2215 so you do not have to re-type everything to add something to the default.
2216
2217 Everytime there is a substitution, you will have to confirm.  If there is an
2218 error (e.g. an unmatched backtick), the default answer will remain unchanged
2219 and you will be prompted again.
2220
2221 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2222 the questions and use the computed defaults (or the previous answers if there
2223 was already a config.sh file). Type 'Configure -h' for a list of options.
2224 You may also start interactively and then answer '& -d' at any prompt to turn
2225 on the non-interactive behaviour for the remainder of the execution.
2226
2227 EOH
2228         . ./myread
2229         cat <<EOH
2230
2231 Much effort has been expended to ensure that this shell script will run on any
2232 Unix system.  If despite that it blows up on yours, your best bet is to edit
2233 Configure and run it again.  If you can't run Configure for some reason,
2234 you'll have to generate a config.sh file by hand.  Whatever problems you
2235 have, let me (perlbug@perl.org) know how I blew it.
2236
2237 This installation script affects things in two ways:
2238
2239 1) it may do direct variable substitutions on some of the files included
2240    in this kit.
2241 2) it builds a config.h file for inclusion in C programs.  You may edit
2242    any of these files as the need arises after running this script.
2243
2244 If you make a mistake on a question, there is no easy way to back up to it
2245 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2246 files.  Configure will offer to let you do this before it runs the SH files.
2247
2248 EOH
2249         dflt='Type carriage return to continue'
2250         . ./myread
2251         case "$firsttime" in
2252         true) echo $user >>../.config/instruct;;
2253         esac
2254 fi
2255
2256 : find out where common programs are
2257 echo " "
2258 echo "Locating common programs..." >&4
2259 cat <<EOSC >loc
2260 $startsh
2261 case \$# in
2262 0) exit 1;;
2263 esac
2264 thing=\$1
2265 shift
2266 dflt=\$1
2267 shift
2268 for dir in \$*; do
2269         case "\$thing" in
2270         .)
2271         if test -d \$dir/\$thing; then
2272                 echo \$dir
2273                 exit 0
2274         fi
2275         ;;
2276         *)
2277         for thisthing in \$dir/\$thing; do
2278                 : just loop through to pick last item
2279         done
2280         if test -f \$thisthing; then
2281                 echo \$thisthing
2282                 exit 0
2283         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2284                 echo \$thisthing
2285                 exit 0
2286         elif test -f \$dir/\$thing.exe; then
2287                 if test -n "$DJGPP"; then
2288                         echo \$dir/\$thing.exe
2289                 elif test "$eunicefix" != ":"; then
2290                         : on Eunice apparently
2291                         echo \$dir/\$thing
2292                 fi
2293                 exit 0
2294         fi
2295         ;;
2296         esac
2297 done
2298 echo \$dflt
2299 exit 1
2300 EOSC
2301 chmod +x loc
2302 $eunicefix loc
2303 loclist="
2304 awk
2305 cat
2306 chmod
2307 comm
2308 cp
2309 echo
2310 expr
2311 grep
2312 ls
2313 mkdir
2314 rm
2315 sed
2316 sort
2317 touch
2318 tr
2319 uniq
2320 "
2321 trylist="
2322 ar
2323 bison
2324 byacc
2325 cpp
2326 csh
2327 date
2328 egrep
2329 gmake
2330 gzip
2331 less
2332 ln
2333 make
2334 more
2335 nm
2336 nroff
2337 pg
2338 test
2339 uname
2340 zip
2341 "
2342 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2343 pth="$pth /lib /usr/lib"
2344 for file in $loclist; do
2345         eval xxx=\$$file
2346         case "$xxx" in
2347         /*|?:[\\/]*)
2348                 if test -f "$xxx"; then
2349                         : ok
2350                 else
2351                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2352                         xxx=`./loc $file $file $pth`
2353                 fi
2354                 ;;
2355         '') xxx=`./loc $file $file $pth`;;
2356         *) xxx=`./loc $xxx $xxx $pth`;;
2357         esac
2358         eval $file=$xxx$_exe
2359         eval _$file=$xxx
2360         case "$xxx" in
2361         /*)
2362                 echo $file is in $xxx.
2363                 ;;
2364         ?:[\\/]*)
2365                 echo $file is in $xxx.
2366                 ;;
2367         *)
2368                 echo "I don't know where '$file' is, and my life depends on it." >&4
2369                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2370                 exit 1
2371                 ;;
2372         esac
2373 done
2374 echo " "
2375 echo "Don't worry if any of the following aren't found..."
2376 say=offhand
2377 for file in $trylist; do
2378         eval xxx=\$$file
2379         case "$xxx" in
2380         /*|?:[\\/]*)
2381                 if test -f "$xxx"; then
2382                         : ok
2383                 else
2384                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2385                         xxx=`./loc $file $file $pth`
2386                 fi
2387                 ;;
2388         '') xxx=`./loc $file $file $pth`;;
2389         *) xxx=`./loc $xxx $xxx $pth`;;
2390         esac
2391         eval $file=$xxx$_exe
2392         eval _$file=$xxx
2393         case "$xxx" in
2394         /*)
2395                 echo $file is in $xxx.
2396                 ;;
2397         ?:[\\/]*)
2398                 echo $file is in $xxx.
2399                 ;;
2400         *)
2401                 echo "I don't see $file out there, $say."
2402                 say=either
2403                 ;;
2404         esac
2405 done
2406 case "$egrep" in
2407 egrep)
2408         echo "Substituting grep for egrep."
2409         egrep=$grep
2410         _egrep=$grep
2411         ;;
2412 esac
2413 case "$ln" in
2414 ln)
2415         echo "Substituting cp for ln."
2416         ln=$cp
2417         _ln=$cp
2418         ;;
2419 esac
2420 case "$make" in
2421 make)
2422         case "$gmake" in
2423         gmake)
2424         echo "I can't find make or gmake, and my life depends on it." >&4
2425         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2426         exit 1
2427         ;;
2428         esac
2429         ;;
2430 esac
2431 case "$gmake" in
2432 gmake)  ;;
2433 *)      # We can't have osname yet.
2434         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2435                 # Assume that gmake, if found, is definitely GNU make
2436                 # and prefer it over the system make.
2437                 echo "Substituting gmake for make."
2438                 make=$gmake
2439                 _make=$gmake
2440         fi
2441         ;;
2442 esac
2443 case "$test" in
2444 test)
2445         echo "Hopefully test is built into your sh."
2446         ;;
2447 *)
2448         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2449                 echo "Using the test built into your sh."
2450                 test=test
2451                 _test=test
2452         fi
2453         ;;
2454 esac
2455 case "$echo" in
2456 echo)
2457         echo "Hopefully echo is built into your sh."
2458         ;;
2459 '') ;;
2460 *)
2461         echo " "
2462 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2463         $echo $n "hi there$c" >foo1
2464         echo $n "hi there$c" >foo2
2465         if cmp foo1 foo2 >/dev/null 2>&1; then
2466                 echo "They are compatible.  In fact, they may be identical."
2467         else
2468                 case "$n" in
2469                 '-n') n='' c='\c';;
2470                 *) n='-n' c='';;
2471                 esac
2472                 cat <<FOO
2473 They are not compatible!  You are probably running ksh on a non-USG system.
2474 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2475 have echo built in and we may have to run some Bourne shell scripts.  That
2476 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2477
2478 FOO
2479                 $echo $n "The star should be here-->$c"
2480                 $echo "*"
2481         fi
2482         $rm -f foo1 foo2
2483         ;;
2484 esac
2485
2486 # This question was auctioned at YAPC::Europe-2007 in Vienna
2487 # I never promised you could answer it. I only auctioned the question.
2488 cat <<FOO
2489 The following message is sponsored by
2490
2491   Dresden.pm<--The stars should be here.
2492
2493 Dear Perl user, system administrator or package
2494 maintainer, the Perl community sends greetings to
2495 you. Do you (emblematical) greet back [Y/n]? n
2496
2497 FOO
2498
2499 : Check what type of C compiler we use
2500 cat <<EOS >trygcc
2501 $startsh
2502 EOS
2503 cat <<'EOSC' >>trygcc
2504 case "$cc" in
2505 '') ;;
2506 *)  $rm -f try try.*
2507     $cat >try.c <<EOM
2508 int main(int argc, char *argv[]) {
2509   return 0;
2510 }
2511 EOM
2512     if $cc -o try $ccflags $ldflags try.c; then
2513        :
2514     else
2515         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2516         despair=yes
2517         trygcc=yes
2518         case "$cc" in
2519         *gcc*) trygcc=no ;;
2520         esac
2521         # Skip this test because it gives a false match on output like:
2522         #    ./trygcc: line 23: cc: command not found
2523         # case "`$cc -v -c try.c 2>&1`" in
2524         # *gcc*) trygcc=no ;;
2525         # esac
2526         if $test X"$trygcc" = Xyes; then
2527             if gcc -o try -c try.c; then
2528                 echo " "
2529                 echo "You seem to have a working gcc, though." >&4
2530                 # Switching compilers may undo the work of hints files.
2531                 # The most common problem is -D_REENTRANT for threads.
2532                 # This heuristic catches that case, but gets false positives
2533                 # if -Dusethreads was not actually specified.  Better to
2534                 # bail out here with a useful message than fail 
2535                 # mysteriously later. Should we perhaps just try to
2536                 # re-invoke Configure -Dcc=gcc config_args ?
2537                 if $test -f usethreads.cbu; then
2538                         $cat >&4 <<EOM 
2539
2540 *** However, any setting of the C compiler flags (e.g. for thread support)
2541 *** will be lost.  It may be necessary for you to restart Configure and
2542 *** add -Dcc=gcc to your Configure command line.
2543
2544 EOM
2545                         rp="Would you like to go ahead and try gcc anyway?"
2546                         dflt=n
2547                 else
2548                         rp="Would you like to use it?"
2549                         dflt=y
2550                 fi
2551                 if $test -f myread; then
2552                     . ./myread
2553                 else
2554                     if $test -f UU/myread; then
2555                         . ./UU/myread
2556                     else
2557                         echo "Cannot find myread, sorry.  Aborting." >&2
2558                         exit 1
2559                     fi
2560                 fi  
2561                 case "$ans" in
2562                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2563                 esac
2564             fi
2565         fi
2566     fi
2567     $rm -f try try.*
2568     ;;
2569 esac
2570 EOSC
2571
2572 cat <<EOS >checkcc
2573 $startsh
2574 EOS
2575 cat <<'EOSC' >>checkcc
2576 case "$cc" in        
2577 '') ;;
2578 *)  $rm -f try try.*              
2579     $cat >try.c <<EOM
2580 int main(int argc, char *argv[]) {
2581   return 0;
2582 }
2583 EOM
2584     if $cc -o try $ccflags $ldflags try.c; then
2585        :
2586     else
2587         if $test X"$despair" = Xyes; then
2588            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2589         fi
2590         $cat >&4 <<EOM         
2591 You need to find a working C compiler.
2592 Either (purchase and) install the C compiler supplied by your OS vendor,
2593 or for a free C compiler try http://gcc.gnu.org/
2594 I cannot continue any further, aborting.
2595 EOM
2596         exit 1
2597     fi
2598     $rm -f try try.*
2599     ;;
2600 esac
2601 EOSC
2602
2603 : determine whether symbolic links are supported
2604 echo " "
2605 $touch blurfl
2606 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2607         echo "Symbolic links are supported." >&4
2608         lns="$ln -s"
2609 else
2610         echo "Symbolic links are NOT supported." >&4
2611         lns="$ln"
2612 fi
2613 $rm -f blurfl sym
2614
2615 : determine whether symbolic links are supported
2616 echo " "
2617 case "$lns" in
2618 *"ln"*" -s")
2619         echo "Checking how to test for symbolic links..." >&4
2620         $lns blurfl sym
2621         if $test "X$issymlink" = X; then
2622                 case "$newsh" in
2623                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2624                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2625                 esac
2626                 if test $? = 0; then
2627                         issymlink="test -h"
2628                 else
2629                         echo "Your builtin 'test -h' may be broken." >&4
2630                         case "$test" in
2631                         /*)     ;;
2632                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2633                                 for p in $pth
2634                                 do
2635                                         if test -f "$p/$test"; then
2636                                                 test="$p/$test"
2637                                                 break
2638                                         fi
2639                                 done
2640                                 ;;
2641                         esac
2642                         case "$test" in
2643                         /*)
2644                                 echo "Trying external '$test -h'." >&4
2645                                 issymlink="$test -h"
2646                                 if $test ! -h sym >/dev/null 2>&1; then
2647                                         echo "External '$test -h' is broken, too." >&4
2648                                         issymlink=''
2649                                 fi
2650                                 ;;
2651                         *)      issymlink='' ;;
2652                         esac
2653                 fi              
2654         fi
2655         if $test "X$issymlink" = X; then
2656                 if $test -L sym 2>/dev/null; then
2657                         issymlink="$test -L"
2658                         echo "The builtin '$test -L' worked." >&4
2659                 fi
2660         fi
2661         if $test "X$issymlink" != X; then
2662                 echo "You can test for symbolic links with '$issymlink'." >&4
2663         else
2664                 echo "I do not know how you can test for symbolic links." >&4
2665         fi
2666         $rm -f blurfl sym
2667         ;;
2668 *)      echo "No symbolic links, so not testing for their testing..." >&4
2669         ;;
2670 esac
2671 echo " "
2672
2673 : Make symlinks util
2674 case "$mksymlinks" in
2675 $define|true|[yY]*)
2676         case "$src" in
2677         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2678                 exit 1
2679                 ;;
2680         *)      case "$lns:$issymlink" in
2681                 *"ln"*" -s:"*"test -"?)
2682                         echo "Creating the symbolic links..." >&4
2683                         echo "(First creating the subdirectories...)" >&4
2684                         cd ..
2685                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2686                                 read directory
2687                                 test -z "$directory" && break
2688                                 mkdir -p $directory
2689                         done
2690                         # Sanity check 1.
2691                         if test ! -d t/base; then
2692                                 echo "Failed to create the subdirectories.  Aborting." >&4
2693                                 exit 1
2694                         fi
2695                         echo "(Then creating the symlinks...)" >&4
2696                         awk '{print $1}' $src/MANIFEST | while true; do
2697                                 read filename
2698                                 test -z "$filename" && break
2699                                 if test -f $filename; then
2700                                         if $issymlink $filename; then
2701                                                 rm -f $filename
2702                                         fi
2703                                 fi
2704                                 if test -f $filename; then
2705                                         echo "$filename already exists, not symlinking."
2706                                 else
2707                                         ln -s $src/$filename $filename
2708                                 fi
2709                         done
2710                         # Sanity check 2.
2711                         if test ! -f t/base/lex.t; then
2712                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2713                                 exit 1
2714                         fi
2715                         cd UU
2716                         ;;
2717                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2718                         ;;
2719                 esac
2720                 ;;
2721         esac
2722         ;;
2723 esac
2724
2725 : Check for Cross-Compilation
2726 case "$usecrosscompile" in
2727 $define|true|[yY]*)
2728         $echo "Cross-compiling..."
2729         croak=''
2730         case "$cc" in
2731         *-*-gcc) # A cross-compiling gcc, probably.
2732             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2733             ar=$targetarch-ar
2734             # leave out ld, choosing it is more complex
2735             nm=$targetarch-nm
2736             ranlib=$targetarch-ranlib
2737             $echo 'extern int foo;' > try.c
2738             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2739             shift
2740             if $test $# -gt 0; then
2741                 incpth="$incpth $*"
2742                 incpth="`$echo $incpth|$sed 's/^ //'`"
2743                 echo "Guessing incpth '$incpth'." >&4
2744                 for i in $*; do
2745                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2746                     if $test -d $j; then
2747                         libpth="$libpth $j"
2748                     fi
2749                 done   
2750                 libpth="`$echo $libpth|$sed 's/^ //'`"
2751                 echo "Guessing libpth '$libpth'." >&4
2752             fi
2753             $rm -f try.c
2754             ;;
2755         esac
2756         case "$targetarch" in
2757         '') echo "Targetarch not defined." >&4; croak=y ;;
2758         *)  echo "Using targetarch $targetarch." >&4 ;;
2759         esac
2760         case "$incpth" in
2761         '') echo "Incpth not defined." >&4; croak=y ;;
2762         *)  echo "Using incpth '$incpth'." >&4 ;;
2763         esac
2764         case "$libpth" in
2765         '') echo "Libpth not defined." >&4; croak=y ;;
2766         *)  echo "Using libpth '$libpth'." >&4 ;;
2767         esac
2768         case "$usrinc" in
2769         '') for i in $incpth; do
2770                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2771                     usrinc=$i
2772                     echo "Guessing usrinc $usrinc." >&4
2773                     break
2774                 fi
2775             done
2776             case "$usrinc" in
2777             '') echo "Usrinc not defined." >&4; croak=y ;;
2778             esac
2779             ;;
2780         *)  echo "Using usrinc $usrinc." >&4 ;;
2781         esac
2782         case "$targethost" in
2783         '') echo "Targethost not defined." >&4; croak=y ;;
2784         *)  echo "Using targethost $targethost." >&4
2785         esac
2786         locincpth=' '
2787         loclibpth=' '
2788         case "$croak" in
2789         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2790         esac
2791         case "$src" in
2792         /*) run=$src/Cross/run
2793             targetmkdir=$src/Cross/mkdir
2794             to=$src/Cross/to
2795             from=$src/Cross/from
2796             ;;
2797         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2798             run=$pwd/Cross/run
2799             targetmkdir=$pwd/Cross/mkdir
2800             to=$pwd/Cross/to
2801             from=$pwd/Cross/from
2802             ;;
2803         esac
2804         case "$targetrun" in
2805         '') targetrun=ssh ;;
2806         esac
2807         case "$targetto" in
2808         '') targetto=scp ;;
2809         esac
2810         case "$targetfrom" in
2811         '') targetfrom=scp ;;
2812         esac
2813         run=$run-$targetrun
2814         to=$to-$targetto
2815         from=$from-$targetfrom
2816         case "$targetdir" in
2817         '')  targetdir=/tmp
2818              echo "Guessing targetdir $targetdir." >&4
2819              ;;
2820         esac
2821         case "$targetuser" in
2822         '')  targetuser=root
2823              echo "Guessing targetuser $targetuser." >&4
2824              ;;
2825         esac
2826         case "$targetfrom" in
2827         scp)    q=-q ;;
2828         *)      q='' ;;
2829         esac
2830         case "$targetrun" in
2831         ssh|rsh)
2832             cat >$run <<EOF
2833 #!/bin/sh
2834 case "\$1" in
2835 -cwd)
2836   shift
2837   cwd=\$1
2838   shift
2839   ;;
2840 esac
2841 case "\$cwd" in
2842 '') cwd=$targetdir ;;
2843 esac
2844 exe=\$1
2845 shift
2846 if $test ! -f \$exe.xok; then
2847   $to \$exe
2848   $touch \$exe.xok
2849 fi
2850 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2851 EOF
2852             ;;
2853         *)  echo "Unknown targetrun '$targetrun'" >&4
2854             exit 1
2855             ;;
2856         esac
2857         case "$targetmkdir" in
2858         */Cross/mkdir)
2859             cat >$targetmkdir <<EOF
2860 #!/bin/sh
2861 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2862 EOF
2863             $chmod a+rx $targetmkdir
2864             ;;
2865         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2866             exit 1
2867             ;;
2868         esac
2869         case "$targetto" in
2870         scp|rcp)
2871             cat >$to <<EOF
2872 #!/bin/sh
2873 for f in \$@
2874 do
2875   case "\$f" in
2876   /*)
2877     $targetmkdir \`dirname \$f\`
2878     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2879     ;;
2880   *)
2881     $targetmkdir $targetdir/\`dirname \$f\`
2882     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2883     ;;
2884   esac
2885 done
2886 exit 0
2887 EOF
2888             ;;
2889         cp) cat >$to <<EOF
2890 #!/bin/sh
2891 for f in \$@
2892 do
2893   case "\$f" in
2894   /*)
2895     $mkdir -p $targetdir/\`dirname \$f\`
2896     $cp \$f $targetdir/\$f || exit 1
2897     ;;
2898   *)
2899     $targetmkdir $targetdir/\`dirname \$f\`
2900     $cp \$f $targetdir/\$f || exit 1
2901     ;;
2902   esac
2903 done
2904 exit 0
2905 EOF
2906             ;;
2907         *)  echo "Unknown targetto '$targetto'" >&4
2908             exit 1
2909             ;;
2910         esac
2911         case "$targetfrom" in
2912         scp|rcp)
2913           cat >$from <<EOF
2914 #!/bin/sh
2915 for f in \$@
2916 do
2917   $rm -f \$f
2918   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2919 done
2920 exit 0
2921 EOF
2922             ;;
2923         cp) cat >$from <<EOF
2924 #!/bin/sh
2925 for f in \$@
2926 do
2927   $rm -f \$f
2928   cp $targetdir/\$f . || exit 1
2929 done
2930 exit 0
2931 EOF
2932             ;;
2933         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2934             exit 1
2935             ;;
2936         esac
2937         if $test ! -f $run; then
2938             echo "Target 'run' script '$run' not found." >&4
2939         else
2940             $chmod a+rx $run
2941         fi
2942         if $test ! -f $to; then
2943             echo "Target 'to' script '$to' not found." >&4
2944         else
2945             $chmod a+rx $to
2946         fi
2947         if $test ! -f $from; then
2948             echo "Target 'from' script '$from' not found." >&4
2949         else
2950             $chmod a+rx $from
2951         fi
2952         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2953             exit 1
2954         fi
2955         cat >&4 <<EOF
2956 Using '$run' for remote execution,
2957 and '$from' and '$to'
2958 for remote file transfer.
2959 EOF
2960         ;;
2961 *)      run=''
2962         to=:
2963         from=:
2964         usecrosscompile='undef'
2965         targetarch=''
2966         ;;
2967 esac
2968
2969 : see whether [:lower:] and [:upper:] are supported character classes
2970 echo " "
2971 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2972 ABYZ)
2973         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2974         up='[:upper:]'
2975         low='[:lower:]'
2976         ;;
2977 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2978         # (0xd9 and 0xe2), therefore that is a nice testing point.
2979         if test "X$up" = X -o "X$low" = X; then
2980             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2981             rs) up='[A-Z]'
2982                 low='[a-z]'
2983                 ;;
2984             esac
2985         fi
2986         if test "X$up" = X -o "X$low" = X; then
2987             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2988             rs) up='A-Z'
2989                 low='a-z'
2990                 ;;
2991             esac
2992         fi
2993         if test "X$up" = X -o "X$low" = X; then
2994             case "`echo RS | od -x 2>/dev/null`" in
2995             *D9E2*|*d9e2*)
2996                 echo "Hey, this might be EBCDIC." >&4
2997                 if test "X$up" = X -o "X$low" = X; then
2998                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2999                     rs) up='[A-IJ-RS-Z]'
3000                         low='[a-ij-rs-z]'
3001                         ;;
3002                     esac
3003                 fi
3004                 if test "X$up" = X -o "X$low" = X; then
3005                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3006                     rs) up='A-IJ-RS-Z'
3007                         low='a-ij-rs-z'
3008                         ;;
3009                     esac
3010                 fi
3011                 ;;
3012             esac
3013         fi
3014 esac
3015 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3016 rs)
3017     echo "Using $up and $low to convert case." >&4
3018     ;;
3019 *)
3020     echo "I don't know how to translate letters from upper to lower case." >&4
3021     echo "Your tr is not acting any way I know of." >&4
3022     exit 1
3023     ;;
3024 esac
3025 : set up the translation script tr, must be called with ./tr of course
3026 cat >tr <<EOSC
3027 $startsh
3028 case "\$1\$2" in
3029 '[A-Z][a-z]') exec $tr '$up' '$low';;
3030 '[a-z][A-Z]') exec $tr '$low' '$up';;
3031 esac
3032 exec $tr "\$@"
3033 EOSC
3034 chmod +x tr
3035 $eunicefix tr
3036
3037 : Try to determine whether config.sh was made on this system
3038 case "$config_sh" in
3039 '')
3040 myuname=`$uname -a 2>/dev/null`
3041 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3042 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3043 # because the A-Z/a-z are not consecutive.
3044 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3045         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3046 newmyuname="$myuname"
3047 dflt=n
3048 case "$knowitall" in
3049 '')
3050         if test -f ../config.sh; then
3051                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3052                         eval "`grep myuname= ../config.sh`"
3053                 fi
3054                 if test "X$myuname" = "X$newmyuname"; then
3055                         dflt=y
3056                 fi
3057         fi
3058         ;;
3059 *) dflt=y;;
3060 esac
3061
3062 : Get old answers from old config file if Configure was run on the
3063 : same system, otherwise use the hints.
3064 hint=default
3065 cd ..
3066 if test -f config.sh; then
3067         echo " "
3068         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3069         . UU/myread
3070         case "$ans" in
3071         n*|N*) echo "OK, I'll ignore it."
3072                 mv config.sh config.sh.old
3073                 myuname="$newmyuname"
3074                 ;;
3075         *)  echo "Fetching default answers from your old config.sh file..." >&4
3076                 tmp_n="$n"
3077                 tmp_c="$c"
3078                 tmp_sh="$sh"
3079                 . ./config.sh
3080                 cp config.sh UU
3081                 n="$tmp_n"
3082                 c="$tmp_c"
3083                 : Older versions did not always set $sh.  Catch re-use of such
3084                 : an old config.sh.
3085                 case "$sh" in
3086                 '') sh="$tmp_sh" ;;
3087                 esac
3088                 hint=previous
3089                 ;;
3090         esac
3091 fi
3092 . ./UU/checkcc
3093 if test ! -f config.sh; then
3094         $cat <<EOM
3095
3096 First time through, eh?  I have some defaults handy for some systems
3097 that need some extra help getting the Configure answers right:
3098
3099 EOM
3100         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3101         dflt=''
3102         : Half the following guesses are probably wrong... If you have better
3103         : tests or hints, please send them to perlbug@perl.org
3104         : The metaconfig authors would also appreciate a copy...
3105         $test -f /irix && osname=irix
3106         $test -f /xenix && osname=sco_xenix
3107         $test -f /dynix && osname=dynix
3108         $test -f /dnix && osname=dnix
3109         $test -f /lynx.os && osname=lynxos
3110         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3111         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3112         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3113         $test -f /bin/mips && /bin/mips && osname=mips
3114         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3115                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3116         $test -d /usr/apollo/bin && osname=apollo
3117         $test -f /etc/saf/_sactab && osname=svr4
3118         $test -d /usr/include/minix && osname=minix
3119         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3120         if $test -d /MachTen -o -d /MachTen_Folder; then
3121                 osname=machten
3122                 if $test -x /sbin/version; then
3123                         osvers=`/sbin/version | $awk '{print $2}' |
3124                         $sed -e 's/[A-Za-z]$//'`
3125                 elif $test -x /usr/etc/version; then
3126                         osvers=`/usr/etc/version | $awk '{print $2}' |
3127                         $sed -e 's/[A-Za-z]$//'`
3128                 else
3129                         osvers="$2.$3"
3130                 fi
3131         fi
3132
3133         $test -f /sys/posix.dll &&
3134                 $test -f /usr/bin/what &&
3135                 set X `/usr/bin/what /sys/posix.dll` &&
3136                 $test "$3" = UWIN &&
3137                 osname=uwin &&
3138                 osvers="$5"
3139
3140         if $test -f $uname; then
3141                 set X $myuname
3142                 shift
3143
3144                 case "$5" in
3145                 fps*) osname=fps ;;
3146                 mips*)
3147                         case "$4" in
3148                         umips) osname=umips ;;
3149                         *) osname=mips ;;
3150                         esac;;
3151                 [23]100) osname=mips ;;
3152                 next*) osname=next ;;
3153                 i386*)
3154                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3155                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3156                                 osname='sco'
3157                                 osvers=$tmp
3158                         elif $test -f /etc/kconfig; then
3159                                 osname=isc
3160                                 if test "$lns" = "$ln -s"; then
3161                                         osvers=4
3162                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3163                                         osvers=3
3164                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3165                                         osvers=2
3166                                 fi
3167                         fi
3168                         tmp=''
3169                         ;;
3170                 pc*)
3171                         if test -n "$DJGPP"; then
3172                                 osname=dos
3173                                 osvers=djgpp
3174                         fi
3175                         ;;
3176                 esac
3177
3178                 case "$1" in
3179                 aix) osname=aix
3180                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3181                         case "$tmp" in
3182                         # oslevel can fail with:
3183                         # oslevel: Unable to acquire lock.
3184                         *not\ found) osvers="$4"."$3" ;;
3185                         '<3240'|'<>3240') osvers=3.2.0 ;;
3186                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3187                         '=3250'|'>3250') osvers=3.2.5 ;;
3188                         *) osvers=$tmp;;
3189                         esac
3190                         ;;
3191                 bsd386) osname=bsd386
3192                         osvers=`$uname -r`
3193                         ;;
3194                 cygwin*) osname=cygwin
3195                         osvers="$3"
3196                         ;;
3197                 *dc.osx) osname=dcosx
3198                         osvers="$3"
3199                         ;;
3200                 dnix) osname=dnix
3201                         osvers="$3"
3202                         ;;
3203                 domainos) osname=apollo
3204                         osvers="$3"
3205                         ;;
3206                 dgux)   osname=dgux
3207                         osvers="$3"
3208                         ;;
3209                 dragonfly) osname=dragonfly
3210                         osvers="$3"
3211                         ;;
3212                 dynixptx*) osname=dynixptx
3213                         osvers=`echo "$4"|sed 's/^v//'`
3214                         ;;
3215                 freebsd) osname=freebsd
3216                         osvers="$3" ;;
3217                 genix)  osname=genix ;;
3218                 gnu)    osname=gnu
3219                         osvers="$3" ;;
3220                 hp*)    osname=hpux
3221                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3222                         ;;
3223                 irix*)  osname=irix
3224                         case "$3" in
3225                         4*) osvers=4 ;;
3226                         5*) osvers=5 ;;
3227                         *)      osvers="$3" ;;
3228                         esac
3229                         ;;
3230                 linux)  osname=linux
3231                         case "$3" in
3232                         *)      osvers="$3" ;;
3233                         esac
3234                         ;;
3235                 MiNT)   osname=mint
3236                         ;;
3237                 netbsd*) osname=netbsd
3238                         osvers="$3"
3239                         ;;
3240                 news-os) osvers="$3"
3241                         case "$3" in
3242                         4*) osname=newsos4 ;;
3243                         *) osname=newsos ;;
3244                         esac
3245                         ;;
3246                 next*) osname=next ;;
3247                 nonstop-ux) osname=nonstopux ;;
3248                 openbsd) osname=openbsd
3249                         osvers="$3"
3250                         ;;
3251                 os2)    osname=os2
3252                         osvers="$4"
3253                         ;;
3254                 POSIX-BC | posix-bc ) osname=posix-bc
3255                         osvers="$3"
3256                         ;;
3257                 powerux | power_ux | powermax_os | powermaxos | \
3258                 powerunix | power_unix) osname=powerux
3259                         osvers="$3"
3260                         ;;
3261                 qnx) osname=qnx
3262                         osvers="$4"
3263                         ;;
3264                 solaris) osname=solaris
3265                         case "$3" in
3266                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3267                         *)      osvers="$3" ;;
3268                         esac
3269                         ;;
3270                 sunos) osname=sunos
3271                         case "$3" in
3272                         5*) osname=solaris
3273                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3274                         *)      osvers="$3" ;;
3275                         esac
3276                         ;;
3277                 titanos) osname=titanos
3278                         case "$3" in
3279                         1*) osvers=1 ;;
3280                         2*) osvers=2 ;;
3281                         3*) osvers=3 ;;
3282                         4*) osvers=4 ;;
3283                         *)      osvers="$3" ;;
3284                         esac
3285                         ;;
3286                 ultrix) osname=ultrix
3287                         osvers="$3"
3288                         ;;
3289                 osf1|mls+)      case "$5" in
3290                                 alpha)
3291                                         osname=dec_osf
3292                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3293                                         case "$osvers" in
3294                                         [1-9].[0-9]*) ;;
3295                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3296                                         esac
3297                                         ;;
3298                         hp*)    osname=hp_osf1  ;;
3299                         mips)   osname=mips_osf1 ;;
3300                         esac
3301                         ;;
3302                 # UnixWare 7.1.2 is known as Open UNIX 8
3303                 openunix|unixware) osname=svr5
3304                         osvers="$4"
3305                         ;;
3306                 uts)    osname=uts
3307                         osvers="$3"
3308                         ;;
3309                 vos) osvers="$3"
3310                         ;;
3311                 $2) case "$osname" in
3312                         *isc*) ;;
3313                         *freebsd*) ;;
3314                         svr*)
3315                                 : svr4.x or possibly later
3316                                 case "svr$3" in
3317                                 ${osname}*)
3318                                         osname=svr$3
3319                                         osvers=$4
3320                                         ;;
3321                                 esac
3322                                 case "$osname" in
3323                                 svr4.0)
3324                                         : Check for ESIX
3325                                         if test -f /stand/boot ; then
3326                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3327                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3328                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3329                                                         if test -n "$isesix"; then
3330                                                                 osname=esix4
3331                                                         fi
3332                                                 fi
3333                                         fi
3334                                         ;;
3335                                 esac
3336                                 ;;
3337                         *)      if test -f /etc/systemid; then
3338                                         osname=sco
3339                                         set `echo $3 | $sed 's/\./ /g'` $4
3340                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3341                                                 osvers=$1.$2.$3
3342                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3343                                                 osvers=$1.$2
3344                                         elif $test -f $src/hints/sco_$1.sh; then
3345                                                 osvers=$1
3346                                         fi
3347                                 else
3348                                         case "$osname" in
3349                                         '') : Still unknown.  Probably a generic Sys V.
3350                                                 osname="sysv"
3351                                                 osvers="$3"
3352                                                 ;;
3353                                         esac
3354                                 fi
3355                                 ;;
3356                         esac
3357                         ;;
3358                 *)      case "$osname" in
3359                         '') : Still unknown.  Probably a generic BSD.
3360                                 osname="$1"
3361                                 osvers="$3"
3362                                 ;;
3363                         esac
3364                         ;;
3365                 esac
3366         else
3367                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3368                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3369                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3370                                 osname=news_os
3371                         fi
3372                         $rm -f UU/kernel.what
3373                 elif test -d c:/. -o -n "$is_os2" ; then
3374                         set X $myuname
3375                         osname=os2
3376                         osvers="$5"
3377                 fi
3378         fi
3379
3380         case "$targetarch" in
3381         '') ;;
3382         *)  hostarch=$osname
3383             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3384             osvers=''
3385             ;;
3386         esac
3387
3388         : Now look for a hint file osname_osvers, unless one has been
3389         : specified already.
3390         case "$hintfile" in
3391         ''|' ')
3392                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3393                 : Also try without trailing minor version numbers.
3394                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3395                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3396                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3397                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3398                 case "$file" in
3399                 '') dflt=none ;;
3400                 *)  case "$osvers" in
3401                         '') dflt=$file
3402                                 ;;
3403                         *)  if $test -f $src/hints/$file.sh ; then
3404                                         dflt=$file
3405                                 elif $test -f $src/hints/$xfile.sh ; then
3406                                         dflt=$xfile
3407                                 elif $test -f $src/hints/$xxfile.sh ; then
3408                                         dflt=$xxfile
3409                                 elif $test -f $src/hints/$xxxfile.sh ; then
3410                                         dflt=$xxxfile
3411                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3412                                         dflt=$xxxxfile
3413                                 elif $test -f "$src/hints/${osname}.sh" ; then
3414                                         dflt="${osname}"
3415                                 else
3416                                         dflt=none
3417                                 fi
3418                                 ;;
3419                         esac
3420                         ;;
3421                 esac
3422                 if $test -f Policy.sh ; then
3423                         case "$dflt" in
3424                         *Policy*) ;;
3425                         none) dflt="Policy" ;;
3426                         *) dflt="Policy $dflt" ;;
3427                         esac
3428                 fi
3429                 ;;
3430         *)
3431                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3432                 ;;
3433         esac
3434
3435         if $test -f Policy.sh ; then
3436                 $cat <<EOM
3437
3438 There's also a Policy hint file available, which should make the
3439 site-specific (policy) questions easier to answer.
3440 EOM
3441
3442         fi
3443
3444         $cat <<EOM
3445
3446 You may give one or more space-separated answers, or "none" if appropriate.
3447 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3448 previous run of Configure, you may specify it as well as or instead of
3449 OS-specific hints.  If hints are provided for your OS, you should use them:
3450 although Perl can probably be built without hints on many platforms, using
3451 hints often improve performance and may enable features that Configure can't
3452 set up on its own. If there are no hints that match your OS, specify "none";
3453 DO NOT give a wrong version or a wrong OS.
3454
3455 EOM
3456
3457         rp="Which of these apply, if any?"
3458         . UU/myread
3459         tans=$ans
3460         for file in $tans; do
3461                 if $test X$file = XPolicy -a -f Policy.sh; then
3462                         . Policy.sh
3463                         $cat Policy.sh >> UU/config.sh
3464                 elif $test -f $src/hints/$file.sh; then
3465                         . $src/hints/$file.sh
3466                         $cat $src/hints/$file.sh >> UU/config.sh
3467                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3468                         : nothing
3469                 else
3470                         : Give one chance to correct a possible typo.
3471                         echo "$file.sh does not exist"
3472                         dflt=$file
3473                         rp="hint to use instead?"
3474                         . UU/myread
3475                         for file in $ans; do
3476                                 if $test -f "$src/hints/$file.sh"; then
3477                                         . $src/hints/$file.sh
3478                                         $cat $src/hints/$file.sh >> UU/config.sh
3479                                 elif $test X$ans = X -o X$ans = Xnone ; then
3480                                         : nothing
3481                                 else
3482                                         echo "$file.sh does not exist -- ignored."
3483                                 fi
3484                         done
3485                 fi
3486         done
3487
3488         hint=recommended
3489         : Remember our hint file for later.
3490         if $test -f "$src/hints/$file.sh" ; then
3491                 hintfile="$file"
3492         else
3493                 hintfile=''
3494         fi
3495 fi
3496 cd UU
3497 ;;
3498 *)
3499         echo " "
3500         echo "Fetching default answers from $config_sh..." >&4
3501         tmp_n="$n"
3502         tmp_c="$c"
3503         cd ..
3504         cp $config_sh config.sh 2>/dev/null
3505         chmod +w config.sh
3506         . ./config.sh
3507         cd UU
3508         cp ../config.sh .
3509         n="$tmp_n"
3510         c="$tmp_c"
3511         hint=previous
3512         ;;
3513 esac
3514 test "$override" && . ./optdef.sh
3515
3516 : Restore computed paths
3517 for file in $loclist $trylist; do
3518         eval $file="\$_$file"
3519 done
3520
3521 cat << EOM
3522
3523 Configure uses the operating system name and version to set some defaults.
3524 The default value is probably right if the name rings a bell. Otherwise,
3525 since spelling matters for me, either accept the default or answer "none"
3526 to leave it blank.
3527
3528 EOM
3529 case "$osname" in
3530         ''|' ')
3531                 case "$hintfile" in
3532                 ''|' '|none) dflt=none ;;
3533                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3534                 esac
3535                 ;;
3536         *) dflt="$osname" ;;
3537 esac
3538 rp="Operating system name?"
3539 . ./myread
3540 case "$ans" in
3541 none)  osname='' ;;
3542 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3543 esac
3544 echo " "
3545 case "$osvers" in
3546         ''|' ')
3547                 case "$hintfile" in
3548                 ''|' '|none) dflt=none ;;
3549                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3550                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3551                         case "$dflt" in
3552                         ''|' ') dflt=none ;;
3553                         esac
3554                         ;;
3555                 esac
3556                 ;;
3557         *) dflt="$osvers" ;;
3558 esac
3559 rp="Operating system version?"
3560 . ./myread
3561 case "$ans" in
3562 none)  osvers='' ;;
3563 *) osvers="$ans" ;;
3564 esac
3565
3566
3567 . ./posthint.sh
3568
3569 : who configured the system
3570 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3571 case "$cf_by" in
3572 "")
3573         cf_by=`(logname) 2>/dev/null`
3574         case "$cf_by" in
3575         "")
3576                 cf_by=`(whoami) 2>/dev/null`
3577                 case "$cf_by" in
3578                 "") cf_by=unknown ;;
3579                 esac ;;
3580         esac ;;
3581 esac
3582
3583 : decide how portable to be.  Allow command line overrides.
3584 case "$d_portable" in
3585 "$undef") ;;
3586 *)      d_portable="$define" ;;
3587 esac
3588
3589 : set up shell script to do ~ expansion
3590 cat >filexp <<EOSS
3591 $startsh
3592 : expand filename
3593 case "\$1" in
3594  \~/*|\~)
3595         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3596         ;;
3597  \~*)
3598         if $test -f /bin/csh; then
3599                 /bin/csh -f -c "glob \$1"
3600                 failed=\$?
3601                 echo ""
3602                 exit \$failed
3603         else
3604                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3605                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3606                 if $test ! -d "\$dir"; then
3607                         me=\`basename \$0\`
3608                         echo "\$me: can't locate home directory for: \$name" >&2
3609                         exit 1
3610                 fi
3611                 case "\$1" in
3612                 */*)
3613                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3614                         ;;
3615                 *)
3616                         echo \$dir
3617                         ;;
3618                 esac
3619         fi
3620         ;;
3621 *)
3622         echo \$1
3623         ;;
3624 esac
3625 EOSS
3626 chmod +x filexp
3627 $eunicefix filexp
3628
3629 : now set up to get a file name
3630 cat <<EOS >getfile
3631 $startsh
3632 EOS
3633 cat <<'EOSC' >>getfile
3634 tilde=''
3635 fullpath=''
3636 already=''
3637 skip=''
3638 none_ok=''
3639 exp_file=''
3640 nopath_ok=''
3641 orig_rp="$rp"
3642 orig_dflt="$dflt"
3643 case "$gfpth" in
3644 '') gfpth='.' ;;
3645 esac
3646
3647 case "$fn" in
3648 *\(*)
3649         : getfile will accept an answer from the comma-separated list
3650         : enclosed in parentheses even if it does not meet other criteria.
3651         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3652         fn=`echo $fn | sed 's/(.*)//'`
3653         ;;
3654 esac
3655
3656 case "$fn" in
3657 *:*)
3658         loc_file=`expr $fn : '.*:\(.*\)'`
3659         fn=`expr $fn : '\(.*\):.*'`
3660         ;;
3661 esac
3662
3663 case "$fn" in
3664 *~*) tilde=true;;
3665 esac
3666 case "$fn" in
3667 */*) fullpath=true;;
3668 esac
3669 case "$fn" in
3670 *+*) skip=true;;
3671 esac
3672 case "$fn" in
3673 *n*) none_ok=true;;
3674 esac
3675 case "$fn" in
3676 *e*) exp_file=true;;
3677 esac
3678 case "$fn" in
3679 *p*) nopath_ok=true;;
3680 esac
3681
3682 case "$fn" in
3683 *f*) type='File';;
3684 *d*) type='Directory';;
3685 *l*) type='Locate';;
3686 esac
3687
3688 what="$type"
3689 case "$what" in
3690 Locate) what='File';;
3691 esac
3692
3693 case "$exp_file" in
3694 '')
3695         case "$d_portable" in
3696         "$define") ;;
3697         *) exp_file=true;;
3698         esac
3699         ;;
3700 esac
3701
3702 cd ..
3703 while test "$type"; do
3704         redo=''
3705         rp="$orig_rp"
3706         dflt="$orig_dflt"
3707         case "$tilde" in
3708         true) rp="$rp (~name ok)";;
3709         esac
3710         . UU/myread
3711         if test -f UU/getfile.ok && \
3712                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3713         then
3714                 value="$ans"
3715                 ansexp="$ans"
3716                 break
3717         fi
3718         case "$ans" in
3719         none)
3720                 value=''
3721                 ansexp=''
3722                 case "$none_ok" in
3723                 true) type='';;
3724                 esac
3725                 ;;
3726         *)
3727                 case "$tilde" in
3728                 '') value="$ans"
3729                         ansexp="$ans";;
3730                 *)
3731                         value=`UU/filexp $ans`
3732                         case $? in
3733                         0)
3734                                 if test "$ans" != "$value"; then
3735                                         echo "(That expands to $value on this system.)"
3736                                 fi
3737                                 ;;
3738                         *) value="$ans";;
3739                         esac
3740                         ansexp="$value"
3741                         case "$exp_file" in
3742                         '') value="$ans";;
3743                         esac
3744                         ;;
3745                 esac
3746                 case "$fullpath" in
3747                 true)
3748                         case "$ansexp" in
3749                         /*) value="$ansexp" ;;
3750                         [a-zA-Z]:/*) value="$ansexp" ;;
3751                         *)
3752                                 redo=true
3753                                 case "$already" in
3754                                 true)
3755                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3756                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3757                                         ;;
3758                                 *)
3759                                 echo "Please give a full path name, starting with slash." >&4
3760                                         case "$tilde" in
3761                                         true)
3762                                 echo "Note that using ~name is ok provided it expands well." >&4
3763                                                 already=true
3764                                                 ;;
3765                                         esac
3766                                 esac
3767                                 ;;
3768                         esac
3769                         ;;
3770                 esac
3771                 case "$redo" in
3772                 '')
3773                         case "$type" in
3774                         File)
3775                                 for fp in $gfpth; do
3776                                         if test "X$fp" = X.; then
3777                                             pf="$ansexp"
3778                                         else    
3779                                             pf="$fp/$ansexp"
3780                                         fi
3781                                         if test -f "$pf"; then
3782                                                 type=''
3783                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3784                                         then
3785                                                 echo "($value is not a plain file, but that's ok.)"
3786                                                 type=''
3787                                         fi
3788                                         if test X"$type" = X; then
3789                                             value="$pf"
3790                                             break
3791                                         fi
3792                                 done
3793                                 ;;
3794                         Directory)
3795                                 for fp in $gfpth; do
3796                                         if test "X$fp" = X.; then
3797                                             dir="$ans"
3798                                             direxp="$ansexp"
3799                                         else    
3800                                             dir="$fp/$ansexp"
3801                                             direxp="$fp/$ansexp"
3802                                         fi
3803                                         if test -d "$direxp"; then
3804                                                 type=''
3805                                                 value="$dir"
3806                                                 break
3807                                         fi
3808                                 done
3809                                 ;;
3810                         Locate)
3811                                 if test -d "$ansexp"; then
3812                                         echo "(Looking for $loc_file in directory $value.)"
3813                                         value="$value/$loc_file"
3814                                         ansexp="$ansexp/$loc_file"
3815                                 fi
3816                                 if test -f "$ansexp"; then
3817                                         type=''
3818                                 fi
3819                                 case "$nopath_ok" in
3820                                 true)   case "$value" in
3821                                         */*) ;;
3822                                         *)      echo "Assuming $value will be in people's path."
3823                                                 type=''
3824                                                 ;;
3825                                         esac
3826                                         ;;
3827                                 esac
3828                                 ;;
3829                         esac
3830
3831                         case "$skip" in
3832                         true) type='';
3833                         esac
3834
3835                         case "$type" in
3836                         '') ;;
3837                         *)
3838                                 if test "$fastread" = yes; then
3839                                         dflt=y
3840                                 else
3841                                         dflt=n
3842                                 fi
3843                                 rp="$what $value doesn't exist.  Use that name anyway?"
3844                                 . UU/myread
3845                                 dflt=''
3846                                 case "$ans" in
3847                                 y*) type='';;
3848                                 *) echo " ";;
3849                                 esac
3850                                 ;;
3851                         esac
3852                         ;;
3853                 esac
3854                 ;;
3855         esac
3856 done
3857 cd UU
3858 ans="$value"
3859 rp="$orig_rp"
3860 dflt="$orig_dflt"
3861 rm -f getfile.ok
3862 test "X$gfpthkeep" != Xy && gfpth=""
3863 EOSC
3864
3865 : determine root of directory hierarchy where package will be installed.
3866 case "$prefix" in
3867 '')
3868         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3869         ;;
3870 *?/)
3871         dflt=`echo "$prefix" | sed 's/.$//'`
3872         ;;
3873 *)
3874         dflt="$prefix"
3875         ;;
3876 esac
3877 $cat <<EOM
3878
3879 By default, $package will be installed in $dflt/bin, manual pages
3880 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3881 installation directories. Typically this is something like /usr/local.
3882 If you wish to have binaries under /usr/bin but other parts of the
3883 installation under /usr/local, that's ok: you will be prompted
3884 separately for each of the installation directories, the prefix being
3885 only used to set the defaults.
3886
3887 EOM
3888 fn=d~
3889 rp='Installation prefix to use?'
3890 . ./getfile
3891 oldprefix=''
3892 case "$prefix" in
3893 '') ;;
3894 *)
3895         case "$ans" in
3896         "$prefix") ;;
3897         *) oldprefix="$prefix";;
3898         esac
3899         ;;
3900 esac
3901 prefix="$ans"
3902 prefixexp="$ansexp"
3903
3904 : allow them to override the AFS root
3905 case "$afsroot" in
3906 '')     afsroot=/afs ;;
3907 *)      afsroot=$afsroot ;;
3908 esac
3909
3910 : is AFS running?
3911 echo " "
3912 case "$afs" in
3913 $define|true)   afs=true ;;
3914 $undef|false)   afs=false ;;
3915 *)      if $test -d $afsroot; then
3916                 afs=true
3917         else
3918                 afs=false
3919         fi
3920         ;;
3921 esac
3922 if $afs; then
3923         echo "AFS may be running... I'll be extra cautious then..." >&4
3924 else
3925         echo "AFS does not seem to be running..." >&4
3926 fi
3927
3928 : determine installation prefix for where package is to be installed.
3929 if $afs; then 
3930 $cat <<EOM
3931
3932 Since you are running AFS, I need to distinguish the directory in which
3933 files will reside from the directory in which they are installed (and from
3934 which they are presumably copied to the former directory by occult means).
3935
3936 EOM
3937         case "$installprefix" in
3938         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3939         *) dflt="$installprefix";;
3940         esac
3941 else
3942 $cat <<EOM
3943
3944 In some special cases, particularly when building $package for distribution,
3945 it is convenient to distinguish the directory in which files should be
3946 installed from the directory ($prefix) in which they will
3947 eventually reside.  For most users, these two directories are the same.
3948
3949 EOM
3950         case "$installprefix" in
3951         '') dflt=$prefix ;;
3952         *) dflt=$installprefix;;
3953         esac
3954 fi
3955 fn=d~
3956 rp='What installation prefix should I use for installing files?'
3957 . ./getfile
3958 installprefix="$ans"
3959 installprefixexp="$ansexp"
3960
3961 : Perform the prefixexp/installprefixexp correction if necessary
3962 cat <<EOS >installprefix
3963 $startsh
3964 EOS
3965 cat <<'EOSC' >>installprefix
3966 : Change installation prefix, if necessary.
3967 if $test X"$prefix" != X"$installprefix"; then
3968     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3969 else
3970     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3971 fi
3972 EOSC
3973 chmod +x installprefix
3974 $eunicefix installprefix
3975
3976 : Set variables such as privlib and privlibexp from the output of ./getfile
3977 : performing the prefixexp/installprefixexp correction if necessary.
3978 cat <<EOS >setprefixvar
3979 $startsh
3980 EOS
3981 cat <<'EOSC' >>setprefixvar
3982 eval "${prefixvar}=\"\$ans\""
3983 eval "${prefixvar}exp=\"\$ansexp\""
3984 . ./installprefix
3985 EOSC
3986 chmod +x setprefixvar
3987 $eunicefix setprefixvar
3988
3989 : set up the script used to warn in case of inconsistency
3990 cat <<EOS >whoa
3991 $startsh
3992 EOS
3993 cat <<'EOSC' >>whoa
3994 dflt=y
3995 case "$hint" in
3996     recommended)
3997         case "$hintfile" in
3998         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
3999                 ;;
4000         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4001                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4002                 ;;
4003         esac
4004         ;;
4005     *)  echo " "
4006         echo "*** WHOA THERE!!! ***" >&4
4007         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4008         ;;
4009 esac
4010 rp="    Keep the $hint value?"
4011 . ./myread
4012 case "$ans" in
4013 y) td=$was; tu=$was;;
4014 esac
4015 EOSC
4016
4017 : function used to set '$1' to '$val'
4018 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4019 case "$val$was" in
4020 $define$undef) . ./whoa; eval "$var=\$td";;
4021 $undef$define) . ./whoa; eval "$var=\$tu";;
4022 *) eval "$var=$val";;
4023 esac'
4024
4025 : Check is we will use socks
4026 case "$usesocks" in
4027 $define|true|[yY]*)     dflt='y';;
4028 *) dflt='n';;
4029 esac
4030 cat <<EOM
4031
4032 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4033 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4034 to use the PerlIO abstraction layer, this will be implicitly selected.
4035
4036 If this doesn't make any sense to you, just accept the default '$dflt'.
4037 EOM
4038 rp='Build Perl for SOCKS?'
4039 . ./myread
4040 case "$ans" in
4041 y|Y)    val="$define" ;;
4042 *)      val="$undef" ;;
4043 esac
4044 set usesocks
4045 eval $setvar
4046
4047 case "$usesocks" in
4048 $define|true|[yY]*) useperlio="$define";;
4049 esac
4050
4051 : Check if we want perlio
4052 case "$useperlio" in
4053 $define|true|[yY]*|'')  dflt='y';;
4054 *) dflt='n';;
4055 esac
4056 cat <<EOM
4057
4058 Previous version of $package used the standard IO mechanisms as
4059 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4060 alternate IO mechanisms via the PerlIO abstraction layer, but the
4061 stdio mechanism is still available if needed.  The abstraction layer
4062 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4063 Using PerlIO with sfio may cause problems with some extension modules.
4064
4065 If this doesn't make any sense to you, just accept the default '$dflt'.
4066 EOM
4067 rp='Use the PerlIO abstraction layer?'
4068 . ./myread
4069 case "$ans" in
4070 y|Y)
4071         val="$define"
4072         ;;
4073 *)
4074         echo "Ok, doing things the stdio way."
4075         val="$undef"
4076         ;;
4077 esac
4078 set useperlio
4079 eval $setvar
4080
4081 case "$usesocks" in
4082 $define|true|[yY]*)
4083         case "$useperlio" in
4084         $define|true|[yY]*) ;;
4085         *)      cat >&4 <<EOM
4086
4087 You are using the SOCKS proxy protocol library which means that you
4088 should also use the PerlIO layer.  You may be headed for trouble.
4089
4090 EOM
4091                 ;;
4092         esac
4093         ;;
4094 esac
4095
4096 : get the patchlevel
4097 echo " "
4098 echo "Getting the current patchlevel..." >&4
4099 if $test -r $rsrc/patchlevel.h;then
4100         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4101         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4102         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4103         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4104         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4105         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4106         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4107 else
4108         revision=0
4109         patchlevel=0
4110         subversion=0
4111         api_revision=0
4112         api_version=0
4113         api_subversion=0
4114         perl_patchlevel=0
4115         $echo "(You do not have patchlevel.h.  Eek.)"
4116 fi
4117 if $test -r $rsrc/.patch ; then
4118         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4119                 perl_patchlevel=`cat $rsrc/.patch`
4120         fi
4121 fi
4122 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4123 version_patchlevel_string="version $patchlevel subversion $subversion"
4124 case "$perl_patchlevel" in
4125 0|'') ;;
4126 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4127 esac
4128
4129 $echo "(You have $package $version_patchlevel_string.)"
4130
4131 case "$osname" in
4132 dos|vms)
4133         : XXX Should be a Configure test for double-dots in filenames.
4134         version=`echo $revision $patchlevel $subversion | \
4135                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4136         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4137                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4138         ;;
4139 *)
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 esac
4146 : Special case the 5.005_xx maintenance series, which used 5.005
4147 : without any subversion label as a subdirectory in $sitelib
4148 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4149         api_versionstring='5.005'
4150 fi
4151
4152 : Do we want threads support and if so, what type
4153 case "$usethreads" in
4154 $define|true|[yY]*)     dflt='y';;
4155 *)     # Catch case where user specified ithreads or 5005threads but
4156        # forgot -Dusethreads (A.D. 4/2002)
4157        case "$useithreads$use5005threads" in
4158        *$define*)
4159                 case "$useperlio" in
4160                 "$define")      dflt='y' ;;
4161                 *)              dflt='n' ;;
4162                 esac
4163                 ;;
4164        *)       dflt='n';;
4165        esac
4166        ;;
4167 esac
4168 cat <<EOM
4169
4170 Perl can be built to take advantage of threads on some systems.
4171 To do so, Configure can be run with -Dusethreads.
4172
4173 Note that Perl built with threading support runs slightly slower
4174 and uses more memory than plain Perl. The current implementation
4175 is believed to be stable, but it is fairly new, and so should be
4176 treated with caution.
4177
4178 If this doesn't make any sense to you, just accept the default '$dflt'.
4179 EOM
4180 rp='Build a threading Perl?'
4181 . ./myread
4182 case "$ans" in
4183 y|Y)    val="$define" ;;
4184 *)      val="$undef" ;;
4185 esac
4186 set usethreads
4187 eval $setvar
4188
4189 if $test $patchlevel -lt 9; then
4190     case "$usethreads" in
4191     $define)
4192         $cat <<EOM
4193
4194 Since release 5.6, Perl has had two different threading implementations,
4195 the newer interpreter-based version (ithreads) with one interpreter per
4196 thread, and the older 5.005 version (5005threads).
4197 The 5005threads version is effectively unmaintained and will probably be
4198 removed in Perl 5.10, so there should be no need to build a Perl using it
4199 unless needed for backwards compatibility with some existing 5.005threads
4200 code.
4201
4202 EOM
4203         : Default to ithreads unless overridden on command line or with
4204         : old config.sh
4205         dflt='y'
4206         case "$use5005threads" in
4207                 $define|true|[yY]*) dflt='n';;
4208         esac
4209         case "$useithreads" in
4210                 $undef|false|[nN]*) dflt='n';;
4211         esac
4212         rp='Use the newer interpreter-based ithreads?'
4213         . ./myread
4214         case "$ans" in
4215         y|Y)    val="$define" ;;
4216         *)      val="$undef" ;;
4217         esac
4218         set useithreads
4219         eval $setvar
4220         : Now set use5005threads to the opposite value.
4221         case "$useithreads" in
4222         $define) val="$undef" ;;
4223         *) val="$define" ;;
4224         esac
4225         set use5005threads
4226         eval $setvar
4227         ;;
4228     *)
4229         useithreads="$undef"
4230         use5005threads="$undef"
4231         ;;
4232     esac
4233
4234     case "$useithreads$use5005threads" in
4235     "$define$define")
4236         $cat >&4 <<EOM
4237
4238 You cannot have both the ithreads and the 5.005 threads enabled
4239 at the same time.  Disabling the 5.005 threads since they are
4240 much less stable than the ithreads.
4241
4242 EOM
4243         use5005threads="$undef"
4244         ;;
4245     esac
4246
4247 else
4248 : perl-5.9.x and later
4249
4250     if test X"$usethreads" = "X$define"; then
4251         case "$use5005threads" in
4252             $define|true|[yY]*)
4253                 $cat >&4 <<EOM
4254
4255 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4256
4257 EOM
4258             ;;
4259         esac
4260     fi
4261
4262     use5005threads="$undef"
4263     useithreads="$usethreads"
4264 fi
4265
4266 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4267         cat >&4 <<EOF
4268 ***
4269 *** To build with ithreads you must also use the PerlIO layer.
4270 *** Cannot continue, aborting.
4271 ***
4272 EOF
4273         exit 1
4274 fi
4275
4276 case "$d_oldpthreads" in
4277 '')     : Configure tests would be welcome here.  For now, assume undef.
4278         val="$undef" ;;
4279 *)      val="$d_oldpthreads" ;;
4280 esac
4281 set d_oldpthreads
4282 eval $setvar
4283
4284
4285 : Look for a hint-file generated 'call-back-unit'.  If the
4286 : user has specified that a threading perl is to be built,
4287 : we may need to set or change some other defaults.
4288 if $test -f usethreads.cbu; then
4289     echo "Your platform has some specific hints regarding threaded builds, using them..."
4290     . ./usethreads.cbu
4291 else
4292     case "$usethreads" in
4293         "$define"|true|[yY]*)
4294                 $cat <<EOM
4295 (Your platform does not have any specific hints for threaded builds.
4296  Assuming POSIX threads, then.)
4297 EOM
4298         ;;
4299     esac
4300 fi
4301
4302 : Check if multiplicity is required
4303 cat <<EOM
4304
4305 Perl can be built so that multiple Perl interpreters can coexist
4306 within the same Perl executable.
4307 EOM
4308
4309 case "$useithreads" in
4310 $define)
4311         cat <<EOM
4312 This multiple interpreter support is required for interpreter-based threads.
4313 EOM
4314         val="$define"
4315         ;;
4316 *)      case "$usemultiplicity" in
4317         $define|true|[yY]*)     dflt='y';;
4318         *) dflt='n';;
4319         esac
4320         echo " "
4321         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4322         rp='Build Perl for multiplicity?'
4323         . ./myread
4324         case "$ans" in
4325         y|Y)    val="$define" ;;
4326         *)      val="$undef" ;;
4327         esac
4328         ;;
4329 esac
4330 set usemultiplicity
4331 eval $setvar
4332
4333 : Check if morebits is requested
4334 case "$usemorebits" in
4335 "$define"|true|[yY]*)
4336         use64bitint="$define"
4337         uselongdouble="$define"
4338         usemorebits="$define"
4339         ;;
4340 *)      usemorebits="$undef"
4341         ;;
4342 esac
4343
4344 : Determine the C compiler to be used
4345 echo " "
4346 case "$cc" in
4347 '') dflt=cc;;
4348 *) dflt="$cc";;
4349 esac
4350 rp="Use which C compiler?"
4351 . ./myread
4352 cc="$ans"
4353
4354 : See whether they have no cc but they do have gcc
4355 . ./trygcc
4356 if $test -f cc.cbu; then
4357     . ./cc.cbu
4358 fi
4359 . ./checkcc
4360
4361 : make some quick guesses about what we are up against
4362 echo " "
4363 $echo $n "Hmm...  $c"
4364 echo exit 1 >bsd
4365 echo exit 1 >usg
4366 echo exit 1 >v7
4367 echo exit 1 >osf1
4368 echo exit 1 >eunice
4369 echo exit 1 >xenix
4370 echo exit 1 >venix
4371 echo exit 1 >os2
4372 d_bsd="$undef"
4373 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4374 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4375 then
4376         echo "Looks kind of like an OSF/1 system, but we'll see..."
4377         echo exit 0 >osf1
4378 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4379         xxx=`./loc addbib blurfl $pth`
4380         if $test -f $xxx; then
4381         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4382                 echo exit 0 >bsd
4383                 echo exit 0 >usg
4384         else
4385                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4386                         echo "Looks kind of like an extended USG system, but we'll see..."
4387                 else
4388                         echo "Looks kind of like a USG system, but we'll see..."
4389                 fi
4390                 echo exit 0 >usg
4391         fi
4392 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4393         echo "Looks kind of like a BSD system, but we'll see..."
4394         d_bsd="$define"
4395         echo exit 0 >bsd
4396 else
4397         echo "Looks kind of like a Version 7 system, but we'll see..."
4398         echo exit 0 >v7
4399 fi
4400 case "$eunicefix" in
4401 *unixtovms*)
4402         $cat <<'EOI'
4403 There is, however, a strange, musty smell in the air that reminds me of
4404 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4405 EOI
4406         echo exit 0 >eunice
4407         d_eunice="$define"
4408 : it so happens the Eunice I know will not run shell scripts in Unix format
4409         ;;
4410 *)
4411         echo " "
4412         echo "Congratulations.  You aren't running Eunice."
4413         d_eunice="$undef"
4414         ;;
4415 esac
4416 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4417 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4418 : semicolon as a patch separator
4419 case "$p_" in
4420 :) ;;
4421 *)
4422         $cat <<'EOI'
4423 I have the feeling something is not exactly right, however...don't tell me...
4424 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4425 (Or you may be running DOS with DJGPP.)
4426 EOI
4427         echo exit 0 >os2
4428         ;;
4429 esac
4430 if test -f /xenix; then
4431         echo "Actually, this looks more like a XENIX system..."
4432         echo exit 0 >xenix
4433         d_xenix="$define"
4434 else
4435         echo " "
4436         echo "It's not Xenix..."
4437         d_xenix="$undef"
4438 fi
4439 chmod +x xenix
4440 $eunicefix xenix
4441 if test -f /venix; then
4442         echo "Actually, this looks more like a VENIX system..."
4443         echo exit 0 >venix
4444 else
4445         echo " "
4446         if ./xenix; then
4447                 : null
4448         else
4449                 echo "Nor is it Venix..."
4450         fi
4451 fi
4452 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4453 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4454 $rm -f foo
4455
4456 : Check if we are using GNU gcc and what its version is
4457 echo " "
4458 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4459 $cat >try.c <<EOM
4460 #include <stdio.h>
4461 int main() {
4462 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4463 #ifdef __VERSION__
4464         printf("%s\n", __VERSION__);
4465 #else
4466         printf("%s\n", "1");
4467 #endif
4468 #endif
4469         return(0);
4470 }
4471 EOM
4472 if $cc -o try $ccflags $ldflags try.c; then
4473         gccversion=`$run ./try`
4474         case "$gccversion" in
4475         '') echo "You are not using GNU cc." ;;
4476         *)  echo "You are using GNU cc $gccversion."
4477             ccname=gcc
4478             ;;
4479         esac
4480 else
4481         echo " "
4482         echo "*** WHOA THERE!!! ***" >&4
4483         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4484         case "$knowitall" in
4485         '')
4486         echo "    You'd better start hunting for one and let me know about it." >&4
4487                 exit 1
4488                 ;;
4489         esac
4490 fi
4491 $rm -f try try.*
4492 case "$gccversion" in
4493 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4494 esac
4495 case "$gccversion" in
4496 '') gccosandvers='' ;;
4497 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4498    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4499    gccshortvers=''
4500    case "$gccosandvers" in
4501    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4502    $osname$osvers) ;; # looking good
4503    $osname*) cat <<EOM >&4
4504
4505 *** WHOA THERE!!! ***
4506
4507     Your gcc has not been compiled for the exact release of
4508     your operating system ($gccosandvers versus $osname$osvers).
4509
4510     In general it is a good idea to keep gcc synchronized with
4511     the operating system because otherwise serious problems
4512     may ensue when trying to compile software, like Perl.
4513
4514     I'm trying to be optimistic here, though, and will continue.
4515     If later during the configuration and build icky compilation
4516     problems appear (headerfile conflicts being the most common
4517     manifestation), I suggest reinstalling the gcc to match
4518     your operating system release.
4519
4520 EOM
4521       ;;
4522    *) gccosandvers='' ;; # failed to parse, better be silent
4523    esac
4524    ;;
4525 esac
4526 case "$ccname" in
4527 '') ccname="$cc" ;;
4528 esac
4529
4530 # gcc 3.* complain about adding -Idirectories that they already know about,
4531 # so we will take those off from locincpth.
4532 case "$gccversion" in
4533 3*)
4534     echo "main(){}">try.c
4535     for incdir in $locincpth; do
4536        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4537              grep '^c[cp]p*[01]: warning: changing search order '`
4538        if test "X$warn" != X; then
4539            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4540        fi
4541     done
4542     $rm -f try try.*
4543 esac
4544
4545 : What should the include directory be ?
4546 echo " "
4547 $echo $n "Hmm...  $c"
4548 dflt='/usr/include'
4549 incpath=''
4550 mips_type=''
4551 if $test -f /bin/mips && /bin/mips; then
4552         echo "Looks like a MIPS system..."
4553         $cat >usr.c <<'EOCP'
4554 #ifdef SYSTYPE_BSD43
4555 /bsd43
4556 #endif
4557 EOCP
4558         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4559                 dflt='/bsd43/usr/include'
4560                 incpath='/bsd43'
4561                 mips_type='BSD 4.3'
4562         else
4563                 mips_type='System V'
4564         fi
4565         $rm -f usr.c usr.out
4566         echo "and you're compiling with the $mips_type compiler and libraries."
4567         xxx_prompt=y
4568         echo "exit 0" >mips
4569 else
4570         echo "Doesn't look like a MIPS system."
4571         xxx_prompt=n
4572         echo "exit 1" >mips
4573 fi
4574 chmod +x mips
4575 $eunicefix mips
4576 case "$usrinc" in
4577 '') ;;
4578 *) dflt="$usrinc";;
4579 esac
4580 case "$xxx_prompt" in
4581 y)      fn=d/
4582         echo " "
4583         rp='Where are the include files you want to use?'
4584         . ./getfile
4585         usrinc="$ans"
4586         ;;
4587 *)      usrinc="$dflt"
4588         ;;
4589 esac
4590
4591 : see how we invoke the C preprocessor
4592 echo " "
4593 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4594 cat <<'EOT' >testcpp.c
4595 #define ABC abc
4596 #define XYZ xyz
4597 ABC.XYZ
4598 EOT
4599 cd ..
4600 if test ! -f cppstdin; then
4601         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4602                 # AIX cc -E doesn't show the absolute headerfile
4603                 # locations but we'll cheat by using the -M flag.
4604                 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
4605         else
4606                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4607         fi
4608 else
4609         echo "Keeping your $hint cppstdin wrapper."
4610 fi
4611 chmod 755 cppstdin
4612 wrapper=`pwd`/cppstdin
4613 ok='false'
4614 cd UU
4615
4616 if $test "X$cppstdin" != "X" && \
4617         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4618         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4619 then
4620         echo "You used to use $cppstdin $cppminus so we'll use that again."
4621         case "$cpprun" in
4622         '') echo "But let's see if we can live without a wrapper..." ;;
4623         *)
4624                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4625                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4626                 then
4627                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4628                         ok='true'
4629                 else
4630                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4631                 fi
4632                 ;;
4633         esac
4634 else
4635         case "$cppstdin" in
4636         '') ;;
4637         *)
4638                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4639                 ;;
4640         esac
4641 fi
4642
4643 if $ok; then
4644         : nothing
4645 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4646         $cc -E <testcpp.c >testcpp.out 2>&1; \
4647         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4648         echo "Yup, it does."
4649         x_cpp="$cc -E"
4650         x_minus='';
4651 elif echo 'Nope...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"' -P" will work...'; \
4658         $cc -P <testcpp.c >testcpp.out 2>&1; \
4659         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4660         echo "Yipee, that works!"
4661         x_cpp="$cc -P"
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 "At long last!"
4667         x_cpp="$cc -P"
4668         x_minus='-';
4669 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4670         $cpp <testcpp.c >testcpp.out 2>&1; \
4671         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4672         echo "It works!"
4673         x_cpp="$cpp"
4674         x_minus='';
4675 elif echo 'Nixed again...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 "Hooray, it works!  I was beginning to wonder."
4679         x_cpp="$cpp"
4680         x_minus='-';
4681 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4682         $wrapper <testcpp.c >testcpp.out 2>&1; \
4683         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4684         x_cpp="$wrapper"
4685         x_minus=''
4686         echo "Eureka!"
4687 else
4688         dflt=''
4689         rp="No dice.  I can't find a C preprocessor.  Name one:"
4690         . ./myread
4691         x_cpp="$ans"
4692         x_minus=''
4693         $x_cpp <testcpp.c >testcpp.out 2>&1
4694         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4695                 echo "OK, that will do." >&4
4696         else
4697 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4698                 exit 1
4699         fi
4700 fi
4701
4702 case "$ok" in
4703 false)
4704         cppstdin="$x_cpp"
4705         cppminus="$x_minus"
4706         cpprun="$x_cpp"
4707         cpplast="$x_minus"
4708         set X $x_cpp
4709         shift
4710         case "$1" in
4711         "$cpp")
4712                 echo "Perhaps can we force $cc -E using a wrapper..."
4713                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4714                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4715                 then
4716                         echo "Yup, we can."
4717                         cppstdin="$wrapper"
4718                         cppminus='';
4719                 else
4720                         echo "Nope, we'll have to live without it..."
4721                 fi
4722                 ;;
4723         esac
4724         case "$cpprun" in
4725         "$wrapper")
4726                 cpprun=''
4727                 cpplast=''
4728                 ;;
4729         esac
4730         ;;
4731 esac
4732
4733 case "$cppstdin" in
4734 "$wrapper"|'cppstdin') ;;
4735 *) $rm -f $wrapper;;
4736 esac
4737 $rm -f testcpp.c testcpp.out
4738
4739 : Set private lib path
4740 case "$plibpth" in
4741 '') if ./mips; then
4742                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4743         fi;;
4744 esac
4745 case "$libpth" in
4746 ' ') dlist='';;
4747 '') dlist="$loclibpth $plibpth $glibpth";;
4748 *) dlist="$libpth";;
4749 esac
4750
4751 : Now check and see which directories actually exist, avoiding duplicates
4752 libpth=''
4753 for xxx in $dlist
4754 do
4755     if $test -d $xxx; then
4756                 case " $libpth " in
4757                 *" $xxx "*) ;;
4758                 *) libpth="$libpth $xxx";;
4759                 esac
4760     fi
4761 done
4762 $cat <<'EOM'
4763
4764 Some systems have incompatible or broken versions of libraries.  Among
4765 the directories listed in the question below, please remove any you
4766 know not to be holding relevant libraries, and add any that are needed.
4767 Say "none" for none.
4768
4769 EOM
4770 case "$libpth" in
4771 '') dflt='none';;
4772 *)
4773         set X $libpth
4774         shift
4775         dflt=${1+"$@"}
4776         ;;
4777 esac
4778 rp="Directories to use for library searches?"
4779 . ./myread
4780 case "$ans" in
4781 none) libpth=' ';;
4782 *) libpth="$ans";;
4783 esac
4784
4785 : compute shared library extension
4786 case "$so" in
4787 '')
4788         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4789                 dflt='sl'
4790         else
4791                 dflt='so'
4792         fi
4793         ;;
4794 *) dflt="$so";;
4795 esac
4796 $cat <<EOM
4797
4798 On some systems, shared libraries may be available.  Answer 'none' if
4799 you want to suppress searching of shared libraries for the remainder
4800 of this configuration.
4801
4802 EOM
4803 rp='What is the file extension used for shared libraries?'
4804 . ./myread
4805 so="$ans"
4806
4807 : Define several unixisms.
4808 : Hints files or command line option can be used to override them.
4809 : The convoluted testing is in case hints files set either the old
4810 : or the new name.
4811 case "$_exe" in
4812 '')     case "$exe_ext" in
4813         '')     ;;
4814         *)      _exe="$exe_ext" ;;
4815         esac
4816         ;;
4817 esac
4818 case "$_a" in
4819 '')     case "$lib_ext" in
4820     '') _a='.a';;
4821         *)      _a="$lib_ext" ;;
4822         esac
4823         ;;
4824 esac
4825 case "$_o" in
4826 '') case "$obj_ext" in
4827         '')     _o='.o';;
4828         *)      _o="$obj_ext";;
4829         esac
4830         ;;
4831 esac
4832 case "$p_" in
4833 '') case "$path_sep" in
4834         '')     p_=':';;
4835         *)      p_="$path_sep";;
4836         esac
4837         ;;
4838 esac
4839 exe_ext=$_exe
4840 lib_ext=$_a
4841 obj_ext=$_o
4842 path_sep=$p_
4843
4844 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4845
4846 : Which makefile gets called first.  This is used by make depend.
4847 case "$firstmakefile" in
4848 '') firstmakefile='makefile';;
4849 esac
4850
4851 : Check for uselongdouble support
4852 case "$ccflags" in
4853 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4854 esac
4855
4856 case "$uselongdouble" in
4857 $define|true|[yY]*)     dflt='y';;
4858 *) dflt='n';;
4859 esac
4860 cat <<EOM
4861
4862 Perl can be built to take advantage of long doubles which
4863 (if available) may give more accuracy and range for floating point numbers.
4864
4865 If this doesn't make any sense to you, just accept the default '$dflt'.
4866 EOM
4867 rp='Try to use long doubles if available?'
4868 . ./myread
4869 case "$ans" in
4870 y|Y)    val="$define"   ;;
4871 *)      val="$undef"    ;;
4872 esac
4873 set uselongdouble
4874 eval $setvar
4875
4876 case "$uselongdouble" in
4877 true|[yY]*) uselongdouble="$define" ;;
4878 esac
4879
4880 : Look for a hint-file generated 'call-back-unit'.  If the
4881 : user has specified that long doubles should be used,
4882 : we may need to set or change some other defaults.
4883 if $test -f uselongdouble.cbu; then
4884     echo "Your platform has some specific hints regarding long doubles, using them..."
4885     . ./uselongdouble.cbu
4886 else
4887     case "$uselongdouble" in
4888         $define)
4889                 $cat <<EOM
4890 (Your platform does not have any specific hints for long doubles.)
4891 EOM
4892         ;;
4893     esac
4894 fi
4895
4896 : Looking for optional libraries
4897 echo " "
4898 echo "Checking for optional libraries..." >&4
4899 case "$libs" in
4900 ' '|'') dflt='';;
4901 *) dflt="$libs";;
4902 esac
4903 case "$libswanted" in
4904 '') libswanted='c_s';;
4905 esac
4906 case "$usesocks" in
4907 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4908 esac
4909 libsfound=''
4910 libsfiles=''
4911 libsdirs=''
4912 libspath=''
4913 for thisdir in $libpth $xlibpth; do
4914   test -d $thisdir && libspath="$libspath $thisdir"
4915 done
4916 for thislib in $libswanted; do
4917         for thisdir in $libspath; do
4918             xxx=''
4919             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4920                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4921                 $test -f "$xxx" && eval $libscheck
4922                 $test -f "$xxx" && libstyle=shared
4923             fi
4924             if test ! -f "$xxx"; then
4925                 xxx=$thisdir/lib$thislib.$so
4926                 $test -f "$xxx" && eval $libscheck
4927                 $test -f "$xxx" && libstyle=shared
4928             fi
4929             if test ! -f "$xxx"; then
4930                 xxx=$thisdir/lib$thislib$_a
4931                 $test -f "$xxx" && eval $libscheck
4932                 $test -f "$xxx" && libstyle=static
4933             fi
4934             if test ! -f "$xxx"; then
4935                 xxx=$thisdir/$thislib$_a
4936                 $test -f "$xxx" && eval $libscheck
4937                 $test -f "$xxx" && libstyle=static
4938             fi
4939             if test ! -f "$xxx"; then
4940                 xxx=$thisdir/lib${thislib}_s$_a
4941                 $test -f "$xxx" && eval $libscheck
4942                 $test -f "$xxx" && libstyle=static
4943                 $test -f "$xxx" && thislib=${thislib}_s
4944             fi
4945             if test ! -f "$xxx"; then
4946                 xxx=$thisdir/Slib$thislib$_a
4947                 $test -f "$xxx" && eval $libscheck
4948                 $test -f "$xxx" && libstyle=static
4949             fi
4950             if $test -f "$xxx"; then
4951                 case "$libstyle" in
4952                 shared) echo "Found -l$thislib (shared)." ;;
4953                 static) echo "Found -l$thislib." ;;
4954                 *)      echo "Found -l$thislib ($libstyle)." ;;
4955                 esac
4956                 case " $dflt " in
4957                 *"-l$thislib "*);;
4958                 *) dflt="$dflt -l$thislib"
4959                    libsfound="$libsfound $xxx"
4960                    yyy=`basename $xxx`
4961                    libsfiles="$libsfiles $yyy"
4962                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4963                    case " $libsdirs " in
4964                    *" $yyy "*) ;;
4965                    *) libsdirs="$libsdirs $yyy" ;;
4966                    esac
4967                    ;;
4968                 esac
4969                 break
4970             fi
4971         done
4972         if $test ! -f "$xxx"; then
4973             echo "No -l$thislib."
4974         fi
4975 done
4976 set X $dflt
4977 shift
4978 dflt="$*"
4979 case "$libs" in
4980 '') dflt="$dflt";;
4981 *) dflt="$libs";;
4982 esac
4983 case "$dflt" in
4984 ' '|'') dflt='none';;
4985 esac
4986
4987 $cat <<EOM
4988
4989 In order to compile $package on your machine, a number of libraries
4990 are usually needed.  Include any other special libraries here as well.
4991 Say "none" for none.  The default list is almost always right.
4992 EOM
4993
4994 echo " "
4995 rp="What libraries to use?"
4996 . ./myread
4997 case "$ans" in
4998 none) libs=' ';;
4999 *) libs="$ans";;
5000 esac
5001
5002 : determine optimization, if desired, or use for debug flag also
5003 case "$optimize" in
5004 ' '|$undef) dflt='none';;
5005 '') dflt='-O';;
5006 *) dflt="$optimize";;
5007 esac
5008 $cat <<EOH
5009
5010 By default, $package compiles with the -O flag to use the optimizer.
5011 Alternately, you might want to use the symbolic debugger, which uses
5012 the -g flag (on traditional Unix systems).  Either flag can be
5013 specified here.  To use neither flag, specify the word "none".
5014
5015 EOH
5016 rp="What optimizer/debugger flag should be used?"
5017 . ./myread
5018 optimize="$ans"
5019 case "$optimize" in
5020 'none') optimize=" ";;
5021 esac
5022
5023 : Check what DEBUGGING is required from the command line
5024 : -DEBUGGING      or -DDEBUGGING or
5025 : -DEBUGGING=both                       = -g + -DDEBUGGING
5026 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5027 : -DEBUGGING=none or -UDEBUGGING        =
5028 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5029 case "$EBUGGING" in
5030 '')     ;;
5031 *)      DEBUGGING=$EBUGGING ;;
5032 esac
5033
5034 case "$DEBUGGING" in
5035 -g|both|$define)
5036     case "$optimize" in
5037         *-g*) ;;
5038         *)    optimize="$optimize -g" ;;
5039     esac ;;
5040 none|$undef)
5041     case "$optimize" in
5042         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5043                 shift
5044                 optimize="$*"
5045                 ;;
5046     esac ;;
5047 esac
5048
5049 dflt=''
5050 case "$DEBUGGING" in
5051 both|$define) dflt='-DDEBUGGING'
5052 esac
5053
5054 : argument order is deliberate, as the flag will start with - which set could
5055 : think is an option
5056 checkccflag='check=$1; flag=$2; callback=$3;
5057 echo " ";
5058 echo "Checking if your compiler accepts $flag" 2>&1;
5059 echo "int main(void) { return 0; }" > gcctest.c;
5060 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5061     echo "Yes, it does." 2>&1;
5062     if $test -s gcctest.out ; then
5063         echo "But your platform does not like it:";
5064         cat gcctest.out;
5065     else
5066         case "$ccflags" in
5067         *$check*)
5068             echo "Leaving current flags $ccflags alone." 2>&1
5069             ;;
5070         *) dflt="$dflt $flag";
5071             eval $callback
5072             ;;
5073         esac
5074     fi
5075 else
5076     echo "Nope, it does not, but that is ok." 2>&1;
5077 fi
5078 '
5079
5080 : We will not override a previous value, but we might want to
5081 : augment a hint file
5082 case "$hint" in
5083 default|recommended)
5084         case "$gccversion" in
5085         1*) dflt="$dflt -fpcc-struct-return" ;;
5086         esac
5087         case "$optimize:$DEBUGGING" in
5088         *-g*:old) dflt="$dflt -DDEBUGGING";;
5089         esac
5090         case "$gccversion" in
5091         2*) if $test -d /etc/conf/kconfig.d &&
5092                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5093                 then
5094                         # Interactive Systems (ISC) POSIX mode.
5095                         dflt="$dflt -posix"
5096                 fi
5097                 ;;
5098         esac
5099         case "$gccversion" in
5100         1*) ;;
5101         2.[0-8]*) ;;
5102         ?*)     set strict-aliasing -fno-strict-aliasing
5103                 eval $checkccflag
5104                 ;;
5105         esac
5106         # For gcc, adding -pipe speeds up compilations for some, but apparently
5107         # some assemblers can't read from stdin.  (It also slows down compilations
5108         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5109         case "$gccversion" in
5110         ?*)     set pipe -pipe
5111                 eval $checkccflag
5112                 ;;
5113         esac
5114
5115         # on x86_64 (at least) we require an extra library (libssp) in the
5116         # link command line. This library is not named, so I infer that it is
5117         # an implementation detail that may change. Hence the safest approach
5118         # is to add the flag to the flags passed to the compiler at link time,
5119         # as that way the compiler can do the right implementation dependant
5120         # thing. (NWC)
5121         case "$gccversion" in
5122         ?*)     set stack-protector -fstack-protector
5123                 eval $checkccflag
5124                 ;;
5125         esac
5126         ;;
5127 esac
5128
5129 case "$mips_type" in
5130 *BSD*|'') inclwanted="$locincpth $usrinc";;
5131 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5132 esac
5133 for thisincl in $inclwanted; do
5134         if $test -d $thisincl; then
5135                 if $test x$thisincl != x$usrinc; then
5136                         case "$dflt" in
5137                         *" -I$thisincl "*);;
5138                         *) dflt="$dflt -I$thisincl ";;
5139                         esac
5140                 fi
5141         fi
5142 done
5143
5144 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5145         xxx=true;
5146 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5147         xxx=true;
5148 else
5149         xxx=false;
5150 fi;
5151 if $xxx; then
5152         case "$dflt" in
5153         *$2*);;
5154         *) dflt="$dflt -D$2";;
5155         esac;
5156 fi'
5157
5158 set signal.h LANGUAGE_C; eval $inctest
5159
5160 case "$usesocks" in
5161 $define)
5162         ccflags="$ccflags -DSOCKS"
5163         ;;
5164 esac
5165
5166 case "$hint" in
5167 default|recommended) dflt="$ccflags $dflt" ;;
5168 *) dflt="$ccflags";;
5169 esac
5170
5171 case "$dflt" in
5172 ''|' ') dflt=none;;
5173 esac
5174
5175 $cat <<EOH
5176
5177 Your C compiler may want other flags.  For this question you should include
5178 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5179 but you should NOT include libraries or ld flags like -lwhatever.  If you
5180 want $package to honor its debug switch, you should include -DDEBUGGING here.
5181 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5182
5183 To use no flags, specify the word "none".
5184
5185 EOH
5186 set X $dflt
5187 shift
5188 dflt=${1+"$@"}
5189 rp="Any additional cc flags?"
5190 . ./myread
5191 case "$ans" in
5192 none) ccflags='';;
5193 *) ccflags="$ans";;
5194 esac
5195
5196 : the following weeds options from ccflags that are of no interest to cpp
5197 case "$cppflags" in
5198 '') cppflags="$ccflags" ;;
5199 *)  cppflags="$cppflags $ccflags" ;;
5200 esac
5201 case "$gccversion" in
5202 1*) cppflags="$cppflags -D__GNUC__"
5203 esac
5204 case "$mips_type" in
5205 '');;
5206 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5207 esac
5208 case "$cppflags" in
5209 '');;
5210 *)
5211         echo " "
5212         echo "Let me guess what the preprocessor flags are..." >&4
5213         set X $cppflags
5214         shift
5215         cppflags=''
5216         $cat >cpp.c <<'EOM'
5217 #define BLURFL foo
5218
5219 BLURFL xx LFRULB
5220 EOM
5221         previous=''
5222         for flag in $*
5223         do
5224                 case "$flag" in
5225                 -*) ftry="$flag";;
5226                 *) ftry="$previous $flag";;
5227                 esac
5228                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5229                         >cpp1.out 2>/dev/null && \
5230                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5231                         >cpp2.out 2>/dev/null && \
5232                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5233                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5234                 then
5235                         cppflags="$cppflags $ftry"
5236                         previous=''
5237                 else
5238                         previous="$flag"
5239                 fi
5240         done
5241         set X $cppflags
5242         shift
5243         cppflags=${1+"$@"}
5244         case "$cppflags" in
5245         *-*)  echo "They appear to be: $cppflags";;
5246         esac
5247         $rm -f cpp.c cpp?.out
5248         ;;
5249 esac
5250
5251 : flags used in final linking phase
5252 case "$ldflags" in
5253 '') if ./venix; then
5254                 dflt='-i -z'
5255         else
5256                 dflt=''
5257         fi
5258         case "$ccflags" in
5259         *-posix*) dflt="$dflt -posix" ;;
5260         esac
5261         # See note above about -fstack-protector
5262         case "$ccflags" in
5263         *-fstack-protector*) dflt="$dflt -fstack-protector" ;;
5264         esac
5265         ;;
5266 *) dflt="$ldflags";;
5267 esac
5268
5269 : Try to guess additional flags to pick up local libraries.
5270 for thislibdir in $libpth; do
5271         case " $loclibpth " in
5272         *" $thislibdir "*)
5273                 case "$dflt " in
5274                 *"-L$thislibdir "*) ;;
5275                 *)  dflt="$dflt -L$thislibdir" ;;
5276                 esac
5277                 ;;
5278         esac
5279 done
5280
5281 case "$dflt" in
5282 '') dflt='none' ;;
5283 esac
5284
5285 $cat <<EOH
5286
5287 Your C linker may need flags.  For this question you should
5288 include -L/whatever and any other flags used by the C linker, but you
5289 should NOT include libraries like -lwhatever.
5290
5291 Make sure you include the appropriate -L/path flags if your C linker
5292 does not normally search all of the directories you specified above,
5293 namely
5294         $libpth
5295 To use no flags, specify the word "none".
5296
5297 EOH
5298
5299 rp="Any additional ld flags (NOT including libraries)?"
5300 . ./myread
5301 case "$ans" in
5302 none) ldflags='';;
5303 *) ldflags="$ans";;
5304 esac
5305 rmlist="$rmlist pdp11"
5306
5307 : coherency check
5308 echo " "
5309 echo "Checking your choice of C compiler and flags for coherency..." >&4
5310 $cat > try.c <<'EOF'
5311 #include <stdio.h>
5312 int main() { printf("Ok\n"); return(0); }
5313 EOF
5314 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5315 shift
5316 $cat >try.msg <<'EOM'
5317 I've tried to compile and run the following simple program:
5318
5319 EOM
5320 $cat try.c >> try.msg
5321
5322 $cat >> try.msg <<EOM
5323
5324 I used the command:
5325
5326         $*
5327         $run ./try
5328
5329 and I got the following output:
5330
5331 EOM
5332 dflt=y
5333 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5334         if $sh -c "$run ./try " >>try.msg 2>&1; then
5335                 xxx=`$run ./try`
5336                 case "$xxx" in
5337                 "Ok") dflt=n ;;
5338                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5339                         case " $libs " in
5340                         *" -lsfio "*)
5341                                 cat >> try.msg <<'EOQS'
5342 If $libs contains -lsfio, and sfio is mis-configured, then it
5343 sometimes (apparently) runs and exits with a 0 status, but with no
5344 output!  It may have to do with sfio's use of _exit vs. exit.
5345
5346 EOQS
5347                                 rp="You have a big problem.  Shall I abort Configure"
5348                                 dflt=y
5349                                 ;;
5350                         esac
5351                         ;;
5352                 esac
5353         else
5354                 echo "The program compiled OK, but exited with status $?." >>try.msg
5355                 rp="You have a problem.  Shall I abort Configure"
5356                 dflt=y
5357         fi
5358 else
5359         echo "I can't compile the test program." >>try.msg
5360         rp="You have a BIG problem.  Shall I abort Configure"
5361         dflt=y
5362 fi
5363 case "$dflt" in
5364 y)
5365         $cat try.msg >&4
5366         case "$knowitall" in
5367         '')
5368                 echo "(The supplied flags or libraries might be incorrect.)"
5369                 ;;
5370         *) dflt=n;;
5371         esac
5372         echo " "
5373         . ./myread
5374         case "$ans" in
5375         n*|N*) ;;
5376         *)      echo "Ok.  Stopping Configure." >&4
5377                 exit 1
5378                 ;;
5379         esac
5380         ;;
5381 n) echo "OK, that should do.";;
5382 esac
5383 $rm_try gcctest gcctest.out
5384
5385 : define a shorthand compile call
5386 compile='
5387 mc_file=$1;
5388 shift;
5389 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5390 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5391 exit 1;
5392 fi;
5393 esac;
5394 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5395 : define a shorthand compile call for compilations that should be ok.
5396 compile_ok='
5397 mc_file=$1;
5398 shift;
5399 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5400
5401 : determine filename position in cpp output
5402 echo " "
5403 echo "Computing filename position in cpp output for #include directives..." >&4
5404 case "$osname" in
5405 vos) testaccess=-e ;;
5406 *)   testaccess=-r ;;
5407 esac
5408 echo '#include <stdio.h>' > foo.c
5409 $cat >fieldn <<EOF
5410 $startsh
5411 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5412 $grep '^[       ]*#.*stdio\.h' | \
5413 while read cline; do
5414         pos=1
5415         set \$cline
5416         while $test \$# -gt 0; do
5417                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5418                         echo "\$pos"
5419                         exit 0
5420                 fi
5421                 shift
5422                 pos=\`expr \$pos + 1\`
5423         done
5424 done
5425 EOF
5426 chmod +x fieldn
5427 fieldn=`./fieldn`
5428 $rm -f foo.c fieldn
5429 case $fieldn in
5430 '') pos='???';;
5431 1) pos=first;;
5432 2) pos=second;;
5433 3) pos=third;;
5434 *) pos="${fieldn}th";;
5435 esac
5436 echo "Your cpp writes the filename in the $pos field of the line."
5437
5438 case "$osname" in
5439 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5440 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5441 *)   cppfilter='' ;;
5442 esac
5443 : locate header file
5444 $cat >findhdr <<EOF
5445 $startsh
5446 wanted=\$1
5447 name=''
5448 for usrincdir in $usrinc
5449 do
5450         if test -f \$usrincdir/\$wanted; then
5451                 echo "\$usrincdir/\$wanted"
5452                 exit 0
5453         fi
5454 done
5455 awkprg='{ print \$$fieldn }'
5456 echo "#include <\$wanted>" > foo\$\$.c
5457 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5458 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5459 while read cline; do
5460         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5461         case "\$name" in
5462         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5463         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5464         *) exit 2;;
5465         esac;
5466 done;
5467 #
5468 # status = 0: grep returned 0 lines, case statement not executed
5469 # status = 1: headerfile found
5470 # status = 2: while loop executed, no headerfile found
5471 #
5472 status=\$?
5473 $rm -f foo\$\$.c;
5474 if test \$status -eq 1; then
5475         exit 0;
5476 fi
5477 exit 1
5478 EOF
5479 chmod +x findhdr
5480
5481 : define an alternate in-header-list? function
5482 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5483 cont=true; xxf="echo \"<\$1> found.\" >&4";
5484 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5485 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5486 esac;
5487 case $# in 4) instead=instead;; *) instead="at last";; esac;
5488 while $test "$cont"; do
5489         xxx=`./findhdr $1`
5490         var=$2; eval "was=\$$2";
5491         if $test "$xxx" && $test -r "$xxx";
5492         then eval $xxf;
5493         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5494                 cont="";
5495         else eval $xxnf;
5496         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5497         set $yyy; shift; shift; yyy=$@;
5498         case $# in 0) cont="";;
5499         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5500                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5501         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5502                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5503         esac;
5504 done;
5505 while $test "$yyy";
5506 do set $yyy; var=$2; eval "was=\$$2";
5507         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5508         set $yyy; shift; shift; yyy=$@;
5509 done'
5510
5511 : see if stdlib is available
5512 set stdlib.h i_stdlib
5513 eval $inhdr
5514
5515 : check for lengths of integral types
5516 echo " "
5517 case "$intsize" in
5518 '')
5519         echo "Checking to see how big your integers are..." >&4
5520         $cat >try.c <<EOCP
5521 #include <stdio.h>
5522 #$i_stdlib I_STDLIB
5523 #ifdef I_STDLIB
5524 #include <stdlib.h>
5525 #endif
5526 int main()
5527 {
5528         printf("intsize=%d;\n", (int)sizeof(int));
5529         printf("longsize=%d;\n", (int)sizeof(long));
5530         printf("shortsize=%d;\n", (int)sizeof(short));
5531         exit(0);
5532 }
5533 EOCP
5534         set try
5535         if eval $compile_ok && $run ./try > /dev/null; then
5536                 eval `$run ./try`
5537                 echo "Your integers are $intsize bytes long."
5538                 echo "Your long integers are $longsize bytes long."
5539                 echo "Your short integers are $shortsize bytes long."
5540         else
5541                 $cat >&4 <<EOM
5542 !
5543 Help! I can't compile and run the intsize test program: please enlighten me!
5544 (This is probably a misconfiguration in your system or libraries, and
5545 you really ought to fix it.  Still, I'll try anyway.)
5546 !
5547 EOM
5548                 dflt=4
5549                 rp="What is the size of an integer (in bytes)?"
5550                 . ./myread
5551                 intsize="$ans"
5552                 dflt=$intsize
5553                 rp="What is the size of a long integer (in bytes)?"
5554                 . ./myread
5555                 longsize="$ans"
5556                 dflt=2
5557                 rp="What is the size of a short integer (in bytes)?"
5558                 . ./myread
5559                 shortsize="$ans"
5560         fi
5561         ;;
5562 esac
5563 $rm_try
5564
5565 : check for long long
5566 echo " "
5567 echo "Checking to see if you have long long..." >&4
5568 echo 'int main() { long long x = 7; return 0; }' > try.c
5569 set try
5570 if eval $compile; then
5571         val="$define"
5572         echo "You have long long."
5573 else
5574         val="$undef"
5575         echo "You do not have long long."
5576 fi
5577 $rm_try
5578 set d_longlong
5579 eval $setvar
5580
5581 : check for length of long long
5582 case "${d_longlong}${longlongsize}" in
5583 $define)
5584         echo " "
5585         echo "Checking to see how big your long longs are..." >&4
5586         $cat >try.c <<'EOCP'
5587 #include <stdio.h>
5588 int main()
5589 {
5590     printf("%d\n", (int)sizeof(long long));
5591     return(0);
5592 }
5593 EOCP
5594         set try
5595         if eval $compile_ok; then
5596                 longlongsize=`$run ./try`
5597                 echo "Your long longs are $longlongsize bytes long."
5598         else
5599                 dflt='8'
5600                 echo " "
5601                 echo "(I can't seem to compile the test program.  Guessing...)"
5602                 rp="What is the size of a long long (in bytes)?"
5603                 . ./myread
5604                 longlongsize="$ans"
5605         fi
5606         if $test "X$longsize" = "X$longlongsize"; then
5607                 echo "(That isn't any different from an ordinary long.)"
5608         fi
5609         ;;
5610 esac
5611 $rm_try
5612
5613 : see if inttypes.h is available
5614 : we want a real compile instead of Inhdr because some systems
5615 : have an inttypes.h which includes non-existent headers
5616 echo " "
5617 $cat >try.c <<EOCP
5618 #include <inttypes.h>
5619 int main() {
5620         static int32_t foo32 = 0x12345678;
5621 }
5622 EOCP
5623 set try
5624 if eval $compile; then
5625         echo "<inttypes.h> found." >&4
5626         val="$define"
5627 else
5628         echo "<inttypes.h> NOT found." >&4
5629         val="$undef"
5630 fi
5631 $rm_try
5632 set i_inttypes
5633 eval $setvar
5634
5635 : check for int64_t
5636 echo " "
5637 echo "Checking to see if you have int64_t..." >&4
5638 $cat >try.c <<EOCP
5639 #include <sys/types.h>
5640 #$i_inttypes I_INTTYPES
5641 #ifdef I_INTTYPES
5642 #include <inttypes.h>
5643 #endif
5644 int main() { int64_t x = 7; }
5645 EOCP
5646 set try
5647 if eval $compile; then
5648         val="$define"
5649         echo "You have int64_t."
5650 else
5651         val="$undef"
5652         echo "You do not have int64_t."
5653 fi
5654 $rm_try
5655 set d_int64_t
5656 eval $setvar
5657
5658 : Check if 64bit ints have a quad type
5659 echo " "
5660 echo "Checking which 64-bit integer type we could use..." >&4
5661
5662 case "$intsize" in
5663 8) val=int
5664    set quadtype
5665    eval $setvar
5666    val='"unsigned int"'
5667    set uquadtype
5668    eval $setvar
5669    quadkind=1
5670    ;;
5671 *) case "$longsize" in
5672    8) val=long
5673       set quadtype
5674       eval $setvar
5675       val='"unsigned long"'
5676       set uquadtype
5677       eval $setvar
5678       quadkind=2
5679       ;;
5680    *) case "$d_longlong:$longlongsize" in
5681       define:8)
5682         val='"long long"'
5683         set quadtype
5684         eval $setvar
5685         val='"unsigned long long"'
5686         set uquadtype
5687         eval $setvar
5688         quadkind=3
5689         ;;
5690       *) case "$d_int64_t" in
5691          define)
5692            val=int64_t
5693            set quadtype
5694            eval $setvar
5695            val=uint64_t
5696            set uquadtype
5697            eval $setvar
5698            quadkind=4
5699            ;;
5700          esac
5701          ;;
5702       esac
5703       ;;
5704    esac
5705    ;;
5706 esac
5707
5708 case "$quadtype" in
5709 '')     echo "Alas, no 64-bit integer types in sight." >&4
5710         d_quad="$undef"
5711         ;;
5712 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5713         d_quad="$define"
5714         ;;
5715 esac
5716
5717 : Do we want 64bit support
5718 case "$uselonglong" in
5719 "$define"|true|[yY]*)
5720         cat <<EOM >&4
5721
5722 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5723 EOM
5724         use64bitint="$define"
5725         ;;
5726 esac
5727 case "$use64bits" in
5728 "$define"|true|[yY]*)
5729         cat <<EOM >&4
5730
5731 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5732 EOM
5733         use64bitint="$define"
5734         ;;
5735 esac
5736 case "$use64bitints" in
5737 "$define"|true|[yY]*)
5738         cat <<EOM >&4
5739
5740 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5741 EOM
5742         use64bitint="$define"
5743         ;;
5744 esac
5745 case "$use64bitsint" in
5746 "$define"|true|[yY]*)
5747         cat <<EOM >&4
5748
5749 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5750 EOM
5751         use64bitint="$define"
5752         ;;
5753 esac
5754 case "$uselonglongs" in
5755 "$define"|true|[yY]*)
5756         cat <<EOM >&4
5757
5758 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5759 EOM
5760         use64bitint="$define"
5761         ;;
5762 esac
5763 case "$use64bitsall" in
5764 "$define"|true|[yY]*)
5765         cat <<EOM >&4
5766
5767 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5768 EOM
5769         use64bitall="$define"
5770         ;;
5771 esac
5772
5773 case "$ccflags" in
5774 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5775 esac
5776 case "$use64bitall" in
5777 "$define"|true|[yY]*) use64bitint="$define" ;;
5778 esac
5779
5780 case "$longsize" in
5781 8) cat <<EOM
5782
5783 You have natively 64-bit long integers.
5784 EOM
5785    val="$define"
5786    ;;
5787 *) case "$use64bitint" in
5788    "$define"|true|[yY]*) dflt='y';;
5789    *) dflt='n';;
5790    esac
5791    case "$d_quad" in
5792    "$define") ;;
5793    *) dflt='n' ;;
5794    esac
5795    cat <<EOM
5796
5797 Perl can be built to take advantage of 64-bit integer types
5798 on some systems.  To do so, Configure can be run with -Duse64bitint.
5799 Choosing this option will most probably introduce binary incompatibilities.
5800
5801 If this doesn't make any sense to you, just accept the default '$dflt'.
5802 (The default has been chosen based on your configuration.)
5803 EOM
5804    rp='Try to use 64-bit integers, if available?'
5805    . ./myread
5806    case "$ans" in
5807    [yY]*) val="$define" ;;
5808    *)     val="$undef"  ;;
5809    esac
5810    ;;
5811 esac
5812 set use64bitint
5813 eval $setvar
5814
5815 case "$use64bitall" in
5816 "$define"|true|[yY]*) dflt='y' ;;
5817 *) case "$longsize" in
5818    8) dflt='y' ;;
5819    *) dflt='n' ;;
5820    esac
5821    ;;
5822 esac
5823 cat <<EOM
5824
5825 You may also choose to try maximal 64-bitness.  It means using as much
5826 64-bitness as possible on the platform.  This in turn means even more
5827 binary incompatibilities.  On the other hand, your platform may not
5828 have any more 64-bitness available than what you already have chosen.
5829
5830 If this doesn't make any sense to you, just accept the default '$dflt'.
5831 (The default has been chosen based on your configuration.)
5832 EOM
5833 rp='Try to use maximal 64-bit support, if available?'
5834 . ./myread
5835 case "$ans" in
5836 [yY]*) val="$define" ;;
5837 *)     val="$undef"  ;;
5838 esac
5839 set use64bitall
5840 eval $setvar
5841 case "$use64bitall" in
5842 "$define")
5843         case "$use64bitint" in
5844         "$undef")
5845                 cat <<EOM
5846
5847 Since you have chosen a maximally 64-bit build, I'm also turning on
5848 the use of 64-bit integers.
5849 EOM
5850                 use64bitint="$define" ;;
5851         esac
5852         ;;
5853 esac
5854
5855 : Look for a hint-file generated 'call-back-unit'.  If the
5856 : user has specified that a 64-bit perl is to be built,
5857 : we may need to set or change some other defaults.
5858 if $test -f use64bitint.cbu; then
5859         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5860         . ./use64bitint.cbu
5861 fi
5862 case "$use64bitint" in
5863 "$define"|true|[yY]*)
5864         case "$longsize" in
5865         4) case "$archname64" in
5866            '') archname64=64int ;;
5867            esac
5868            ;;
5869         esac
5870         ;;
5871 esac
5872
5873 : Look for a hint-file generated 'call-back-unit'.  If the
5874 : user has specified that a maximally 64-bit perl is to be built,
5875 : we may need to set or change some other defaults.
5876 if $test -f use64bitall.cbu; then
5877         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5878         . ./use64bitall.cbu
5879 fi
5880 case "$use64bitall" in
5881 "$define"|true|[yY]*)
5882         case "$longsize" in
5883         4) case "$archname64" in
5884            ''|64int) archname64=64all ;;
5885            esac
5886            ;;
5887         esac
5888         ;;
5889 esac
5890
5891 case "$d_quad:$use64bitint" in
5892 $undef:$define)
5893         cat >&4 <<EOF
5894
5895 *** You have chosen to use 64-bit integers,
5896 *** but none can be found.
5897 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5898 *** Cannot continue, aborting.
5899
5900 EOF
5901         exit 1
5902         ;;
5903 esac
5904
5905 : check for length of double
5906 echo " "
5907 case "$doublesize" in
5908 '')
5909         echo "Checking to see how big your double precision numbers are..." >&4
5910         $cat >try.c <<EOCP
5911 #include <stdio.h>
5912 #$i_stdlib I_STDLIB
5913 #ifdef I_STDLIB
5914 #include <stdlib.h>
5915 #endif
5916 int main()
5917 {
5918     printf("%d\n", (int)sizeof(double));
5919     exit(0);
5920 }
5921 EOCP
5922         set try
5923         if eval $compile_ok; then
5924                 doublesize=`$run ./try`
5925                 echo "Your double is $doublesize bytes long."
5926         else
5927                 dflt='8'
5928                 echo "(I can't seem to compile the test program.  Guessing...)"
5929                 rp="What is the size of a double precision number (in bytes)?"
5930                 . ./myread
5931                 doublesize="$ans"
5932         fi
5933         ;;
5934 esac
5935 $rm_try
5936
5937 : check for long doubles
5938 echo " "
5939 echo "Checking to see if you have long double..." >&4
5940 echo 'int main() { long double x = 7.0; }' > try.c
5941 set try
5942 if eval $compile; then
5943         val="$define"
5944         echo "You have long double."
5945 else
5946         val="$undef"
5947         echo "You do not have long double."
5948 fi
5949 $rm_try
5950 set d_longdbl
5951 eval $setvar
5952
5953 : check for length of long double
5954 case "${d_longdbl}${longdblsize}" in
5955 $define)
5956         echo " "
5957         echo "Checking to see how big your long doubles are..." >&4
5958         $cat >try.c <<'EOCP'
5959 #include <stdio.h>
5960 int main()
5961 {
5962         printf("%d\n", sizeof(long double));
5963 }
5964 EOCP
5965         set try
5966         set try
5967         if eval $compile; then
5968                 longdblsize=`$run ./try`
5969                 echo "Your long doubles are $longdblsize bytes long."
5970         else
5971                 dflt='8'
5972                 echo " "
5973                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5974                 rp="What is the size of a long double (in bytes)?"
5975                 . ./myread
5976                 longdblsize="$ans"
5977         fi
5978         if $test "X$doublesize" = "X$longdblsize"; then
5979                 echo "That isn't any different from an ordinary double."
5980                 echo "I'll keep your setting anyway, but you may see some"
5981                 echo "harmless compilation warnings."
5982         fi
5983         ;;
5984 esac
5985 $rm_try
5986
5987 : determine the architecture name
5988 echo " "
5989 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5990         tarch=`arch`"-$osname"
5991 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5992         if uname -m > tmparch 2>&1 ; then
5993                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5994                         -e 's/$/'"-$osname/" tmparch`
5995         else
5996                 tarch="$osname"
5997         fi
5998         $rm -f tmparch
5999 else
6000         tarch="$osname"
6001 fi
6002 case "$myarchname" in
6003 ''|"$tarch") ;;
6004 *)
6005         echo "(Your architecture name used to be $myarchname.)"
6006         archname=''
6007         ;;
6008 esac
6009 case "$targetarch" in
6010 '') ;;
6011 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6012 esac
6013 myarchname="$tarch"
6014 case "$archname" in
6015 '') dflt="$tarch";;
6016 *) dflt="$archname";;
6017 esac
6018 rp='What is your architecture name'
6019 . ./myread
6020 archname="$ans"
6021 case "$usethreads" in
6022 $define)
6023         echo "Threads selected." >&4
6024         case "$archname" in
6025         *-thread*) echo "...and architecture name already has -thread." >&4
6026                 ;;
6027         *)      archname="$archname-thread"
6028                 echo "...setting architecture name to $archname." >&4
6029                 ;;
6030         esac
6031         ;;
6032 esac
6033 case "$usemultiplicity" in
6034 $define)
6035         echo "Multiplicity selected." >&4
6036         case "$archname" in
6037         *-multi*) echo "...and architecture name already has -multi." >&4
6038                 ;;
6039         *)      archname="$archname-multi"
6040                 echo "...setting architecture name to $archname." >&4
6041                 ;;
6042         esac
6043         ;;
6044 esac
6045 case "$use64bitint$use64bitall" in
6046 *"$define"*)
6047         case "$archname64" in
6048         '')
6049                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6050                 ;;
6051         *)
6052                 case "$use64bitint" in
6053                 "$define") echo "64 bit integers selected." >&4 ;;
6054                 esac
6055                 case "$use64bitall" in
6056                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6057                 esac
6058                 case "$archname" in
6059                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6060                         ;;
6061                 *)      archname="$archname-$archname64"
6062                         echo "...setting architecture name to $archname." >&4
6063                         ;;
6064                 esac
6065                 ;;
6066         esac
6067 esac
6068 case "$uselongdouble" in
6069 $define)
6070         echo "Long doubles selected." >&4
6071         case "$longdblsize" in
6072         $doublesize)
6073                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6074                 ;;
6075         *)
6076                 case "$archname" in
6077                 *-ld*) echo "...and architecture name already has -ld." >&4
6078                         ;;
6079                 *)      archname="$archname-ld"
6080                         echo "...setting architecture name to $archname." >&4
6081                         ;;
6082                 esac
6083                 ;;
6084         esac
6085         ;;
6086 esac
6087 case "$useperlio" in
6088 $define)
6089         echo "Perlio selected." >&4
6090         ;;
6091 *)
6092         echo "Perlio not selected, using stdio." >&4
6093         case "$archname" in
6094         *-stdio*) echo "...and architecture name already has -stdio." >&4
6095                 ;;
6096         *)      archname="$archname-stdio"
6097                 echo "...setting architecture name to $archname." >&4
6098                 ;;
6099         esac
6100         ;;
6101 esac
6102 if $test -f archname.cbu; then
6103         echo "Your platform has some specific hints for architecture name, using them..."
6104         . ./archname.cbu
6105 fi
6106
6107 : set the prefixit variable, to compute a suitable default value
6108 prefixit='case "$3" in
6109 ""|none)
6110         case "$oldprefix" in
6111         "") eval "$1=\"\$$2\"";;
6112         *)
6113                 case "$3" in
6114                 "") eval "$1=";;
6115                 none)
6116                         eval "tp=\"\$$2\"";
6117                         case "$tp" in
6118                         ""|" ") eval "$1=\"\$$2\"";;
6119                         *) eval "$1=";;
6120                         esac;;
6121                 esac;;
6122         esac;;
6123 *)
6124         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6125         case "$tp" in
6126         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6127         /*-$oldprefix/*|\~*-$oldprefix/*)
6128                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6129         *) eval "$1=\"\$$2\"";;
6130         esac;;
6131 esac'
6132
6133 : determine installation style
6134 : For now, try to deduce it from prefix unless it is already set.
6135 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6136 case "$installstyle" in
6137 '')     case "$prefix" in
6138                 *perl*) dflt='lib';;
6139                 *) dflt='lib/perl5' ;;
6140         esac
6141         ;;
6142 *)      dflt="$installstyle" ;;
6143 esac
6144 : Probably not worth prompting for this since we prompt for all
6145 : the directories individually, and the prompt would be too long and
6146 : confusing anyway.
6147 installstyle=$dflt
6148
6149 : determine where public executables go
6150 echo " "
6151 set dflt bin bin
6152 eval $prefixit
6153 fn=d~
6154 rp='Pathname where the public executables will reside?'
6155 . ./getfile
6156 if $test "X$ansexp" != "X$binexp"; then
6157         installbin=''
6158 fi
6159 prefixvar=bin
6160 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6161 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6162 :     this via initialinstalllocation
6163 . ./setprefixvar
6164
6165 case "$userelocatableinc" in
6166 $define|true|[yY]*)     dflt='y' ;;
6167 *)                      dflt='n' ;;
6168 esac
6169 cat <<EOM
6170
6171 Would you like to build Perl so that the installation is relocatable, so that
6172 library paths in @INC are determined relative to the path of the perl binary?
6173 This is not advised for system Perl installs, or if you need to run setid
6174 scripts or scripts under taint mode.
6175
6176 If this doesn't make any sense to you, just accept the default '$dflt'.
6177 EOM
6178 rp='Use relocatable @INC?'
6179 . ./myread
6180 case "$ans" in
6181 y|Y)    val="$define" ;;
6182 *)      val="$undef"  ;;
6183 esac
6184 set userelocatableinc
6185 eval $setvar
6186
6187 initialinstalllocation="$binexp"
6188 : Default prefix is now "up one level from where the binaries are"
6189 case "$userelocatableinc" in
6190 $define|true|[yY]*)
6191     bin=".../"
6192     binexp=".../"
6193     prefix=".../.."
6194     prefixexp=".../.."
6195     installprefixexp=".../.."
6196     ;;
6197 esac
6198
6199 : determine where private library files go
6200 : Usual default is /usr/local/lib/perl5/$version.
6201 : Also allow things like /opt/perl/lib/$version, since
6202 : /opt/perl/lib/perl5... would be redundant.
6203 : The default "style" setting is made in installstyle.U
6204 case "$installstyle" in
6205 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6206 *)       set dflt privlib lib/$version ;;
6207 esac
6208 eval $prefixit
6209 $cat <<EOM
6210
6211 There are some auxiliary files for $package that need to be put into a
6212 private library directory that is accessible by everyone.
6213
6214 EOM
6215 fn=$binexp
6216 fn=d~+
6217 rp='Pathname where the private library files will reside?'
6218 . ./getfile
6219 prefixvar=privlib
6220 . ./setprefixvar
6221
6222 : set the prefixup variable, to restore leading tilda escape
6223 prefixup='case "$prefixexp" in
6224 "$prefix") ;;
6225 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6226 esac'
6227
6228 : determine where public architecture dependent libraries go
6229 set archlib archlib
6230 eval $prefixit
6231 : privlib default is /usr/local/lib/$package/$version
6232 : archlib default is /usr/local/lib/$package/$version/$archname
6233 : privlib may have an optional trailing /share.
6234 tdflt=`echo $privlib | $sed 's,/share$,,'`
6235 tdflt=$tdflt/$archname
6236 case "$archlib" in
6237 '')     dflt=$tdflt
6238         ;;
6239 *)      dflt="$archlib"
6240     ;;
6241 esac
6242 $cat <<EOM
6243
6244 $spackage contains architecture-dependent library files.  If you are
6245 sharing libraries in a heterogeneous environment, you might store
6246 these files in a separate location.  Otherwise, you can just include
6247 them with the rest of the public library files.
6248
6249 EOM
6250 fn=$binexp
6251 fn=d+~
6252 rp='Where do you want to put the public architecture-dependent libraries?'
6253 . ./getfile
6254 prefixvar=archlib
6255 . ./setprefixvar
6256 if $test X"$archlib" = X"$privlib"; then
6257         d_archlib="$undef"
6258 else
6259         d_archlib="$define"
6260 fi
6261
6262 : see if setuid scripts can be secure
6263 $cat <<EOM
6264
6265 Some kernels have a bug that prevents setuid #! scripts from being
6266 secure.  Some sites have disabled setuid #! scripts because of this.
6267
6268 First let's decide if your kernel supports secure setuid #! scripts.
6269 (If setuid #! scripts would be secure but have been disabled anyway,
6270 don't say that they are secure if asked.)
6271
6272 EOM
6273
6274 val="$undef"
6275 if $test -d /dev/fd; then
6276         echo "#!$ls" >reflect
6277         chmod +x,u+s reflect
6278         ./reflect >flect 2>&1
6279         if $contains "/dev/fd" flect >/dev/null; then
6280                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6281                 val="$define"
6282         else
6283                 $cat <<EOM
6284 If you are not sure if they are secure, I can check but I'll need a
6285 username and password different from the one you are using right now.
6286 If you don't have such a username or don't want me to test, simply
6287 enter 'none'.
6288
6289 EOM
6290                 rp='Other username to test security of setuid scripts with?'
6291                 dflt='none'
6292                 . ./myread
6293                 case "$ans" in
6294                 n|none)
6295                         case "$d_suidsafe" in
6296                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6297                                 dflt=n;;
6298                         "$undef")
6299                                 echo "Well, the $hint value is *not* secure." >&4
6300                                 dflt=n;;
6301                         *)      echo "Well, the $hint value *is* secure." >&4
6302                                 dflt=y;;
6303                         esac
6304                         ;;
6305                 *)
6306                         $rm -f reflect flect
6307                         echo "#!$ls" >reflect
6308                         chmod +x,u+s reflect
6309                         echo >flect
6310                         chmod a+w flect
6311                         echo '"su" will (probably) prompt you for '"$ans's password."
6312                         su $ans -c './reflect >flect'
6313                         if $contains "/dev/fd" flect >/dev/null; then
6314                                 echo "Okay, it looks like setuid scripts are secure." >&4
6315                                 dflt=y
6316                         else
6317                                 echo "I don't think setuid scripts are secure." >&4
6318                                 dflt=n
6319                         fi
6320                         ;;
6321                 esac
6322                 rp='Does your kernel have *secure* setuid scripts?'
6323                 . ./myread
6324                 case "$ans" in
6325                 [yY]*)  val="$define";;
6326                 *)      val="$undef";;
6327                 esac
6328         fi
6329 else
6330         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6331         echo "(That's for file descriptors, not floppy disks.)"
6332         val="$undef"
6333 fi
6334 set d_suidsafe
6335 eval $setvar
6336
6337 $rm -f reflect flect
6338
6339 : now see if they want to do setuid emulation
6340 echo " "
6341 val="$undef"
6342 case "$d_suidsafe" in
6343 "$define")
6344         val="$undef"
6345         echo "No need to emulate SUID scripts since they are secure here." >&4
6346         ;;
6347 *)
6348         $cat <<EOM
6349 Some systems have disabled setuid scripts, especially systems where
6350 setuid scripts cannot be secure.  On systems where setuid scripts have
6351 been disabled, the setuid/setgid bits on scripts are currently
6352 useless.  It is possible for $package to detect those bits and emulate
6353 setuid/setgid in a secure fashion.  This emulation will only work if
6354 setuid scripts have been disabled in your kernel.
6355
6356 EOM
6357         case "$d_dosuid" in
6358         "$define") dflt=y ;;
6359         *) dflt=n ;;
6360         esac
6361         rp="Do you want to do setuid/setgid emulation?"
6362         . ./myread
6363         case "$ans" in
6364         [yY]*)  val="$define";;
6365         *)      val="$undef";;
6366         esac
6367         ;;
6368 esac
6369 set d_dosuid
6370 eval $setvar
6371
6372 : Find perl5.005 or later.
6373 echo "Looking for a previously installed perl5.005 or later... "
6374 case "$perl5" in
6375 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6376                 : Check if this perl is recent and can load a simple module
6377                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6378                         perl5=$tdir/perl
6379                         break;
6380                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6381                         perl5=$tdir/perl5
6382                         break;
6383                 fi
6384         done
6385         ;;
6386 *)      perl5="$perl5"
6387         ;;
6388 esac
6389 case "$perl5" in
6390 '')     echo "None found.  That's ok.";;
6391 *)      echo "Using $perl5." ;;
6392 esac
6393
6394 : Set the siteprefix variables
6395 $cat <<EOM
6396
6397 After $package is installed, you may wish to install various
6398 add-on modules and utilities.  Typically, these add-ons will
6399 be installed under $prefix with the rest
6400 of this package.  However, you may wish to install such add-ons
6401 elsewhere under a different prefix.
6402
6403 If you do not wish to put everything under a single prefix, that's
6404 ok.  You will be prompted for the individual locations; this siteprefix
6405 is only used to suggest the defaults.
6406
6407 The default should be fine for most people.
6408
6409 EOM
6410 fn=d~+
6411 rp='Installation prefix to use for add-on modules and utilities?'
6412 : XXX Here might be another good place for an installstyle setting.
6413 case "$siteprefix" in
6414 '') dflt=$prefix ;;
6415 *)  dflt=$siteprefix ;;
6416 esac
6417 . ./getfile
6418 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6419 oldsiteprefix=''
6420 case "$siteprefix" in
6421 '') ;;
6422 *)      case "$ans" in
6423         "$prefix") ;;
6424         *) oldsiteprefix="$prefix";;
6425         esac
6426         ;;
6427 esac
6428 siteprefix="$ans"
6429 siteprefixexp="$ansexp"
6430
6431 : determine where site specific libraries go.
6432 : Usual default is /usr/local/lib/perl5/site_perl/$version
6433 : The default "style" setting is made in installstyle.U
6434 : XXX No longer works with Prefixit stuff.
6435 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6436 case "$sitelib" in
6437 '') case "$installstyle" in
6438         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6439         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6440         esac
6441         ;;
6442 *)      dflt="$sitelib"
6443         ;;
6444 esac
6445 $cat <<EOM
6446
6447 The installation process will create a directory for
6448 site-specific extensions and modules.  Most users find it convenient
6449 to place all site-specific files in this directory rather than in the
6450 main distribution directory.
6451
6452 EOM
6453 fn=d~+
6454 rp='Pathname for the site-specific library files?'
6455 . ./getfile
6456 prefixvar=sitelib
6457 . ./setprefixvar
6458 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6459
6460 : Determine list of previous versions to include in @INC
6461 $cat > getverlist <<EOPL
6462 #!$perl5 -w
6463 use File::Basename;
6464 \$api_versionstring = "$api_versionstring";
6465 \$version = "$version";
6466 \$stem = "$sitelib_stem";
6467 \$archname = "$archname";
6468 EOPL
6469         $cat >> getverlist <<'EOPL'
6470 # The list found is store twice for each entry: the original name, and
6471 # the binary broken down version as pack "sss", so sorting is easy and
6472 # unambiguous. This will work for all versions that have a maximum of
6473 # three digit groups, separate by '.'s or '_'s. Names are extended with
6474 # ".0.0" to ensure at least three elements for the pack.
6475 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6476
6477 # Can't have leading @ because metaconfig interprets it as a command!
6478 ;@inc_version_list=();
6479 # XXX Redo to do opendir/readdir?
6480 if (-d $stem) {
6481     chdir($stem);
6482     ;@candidates = map {
6483         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6484 }
6485 else {
6486     ;@candidates = ();
6487 }
6488
6489 ($pversion, $aversion, $vsn5005) = map {
6490     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6491 foreach $d (@candidates) {
6492     if ($d->[1] lt $pversion) {
6493         if ($d->[1] ge $aversion) {
6494             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6495         }
6496         elsif ($d->[1] ge $vsn5005) {
6497             unshift(@inc_version_list, grep { -d } $d->[0]);
6498         }
6499     }
6500     else {
6501         # Skip newer version.  I.e. don't look in
6502         # 5.7.0 if we're installing 5.6.1.
6503     }
6504 }
6505
6506 if (@inc_version_list) {
6507     print join(' ', @inc_version_list);
6508 }
6509 else {
6510     # Blank space to preserve value for next Configure run.
6511     print " ";
6512 }
6513 EOPL
6514 chmod +x getverlist
6515 case "$inc_version_list" in
6516 '')     if test -x "$perl5$exe_ext"; then
6517                 dflt=`$perl5 getverlist`
6518         else
6519                 dflt='none'
6520         fi
6521         ;;
6522 $undef) dflt='none' ;;
6523 *)  eval dflt=\"$inc_version_list\" ;;
6524 esac
6525 case "$dflt" in
6526 ''|' ') dflt=none ;;
6527 esac
6528 case "$dflt" in
6529 5.005) dflt=none ;;
6530 esac
6531 $cat <<EOM
6532
6533 In order to ease the process of upgrading, this version of perl
6534 can be configured to use modules built and installed with earlier
6535 versions of perl that were installed under $prefix.  Specify here
6536 the list of earlier versions that this version of perl should check.
6537 If Configure detected no earlier versions of perl installed under
6538 $prefix, then the list will be empty.  Answer 'none' to tell perl
6539 to not search earlier versions.
6540
6541 The default should almost always be sensible, so if you're not sure,
6542 just accept the default.
6543 EOM
6544
6545 rp='List of earlier versions to include in @INC?'
6546 . ./myread
6547 case "$ans" in
6548 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6549 *) inc_version_list="$ans" ;;
6550 esac
6551 case "$inc_version_list" in
6552 ''|' ')
6553         inc_version_list_init='0'
6554         d_inc_version_list="$undef"
6555         ;;
6556 *)      inc_version_list_init=`echo $inc_version_list |
6557                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6558         d_inc_version_list="$define"
6559         ;;
6560 esac
6561 $rm -f getverlist
6562
6563 : see if malloc/malloc.h has to be included
6564 set malloc/malloc.h i_mallocmalloc
6565 eval $inhdr
6566
6567 : see if this is a malloc.h system
6568 : we want a real compile instead of Inhdr because some systems have a
6569 : malloc.h that just gives a compile error saying to use stdlib.h instead
6570 echo " "
6571 $cat >try.c <<EOCP
6572 #include <stdlib.h>
6573 #include <malloc.h>
6574 #$i_mallocmalloc I_MALLOCMALLOC
6575 #ifdef I_MALLOCMALLOC
6576 # include <malloc/malloc.h>
6577 #endif
6578
6579 int main () { return 0; }
6580 EOCP
6581 set try
6582 if eval $compile; then
6583     echo "<malloc.h> found." >&4
6584     val="$define"
6585 else
6586     echo "<malloc.h> NOT found." >&4
6587     val="$undef"
6588 fi
6589 $rm_try
6590 set i_malloc
6591 eval $setvar
6592
6593 : check for void type
6594 echo " "
6595 echo "Checking to see how well your C compiler groks the void type..." >&4
6596 case "$voidflags" in
6597 '')
6598         $cat >try.c <<EOCP
6599 #$i_stdlib I_STDLIB
6600 #ifdef I_STDLIB
6601 #include <stdlib.h>
6602 #endif
6603 #if TRY & 1
6604 void sub() {
6605 #else
6606 sub() {
6607 #endif
6608         extern void moo();      /* function returning void */
6609         void (*goo)();          /* ptr to func returning void */
6610 #if TRY & 8
6611         void *hue;              /* generic ptr */
6612 #endif
6613 #if TRY & 2
6614         void (*foo[10])();
6615 #endif
6616
6617 #if TRY & 4
6618         if(goo == moo) {
6619                 exit(0);
6620         }
6621 #endif
6622         exit(0);
6623 }
6624 int main() { sub(); }
6625 EOCP
6626         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6627                 voidflags=$defvoidused
6628         echo "Good.  It appears to support void to the level $package wants.">&4
6629                 if $contains warning .out >/dev/null 2>&1; then
6630                         echo "However, you might get some warnings that look like this:"
6631                         $cat .out
6632                 fi
6633         else
6634 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6635                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6636                         echo "It supports 1..."
6637                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6638                                 echo "It also supports 2..."
6639                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6640                                         voidflags=7
6641                                         echo "And it supports 4 but not 8 definitely."
6642                                 else
6643                                         echo "It doesn't support 4..."
6644                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6645                                                 voidflags=11
6646                                                 echo "But it supports 8."
6647                                         else
6648                                                 voidflags=3
6649                                                 echo "Neither does it support 8."
6650                                         fi
6651                                 fi
6652                         else
6653                                 echo "It does not support 2..."
6654                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6655                                         voidflags=13
6656                                         echo "But it supports 4 and 8."
6657                                 else
6658                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6659                                                 voidflags=5
6660                                                 echo "And it supports 4 but has not heard about 8."
6661                                         else
6662                                                 echo "However it supports 8 but not 4."
6663                                         fi
6664                                 fi
6665                         fi
6666                 else
6667                         echo "There is no support at all for void."
6668                         voidflags=0
6669                 fi
6670         fi
6671 esac
6672 case "$voidflags" in
6673 "$defvoidused") ;;
6674 *)      $cat >&4 <<'EOM'
6675   Support flag bits are:
6676     1: basic void declarations.
6677     2: arrays of pointers to functions returning void.
6678     4: operations between pointers to and addresses of void functions.
6679     8: generic void pointers.
6680 EOM
6681         dflt="$voidflags";
6682         rp="Your void support flags add up to what?"
6683         . ./myread
6684         voidflags="$ans"
6685         ;;
6686 esac
6687 $rm_try
6688
6689 : check for length of pointer
6690 echo " "
6691 case "$ptrsize" in
6692 '')
6693         echo "Checking to see how big your pointers are..." >&4
6694         if test "$voidflags" -gt 7; then
6695                 echo '#define VOID_PTR char *' > try.c
6696         else
6697                 echo '#define VOID_PTR void *' > try.c
6698         fi
6699         $cat >>try.c <<EOCP
6700 #include <stdio.h>
6701 #$i_stdlib I_STDLIB
6702 #ifdef I_STDLIB
6703 #include <stdlib.h>
6704 #endif
6705 int main()
6706 {
6707     printf("%d\n", (int)sizeof(VOID_PTR));
6708     exit(0);
6709 }
6710 EOCP
6711         set try
6712         if eval $compile_ok; then
6713                 ptrsize=`$run ./try`
6714                 echo "Your pointers are $ptrsize bytes long."
6715         else
6716                 dflt='4'
6717                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6718                 rp="What is the size of a pointer (in bytes)?"
6719                 . ./myread
6720                 ptrsize="$ans"
6721         fi
6722         ;;
6723 esac
6724 $rm_try
6725 case "$use64bitall" in
6726 "$define"|true|[yY]*)
6727         case "$ptrsize" in
6728         4)      cat <<EOM >&4
6729
6730 *** You have chosen a maximally 64-bit build,
6731 *** but your pointers are only 4 bytes wide.
6732 *** Please rerun Configure without -Duse64bitall.
6733 EOM
6734                 case "$d_quad" in
6735                 define)
6736                         cat <<EOM >&4
6737 *** Since you have quads, you could possibly try with -Duse64bitint.
6738 EOM
6739                         ;;
6740                 esac
6741                 cat <<EOM >&4
6742 *** Cannot continue, aborting.
6743
6744 EOM
6745
6746                 exit 1
6747                 ;;
6748         esac
6749         ;;
6750 esac
6751
6752
6753 : determine whether to use malloc wrapping
6754 echo " "
6755 case "$usemallocwrap" in
6756 [yY]*|true|$define)     dflt='y' ;;
6757 [nN]*|false|$undef)     dflt='n' ;;
6758 *)      case "$usedevel" in
6759         [yY]*|true|$define)     dflt='y' ;;
6760         *) dflt='n' ;;
6761         esac
6762         ;;
6763 esac
6764 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6765 . ./myread
6766 usemallocwrap="$ans"
6767 case "$ans" in
6768 y*|true)
6769         usemallocwrap="$define" ;;
6770 *)
6771         usemallocwrap="$undef" ;;
6772 esac
6773
6774 : determine which malloc to compile in
6775 echo " "
6776 case "$usemymalloc" in
6777 [yY]*|true|$define)     dflt='y' ;;
6778 [nN]*|false|$undef)     dflt='n' ;;
6779 *)      case "$ptrsize" in
6780         4) dflt='y' ;;
6781         *) dflt='n' ;;
6782         esac
6783         ;;
6784 esac
6785 rp="Do you wish to attempt to use the malloc that comes with $package?"
6786 . ./myread
6787 usemymalloc="$ans"
6788 case "$ans" in
6789 y*|true)
6790         usemymalloc='y'
6791         mallocsrc='malloc.c'
6792         mallocobj="malloc$_o"
6793         d_mymalloc="$define"
6794         case "$libs" in
6795         *-lmalloc*)
6796                 : Remove malloc from list of libraries to use
6797                 echo "Removing unneeded -lmalloc from library list" >&4
6798                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6799                 shift
6800                 libs="$*"
6801                 echo "libs = $libs" >&4
6802                 ;;
6803         esac
6804         ;;
6805 *)
6806         usemymalloc='n'
6807         mallocsrc=''
6808         mallocobj=''
6809         d_mymalloc="$undef"
6810         ;;
6811 esac
6812
6813 : compute the return types of malloc and free
6814 echo " "
6815 $cat >malloc.c <<END
6816 #$i_malloc I_MALLOC
6817 #$i_stdlib I_STDLIB
6818 #include <stdio.h>
6819 #include <sys/types.h>
6820 #ifdef I_MALLOC
6821 #include <malloc.h>
6822 #endif
6823 #ifdef I_STDLIB
6824 #include <stdlib.h>
6825 #endif
6826 #ifdef TRY_MALLOC
6827 void *malloc();
6828 #endif
6829 #ifdef TRY_FREE
6830 void free();
6831 #endif
6832 END
6833 case "$malloctype" in
6834 '')
6835         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6836                 malloctype='void *'
6837         else
6838                 malloctype='char *'
6839         fi
6840         ;;
6841 esac
6842 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6843
6844 case "$freetype" in
6845 '')
6846         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6847                 freetype='void'
6848         else
6849                 freetype='int'
6850         fi
6851         ;;
6852 esac
6853 echo "Your system uses $freetype free(), it would seem." >&4
6854 $rm -f malloc.[co]
6855 : determine where site specific architecture-dependent libraries go.
6856 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6857 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6858 : sitelib may have an optional trailing /share.
6859 case "$sitearch" in
6860 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6861         dflt="$dflt/$archname"
6862         ;;
6863 *)      dflt="$sitearch"
6864         ;;
6865 esac
6866 set sitearch sitearch none
6867 eval $prefixit
6868 $cat <<EOM
6869
6870 The installation process will also create a directory for
6871 architecture-dependent site-specific extensions and modules.
6872
6873 EOM
6874 fn=d~+
6875 rp='Pathname for the site-specific architecture-dependent library files?'
6876 . ./getfile
6877 prefixvar=sitearch
6878 . ./setprefixvar
6879 if $test X"$sitearch" = X"$sitelib"; then
6880         d_sitearch="$undef"
6881 else
6882         d_sitearch="$define"
6883 fi
6884
6885 : Set the vendorprefix variables
6886 $cat <<EOM
6887
6888 The installation process will also create a directory for
6889 vendor-supplied add-ons.  Vendors who supply perl with their system
6890 may find it convenient to place all vendor-supplied files in this
6891 directory rather than in the main distribution directory.  This will
6892 ease upgrades between binary-compatible maintenance versions of perl.
6893
6894 Of course you may also use these directories in whatever way you see
6895 fit.  For example, you might use them to access modules shared over a
6896 company-wide network.
6897
6898 The default answer should be fine for most people.
6899 This causes further questions about vendor add-ons to be skipped
6900 and no vendor-specific directories will be configured for perl.
6901
6902 EOM
6903 rp='Do you want to configure vendor-specific add-on directories?'
6904 case "$usevendorprefix" in
6905 define|true|[yY]*) dflt=y ;;
6906 *)      : User may have set vendorprefix directly on Configure command line.
6907         case "$vendorprefix" in
6908         ''|' ') dflt=n ;;
6909         *)      dflt=y ;;
6910         esac
6911         ;;
6912 esac
6913 . ./myread
6914 case "$ans" in
6915 [yY]*)  fn=d~+
6916         rp='Installation prefix to use for vendor-supplied add-ons?'
6917         case "$vendorprefix" in
6918         '') dflt='' ;;
6919         *)  dflt=$vendorprefix ;;
6920         esac
6921         . ./getfile
6922         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6923         oldvendorprefix=''
6924         case "$vendorprefix" in
6925         '') ;;
6926         *)      case "$ans" in
6927                 "$prefix") ;;
6928                 *) oldvendorprefix="$prefix";;
6929                 esac
6930                 ;;
6931         esac
6932         usevendorprefix="$define"
6933         vendorprefix="$ans"
6934         vendorprefixexp="$ansexp"
6935         ;;
6936 *)      usevendorprefix="$undef"
6937         vendorprefix=''
6938         vendorprefixexp=''
6939         ;;
6940 esac
6941
6942 : Set the vendorlib variables
6943 case "$vendorprefix" in
6944 '')     d_vendorlib="$undef"
6945         vendorlib=''
6946         vendorlibexp=''
6947         ;;
6948 *)      d_vendorlib="$define"
6949         : determine where vendor-supplied modules go.
6950         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6951         case "$vendorlib" in
6952         '')
6953                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6954                 case "$installstyle" in
6955                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6956                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6957                 esac
6958                 ;;
6959         *)      dflt="$vendorlib"
6960                 ;;
6961         esac
6962         fn=d~+
6963         rp='Pathname for the vendor-supplied library files?'
6964         . ./getfile
6965         vendorlib="$ans"
6966         vendorlibexp="$ansexp"
6967         ;;
6968 esac
6969 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6970 prefixvar=vendorlib
6971 . ./installprefix
6972
6973 : Set the vendorarch variables
6974 case "$vendorprefix" in
6975 '')     d_vendorarch="$undef"
6976         vendorarch=''
6977         vendorarchexp=''
6978         ;;
6979 *)      d_vendorarch="$define"
6980         : determine where vendor-supplied architecture-dependent libraries go.
6981         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6982         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6983         : vendorlib may have an optional trailing /share.
6984         case "$vendorarch" in
6985         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6986                 dflt="$dflt/$archname"
6987                 ;;
6988         *)      dflt="$vendorarch" ;;
6989         esac
6990         fn=d~+
6991         rp='Pathname for vendor-supplied architecture-dependent files?'
6992         . ./getfile
6993         vendorarch="$ans"
6994         vendorarchexp="$ansexp"
6995         ;;
6996 esac
6997 prefixvar=vendorarch
6998 . ./installprefix
6999
7000 : Final catch-all directories to search
7001 $cat <<EOM
7002
7003 Lastly, you can have perl look in other directories for extensions and
7004 modules in addition to those already specified.
7005 These directories will be searched after 
7006         $sitearch 
7007         $sitelib 
7008 EOM
7009 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7010 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7011 echo ' '
7012 case "$otherlibdirs" in
7013 ''|' ') dflt='none' ;;
7014 *)      dflt="$otherlibdirs" ;;
7015 esac
7016 $cat <<EOM
7017 Enter a colon-separated set of extra paths to include in perl's @INC
7018 search path, or enter 'none' for no extra paths.
7019
7020 EOM
7021
7022 rp='Colon-separated list of additional directories for perl to search?'
7023 . ./myread
7024 case "$ans" in
7025 ' '|''|none)    otherlibdirs=' ' ;;     
7026 *)      otherlibdirs="$ans" ;;
7027 esac
7028 case "$otherlibdirs" in
7029 ' ') val=$undef ;;
7030 *)      val=$define ;;
7031 esac
7032 set d_perl_otherlibdirs
7033 eval $setvar
7034
7035 : Cruising for prototypes
7036 echo " "
7037 echo "Checking out function prototypes..." >&4
7038 $cat >prototype.c <<EOCP
7039 #$i_stdlib I_STDLIB
7040 #ifdef I_STDLIB
7041 #include <stdlib.h>
7042 #endif
7043 int main(int argc, char *argv[]) {
7044         exit(0);}
7045 EOCP
7046 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7047         echo "Your C compiler appears to support function prototypes."
7048         val="$define"
7049 else
7050         echo "Your C compiler doesn't seem to understand function prototypes."
7051         val="$undef"
7052 fi
7053 set prototype
7054 eval $setvar
7055 $rm -f prototype*
7056
7057 : Check if ansi2knr is required
7058 case "$prototype" in
7059 "$define") ;;
7060 *)      ansi2knr='ansi2knr'
7061         echo " "
7062         cat <<EOM >&4
7063
7064 $me:  FATAL ERROR:
7065 This version of $package can only be compiled by a compiler that 
7066 understands function prototypes.  Unfortunately, your C compiler 
7067         $cc $ccflags
7068 doesn't seem to understand them.  Sorry about that.
7069
7070 If GNU cc is available for your system, perhaps you could try that instead.  
7071
7072 Eventually, we hope to support building Perl with pre-ANSI compilers.
7073 If you would like to help in that effort, please contact <perlbug@perl.org>.
7074
7075 Aborting Configure now.
7076 EOM
7077         exit 2
7078         ;;
7079 esac
7080
7081 : DTrace support
7082 dflt_dtrace='/usr/sbin/dtrace'
7083 cat <<EOM
7084
7085 Perl can be built to support DTrace on platforms that support it.
7086 DTrace is a diagnosis and performance analysis tool from Sun.
7087
7088 If this doesn't make any sense to you, just accept the default '$dflt'.
7089 EOM
7090
7091 while $test 1 ; do
7092         case "$usedtrace" in
7093         $define|true|[yY]*)
7094                 dflt='y'
7095                 ;;
7096         ?*)
7097                 dflt='y'
7098                 dflt_dtrace=$usedtrace
7099                 ;;
7100         *)
7101                 dflt='n'
7102                 ;;
7103         esac
7104
7105         rp='Support DTrace if available?'
7106         . ./myread
7107         case "$ans" in
7108         y|Y)    val="$define" ;;
7109         *)      val="$undef" ;;
7110         esac
7111         set usedtrace
7112         eval $setvar
7113
7114         test "X$usedtrace" != "X$define" && break
7115
7116         echo " "
7117         rp='Where is the dtrace executable?'
7118         dflt=$dflt_dtrace
7119         . ./getfile
7120         val="$ans"
7121         set dtrace
7122         eval $setvar
7123
7124         if $test -f $dtrace
7125         then
7126                 if $dtrace -h -s ../perldtrace.d \
7127                         -o perldtrace.tmp >/dev/null 2>&1 \
7128                         && rm -f perldtrace.tmp
7129                 then
7130                         echo " "
7131                         echo "Good: your $dtrace knows about the -h flag."
7132                 else
7133                         cat >&2 <<EOM
7134
7135 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7136 ***
7137 *** Your installed dtrace doesn't support the -h switch to compile a D
7138 *** program into a C header. Can't continue.
7139
7140 EOM
7141                         exit 1
7142                 fi
7143                 break;
7144         fi
7145
7146         case "$fastread" in
7147         yes)
7148                 cat >&2 <<EOM
7149
7150 *** $me:  Fatal Error:  $dtrace not found.
7151 *** Can't continue.
7152
7153 EOM
7154                 exit 1
7155                 ;;
7156         *)
7157                 echo "*** $dtrace was not found."
7158                 echo " "
7159                 ;;
7160         esac
7161 done
7162
7163 : See if we want extra modules installed
7164 echo " "
7165 case "$extras" in
7166 '') dflt='n';;
7167 *) dflt='y';;
7168 esac
7169 cat <<EOM
7170 Perl can be built with extra modules or bundles of modules which
7171 will be fetched from the CPAN and installed alongside Perl.
7172
7173 Notice that you will need access to the CPAN; either via the Internet,
7174 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7175 be asked later to configure the CPAN.pm module which will in turn do
7176 the installation of the rest of the extra modules or bundles.)
7177
7178 Notice also that if the modules require any external software such as
7179 libraries and headers (the libz library and the zlib.h header for the
7180 Compress::Zlib module, for example) you MUST have any such software
7181 already installed, this configuration process will NOT install such
7182 things for you.
7183
7184 If this doesn't make any sense to you, just accept the default '$dflt'.
7185 EOM
7186 rp='Install any extra modules (y or n)?'
7187 . ./myread
7188 case "$ans" in
7189 y|Y)
7190         cat <<EOM
7191
7192 Please list any extra modules or bundles to be installed from CPAN,
7193 with spaces between the names.  The names can be in any format the
7194 'install' command of CPAN.pm will understand.  (Answer 'none',
7195 without the quotes, to install no extra modules or bundles.)
7196 EOM
7197         rp='Extras?'
7198         dflt="$extras"
7199         . ./myread
7200         extras="$ans"
7201 esac
7202 case "$extras" in
7203 ''|'none')
7204         val=''
7205         $rm -f ../extras.lst
7206         ;;
7207 *)      echo "(Saving the list of extras for later...)"
7208         echo "$extras" > ../extras.lst
7209         val="'$extras'"
7210         ;;
7211 esac
7212 set extras
7213 eval $setvar
7214 echo " "
7215
7216 : determine where html pages for programs go
7217 set html1dir html1dir none
7218 eval $prefixit
7219 $cat <<EOM
7220
7221 If you wish to install html files for programs in $spackage, indicate
7222 the appropriate directory here.  To skip installing html files,
7223 answer "none".
7224 EOM
7225 case "$html1dir" in
7226 ''|none|$undef|' ') dflt=none ;;
7227 *) dflt=$html1dir ;;
7228 esac
7229 fn=dn+~
7230 rp="Directory for the main $spackage html pages?"
7231 . ./getfile
7232 prefixvar=html1dir
7233 . ./setprefixvar
7234 : Use ' ' for none so value is preserved next time through Configure
7235 $test X"$html1dir" = "X" && html1dir=' '
7236
7237 : determine where html pages for libraries and modules go
7238 set html3dir html3dir none
7239 eval $prefixit
7240 $cat <<EOM
7241
7242 If you wish to install html files for modules associated with $spackage,
7243 indicate the appropriate directory here.  To skip installing html files,
7244 answer "none".
7245 EOM
7246 : There is no obvious default.  If they have specified html1dir, then
7247 : try to key off that, possibly changing .../html1 into .../html3.
7248 case "$html3dir" in
7249 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7250 *) dflt=$html3dir ;;
7251 esac
7252 fn=dn+~
7253 rp="Directory for the $spackage module html pages?"
7254 . ./getfile
7255 prefixvar=html3dir
7256 . ./setprefixvar
7257 : Use ' ' for none so value is preserved next time through Configure
7258 $test X"$html3dir" = "X" && html3dir=' '
7259
7260 : determine whether to install perl also as /usr/bin/perl
7261
7262 echo " "
7263 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7264         $cat <<EOM
7265 Many scripts expect perl to be installed as /usr/bin/perl.
7266
7267 If you want to, I can install the perl you are about to compile
7268 as /usr/bin/perl (in addition to $bin/perl).
7269 EOM
7270         if test -f /usr/bin/perl; then
7271             $cat <<EOM
7272
7273 However, please note that because you already have a /usr/bin/perl,
7274 overwriting that with a new Perl would very probably cause problems.
7275 Therefore I'm assuming you don't want to do that (unless you insist).
7276
7277 EOM
7278             case "$installusrbinperl" in
7279             "$define"|[yY]*)    dflt='y';;
7280             *)                  dflt='n';;
7281             esac
7282         else
7283             $cat <<EOM
7284
7285 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7286
7287 EOM
7288             case "$installusrbinperl" in
7289             "$undef"|[nN]*)     dflt='n';;
7290             *)                  dflt='y';;
7291             esac
7292         fi
7293         rp="Do you want to install perl as /usr/bin/perl?"
7294         . ./myread
7295         case "$ans" in
7296         [yY]*)  val="$define";;
7297         *)      val="$undef" ;;
7298         esac
7299 else
7300         val="$undef"
7301 fi
7302 set installusrbinperl
7303 eval $setvar
7304
7305 : Check if we are using the GNU C library
7306 echo " "
7307 echo "Checking for GNU C Library..." >&4
7308 cat >try.c <<'EOCP'
7309 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7310    alone are insufficient to distinguish different versions, such as
7311    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7312    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7313 */
7314 #include <stdio.h>
7315 int main(void)
7316 {
7317 #ifdef __GLIBC__
7318 #   ifdef __GLIBC_MINOR__
7319 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7320 #           include <gnu/libc-version.h>
7321             printf("%s\n",  gnu_get_libc_version());
7322 #       else
7323             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7324 #       endif
7325 #   else
7326         printf("%d\n",  __GLIBC__);
7327 #   endif
7328     return 0;
7329 #else
7330     return 1;
7331 #endif
7332 }
7333 EOCP
7334 set try
7335 if eval $compile_ok && $run ./try > glibc.ver; then
7336         val="$define"
7337         gnulibc_version=`$cat glibc.ver`
7338         echo "You are using the GNU C Library version $gnulibc_version"
7339 else
7340         val="$undef"
7341         gnulibc_version=''
7342         echo "You are not using the GNU C Library"
7343 fi
7344 $rm_try glibc.ver
7345 set d_gnulibc
7346 eval $setvar
7347
7348 : see if nm is to be used to determine whether a symbol is defined or not
7349 case "$usenm" in
7350 '')
7351         dflt=''
7352         case "$d_gnulibc" in
7353         "$define")
7354                 echo " "
7355                 echo "nm probably won't work on the GNU C Library." >&4
7356                 dflt=n
7357                 ;;
7358         esac
7359         case "$dflt" in
7360         '') 
7361                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7362                         echo " "
7363                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7364                         echo "'nm' won't be sufficient on this sytem." >&4
7365                         dflt=n
7366                 fi
7367                 ;;
7368         esac
7369         case "$dflt" in
7370         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7371                 if $test $dflt -gt 20; then
7372                         dflt=y
7373                 else
7374                         dflt=n
7375                 fi
7376                 ;;
7377         esac
7378         ;;
7379 *)
7380         case "$usenm" in
7381         true|$define) dflt=y;;
7382         *) dflt=n;;
7383         esac
7384         ;;
7385 esac
7386 $cat <<EOM
7387
7388 I can use $nm to extract the symbols from your C libraries. This
7389 is a time consuming task which may generate huge output on the disk (up
7390 to 3 megabytes) but that should make the symbols extraction faster. The
7391 alternative is to skip the 'nm' extraction part and to compile a small
7392 test program instead to determine whether each symbol is present. If
7393 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7394 this may be the best solution.
7395
7396 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7397
7398 EOM
7399 rp="Shall I use $nm to extract C symbols from the libraries?"
7400 . ./myread
7401 case "$ans" in
7402 [Nn]*) usenm=false;;
7403 *) usenm=true;;
7404 esac
7405
7406 runnm=$usenm
7407 case "$reuseval" in
7408 true) runnm=false;;
7409 esac
7410
7411 : nm options which may be necessary
7412 case "$nm_opt" in
7413 '') if $test -f /mach_boot; then
7414                 nm_opt=''       # Mach
7415         elif $test -d /usr/ccs/lib; then
7416                 nm_opt='-p'     # Solaris (and SunOS?)
7417         elif $test -f /dgux; then
7418                 nm_opt='-p'     # DG-UX
7419         elif $test -f /lib64/rld; then
7420                 nm_opt='-p'     # 64-bit Irix
7421         else
7422                 nm_opt=''
7423         fi;;
7424 esac
7425
7426 : nm options which may be necessary for shared libraries but illegal
7427 : for archive libraries.  Thank you, Linux.
7428 case "$nm_so_opt" in
7429 '')     case "$myuname" in
7430         *linux*|gnu*)
7431                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7432                         nm_so_opt='--dynamic'
7433                 fi
7434                 ;;
7435         esac
7436         ;;
7437 esac
7438
7439 : get list of predefined functions in a handy place
7440 case "$runnm" in
7441 true)
7442 echo " "
7443 case "$libc" in
7444 '') libc=unknown
7445         case "$libs" in
7446         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7447         esac
7448         ;;
7449 esac
7450 case "$libs" in
7451 '') ;;
7452 *)  for thislib in $libs; do
7453         case "$thislib" in
7454         -lc|-lc_s)
7455                 : Handle C library specially below.
7456                 ;;
7457         -l*)
7458                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7459                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7460                         :
7461                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7462                         :
7463                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7464                         :
7465                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7466                         :
7467                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7468                         :
7469                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7470                         :
7471                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7472                         :
7473                 else
7474                         try=''
7475                 fi
7476                 libnames="$libnames $try"
7477                 ;;
7478         *) libnames="$libnames $thislib" ;;
7479         esac
7480         done
7481         ;;
7482 esac
7483 xxx=normal
7484 case "$libc" in
7485 unknown)
7486         set /lib/libc.$so
7487         for xxx in $libpth; do
7488                 $test -r $1 || set $xxx/libc.$so
7489                 : The messy sed command sorts on library version numbers.
7490                 $test -r $1 || \
7491                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7492                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7493                                 h
7494                                 s/[0-9][0-9]*/0000&/g
7495                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7496                                 G
7497                                 s/\n/ /' | \
7498                          $sort | $sed -e 's/^.* //'`
7499                 eval set \$$#
7500         done
7501         $test -r $1 || set /usr/ccs/lib/libc.$so
7502         $test -r $1 || set /lib/libsys_s$_a
7503         ;;
7504 *)
7505         set blurfl
7506         ;;
7507 esac
7508 if $test -r "$1"; then
7509         echo "Your (shared) C library seems to be in $1."
7510         libc="$1"
7511 elif $test -r /lib/libc && $test -r /lib/clib; then
7512         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7513         xxx=apollo
7514         libc='/lib/clib /lib/libc'
7515         if $test -r /lib/syslib; then
7516                 echo "(Your math library is in /lib/syslib.)"
7517                 libc="$libc /lib/syslib"
7518         fi
7519 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7520         echo "Your C library seems to be in $libc, as you said before."
7521 elif $test -r $incpath/usr/lib/libc$_a; then
7522         libc=$incpath/usr/lib/libc$_a;
7523         echo "Your C library seems to be in $libc.  That's fine."
7524 elif $test -r /lib/libc$_a; then
7525         libc=/lib/libc$_a;
7526         echo "Your C library seems to be in $libc.  You're normal."
7527 else
7528         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7529                 :
7530         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7531                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7532         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7533                 :
7534         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7535                 :
7536         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7537                 :
7538         else
7539                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7540         fi
7541         if $test -r "$tans"; then
7542                 echo "Your C library seems to be in $tans, of all places."
7543                 libc=$tans
7544         else
7545                 libc='blurfl'
7546         fi
7547 fi
7548 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7549         dflt="$libc"
7550         cat <<EOM
7551
7552 If the guess above is wrong (which it might be if you're using a strange
7553 compiler, or your machine supports multiple models), you can override it here.
7554
7555 EOM
7556 else
7557         dflt=''
7558         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7559         cat >&4 <<EOM
7560 I can't seem to find your C library.  I've looked in the following places:
7561
7562 EOM
7563         $sed 's/^/      /' libpath
7564         cat <<EOM
7565
7566 None of these seems to contain your C library. I need to get its name...
7567
7568 EOM
7569 fi
7570 fn=f
7571 rp='Where is your C library?'
7572 . ./getfile
7573 libc="$ans"
7574
7575 echo " "
7576 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7577 set X `cat libnames`
7578 shift
7579 xxx=files
7580 case $# in 1) xxx=file; esac
7581 echo "Extracting names from the following $xxx for later perusal:" >&4
7582 echo " "
7583 $sed 's/^/      /' libnames >&4
7584 echo " "
7585 $echo $n "This may take a while...$c" >&4
7586
7587 for file in $*; do
7588         case $file in
7589         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7590         *) $nm $nm_opt $file 2>/dev/null;;
7591         esac
7592 done >libc.tmp
7593
7594 $echo $n ".$c"
7595 $grep fprintf libc.tmp > libc.ptf
7596 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7597 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7598 xxx='[ADTSIW]'
7599 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7600         eval $xscan;\
7601         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7602                 eval $xrun
7603 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7604         eval $xscan;\
7605         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7606                 eval $xrun
7607 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7608         eval $xscan;\
7609         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7610                 eval $xrun
7611 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //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.*text.*/\1/p'";\
7616         eval $xscan;\
7617         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7618                 eval $xrun
7619 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7620         eval $xscan;\
7621         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7622                 eval $xrun
7623 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7624                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7625         eval $xscan;\
7626         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7627                 eval $xrun
7628 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7629         eval $xscan;\
7630         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7631                 eval $xrun
7632 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7633         eval $xscan;\
7634         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7635                 eval $xrun
7636 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7637         eval $xscan;\
7638         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7639                 eval $xrun
7640 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7641         eval $xscan;\
7642         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7643                 eval $xrun
7644 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7645         eval $xscan;\
7646         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7647                 eval $xrun
7648 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7649         eval $xscan;\
7650         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7651                 eval $xrun
7652 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7653         eval $xscan;\
7654         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7655                 eval $xrun
7656 else
7657         $nm -p $* 2>/dev/null >libc.tmp
7658         $grep fprintf libc.tmp > libc.ptf
7659         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7660                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7661         then
7662                 nm_opt='-p'
7663                 eval $xrun
7664         else
7665                 echo " "
7666                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7667                 com=''
7668                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7669                         for thisname in $libnames $libc; do
7670                                 $ar t $thisname >>libc.tmp
7671                         done
7672                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7673                         echo "Ok." >&4
7674                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7675                         # Repeat libc to extract forwarders to DLL entries too
7676                         for thisname in $libnames $libc; do
7677                                 $ar tv $thisname >>libc.tmp
7678                                 # Revision 50 of EMX has bug in $ar.
7679                                 # it will not extract forwarders to DLL entries
7680                                 # Use emximp which will extract exactly them.
7681                                 emximp -o tmp.imp $thisname \
7682                                     2>/dev/null && \
7683                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7684                                     < tmp.imp >>libc.tmp
7685                                 $rm tmp.imp
7686                         done
7687                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7688                         echo "Ok." >&4
7689                 else
7690                         echo "$ar didn't seem to work right." >&4
7691                         echo "Maybe this is a Cray...trying bld instead..." >&4
7692                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7693                         then
7694                                 for thisname in $libnames; do
7695                                         bld t $libnames | \
7696                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7697                                         $ar t $thisname >>libc.tmp
7698                                 done
7699                                 echo "Ok." >&4
7700                         else
7701                                 echo "That didn't work either.  Giving up." >&4
7702                                 exit 1
7703                         fi
7704                 fi
7705         fi
7706 fi
7707 nm_extract="$com"
7708 case "$PASE" in
7709 define)
7710     echo " "
7711     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7712     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7713     ;;
7714 *)  if $test -f /lib/syscalls.exp; then
7715         echo " "
7716         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7717         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7718     fi
7719     ;;
7720 esac
7721 ;;
7722 esac
7723 $rm -f libnames libpath
7724
7725 : see if dld is available
7726 set dld.h i_dld
7727 eval $inhdr
7728
7729 : Check if we are using C++
7730 echo " "
7731 echo "Checking for C++..." >&4
7732 $cat >try.c <<'EOCP'
7733 #include <stdio.h>
7734 int main(void)
7735 {
7736 #ifdef __cplusplus
7737     return 0;
7738 #else
7739     return 1;
7740 #endif
7741 }
7742 EOCP
7743 set try
7744 if eval $compile_ok && $run ./try; then
7745         val="$define"
7746         echo "You are using a C++ compiler."
7747 else
7748         val="$undef"
7749         echo "You are not using a C++ compiler."
7750 fi
7751 $rm_try cplusplus$$
7752 set d_cplusplus
7753 eval $setvar
7754
7755 : is a C symbol defined?
7756 csym='tlook=$1;
7757 case "$3" in
7758 -v) tf=libc.tmp; tdc="";;
7759 -a) tf=libc.tmp; tdc="[]";;
7760 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7761 esac;
7762 tx=yes;
7763 case "$reuseval-$4" in
7764 true-) ;;
7765 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7766 esac;
7767 case "$tx" in
7768 yes)
7769         tval=false;
7770         case "$d_cplusplus" in
7771                 $define) extern_C=\"C\";;
7772         esac;
7773         if $test "$runnm" = true; then
7774                 if $contains $tlook $tf >/dev/null 2>&1; then
7775                         tval=true;
7776                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7777                         echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7778                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7779                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7780                         $rm_try;
7781                 fi;
7782         else
7783                 echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7784                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7785                 $rm_try;
7786         fi;
7787         ;;
7788 *)
7789         case "$tval" in
7790         $define) tval=true;;
7791         *) tval=false;;
7792         esac;
7793         ;;
7794 esac;
7795 eval "$2=$tval"'
7796
7797 : define an is-in-libc? function
7798 inlibc='echo " "; td=$define; tu=$undef;
7799 sym=$1; var=$2; eval "was=\$$2";
7800 tx=yes;
7801 case "$reuseval$was" in
7802 true) ;;
7803 true*) tx=no;;
7804 esac;
7805 case "$tx" in
7806 yes)
7807         set $sym tres -f;
7808         eval $csym;
7809         case "$tres" in
7810         true)
7811                 echo "$sym() found." >&4;
7812                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7813         *)
7814                 echo "$sym() NOT found." >&4;
7815                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7816         esac;;
7817 *)
7818         case "$was" in
7819         $define) echo "$sym() found." >&4;;
7820         *) echo "$sym() NOT found." >&4;;
7821         esac;;
7822 esac'
7823
7824 : see if dlopen exists
7825 xxx_runnm="$runnm"
7826 xxx_ccflags="$ccflags"
7827 runnm=false
7828 : with g++ one needs -shared to get is-in-libc to work for dlopen
7829 case "$gccversion" in
7830 '')     ;;
7831 *)      case "$d_cplusplus" in
7832         "$define") ccflags="$ccflags -shared" ;;
7833         esac
7834         ;;
7835 esac
7836 set dlopen d_dlopen
7837 eval $inlibc
7838 runnm="$xxx_runnm"
7839 ccflags="$xxx_ccflags"
7840
7841 : see if this is a unistd.h system
7842 set unistd.h i_unistd
7843 eval $inhdr
7844
7845 : determine which dynamic loading, if any, to compile in
7846 echo " "
7847 dldir="ext/DynaLoader"
7848 case "$usedl" in
7849 $define|y|true)
7850         dflt='y'
7851         usedl="$define"
7852         ;;
7853 $undef|n|false)
7854         dflt='n'
7855         usedl="$undef"
7856         ;;
7857 *)
7858         dflt='n'
7859         case "$d_dlopen" in
7860             $define) dflt='y' ;;
7861         esac
7862         case "$i_dld" in
7863             $define) dflt='y' ;;
7864         esac
7865         : Does a dl_xxx.xs file exist for this operating system
7866         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7867         ;;
7868 esac
7869 rp="Do you wish to use dynamic loading?"
7870 . ./myread
7871 usedl="$ans"
7872 case "$ans" in
7873 y*) usedl="$define"
7874         case "$dlsrc" in
7875         '')
7876                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7877                         dflt="$dldir/dl_${osname}.xs"
7878                 elif $test "$d_dlopen" = "$define" ; then
7879                         dflt="$dldir/dl_dlopen.xs"
7880                 elif $test "$i_dld" = "$define" ; then
7881                         dflt="$dldir/dl_dld.xs"
7882                 else
7883                         dflt=''
7884                 fi
7885                 ;;
7886         *)      dflt="$dldir/$dlsrc"
7887                 ;;
7888         esac
7889     echo "The following dynamic loading files are available:"
7890         : Can not go over to $dldir because getfile has path hard-coded in.
7891         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7892         rp="Source file to use for dynamic loading"
7893         fn="fne"
7894         gfpth="$src"
7895         . ./getfile
7896         usedl="$define"
7897         : emulate basename
7898         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7899
7900         $cat << EOM
7901
7902 Some systems may require passing special flags to $cc -c to
7903 compile modules that will be used to create a shared library.
7904 To use no flags, say "none".
7905
7906 EOM
7907     case "$cccdlflags" in
7908     '') case "$gccversion" in
7909                 '') case "$osname" in
7910                         hpux)   dflt='+z' ;;
7911                         next)   dflt='none' ;;
7912                         irix*)  dflt='-KPIC' ;;
7913                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7914                         sunos)  dflt='-pic' ;;
7915                         *)      dflt='none' ;;
7916                     esac
7917                         ;;
7918                 *)  case "$osname" in
7919                         darwin) dflt='none' ;;
7920                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7921                         *)      dflt='-fpic' ;;
7922                     esac ;;
7923             esac ;;
7924         ' ') dflt='none' ;;
7925     *)  dflt="$cccdlflags" ;;
7926     esac
7927     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7928     . ./myread
7929     case "$ans" in
7930     none) cccdlflags=' ' ;;
7931     *) cccdlflags="$ans" ;;
7932     esac
7933
7934     cat << EOM
7935
7936 Some systems use ld to create libraries that can be dynamically loaded,
7937 while other systems (such as those using ELF) use $cc.
7938
7939 EOM
7940         case "$ld" in
7941         '')     $cat >try.c <<EOM
7942 /* Test for whether ELF binaries are produced */
7943 #include <fcntl.h>
7944 #$i_stdlib I_STDLIB
7945 #ifdef I_STDLIB
7946 #include <stdlib.h>
7947 #endif
7948 #$i_unistd I_UNISTD
7949 #ifdef I_UNISTD
7950 #include <unistd.h>
7951 #endif
7952 int main() {
7953         char b[4];
7954         int i = open("a.out",O_RDONLY);
7955         if(i == -1)
7956                 exit(1); /* fail */
7957         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7958                 exit(0); /* succeed (yes, it's ELF) */
7959         else
7960                 exit(1); /* fail */
7961 }
7962 EOM
7963                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7964                         cat <<EOM
7965 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7966 EOM
7967                         dflt="$cc"
7968                 else
7969                         echo "I'll use ld to build dynamic libraries."
7970                         dflt='ld'
7971                 fi
7972                 $rm_try
7973                 ;;
7974         *)      dflt="$ld"
7975                 ;;
7976         esac
7977
7978     rp="What command should be used to create dynamic libraries?"
7979     . ./myread
7980         ld="$ans"
7981
7982     cat << EOM
7983
7984 Some systems may require passing special flags to $ld to create a
7985 library that can be dynamically loaded.  If your ld flags include
7986 -L/other/path options to locate libraries outside your loader's normal
7987 search path, you may need to specify those -L options here as well.  To
7988 use no flags, say "none".
7989
7990 EOM
7991     case "$lddlflags" in
7992     '') case "$osname" in
7993                         beos) dflt='-nostart' ;;
7994                         hpux) dflt='-b';
7995                               case "$gccversion" in
7996                               '') dflt="$dflt +vnocompatwarnings" ;;
7997                               esac
7998                               ;;
7999                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8000                         next)  dflt='none' ;;
8001                         solaris) dflt='-G' ;;
8002                         sunos) dflt='-assert nodefinitions' ;;
8003                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8004                 *)     dflt='none' ;;
8005                         esac
8006                         ;;
8007     *) dflt="$lddlflags" ;;
8008     esac
8009
8010         : Try to guess additional flags to pick up local libraries.
8011         : Be careful not to append to a plain 'none'
8012         case "$dflt" in
8013         none) dflt='' ;;
8014         esac
8015         for thisflag in $ldflags; do
8016                 case "$thisflag" in
8017                 -L*|-R*|-Wl,-R*)
8018                         case " $dflt " in
8019                         *" $thisflag "*) ;;
8020                         *) dflt="$dflt $thisflag" ;;
8021                         esac
8022                         ;;
8023                 esac
8024         done
8025
8026         case "$dflt" in
8027         ''|' ') dflt='none' ;;
8028         esac
8029
8030         case "$ldflags" in
8031         *-fstack-protector*)
8032             case "$dflt" in
8033                         *-fstack-protector*) ;; # Don't add it again
8034                         *) dflt="$dflt -fstack-protector" ;; 
8035                 esac
8036                 ;;
8037         esac
8038
8039
8040     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8041     . ./myread
8042     case "$ans" in
8043     none) lddlflags=' ' ;;
8044     *) lddlflags="$ans" ;;
8045     esac
8046
8047         cat <<EOM
8048
8049 Some systems may require passing special flags to $cc to indicate that
8050 the resulting executable will use dynamic linking.  To use no flags,
8051 say "none".
8052
8053 EOM
8054     case "$ccdlflags" in
8055     '') case "$osname" in
8056             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8057             next|sunos) dflt='none' ;;
8058             *)          dflt='none' ;;
8059             esac ;;
8060     ' ')  dflt='none' ;;
8061     *)  dflt="$ccdlflags" ;;
8062     esac
8063     rp="Any special flags to pass to $cc to use dynamic linking?"
8064     . ./myread
8065     case "$ans" in
8066     none) ccdlflags=' ' ;;
8067     *) ccdlflags="$ans" ;;
8068     esac
8069     ;;
8070 *)  usedl="$undef"
8071         ld='ld'
8072     dlsrc='dl_none.xs'
8073     lddlflags=''
8074     ccdlflags=''
8075     ;;
8076 esac
8077
8078 : Do we want a shared libperl?
8079 also=''
8080 case "$usedl" in
8081 $undef)
8082         # No dynamic loading being used, so don't bother even to prompt.
8083         useshrplib='false'
8084         ;;
8085 *)      case "$useshrplib" in
8086         '')     case "$osname" in
8087                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
8088                         dflt=y
8089                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8090                         ;;
8091                 next*)
8092                         case "$osvers" in
8093                         4*)     dflt=y
8094                                 also='Building a shared libperl is needed for MAB support.'
8095                                 ;;
8096                         *)      dflt=n
8097                                 ;;
8098                         esac
8099                         ;;
8100                 *)      dflt=n
8101                         ;;
8102                 esac
8103                 ;;
8104         $define|true|[Yy]*)
8105                 dflt=y
8106                 ;;
8107         *)      dflt=n
8108                 ;;
8109         esac
8110         $cat << EOM
8111
8112 The perl executable is normally obtained by linking perlmain.c with
8113 libperl${_a}, any static extensions (usually just DynaLoader), and
8114 any other libraries needed on this system (such as -lm, etc.).  Since
8115 your system supports dynamic loading, it is probably possible to build
8116 a shared libperl.$so.  If you will have more than one executable linked
8117 to libperl.$so, this will significantly reduce the size of each
8118 executable, but it may have a noticeable effect on performance.  The
8119 default is probably sensible for your system.
8120 $also
8121
8122 EOM
8123         rp="Build a shared libperl.$so (y/n)"
8124         . ./myread
8125         case "$ans" in
8126         true|$define|[Yy]*)
8127                 useshrplib='true'  ;;
8128         *)      useshrplib='false' ;;
8129         esac
8130         ;;
8131 esac
8132
8133 case "$useshrplib" in
8134 true)
8135         case "$libperl" in
8136         '')
8137                 # Figure out a good name for libperl.so.  Since it gets stored in
8138                 # a version-specific architecture-dependent library, the version
8139                 # number isn't really that important, except for making cc/ld happy.
8140                 #
8141                 # A name such as libperl.so.3.1
8142                 majmin="libperl.$so.$patchlevel.$subversion"
8143                 # A name such as libperl.so.301
8144                 majonly=`echo $patchlevel $subversion |
8145                         $awk '{printf "%d%02d", $1, $2}'`
8146                 majonly=libperl.$so.$majonly
8147                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8148                 # rely on figuring it out from the naming of libc.
8149                 case "${osname}${osvers}" in
8150                 next4*)
8151                         dflt=libperl.5.$so
8152                         # XXX How handle the --version stuff for MAB?
8153                         ;;
8154                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8155                         dflt=libperl.$so
8156                         ;;
8157                 cygwin*) # ld links against an importlib
8158                         dflt=libperl$lib_ext
8159                         ;;
8160                 *)      # Try to guess based on whether libc has major.minor.
8161                         case "$libc" in
8162                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8163                         *libc.$so.[0-9]*) dflt=$majonly ;;
8164                         *)      dflt=libperl.$so ;;
8165                         esac
8166                         ;;
8167                 esac
8168                 ;;
8169         *)      dflt=$libperl
8170                 ;;
8171         esac
8172         cat << EOM
8173
8174 I need to select a good name for the shared libperl.  If your system uses
8175 library names with major and minor numbers, then you might want something
8176 like $majmin.  Alternatively, if your system uses a single version
8177 number for shared libraries, then you might want to use $majonly.
8178 Or, your system might be quite happy with a simple libperl.$so.
8179
8180 Since the shared libperl will get installed into a version-specific
8181 architecture-dependent directory, the version number of the shared perl
8182 library probably isn't important, so the default should be o.k.
8183
8184 EOM
8185         rp='What name do you want to give to the shared libperl?'
8186         . ./myread
8187         libperl=$ans
8188         echo "Ok, I'll use $libperl"
8189         ;;
8190 *)
8191         libperl="libperl${_a}"
8192         ;;
8193 esac
8194
8195 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8196 case "$shrpdir" in
8197 '') ;;
8198 *)      $cat >&4 <<EOM
8199 WARNING:  Use of the shrpdir variable for the installation location of
8200 the shared $libperl is not supported.  It was never documented and
8201 will not work in this version.  Let me (perlbug@perl.org)
8202 know of any problems this may cause.
8203
8204 EOM
8205         case "$shrpdir" in
8206         "$archlibexp/CORE")
8207                 $cat >&4 <<EOM
8208 But your current setting of $shrpdir is
8209 the default anyway, so it's harmless.
8210 EOM
8211                 ;;
8212         *)
8213                 $cat >&4 <<EOM
8214 Further, your current attempted setting of $shrpdir
8215 conflicts with the value of $archlibexp/CORE
8216 that installperl will use.
8217 EOM
8218                 ;;
8219         esac
8220         ;;
8221 esac
8222
8223 # How will the perl executable find the installed shared $libperl?
8224 # Add $xxx to ccdlflags.
8225 # If we can't figure out a command-line option, use $shrpenv to
8226 # set env LD_RUN_PATH.  The main perl makefile uses this.
8227 shrpdir=$archlibexp/CORE
8228 xxx=''
8229 tmp_shrpenv=''
8230 if "$useshrplib"; then
8231     case "$osname" in
8232         aix)
8233                 # We'll set it in Makefile.SH...
8234                 ;;
8235         solaris)
8236                 xxx="-R $shrpdir"
8237                 ;;
8238         freebsd|netbsd|openbsd|interix|dragonfly)
8239                 xxx="-Wl,-R$shrpdir"
8240                 ;;
8241         bsdos|linux|irix*|dec_osf|gnu*)
8242                 xxx="-Wl,-rpath,$shrpdir"
8243                 ;;
8244         next)
8245                 # next doesn't like the default...
8246                 ;;
8247         beos)
8248                 # beos doesn't like the default, either.
8249                 ;;
8250         hpux*)
8251                 # hpux doesn't like the default, either.
8252                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8253                 ;;
8254         *)
8255                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8256                 ;;
8257         esac
8258         case "$xxx" in
8259         '') ;;
8260         *)
8261                 # Only add $xxx if it isn't already in ccdlflags.
8262                 case " $ccdlflags " in
8263                 *" $xxx "*)     ;;
8264                 *)      ccdlflags="$ccdlflags $xxx"
8265                         cat <<EOM >&4
8266
8267 Adding $xxx to the flags
8268 passed to $ld so that the perl executable will find the
8269 installed shared $libperl.
8270
8271 EOM
8272                         ;;
8273                 esac
8274                 ;;
8275         esac
8276 fi
8277 # Fix ccdlflags in AIX for building external extensions.
8278 # (For building Perl itself bare -bE:perl.exp is needed,
8279 #  Makefile.SH takes care of this.)
8280 case "$osname" in
8281 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8282 esac
8283 # Respect a hint or command-line value.
8284 case "$shrpenv" in
8285 '') shrpenv="$tmp_shrpenv" ;;
8286 esac
8287 case "$ldlibpthname" in
8288 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8289 none)   ldlibpthname='' ;;
8290 esac
8291
8292 : determine where manual pages are on this system
8293 echo " "
8294 case "$sysman" in
8295 '') 
8296         syspath='/usr/share/man/man1 /usr/man/man1'
8297         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8298         syspath="$syspath /usr/man/u_man/man1"
8299         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8300         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8301         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8302         sysman=`./loc . /usr/man/man1 $syspath`
8303         ;;
8304 esac
8305 if $test -d "$sysman"; then
8306         echo "System manual is in $sysman." >&4
8307 else
8308         echo "Could not find manual pages in source form." >&4
8309 fi
8310
8311 : determine where manual pages go
8312 set man1dir man1dir none
8313 eval $prefixit
8314 $cat <<EOM
8315
8316 $spackage has manual pages available in source form.
8317 EOM
8318 case "$nroff" in
8319 nroff)
8320         echo "However, you don't have nroff, so they're probably useless to you."
8321         case "$man1dir" in
8322         '') man1dir="none";;
8323         esac;;
8324 esac
8325 echo "If you don't want the manual sources installed, answer 'none'."
8326 case "$man1dir" in
8327 ' ') dflt=none
8328         ;;
8329 '')
8330         lookpath="$prefixexp/share/man/man1"
8331         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8332         lookpath="$lookpath $prefixexp/man/p_man/man1"
8333         lookpath="$lookpath $prefixexp/man/u_man/man1"
8334         lookpath="$lookpath $prefixexp/man/man.1"
8335         case "$sysman" in
8336         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8337         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8338         esac
8339         set dflt
8340         eval $prefixup
8341         ;;
8342 *)  dflt="$man1dir"
8343         ;;
8344 esac
8345 echo " "
8346 fn=dn+~
8347 rp="Where do the main $spackage manual pages (source) go?"
8348 . ./getfile
8349 if $test "X$man1direxp" != "X$ansexp"; then
8350         installman1dir=''
8351 fi
8352 prefixvar=man1dir
8353 . ./setprefixvar
8354
8355 case "$man1dir" in
8356 '')     man1dir=' '
8357         installman1dir='';;
8358 esac
8359
8360 : What suffix to use on installed man pages
8361
8362 case "$man1dir" in
8363 ' ')
8364         man1ext='0'
8365         ;;
8366 *)
8367         rp="What suffix should be used for the main $spackage man pages?"
8368         case "$man1ext" in
8369         '')     case "$man1dir" in
8370                 *1)  dflt=1 ;;
8371                 *1p) dflt=1p ;;
8372                 *1pm) dflt=1pm ;;
8373                 *l) dflt=l;;
8374                 *n) dflt=n;;
8375                 *o) dflt=o;;
8376                 *p) dflt=p;;
8377                 *C) dflt=C;;
8378                 *L) dflt=L;;
8379                 *L1) dflt=L1;;
8380                 *) dflt=1;;
8381                 esac
8382                 ;;
8383         *)      dflt="$man1ext";;
8384         esac
8385         . ./myread
8386         man1ext="$ans"
8387         ;;
8388 esac
8389
8390 : see if we can have long filenames
8391 echo " "
8392 first=123456789abcdef
8393 $rm -f $first
8394 if (echo hi >$first) 2>/dev/null; then
8395         if $test -f 123456789abcde; then
8396                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8397                 val="$undef"
8398         else
8399                 echo 'You can have filenames longer than 14 characters.'>&4
8400                 val="$define"
8401         fi
8402 else
8403         $cat <<'EOM'
8404 You can't have filenames longer than 14 chars.
8405 You can't even think about them!
8406 EOM
8407         val="$undef"
8408 fi
8409 set d_flexfnam
8410 eval $setvar
8411 $rm -rf 123456789abcde*
8412
8413 : determine where library module manual pages go
8414 set man3dir man3dir none
8415 eval $prefixit
8416 $cat <<EOM
8417
8418 $spackage has manual pages for many of the library modules.
8419 EOM
8420
8421 case "$nroff" in
8422 nroff)
8423         $cat <<'EOM'
8424 However, you don't have nroff, so they're probably useless to you.
8425 EOM
8426         case "$man3dir" in
8427         '') man3dir="none";;
8428         esac;;
8429 esac
8430
8431 case "$d_flexfnam" in
8432 undef)
8433         $cat <<'EOM'
8434 However, your system can't handle the long file names like File::Basename.3.
8435 EOM
8436         case "$man3dir" in
8437         '') man3dir="none";;
8438         esac;;
8439 esac
8440
8441 echo "If you don't want the manual sources installed, answer 'none'."
8442 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8443 case "$man3dir" in
8444 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8445         if $test -d "$privlib/man/man3"; then
8446                 cat <<EOM >&4
8447
8448 WARNING:  Previous versions of perl installed man3 pages into
8449 $privlib/man/man3.  This version will suggest a
8450 new default of $dflt.
8451 EOM
8452                 tdflt=$dflt
8453                 dflt='n'
8454                 rp='Do you wish to preserve the old behavior?(y/n)'
8455                 . ./myread
8456                 case "$ans" in
8457                 y*) dflt="$privlib/man/man3" ;;
8458                 *)  dflt=$tdflt ;;
8459                 esac
8460     fi
8461         ;;
8462 *)      dflt="$man3dir" ;;
8463 esac
8464 case "$dflt" in
8465 ' ') dflt=none ;;
8466 esac
8467 echo " "
8468 fn=dn+~
8469 rp="Where do the $package library man pages (source) go?"
8470 . ./getfile
8471 prefixvar=man3dir
8472 . ./setprefixvar
8473
8474 case "$man3dir" in
8475 '')     man3dir=' '
8476         installman3dir='';;
8477 esac
8478
8479 : What suffix to use on installed man pages
8480 case "$man3dir" in
8481 ' ')
8482         man3ext='0'
8483         ;;
8484 *)
8485         rp="What suffix should be used for the $package library man pages?"
8486         case "$man3ext" in
8487         '')     case "$man3dir" in
8488                 *3)  dflt=3 ;;
8489                 *3p) dflt=3p ;;
8490                 *3pm) dflt=3pm ;;
8491                 *l) dflt=l;;
8492                 *n) dflt=n;;
8493                 *o) dflt=o;;
8494                 *p) dflt=p;;
8495                 *C) dflt=C;;
8496                 *L) dflt=L;;
8497                 *L3) dflt=L3;;
8498                 *) dflt=3;;
8499                 esac
8500                 ;;
8501         *)      dflt="$man3ext";;
8502         esac
8503         . ./myread
8504         man3ext="$ans"
8505         ;;
8506 esac
8507
8508 : see if we have to deal with yellow pages, now NIS.
8509 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8510         if $test -f /usr/etc/nibindd; then
8511                 echo " "
8512                 echo "I'm fairly confident you're on a NeXT."
8513                 echo " "
8514                 rp='Do you get the hosts file via NetInfo?'
8515                 dflt=y
8516                 case "$hostcat" in
8517                 nidump*) ;;
8518                 '') ;;
8519                 *) dflt=n;;
8520                 esac
8521                 . ./myread
8522                 case "$ans" in
8523                 y*) hostcat='nidump hosts .';;
8524                 *)      case "$hostcat" in
8525                         nidump*) hostcat='';;
8526                         esac
8527                         ;;
8528                 esac
8529         fi
8530         case "$hostcat" in
8531         nidump*) ;;
8532         *)
8533                 case "$hostcat" in
8534                 *ypcat*) dflt=y;;
8535                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8536                                 dflt=y
8537                         else
8538                                 dflt=n
8539                         fi;;
8540                 *) dflt=n;;
8541                 esac
8542                 echo " "
8543                 rp='Are you getting the hosts file via yellow pages?'
8544                 . ./myread
8545                 case "$ans" in
8546                 y*) hostcat='ypcat hosts';;
8547                 *) hostcat='cat /etc/hosts';;
8548                 esac
8549                 ;;
8550         esac
8551 fi
8552 case "$hostcat" in
8553 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8554 esac
8555 case "$groupcat" in
8556 '') test -f /etc/group && groupcat='cat /etc/group';;
8557 esac
8558 case "$passcat" in
8559 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8560 esac
8561
8562 : now get the host name
8563 echo " "
8564 echo "Figuring out host name..." >&4
8565 case "$myhostname" in
8566 '') cont=true
8567         echo 'Maybe "hostname" will work...'
8568         if tans=`sh -c hostname 2>&1` ; then
8569                 myhostname=$tans
8570                 phostname=hostname
8571                 cont=''
8572         fi
8573         ;;
8574 *) cont='';;
8575 esac
8576 if $test "$cont"; then
8577         if ./xenix; then
8578                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8579                 if tans=`cat /etc/systemid 2>&1` ; then
8580                         myhostname=$tans
8581                         phostname='cat /etc/systemid'
8582                         echo "Whadyaknow.  Xenix always was a bit strange..."
8583                         cont=''
8584                 fi
8585         elif $test -r /etc/systemid; then
8586                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8587         fi
8588 fi
8589 if $test "$cont"; then
8590         echo 'No, maybe "uuname -l" will work...'
8591         if tans=`sh -c 'uuname -l' 2>&1` ; then
8592                 myhostname=$tans
8593                 phostname='uuname -l'
8594         else
8595                 echo 'Strange.  Maybe "uname -n" will work...'
8596                 if tans=`sh -c 'uname -n' 2>&1` ; then
8597                         myhostname=$tans
8598                         phostname='uname -n'
8599                 else
8600                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8601                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8602                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8603                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8604                         else
8605                                 case "$myhostname" in
8606                                 '') echo "Does this machine have an identity crisis or something?"
8607                                         phostname='';;
8608                                 *)
8609                                         echo "Well, you said $myhostname before..."
8610                                         phostname='echo $myhostname';;
8611                                 esac
8612                         fi
8613                 fi
8614         fi
8615 fi
8616 case "$myhostname" in
8617 '') myhostname=noname ;;
8618 esac
8619 : you do not want to know about this
8620 set $myhostname
8621 myhostname=$1
8622
8623 : verify guess
8624 if $test "$myhostname" ; then
8625         dflt=y
8626         rp='Your host name appears to be "'$myhostname'".'" Right?"
8627         . ./myread
8628         case "$ans" in
8629         y*) ;;
8630         *) myhostname='';;
8631         esac
8632 fi
8633
8634 : bad guess or no guess
8635 while $test "X$myhostname" = X ; do
8636         dflt=''
8637         rp="Please type the (one word) name of your host:"
8638         . ./myread
8639         myhostname="$ans"
8640 done
8641
8642 : translate upper to lower if necessary
8643 case "$myhostname" in
8644 *[A-Z]*)
8645         echo "(Normalizing case in your host name)"
8646         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8647         ;;
8648 esac
8649
8650 case "$myhostname" in
8651 *.*)
8652         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8653         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8654         echo "(Trimming domain name from host name--host name is now $myhostname)"
8655         ;;
8656 *) case "$mydomain" in
8657         '')
8658                 {
8659                         test "X$hostcat" = "Xypcat hosts" &&
8660                         ypmatch "$myhostname" hosts 2>/dev/null |\
8661                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8662                         $test -s hosts
8663                 } || {
8664                         test "X$hostcat" != "X" &&
8665                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8666                                         /[       ]$myhostname[  . ]/p" > hosts
8667                 }
8668                 tmp_re="[       . ]"
8669                 if $test -f hosts; then
8670                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8671                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8672                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8673                                 hosts | $sort | $uniq | \
8674                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8675                         case `$echo X$dflt` in
8676                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8677                                 dflt=.
8678                                 ;;
8679                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8680                                 ;;
8681                         esac
8682                 else
8683                         echo "(I cannot locate a hosts database anywhere)"
8684                         dflt=.
8685                 fi
8686                 case "$dflt" in
8687                 .)
8688                         tans=`./loc resolv.conf X /etc /usr/etc`
8689                         if $test -f "$tans"; then
8690                                 echo "(Attempting domain name extraction from $tans)"
8691                                 dflt=.`$sed -n -e 's/   / /g' \
8692                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8693                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8694                                 case "$dflt" in
8695                                 .) dflt=.`$sed -n -e 's/        / /g' \
8696                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8697                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8698                                         ;;
8699                                 esac
8700                         fi
8701                         ;;
8702                 esac
8703                 case "$dflt" in
8704                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8705                         dflt=.`sh -c domainname 2>/dev/null`
8706                         case "$dflt" in
8707                         '') dflt='.';;
8708                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8709                         esac
8710                         ;;
8711                 esac
8712                 case "$dflt$osname" in
8713                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8714                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8715                         ;;
8716                 esac
8717                 case "$dflt" in
8718                 .) echo "(Lost all hope -- silly guess then)"
8719                         dflt='.nonet'
8720                         ;;
8721                 esac
8722                 $rm -f hosts
8723                 ;;
8724         *) dflt="$mydomain";;
8725         esac;;
8726 esac
8727 echo " "
8728 rp="What is your domain name?"
8729 . ./myread
8730 tans="$ans"
8731 case "$ans" in
8732 '') ;;
8733 .*) ;;
8734 *) tans=".$tans";;
8735 esac
8736 mydomain="$tans"
8737
8738 : translate upper to lower if necessary
8739 case "$mydomain" in
8740 *[A-Z]*)
8741         echo "(Normalizing case in your domain name)"
8742         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8743         ;;
8744 esac
8745
8746 : a little sanity check here
8747 case "$phostname" in
8748 '') ;;
8749 *)
8750         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8751         $myhostname$mydomain|$myhostname) ;;
8752         *)
8753                 case "$phostname" in
8754                 sed*)
8755                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8756                         ;;
8757                 *)
8758                         echo "(That doesn't agree with your $phostname command, by the way.)"
8759                         ;;
8760                 esac
8761         ;;
8762         esac
8763         ;;
8764 esac
8765
8766 : determine the e-mail address of the user who is running us
8767 $cat <<EOM
8768
8769 I need to get your e-mail address in Internet format if possible, i.e.
8770 something like user@host.domain. Please answer accurately since I have
8771 no easy means to double check it. The default value provided below
8772 is most probably close to reality but may not be valid from outside
8773 your organization...
8774
8775 EOM
8776 cont=x
8777 while test "$cont"; do
8778         case "$cf_email" in
8779         '') dflt="$cf_by@$myhostname$mydomain";;
8780         *) dflt="$cf_email";;
8781         esac
8782         rp='What is your e-mail address?'
8783         . ./myread
8784         cf_email="$ans"
8785         case "$cf_email" in
8786         *@*.*) cont='' ;;
8787         *)
8788                 rp='Address does not look like an Internet one.  Use it anyway?'
8789                 case "$fastread" in
8790                 yes) dflt=y ;;
8791                 *) dflt=n ;;
8792                 esac
8793                 . ./myread
8794                 case "$ans" in
8795                 y*) cont='' ;;
8796                 *) echo " " ;;
8797                 esac
8798                 ;;
8799         esac
8800 done
8801
8802 : Ask e-mail of administrator
8803 $cat <<EOM
8804
8805 If you or somebody else will be maintaining perl at your site, please
8806 fill in the correct e-mail address here so that they may be contacted
8807 if necessary. Currently, the "perlbug" program included with perl
8808 will send mail to this address in addition to perlbug@perl.org. You may
8809 enter "none" for no administrator.
8810
8811 EOM
8812 case "$perladmin" in
8813 '') dflt="$cf_email";;
8814 *) dflt="$perladmin";;
8815 esac
8816 rp='Perl administrator e-mail address'
8817 . ./myread
8818 perladmin="$ans"
8819
8820 : determine whether to only install version-specific parts.
8821 echo " "
8822 $cat <<EOM
8823 Do you want to install only the version-specific parts of the perl
8824 distribution?  Usually you do *not* want to do this.
8825 EOM
8826 case "$versiononly" in
8827 "$define"|[Yy]*|true) dflt='y' ;;
8828 *) dflt='n';
8829 esac
8830 rp="Do you want to install only the version-specific parts of perl?"
8831 . ./myread
8832 case "$ans" in
8833 [yY]*)  val="$define";;
8834 *)      val="$undef" ;;
8835 esac
8836 set versiononly
8837 eval $setvar
8838
8839 case "$versiononly" in
8840 "$define") inc_version_list=''
8841            inc_version_list_init=0
8842            ;;
8843 esac
8844
8845 : figure out how to guarantee perl startup
8846 : XXX Note that this currently takes advantage of the bug that binexp ignores
8847 :     the Configure -Dinstallprefix setting, which in turn means that under
8848 :     relocatable @INC, initialinstalllocation is what binexp started as.
8849 case "$startperl" in
8850 '')
8851         case "$sharpbang" in
8852         *!)
8853                 $cat <<EOH
8854
8855 I can use the #! construct to start perl on your system. This will
8856 make startup of perl scripts faster, but may cause problems if you
8857 want to share those scripts and perl is not in a standard place
8858 ($initialinstalllocation/perl) on all your platforms. The alternative
8859 is to force a shell by starting the script with a single ':' character.
8860
8861 EOH
8862                 case "$versiononly" in
8863                 "$define")      dflt="$initialinstalllocation/perl$version";;
8864                 *)              dflt="$initialinstalllocation/perl";;
8865                 esac
8866                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8867                 . ./myread
8868                 case "$ans" in
8869                 none)   startperl=": # use perl";;
8870                 *)      startperl="#!$ans"
8871                         if $test 30 -lt `echo "$ans" | wc -c`; then
8872                                 $cat >&4 <<EOM
8873
8874 WARNING:  Some systems limit the #! command to 32 characters.
8875 If you experience difficulty running Perl scripts with #!, try
8876 installing Perl in a directory with a shorter pathname.
8877
8878 EOM
8879                         fi ;;
8880                 esac
8881                 ;;
8882         *) startperl=": # use perl"
8883                 ;;
8884         esac
8885         ;;
8886 esac
8887 echo "I'll use $startperl to start perl scripts."
8888
8889 : figure best path for perl in scripts
8890 case "$perlpath" in
8891 '')
8892         case "$versiononly" in
8893         "$define")      perlpath="$initialinstalllocation/perl$version";;
8894         *)              perlpath="$initialinstalllocation/perl";;
8895         esac
8896         case "$startperl" in
8897         *!*) ;;
8898         *)
8899                 $cat <<EOH
8900
8901 I will use the "eval 'exec'" idiom to start Perl on your system.
8902 I can use the full path of your Perl binary for this purpose, but
8903 doing so may cause problems if you want to share those scripts and
8904 Perl is not always in a standard place ($initialinstalllocation/perl).
8905
8906 EOH
8907                 dflt="$initialinstalllocation/perl"
8908                 rp="What path shall I use in \"eval 'exec'\"?"
8909                 . ./myread
8910                 perlpath="$ans"
8911                 ;;
8912         esac
8913         ;;
8914 esac
8915 case "$startperl" in
8916 *!*)    ;;
8917 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8918 esac
8919
8920 : determine where public executable scripts go
8921 set scriptdir scriptdir
8922 eval $prefixit
8923 case "$scriptdir" in
8924 '')
8925         dflt="$bin"
8926         : guess some guesses
8927         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8928         $test -d /usr/share/bin     && dflt=/usr/share/bin
8929         $test -d /usr/local/script  && dflt=/usr/local/script
8930         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8931         $test -d $prefixexp/script  && dflt=$prefixexp/script
8932         set dflt
8933         eval $prefixup
8934         ;;
8935 *)  dflt="$scriptdir"
8936         ;;
8937 esac
8938 $cat <<EOM
8939
8940 Some installations have a separate directory just for executable scripts so
8941 that they can mount it across multiple architectures but keep the scripts in
8942 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8943 Or you might just lump your scripts in with all your other executables.
8944
8945 EOM
8946 fn=d~
8947 rp='Where do you keep publicly executable scripts?'
8948 . ./getfile
8949 if $test "X$ansexp" != "X$scriptdirexp"; then
8950         installscript=''
8951 fi
8952 installscriptdir=''
8953 prefixvar=scriptdir
8954 . ./setprefixvar
8955 : A little fix up for an irregularly named variable.
8956 installscript="$installscriptdir"
8957
8958 : determine where add-on public executables go
8959 case "$sitebin" in
8960 '')     dflt=$siteprefix/bin ;;
8961 *)      dflt=$sitebin ;;
8962 esac
8963 fn=d~
8964 rp='Pathname where the add-on public executables should be installed?'
8965 . ./getfile
8966 prefixvar=sitebin
8967 . ./setprefixvar
8968
8969 : determine where add-on html pages go
8970 : There is no standard location, so try to copy the previously-selected
8971 : directory structure for the core html pages.
8972 case "$sitehtml1dir" in
8973 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8974 *)     dflt=$sitehtml1dir ;;
8975 esac
8976 case "$dflt" in
8977 ''|' ') dflt=none ;;
8978 esac
8979 fn=dn+~
8980 rp='Pathname where the site-specific html pages should be installed?'
8981 . ./getfile
8982 prefixvar=sitehtml1dir
8983 . ./setprefixvar
8984
8985 : determine where add-on library html pages go
8986 : There is no standard location, so try to copy the previously-selected
8987 : directory structure for the core html pages.
8988 case "$sitehtml3dir" in
8989 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8990 *)     dflt=$sitehtml3dir ;;
8991 esac
8992 case "$dflt" in
8993 ''|' ') dflt=none ;;
8994 esac
8995 fn=dn+~
8996 rp='Pathname where the site-specific library html pages should be installed?'
8997 . ./getfile
8998 prefixvar=sitehtml3dir
8999 . ./setprefixvar
9000
9001 : determine where add-on manual pages go
9002 case "$siteman1dir" in
9003 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9004 *)      dflt=$siteman1dir ;;
9005 esac
9006 case "$dflt" in
9007 ''|' ') dflt=none ;;
9008 esac
9009 fn=dn+~
9010 rp='Pathname where the site-specific manual pages should be installed?'
9011 . ./getfile
9012 prefixvar=siteman1dir
9013 . ./setprefixvar
9014
9015 : determine where add-on library man pages go
9016 case "$siteman3dir" in
9017 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9018 *)      dflt=$siteman3dir ;;
9019 esac
9020 case "$dflt" in
9021 ''|' ') dflt=none ;;
9022 esac
9023 fn=dn+~
9024 rp='Pathname where the site-specific library manual pages should be installed?'
9025 . ./getfile
9026 prefixvar=siteman3dir
9027 . ./setprefixvar
9028
9029 : determine where add-on public executable scripts go
9030 case "$sitescript" in
9031 '')     dflt=$siteprefix/script
9032         $test -d $dflt || dflt=$sitebin ;;
9033 *)  dflt="$sitescript" ;;
9034 esac
9035 fn=d~+
9036 rp='Pathname where add-on public executable scripts should be installed?'
9037 . ./getfile
9038 prefixvar=sitescript
9039 . ./setprefixvar
9040
9041 : Check if faststdio is requested and available
9042 case "$usefaststdio" in
9043 $define|true|[yY]*|'')
9044         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9045         case "$xversion" in
9046         [68])   dflt='y' ;;
9047         *)      dflt='n' ;;
9048         esac
9049         ;;
9050 *) dflt='n';;
9051 esac
9052 cat <<EOM
9053
9054 Perl can be built to use 'fast stdio', which means using the stdio
9055 library but also directly manipulating the stdio buffers to enable
9056 faster I/O.  Using stdio is better for backward compatibility (especially
9057 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9058 interface has been preferred instead of stdio.
9059
9060 If this doesn't make any sense to you, just accept the default '$dflt'.
9061 EOM
9062 rp='Use the "fast stdio" if available?'
9063 . ./myread
9064 case "$ans" in
9065 y|Y)    val="$define" ;;
9066 *)      val="$undef" ;;
9067 esac
9068 set usefaststdio
9069 eval $setvar
9070
9071
9072 : define an is-a-typedef? function
9073 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9074 case "$inclist" in
9075 "") inclist="sys/types.h";;
9076 esac;
9077 eval "varval=\$$var";
9078 case "$varval" in
9079 "")
9080         $rm -f temp.c;
9081         for inc in $inclist; do
9082                 echo "#include <$inc>" >>temp.c;
9083         done;
9084         echo "#ifdef $type" >> temp.c;
9085         echo "printf(\"We have $type\");" >> temp.c;
9086         echo "#endif" >> temp.c;
9087         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9088         if $contains $type temp.E >/dev/null 2>&1; then
9089                 eval "$var=\$type";
9090         else
9091                 eval "$var=\$def";
9092         fi;
9093         $rm -f temp.?;;
9094 *) eval "$var=\$varval";;
9095 esac'
9096
9097 : define an is-a-typedef? function that prompts if the type is not available.
9098 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9099 case "$inclist" in
9100 "") inclist="sys/types.h";;
9101 esac;
9102 eval "varval=\$$var";
9103 case "$varval" in
9104 "")
9105         $rm -f temp.c;
9106         for inc in $inclist; do
9107                 echo "#include <$inc>" >>temp.c;
9108         done;
9109         echo "#ifdef $type" >> temp.c;
9110         echo "printf(\"We have $type\");" >> temp.c;
9111         echo "#endif" >> temp.c;
9112         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9113         echo " " ;
9114         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9115         if $contains $type temp.E >/dev/null 2>&1; then
9116                 echo "$type found." >&4;
9117                 eval "$var=\$type";
9118         else
9119                 echo "$type NOT found." >&4;
9120                 dflt="$def";
9121                 . ./myread ;
9122                 eval "$var=\$ans";
9123         fi;
9124         $rm -f temp.?;;
9125 *) eval "$var=\$varval";;
9126 esac'
9127
9128 : see what type lseek is declared as in the kernel
9129 rp="What is the type used for lseek's offset on this system?"
9130 set off_t lseektype long stdio.h sys/types.h
9131 eval $typedef_ask
9132
9133 echo " "
9134 echo "Checking to see how big your file offsets are..." >&4
9135 $cat >try.c <<EOCP
9136 #include <sys/types.h>
9137 #include <stdio.h>
9138 int main()
9139 {
9140     printf("%d\n", (int)sizeof($lseektype));
9141     return(0);
9142 }
9143 EOCP
9144 set try
9145 if eval $compile_ok; then
9146         lseeksize=`$run ./try`
9147         echo "Your file offsets are $lseeksize bytes long."
9148 else
9149         dflt=$longsize
9150         echo " "
9151         echo "(I can't seem to compile the test program.  Guessing...)"
9152         rp="What is the size of your file offsets (in bytes)?"
9153         . ./myread
9154         lseeksize="$ans"
9155 fi
9156 $rm_try
9157
9158 : see what type file positions are declared as in the library
9159 rp="What is the type for file position used by fsetpos()?"
9160 set fpos_t fpostype long stdio.h sys/types.h
9161 eval $typedef_ask
9162
9163 : Check size for Fpos_t
9164 echo " "
9165 case "$fpostype" in
9166 *_t) zzz="$fpostype"    ;;
9167 *)   zzz="fpos_t"       ;;
9168 esac
9169 echo "Checking the size of $zzz..." >&4
9170 cat > try.c <<EOCP
9171 #include <sys/types.h>
9172 #include <stdio.h>
9173 #$i_stdlib I_STDLIB
9174 #ifdef I_STDLIB
9175 #include <stdlib.h>
9176 #endif
9177 int main() {
9178     printf("%d\n", (int)sizeof($fpostype));
9179     exit(0);
9180 }
9181 EOCP
9182 set try
9183 if eval $compile_ok; then
9184         yyy=`$run ./try`
9185         case "$yyy" in
9186         '')     fpossize=4
9187                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9188                 ;;
9189         *)      fpossize=$yyy
9190                 echo "Your $zzz is $fpossize bytes long."
9191                 ;;
9192         esac
9193 else
9194         dflt="$longsize"
9195         echo " " >&4
9196         echo "(I can't compile the test program.  Guessing...)" >&4
9197         rp="What is the size of your file positions (in bytes)?"
9198         . ./myread
9199         fpossize="$ans"
9200 fi
9201
9202 : Check for large file support
9203 # Backward compatibility (uselfs is deprecated).
9204 case "$uselfs" in
9205 "$define"|true|[yY]*)
9206         cat <<EOM >&4
9207
9208 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9209 EOM
9210         uselargefiles="$define"
9211         ;;
9212 esac
9213
9214 case "$lseeksize:$fpossize" in
9215 8:8) cat <<EOM
9216
9217 You can have files larger than 2 gigabytes.
9218 EOM
9219    val="$define" ;;
9220 *)    case "$uselargefiles" in
9221    "$undef"|false|[nN]*) dflt='n' ;;
9222    *)   dflt='y' ;;
9223    esac
9224    cat <<EOM
9225
9226 Perl can be built to understand large files (files larger than 2 gigabytes)
9227 on some systems.  To do so, Configure can be run with -Duselargefiles.
9228
9229 If this doesn't make any sense to you, just accept the default '$dflt'.
9230 EOM
9231    rp='Try to understand large files, if available?'
9232    . ./myread
9233    case "$ans" in
9234    y|Y)         val="$define" ;;
9235    *)           val="$undef"  ;;
9236    esac
9237    ;;
9238 esac
9239 set uselargefiles
9240 eval $setvar
9241 : Look for a hint-file generated 'call-back-unit'.  If the
9242 : user has specified that a large files perl is to be built,
9243 : we may need to set or change some other defaults.
9244 if $test -f uselargefiles.cbu; then
9245         echo "Your platform has some specific hints regarding large file builds, using them..."
9246         . ./uselargefiles.cbu
9247 fi
9248 case "$uselargefiles" in
9249 "$define")
9250         if $test -f uselargefiles.cbu; then
9251                 echo " "
9252                 echo "Rechecking to see how big your file offsets are..." >&4
9253                 $cat >try.c <<EOCP
9254 #include <sys/types.h>
9255 #include <stdio.h>
9256 int main()
9257 {
9258     printf("%d\n", (int)sizeof($lseektype));
9259     return(0);
9260 }
9261 EOCP
9262                 set try
9263                 if eval $compile_ok; then
9264                         lseeksize=`$run ./try`
9265                         $echo "Your file offsets are now $lseeksize bytes long."
9266                 else
9267                         dflt="$lseeksize"
9268                         echo " "
9269                         echo "(I can't seem to compile the test program.  Guessing...)"
9270                         rp="What is the size of your file offsets (in bytes)?"
9271                         . ./myread
9272                         lseeksize="$ans"
9273                 fi
9274                 case "$fpostype" in
9275                 *_t) zzz="$fpostype"    ;;
9276                 *)   zzz="fpos_t"       ;;
9277                 esac
9278                 $echo $n "Rechecking the size of $zzz...$c" >&4
9279                 $cat > try.c <<EOCP
9280 #include <sys/types.h>
9281 #include <stdio.h>
9282 #$i_stdlib I_STDLIB
9283 #ifdef I_STDLIB
9284 #include <stdlib.h>
9285 #endif
9286 int main() {
9287     printf("%d\n", (int)sizeof($fpostype));
9288     return(0);
9289 }
9290 EOCP
9291                 set try
9292                 if eval $compile_ok; then
9293                         yyy=`$run ./try`
9294                         dflt="$lseeksize"
9295                         case "$yyy" in
9296                         '')     echo " "
9297                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9298                                 ;;
9299                         *)      fpossize=$yyy
9300                                 echo " $fpossize bytes." >&4
9301                                 ;;
9302                         esac
9303                 else
9304                         dflt="$fpossize"
9305                         echo " "
9306                         echo "(I can't compile the test program.  Guessing...)" >&4
9307                         rp="What is the size of your file positions (in bytes)?"
9308                         . ./myread
9309                         fpossize="$ans"
9310                 fi
9311                 $rm_try
9312         fi
9313         ;;
9314 esac
9315
9316 : Set the vendorbin variables
9317 case "$vendorprefix" in
9318 '')     d_vendorbin="$undef"
9319         vendorbin=''
9320         vendorbinexp=''
9321         ;;
9322 *)      d_vendorbin="$define"
9323         : determine where vendor-supplied executables go.
9324         case "$vendorbin" in
9325         '') dflt=$vendorprefix/bin ;;
9326         *)      dflt="$vendorbin" ;;
9327         esac
9328         fn=d~+
9329         rp='Pathname for the vendor-supplied executables directory?'
9330         . ./getfile
9331         vendorbin="$ans"
9332         vendorbinexp="$ansexp"
9333         ;;
9334 esac
9335 prefixvar=vendorbin
9336 . ./installprefix
9337
9338 : Set the vendorhtml1dir variables
9339 case "$vendorprefix" in
9340 '')     vendorhtml1dir=''
9341         vendorhtml1direxp=''
9342         ;;
9343 *)      : determine where vendor-supplied html pages go.
9344         : There is no standard location, so try to copy the previously-selected
9345         : directory structure for the core html pages.
9346         : XXX Better default suggestions would be welcome.
9347         case "$vendorhtml1dir" in
9348         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9349         *)      dflt=$vendorhtml1dir ;;
9350         esac
9351         case "$dflt" in
9352         ''|' ') dflt=none ;;
9353         esac
9354         fn=dn+~
9355         rp='Pathname for the vendor-supplied html pages?'
9356         . ./getfile
9357         vendorhtml1dir="$ans"
9358         vendorhtml1direxp="$ansexp"
9359         ;;
9360 esac
9361 : Use ' ' for none so value is preserved next time through Configure
9362 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9363 prefixvar=vendorhtml1dir
9364 . ./installprefix
9365
9366 : Set the vendorhtml3dir variables
9367 case "$vendorprefix" in
9368 '')     vendorhtml3dir=''
9369         vendorhtml3direxp=''
9370         ;;
9371 *)      : determine where vendor-supplied module html pages go.
9372         : There is no standard location, so try to copy the previously-selected
9373         : directory structure for the core html pages.
9374         : XXX Better default suggestions would be welcome.
9375         case "$vendorhtml3dir" in
9376         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9377         *)      dflt=$vendorhtml3dir ;;
9378         esac
9379         case "$dflt" in
9380         ''|' ') dflt=none ;;
9381         esac
9382         fn=dn+~
9383         rp='Pathname for the vendor-supplied html pages?'
9384         . ./getfile
9385         vendorhtml3dir="$ans"
9386         vendorhtml3direxp="$ansexp"
9387         ;;
9388 esac
9389 : Use ' ' for none so value is preserved next time through Configure
9390 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9391 prefixvar=vendorhtml3dir
9392 . ./installprefix
9393
9394 : Set the vendorman1dir variables
9395 case "$vendorprefix" in
9396 '')     vendorman1dir=''
9397         vendorman1direxp=''
9398         ;;
9399 *)      : determine where vendor-supplied manual pages go.
9400         case "$vendorman1dir" in
9401         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9402         *)      dflt=$vendorman1dir ;;
9403         esac
9404         case "$dflt" in
9405         ''|' ') dflt=none ;;
9406         esac
9407         fn=nd~+
9408         rp='Pathname for the vendor-supplied manual section 1 pages?'
9409         . ./getfile
9410         vendorman1dir="$ans"
9411         vendorman1direxp="$ansexp"
9412         ;;
9413 esac
9414 : Use ' ' for none so value is preserved next time through Configure
9415 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9416 prefixvar=vendorman1dir
9417 . ./installprefix
9418
9419 : Set the vendorman3dir variables
9420 case "$vendorprefix" in
9421 '')     vendorman3dir=''
9422         vendorman3direxp=''
9423         ;;
9424 *)      : determine where vendor-supplied module manual pages go.
9425         case "$vendorman3dir" in
9426         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9427         *)      dflt=$vendorman3dir ;;
9428         esac
9429         case "$dflt" in
9430         ''|' ') dflt=none ;;
9431         esac
9432         fn=nd~+
9433         rp='Pathname for the vendor-supplied manual section 3 pages?'
9434         . ./getfile
9435         vendorman3dir="$ans"
9436         vendorman3direxp="$ansexp"
9437         ;;
9438 esac
9439 : Use ' ' for none so value is preserved next time through Configure
9440 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9441 prefixvar=vendorman3dir
9442 . ./installprefix
9443
9444 : Set the vendorscript variables
9445 case "$vendorprefix" in
9446 '')     d_vendorscript="$undef"
9447         vendorscript=''
9448         vendorscriptexp=''
9449         ;;
9450 *)      d_vendorscript="$define"
9451         : determine where vendor-supplied scripts go.
9452         case "$vendorscript" in
9453         '')     dflt=$vendorprefix/script
9454                 $test -d $dflt || dflt=$vendorbin ;;
9455         *)  dflt="$vendorscript" ;;
9456         esac
9457         $cat <<EOM
9458
9459 The installation process will create a directory for
9460 vendor-supplied scripts.
9461
9462 EOM
9463         fn=d~+
9464         rp='Pathname for the vendor-supplied scripts directory?'
9465         . ./getfile
9466         vendorscript="$ans"
9467         vendorscriptexp="$ansexp"
9468         ;;
9469 esac
9470 prefixvar=vendorscript
9471 . ./installprefix
9472
9473 : see if qgcvt exists
9474 set qgcvt d_qgcvt
9475 eval $inlibc
9476
9477 : Check print/scan long double stuff
9478 echo " "
9479
9480 if $test X"$d_longdbl" = X"$define"; then
9481
9482 echo "Checking how to print long doubles..." >&4
9483
9484 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9485         $cat >try.c <<'EOCP'
9486 #include <sys/types.h>
9487 #include <stdio.h>
9488 int main() {
9489   double d = 123.456;
9490   printf("%.3f\n", d);
9491 }
9492 EOCP
9493         set try
9494         if eval $compile; then
9495                 yyy=`$run ./try`
9496                 case "$yyy" in
9497                 123.456)
9498                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9499                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9500                         echo "We will use %f."
9501                         ;;
9502                 esac
9503         fi
9504 fi
9505
9506 if $test X"$sPRIfldbl" = X; then
9507         $cat >try.c <<'EOCP'
9508 #include <sys/types.h>
9509 #include <stdio.h>
9510 int main() {
9511   long double d = 123.456;
9512   printf("%.3Lf\n", d);
9513 }
9514 EOCP
9515         set try
9516         if eval $compile; then
9517                 yyy=`$run ./try`
9518                 case "$yyy" in
9519                 123.456)
9520                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9521                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9522                         echo "We will use %Lf."
9523                         ;;
9524                 esac
9525         fi
9526 fi
9527
9528 if $test X"$sPRIfldbl" = X; then
9529         $cat >try.c <<'EOCP'
9530 #include <sys/types.h>
9531 #include <stdio.h>
9532 int main() {
9533   long double d = 123.456;
9534   printf("%.3llf\n", d);
9535 }
9536 EOCP
9537         set try
9538         if eval $compile; then
9539                 yyy=`$run ./try`
9540                 case "$yyy" in
9541                 123.456)
9542                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9543                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9544                         echo "We will use %llf."
9545                         ;;
9546                 esac
9547         fi
9548 fi
9549
9550 if $test X"$sPRIfldbl" = X; then
9551         $cat >try.c <<'EOCP'
9552 #include <sys/types.h>
9553 #include <stdio.h>
9554 int main() {
9555   long double d = 123.456;
9556   printf("%.3lf\n", d);
9557 }
9558 EOCP
9559         set try
9560         if eval $compile; then
9561                 yyy=`$run ./try`
9562                 case "$yyy" in
9563                 123.456)
9564                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9565                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9566                         echo "We will use %lf."
9567                         ;;
9568                 esac
9569         fi
9570 fi
9571
9572 if $test X"$sPRIfldbl" = X; then
9573         echo "Cannot figure out how to print long doubles." >&4
9574 else
9575         sSCNfldbl=$sPRIfldbl    # expect consistency
9576 fi
9577
9578 $rm_try
9579
9580 fi # d_longdbl
9581
9582 case "$sPRIfldbl" in
9583 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9584         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9585         d_SCNfldbl="$undef";
9586         ;;
9587 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9588         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9589         d_SCNfldbl="$define";
9590         ;;
9591 esac
9592
9593 : Check how to convert floats to strings.
9594
9595 if test "X$d_Gconvert" = X; then
9596
9597 echo " "
9598 echo "Checking for an efficient way to convert floats to strings."
9599 echo " " > try.c
9600 case "$uselongdouble" in
9601 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9602 esac
9603 case "$d_longdbl" in
9604 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9605 esac
9606 case "$d_PRIgldbl" in
9607 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9608 esac
9609 $cat >>try.c <<EOP
9610 #ifdef TRY_gconvert
9611 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9612 char *myname = "gconvert";
9613 #endif
9614 #ifdef TRY_gcvt
9615 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9616 char *myname = "gcvt";
9617 #endif
9618 #ifdef TRY_qgcvt
9619 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9620 char *myname = "qgcvt";
9621 #define DOUBLETYPE long double
9622 #endif
9623 #ifdef TRY_sprintf
9624 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9625 #ifdef HAS_PRIgldbl
9626 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9627 #else
9628 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9629 #endif
9630 #else
9631 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9632 #endif
9633 char *myname = "sprintf";
9634 #endif
9635
9636 #ifndef DOUBLETYPE
9637 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9638 #define DOUBLETYPE long double
9639 #else
9640 #define DOUBLETYPE double
9641 #endif
9642 #endif
9643
9644 #include <stdio.h>
9645
9646 #define I_STDLIB $i_stdlib
9647 #ifdef I_STDLIB
9648 #include <stdlib.h>
9649 #endif
9650
9651 int
9652 checkit(expect, got)
9653 char *expect;
9654 char *got;
9655 {
9656     if (strcmp(expect, got)) {
9657                 printf("%s oddity:  Expected %s, got %s\n",
9658                         myname, expect, got);
9659                 exit(1);
9660         }
9661 }
9662
9663 int main()
9664 {
9665         char buf[64];
9666         buf[63] = '\0';
9667
9668         /* This must be 1st test on (which?) platform */
9669         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9670         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9671         checkit("0.1", buf);
9672
9673         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9674         checkit("0.01", buf);
9675
9676         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9677         checkit("0.001", buf);
9678
9679         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9680         checkit("0.0001", buf);
9681
9682         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9683         if (strlen(buf) > 5)
9684             checkit("9e-005", buf); /* for Microsoft ?? */
9685         else
9686             checkit("9e-05", buf);
9687
9688         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9689         checkit("1", buf);
9690
9691         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9692         checkit("1.1", buf);
9693
9694         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9695         checkit("1.01", buf);
9696
9697         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9698         checkit("1.001", buf);
9699
9700         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9701         checkit("1.0001", buf);
9702
9703         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9704         checkit("1.00001", buf);
9705
9706         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9707         checkit("1.000001", buf);
9708
9709         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9710         checkit("0", buf);
9711
9712         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9713         checkit("-1", buf);
9714
9715         /* Some Linux gcvt's give 1.e+5 here. */
9716         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9717         checkit("100000", buf);
9718
9719         /* Some Linux gcvt's give -1.e+5 here. */
9720         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9721         checkit("-100000", buf);
9722
9723         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9724         checkit("123.456", buf);
9725
9726         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9727         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9728         /* 34 should be enough to scare even long double
9729          * places into using the e notation. */
9730         if (strlen(buf) > 5)
9731             checkit("1e+034", buf); /* for Microsoft */
9732         else
9733             checkit("1e+34", buf);
9734
9735         /* For Perl, if you add additional tests here, also add them to
9736          * t/base/num.t for benefit of platforms not using Configure or
9737          * overriding d_Gconvert */
9738
9739         exit(0);
9740 }
9741 EOP
9742 : first add preferred functions to our list
9743 xxx_list=""
9744 for xxx_convert in $gconvert_preference; do
9745     case $xxx_convert in
9746     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9747     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9748     esac
9749 done
9750 : then add any others
9751 for xxx_convert in gconvert gcvt sprintf; do
9752     case "$xxx_list" in
9753     *$xxx_convert*) ;;
9754     *) xxx_list="$xxx_list $xxx_convert" ;;
9755     esac
9756 done
9757
9758 case "$d_longdbl$uselongdouble" in
9759 "$define$define")
9760     : again, add prefered functions to our list first
9761     xxx_ld_list=""
9762     for xxx_convert in $gconvert_ld_preference; do
9763         case $xxx_convert in
9764         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9765         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9766         esac
9767     done
9768     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9769     for xxx_convert in qgcvt sprintf $xxx_list; do
9770         case "$xxx_ld_list" in
9771         $xxx_convert*|*" $xxx_convert"*) ;;
9772         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9773         esac
9774     done
9775     : if sprintf cannot do long doubles, move it to the end
9776     if test "$d_PRIgldbl" != "$define"; then
9777         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9778     fi
9779     : if no qgcvt, remove it
9780     if test "$d_qgcvt" != "$define"; then
9781         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9782     fi
9783     : use the ld_list
9784     xxx_list="$xxx_ld_list"
9785     ;;
9786 esac
9787
9788 for xxx_convert in $xxx_list; do
9789         echo "Trying $xxx_convert..."
9790         $rm -f try try$_o core
9791         set try -DTRY_$xxx_convert
9792         if eval $compile; then
9793                 echo "$xxx_convert() found." >&4
9794                 if $run ./try; then
9795                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9796                         break;
9797                 else
9798                         echo "...But $xxx_convert didn't work as I expected."
9799                         xxx_convert=''
9800                 fi
9801         else
9802                 echo "$xxx_convert NOT found." >&4
9803         fi
9804 done
9805
9806 if test X$xxx_convert = X; then
9807     echo "*** WHOA THERE!!! ***" >&4
9808     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9809     xxx_convert=sprintf
9810 fi
9811
9812 case "$xxx_convert" in
9813 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9814 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9815 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9816 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9817    "$define$define$define")
9818       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9819    "$define$define$undef")
9820       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9821    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9822    esac
9823    ;;
9824 esac
9825
9826 fi
9827 $rm_try
9828
9829 : see if _fwalk exists
9830 set fwalk d__fwalk
9831 eval $inlibc
9832
9833 : Initialize h_fcntl
9834 h_fcntl=false
9835
9836 : Initialize h_sysfile
9837 h_sysfile=false
9838
9839 : access call always available on UNIX
9840 set access d_access
9841 eval $inlibc
9842
9843 : locate the flags for 'access()'
9844 case "$d_access" in
9845 "$define")
9846         echo " "
9847         $cat >access.c <<EOCP
9848 #include <sys/types.h>
9849 #ifdef I_FCNTL
9850 #include <fcntl.h>
9851 #endif
9852 #ifdef I_SYS_FILE
9853 #include <sys/file.h>
9854 #endif
9855 #ifdef I_UNISTD
9856 #include <unistd.h>
9857 #endif
9858 #$i_stdlib I_STDLIB
9859 #ifdef I_STDLIB
9860 #include <stdlib.h>
9861 #endif
9862 int main() {
9863         exit(R_OK);
9864 }
9865 EOCP
9866         : check sys/file.h first, no particular reason here
9867         if $test `./findhdr sys/file.h` && \
9868                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9869                 h_sysfile=true;
9870                 echo "<sys/file.h> defines the *_OK access constants." >&4
9871         elif $test `./findhdr fcntl.h` && \
9872                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9873                 h_fcntl=true;
9874                 echo "<fcntl.h> defines the *_OK access constants." >&4
9875         elif $test `./findhdr unistd.h` && \
9876                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9877                 echo "<unistd.h> defines the *_OK access constants." >&4
9878         else
9879                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9880         fi
9881         ;;
9882 esac
9883 $rm -f access*
9884
9885 : see if accessx exists
9886 set accessx d_accessx
9887 eval $inlibc
9888
9889 : see if aintl exists
9890 set aintl d_aintl
9891 eval $inlibc
9892
9893 : see if alarm exists
9894 set alarm d_alarm
9895 eval $inlibc
9896
9897 : see if POSIX threads are available
9898 set pthread.h i_pthread
9899 eval $inhdr
9900
9901 : define a fucntion to check prototypes
9902 $cat > protochk <<EOSH
9903 $startsh
9904 cc="$cc"
9905 optimize="$optimize"
9906 ccflags="$ccflags"
9907 prototype="$prototype"
9908 define="$define"
9909 rm_try="$rm_try"
9910 usethreads=$usethreads
9911 i_pthread=$i_pthread
9912 pthread_h_first=$pthread_h_first
9913 EOSH
9914
9915 $cat >> protochk <<'EOSH'
9916
9917 $rm_try
9918 foo="$1"
9919 shift
9920 while test $# -ge 2; do
9921         case "$1" in
9922                 $define) echo "#include <$2>" >> try.c ;;
9923                 literal) echo "$2" >> try.c ;;
9924         esac
9925     # Extra magic for the benefit of systems that need pthread.h
9926     # to be included early to correctly detect threadsafe functions.
9927     # Such functions must guarantee themselves, though, that the usethreads
9928     # and i_pthread have been defined, before calling protochk.
9929     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9930         echo "#include <pthread.h>" >> try.c
9931         pthread_h_done=yes
9932     fi
9933     shift 2
9934 done
9935 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9936 cat >> try.c <<'EOCP'
9937 #ifdef CAN_PROTOTYPE
9938 #define _(args) args
9939 #else
9940 #define _(args) ()
9941 #endif
9942 EOCP
9943 echo "$foo" >> try.c
9944 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9945 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9946 status=$?
9947 $rm_try
9948 exit $status
9949 EOSH
9950 chmod +x protochk
9951 $eunicefix protochk
9952
9953 : Define hasproto macro for Configure internal use
9954 hasproto='varname=$1; func=$2; shift; shift;
9955 while $test $# -ge 2; do
9956         case "$1" in
9957         $define) echo "#include <$2>";;
9958         esac ;
9959     shift 2;
9960 done > try.c;
9961 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9962 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9963         echo "$func() prototype found.";
9964         val="$define";
9965 else
9966         echo "$func() prototype NOT found.";
9967         val="$undef";
9968 fi;
9969 set $varname;
9970 eval $setvar;
9971 $rm_try tryout.c'
9972
9973 : see if sys/types.h has to be included
9974 set sys/types.h i_systypes
9975 eval $inhdr
9976
9977 : see if sys/select.h has to be included
9978 set sys/select.h i_sysselct
9979 eval $inhdr
9980
9981 : Define hasfield macro for Configure internal use
9982 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9983 while $test $# -ge 2; do
9984         case "$1" in
9985         $define) echo "#include <$2>";;
9986         esac ;
9987     shift 2;
9988 done > try.c;
9989 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9990 set try;
9991 if eval $compile; then
9992         val="$define";
9993 else
9994         val="$undef";
9995 fi;
9996 set $varname;
9997 eval $setvar;
9998 $rm_try'
9999
10000 : see if we should include time.h, sys/time.h, or both
10001 echo " "
10002 if test "X$timeincl" = X; then
10003         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10004         $echo $n "I'm now running the test program...$c"
10005         $cat >try.c <<EOCP
10006 #include <sys/types.h>
10007 #ifdef I_TIME
10008 #include <time.h>
10009 #endif
10010 #ifdef I_SYSTIME
10011 #ifdef SYSTIMEKERNEL
10012 #define KERNEL
10013 #endif
10014 #include <sys/time.h>
10015 #endif
10016 #ifdef I_SYSSELECT
10017 #include <sys/select.h>
10018 #endif
10019 #$i_stdlib I_STDLIB
10020 #ifdef I_STDLIB
10021 #include <stdlib.h>
10022 #endif
10023 int main()
10024 {
10025         struct tm foo;
10026 #ifdef S_TIMEVAL
10027         struct timeval bar;
10028 #endif
10029 #ifdef S_TIMEZONE
10030         struct timezone tzp;
10031 #endif
10032         if (foo.tm_sec == foo.tm_sec)
10033                 exit(0);
10034 #ifdef S_TIMEVAL
10035         if (bar.tv_sec == bar.tv_sec)
10036                 exit(0);
10037 #endif
10038         exit(1);
10039 }
10040 EOCP
10041         flags=''
10042         for s_timezone in '-DS_TIMEZONE' ''; do
10043         sysselect=''
10044         for s_timeval in '-DS_TIMEVAL' ''; do
10045         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10046         for i_time in '' '-DI_TIME'; do
10047         for i_systime in '-DI_SYSTIME' ''; do
10048                 case "$flags" in
10049                 '') $echo $n ".$c"
10050                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10051                         if eval $compile; then
10052                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10053                                 shift
10054                                 flags="$*"
10055                                 echo " "
10056                                 $echo $n "Succeeded with $flags$c"
10057                         fi
10058                         ;;
10059                 esac
10060         done
10061         done
10062         done
10063         done
10064         done
10065         timeincl=''
10066         echo " "
10067         case "$flags" in
10068         *SYSTIMEKERNEL*) i_systimek="$define"
10069                 timeincl=`./findhdr sys/time.h`
10070                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10071         *) i_systimek="$undef";;
10072         esac
10073         case "$flags" in
10074         *I_TIME*) i_time="$define"
10075                 timeincl=`./findhdr time.h`" $timeincl"
10076                 echo "We'll include <time.h>." >&4;;
10077         *) i_time="$undef";;
10078         esac
10079         case "$flags" in
10080         *I_SYSTIME*) i_systime="$define"
10081                 timeincl=`./findhdr sys/time.h`" $timeincl"
10082                 echo "We'll include <sys/time.h>." >&4;;
10083         *) i_systime="$undef";;
10084         esac
10085         $rm_try
10086 fi
10087 : see if struct tm knows about tm_zone
10088 case "$i_systime$i_time" in
10089 *$define*)
10090         echo " "
10091         echo "Checking to see if your struct tm has tm_zone field..." >&4
10092         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10093         eval $hasfield
10094         ;;
10095 *)      val="$undef"
10096         set d_tm_tm_zone
10097         eval $setvar
10098         ;;
10099 esac
10100 case "$d_tm_tm_zone" in
10101 "$define")      echo "Yes, it does."   ;;
10102 *)              echo "No, it doesn't." ;;
10103 esac
10104 : see if struct tm knows about tm_gmtoff
10105 case "$i_systime$i_time" in
10106 *$define*)
10107         echo " "
10108         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10109         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10110         eval $hasfield
10111         ;;
10112 *)      val="$undef"
10113         set d_tm_tm_gmtoff
10114         eval $setvar
10115         ;;
10116 esac
10117 case "$d_tm_tm_gmtoff" in
10118 "$define")      echo "Yes, it does."   ;;
10119 *)              echo "No, it doesn't." ;;
10120 esac
10121
10122 : see if asctime_r exists
10123 set asctime_r d_asctime_r
10124 eval $inlibc
10125 case "$d_asctime_r" in
10126 "$define")
10127         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10128         case "$d_asctime_r_proto:$usethreads" in
10129         ":define")      d_asctime_r_proto=define
10130                 set d_asctime_r_proto asctime_r $hdrs
10131                 eval $hasproto ;;
10132         *)      ;;
10133         esac
10134         case "$d_asctime_r_proto" in
10135         define)
10136         case "$asctime_r_proto" in
10137         ''|0) try='char* asctime_r(const struct tm*, char*);'
10138         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
10139         esac
10140         case "$asctime_r_proto" in
10141         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10142         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
10143         esac
10144         case "$asctime_r_proto" in
10145         ''|0) try='int asctime_r(const struct tm*, char*);'
10146         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
10147         esac
10148         case "$asctime_r_proto" in
10149         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10150         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
10151         esac
10152         case "$asctime_r_proto" in
10153         ''|0)   d_asctime_r=undef
10154                 asctime_r_proto=0
10155                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10156         * )     case "$asctime_r_proto" in
10157                 REENTRANT_PROTO*) ;;
10158                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10159                 esac
10160                 echo "Prototype: $try" ;;
10161         esac
10162         ;;
10163         *)      case "$usethreads" in
10164                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10165                 esac
10166                 d_asctime_r=undef
10167                 asctime_r_proto=0
10168                 ;;
10169         esac
10170         ;;
10171 *)      asctime_r_proto=0
10172         ;;
10173 esac
10174
10175 : see if atolf exists
10176 set atolf d_atolf
10177 eval $inlibc
10178
10179 : see if atoll exists
10180 set atoll d_atoll
10181 eval $inlibc
10182
10183 : Look for GCC-style attribute format
10184 case "$d_attribute_format" in
10185 '')
10186 echo " "
10187 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10188 $cat >attrib.c <<'EOCP'
10189 #include <stdio.h>
10190 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10191 EOCP
10192 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10193         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10194                 echo "Your C compiler doesn't support __attribute__((format))."
10195                 val="$undef"
10196         else
10197                 echo "Your C compiler supports __attribute__((format))."
10198                 val="$define"
10199         fi
10200 else
10201         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10202         val="$undef"
10203 fi
10204 ;;
10205 *) val="$d_attribute_format" ;;
10206 esac
10207 set d_attribute_format
10208 eval $setvar
10209 $rm -f attrib*
10210
10211 : Look for GCC-style attribute format with null format allowed
10212 case "$d_printf_format_null" in
10213 '') case "$d_attribute_format" in
10214     $define)
10215         echo " "
10216         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10217 $cat >attrib.c <<EOCP
10218 #include <stdio.h>
10219 #$i_stdlib I_STDLIB
10220 #ifdef I_STDLIB
10221 #include <stdlib.h>
10222 #endif
10223 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10224 int null_printf (char* pat,...) { return (int)pat; }
10225 int main () { exit(null_printf(NULL)); }
10226 EOCP
10227         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10228             : run the executable in case it produces a run-time warning
10229             if $run ./attrib >>attrib.out 2>&1; then
10230                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10231                     echo "Your C compiler doesn't allow __printf__ format to be null."
10232                     val="$undef"
10233                 else
10234                     echo "Your C compiler allows __printf__ format to be null."
10235                     val="$define"
10236                 fi
10237             else
10238             echo "Your C compiler executable failed with __printf__ format null."
10239             val="$undef"
10240         fi
10241     else
10242         echo "Your C compiler fails with __printf__ format null."
10243         val="$undef"
10244     fi
10245     ;;
10246     *)  val="$undef" ;;
10247     esac
10248 ;;
10249 *)  val="$d_printf_format_null" ;;
10250 esac
10251 set d_printf_format_null
10252 eval $setvar
10253 $rm -f attrib*
10254
10255 : Look for GCC-style attribute malloc
10256 case "$d_attribute_malloc" in
10257 '')
10258 echo " "
10259 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10260 $cat >attrib.c <<'EOCP'
10261 #include <stdio.h>
10262 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10263 EOCP
10264 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10265         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10266                 echo "Your C compiler doesn't support __attribute__((malloc))."
10267                 val="$undef"
10268         else
10269                 echo "Your C compiler supports __attribute__((malloc))."
10270                 val="$define"
10271         fi
10272 else
10273         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10274         val="$undef"
10275 fi
10276 ;;
10277 *) val="$d_attribute_malloc" ;;
10278 esac
10279 set d_attribute_malloc
10280 eval $setvar
10281 $rm -f attrib*
10282
10283 : Look for GCC-style attribute nonnull
10284 case "$d_attribute_nonnull" in
10285 '')
10286 echo " "
10287 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10288 $cat >attrib.c <<'EOCP'
10289 #include <stdio.h>
10290 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10291 EOCP
10292 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10293         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10294                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10295                 val="$undef"
10296         else
10297                 echo "Your C compiler supports __attribute__((nonnull))."
10298                 val="$define"
10299         fi
10300 else
10301         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10302         val="$undef"
10303 fi
10304 ;;
10305 *) val="$d_attribute_nonnull" ;;
10306 esac
10307 set d_attribute_nonnull
10308 eval $setvar
10309 $rm -f attrib*
10310
10311 : Look for GCC-style attribute noreturn
10312 case "$d_attribute_noreturn" in
10313 '')
10314 echo " "
10315 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10316 $cat >attrib.c <<'EOCP'
10317 #include <stdio.h>
10318 void fall_over_dead( void ) __attribute__((noreturn));
10319 EOCP
10320 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10321         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10322                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10323                 val="$undef"
10324         else
10325                 echo "Your C compiler supports __attribute__((noreturn))."
10326                 val="$define"
10327         fi
10328 else
10329         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10330         val="$undef"
10331 fi
10332 ;;
10333 *) val="$d_attribute_noreturn" ;;
10334 esac
10335 set d_attribute_noreturn
10336 eval $setvar
10337 $rm -f attrib*
10338
10339 : Look for GCC-style attribute pure
10340 case "$d_attribute_pure" in
10341 '')
10342 echo " "
10343 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10344 $cat >attrib.c <<'EOCP'
10345 #include <stdio.h>
10346 int square( int n ) __attribute__((pure));
10347 EOCP
10348 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10349         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10350                 echo "Your C compiler doesn't support __attribute__((pure))."
10351                 val="$undef"
10352         else
10353                 echo "Your C compiler supports __attribute__((pure))."
10354                 val="$define"
10355         fi
10356 else
10357         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10358         val="$undef"
10359 fi
10360 ;;
10361 *) val="$d_attribute_pure" ;;
10362 esac
10363 set d_attribute_pure
10364 eval $setvar
10365 $rm -f attrib*
10366
10367 : Look for GCC-style attribute unused
10368 case "$d_attribute_unused" in
10369 '')
10370 echo " "
10371 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10372 $cat >attrib.c <<'EOCP'
10373 #include <stdio.h>
10374 int do_something( int dummy __attribute__((unused)), int n );
10375 EOCP
10376 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10377         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10378                 echo "Your C compiler doesn't support __attribute__((unused))."
10379                 val="$undef"
10380         else
10381                 echo "Your C compiler supports __attribute__((unused))."
10382                 val="$define"
10383         fi
10384 else
10385         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10386         val="$undef"
10387 fi
10388 ;;
10389 *) val="$d_attribute_unused" ;;
10390 esac
10391 set d_attribute_unused
10392 eval $setvar
10393 $rm -f attrib*
10394
10395 : Look for GCC-style attribute warn_unused_result
10396 case "$d_attribute_warn_unused_result" in
10397 '')
10398 echo " "
10399 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10400 $cat >attrib.c <<'EOCP'
10401 #include <stdio.h>
10402 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10403 EOCP
10404 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10405         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10406                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10407                 val="$undef"
10408         else
10409                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10410                 val="$define"
10411         fi
10412 else
10413         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10414         val="$undef"
10415 fi
10416 ;;
10417 *) val="$d_attribute_warn_unused_result" ;;
10418 esac
10419 set d_attribute_warn_unused_result
10420 eval $setvar
10421 $rm -f attrib*
10422
10423 : see if bcmp exists
10424 set bcmp d_bcmp
10425 eval $inlibc
10426
10427 : see if bcopy exists
10428 set bcopy d_bcopy
10429 eval $inlibc
10430
10431 : see if getpgrp exists
10432 set getpgrp d_getpgrp
10433 eval $inlibc
10434
10435 case "$d_getpgrp" in
10436 "$define")
10437         echo " "
10438         echo "Checking to see which flavor of getpgrp is in use..."
10439         $cat >try.c <<EOP
10440 #$i_unistd I_UNISTD
10441 #include <sys/types.h>
10442 #ifdef I_UNISTD
10443 #  include <unistd.h>
10444 #endif
10445 #$i_stdlib I_STDLIB
10446 #ifdef I_STDLIB
10447 #include <stdlib.h>
10448 #endif
10449 int main()
10450 {
10451         if (getuid() == 0) {
10452                 printf("(I see you are running Configure as super-user...)\n");
10453                 setuid(1);
10454         }
10455 #ifdef TRY_BSD_PGRP
10456         if (getpgrp(1) == 0)
10457                 exit(0);
10458 #else
10459         if (getpgrp() > 0)
10460                 exit(0);
10461 #endif
10462         exit(1);
10463 }
10464 EOP
10465         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10466                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10467                 val="$define"
10468         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10469                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10470                 val="$undef"
10471         else
10472                 echo "I can't seem to compile and run the test program."
10473                 if ./usg; then
10474                         xxx="a USG one, i.e. you use getpgrp()."
10475                 else
10476                         # SVR4 systems can appear rather BSD-ish.
10477                         case "$i_unistd" in
10478                         $undef)
10479                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10480                                 val="$define"
10481                                 ;;
10482                         $define)
10483                                 xxx="probably a USG one, i.e. you use getpgrp()."
10484                                 val="$undef"
10485                                 ;;
10486                         esac
10487                 fi
10488                 echo "Assuming your getpgrp is $xxx" >&4
10489         fi
10490         ;;
10491 *) val="$undef";;
10492 esac
10493 set d_bsdgetpgrp
10494 eval $setvar
10495 $rm_try
10496
10497 : see if setpgrp exists
10498 set setpgrp d_setpgrp
10499 eval $inlibc
10500
10501 case "$d_setpgrp" in
10502 "$define")
10503         echo " "
10504         echo "Checking to see which flavor of setpgrp is in use..."
10505         $cat >try.c <<EOP
10506 #$i_unistd I_UNISTD
10507 #include <sys/types.h>
10508 #ifdef I_UNISTD
10509 #  include <unistd.h>
10510 #endif
10511 #$i_stdlib I_STDLIB
10512 #ifdef I_STDLIB
10513 #include <stdlib.h>
10514 #endif
10515 int main()
10516 {
10517         if (getuid() == 0) {
10518                 printf("(I see you are running Configure as super-user...)\n");
10519                 setuid(1);
10520         }
10521 #ifdef TRY_BSD_PGRP
10522         if (-1 == setpgrp(1, 1))
10523                 exit(0);
10524 #else
10525         if (setpgrp() != -1)
10526                 exit(0);
10527 #endif
10528         exit(1);
10529 }
10530 EOP
10531         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10532                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10533                 val="$define"
10534         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10535                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10536                 val="$undef"
10537         else
10538                 echo "(I can't seem to compile and run the test program.)"
10539                 if ./usg; then
10540                         xxx="a USG one, i.e. you use setpgrp()."
10541                 else
10542                         # SVR4 systems can appear rather BSD-ish.
10543                         case "$i_unistd" in
10544                         $undef)
10545                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10546                                 val="$define"
10547                                 ;;
10548                         $define)
10549                                 xxx="probably a USG one, i.e. you use setpgrp()."
10550                                 val="$undef"
10551                                 ;;
10552                         esac
10553                 fi
10554                 echo "Assuming your setpgrp is $xxx" >&4
10555         fi
10556         ;;
10557 *) val="$undef";;
10558 esac
10559 set d_bsdsetpgrp
10560 eval $setvar
10561 $rm_try
10562
10563 : Look for GCC-style __builtin_choose_expr
10564 case "$d_builtin_choose_expr" in
10565 '')
10566     echo " "
10567     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10568     $cat >try.c <<'EOCP'
10569 #include <assert.h>
10570 #include <stdlib.h>
10571 #include <stdio.h>
10572
10573 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10574
10575 int main(void) {
10576     assert( SYRINX(1) == 2112 );
10577     assert( SYRINX(1) != 5150 );
10578     assert( SYRINX(0) == 5150 );
10579     assert( SYRINX(0) != 2112 );
10580     puts( "All good!" );
10581     exit(0);
10582 }
10583
10584 EOCP
10585     set try
10586     if eval $compile && $run ./try; then
10587         echo "Your C compiler supports __builtin_choose_expr."
10588         val="$define"
10589     else
10590         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10591         val="$undef"
10592     fi
10593 ;;
10594 *) val="$d_builtin_choose_expr" ;;
10595 esac
10596
10597 set d_builtin_choose_expr
10598 eval $setvar
10599 $rm_try
10600
10601 : Look for GCC-style __builtin_expect
10602 case "$d_builtin_expect" in
10603 '')
10604     echo " "
10605     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10606     $cat >try.c <<'EOCP'
10607 int main(void) {
10608     int n = 50;
10609     if ( __builtin_expect(n, 0) ) n = 1;
10610     /* Remember shell exit code truth is 0, C truth is non-zero */
10611     return !(n == 1);
10612 }
10613 EOCP
10614     set try
10615     if eval $compile && $run ./try; then
10616         echo "Your C compiler supports __builtin_expect."
10617         val="$define"
10618     else
10619         echo "Your C compiler doesn't seem to understand __builtin_expect."
10620         val="$undef"
10621     fi
10622     ;;
10623 *) val="$d_builtin_expect" ;;
10624 esac
10625
10626 set d_builtin_expect
10627 eval $setvar
10628 $rm_try
10629
10630 : see if bzero exists
10631 set bzero d_bzero
10632 eval $inlibc
10633
10634 : see if stdarg is available
10635 echo " "
10636 if $test `./findhdr stdarg.h`; then
10637         echo "<stdarg.h> found." >&4
10638         valstd="$define"
10639 else
10640         echo "<stdarg.h> NOT found." >&4
10641         valstd="$undef"
10642 fi
10643
10644 : see if varags is available
10645 echo " "
10646 if $test `./findhdr varargs.h`; then
10647         echo "<varargs.h> found." >&4
10648 else
10649         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10650 fi
10651
10652 : set up the varargs testing programs
10653 $cat > varargs.c <<EOP
10654 #ifdef I_STDARG
10655 #include <stdarg.h>
10656 #endif
10657 #ifdef I_VARARGS
10658 #include <varargs.h>
10659 #endif
10660
10661 #ifdef I_STDARG
10662 int f(char *p, ...)
10663 #else
10664 int f(va_alist)
10665 va_dcl
10666 #endif
10667 {
10668         va_list ap;
10669 #ifndef I_STDARG
10670         char *p;
10671 #endif
10672 #ifdef I_STDARG
10673         va_start(ap,p);
10674 #else
10675         va_start(ap);
10676         p = va_arg(ap, char *);
10677 #endif
10678         va_end(ap);
10679         return 0;
10680 }
10681 EOP
10682 $cat > varargs <<EOP
10683 $startsh
10684 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10685         echo "true"
10686 else
10687         echo "false"
10688 fi
10689 $rm -f varargs$_o
10690 EOP
10691 chmod +x varargs
10692
10693 : now check which varargs header should be included
10694 echo " "
10695 i_varhdr=''
10696 case "$valstd" in
10697 "$define")
10698         if `./varargs I_STDARG`; then
10699                 val='stdarg.h'
10700         elif `./varargs I_VARARGS`; then
10701                 val='varargs.h'
10702         fi
10703         ;;
10704 *)
10705         if `./varargs I_VARARGS`; then
10706                 val='varargs.h'
10707         fi
10708         ;;
10709 esac
10710 case "$val" in
10711 '')
10712 echo "I could not find the definition for va_dcl... You have problems..." >&4
10713         val="$undef"; set i_stdarg; eval $setvar
10714         val="$undef"; set i_varargs; eval $setvar
10715         ;;
10716 *)
10717         set i_varhdr
10718         eval $setvar
10719         case "$i_varhdr" in
10720         stdarg.h)
10721                 val="$define"; set i_stdarg; eval $setvar
10722                 val="$undef"; set i_varargs; eval $setvar
10723                 ;;
10724         varargs.h)
10725                 val="$undef"; set i_stdarg; eval $setvar
10726                 val="$define"; set i_varargs; eval $setvar
10727                 ;;
10728         esac
10729         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10730 esac
10731 $rm -f varargs*
10732
10733 : see if the Compiler supports C99 variadic macros
10734 case "$i_stdarg$i_stdlib" in
10735     "$define$define")
10736     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10737     $cat >try.c <<EOCP
10738 #include <stdio.h>
10739 #include <stdarg.h>
10740
10741 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10742
10743 int main() {
10744   char buf[20];
10745   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10746   puts(buf);
10747   return 0;
10748 }
10749 EOCP
10750     set try
10751     if eval $compile && $run ./try 2>&1 >/dev/null; then
10752         case "`$run ./try`" in
10753             "123 456 789")
10754             echo "You have C99 variadic macros." >&4
10755             d_c99_variadic_macros="$define"
10756             ;;
10757             *)
10758             echo "You don't have functional C99 variadic macros." >&4
10759             d_c99_variadic_macros="$undef"
10760             ;;
10761         esac
10762     else
10763         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10764         d_c99_variadic_macros="$undef"
10765     fi
10766     $rm_try
10767     ;;
10768     *)
10769     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10770     d_c99_variadic_macros="$undef"
10771     ;;
10772 esac
10773
10774 : see if signal is declared as pointer to function returning int or void
10775 echo " "
10776 xxx=`./findhdr signal.h`
10777 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10778 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10779         echo "You have int (*signal())() instead of void." >&4
10780         val="$undef"
10781 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10782         echo "You have void (*signal())()." >&4
10783         val="$define"
10784 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10785         echo "You have int (*signal())() instead of void." >&4
10786         val="$undef"
10787 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10788         echo "You have void (*signal())()." >&4
10789         val="$define"
10790 else
10791         case "$d_voidsig" in
10792         '')
10793         echo "I can't determine whether signal handler returns void or int..." >&4
10794                 dflt=void
10795                 rp="What type does your signal handler return?"
10796                 . ./myread
10797                 case "$ans" in
10798                 v*) val="$define";;
10799                 *) val="$undef";;
10800                 esac;;
10801         "$define")
10802                 echo "As you already told me, signal handler returns void." >&4
10803                 val="$define"
10804                 ;;
10805         *)      echo "As you already told me, signal handler returns int." >&4
10806                 val="$undef"
10807                 ;;
10808         esac
10809 fi
10810 set d_voidsig
10811 eval $setvar
10812 case "$d_voidsig" in
10813 "$define") signal_t="void";;
10814 *) signal_t="int";;
10815 esac
10816 $rm -f $$.tmp
10817
10818 : check for ability to cast large floats to 32-bit ints.
10819 echo " "
10820 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10821 if $test "$intsize" -ge 4; then
10822         xxx=int
10823 else
10824         xxx=long
10825 fi
10826 $cat >try.c <<EOCP
10827 #include <stdio.h>
10828 #$i_stdlib I_STDLIB
10829 #ifdef I_STDLIB
10830 #include <stdlib.h>
10831 #endif
10832 #include <sys/types.h>
10833 #include <signal.h>
10834 $signal_t blech(int s) { exit(3); }
10835 int main()
10836 {
10837         $xxx i32;
10838         double f, g;
10839         int result = 0;
10840         char str[16];
10841         signal(SIGFPE, blech);
10842
10843         /* Don't let compiler optimize the test away.  Store the number
10844            in a writable string for gcc to pass to sscanf under HP/UX.
10845         */
10846         sprintf(str, "2147483647");
10847         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10848         g = 10 * f;
10849         i32  = ($xxx) g;
10850
10851         /* x86 processors will probably give 0x8000 0000, which is a
10852            sign change.  We don't want that.  We want to mimic SPARC
10853            behavior here, which is to preserve the sign and give
10854            back 0x7fff ffff.
10855         */
10856         if (i32 != ($xxx) f)
10857                 result |= 1;
10858         exit(result);
10859 }
10860 EOCP
10861 set try
10862 if eval $compile_ok; then
10863         $run ./try
10864         yyy=$?
10865 else
10866         echo "(I can't seem to compile the test program--assuming it can't)"
10867         yyy=1
10868 fi
10869 case "$yyy" in
10870 0)      val="$define"
10871         echo "Yup, it can."
10872         ;;
10873 *)      val="$undef"
10874         echo "Nope, it can't."
10875         ;;
10876 esac
10877 set d_casti32
10878 eval $setvar
10879 $rm_try
10880
10881 : check for ability to cast negative floats to unsigned
10882 echo " "
10883 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10884 $cat >try.c <<EOCP
10885 #include <stdio.h>
10886 #$i_stdlib I_STDLIB
10887 #ifdef I_STDLIB
10888 #include <stdlib.h>
10889 #endif
10890 #include <sys/types.h>
10891 #include <signal.h>
10892 $signal_t blech(int s) { exit(7); }
10893 $signal_t blech_in_list(int s) { exit(4); }
10894 unsigned long dummy_long(unsigned long p) { return p; }
10895 unsigned int dummy_int(unsigned int p) { return p; }
10896 unsigned short dummy_short(unsigned short p) { return p; }
10897 int main()
10898 {
10899         double f;
10900         unsigned long along;
10901         unsigned int aint;
10902         unsigned short ashort;
10903         int result = 0;
10904         char str[16];
10905
10906         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10907            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10908            optimized the whole file away
10909         */
10910         /* Store the number in a writable string for gcc to pass to
10911            sscanf under HP/UX.
10912         */
10913         sprintf(str, "-123");
10914         sscanf(str, "%lf", &f);  /* f = -123.; */
10915
10916         signal(SIGFPE, blech);
10917         along = (unsigned long)f;
10918         aint = (unsigned int)f;
10919         ashort = (unsigned short)f;
10920         if (along != (unsigned long)-123)
10921                 result |= 1;
10922         if (aint != (unsigned int)-123)
10923                 result |= 1;
10924         if (ashort != (unsigned short)-123)
10925                 result |= 1;
10926         sprintf(str, "1073741824.");
10927         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10928         f = f + f;
10929         along = 0;
10930         along = (unsigned long)f;
10931         if (along != 0x80000000)
10932                 result |= 2;
10933         f -= 1.;
10934         along = 0;
10935         along = (unsigned long)f;
10936         if (along != 0x7fffffff)
10937                 result |= 1;
10938         f += 2.;
10939         along = 0;
10940         along = (unsigned long)f;
10941         if (along != 0x80000001)
10942                 result |= 2;
10943         if (result)
10944                 exit(result);
10945         signal(SIGFPE, blech_in_list);
10946         sprintf(str, "123.");
10947         sscanf(str, "%lf", &f);  /* f = 123.; */
10948         along = dummy_long((unsigned long)f);
10949         aint = dummy_int((unsigned int)f);
10950         ashort = dummy_short((unsigned short)f);
10951         if (along != (unsigned long)123)
10952                 result |= 4;
10953         if (aint != (unsigned int)123)
10954                 result |= 4;
10955         if (ashort != (unsigned short)123)
10956                 result |= 4;
10957         exit(result);
10958
10959 }
10960 EOCP
10961 set try
10962 if eval $compile_ok; then
10963         $run ./try
10964         castflags=$?
10965 else
10966         echo "(I can't seem to compile the test program--assuming it can't)"
10967         castflags=7
10968 fi
10969 case "$castflags" in
10970 0)      val="$define"
10971         echo "Yup, it can."
10972         ;;
10973 *)      val="$undef"
10974         echo "Nope, it can't."
10975         ;;
10976 esac
10977 set d_castneg
10978 eval $setvar
10979 $rm_try
10980
10981 : see if vprintf exists
10982 echo " "
10983 if set vprintf val -f d_vprintf; eval $csym; $val; then
10984         echo 'vprintf() found.' >&4
10985         val="$define"
10986         $cat >try.c <<EOF
10987 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
10988 #$i_varargs I_VARARGS
10989
10990 #$i_stdlib I_STDLIB
10991 #$i_unistd I_UNISTD
10992
10993 #ifdef I_STDARG
10994 #  include <stdarg.h>
10995 #else /* I_VARARGS */
10996 #  include <varargs.h>
10997 #endif
10998
10999 #ifdef I_UNISTD
11000 #  include <unistd.h>
11001 #endif
11002
11003 #ifdef I_STDLIB
11004 #  include <stdlib.h>
11005 #endif
11006
11007 #include <stdio.h> /* vsprintf prototype */
11008
11009 #ifdef I_STDARG
11010 void xxx(int n, ...)
11011 {
11012     va_list args;
11013     char buf[10];
11014     va_start(args, n);
11015     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11016 }
11017 int main() { xxx(1, "foo"); }
11018
11019 #else /* I_VARARGS */
11020
11021 xxx(va_alist)
11022 va_dcl
11023 {
11024     va_list args;
11025     char buf[10];
11026     va_start(args);
11027     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11028 }
11029 int main() { xxx("foo"); }
11030
11031 #endif
11032
11033 EOF
11034         set try
11035         if eval $compile_ok; then
11036                 if $run ./try; then
11037                         echo "Your vsprintf() returns (int)." >&4
11038                         val2="$undef"
11039                 else
11040                         echo "Your vsprintf() returns (char*)." >&4
11041                         val2="$define"
11042                 fi
11043         else
11044                 echo 'I am unable to compile the vsprintf() test program.' >&4
11045                 # We shouldn't get here.  If we do, assume the standard signature,
11046                 # not the old BSD one.
11047                 echo 'Guessing that vsprintf() returns (int).' >&4
11048                 val2="$undef"
11049         fi
11050 else
11051         echo 'vprintf() NOT found.' >&4
11052         val="$undef"
11053         val2="$undef"
11054 fi
11055 $rm_try
11056 set d_vprintf
11057 eval $setvar
11058 val=$val2
11059 set d_charvspr
11060 eval $setvar
11061
11062 : see if chown exists
11063 set chown d_chown
11064 eval $inlibc
11065
11066 : see if chroot exists
11067 set chroot d_chroot
11068 eval $inlibc
11069
11070 : see if chsize exists
11071 set chsize d_chsize
11072 eval $inlibc
11073
11074 : see if class exists
11075 set class d_class
11076 eval $inlibc
11077
11078 : see if clearenv exists
11079 set clearenv d_clearenv
11080 eval $inlibc
11081
11082 : Define hasstruct macro for Configure internal use
11083 hasstruct='varname=$1; struct=$2; shift; shift;
11084 while $test $# -ge 2; do
11085         case "$1" in
11086         $define) echo "#include <$2>";;
11087         esac ;
11088     shift 2;
11089 done > try.c;
11090 echo "int main () { struct $struct foo; }" >> try.c;
11091 set try;
11092 if eval $compile; then
11093         val="$define";
11094 else
11095         val="$undef";
11096 fi;
11097 set $varname;
11098 eval $setvar;
11099 $rm_try'
11100
11101 : see whether socket exists
11102 socketlib=''
11103 sockethdr=''
11104 echo " "
11105 $echo $n "Hmm... $c" >&4
11106 if set socket val -f d_socket; eval $csym; $val; then
11107         echo "Looks like you have Berkeley networking support." >&4
11108         d_socket="$define"
11109         if set setsockopt val -f; eval $csym; $val; then
11110                 d_oldsock="$undef"
11111         else
11112                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11113                 d_oldsock="$define"
11114         fi
11115 else
11116         if $contains socklib libc.list >/dev/null 2>&1; then
11117                 echo "Looks like you have Berkeley networking support." >&4
11118                 d_socket="$define"
11119                 : we will have to assume that it supports the 4.2 BSD interface
11120                 d_oldsock="$undef"
11121         else
11122                 echo "You don't have Berkeley networking in libc$_a..." >&4
11123                 if test "X$d_socket" = "X$define"; then
11124                    echo "...but you seem to believe that you have sockets." >&4
11125                 else
11126                         for net in net socket
11127                         do
11128                                 if test -f /usr/lib/lib$net$_a; then
11129                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11130                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11131                                         if $contains socket libc.list >/dev/null 2>&1; then
11132                                                 d_socket="$define"
11133                                                 socketlib="-l$net"
11134                                                 case "$net" in
11135                                                 net)
11136                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11137                                                         sockethdr="-I/usr/netinclude"
11138                                                         ;;
11139                                                 esac
11140                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11141                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11142                                                         d_oldsock="$undef"
11143                                                 else
11144                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11145                                                         d_oldsock="$define"
11146                                                 fi
11147                                                 break
11148                                         fi
11149                                 fi
11150                         done
11151                         if test "X$d_socket" != "X$define"; then
11152                            echo "or anywhere else I see." >&4
11153                            d_socket="$undef"
11154                            d_oldsock="$undef"
11155                         fi
11156                 fi
11157         fi
11158 fi
11159
11160 : see if socketpair exists
11161 set socketpair d_sockpair
11162 eval $inlibc
11163
11164
11165 echo " "
11166 echo "Checking the availability of certain socket constants..." >&4
11167 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11168         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11169         $cat >try.c <<EOF
11170 #include <sys/types.h>
11171 #include <sys/socket.h>
11172 int main() {
11173     int i = $ENUM;
11174 }
11175 EOF
11176         val="$undef"
11177         set try; if eval $compile; then
11178                 val="$define"
11179         fi
11180         set d_${enum}; eval $setvar
11181         $rm_try
11182 done
11183
11184 : see if this is a sys/uio.h system
11185 set sys/uio.h i_sysuio
11186 eval $inhdr
11187
11188 : Check for cmsghdr support
11189 echo " "
11190 echo "Checking to see if your system supports struct cmsghdr..." >&4
11191 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11192 eval $hasstruct
11193 case "$d_cmsghdr_s" in
11194 "$define")      echo "Yes, it does."   ;;
11195 *)              echo "No, it doesn't." ;;
11196 esac
11197
11198
11199 : check for const keyword
11200 echo " "
11201 echo 'Checking to see if your C compiler knows about "const"...' >&4
11202 $cat >const.c <<'EOCP'
11203 typedef struct spug { int drokk; } spug;
11204 int main()
11205 {
11206         const char *foo;
11207         const spug y = { 0 };
11208 }
11209 EOCP
11210 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11211         val="$define"
11212         echo "Yup, it does."
11213 else
11214         val="$undef"
11215         echo "Nope, it doesn't."
11216 fi
11217 set d_const
11218 eval $setvar
11219
11220 : see if copysignl exists
11221 set copysignl d_copysignl
11222 eval $inlibc
11223
11224 : see if crypt exists
11225 echo " "
11226 set crypt d_crypt
11227 eval $inlibc
11228 case "$d_crypt" in
11229 $define) cryptlib='' ;;
11230 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11231                 echo 'crypt() found.' >&4
11232                 val="$define"
11233                 cryptlib=''
11234         else
11235                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11236                 if $test -z "$cryptlib"; then
11237                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11238                 else
11239                         cryptlib=-lcrypt
11240                 fi
11241                 if $test -z "$cryptlib"; then
11242                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11243                 else
11244                         cryptlib=-lcrypt
11245                 fi
11246                 if $test -z "$cryptlib"; then
11247                         cryptlib=`./loc libcrypt$_a "" $libpth`
11248                 else
11249                         cryptlib=-lcrypt
11250                 fi
11251                 if $test -z "$cryptlib"; then
11252                         echo 'crypt() NOT found.' >&4
11253                         val="$undef"
11254                 else
11255                         val="$define"
11256                 fi
11257         fi
11258         set d_crypt
11259         eval $setvar
11260         ;;
11261 esac
11262
11263 : see if this is a crypt.h system
11264 set crypt.h i_crypt
11265 eval $inhdr
11266
11267 : see if crypt_r exists
11268 set crypt_r d_crypt_r
11269 eval $inlibc
11270 case "$d_crypt_r" in
11271 "$define")
11272         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11273         case "$d_crypt_r_proto:$usethreads" in
11274         ":define")      d_crypt_r_proto=define
11275                 set d_crypt_r_proto crypt_r $hdrs
11276                 eval $hasproto ;;
11277         *)      ;;
11278         esac
11279         case "$d_crypt_r_proto" in
11280         define)
11281         case "$crypt_r_proto" in
11282         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11283         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
11284         esac
11285         case "$crypt_r_proto" in
11286         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11287         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
11288         esac
11289         case "$crypt_r_proto" in
11290         ''|0)   d_crypt_r=undef
11291                 crypt_r_proto=0
11292                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11293         * )     case "$crypt_r_proto" in
11294                 REENTRANT_PROTO*) ;;
11295                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11296                 esac
11297                 echo "Prototype: $try" ;;
11298         esac
11299         ;;
11300         *)      case "$usethreads" in
11301                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11302                 esac
11303                 d_crypt_r=undef
11304                 crypt_r_proto=0
11305                 ;;
11306         esac
11307         ;;
11308 *)      crypt_r_proto=0
11309         ;;
11310 esac
11311
11312 : get csh whereabouts
11313 case "$csh" in
11314 'csh') val="$undef" ;;
11315 *) val="$define" ;;
11316 esac
11317 set d_csh
11318 eval $setvar
11319 : Respect a hint or command line value for full_csh.
11320 case "$full_csh" in
11321 '') full_csh=$csh ;;
11322 esac
11323
11324 : see if ctermid exists
11325 set ctermid d_ctermid
11326 eval $inlibc
11327
11328 : see if ctermid_r exists
11329 set ctermid_r d_ctermid_r
11330 eval $inlibc
11331 case "$d_ctermid_r" in
11332 "$define")
11333         hdrs="$i_systypes sys/types.h define stdio.h "
11334         case "$d_ctermid_r_proto:$usethreads" in
11335         ":define")      d_ctermid_r_proto=define
11336                 set d_ctermid_r_proto ctermid_r $hdrs
11337                 eval $hasproto ;;
11338         *)      ;;
11339         esac
11340         case "$d_ctermid_r_proto" in
11341         define)
11342         case "$ctermid_r_proto" in
11343         ''|0) try='char* ctermid_r(char*);'
11344         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11345         esac
11346         case "$ctermid_r_proto" in
11347         ''|0)   d_ctermid_r=undef
11348                 ctermid_r_proto=0
11349                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11350         * )     case "$ctermid_r_proto" in
11351                 REENTRANT_PROTO*) ;;
11352                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11353                 esac
11354                 echo "Prototype: $try" ;;
11355         esac
11356         ;;
11357         *)      case "$usethreads" in
11358                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11359                 esac
11360                 d_ctermid_r=undef
11361                 ctermid_r_proto=0
11362                 ;;
11363         esac
11364         ;;
11365 *)      ctermid_r_proto=0
11366         ;;
11367 esac
11368
11369 : see if ctime_r exists
11370 set ctime_r d_ctime_r
11371 eval $inlibc
11372 case "$d_ctime_r" in
11373 "$define")
11374         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11375         case "$d_ctime_r_proto:$usethreads" in
11376         ":define")      d_ctime_r_proto=define
11377                 set d_ctime_r_proto ctime_r $hdrs
11378                 eval $hasproto ;;
11379         *)      ;;
11380         esac
11381         case "$d_ctime_r_proto" in
11382         define)
11383         case "$ctime_r_proto" in
11384         ''|0) try='char* ctime_r(const time_t*, char*);'
11385         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11386         esac
11387         case "$ctime_r_proto" in
11388         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11389         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11390         esac
11391         case "$ctime_r_proto" in
11392         ''|0) try='int ctime_r(const time_t*, char*);'
11393         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11394         esac
11395         case "$ctime_r_proto" in
11396         ''|0) try='int ctime_r(const time_t*, char*, int);'
11397         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11398         esac
11399         case "$ctime_r_proto" in
11400         ''|0)   d_ctime_r=undef
11401                 ctime_r_proto=0
11402                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11403         * )     case "$ctime_r_proto" in
11404                 REENTRANT_PROTO*) ;;
11405                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11406                 esac
11407                 echo "Prototype: $try" ;;
11408         esac
11409         ;;
11410         *)      case "$usethreads" in
11411                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11412                 esac
11413                 d_ctime_r=undef
11414                 ctime_r_proto=0
11415                 ;;
11416         esac
11417         ;;
11418 *)      ctime_r_proto=0
11419         ;;
11420 esac
11421
11422 : see if cuserid exists
11423 set cuserid d_cuserid
11424 eval $inlibc
11425
11426 : see if this is a limits.h system
11427 set limits.h i_limits
11428 eval $inhdr
11429
11430 : see if this is a float.h system
11431 set float.h i_float
11432 eval $inhdr
11433
11434 : See if number of significant digits in a double precision number is known
11435 echo " "
11436 $cat >dbl_dig.c <<EOM
11437 #$i_limits I_LIMITS
11438 #$i_float I_FLOAT
11439 #ifdef I_LIMITS
11440 #include <limits.h>
11441 #endif
11442 #ifdef I_FLOAT
11443 #include <float.h>
11444 #endif
11445 #ifdef DBL_DIG
11446 printf("Contains DBL_DIG");
11447 #endif
11448 EOM
11449 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11450 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11451         echo "DBL_DIG found." >&4
11452         val="$define"
11453 else
11454         echo "DBL_DIG NOT found." >&4
11455         val="$undef"
11456 fi
11457 $rm -f dbl_dig.?
11458 set d_dbl_dig
11459 eval $setvar
11460
11461 : see if dbm.h is available
11462 : see if dbmclose exists
11463 set dbmclose d_dbmclose
11464 eval $inlibc
11465
11466 case "$d_dbmclose" in
11467 $define)
11468         set dbm.h i_dbm
11469         eval $inhdr
11470         case "$i_dbm" in
11471         $define)
11472                 val="$undef"
11473                 set i_rpcsvcdbm
11474                 eval $setvar
11475                 ;;
11476         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11477                 eval $inhdr
11478                 ;;
11479         esac
11480         ;;
11481 *)      echo "We won't be including <dbm.h>"
11482         val="$undef"
11483         set i_dbm
11484         eval $setvar
11485         val="$undef"
11486         set i_rpcsvcdbm
11487         eval $setvar
11488         ;;
11489 esac
11490
11491 : see if prototype for dbminit is available
11492 echo " "
11493 set d_dbminitproto dbminit $i_dbm dbm.h
11494 eval $hasproto
11495
11496 : see if difftime exists
11497 set difftime d_difftime
11498 eval $inlibc
11499
11500 : see if this is a dirent system
11501 echo " "
11502 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11503         val="$define"
11504         echo "<dirent.h> found." >&4
11505 else
11506         val="$undef"
11507         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11508                 echo "<sys/dir.h> found." >&4
11509                 echo " "
11510         else
11511                 xinc=`./findhdr sys/ndir.h`
11512         fi
11513         echo "<dirent.h> NOT found." >&4
11514 fi
11515 set i_dirent
11516 eval $setvar
11517
11518 : Look for type of directory structure.
11519 echo " "
11520 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11521
11522 case "$direntrytype" in
11523 ''|' ')
11524         case "$i_dirent" in
11525         $define) guess1='struct dirent' ;;
11526         *) guess1='struct direct'  ;;
11527         esac
11528         ;;
11529 *)      guess1="$direntrytype"
11530         ;;
11531 esac
11532
11533 case "$guess1" in
11534 'struct dirent') guess2='struct direct' ;;
11535 *) guess2='struct dirent' ;;
11536 esac
11537
11538 if $contains "$guess1" try.c >/dev/null 2>&1; then
11539         direntrytype="$guess1"
11540         echo "Your directory entries are $direntrytype." >&4
11541 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11542         direntrytype="$guess2"
11543         echo "Your directory entries seem to be $direntrytype." >&4
11544 else
11545         echo "I don't recognize your system's directory entries." >&4
11546         rp="What type is used for directory entries on this system?"
11547         dflt="$guess1"
11548         . ./myread
11549         direntrytype="$ans"
11550 fi
11551 $rm_try
11552
11553 : see if the directory entry stores field length
11554 echo " "
11555 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11556 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11557         echo "Good, your directory entry keeps length information in d_namlen." >&4
11558         val="$define"
11559 else
11560         echo "Your directory entry does not know about the d_namlen field." >&4
11561         val="$undef"
11562 fi
11563 set d_dirnamlen
11564 eval $setvar
11565 $rm_try
11566
11567 : Look for DIR.dd_fd
11568 case "$i_dirent" in
11569 "$define")
11570     echo "Checking to see if DIR has a dd_fd member variable" >&4
11571     $cat >try.c <<EOCP
11572 #$i_stdlib I_STDLIB
11573 #ifdef I_STDLIB
11574 #include <stdlib.h>
11575 #endif
11576 #include <dirent.h>
11577
11578 int main() {
11579     DIR dir;
11580     dir.dd_fd = 1;
11581     return 0;
11582 }
11583 EOCP
11584     val=$undef
11585     set try
11586     if eval $compile; then
11587         echo "Yes, it does."
11588         val="$define"
11589     else
11590         echo "No, it does not."
11591         val="$undef"
11592     fi
11593     ;;
11594 *)
11595     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11596     val="$undef"
11597     ;;
11598 esac
11599 set d_dir_dd_fd
11600 eval $setvar
11601 $rm_try
11602
11603 : see if this is an sysdir system
11604 set sys/dir.h i_sysdir
11605 eval $inhdr
11606
11607 : see if this is an sysndir system
11608 set sys/ndir.h i_sysndir
11609 eval $inhdr
11610
11611 : Look for dirfd
11612 echo " "
11613 $cat >dirfd.c <<EOM
11614 #include <stdio.h>
11615 #$i_stdlib I_STDLIB
11616 #ifdef I_STDLIB
11617 #include <stdlib.h>
11618 #endif
11619 #$i_dirent I_DIRENT             /**/
11620 #$i_sysdir I_SYS_DIR            /**/
11621 #$i_sysndir I_SYS_NDIR          /**/
11622 #$i_systypes I_SYS_TYPES        /**/
11623 #if defined(I_SYS_TYPES)
11624 #include <sys/types.h>
11625 #endif
11626 #if defined(I_DIRENT)
11627 #include <dirent.h>
11628 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11629 #include <sys/dir.h>
11630 #endif
11631 #else
11632 #ifdef I_SYS_NDIR
11633 #include <sys/ndir.h>
11634 #else
11635 #ifdef I_SYS_DIR
11636 #ifdef hp9000s500
11637 #include <ndir.h>       /* may be wrong in the future */
11638 #else
11639 #include <sys/dir.h>
11640 #endif
11641 #endif
11642 #endif
11643 #endif 
11644 int main() {
11645         DIR *dirp = opendir(".");
11646         if (dirfd(dirp) >= 0)
11647                 exit(0);
11648         else
11649                 exit(1);
11650 }
11651 EOM
11652 val=$undef
11653 set dirfd
11654 if eval $compile; then
11655         val="$define"
11656 fi
11657 case "$val" in
11658 $define)        echo "dirfd() found." >&4       ;;
11659 *)              echo "dirfd() NOT found." >&4   ;;
11660 esac
11661 set d_dirfd
11662 eval $setvar
11663 $rm -f dirfd*
11664
11665 : see if dlerror exists
11666 xxx_runnm="$runnm"
11667 runnm=false
11668 set dlerror d_dlerror
11669 eval $inlibc
11670 runnm="$xxx_runnm"
11671
11672 : see if dlfcn is available
11673 set dlfcn.h i_dlfcn
11674 eval $inhdr
11675
11676 : Check what extension to use for shared libs
11677 case "$usedl" in
11678 $define|y|true)
11679         $cat << EOM
11680
11681 On a few systems, the dynamically loaded modules that perl generates and uses
11682 will need a different extension than shared libs. The default will probably
11683 be appropriate.
11684
11685 EOM
11686         case "$dlext" in
11687         '')     dflt="$so" ;;
11688         *)      dflt="$dlext" ;;
11689         esac
11690         rp='What is the extension of dynamically loaded modules'
11691         . ./myread
11692         dlext="$ans"
11693         ;;
11694 *)
11695         dlext="none"
11696         ;;
11697 esac
11698
11699 : Check if dlsym need a leading underscore
11700 echo " "
11701 val="$undef"
11702
11703 case "$dlsrc" in
11704 dl_dlopen.xs)
11705         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11706         $cat >dyna.c <<'EOM'
11707 fred () { }
11708 EOM
11709
11710 $cat >fred.c<<EOM
11711
11712 #include <stdio.h>
11713 #$i_stdlib I_STDLIB
11714 #ifdef I_STDLIB
11715 #include <stdlib.h>
11716 #endif
11717 #$i_dlfcn I_DLFCN
11718 #ifdef I_DLFCN
11719 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11720 #else
11721 #include <sys/types.h>
11722 #include <nlist.h>
11723 #include <link.h>
11724 #endif
11725
11726 extern int fred() ;
11727
11728 int main()
11729 {
11730     void * handle ;
11731     void * symbol ;
11732 #ifndef RTLD_LAZY
11733     int mode = 1 ;
11734 #else
11735     int mode = RTLD_LAZY ;
11736 #endif
11737     handle = dlopen("./dyna.$dlext", mode) ;
11738     if (handle == NULL) {
11739         printf ("1\n") ;
11740         fflush (stdout) ;
11741         exit(0);
11742     }
11743     symbol = dlsym(handle, "fred") ;
11744     if (symbol == NULL) {
11745         /* try putting a leading underscore */
11746         symbol = dlsym(handle, "_fred") ;
11747         if (symbol == NULL) {
11748             printf ("2\n") ;
11749             fflush (stdout) ;
11750             exit(0);
11751         }
11752         printf ("3\n") ;
11753     }
11754     else
11755         printf ("4\n") ;
11756     fflush (stdout) ;
11757     exit(0);
11758 }
11759 EOM
11760         : Call the object file tmp-dyna.o in case dlext=o.
11761         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11762                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11763                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11764                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11765                 xxx=`$run ./fred`
11766                 case $xxx in
11767                 1)      echo "Test program failed using dlopen." >&4
11768                         echo "Perhaps you should not use dynamic loading." >&4;;
11769                 2)      echo "Test program failed using dlsym." >&4
11770                         echo "Perhaps you should not use dynamic loading." >&4;;
11771                 3)      echo "dlsym needs a leading underscore" >&4
11772                         val="$define" ;;
11773                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11774                 esac
11775         else
11776                 echo "I can't compile and run the test program." >&4
11777                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11778         fi
11779         ;;
11780 esac
11781
11782 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11783
11784 set d_dlsymun
11785 eval $setvar
11786
11787 : see if drand48_r exists
11788 set drand48_r d_drand48_r
11789 eval $inlibc
11790 case "$d_drand48_r" in
11791 "$define")
11792         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11793         case "$d_drand48_r_proto:$usethreads" in
11794         ":define")      d_drand48_r_proto=define
11795                 set d_drand48_r_proto drand48_r $hdrs
11796                 eval $hasproto ;;
11797         *)      ;;
11798         esac
11799         case "$d_drand48_r_proto" in
11800         define)
11801         case "$drand48_r_proto" in
11802         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11803         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11804         esac
11805         case "$drand48_r_proto" in
11806         ''|0)   d_drand48_r=undef
11807                 drand48_r_proto=0
11808                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11809         * )     case "$drand48_r_proto" in
11810                 REENTRANT_PROTO*) ;;
11811                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11812                 esac
11813                 echo "Prototype: $try" ;;
11814         esac
11815         ;;
11816         *)      case "$usethreads" in
11817                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11818                 esac
11819                 d_drand48_r=undef
11820                 drand48_r_proto=0
11821                 ;;
11822         esac
11823         ;;
11824 *)      drand48_r_proto=0
11825         ;;
11826 esac
11827
11828 : see if prototype for drand48 is available
11829 echo " "
11830 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11831 eval $hasproto
11832
11833 : see if dup2 exists
11834 set dup2 d_dup2
11835 eval $inlibc
11836
11837 : see if eaccess exists
11838 set eaccess d_eaccess
11839 eval $inlibc
11840
11841 : see if endgrent exists
11842 set endgrent d_endgrent
11843 eval $inlibc
11844
11845 : see if this is an grp system
11846 set grp.h i_grp
11847 eval $inhdr
11848
11849 case "$i_grp" in
11850 $define)
11851         xxx=`./findhdr grp.h`
11852         $cppstdin $cppflags $cppminus < $xxx >$$.h
11853
11854         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11855                 val="$define"
11856         else
11857                 val="$undef"
11858         fi
11859         set d_grpasswd
11860         eval $setvar
11861
11862         $rm -f $$.h
11863         ;;
11864 *)
11865         val="$undef";
11866         set d_grpasswd; eval $setvar
11867         ;;
11868 esac
11869
11870 : see if endgrent_r exists
11871 set endgrent_r d_endgrent_r
11872 eval $inlibc
11873 case "$d_endgrent_r" in
11874 "$define")
11875         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11876         case "$d_endgrent_r_proto:$usethreads" in
11877         ":define")      d_endgrent_r_proto=define
11878                 set d_endgrent_r_proto endgrent_r $hdrs
11879                 eval $hasproto ;;
11880         *)      ;;
11881         esac
11882         case "$d_endgrent_r_proto" in
11883         define)
11884         case "$endgrent_r_proto" in
11885         ''|0) try='int endgrent_r(FILE**);'
11886         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11887         esac
11888         case "$endgrent_r_proto" in
11889         ''|0) try='void endgrent_r(FILE**);'
11890         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11891         esac
11892         case "$endgrent_r_proto" in
11893         ''|0)   d_endgrent_r=undef
11894                 endgrent_r_proto=0
11895                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11896         * )     case "$endgrent_r_proto" in
11897                 REENTRANT_PROTO*) ;;
11898                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11899                 esac
11900                 echo "Prototype: $try" ;;
11901         esac
11902         ;;
11903         *)      case "$usethreads" in
11904                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11905                 esac
11906                 d_endgrent_r=undef
11907                 endgrent_r_proto=0
11908                 ;;
11909         esac
11910         ;;
11911 *)      endgrent_r_proto=0
11912         ;;
11913 esac
11914
11915 : see if endhostent exists
11916 set endhostent d_endhent
11917 eval $inlibc
11918
11919 : see if this is a netdb.h system
11920 set netdb.h i_netdb
11921 eval $inhdr
11922
11923 : see if endhostent_r exists
11924 set endhostent_r d_endhostent_r
11925 eval $inlibc
11926 case "$d_endhostent_r" in
11927 "$define")
11928         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11929         case "$d_endhostent_r_proto:$usethreads" in
11930         ":define")      d_endhostent_r_proto=define
11931                 set d_endhostent_r_proto endhostent_r $hdrs
11932                 eval $hasproto ;;
11933         *)      ;;
11934         esac
11935         case "$d_endhostent_r_proto" in
11936         define)
11937         case "$endhostent_r_proto" in
11938         ''|0) try='int endhostent_r(struct hostent_data*);'
11939         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11940         esac
11941         case "$endhostent_r_proto" in
11942         ''|0) try='void endhostent_r(struct hostent_data*);'
11943         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11944         esac
11945         case "$endhostent_r_proto" in
11946         ''|0)   d_endhostent_r=undef
11947                 endhostent_r_proto=0
11948                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11949         * )     case "$endhostent_r_proto" in
11950                 REENTRANT_PROTO*) ;;
11951                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11952                 esac
11953                 echo "Prototype: $try" ;;
11954         esac
11955         ;;
11956         *)      case "$usethreads" in
11957                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11958                 esac
11959                 d_endhostent_r=undef
11960                 endhostent_r_proto=0
11961                 ;;
11962         esac
11963         ;;
11964 *)      endhostent_r_proto=0
11965         ;;
11966 esac
11967
11968 : see if endnetent exists
11969 set endnetent d_endnent
11970 eval $inlibc
11971
11972 : see if endnetent_r exists
11973 set endnetent_r d_endnetent_r
11974 eval $inlibc
11975 case "$d_endnetent_r" in
11976 "$define")
11977         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11978         case "$d_endnetent_r_proto:$usethreads" in
11979         ":define")      d_endnetent_r_proto=define
11980                 set d_endnetent_r_proto endnetent_r $hdrs
11981                 eval $hasproto ;;
11982         *)      ;;
11983         esac
11984         case "$d_endnetent_r_proto" in
11985         define)
11986         case "$endnetent_r_proto" in
11987         ''|0) try='int endnetent_r(struct netent_data*);'
11988         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11989         esac
11990         case "$endnetent_r_proto" in
11991         ''|0) try='void endnetent_r(struct netent_data*);'
11992         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11993         esac
11994         case "$endnetent_r_proto" in
11995         ''|0)   d_endnetent_r=undef
11996                 endnetent_r_proto=0
11997                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11998         * )     case "$endnetent_r_proto" in
11999                 REENTRANT_PROTO*) ;;
12000                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12001                 esac
12002                 echo "Prototype: $try" ;;
12003         esac
12004         ;;
12005         *)      case "$usethreads" in
12006                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12007                 esac
12008                 d_endnetent_r=undef
12009                 endnetent_r_proto=0
12010                 ;;
12011         esac
12012         ;;
12013 *)      endnetent_r_proto=0
12014         ;;
12015 esac
12016
12017 : see if endprotoent exists
12018 set endprotoent d_endpent
12019 eval $inlibc
12020
12021 : see if endprotoent_r exists
12022 set endprotoent_r d_endprotoent_r
12023 eval $inlibc
12024 case "$d_endprotoent_r" in
12025 "$define")
12026         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12027         case "$d_endprotoent_r_proto:$usethreads" in
12028         ":define")      d_endprotoent_r_proto=define
12029                 set d_endprotoent_r_proto endprotoent_r $hdrs
12030                 eval $hasproto ;;
12031         *)      ;;
12032         esac
12033         case "$d_endprotoent_r_proto" in
12034         define)
12035         case "$endprotoent_r_proto" in
12036         ''|0) try='int endprotoent_r(struct protoent_data*);'
12037         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
12038         esac
12039         case "$endprotoent_r_proto" in
12040         ''|0) try='void endprotoent_r(struct protoent_data*);'
12041         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
12042         esac
12043         case "$endprotoent_r_proto" in
12044         ''|0)   d_endprotoent_r=undef
12045                 endprotoent_r_proto=0
12046                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12047         * )     case "$endprotoent_r_proto" in
12048                 REENTRANT_PROTO*) ;;
12049                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12050                 esac
12051                 echo "Prototype: $try" ;;
12052         esac
12053         ;;
12054         *)      case "$usethreads" in
12055                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12056                 esac
12057                 d_endprotoent_r=undef
12058                 endprotoent_r_proto=0
12059                 ;;
12060         esac
12061         ;;
12062 *)      endprotoent_r_proto=0
12063         ;;
12064 esac
12065
12066 : see if endpwent exists
12067 set endpwent d_endpwent
12068 eval $inlibc
12069
12070 : see if this is a pwd.h system
12071 set pwd.h i_pwd
12072 eval $inhdr
12073
12074 case "$i_pwd" in
12075 $define)
12076         xxx=`./findhdr pwd.h`
12077         $cppstdin $cppflags $cppminus < $xxx >$$.h
12078
12079         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12080                 val="$define"
12081         else
12082                 val="$undef"
12083         fi
12084         set d_pwquota
12085         eval $setvar
12086
12087         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12088                 val="$define"
12089         else
12090                 val="$undef"
12091         fi
12092         set d_pwage
12093         eval $setvar
12094
12095         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12096                 val="$define"
12097         else
12098                 val="$undef"
12099         fi
12100         set d_pwchange
12101         eval $setvar
12102
12103         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12104                 val="$define"
12105         else
12106                 val="$undef"
12107         fi
12108         set d_pwclass
12109         eval $setvar
12110
12111         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12112                 val="$define"
12113         else
12114                 val="$undef"
12115         fi
12116         set d_pwexpire
12117         eval $setvar
12118
12119         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12120                 val="$define"
12121         else
12122                 val="$undef"
12123         fi
12124         set d_pwcomment
12125         eval $setvar
12126
12127         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12128                 val="$define"
12129         else
12130                 val="$undef"
12131         fi
12132         set d_pwgecos
12133         eval $setvar
12134
12135         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12136                 val="$define"
12137         else
12138                 val="$undef"
12139         fi
12140         set d_pwpasswd
12141         eval $setvar
12142
12143         $rm -f $$.h
12144         ;;
12145 *)
12146         val="$undef"; 
12147         set d_pwquota; eval $setvar
12148         set d_pwage; eval $setvar
12149         set d_pwchange; eval $setvar
12150         set d_pwclass; eval $setvar
12151         set d_pwexpire; eval $setvar
12152         set d_pwcomment; eval $setvar
12153         set d_pwgecos; eval $setvar
12154         set d_pwpasswd; eval $setvar
12155         ;;
12156 esac
12157
12158 : see if endpwent_r exists
12159 set endpwent_r d_endpwent_r
12160 eval $inlibc
12161 case "$d_endpwent_r" in
12162 "$define")
12163         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12164         case "$d_endpwent_r_proto:$usethreads" in
12165         ":define")      d_endpwent_r_proto=define
12166                 set d_endpwent_r_proto endpwent_r $hdrs
12167                 eval $hasproto ;;
12168         *)      ;;
12169         esac
12170         case "$d_endpwent_r_proto" in
12171         define)
12172         case "$endpwent_r_proto" in
12173         ''|0) try='int endpwent_r(FILE**);'
12174         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
12175         esac
12176         case "$endpwent_r_proto" in
12177         ''|0) try='void endpwent_r(FILE**);'
12178         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
12179         esac
12180         case "$endpwent_r_proto" in
12181         ''|0)   d_endpwent_r=undef
12182                 endpwent_r_proto=0
12183                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12184         * )     case "$endpwent_r_proto" in
12185                 REENTRANT_PROTO*) ;;
12186                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12187                 esac
12188                 echo "Prototype: $try" ;;
12189         esac
12190         ;;
12191         *)      case "$usethreads" in
12192                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12193                 esac
12194                 d_endpwent_r=undef
12195                 endpwent_r_proto=0
12196                 ;;
12197         esac
12198         ;;
12199 *)      endpwent_r_proto=0
12200         ;;
12201 esac
12202
12203 : see if endservent exists
12204 set endservent d_endsent
12205 eval $inlibc
12206
12207 : see if endservent_r exists
12208 set endservent_r d_endservent_r
12209 eval $inlibc
12210 case "$d_endservent_r" in
12211 "$define")
12212         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12213         case "$d_endservent_r_proto:$usethreads" in
12214         ":define")      d_endservent_r_proto=define
12215                 set d_endservent_r_proto endservent_r $hdrs
12216                 eval $hasproto ;;
12217         *)      ;;
12218         esac
12219         case "$d_endservent_r_proto" in
12220         define)
12221         case "$endservent_r_proto" in
12222         ''|0) try='int endservent_r(struct servent_data*);'
12223         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
12224         esac
12225         case "$endservent_r_proto" in
12226         ''|0) try='void endservent_r(struct servent_data*);'
12227         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
12228         esac
12229         case "$endservent_r_proto" in
12230         ''|0)   d_endservent_r=undef
12231                 endservent_r_proto=0
12232                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12233         * )     case "$endservent_r_proto" in
12234                 REENTRANT_PROTO*) ;;
12235                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12236                 esac
12237                 echo "Prototype: $try" ;;
12238         esac
12239         ;;
12240         *)      case "$usethreads" in
12241                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12242                 esac
12243                 d_endservent_r=undef
12244                 endservent_r_proto=0
12245                 ;;
12246         esac
12247         ;;
12248 *)      endservent_r_proto=0
12249         ;;
12250 esac
12251
12252 : Locate the flags for 'open()'
12253 echo " "
12254 $cat >try.c <<EOCP
12255 #include <sys/types.h>
12256 #ifdef I_FCNTL
12257 #include <fcntl.h>
12258 #endif
12259 #ifdef I_SYS_FILE
12260 #include <sys/file.h>
12261 #endif
12262 #$i_stdlib I_STDLIB
12263 #ifdef I_STDLIB
12264 #include <stdlib.h>
12265 #endif
12266 int main() {
12267         if(O_RDONLY);
12268 #ifdef O_TRUNC
12269         exit(0);
12270 #else
12271         exit(1);
12272 #endif
12273 }
12274 EOCP
12275 : check sys/file.h first to get FREAD on Sun
12276 if $test `./findhdr sys/file.h` && \
12277                 set try -DI_SYS_FILE && eval $compile; then
12278         h_sysfile=true;
12279         echo "<sys/file.h> defines the O_* constants..." >&4
12280         if $run ./try; then
12281                 echo "and you have the 3 argument form of open()." >&4
12282                 val="$define"
12283         else
12284                 echo "but not the 3 argument form of open().  Oh, well." >&4
12285                 val="$undef"
12286         fi
12287 elif $test `./findhdr fcntl.h` && \
12288                 set try -DI_FCNTL && eval $compile; then
12289         h_fcntl=true;
12290         echo "<fcntl.h> defines the O_* constants..." >&4
12291         if $run ./try; then
12292                 echo "and you have the 3 argument form of open()." >&4
12293                 val="$define"
12294         else
12295                 echo "but not the 3 argument form of open().  Oh, well." >&4
12296                 val="$undef"
12297         fi
12298 else
12299         val="$undef"
12300         echo "I can't find the O_* constant definitions!  You got problems." >&4
12301 fi
12302 set d_open3
12303 eval $setvar
12304 $rm_try
12305
12306 : script used to emit important warnings
12307 cat >warn <<EOS
12308 $startsh
12309 if test \$# -gt 0; then
12310         echo "\$@" >msg
12311 else
12312         cat >msg
12313 fi
12314 echo "*** WARNING:" >&4
12315 sed -e 's/^/*** /' <msg >&4
12316 echo "*** " >&4
12317 cat msg >>config.msg
12318 echo " " >>config.msg
12319 rm -f msg
12320 EOS
12321 chmod +x warn
12322 $eunicefix warn
12323
12324 : see which of string.h or strings.h is needed
12325 echo " "
12326 strings=`./findhdr string.h`
12327 if $test "$strings" && $test -r "$strings"; then
12328         echo "Using <string.h> instead of <strings.h>." >&4
12329         val="$define"
12330 else
12331         val="$undef"
12332         strings=`./findhdr strings.h`
12333         if $test "$strings" && $test -r "$strings"; then
12334                 echo "Using <strings.h> instead of <string.h>." >&4
12335         else
12336                 ./warn "No string header found -- You'll surely have problems."
12337         fi
12338 fi
12339 set i_string
12340 eval $setvar
12341 case "$i_string" in
12342 "$undef") strings=`./findhdr strings.h`;;
12343 *)        strings=`./findhdr string.h`;;
12344 esac
12345
12346 : see if this is a sys/file.h system
12347 val=''
12348 set sys/file.h val
12349 eval $inhdr
12350
12351 : do we need to include sys/file.h ?
12352 case "$val" in
12353 "$define")
12354         echo " "
12355         if $h_sysfile; then
12356                 val="$define"
12357                 echo "We'll be including <sys/file.h>." >&4
12358         else
12359                 val="$undef"
12360                 echo "We won't be including <sys/file.h>." >&4
12361         fi
12362         ;;
12363 *)
12364         h_sysfile=false
12365         ;;
12366 esac
12367 set i_sysfile
12368 eval $setvar
12369
12370 : see if fcntl.h is there
12371 val=''
12372 set fcntl.h val
12373 eval $inhdr
12374
12375 : see if we can include fcntl.h
12376 case "$val" in
12377 "$define")
12378         echo " "
12379         if $h_fcntl; then
12380                 val="$define"
12381                 echo "We'll be including <fcntl.h>." >&4
12382         else
12383                 val="$undef"
12384                 if $h_sysfile; then
12385         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12386                 else
12387                         echo "We won't be including <fcntl.h>." >&4
12388                 fi
12389         fi
12390         ;;
12391 *)
12392         h_fcntl=false
12393         val="$undef"
12394         ;;
12395 esac
12396 set i_fcntl
12397 eval $setvar
12398
12399 : see if fork exists
12400 set fork d_fork
12401 eval $inlibc
12402
12403 : see if pipe exists
12404 set pipe d_pipe
12405 eval $inlibc
12406
12407 : check for non-blocking I/O stuff
12408 case "$h_sysfile" in
12409 true) echo "#include <sys/file.h>" > head.c;;
12410 *)
12411        case "$h_fcntl" in
12412        true) echo "#include <fcntl.h>" > head.c;;
12413        *) echo "#include <sys/fcntl.h>" > head.c;;
12414        esac
12415        ;;
12416 esac
12417 echo " "
12418 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12419 case "$o_nonblock" in
12420 '')
12421         $cat head.c > try.c
12422         $cat >>try.c <<EOCP
12423 #include <stdio.h>
12424 #$i_stdlib I_STDLIB
12425 #ifdef I_STDLIB
12426 #include <stdlib.h>
12427 #endif
12428 #$i_fcntl I_FCNTL
12429 #ifdef I_FCNTL
12430 #include <fcntl.h>
12431 #endif
12432 int main() {
12433 #ifdef O_NONBLOCK
12434         printf("O_NONBLOCK\n");
12435         exit(0);
12436 #endif
12437 #ifdef O_NDELAY
12438         printf("O_NDELAY\n");
12439         exit(0);
12440 #endif
12441 #ifdef FNDELAY
12442         printf("FNDELAY\n");
12443         exit(0);
12444 #endif
12445         exit(0);
12446 }
12447 EOCP
12448         set try
12449         if eval $compile_ok; then
12450                 o_nonblock=`$run ./try`
12451                 case "$o_nonblock" in
12452                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12453                 *) echo "Seems like we can use $o_nonblock.";;
12454                 esac
12455         else
12456                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12457         fi
12458         ;;
12459 *) echo "Using $hint value $o_nonblock.";;
12460 esac
12461 $rm_try
12462
12463 echo " "
12464 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12465 case "$eagain" in
12466 '')
12467         case "$d_fork:$d_pipe" in
12468         define:define)
12469         $cat head.c > try.c
12470         $cat >>try.c <<EOCP
12471 #include <errno.h>
12472 #include <sys/types.h>
12473 #include <signal.h>
12474 #include <stdio.h>
12475 #$i_stdlib I_STDLIB
12476 #ifdef I_STDLIB
12477 #include <stdlib.h>
12478 #endif
12479 #$i_fcntl I_FCNTL
12480 #ifdef I_FCNTL
12481 #include <fcntl.h>
12482 #endif
12483 #define MY_O_NONBLOCK $o_nonblock
12484 #ifndef errno  /* XXX need better Configure test */
12485 extern int errno;
12486 #endif
12487 #$i_unistd I_UNISTD
12488 #ifdef I_UNISTD
12489 #include <unistd.h>
12490 #endif
12491 #$i_string I_STRING
12492 #ifdef I_STRING
12493 #include <string.h>
12494 #else
12495 #include <strings.h>
12496 #endif
12497 $signal_t blech(int x) { exit(3); }
12498 EOCP
12499         $cat >> try.c <<'EOCP'
12500 int main()
12501 {
12502         int pd[2];
12503         int pu[2];
12504         char buf[1];
12505         char string[100];
12506
12507         pipe(pd);       /* Down: child -> parent */
12508         pipe(pu);       /* Up: parent -> child */
12509         if (0 != fork()) {
12510                 int ret;
12511                 close(pd[1]);   /* Parent reads from pd[0] */
12512                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12513 #ifdef F_SETFL
12514                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12515                         exit(1);
12516 #else
12517                 exit(4);
12518 #endif
12519                 signal(SIGALRM, blech);
12520                 alarm(5);
12521                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12522                         exit(2);
12523                 sprintf(string, "%d\n", ret);
12524                 write(2, string, strlen(string));
12525                 alarm(0);
12526 #ifdef EAGAIN
12527                 if (errno == EAGAIN) {
12528                         printf("EAGAIN\n");
12529                         goto ok;
12530                 }
12531 #endif
12532 #ifdef EWOULDBLOCK
12533                 if (errno == EWOULDBLOCK)
12534                         printf("EWOULDBLOCK\n");
12535 #endif
12536         ok:
12537                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12538                 sleep(2);                               /* Give it time to close our pipe */
12539                 alarm(5);
12540                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12541                 alarm(0);
12542                 sprintf(string, "%d\n", ret);
12543                 write(4, string, strlen(string));
12544                 exit(0);
12545         }
12546
12547         close(pd[0]);                   /* We write to pd[1] */
12548         close(pu[1]);                   /* We read from pu[0] */
12549         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12550         close(pd[1]);                   /* Pipe pd is now fully closed! */
12551         exit(0);                                /* Bye bye, thank you for playing! */
12552 }
12553 EOCP
12554         set try
12555         if eval $compile_ok; then
12556                 echo "$startsh" >mtry
12557                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12558                 chmod +x mtry
12559                 ./mtry >/dev/null 2>&1
12560                 case $? in
12561                 0) eagain=`$cat try.out`;;
12562                 1) echo "Could not perform non-blocking setting!";;
12563                 2) echo "I did a successful read() for something that was not there!";;
12564                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12565                 4) echo "Could not find F_SETFL!";;
12566                 *) echo "Something terribly wrong happened during testing.";;
12567                 esac
12568                 rd_nodata=`$cat try.ret`
12569                 echo "A read() system call with no data present returns $rd_nodata."
12570                 case "$rd_nodata" in
12571                 0|-1) ;;
12572                 *)
12573                         echo "(That's peculiar, fixing that to be -1.)"
12574                         rd_nodata=-1
12575                         ;;
12576                 esac
12577                 case "$eagain" in
12578                 '')
12579                         echo "Forcing errno EAGAIN on read() with no data available."
12580                         eagain=EAGAIN
12581                         ;;
12582                 *)
12583                         echo "Your read() sets errno to $eagain when no data is available."
12584                         ;;
12585                 esac
12586                 status=`$cat try.err`
12587                 case "$status" in
12588                 0) echo "And it correctly returns 0 to signal EOF.";;
12589                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12590                 *) echo "However, your read() returns '$status' on EOF??";;
12591                 esac
12592                 val="$define"
12593                 if test "$status" = "$rd_nodata"; then
12594                         echo "WARNING: you can't distinguish between EOF and no data!"
12595                         val="$undef"
12596                 fi
12597         else
12598                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12599                 eagain=EAGAIN
12600         fi
12601         ;;
12602         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12603                 eagain=EAGAIN
12604                 val="$define"
12605                 ;;
12606         esac
12607         set d_eofnblk
12608         eval $setvar
12609         ;;
12610 *)
12611         echo "Using $hint value $eagain."
12612         echo "Your read() returns $rd_nodata when no data is present."
12613         case "$d_eofnblk" in
12614         "$define") echo "And you can see EOF because read() returns 0.";;
12615         "$undef") echo "But you can't see EOF status from read() returned value.";;
12616         *)
12617                 echo "(Assuming you can't see EOF status from read anyway.)"
12618                 d_eofnblk=$undef
12619                 ;;
12620         esac
12621         ;;
12622 esac
12623 $rm_try head.c mtry
12624
12625 : see if _ptr and _cnt from stdio act std
12626 echo " "
12627
12628 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12629         echo "(Looks like you have stdio.h from BSD.)"
12630         case "$stdio_ptr" in
12631         '') stdio_ptr='((fp)->_p)'
12632                 ptr_lval=$define
12633                 ;;
12634         *)      ptr_lval=$d_stdio_ptr_lval;;
12635         esac
12636         case "$stdio_cnt" in
12637         '') stdio_cnt='((fp)->_r)'
12638                 cnt_lval=$define
12639                 ;;
12640         *)      cnt_lval=$d_stdio_cnt_lval;;
12641         esac
12642         case "$stdio_base" in
12643         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12644         esac
12645         case "$stdio_bufsiz" in
12646         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12647         esac
12648 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12649         echo "(Looks like you have stdio.h from Linux.)"
12650         case "$stdio_ptr" in
12651         '') stdio_ptr='((fp)->_IO_read_ptr)'
12652                 ptr_lval=$define
12653                 ;;
12654         *)      ptr_lval=$d_stdio_ptr_lval;;
12655         esac
12656         case "$stdio_cnt" in
12657         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12658                 cnt_lval=$undef
12659                 ;;
12660         *)      cnt_lval=$d_stdio_cnt_lval;;
12661         esac
12662         case "$stdio_base" in
12663         '') stdio_base='((fp)->_IO_read_base)';;
12664         esac
12665         case "$stdio_bufsiz" in
12666         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12667         esac
12668 else
12669         case "$stdio_ptr" in
12670         '') stdio_ptr='((fp)->_ptr)'
12671                 ptr_lval=$define
12672                 ;;
12673         *)      ptr_lval=$d_stdio_ptr_lval;;
12674         esac
12675         case "$stdio_cnt" in
12676         '') stdio_cnt='((fp)->_cnt)'
12677                 cnt_lval=$define
12678                 ;;
12679         *)      cnt_lval=$d_stdio_cnt_lval;;
12680         esac
12681         case "$stdio_base" in
12682         '') stdio_base='((fp)->_base)';;
12683         esac
12684         case "$stdio_bufsiz" in
12685         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12686         esac
12687 fi
12688
12689 : test whether _ptr and _cnt really work
12690 echo "Checking how std your stdio is..." >&4
12691 $cat >try.c <<EOP
12692 #include <stdio.h>
12693 #$i_stdlib I_STDLIB
12694 #ifdef I_STDLIB
12695 #include <stdlib.h>
12696 #endif
12697 #define FILE_ptr(fp)    $stdio_ptr
12698 #define FILE_cnt(fp)    $stdio_cnt
12699 int main() {
12700         FILE *fp = fopen("try.c", "r");
12701         char c = getc(fp);
12702         if (
12703                 18 <= FILE_cnt(fp) &&
12704                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12705         )
12706                 exit(0);
12707         exit(1);
12708 }
12709 EOP
12710 val="$undef"
12711 set try
12712 if eval $compile && $to try.c; then
12713         if $run ./try; then
12714                 echo "Your stdio acts pretty std."
12715                 val="$define"
12716         else
12717                 echo "Your stdio isn't very std."
12718         fi
12719 else
12720         echo "Your stdio doesn't appear very std."
12721 fi
12722 $rm_try
12723
12724 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12725 # direct buffer manipulation no longer works.  The Configure tests
12726 # should be changed to correctly detect this, but until then,
12727 # the following check should at least let perl compile and run.
12728 # (This quick fix should be updated before 5.8.1.)
12729 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12730 # A. Dougherty, June 3, 2002.
12731 case "$d_gnulibc" in
12732 $define)
12733         case "$gnulibc_version" in
12734         2.[01]*)  ;;
12735         2.2) ;;
12736         2.2.[0-9]) ;;
12737         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12738                 val="$undef"
12739                 ;;
12740         esac
12741         ;;
12742 esac
12743 set d_stdstdio
12744 eval $setvar
12745
12746 : Can _ptr be used as an lvalue?
12747 case "$d_stdstdio$ptr_lval" in
12748 $define$define) val=$define ;;
12749 *) val=$undef ;;
12750 esac
12751 set d_stdio_ptr_lval
12752 eval $setvar
12753
12754 : Can _cnt be used as an lvalue?
12755 case "$d_stdstdio$cnt_lval" in
12756 $define$define) val=$define ;;
12757 *) val=$undef ;;
12758 esac
12759 set d_stdio_cnt_lval
12760 eval $setvar
12761
12762
12763 : test whether setting _ptr sets _cnt as a side effect
12764 d_stdio_ptr_lval_sets_cnt="$undef"
12765 d_stdio_ptr_lval_nochange_cnt="$undef"
12766 case "$d_stdio_ptr_lval$d_stdstdio" in
12767 $define$define)
12768         echo "Checking to see what happens if we set the stdio ptr..." >&4
12769 $cat >try.c <<EOP
12770 #include <stdio.h>
12771 /* Can we scream? */
12772 /* Eat dust sed :-) */
12773 /* In the buffer space, no one can hear you scream. */
12774 #$i_stdlib I_STDLIB
12775 #ifdef I_STDLIB
12776 #include <stdlib.h>
12777 #endif
12778 #define FILE_ptr(fp)    $stdio_ptr
12779 #define FILE_cnt(fp)    $stdio_cnt
12780 #include <sys/types.h>
12781 int main() {
12782         FILE *fp = fopen("try.c", "r");
12783         int c;
12784         char *ptr;
12785         size_t cnt;
12786         if (!fp) {
12787             puts("Fail even to read");
12788             exit(1);
12789         }
12790         c = getc(fp); /* Read away the first # */
12791         if (c == EOF) {
12792             puts("Fail even to read");
12793             exit(1);
12794         }
12795         if (!(
12796                 18 <= FILE_cnt(fp) &&
12797                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12798         )) {
12799                 puts("Fail even to read");
12800                 exit (1);
12801         }
12802         ptr = (char*) FILE_ptr(fp);
12803         cnt = (size_t)FILE_cnt(fp);
12804
12805         FILE_ptr(fp) += 42;
12806
12807         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12808                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12809                 exit (1);
12810         }
12811         if (FILE_cnt(fp) <= 20) {
12812                 printf ("Fail (<20 chars to test)");
12813                 exit (1);
12814         }
12815         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12816                 puts("Fail compare");
12817                 exit (1);
12818         }
12819         if (cnt == FILE_cnt(fp)) {
12820                 puts("Pass_unchanged");
12821                 exit (0);
12822         }
12823         if (FILE_cnt(fp) == (cnt - 42)) {
12824                 puts("Pass_changed");
12825                 exit (0);
12826         }
12827         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12828         return 1;
12829
12830 }
12831 EOP
12832         set try
12833         if eval $compile && $to try.c; then
12834                 case `$run ./try` in
12835                 Pass_changed)
12836                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12837                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12838                 Pass_unchanged)
12839                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12840                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12841                 Fail*)
12842                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12843                 *)
12844                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12845         esac
12846         else
12847                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12848         fi
12849         $rm_try
12850         ;;
12851 esac
12852
12853 : see if _base is also standard
12854 val="$undef"
12855 case "$d_stdstdio" in
12856 $define)
12857         $cat >try.c <<EOP
12858 #include <stdio.h>
12859 #$i_stdlib I_STDLIB
12860 #ifdef I_STDLIB
12861 #include <stdlib.h>
12862 #endif
12863 #define FILE_base(fp)   $stdio_base
12864 #define FILE_bufsiz(fp) $stdio_bufsiz
12865 int main() {
12866         FILE *fp = fopen("try.c", "r");
12867         char c = getc(fp);
12868         if (
12869                 19 <= FILE_bufsiz(fp) &&
12870                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12871         )
12872                 exit(0);
12873         exit(1);
12874 }
12875 EOP
12876         set try
12877         if eval $compile && $to try.c; then
12878                 if $run ./try; then
12879                         echo "And its _base field acts std."
12880                         val="$define"
12881                 else
12882                         echo "But its _base field isn't std."
12883                 fi
12884         else
12885                 echo "However, it seems to be lacking the _base field."
12886         fi
12887         $rm_try
12888         ;;
12889 esac
12890 set d_stdiobase
12891 eval $setvar
12892
12893 : see if fast_stdio exists
12894 val="$undef"
12895 case "$d_stdstdio:$d_stdio_ptr_lval" in
12896 "$define:$define")
12897         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12898         *$define*)
12899                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12900                 val="$define"
12901                 ;;
12902         esac
12903         ;;
12904 esac
12905 set d_faststdio
12906 eval $setvar
12907
12908
12909
12910 : see if fchdir exists
12911 set fchdir d_fchdir
12912 eval $inlibc
12913
12914 : see if fchmod exists
12915 set fchmod d_fchmod
12916 eval $inlibc
12917
12918 : see if fchown exists
12919 set fchown d_fchown
12920 eval $inlibc
12921
12922 : see if this is an fcntl system
12923 set fcntl d_fcntl
12924 eval $inlibc
12925
12926 : See if fcntl-based locking works.
12927 echo " "
12928 $cat >try.c <<EOCP
12929 #$i_stdlib I_STDLIB
12930 #ifdef I_STDLIB
12931 #include <stdlib.h>
12932 #endif
12933 #include <unistd.h>
12934 #include <fcntl.h>
12935 #include <signal.h>
12936 $signal_t blech(int x) { exit(3); }
12937 int main() {
12938 #if defined(F_SETLK) && defined(F_SETLKW)
12939      struct flock flock;
12940      int retval, fd;
12941      fd = open("try.c", O_RDONLY);
12942      flock.l_type = F_RDLCK;
12943      flock.l_whence = SEEK_SET;
12944      flock.l_start = flock.l_len = 0;
12945      signal(SIGALRM, blech);
12946      alarm(10);
12947      retval = fcntl(fd, F_SETLK, &flock);
12948      close(fd);
12949      (retval < 0 ? exit(2) : exit(0));
12950 #else
12951      exit(2);
12952 #endif
12953 }
12954 EOCP
12955 echo "Checking if fcntl-based file locking works... "
12956 case "$d_fcntl" in
12957 "$define")
12958         set try
12959         if eval $compile_ok; then
12960                 if $run ./try; then
12961                         echo "Yes, it seems to work."
12962                         val="$define"
12963                 else
12964                         echo "Nope, it didn't work."
12965                         val="$undef"
12966                         case "$?" in
12967                         3) $cat >&4 <<EOM
12968 ***
12969 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12970 *** This is (almost) impossible.
12971 *** If your NFS lock daemons are not feeling well, something like
12972 *** this may happen, please investigate.  Cannot continue, aborting.
12973 ***
12974 EOM
12975                                 exit 1
12976                                 ;;
12977                         esac
12978                 fi
12979         else
12980                 echo "I'm unable to compile the test program, so I'll assume not."
12981                 val="$undef"
12982         fi
12983         ;;
12984 *) val="$undef";
12985         echo "Nope, since you don't even have fcntl()."
12986         ;;
12987 esac
12988 set d_fcntl_can_lock
12989 eval $setvar
12990 $rm_try
12991
12992 : check for fd_set items
12993 $cat <<EOM
12994
12995 Checking to see how well your C compiler handles fd_set and friends ...
12996 EOM
12997 $cat >try.c <<EOCP
12998 #$i_stdlib I_STDLIB
12999 #ifdef I_STDLIB
13000 #include <stdlib.h>
13001 #endif
13002 #$i_systime I_SYS_TIME
13003 #$i_sysselct I_SYS_SELECT
13004 #$d_socket HAS_SOCKET
13005 #include <sys/types.h>
13006 #ifdef HAS_SOCKET
13007 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13008 #endif
13009 #ifdef I_SYS_TIME
13010 #include <sys/time.h>
13011 #endif
13012 #ifdef I_SYS_SELECT
13013 #include <sys/select.h>
13014 #endif
13015 int main() {
13016         fd_set fds;
13017
13018 #ifdef TRYBITS
13019         if(fds.fds_bits);
13020 #endif
13021
13022 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13023         exit(0);
13024 #else
13025         exit(1);
13026 #endif
13027 }
13028 EOCP
13029 set try -DTRYBITS
13030 if eval $compile; then
13031         d_fds_bits="$define"
13032         d_fd_set="$define"
13033         echo "Well, your system knows about the normal fd_set typedef..." >&4
13034         if $run ./try; then
13035                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13036                 d_fd_macros="$define"
13037         else
13038                 $cat >&4 <<'EOM'
13039 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13040 EOM
13041                 d_fd_macros="$undef"
13042         fi
13043 else
13044         $cat <<'EOM'
13045 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13046 EOM
13047         set try
13048         if eval $compile; then
13049                 d_fds_bits="$undef"
13050                 d_fd_set="$define"
13051                 echo "Well, your system has some sort of fd_set available..." >&4
13052                 if $run ./try; then
13053                         echo "and you have the normal fd_set macros." >&4
13054                         d_fd_macros="$define"
13055                 else
13056                         $cat <<'EOM'
13057 but not the normal fd_set macros!  Gross!  More work for me...
13058 EOM
13059                         d_fd_macros="$undef"
13060                 fi
13061         else
13062         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13063                 d_fd_set="$undef"
13064                 d_fds_bits="$undef"
13065                 d_fd_macros="$undef"
13066         fi
13067 fi
13068 $rm_try
13069
13070 : see if fgetpos exists
13071 set fgetpos d_fgetpos
13072 eval $inlibc
13073
13074 : see if finite exists
13075 set finite d_finite
13076 eval $inlibc
13077
13078 : see if finitel exists
13079 set finitel d_finitel
13080 eval $inlibc
13081
13082 : see if flock exists
13083 set flock d_flock
13084 eval $inlibc
13085
13086 : see if prototype for flock is available
13087 echo " "
13088 set d_flockproto flock $i_sysfile sys/file.h
13089 eval $hasproto
13090
13091 : see if fp_class exists
13092 set fp_class d_fp_class
13093 eval $inlibc
13094
13095 : see if pathconf exists
13096 set pathconf d_pathconf
13097 eval $inlibc
13098
13099 : see if fpathconf exists
13100 set fpathconf d_fpathconf
13101 eval $inlibc
13102
13103 : see if fpclass exists
13104 set fpclass d_fpclass
13105 eval $inlibc
13106
13107 : see if fpclassify exists
13108 set fpclassify d_fpclassify
13109 eval $inlibc
13110
13111 : see if fpclassl exists
13112 set fpclassl d_fpclassl
13113 eval $inlibc
13114
13115 : check for fpos64_t
13116 echo " "
13117 echo "Checking to see if you have fpos64_t..." >&4
13118 $cat >try.c <<EOCP
13119 #include <stdio.h>
13120 int main() { fpos64_t x = 7; }
13121 EOCP
13122 set try
13123 if eval $compile; then
13124         val="$define"
13125         echo "You have fpos64_t."
13126 else
13127         val="$undef"
13128         echo "You do not have fpos64_t."
13129         case "$fpossize" in
13130         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13131         esac
13132 fi
13133 $rm_try
13134 set d_fpos64_t
13135 eval $setvar
13136
13137 : see if frexpl exists
13138 set frexpl d_frexpl
13139 eval $inlibc
13140
13141 : see if this is a sys/param system
13142 set sys/param.h i_sysparam
13143 eval $inhdr
13144
13145 : see if this is a sys/mount.h system
13146 set sys/mount.h i_sysmount
13147 eval $inhdr
13148
13149 : Check for fs_data_s
13150 echo " "
13151 echo "Checking to see if your system supports struct fs_data..." >&4
13152 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13153 eval $hasstruct
13154 case "$d_fs_data_s" in
13155 "$define")      echo "Yes, it does."   ;;
13156 *)              echo "No, it doesn't." ;;
13157 esac
13158
13159 : see if fseeko exists
13160 set fseeko d_fseeko
13161 eval $inlibc
13162 case "$longsize" in
13163 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13164 esac
13165
13166 : see if fsetpos exists
13167 set fsetpos d_fsetpos
13168 eval $inlibc
13169
13170 : see if fstatfs exists
13171 set fstatfs d_fstatfs
13172 eval $inlibc
13173
13174 : see if statvfs exists
13175 set statvfs d_statvfs
13176 eval $inlibc
13177
13178 : see if fstatvfs exists
13179 set fstatvfs d_fstatvfs
13180 eval $inlibc
13181
13182
13183 : see if fsync exists
13184 set fsync d_fsync
13185 eval $inlibc
13186
13187 : see if ftello exists
13188 set ftello d_ftello
13189 eval $inlibc
13190 case "$longsize" in
13191 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13192 esac
13193
13194 : check for a working futimes
13195 d_futimes="$undef"
13196 echo " "
13197 echo "Checking if you have a working futimes()" >&4
13198 $cat >try.c <<EOCP
13199 #include <stdio.h>
13200 #include <sys/time.h>
13201 #include <errno.h>
13202 #include <fcntl.h>
13203
13204 int main ()
13205 {
13206     int fd, rv;
13207     fd = open ("try.c", O_RDWR);
13208     if (-1 == fd) exit (1);
13209     rv = futimes (fd, NULL);
13210     exit (rv == -1 ? errno : 0);
13211 }
13212 EOCP
13213 set try
13214 if eval $compile; then
13215     `$run ./try`
13216     rc=$?
13217     case "$rc" in
13218         0)  echo "Yes, you have" >&4
13219             d_futimes="$define"
13220             ;;
13221         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13222             ;;
13223     esac
13224 else
13225     echo "No, it does not (probably harmless)" >&4
13226 fi
13227 $rm_try
13228
13229 : see if getcwd exists
13230 set getcwd d_getcwd
13231 eval $inlibc
13232
13233 : see if getespwnam exists
13234 set getespwnam d_getespwnam
13235 eval $inlibc
13236
13237 : see if getfsstat exists
13238 set getfsstat d_getfsstat
13239 eval $inlibc
13240
13241 : see if getgrent exists
13242 set getgrent d_getgrent
13243 eval $inlibc
13244
13245 : see if getgrent_r exists
13246 set getgrent_r d_getgrent_r
13247 eval $inlibc
13248 case "$d_getgrent_r" in
13249 "$define")
13250         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13251         case "$d_getgrent_r_proto:$usethreads" in
13252         ":define")      d_getgrent_r_proto=define
13253                 set d_getgrent_r_proto getgrent_r $hdrs
13254                 eval $hasproto ;;
13255         *)      ;;
13256         esac
13257         case "$d_getgrent_r_proto" in
13258         define)
13259         case "$getgrent_r_proto" in
13260         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13261         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13262         esac
13263         case "$getgrent_r_proto" in
13264         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13265         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13266         esac
13267         case "$getgrent_r_proto" in
13268         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13269         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
13270         esac
13271         case "$getgrent_r_proto" in
13272         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13273         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
13274         esac
13275         case "$getgrent_r_proto" in
13276         ''|0) try='int getgrent_r(struct group*, char*, int);'
13277         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
13278         esac
13279         case "$getgrent_r_proto" in
13280         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13281         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13282         esac
13283         case "$getgrent_r_proto" in
13284         ''|0)   d_getgrent_r=undef
13285                 getgrent_r_proto=0
13286                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13287         * )     case "$getgrent_r_proto" in
13288                 REENTRANT_PROTO*) ;;
13289                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13290                 esac
13291                 echo "Prototype: $try" ;;
13292         esac
13293         ;;
13294         *)      case "$usethreads" in
13295                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13296                 esac
13297                 d_getgrent_r=undef
13298                 getgrent_r_proto=0
13299                 ;;
13300         esac
13301         ;;
13302 *)      getgrent_r_proto=0
13303         ;;
13304 esac
13305
13306 : see if getgrgid_r exists
13307 set getgrgid_r d_getgrgid_r
13308 eval $inlibc
13309 case "$d_getgrgid_r" in
13310 "$define")
13311         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13312         case "$d_getgrgid_r_proto:$usethreads" in
13313         ":define")      d_getgrgid_r_proto=define
13314                 set d_getgrgid_r_proto getgrgid_r $hdrs
13315                 eval $hasproto ;;
13316         *)      ;;
13317         esac
13318         case "$d_getgrgid_r_proto" in
13319         define)
13320         case "$getgrgid_r_proto" in
13321         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13322         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13323         esac
13324         case "$getgrgid_r_proto" in
13325         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13326         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13327         esac
13328         case "$getgrgid_r_proto" in
13329         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13330         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13331         esac
13332         case "$getgrgid_r_proto" in
13333         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13334         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13335         esac
13336         case "$getgrgid_r_proto" in
13337         ''|0)   d_getgrgid_r=undef
13338                 getgrgid_r_proto=0
13339                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13340         * )     case "$getgrgid_r_proto" in
13341                 REENTRANT_PROTO*) ;;
13342                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13343                 esac
13344                 echo "Prototype: $try" ;;
13345         esac
13346         ;;
13347         *)      case "$usethreads" in
13348                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13349                 esac
13350                 d_getgrgid_r=undef
13351                 getgrgid_r_proto=0
13352                 ;;
13353         esac
13354         ;;
13355 *)      getgrgid_r_proto=0
13356         ;;
13357 esac
13358
13359 : see if getgrnam_r exists
13360 set getgrnam_r d_getgrnam_r
13361 eval $inlibc
13362 case "$d_getgrnam_r" in
13363 "$define")
13364         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13365         case "$d_getgrnam_r_proto:$usethreads" in
13366         ":define")      d_getgrnam_r_proto=define
13367                 set d_getgrnam_r_proto getgrnam_r $hdrs
13368                 eval $hasproto ;;
13369         *)      ;;
13370         esac
13371         case "$d_getgrnam_r_proto" in
13372         define)
13373         case "$getgrnam_r_proto" in
13374         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13375         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13376         esac
13377         case "$getgrnam_r_proto" in
13378         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13379         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13380         esac
13381         case "$getgrnam_r_proto" in
13382         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13383         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13384         esac
13385         case "$getgrnam_r_proto" in
13386         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13387         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13388         esac
13389         case "$getgrnam_r_proto" in
13390         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13391         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13392         esac
13393         case "$getgrnam_r_proto" in
13394         ''|0)   d_getgrnam_r=undef
13395                 getgrnam_r_proto=0
13396                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13397         * )     case "$getgrnam_r_proto" in
13398                 REENTRANT_PROTO*) ;;
13399                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13400                 esac
13401                 echo "Prototype: $try" ;;
13402         esac
13403         ;;
13404         *)      case "$usethreads" in
13405                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13406                 esac
13407                 d_getgrnam_r=undef
13408                 getgrnam_r_proto=0
13409                 ;;
13410         esac
13411         ;;
13412 *)      getgrnam_r_proto=0
13413         ;;
13414 esac
13415
13416 : see if gethostbyaddr exists
13417 set gethostbyaddr d_gethbyaddr
13418 eval $inlibc
13419
13420 : see if gethostbyname exists
13421 set gethostbyname d_gethbyname
13422 eval $inlibc
13423
13424 : see if gethostent exists
13425 set gethostent d_gethent
13426 eval $inlibc
13427
13428 : see how we will look up host name
13429 echo " "
13430 call=''
13431 if set gethostname val -f d_gethname; eval $csym; $val; then
13432         echo 'gethostname() found.' >&4
13433         d_gethname="$define"
13434         call=gethostname
13435 fi
13436 if set uname val -f d_uname; eval $csym; $val; then
13437         if ./xenix; then
13438                 $cat <<'EOM'
13439 uname() was found, but you're running xenix, and older versions of xenix
13440 have a broken uname(). If you don't really know whether your xenix is old
13441 enough to have a broken system call, use the default answer.
13442
13443 EOM
13444                 dflt=y
13445                 case "$d_uname" in
13446                 "$define") dflt=n;;
13447                 esac
13448                 rp='Is your uname() broken?'
13449                 . ./myread
13450                 case "$ans" in
13451                 n*) d_uname="$define"; call=uname;;
13452                 esac
13453         else
13454                 echo 'uname() found.' >&4
13455                 d_uname="$define"
13456                 case "$call" in
13457                 '') call=uname ;;
13458                 esac
13459         fi
13460 fi
13461 case "$d_gethname" in
13462 '') d_gethname="$undef";;
13463 esac
13464 case "$d_uname" in
13465 '') d_uname="$undef";;
13466 esac
13467 case "$d_uname$d_gethname" in
13468 *define*)
13469         dflt=n
13470         cat <<EOM
13471
13472 Every now and then someone has a $call() that lies about the hostname
13473 but can't be fixed for political or economic reasons.  If you wish, I can
13474 pretend $call() isn't there and maybe compute hostname at run-time
13475 thanks to the '$phostname' command.
13476
13477 EOM
13478         rp="Shall I ignore $call() from now on?"
13479         . ./myread
13480         case "$ans" in
13481         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13482         esac;;
13483 esac
13484 case "$phostname" in
13485 '') aphostname='';;
13486 *) case "$aphostname" in
13487         /*) ;;
13488         *) set X $phostname
13489                 shift
13490                 file=$1
13491                 shift
13492                 file=`./loc $file $file $pth`
13493                 aphostname=`echo $file $*`
13494                 ;;
13495         esac
13496         ;;
13497 esac
13498 case "$d_uname$d_gethname" in
13499 *define*) ;;
13500 *)
13501         case "$phostname" in
13502         '')
13503                 echo "There will be no way for $package to get your hostname." >&4;;
13504         *)
13505         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13506                 ;;
13507         esac;;
13508 esac
13509 case "$d_phostname" in
13510 '') d_phostname="$undef";;
13511 esac
13512
13513 : see if gethostbyaddr_r exists
13514 set gethostbyaddr_r d_gethostbyaddr_r
13515 eval $inlibc
13516 case "$d_gethostbyaddr_r" in
13517 "$define")
13518         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13519         case "$d_gethostbyaddr_r_proto:$usethreads" in
13520         ":define")      d_gethostbyaddr_r_proto=define
13521                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13522                 eval $hasproto ;;
13523         *)      ;;
13524         esac
13525         case "$d_gethostbyaddr_r_proto" in
13526         define)
13527         case "$gethostbyaddr_r_proto" in
13528         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13529         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13530         esac
13531         case "$gethostbyaddr_r_proto" in
13532         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13533         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13534         esac
13535         case "$gethostbyaddr_r_proto" in
13536         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13537         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13538         esac
13539         case "$gethostbyaddr_r_proto" in
13540         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13541         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13542         esac
13543         case "$gethostbyaddr_r_proto" in
13544         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13545         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13546         esac
13547         case "$gethostbyaddr_r_proto" in
13548         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13549         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13550         esac
13551         case "$gethostbyaddr_r_proto" in
13552         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13553         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13554         esac
13555         case "$gethostbyaddr_r_proto" in
13556         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13557         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13558         esac
13559         case "$gethostbyaddr_r_proto" in
13560         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13561         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13562         esac
13563         case "$gethostbyaddr_r_proto" in
13564         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13565         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13566         esac
13567         case "$gethostbyaddr_r_proto" in
13568         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13569         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13570         esac
13571         case "$gethostbyaddr_r_proto" in
13572         ''|0)   d_gethostbyaddr_r=undef
13573                 gethostbyaddr_r_proto=0
13574                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13575         * )     case "$gethostbyaddr_r_proto" in
13576                 REENTRANT_PROTO*) ;;
13577                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13578                 esac
13579                 echo "Prototype: $try" ;;
13580         esac
13581         ;;
13582         *)      case "$usethreads" in
13583                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13584                 esac
13585                 d_gethostbyaddr_r=undef
13586                 gethostbyaddr_r_proto=0
13587                 ;;
13588         esac
13589         ;;
13590 *)      gethostbyaddr_r_proto=0
13591         ;;
13592 esac
13593
13594 : see if gethostbyname_r exists
13595 set gethostbyname_r d_gethostbyname_r
13596 eval $inlibc
13597 case "$d_gethostbyname_r" in
13598 "$define")
13599         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13600         case "$d_gethostbyname_r_proto:$usethreads" in
13601         ":define")      d_gethostbyname_r_proto=define
13602                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13603                 eval $hasproto ;;
13604         *)      ;;
13605         esac
13606         case "$d_gethostbyname_r_proto" in
13607         define)
13608         case "$gethostbyname_r_proto" in
13609         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13610         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13611         esac
13612         case "$gethostbyname_r_proto" in
13613         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13614         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13615         esac
13616         case "$gethostbyname_r_proto" in
13617         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13618         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13619         esac
13620         case "$gethostbyname_r_proto" in
13621         ''|0)   d_gethostbyname_r=undef
13622                 gethostbyname_r_proto=0
13623                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13624         * )     case "$gethostbyname_r_proto" in
13625                 REENTRANT_PROTO*) ;;
13626                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13627                 esac
13628                 echo "Prototype: $try" ;;
13629         esac
13630         ;;
13631         *)      case "$usethreads" in
13632                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13633                 esac
13634                 d_gethostbyname_r=undef
13635                 gethostbyname_r_proto=0
13636                 ;;
13637         esac
13638         ;;
13639 *)      gethostbyname_r_proto=0
13640         ;;
13641 esac
13642
13643 : see if gethostent_r exists
13644 set gethostent_r d_gethostent_r
13645 eval $inlibc
13646 case "$d_gethostent_r" in
13647 "$define")
13648         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13649         case "$d_gethostent_r_proto:$usethreads" in
13650         ":define")      d_gethostent_r_proto=define
13651                 set d_gethostent_r_proto gethostent_r $hdrs
13652                 eval $hasproto ;;
13653         *)      ;;
13654         esac
13655         case "$d_gethostent_r_proto" in
13656         define)
13657         case "$gethostent_r_proto" in
13658         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13659         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13660         esac
13661         case "$gethostent_r_proto" in
13662         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13663         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13664         esac
13665         case "$gethostent_r_proto" in
13666         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13667         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13668         esac
13669         case "$gethostent_r_proto" in
13670         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13671         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13672         esac
13673         case "$gethostent_r_proto" in
13674         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13675         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13676         esac
13677         case "$gethostent_r_proto" in
13678         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13679         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13680         esac
13681         case "$gethostent_r_proto" in
13682         ''|0)   d_gethostent_r=undef
13683                 gethostent_r_proto=0
13684                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13685         * )     case "$gethostent_r_proto" in
13686                 REENTRANT_PROTO*) ;;
13687                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13688                 esac
13689                 echo "Prototype: $try" ;;
13690         esac
13691         ;;
13692         *)      case "$usethreads" in
13693                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13694                 esac
13695                 d_gethostent_r=undef
13696                 gethostent_r_proto=0
13697                 ;;
13698         esac
13699         ;;
13700 *)      gethostent_r_proto=0
13701         ;;
13702 esac
13703
13704 : see if prototypes for various gethostxxx netdb.h functions are available
13705 echo " "
13706 set d_gethostprotos gethostent $i_netdb netdb.h
13707 eval $hasproto
13708
13709 : see if getitimer exists
13710 set getitimer d_getitimer
13711 eval $inlibc
13712
13713 : see if getlogin exists
13714 set getlogin d_getlogin
13715 eval $inlibc
13716
13717 : see if getlogin_r exists
13718 set getlogin_r d_getlogin_r
13719 eval $inlibc
13720 case "$d_getlogin_r" in
13721 "$define")
13722         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13723         case "$d_getlogin_r_proto:$usethreads" in
13724         ":define")      d_getlogin_r_proto=define
13725                 set d_getlogin_r_proto getlogin_r $hdrs
13726                 eval $hasproto ;;
13727         *)      ;;
13728         esac
13729         case "$d_getlogin_r_proto" in
13730         define)
13731         case "$getlogin_r_proto" in
13732         ''|0) try='int getlogin_r(char*, size_t);'
13733         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13734         esac
13735         case "$getlogin_r_proto" in
13736         ''|0) try='int getlogin_r(char*, int);'
13737         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13738         esac
13739         case "$getlogin_r_proto" in
13740         ''|0) try='char* getlogin_r(char*, size_t);'
13741         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13742         esac
13743         case "$getlogin_r_proto" in
13744         ''|0) try='char* getlogin_r(char*, int);'
13745         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13746         esac
13747         case "$getlogin_r_proto" in
13748         ''|0)   d_getlogin_r=undef
13749                 getlogin_r_proto=0
13750                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13751         * )     case "$getlogin_r_proto" in
13752                 REENTRANT_PROTO*) ;;
13753                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13754                 esac
13755                 echo "Prototype: $try" ;;
13756         esac
13757         ;;
13758         *)      case "$usethreads" in
13759                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13760                 esac
13761                 d_getlogin_r=undef
13762                 getlogin_r_proto=0
13763                 ;;
13764         esac
13765         ;;
13766 *)      getlogin_r_proto=0
13767         ;;
13768 esac
13769
13770 : see if getmnt exists
13771 set getmnt d_getmnt
13772 eval $inlibc
13773
13774 : see if getmntent exists
13775 set getmntent d_getmntent
13776 eval $inlibc
13777
13778 : see if getnetbyaddr exists
13779 set getnetbyaddr d_getnbyaddr
13780 eval $inlibc
13781
13782 : see if getnetbyname exists
13783 set getnetbyname d_getnbyname
13784 eval $inlibc
13785
13786 : see if getnetent exists
13787 set getnetent d_getnent
13788 eval $inlibc
13789
13790 : see if getnetbyaddr_r exists
13791 set getnetbyaddr_r d_getnetbyaddr_r
13792 eval $inlibc
13793 case "$d_getnetbyaddr_r" in
13794 "$define")
13795         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13796         case "$d_getnetbyaddr_r_proto:$usethreads" in
13797         ":define")      d_getnetbyaddr_r_proto=define
13798                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13799                 eval $hasproto ;;
13800         *)      ;;
13801         esac
13802         case "$d_getnetbyaddr_r_proto" in
13803         define)
13804         case "$getnetbyaddr_r_proto" in
13805         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13806         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13807         esac
13808         case "$getnetbyaddr_r_proto" in
13809         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13810         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13811         esac
13812         case "$getnetbyaddr_r_proto" in
13813         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13814         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13815         esac
13816         case "$getnetbyaddr_r_proto" in
13817         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13818         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13819         esac
13820         case "$getnetbyaddr_r_proto" in
13821         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13822         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13823         esac
13824         case "$getnetbyaddr_r_proto" in
13825         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13826         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13827         esac
13828         case "$getnetbyaddr_r_proto" in
13829         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13830         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13831         esac
13832         case "$getnetbyaddr_r_proto" in
13833         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13834         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13835         esac
13836         case "$getnetbyaddr_r_proto" in
13837         ''|0)   d_getnetbyaddr_r=undef
13838                 getnetbyaddr_r_proto=0
13839                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13840         * )     case "$getnetbyaddr_r_proto" in
13841                 REENTRANT_PROTO*) ;;
13842                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13843                 esac
13844                 echo "Prototype: $try" ;;
13845         esac
13846         ;;
13847         *)      case "$usethreads" in
13848                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13849                 esac
13850                 d_getnetbyaddr_r=undef
13851                 getnetbyaddr_r_proto=0
13852                 ;;
13853         esac
13854         ;;
13855 *)      getnetbyaddr_r_proto=0
13856         ;;
13857 esac
13858
13859 : see if getnetbyname_r exists
13860 set getnetbyname_r d_getnetbyname_r
13861 eval $inlibc
13862 case "$d_getnetbyname_r" in
13863 "$define")
13864         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13865         case "$d_getnetbyname_r_proto:$usethreads" in
13866         ":define")      d_getnetbyname_r_proto=define
13867                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13868                 eval $hasproto ;;
13869         *)      ;;
13870         esac
13871         case "$d_getnetbyname_r_proto" in
13872         define)
13873         case "$getnetbyname_r_proto" in
13874         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13875         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13876         esac
13877         case "$getnetbyname_r_proto" in
13878         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13879         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13880         esac
13881         case "$getnetbyname_r_proto" in
13882         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13883         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13884         esac
13885         case "$getnetbyname_r_proto" in
13886         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13887         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13888         esac
13889         case "$getnetbyname_r_proto" in
13890         ''|0)   d_getnetbyname_r=undef
13891                 getnetbyname_r_proto=0
13892                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13893         * )     case "$getnetbyname_r_proto" in
13894                 REENTRANT_PROTO*) ;;
13895                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13896                 esac
13897                 echo "Prototype: $try" ;;
13898         esac
13899         ;;
13900         *)      case "$usethreads" in
13901                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13902                 esac
13903                 d_getnetbyname_r=undef
13904                 getnetbyname_r_proto=0
13905                 ;;
13906         esac
13907         ;;
13908 *)      getnetbyname_r_proto=0
13909         ;;
13910 esac
13911
13912 : see if getnetent_r exists
13913 set getnetent_r d_getnetent_r
13914 eval $inlibc
13915 case "$d_getnetent_r" in
13916 "$define")
13917         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13918         case "$d_getnetent_r_proto:$usethreads" in
13919         ":define")      d_getnetent_r_proto=define
13920                 set d_getnetent_r_proto getnetent_r $hdrs
13921                 eval $hasproto ;;
13922         *)      ;;
13923         esac
13924         case "$d_getnetent_r_proto" in
13925         define)
13926         case "$getnetent_r_proto" in
13927         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13928         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13929         esac
13930         case "$getnetent_r_proto" in
13931         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13932         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13933         esac
13934         case "$getnetent_r_proto" in
13935         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13936         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13937         esac
13938         case "$getnetent_r_proto" in
13939         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13940         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13941         esac
13942         case "$getnetent_r_proto" in
13943         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13944         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13945         esac
13946         case "$getnetent_r_proto" in
13947         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13948         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13949         esac
13950         case "$getnetent_r_proto" in
13951         ''|0)   d_getnetent_r=undef
13952                 getnetent_r_proto=0
13953                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13954         * )     case "$getnetent_r_proto" in
13955                 REENTRANT_PROTO*) ;;
13956                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13957                 esac
13958                 echo "Prototype: $try" ;;
13959         esac
13960         ;;
13961         *)      case "$usethreads" in
13962                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13963                 esac
13964                 d_getnetent_r=undef
13965                 getnetent_r_proto=0
13966                 ;;
13967         esac
13968         ;;
13969 *)      getnetent_r_proto=0
13970         ;;
13971 esac
13972
13973 : see if prototypes for various getnetxxx netdb.h functions are available
13974 echo " "
13975 set d_getnetprotos getnetent $i_netdb netdb.h
13976 eval $hasproto
13977
13978 : see if getpagesize exists
13979 set getpagesize d_getpagsz
13980 eval $inlibc
13981
13982 : Optional checks for getprotobyname and getprotobynumber
13983
13984 : see if getprotobyname exists
13985 set getprotobyname d_getpbyname
13986 eval $inlibc
13987
13988 : see if getprotobynumber exists
13989 set getprotobynumber d_getpbynumber
13990 eval $inlibc
13991
13992 : see if getprotoent exists
13993 set getprotoent d_getpent
13994 eval $inlibc
13995
13996 : see if getpgid exists
13997 set getpgid d_getpgid
13998 eval $inlibc
13999
14000 : see if getpgrp2 exists
14001 set getpgrp2 d_getpgrp2
14002 eval $inlibc
14003
14004 : see if getppid exists
14005 set getppid d_getppid
14006 eval $inlibc
14007
14008 : see if getpriority exists
14009 set getpriority d_getprior
14010 eval $inlibc
14011
14012 : see if getprotobyname_r exists
14013 set getprotobyname_r d_getprotobyname_r
14014 eval $inlibc
14015 case "$d_getprotobyname_r" in
14016 "$define")
14017         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14018         case "$d_getprotobyname_r_proto:$usethreads" in
14019         ":define")      d_getprotobyname_r_proto=define
14020                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14021                 eval $hasproto ;;
14022         *)      ;;
14023         esac
14024         case "$d_getprotobyname_r_proto" in
14025         define)
14026         case "$getprotobyname_r_proto" in
14027         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14028         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14029         esac
14030         case "$getprotobyname_r_proto" in
14031         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14032         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14033         esac
14034         case "$getprotobyname_r_proto" in
14035         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14036         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14037         esac
14038         case "$getprotobyname_r_proto" in
14039         ''|0)   d_getprotobyname_r=undef
14040                 getprotobyname_r_proto=0
14041                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14042         * )     case "$getprotobyname_r_proto" in
14043                 REENTRANT_PROTO*) ;;
14044                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14045                 esac
14046                 echo "Prototype: $try" ;;
14047         esac
14048         ;;
14049         *)      case "$usethreads" in
14050                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14051                 esac
14052                 d_getprotobyname_r=undef
14053                 getprotobyname_r_proto=0
14054                 ;;
14055         esac
14056         ;;
14057 *)      getprotobyname_r_proto=0
14058         ;;
14059 esac
14060
14061 : see if getprotobynumber_r exists
14062 set getprotobynumber_r d_getprotobynumber_r
14063 eval $inlibc
14064 case "$d_getprotobynumber_r" in
14065 "$define")
14066         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14067         case "$d_getprotobynumber_r_proto:$usethreads" in
14068         ":define")      d_getprotobynumber_r_proto=define
14069                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14070                 eval $hasproto ;;
14071         *)      ;;
14072         esac
14073         case "$d_getprotobynumber_r_proto" in
14074         define)
14075         case "$getprotobynumber_r_proto" in
14076         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14077         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14078         esac
14079         case "$getprotobynumber_r_proto" in
14080         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14081         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14082         esac
14083         case "$getprotobynumber_r_proto" in
14084         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14085         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14086         esac
14087         case "$getprotobynumber_r_proto" in
14088         ''|0)   d_getprotobynumber_r=undef
14089                 getprotobynumber_r_proto=0
14090                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14091         * )     case "$getprotobynumber_r_proto" in
14092                 REENTRANT_PROTO*) ;;
14093                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14094                 esac
14095                 echo "Prototype: $try" ;;
14096         esac
14097         ;;
14098         *)      case "$usethreads" in
14099                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14100                 esac
14101                 d_getprotobynumber_r=undef
14102                 getprotobynumber_r_proto=0
14103                 ;;
14104         esac
14105         ;;
14106 *)      getprotobynumber_r_proto=0
14107         ;;
14108 esac
14109
14110 : see if getprotoent_r exists
14111 set getprotoent_r d_getprotoent_r
14112 eval $inlibc
14113 case "$d_getprotoent_r" in
14114 "$define")
14115         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14116         case "$d_getprotoent_r_proto:$usethreads" in
14117         ":define")      d_getprotoent_r_proto=define
14118                 set d_getprotoent_r_proto getprotoent_r $hdrs
14119                 eval $hasproto ;;
14120         *)      ;;
14121         esac
14122         case "$d_getprotoent_r_proto" in
14123         define)
14124         case "$getprotoent_r_proto" in
14125         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14126         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14127         esac
14128         case "$getprotoent_r_proto" in
14129         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14130         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14131         esac
14132         case "$getprotoent_r_proto" in
14133         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14134         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14135         esac
14136         case "$getprotoent_r_proto" in
14137         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14138         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
14139         esac
14140         case "$getprotoent_r_proto" in
14141         ''|0)   d_getprotoent_r=undef
14142                 getprotoent_r_proto=0
14143                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14144         * )     case "$getprotoent_r_proto" in
14145                 REENTRANT_PROTO*) ;;
14146                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14147                 esac
14148                 echo "Prototype: $try" ;;
14149         esac
14150         ;;
14151         *)      case "$usethreads" in
14152                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14153                 esac
14154                 d_getprotoent_r=undef
14155                 getprotoent_r_proto=0
14156                 ;;
14157         esac
14158         ;;
14159 *)      getprotoent_r_proto=0
14160         ;;
14161 esac
14162
14163 : see if prototypes for various getprotoxxx netdb.h functions are available
14164 echo " "
14165 set d_getprotoprotos getprotoent $i_netdb netdb.h
14166 eval $hasproto
14167
14168 : see if getprpwnam exists
14169 set getprpwnam d_getprpwnam
14170 eval $inlibc
14171
14172 : see if getpwent exists
14173 set getpwent d_getpwent
14174 eval $inlibc
14175
14176 : see if getpwent_r exists
14177 set getpwent_r d_getpwent_r
14178 eval $inlibc
14179 case "$d_getpwent_r" in
14180 "$define")
14181         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14182         case "$d_getpwent_r_proto:$usethreads" in
14183         ":define")      d_getpwent_r_proto=define
14184                 set d_getpwent_r_proto getpwent_r $hdrs
14185                 eval $hasproto ;;
14186         *)      ;;
14187         esac
14188         case "$d_getpwent_r_proto" in
14189         define)
14190         case "$getpwent_r_proto" in
14191         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14192         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14193         esac
14194         case "$getpwent_r_proto" in
14195         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14196         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14197         esac
14198         case "$getpwent_r_proto" in
14199         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14200         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
14201         esac
14202         case "$getpwent_r_proto" in
14203         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14204         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
14205         esac
14206         case "$getpwent_r_proto" in
14207         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14208         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
14209         esac
14210         case "$getpwent_r_proto" in
14211         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14212         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14213         esac
14214         case "$getpwent_r_proto" in
14215         ''|0)   d_getpwent_r=undef
14216                 getpwent_r_proto=0
14217                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14218         * )     case "$getpwent_r_proto" in
14219                 REENTRANT_PROTO*) ;;
14220                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14221                 esac
14222                 echo "Prototype: $try" ;;
14223         esac
14224         ;;
14225         *)      case "$usethreads" in
14226                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14227                 esac
14228                 d_getpwent_r=undef
14229                 getpwent_r_proto=0
14230                 ;;
14231         esac
14232         ;;
14233 *)      getpwent_r_proto=0
14234         ;;
14235 esac
14236
14237 : see if getpwnam_r exists
14238 set getpwnam_r d_getpwnam_r
14239 eval $inlibc
14240 case "$d_getpwnam_r" in
14241 "$define")
14242         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14243         case "$d_getpwnam_r_proto:$usethreads" in
14244         ":define")      d_getpwnam_r_proto=define
14245                 set d_getpwnam_r_proto getpwnam_r $hdrs
14246                 eval $hasproto ;;
14247         *)      ;;
14248         esac
14249         case "$d_getpwnam_r_proto" in
14250         define)
14251         case "$getpwnam_r_proto" in
14252         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14253         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14254         esac
14255         case "$getpwnam_r_proto" in
14256         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14257         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14258         esac
14259         case "$getpwnam_r_proto" in
14260         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14261         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14262         esac
14263         case "$getpwnam_r_proto" in
14264         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14265         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14266         esac
14267         case "$getpwnam_r_proto" in
14268         ''|0)   d_getpwnam_r=undef
14269                 getpwnam_r_proto=0
14270                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14271         * )     case "$getpwnam_r_proto" in
14272                 REENTRANT_PROTO*) ;;
14273                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14274                 esac
14275                 echo "Prototype: $try" ;;
14276         esac
14277         ;;
14278         *)      case "$usethreads" in
14279                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14280                 esac
14281                 d_getpwnam_r=undef
14282                 getpwnam_r_proto=0
14283                 ;;
14284         esac
14285         ;;
14286 *)      getpwnam_r_proto=0
14287         ;;
14288 esac
14289
14290 : see if getpwuid_r exists
14291 set getpwuid_r d_getpwuid_r
14292 eval $inlibc
14293 case "$d_getpwuid_r" in
14294 "$define")
14295         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14296         case "$d_getpwuid_r_proto:$usethreads" in
14297         ":define")      d_getpwuid_r_proto=define
14298                 set d_getpwuid_r_proto getpwuid_r $hdrs
14299                 eval $hasproto ;;
14300         *)      ;;
14301         esac
14302         case "$d_getpwuid_r_proto" in
14303         define)
14304         case "$getpwuid_r_proto" in
14305         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14306         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14307         esac
14308         case "$getpwuid_r_proto" in
14309         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14310         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14311         esac
14312         case "$getpwuid_r_proto" in
14313         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14314         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14315         esac
14316         case "$getpwuid_r_proto" in
14317         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14318         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14319         esac
14320         case "$getpwuid_r_proto" in
14321         ''|0)   d_getpwuid_r=undef
14322                 getpwuid_r_proto=0
14323                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14324         * )     case "$getpwuid_r_proto" in
14325                 REENTRANT_PROTO*) ;;
14326                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14327                 esac
14328                 echo "Prototype: $try" ;;
14329         esac
14330         ;;
14331         *)      case "$usethreads" in
14332                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14333                 esac
14334                 d_getpwuid_r=undef
14335                 getpwuid_r_proto=0
14336                 ;;
14337         esac
14338         ;;
14339 *)      getpwuid_r_proto=0
14340         ;;
14341 esac
14342
14343 : Optional checks for getsbyname and getsbyport
14344
14345 : see if getservbyname exists
14346 set getservbyname d_getsbyname
14347 eval $inlibc
14348
14349 : see if getservbyport exists
14350 set getservbyport d_getsbyport
14351 eval $inlibc
14352
14353 : see if getservent exists
14354 set getservent d_getsent
14355 eval $inlibc
14356
14357 : see if getservbyname_r exists
14358 set getservbyname_r d_getservbyname_r
14359 eval $inlibc
14360 case "$d_getservbyname_r" in
14361 "$define")
14362         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14363         case "$d_getservbyname_r_proto:$usethreads" in
14364         ":define")      d_getservbyname_r_proto=define
14365                 set d_getservbyname_r_proto getservbyname_r $hdrs
14366                 eval $hasproto ;;
14367         *)      ;;
14368         esac
14369         case "$d_getservbyname_r_proto" in
14370         define)
14371         case "$getservbyname_r_proto" in
14372         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14373         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14374         esac
14375         case "$getservbyname_r_proto" in
14376         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14377         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14378         esac
14379         case "$getservbyname_r_proto" in
14380         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14381         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14382         esac
14383         case "$getservbyname_r_proto" in
14384         ''|0)   d_getservbyname_r=undef
14385                 getservbyname_r_proto=0
14386                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14387         * )     case "$getservbyname_r_proto" in
14388                 REENTRANT_PROTO*) ;;
14389                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14390                 esac
14391                 echo "Prototype: $try" ;;
14392         esac
14393         ;;
14394         *)      case "$usethreads" in
14395                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14396                 esac
14397                 d_getservbyname_r=undef
14398                 getservbyname_r_proto=0
14399                 ;;
14400         esac
14401         ;;
14402 *)      getservbyname_r_proto=0
14403         ;;
14404 esac
14405
14406 : see if getservbyport_r exists
14407 set getservbyport_r d_getservbyport_r
14408 eval $inlibc
14409 case "$d_getservbyport_r" in
14410 "$define")
14411         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14412         case "$d_getservbyport_r_proto:$usethreads" in
14413         ":define")      d_getservbyport_r_proto=define
14414                 set d_getservbyport_r_proto getservbyport_r $hdrs
14415                 eval $hasproto ;;
14416         *)      ;;
14417         esac
14418         case "$d_getservbyport_r_proto" in
14419         define)
14420         case "$getservbyport_r_proto" in
14421         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14422         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14423         esac
14424         case "$getservbyport_r_proto" in
14425         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14426         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14427         esac
14428         case "$getservbyport_r_proto" in
14429         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14430         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14431         esac
14432         case "$getservbyport_r_proto" in
14433         ''|0)   d_getservbyport_r=undef
14434                 getservbyport_r_proto=0
14435                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14436         * )     case "$getservbyport_r_proto" in
14437                 REENTRANT_PROTO*) ;;
14438                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14439                 esac
14440                 echo "Prototype: $try" ;;
14441         esac
14442         ;;
14443         *)      case "$usethreads" in
14444                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14445                 esac
14446                 d_getservbyport_r=undef
14447                 getservbyport_r_proto=0
14448                 ;;
14449         esac
14450         ;;
14451 *)      getservbyport_r_proto=0
14452         ;;
14453 esac
14454
14455 : see if getservent_r exists
14456 set getservent_r d_getservent_r
14457 eval $inlibc
14458 case "$d_getservent_r" in
14459 "$define")
14460         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14461         case "$d_getservent_r_proto:$usethreads" in
14462         ":define")      d_getservent_r_proto=define
14463                 set d_getservent_r_proto getservent_r $hdrs
14464                 eval $hasproto ;;
14465         *)      ;;
14466         esac
14467         case "$d_getservent_r_proto" in
14468         define)
14469         case "$getservent_r_proto" in
14470         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14471         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14472         esac
14473         case "$getservent_r_proto" in
14474         ''|0) try='int getservent_r(struct servent*, char*, int);'
14475         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14476         esac
14477         case "$getservent_r_proto" in
14478         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14479         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14480         esac
14481         case "$getservent_r_proto" in
14482         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14483         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14484         esac
14485         case "$getservent_r_proto" in
14486         ''|0)   d_getservent_r=undef
14487                 getservent_r_proto=0
14488                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14489         * )     case "$getservent_r_proto" in
14490                 REENTRANT_PROTO*) ;;
14491                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14492                 esac
14493                 echo "Prototype: $try" ;;
14494         esac
14495         ;;
14496         *)      case "$usethreads" in
14497                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14498                 esac
14499                 d_getservent_r=undef
14500                 getservent_r_proto=0
14501                 ;;
14502         esac
14503         ;;
14504 *)      getservent_r_proto=0
14505         ;;
14506 esac
14507
14508 : see if prototypes for various getservxxx netdb.h functions are available
14509 echo " "
14510 set d_getservprotos getservent $i_netdb netdb.h
14511 eval $hasproto
14512
14513 : see if getspnam exists
14514 set getspnam d_getspnam
14515 eval $inlibc
14516
14517 : see if this is a shadow.h system
14518 set shadow.h i_shadow
14519 eval $inhdr
14520
14521 : see if getspnam_r exists
14522 set getspnam_r d_getspnam_r
14523 eval $inlibc
14524 case "$d_getspnam_r" in
14525 "$define")
14526         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14527         case "$d_getspnam_r_proto:$usethreads" in
14528         ":define")      d_getspnam_r_proto=define
14529                 set d_getspnam_r_proto getspnam_r $hdrs
14530                 eval $hasproto ;;
14531         *)      ;;
14532         esac
14533         case "$d_getspnam_r_proto" in
14534         define)
14535         case "$getspnam_r_proto" in
14536         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14537         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14538         esac
14539         case "$getspnam_r_proto" in
14540         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14541         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14542         esac
14543         case "$getspnam_r_proto" in
14544         ''|0)   d_getspnam_r=undef
14545                 getspnam_r_proto=0
14546                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14547         * )     case "$getspnam_r_proto" in
14548                 REENTRANT_PROTO*) ;;
14549                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14550                 esac
14551                 echo "Prototype: $try" ;;
14552         esac
14553         ;;
14554         *)      case "$usethreads" in
14555                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14556                 esac
14557                 d_getspnam_r=undef
14558                 getspnam_r_proto=0
14559                 ;;
14560         esac
14561         ;;
14562 *)      getspnam_r_proto=0
14563         ;;
14564 esac
14565
14566 : see if gettimeofday or ftime exists
14567 set gettimeofday d_gettimeod
14568 eval $inlibc
14569 case "$d_gettimeod" in
14570 "$undef")
14571         set ftime d_ftime 
14572         eval $inlibc
14573         ;;
14574 *)
14575         val="$undef"; set d_ftime; eval $setvar
14576         ;;
14577 esac
14578 case "$d_gettimeod$d_ftime" in
14579 "$undef$undef")
14580         echo " "
14581         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14582         ;;
14583 esac
14584
14585 : see if gmtime_r exists
14586 set gmtime_r d_gmtime_r
14587 eval $inlibc
14588 case "$d_gmtime_r" in
14589 "$define")
14590         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14591         case "$d_gmtime_r_proto:$usethreads" in
14592         ":define")      d_gmtime_r_proto=define
14593                 set d_gmtime_r_proto gmtime_r $hdrs
14594                 eval $hasproto ;;
14595         *)      ;;
14596         esac
14597         case "$d_gmtime_r_proto" in
14598         define)
14599         case "$gmtime_r_proto" in
14600         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14601         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14602         esac
14603         case "$gmtime_r_proto" in
14604         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14605         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14606         esac
14607         case "$gmtime_r_proto" in
14608         ''|0)   d_gmtime_r=undef
14609                 gmtime_r_proto=0
14610                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14611         * )     case "$gmtime_r_proto" in
14612                 REENTRANT_PROTO*) ;;
14613                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14614                 esac
14615                 echo "Prototype: $try" ;;
14616         esac
14617         ;;
14618         *)      case "$usethreads" in
14619                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14620                 esac
14621                 d_gmtime_r=undef
14622                 gmtime_r_proto=0
14623                 ;;
14624         esac
14625         ;;
14626 *)      gmtime_r_proto=0
14627         ;;
14628 esac
14629
14630 : see if hasmntopt exists
14631 set hasmntopt d_hasmntopt
14632 eval $inlibc
14633
14634 : see if this is a netinet/in.h or sys/in.h system
14635 set netinet/in.h i_niin sys/in.h i_sysin
14636 eval $inhdr
14637
14638 : see if arpa/inet.h has to be included
14639 set arpa/inet.h i_arpainet
14640 eval $inhdr
14641
14642 : see if htonl --and friends-- exists
14643 val=''
14644 set htonl val
14645 eval $inlibc
14646
14647 : Maybe they are macros.
14648 case "$val" in
14649 $undef)
14650         $cat >htonl.c <<EOM
14651 #include <stdio.h>
14652 #include <sys/types.h>
14653 #$i_niin I_NETINET_IN
14654 #$i_sysin I_SYS_IN
14655 #$i_arpainet I_ARPA_INET
14656 #ifdef I_NETINET_IN
14657 #include <netinet/in.h>
14658 #endif
14659 #ifdef I_SYS_IN
14660 #include <sys/in.h>
14661 #endif
14662 #ifdef I_ARPA_INET
14663 #include <arpa/inet.h>
14664 #endif
14665 #ifdef htonl
14666 printf("Defined as a macro.");
14667 #endif
14668 EOM
14669         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14670         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14671                 val="$define"
14672                 echo "But it seems to be defined as a macro." >&4
14673         fi
14674         $rm -f htonl.?
14675         ;;
14676 esac
14677 set d_htonl
14678 eval $setvar
14679
14680 : see if ilogbl exists
14681 set ilogbl d_ilogbl
14682 eval $inlibc
14683
14684 : index or strchr
14685 echo " "
14686 if set index val -f; eval $csym; $val; then
14687         if set strchr val -f d_strchr; eval $csym; $val; then
14688                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14689                         val="$define"
14690                         vali="$undef"
14691                         echo "strchr() found." >&4
14692                 else
14693                         val="$undef"
14694                         vali="$define"
14695                         echo "index() found." >&4
14696                 fi
14697         else
14698                 val="$undef"
14699                 vali="$define"
14700                 echo "index() found." >&4
14701         fi
14702 else
14703         if set strchr val -f d_strchr; eval $csym; $val; then
14704                 val="$define"
14705                 vali="$undef"
14706                 echo "strchr() found." >&4
14707         else
14708                 echo "No index() or strchr() found!" >&4
14709                 val="$undef"
14710                 vali="$undef"
14711         fi
14712 fi
14713 set d_strchr; eval $setvar
14714 val="$vali"
14715 set d_index; eval $setvar
14716
14717 : check whether inet_aton exists
14718 set inet_aton d_inetaton
14719 eval $inlibc
14720
14721 : Look for isascii
14722 echo " "
14723 $cat >isascii.c <<EOCP
14724 #include <stdio.h>
14725 #include <ctype.h>
14726 #$i_stdlib I_STDLIB
14727 #ifdef I_STDLIB
14728 #include <stdlib.h>
14729 #endif
14730 int main() {
14731         int c = 'A';
14732         if (isascii(c))
14733                 exit(0);
14734         else
14735                 exit(1);
14736 }
14737 EOCP
14738 set isascii
14739 if eval $compile; then
14740         echo "isascii() found." >&4
14741         val="$define"
14742 else
14743         echo "isascii() NOT found." >&4
14744         val="$undef"
14745 fi
14746 set d_isascii
14747 eval $setvar
14748 $rm -f isascii*
14749
14750 : see if isfinite exists
14751 set isfinite d_isfinite
14752 eval $inlibc
14753
14754 : see if isinf exists
14755 set isinf d_isinf
14756 eval $inlibc
14757
14758 : see if isnan exists
14759 set isnan d_isnan
14760 eval $inlibc
14761
14762 : see if isnanl exists
14763 set isnanl d_isnanl
14764 eval $inlibc
14765
14766 : see if killpg exists
14767 set killpg d_killpg
14768 eval $inlibc
14769
14770 : see if lchown exists
14771 echo " "
14772 $cat > try.c <<'EOCP'
14773 /* System header to define __stub macros and hopefully few prototypes,
14774     which can conflict with char lchown(); below.  */
14775 #include <assert.h>
14776 /* Override any gcc2 internal prototype to avoid an error.  */
14777 /* We use char because int might match the return type of a gcc2
14778    builtin and then its argument prototype would still apply.  */
14779 char lchown();
14780 int main() {
14781     /*  The GNU C library defines this for functions which it implements
14782         to always fail with ENOSYS.  Some functions are actually named
14783         something starting with __ and the normal name is an alias.  */
14784 #if defined (__stub_lchown) || defined (__stub___lchown)
14785 choke me
14786 #else
14787 lchown();
14788 #endif
14789 ; return 0; }
14790 EOCP
14791 set try
14792 if eval $compile; then
14793     $echo "lchown() found." >&4
14794     val="$define"
14795 else
14796     $echo "lchown() NOT found." >&4
14797     val="$undef"
14798 fi
14799 set d_lchown
14800 eval $setvar
14801
14802 : See if number of significant digits in a double precision number is known
14803 echo " "
14804 $cat >ldbl_dig.c <<EOM
14805 #$i_limits I_LIMITS
14806 #$i_float I_FLOAT
14807 #ifdef I_LIMITS
14808 #include <limits.h>
14809 #endif
14810 #ifdef I_FLOAT
14811 #include <float.h>
14812 #endif
14813 #ifdef LDBL_DIG
14814 printf("Contains LDBL_DIG");
14815 #endif
14816 EOM
14817 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14818 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14819         echo "LDBL_DIG found." >&4
14820         val="$define"
14821 else
14822         echo "LDBL_DIG NOT found." >&4
14823         val="$undef"
14824 fi
14825 $rm -f ldbl_dig.?
14826 set d_ldbl_dig
14827 eval $setvar
14828
14829 : see if this is a math.h system
14830 set math.h i_math
14831 eval $inhdr
14832
14833 : check to see if math.h defines _LIB_VERSION
14834 d_libm_lib_version="$undef"
14835 case $i_math in
14836     $define)
14837         echo " "
14838         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14839         $cat >try.c <<EOCP
14840 #include <unistd.h>
14841 #include <math.h>
14842 int main (int argc, char *argv[])
14843 {
14844     printf ("%d\n", _LIB_VERSION);
14845     return (0);
14846     } /* main */
14847 EOCP
14848         set try
14849         if eval $compile; then
14850             foo=`$run ./try`
14851             echo "Yes, it does ($foo)" >&4
14852             d_libm_lib_version="$define"
14853         else
14854             echo "No, it does not (probably harmless)" >&4
14855             fi
14856         $rm_try
14857         ;;
14858
14859     esac
14860
14861 : see if link exists
14862 set link d_link
14863 eval $inlibc
14864
14865 : see if localtime_r exists
14866 set localtime_r d_localtime_r
14867 eval $inlibc
14868 case "$d_localtime_r" in
14869 "$define")
14870         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14871         case "$d_localtime_r_proto:$usethreads" in
14872         ":define")      d_localtime_r_proto=define
14873                 set d_localtime_r_proto localtime_r $hdrs
14874                 eval $hasproto ;;
14875         *)      ;;
14876         esac
14877         case "$d_localtime_r_proto" in
14878         define)
14879         case "$localtime_r_proto" in
14880         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14881         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14882         esac
14883         case "$localtime_r_proto" in
14884         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14885         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14886         esac
14887         case "$localtime_r_proto" in
14888         ''|0)   d_localtime_r=undef
14889                 localtime_r_proto=0
14890                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14891         * )     case "$localtime_r_proto" in
14892                 REENTRANT_PROTO*) ;;
14893                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14894                 esac
14895                 echo "Prototype: $try" ;;
14896         esac
14897         ;;
14898         *)      case "$usethreads" in
14899                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14900                 esac
14901                 d_localtime_r=undef
14902                 localtime_r_proto=0
14903                 ;;
14904         esac
14905         ;;
14906 *)      localtime_r_proto=0
14907         ;;
14908 esac
14909
14910 : see if localtime_r calls tzset
14911 case "$localtime_r_proto" in
14912 REENTRANT_PROTO*)
14913         $cat >try.c <<EOCP
14914 /*  Does our libc's localtime_r call tzset ?
14915  *  return 0 if so, 1 otherwise.
14916  */
14917 #include <sys/types.h>
14918 #include <unistd.h>
14919 #include <time.h>
14920 #include <string.h>
14921 #include <malloc.h>
14922 int main()
14923 {
14924     time_t t = time(0L);
14925     char w_tz[]="TZ" "=GMT+5",
14926          e_tz[]="TZ" "=GMT-5",
14927         *tz_e = (char*)malloc(16),
14928         *tz_w = (char*)malloc(16);
14929     struct tm tm_e, tm_w;
14930     memset(&tm_e,'\0',sizeof(struct tm));
14931     memset(&tm_w,'\0',sizeof(struct tm));
14932     strcpy(tz_e,e_tz);
14933     strcpy(tz_w,w_tz);
14934
14935     putenv(tz_e);
14936     localtime_r(&t, &tm_e);
14937
14938     putenv(tz_w);
14939     localtime_r(&t, &tm_w);
14940
14941     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14942         return 1;
14943     return 0;
14944 }
14945 EOCP
14946         set try
14947         if eval $compile; then
14948             if $run ./try; then
14949                 d_localtime_r_needs_tzset=undef;
14950             else
14951                 d_localtime_r_needs_tzset=define;
14952             fi;
14953         else
14954             d_localtime_r_needs_tzset=undef;
14955         fi;
14956      ;;
14957   *)
14958      d_localtime_r_needs_tzset=undef;
14959      ;;
14960 esac
14961 $rm_try
14962
14963 : see if localeconv exists
14964 set localeconv d_locconv
14965 eval $inlibc
14966
14967 : see if lockf exists
14968 set lockf d_lockf
14969 eval $inlibc
14970
14971 : see if prototype for lseek is available
14972 echo " "
14973 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14974 eval $hasproto
14975
14976 : see if lstat exists
14977 set lstat d_lstat
14978 eval $inlibc
14979
14980 : see if madvise exists
14981 set madvise d_madvise
14982 eval $inlibc
14983
14984 : see if malloc_size exists
14985 set malloc_size d_malloc_size
14986 eval $inlibc
14987
14988 : see if malloc_size_good exists
14989 set malloc_good_size d_malloc_good_size
14990 eval $inlibc
14991
14992 : see if mblen exists
14993 set mblen d_mblen
14994 eval $inlibc
14995
14996 : see if mbstowcs exists
14997 set mbstowcs d_mbstowcs
14998 eval $inlibc
14999
15000 : see if mbtowc exists
15001 set mbtowc d_mbtowc
15002 eval $inlibc
15003
15004 : see if memchr exists
15005 set memchr d_memchr
15006 eval $inlibc
15007
15008 : see if memcmp exists
15009 set memcmp d_memcmp
15010 eval $inlibc
15011
15012 : see if memcpy exists
15013 set memcpy d_memcpy
15014 eval $inlibc
15015
15016 : see if memmove exists
15017 set memmove d_memmove
15018 eval $inlibc
15019
15020 : see if memset exists
15021 set memset d_memset
15022 eval $inlibc
15023
15024 : see if mkdir exists
15025 set mkdir d_mkdir
15026 eval $inlibc
15027
15028 : see if mkdtemp exists
15029 set mkdtemp d_mkdtemp
15030 eval $inlibc
15031
15032 : see if mkfifo exists
15033 set mkfifo d_mkfifo
15034 eval $inlibc
15035
15036 : see if mkstemp exists
15037 set mkstemp d_mkstemp
15038 eval $inlibc
15039
15040 : see if mkstemps exists
15041 set mkstemps d_mkstemps
15042 eval $inlibc
15043
15044 : see if mktime exists
15045 set mktime d_mktime
15046 eval $inlibc
15047
15048 : see if this is a sys/mman.h system
15049 set sys/mman.h i_sysmman
15050 eval $inhdr
15051
15052 : see if mmap exists
15053 set mmap d_mmap
15054 eval $inlibc
15055 : see what shmat returns
15056 : default to something harmless
15057 mmaptype='void *'
15058 case "$i_sysmman$d_mmap" in
15059 "$define$define")
15060         $cat >mmap.c <<'END'
15061 #include <sys/mman.h>
15062 void *mmap();
15063 END
15064         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15065                 mmaptype='void *'
15066         else
15067                 mmaptype='caddr_t'
15068         fi
15069         echo "and it returns ($mmaptype)." >&4
15070         ;;
15071 esac
15072
15073
15074
15075 : see if sqrtl exists
15076 set sqrtl d_sqrtl
15077 eval $inlibc
15078
15079 : see if scalbnl exists
15080 set scalbnl d_scalbnl
15081 eval $inlibc
15082
15083 : see if modfl exists
15084 set modfl d_modfl
15085 eval $inlibc
15086
15087 : see if prototype for modfl is available
15088 echo " "
15089 set d_modflproto modfl $i_math math.h
15090 eval $hasproto
15091
15092 d_modfl_pow32_bug="$undef"
15093
15094 case "$d_longdbl$d_modfl" in
15095 $define$define)
15096         $cat <<EOM
15097 Checking to see whether your modfl() is okay for large values...
15098 EOM
15099 $cat >try.c <<EOCP
15100 #include <math.h>
15101 #include <stdio.h>
15102 EOCP
15103 if $test "X$d_modflproto" != "X$define"; then
15104         $cat >>try.c <<EOCP
15105 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15106 long double modfl (long double, long double *);
15107 EOCP
15108 fi
15109 $cat >>try.c <<EOCP
15110 int main() {
15111     long double nv = 4294967303.15;
15112     long double v, w;
15113     v = modfl(nv, &w);
15114 #ifdef __GLIBC__
15115     printf("glibc");
15116 #endif
15117     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15118     return 0;
15119 }
15120 EOCP
15121         case "$osname:$gccversion" in
15122         aix:)   saveccflags="$ccflags"
15123                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15124         esac
15125         set try
15126         if eval $compile; then
15127                 foo=`$run ./try`
15128                 case "$foo" in
15129                 *" 4294967303.150000 1.150000 4294967302.000000")
15130                         echo >&4 "Your modfl() is broken for large values."
15131                         d_modfl_pow32_bug="$define"
15132                         case "$foo" in
15133                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15134                         ;;
15135                         esac
15136                         ;;
15137                 *" 4294967303.150000 0.150000 4294967303.000000")
15138                         echo >&4 "Your modfl() seems okay for large values."
15139                         ;;
15140                 *)      echo >&4 "I don't understand your modfl() at all."
15141                         d_modfl="$undef"
15142                         ;;
15143                 esac
15144                 $rm_try
15145         else
15146                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15147                 d_modfl="$undef"
15148         fi
15149         case "$osname:$gccversion" in
15150         aix:)   ccflags="$saveccflags" ;; # restore
15151         esac
15152         ;;
15153 esac
15154
15155 if $test "$uselongdouble" = "$define"; then
15156     message=""
15157     if $test "$d_sqrtl" != "$define"; then
15158         message="$message sqrtl"
15159     fi
15160     if $test "$d_modfl" != "$define"; then
15161         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15162             echo "You have both aintl and copysignl, so I can emulate modfl."
15163         else
15164             message="$message modfl"
15165         fi
15166     fi
15167     if $test "$d_frexpl" != "$define"; then
15168         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15169             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15170         else
15171             message="$message frexpl"
15172         fi
15173     fi
15174
15175     if $test "$message" != ""; then
15176         $cat <<EOM >&4
15177
15178 *** You requested the use of long doubles but you do not seem to have
15179 *** the following mathematical functions needed for long double support:
15180 ***    $message
15181 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15182 *** Cannot continue, aborting.
15183
15184 EOM
15185
15186         exit 1
15187     fi
15188 fi
15189
15190 : see if mprotect exists
15191 set mprotect d_mprotect
15192 eval $inlibc
15193
15194 : see if msgctl exists
15195 set msgctl d_msgctl
15196 eval $inlibc
15197
15198 : see if msgget exists
15199 set msgget d_msgget
15200 eval $inlibc
15201
15202 : see if msgsnd exists
15203 set msgsnd d_msgsnd
15204 eval $inlibc
15205
15206 : see if msgrcv exists
15207 set msgrcv d_msgrcv
15208 eval $inlibc
15209
15210 : see how much of the 'msg*(2)' library is present.
15211 h_msg=true
15212 echo " "
15213 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15214 *"$undef"*) h_msg=false;;
15215 esac
15216 case "$osname" in
15217 freebsd)
15218     case "`ipcs 2>&1`" in
15219     "SVID messages"*"not configured"*)
15220         echo "Your $osname does not have the msg*(2) configured." >&4
15221         h_msg=false
15222         val="$undef"
15223         set msgctl d_msgctl
15224         eval $setvar
15225         set msgget d_msgget
15226         eval $setvar
15227         set msgsnd d_msgsnd
15228         eval $setvar
15229         set msgrcv d_msgrcv
15230         eval $setvar
15231         ;;
15232     esac
15233     ;;
15234 esac
15235 : we could also check for sys/ipc.h ...
15236 if $h_msg && $test `./findhdr sys/msg.h`; then
15237         echo "You have the full msg*(2) library." >&4
15238         val="$define"
15239 else
15240         echo "You don't have the full msg*(2) library." >&4
15241         val="$undef"
15242 fi
15243 set d_msg
15244 eval $setvar
15245
15246 : Check for msghdr_s
15247 echo " "
15248 echo "Checking to see if your system supports struct msghdr..." >&4
15249 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15250 eval $hasstruct
15251 case "$d_msghdr_s" in
15252 "$define")      echo "Yes, it does."   ;;
15253 *)              echo "No, it doesn't." ;;
15254 esac
15255
15256
15257 : see if msync exists
15258 set msync d_msync
15259 eval $inlibc
15260
15261 : see if munmap exists
15262 set munmap d_munmap
15263 eval $inlibc
15264
15265 : see if nice exists
15266 set nice d_nice
15267 eval $inlibc
15268
15269 : see if this is a langinfo.h system
15270 set langinfo.h i_langinfo
15271 eval $inhdr
15272
15273 : see if nl_langinfo exists
15274 set nl_langinfo d_nl_langinfo
15275 eval $inlibc
15276
15277 : check for volatile keyword
15278 echo " "
15279 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15280 $cat >try.c <<'EOCP'
15281 int main()
15282 {
15283         typedef struct _goo_struct goo_struct;
15284         goo_struct * volatile goo = ((goo_struct *)0);
15285         struct _goo_struct {
15286                 long long_int;
15287                 int reg_int;
15288                 char char_var;
15289         };
15290         typedef unsigned short foo_t;
15291         char *volatile foo;
15292         volatile int bar;
15293         volatile foo_t blech;
15294         foo = foo;
15295 }
15296 EOCP
15297 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15298         val="$define"
15299         echo "Yup, it does."
15300 else
15301         val="$undef"
15302         echo "Nope, it doesn't."
15303 fi
15304 set d_volatile
15305 eval $setvar
15306 $rm_try
15307
15308 : Check basic sizes
15309 echo " "
15310 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15311
15312 case "$use64bitint:$d_quad:$quadtype" in
15313 define:define:?*)
15314         ivtype="$quadtype"
15315         uvtype="$uquadtype"
15316         ivsize=8
15317         uvsize=8
15318         ;;
15319 *)      ivtype="long"
15320         uvtype="unsigned long"
15321         ivsize=$longsize
15322         uvsize=$longsize
15323         ;;
15324 esac
15325
15326 case "$uselongdouble:$d_longdbl" in
15327 define:define)
15328         nvtype="long double"
15329         nvsize=$longdblsize
15330         ;;
15331 *)      nvtype=double
15332         nvsize=$doublesize
15333         ;;
15334 esac
15335
15336 $echo "(IV will be "$ivtype", $ivsize bytes)"
15337 $echo "(UV will be "$uvtype", $uvsize bytes)"
15338 $echo "(NV will be "$nvtype", $nvsize bytes)"
15339
15340 $cat >try.c <<EOCP
15341 #$i_inttypes I_INTTYPES
15342 #ifdef I_INTTYPES
15343 #include <inttypes.h>
15344 #endif
15345 #include <stdio.h>
15346 int main() {
15347 #ifdef INT8
15348    int8_t i =  INT8_MAX;
15349   uint8_t u = UINT8_MAX;
15350   printf("int8_t\n");
15351 #endif
15352 #ifdef INT16
15353    int16_t i =  INT16_MAX;
15354   uint16_t i = UINT16_MAX;
15355   printf("int16_t\n");
15356 #endif
15357 #ifdef INT32
15358    int32_t i =  INT32_MAX;
15359   uint32_t u = UINT32_MAX;
15360   printf("int32_t\n");
15361 #endif
15362 }
15363 EOCP
15364
15365 i8type="signed char"
15366 u8type="unsigned char"
15367 i8size=1
15368 u8size=1
15369
15370 case "$i16type" in
15371 '')     case "$shortsize" in
15372         2)      i16type=short
15373                 u16type="unsigned short"
15374                 i16size=$shortsize
15375                 u16size=$shortsize
15376                 ;;
15377         esac
15378         ;;
15379 esac
15380 case "$i16type" in
15381 '')     set try -DINT16
15382         if eval $compile; then
15383                 case "`$run ./try`" in
15384                 int16_t)
15385                         i16type=int16_t
15386                         u16type=uint16_t
15387                         i16size=2
15388                         u16size=2
15389                         ;;
15390                 esac
15391         fi
15392         ;;
15393 esac
15394 case "$i16type" in
15395 '')     if $test $shortsize -ge 2; then
15396                 i16type=short
15397                 u16type="unsigned short"
15398                 i16size=$shortsize
15399                 u16size=$shortsize
15400         fi
15401         ;;
15402 esac
15403
15404 case "$i32type" in
15405 '')     case "$longsize" in
15406         4)      i32type=long
15407                 u32type="unsigned long"
15408                 i32size=$longsize
15409                 u32size=$longsize
15410                 ;;
15411         *)      case "$intsize" in
15412                 4)      i32type=int
15413                         u32type="unsigned int"
15414                         i32size=$intsize
15415                         u32size=$intsize
15416                         ;;
15417                 esac
15418                 ;;
15419         esac
15420         ;;
15421 esac
15422 case "$i32type" in
15423 '')     set try -DINT32
15424         if eval $compile; then
15425                 case "`$run ./try`" in
15426                 int32_t)
15427                         i32type=int32_t
15428                         u32type=uint32_t
15429                         i32size=4
15430                         u32size=4
15431                         ;;
15432                 esac
15433         fi
15434         ;;
15435 esac
15436 case "$i32type" in
15437 '')     if $test $intsize -ge 4; then
15438                 i32type=int
15439                 u32type="unsigned int"
15440                 i32size=$intsize
15441                 u32size=$intsize
15442         fi
15443         ;;
15444 esac
15445
15446 case "$i64type" in
15447 '')     case "$d_quad:$quadtype" in
15448         define:?*)
15449                 i64type="$quadtype"
15450                 u64type="$uquadtype"
15451                 i64size=8
15452                 u64size=8
15453                 ;;
15454         esac
15455         ;;
15456 esac
15457
15458 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15459 : volatile so that the compiler has to store it out to memory.
15460 if test X"$d_volatile" = X"$define"; then
15461         volatile=volatile
15462 fi
15463 $cat <<EOP >try.c
15464 #include <stdio.h>
15465 #$i_stdlib I_STDLIB
15466 #ifdef I_STDLIB
15467 #include <stdlib.h>
15468 #endif
15469 #include <sys/types.h>
15470 #include <signal.h>
15471 #ifdef SIGFPE
15472 $volatile int bletched = 0;
15473 $signal_t blech(int s) { bletched = 1; }
15474 #endif
15475 int main() {
15476     $uvtype u = 0;
15477     $nvtype d;
15478     int     n = 8 * $uvsize;
15479     int     i;
15480 #ifdef SIGFPE
15481     signal(SIGFPE, blech);
15482 #endif
15483
15484     for (i = 0; i < n; i++) {
15485       u = u << 1 | ($uvtype)1;
15486       d = ($nvtype)u;
15487       if (($uvtype)d != u)
15488         break;
15489       if (d <= 0)
15490         break;
15491       d = ($nvtype)(u - 1);
15492       if (($uvtype)d != (u - 1))
15493         break;
15494 #ifdef SIGFPE
15495       if (bletched)
15496         break;
15497 #endif
15498     }
15499     printf("%d\n", ((i == n) ? -n : i));
15500     exit(0);
15501 }
15502 EOP
15503 set try
15504
15505 d_nv_preserves_uv="$undef"
15506 if eval $compile; then
15507         nv_preserves_uv_bits="`$run ./try`"
15508 fi
15509 case "$nv_preserves_uv_bits" in
15510 \-[1-9]*)
15511         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15512         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15513         d_nv_preserves_uv="$define"
15514         ;;
15515 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15516         d_nv_preserves_uv="$undef" ;;
15517 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15518         nv_preserves_uv_bits="0" ;;
15519 esac
15520 $rm_try
15521
15522 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15523 : volatile so that the compiler has to store it out to memory.
15524 if test X"$d_volatile" = X"$define"; then
15525         volatile=volatile
15526 fi
15527 $cat <<EOP >try.c
15528 #include <stdio.h>
15529
15530 typedef $nvtype NV;
15531
15532 int
15533 main() {
15534   NV value = 2;
15535   int count = 1;
15536
15537   while(count < 256) {
15538     $volatile NV up = value + 1.0;
15539     $volatile NV negated = -value;
15540     $volatile NV down = negated - 1.0;
15541     $volatile NV got_up = up - value;
15542     int up_good = got_up == 1.0;
15543     int got_down = down - negated;
15544     int down_good = got_down == -1.0;
15545
15546     if (down_good != up_good) {
15547       fprintf(stderr,
15548               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15549               up_good, (double) got_up, down_good, (double) got_down,
15550               count, (double) value);
15551       return 1;
15552     }
15553     if (!up_good) {
15554       while (1) {
15555         if (count > 8) {
15556           count -= 8;
15557           fputs("256.0", stdout);
15558         } else {
15559           count--;
15560           fputs("2.0", stdout);
15561         }
15562         if (!count) {
15563           puts("");
15564           return 0;
15565         }
15566         fputs("*", stdout);
15567       }
15568     }
15569     value *= 2;
15570     ++count;
15571   }
15572   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15573           count, (double) value);
15574   return 1;
15575 }
15576 EOP
15577 set try
15578
15579 nv_overflows_integers_at='0'
15580 if eval $compile; then
15581     xxx="`$run ./try`"
15582     case "$?" in
15583         0)
15584             case "$xxx" in
15585                 2*)  cat >&4 <<EOM
15586 The largest integer your NVs can preserve is equal to $xxx
15587 EOM
15588                     nv_overflows_integers_at="$xxx"
15589                     ;;
15590                 *)  cat >&4 <<EOM
15591 Cannot determine the largest integer value your NVs can hold, unexpected output
15592 '$xxx'
15593 EOM
15594                     ;;
15595             esac
15596             ;;
15597         *)  cat >&4 <<EOM
15598 Cannot determine the largest integer value your NVs can hold
15599 EOM
15600             ;;
15601     esac
15602 fi
15603 $rm_try
15604
15605 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15606 : volatile so that the compiler has to store it out to memory.
15607 if test X"$d_volatile" = X"$define"; then
15608         volatile=volatile
15609 fi
15610 $cat <<EOP >try.c
15611 #include <stdio.h>
15612 #$i_stdlib I_STDLIB
15613 #ifdef I_STDLIB
15614 #include <stdlib.h>
15615 #endif
15616 #$i_string I_STRING
15617 #ifdef I_STRING
15618 #  include <string.h>
15619 #else
15620 #  include <strings.h>
15621 #endif
15622 #include <sys/types.h>
15623 #include <signal.h>
15624 #ifdef SIGFPE
15625 $volatile int bletched = 0;
15626 $signal_t blech(int s) { bletched = 1; }
15627 #endif
15628
15629 int checkit($nvtype d, char *where) {
15630     unsigned char *p = (char *)&d;
15631     unsigned char *end = p + sizeof(d);
15632     int fail = 0;
15633
15634     while (p < end)
15635         fail += *p++;
15636
15637     if (!fail)
15638         return 0;
15639
15640     p = (char *)&d;
15641     printf("No - %s: 0x", where);
15642     while (p < end)
15643         printf ("%02X", *p++);
15644     printf("\n");
15645     return 1;
15646 }
15647
15648 int main(int argc, char **argv) {
15649     $nvtype d = 0.0;
15650     int fail = 0;
15651     fail += checkit(d, "0.0");
15652
15653     /* The compiler shouldn't be assuming that bletched is 0  */
15654     d = bletched;
15655
15656     fail += checkit(d, "bleched");
15657
15658 #ifdef SIGFPE
15659     signal(SIGFPE, blech);
15660 #endif
15661
15662     /* Paranoia - the compiler should have no way of knowing that ANSI says
15663        that argv[argc] will always be NULL.  Actually, if it did assume this it
15664        would be buggy, as this is C and main() can be called from elsewhere in
15665        the program.  */
15666     d = argv[argc] ? 1 : 0;
15667
15668     if (d) {
15669         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15670     }
15671
15672     fail += checkit(d, "ternary");
15673
15674     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15675
15676     if (d != 0.0) {
15677         printf("No - memset doesn't give 0.0\n");
15678         /* This might just blow up:  */
15679         printf("(gives %g)\n", d);
15680         return 1;
15681     }
15682
15683 #ifdef SIGFPE
15684     if (bletched) {
15685         printf("No - something bleched\n");
15686         return 1;
15687     }
15688 #endif
15689     if (fail) {
15690       printf("No - %d fail(s)\n", fail);
15691       return 1;
15692     }
15693     printf("Yes\n");
15694     return 0;
15695 }
15696 EOP
15697 set try
15698
15699 d_nv_zero_is_allbits_zero="$undef"
15700 if eval $compile; then
15701     xxx="`$run ./try`"
15702     case "$?" in
15703         0)
15704             case "$xxx" in
15705                 Yes)  cat >&4 <<EOM
15706 0.0 is represented as all bits zero in memory
15707 EOM
15708                     d_nv_zero_is_allbits_zero="$define"
15709                     ;;
15710                 *)  cat >&4 <<EOM
15711 0.0 is not represented as all bits zero in memory
15712 EOM
15713                     d_nv_zero_is_allbits_zero="$undef"
15714                     ;;
15715             esac
15716             ;;
15717         *)  cat >&4 <<EOM
15718 0.0 is not represented as all bits zero in memory
15719 EOM
15720             d_nv_zero_is_allbits_zero="$undef"
15721             ;;
15722     esac
15723 fi
15724 $rm_try
15725
15726 : check for off64_t
15727 echo " "
15728 echo "Checking to see if you have off64_t..." >&4
15729 $cat >try.c <<EOCP
15730 #include <sys/types.h>
15731 #include <unistd.h>
15732 int main() { off64_t x = 7; }
15733 EOCP
15734 set try
15735 if eval $compile; then
15736         val="$define"
15737         echo "You have off64_t."
15738 else
15739         val="$undef"
15740         echo "You do not have off64_t."
15741         case "$lseeksize" in
15742         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15743         esac
15744 fi
15745 $rm_try
15746 set d_off64_t
15747 eval $setvar
15748
15749 : how to create joinable pthreads
15750 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15751         echo " "
15752         echo "Checking what constant to use for creating joinable pthreads..." >&4
15753         $cat >try.c <<'EOCP'
15754 #include <pthread.h>
15755 int main() {
15756     int detachstate = JOINABLE;
15757 }
15758 EOCP
15759         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15760         if eval $compile; then
15761                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15762                 val="$undef" # Yes, undef.
15763                 set d_old_pthread_create_joinable
15764                 eval $setvar
15765                 val=""
15766                 set old_pthread_create_joinable
15767                 eval $setvar
15768         else
15769                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15770                 if eval $compile; then
15771                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15772                         val="$define"
15773                         set d_old_pthread_create_joinable
15774                         eval $setvar
15775                         val=PTHREAD_CREATE_UNDETACHED
15776                         set old_pthread_create_joinable
15777                         eval $setvar
15778                 else
15779                         set try -DJOINABLE=__UNDETACHED
15780                         if eval $compile; then
15781                                 echo "You seem to use __UNDETACHED." >&4
15782                                 val="$define"
15783                                 set d_old_pthread_create_joinable
15784                                 eval $setvar
15785                                 val=__UNDETACHED
15786                                 set old_pthread_create_joinable
15787                                 eval $setvar
15788                         else
15789                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15790                                 val="$define"
15791                                 set d_old_pthread_create_joinable
15792                                 eval $setvar
15793                                 val=0
15794                                 set old_pthread_create_joinable
15795                                 eval $setvar
15796                         fi
15797                 fi
15798         fi
15799         $rm_try
15800 else
15801     d_old_pthread_create_joinable="$undef"
15802     old_pthread_create_joinable=""
15803 fi
15804
15805 : see if pause exists
15806 set pause d_pause
15807 eval $inlibc
15808
15809 : see if poll exists
15810 set poll d_poll
15811 eval $inlibc
15812
15813 : see if readlink exists
15814 set readlink d_readlink
15815 eval $inlibc
15816
15817 : Check if exe is symlink to abs path of executing program
15818 echo " "
15819 procselfexe=''
15820 val="$undef"
15821 case "$d_readlink" in
15822 "$define")
15823         if $issymlink /proc/self/exe ; then
15824                 $ls -l /proc/self/exe > reflect
15825                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15826                         echo "You have Linux-like /proc/self/exe."
15827                         procselfexe='"/proc/self/exe"'
15828                         val="$define"
15829                 fi
15830         fi
15831         if $issymlink /proc/curproc/file ; then
15832                 $ls -l /proc/curproc/file > reflect
15833                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15834                         echo "You have BSD-like /proc/curproc/file."
15835                         procselfexe='"/proc/curproc/file"'
15836                         val="$define"
15837                 fi
15838         fi
15839         ;;
15840 esac
15841 $rm -f reflect
15842 set d_procselfexe
15843 eval $setvar
15844
15845 : backward compatibility for d_hvfork
15846 if test X$d_hvfork != X; then
15847         d_vfork="$d_hvfork"
15848         d_hvfork=''
15849 fi
15850 : see if there is a vfork
15851 val=''
15852 set vfork val
15853 eval $inlibc
15854
15855 d_pseudofork=$undef
15856
15857 : Ok, but do we want to use it. vfork is reportedly unreliable in
15858 : perl on Solaris 2.x, and probably elsewhere.
15859 case "$val" in
15860 $define)
15861         echo " "
15862         case "$usevfork" in
15863         false) dflt='n';;
15864         *) dflt='y';;
15865         esac
15866         cat <<'EOM'
15867
15868 Perl can only use a vfork() that doesn't suffer from strict
15869 restrictions on calling functions or modifying global data in
15870 the child.  For example, glibc-2.1 contains such a vfork()
15871 that is unsuitable.  If your system provides a proper fork()
15872 call, chances are that you do NOT want perl to use vfork().
15873
15874 EOM
15875         rp="Do you still want to use vfork()?"
15876         . ./myread
15877         case "$ans" in
15878         y|Y) ;;
15879         *)
15880                 echo "Ok, we won't use vfork()."
15881                 val="$undef"
15882                 ;;
15883         esac
15884         ;;
15885 esac
15886 set d_vfork
15887 eval $setvar
15888 case "$d_vfork" in
15889 $define) usevfork='true';;
15890 *) usevfork='false';;
15891 esac
15892
15893 : see whether the pthread_atfork exists
15894 $cat >try.c <<EOP
15895 #include <pthread.h>
15896 #include <stdio.h>
15897 int main() {
15898 #ifdef  PTHREAD_ATFORK
15899         pthread_atfork(NULL,NULL,NULL);
15900 #endif
15901 }
15902 EOP
15903
15904 : see if pthread_atfork exists
15905 set try -DPTHREAD_ATFORK
15906 if eval $compile; then
15907     val="$define"
15908 else
15909     val="$undef"
15910 fi
15911 case "$usethreads" in
15912 $define)
15913         case "$val" in
15914         $define) echo 'pthread_atfork found.' >&4        ;;
15915         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15916         esac
15917 esac
15918 set d_pthread_atfork
15919 eval $setvar
15920
15921 : see if pthread_attr_setscope exists
15922 set pthread_attr_setscope d_pthread_attr_setscope
15923 eval $inlibc
15924
15925 : see whether the various POSIXish _yields exist
15926 $cat >try.c <<EOP
15927 #include <pthread.h>
15928 #include <stdio.h>
15929 int main() {
15930 #ifdef SCHED_YIELD
15931         sched_yield();
15932 #else
15933 #ifdef PTHREAD_YIELD
15934         pthread_yield();
15935 #else
15936 #ifdef PTHREAD_YIELD_NULL
15937         pthread_yield(NULL);
15938 #endif
15939 #endif
15940 #endif
15941 }
15942 EOP
15943 : see if sched_yield exists
15944 set try -DSCHED_YIELD
15945 if eval $compile; then
15946     val="$define"
15947     sched_yield='sched_yield()'
15948 else
15949     val="$undef"
15950 fi
15951 case "$usethreads" in
15952 $define)
15953         case "$val" in
15954         $define) echo 'sched_yield() found.' >&4        ;;
15955         *)       echo 'sched_yield() NOT found.' >&4    ;;
15956         esac
15957 esac
15958 set d_sched_yield
15959 eval $setvar
15960
15961 : see if pthread_yield exists
15962 set try -DPTHREAD_YIELD
15963 if eval $compile; then
15964     val="$define"
15965     case "$sched_yield" in
15966     '') sched_yield='pthread_yield()' ;;
15967     esac
15968 else
15969     set try -DPTHREAD_YIELD_NULL
15970     if eval $compile; then
15971         val="$define"
15972         case "$sched_yield" in
15973         '') sched_yield='pthread_yield(NULL)' ;;
15974         esac
15975     else
15976         val="$undef"
15977     fi
15978 fi
15979 case "$usethreads" in
15980 $define)
15981         case "$val" in
15982         $define) echo 'pthread_yield() found.' >&4      ;;
15983         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15984         esac
15985         ;;
15986 esac
15987 set d_pthread_yield
15988 eval $setvar
15989 case "$sched_yield" in
15990 '') sched_yield=undef ;;
15991 esac
15992 $rm_try
15993
15994 : see if random_r exists
15995 set random_r d_random_r
15996 eval $inlibc
15997 case "$d_random_r" in
15998 "$define")
15999         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16000         case "$d_random_r_proto:$usethreads" in
16001         ":define")      d_random_r_proto=define
16002                 set d_random_r_proto random_r $hdrs
16003                 eval $hasproto ;;
16004         *)      ;;
16005         esac
16006         case "$d_random_r_proto" in
16007         define)
16008         case "$random_r_proto" in
16009         ''|0) try='int random_r(int*, struct random_data*);'
16010         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
16011         esac
16012         case "$random_r_proto" in
16013         ''|0) try='int random_r(long*, struct random_data*);'
16014         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
16015         esac
16016         case "$random_r_proto" in
16017         ''|0) try='int random_r(struct random_data*, int32_t*);'
16018         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
16019         esac
16020         case "$random_r_proto" in
16021         ''|0)   d_random_r=undef
16022                 random_r_proto=0
16023                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16024         * )     case "$random_r_proto" in
16025                 REENTRANT_PROTO*) ;;
16026                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16027                 esac
16028                 echo "Prototype: $try" ;;
16029         esac
16030         ;;
16031         *)      case "$usethreads" in
16032                 define) echo "random_r has no prototype, not using it." >&4 ;;
16033                 esac
16034                 d_random_r=undef
16035                 random_r_proto=0
16036                 ;;
16037         esac
16038         ;;
16039 *)      random_r_proto=0
16040         ;;
16041 esac
16042
16043 : see if readdir and friends exist
16044 set readdir d_readdir
16045 eval $inlibc
16046 set seekdir d_seekdir
16047 eval $inlibc
16048 set telldir d_telldir
16049 eval $inlibc
16050 set rewinddir d_rewinddir
16051 eval $inlibc
16052
16053 : see if readdir64_r exists
16054 set readdir64_r d_readdir64_r
16055 eval $inlibc
16056 case "$d_readdir64_r" in
16057 "$define")
16058         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16059         case "$d_readdir64_r_proto:$usethreads" in
16060         ":define")      d_readdir64_r_proto=define
16061                 set d_readdir64_r_proto readdir64_r $hdrs
16062                 eval $hasproto ;;
16063         *)      ;;
16064         esac
16065         case "$d_readdir64_r_proto" in
16066         define)
16067         case "$readdir64_r_proto" in
16068         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16069         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
16070         esac
16071         case "$readdir64_r_proto" in
16072         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16073         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
16074         esac
16075         case "$readdir64_r_proto" in
16076         ''|0)   d_readdir64_r=undef
16077                 readdir64_r_proto=0
16078                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16079         * )     case "$readdir64_r_proto" in
16080                 REENTRANT_PROTO*) ;;
16081                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16082                 esac
16083                 echo "Prototype: $try" ;;
16084         esac
16085         ;;
16086         *)      case "$usethreads" in
16087                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16088                 esac
16089                 d_readdir64_r=undef
16090                 readdir64_r_proto=0
16091                 ;;
16092         esac
16093         ;;
16094 *)      readdir64_r_proto=0
16095         ;;
16096 esac
16097
16098 : see if readdir_r exists
16099 set readdir_r d_readdir_r
16100 eval $inlibc
16101 case "$d_readdir_r" in
16102 "$define")
16103         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16104         case "$d_readdir_r_proto:$usethreads" in
16105         ":define")      d_readdir_r_proto=define
16106                 set d_readdir_r_proto readdir_r $hdrs
16107                 eval $hasproto ;;
16108         *)      ;;
16109         esac
16110         case "$d_readdir_r_proto" in
16111         define)
16112         case "$readdir_r_proto" in
16113         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16114         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
16115         esac
16116         case "$readdir_r_proto" in
16117         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16118         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
16119         esac
16120         case "$readdir_r_proto" in
16121         ''|0)   d_readdir_r=undef
16122                 readdir_r_proto=0
16123                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16124         * )     case "$readdir_r_proto" in
16125                 REENTRANT_PROTO*) ;;
16126                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16127                 esac
16128                 echo "Prototype: $try" ;;
16129         esac
16130         ;;
16131         *)      case "$usethreads" in
16132                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16133                 esac
16134                 d_readdir_r=undef
16135                 readdir_r_proto=0
16136                 ;;
16137         esac
16138         ;;
16139 *)      readdir_r_proto=0
16140         ;;
16141 esac
16142
16143 : see if readv exists
16144 set readv d_readv
16145 eval $inlibc
16146
16147 : see if recvmsg exists
16148 set recvmsg d_recvmsg
16149 eval $inlibc
16150
16151 : see if rename exists
16152 set rename d_rename
16153 eval $inlibc
16154
16155 : see if rmdir exists
16156 set rmdir d_rmdir
16157 eval $inlibc
16158
16159 : see if memory.h is available.
16160 val=''
16161 set memory.h val
16162 eval $inhdr
16163
16164 : See if it conflicts with string.h
16165 case "$val" in
16166 $define)
16167         case "$strings" in
16168         '') ;;
16169         *)
16170                 $cppstdin $cppflags $cppminus < $strings > mem.h
16171                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16172                         echo " "
16173                         echo "We won't be including <memory.h>."
16174                         val="$undef"
16175                 fi
16176                 $rm -f mem.h
16177                 ;;
16178         esac
16179 esac
16180 set i_memory
16181 eval $setvar
16182
16183 : can bcopy handle overlapping blocks?
16184 echo " "
16185 val="$undef"
16186 case "$d_memmove" in
16187 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16188 *)      case "$d_bcopy" in
16189         "$define")
16190                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16191                 $cat >try.c <<EOCP
16192 #$i_memory I_MEMORY
16193 #$i_stdlib I_STDLIB
16194 #$i_string I_STRING
16195 #$i_unistd I_UNISTD
16196 EOCP
16197         $cat >>try.c <<'EOCP'
16198 #include <stdio.h>
16199 #ifdef I_MEMORY
16200 #  include <memory.h>
16201 #endif
16202 #ifdef I_STDLIB
16203 #  include <stdlib.h>
16204 #endif
16205 #ifdef I_STRING
16206 #  include <string.h>
16207 #else
16208 #  include <strings.h>
16209 #endif
16210 #ifdef I_UNISTD
16211 #  include <unistd.h>  /* Needed for NetBSD */
16212 #endif
16213 int main()
16214 {
16215 char buf[128], abc[128];
16216 char *b;
16217 int len;
16218 int off;
16219 int align;
16220
16221 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16222    try to store the string in read-only memory. */
16223 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16224
16225 for (align = 7; align >= 0; align--) {
16226         for (len = 36; len; len--) {
16227                 b = buf+align;
16228                 bcopy(abc, b, len);
16229                 for (off = 1; off <= len; off++) {
16230                         bcopy(b, b+off, len);
16231                         bcopy(b+off, b, len);
16232                         if (bcmp(b, abc, len))
16233                                 exit(1);
16234                 }
16235         }
16236 }
16237 exit(0);
16238 }
16239 EOCP
16240                 set try
16241                 if eval $compile_ok; then
16242                         if $run ./try 2>/dev/null; then
16243                                 echo "Yes, it can."
16244                                 val="$define"
16245                         else
16246                                 echo "It can't, sorry."
16247                         fi
16248                 else
16249                         echo "(I can't compile the test program, so we'll assume not...)"
16250                 fi
16251                 ;;
16252         esac
16253         $rm_try
16254         ;;
16255 esac
16256 set d_safebcpy
16257 eval $setvar
16258
16259 : can memcpy handle overlapping blocks?
16260 echo " "
16261 val="$undef"
16262 case "$d_memmove" in
16263 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16264 *)      case "$d_memcpy" in
16265         "$define")
16266                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16267                 $cat >try.c <<EOCP
16268 #$i_memory I_MEMORY
16269 #$i_stdlib I_STDLIB
16270 #$i_string I_STRING
16271 #$i_unistd I_UNISTD
16272 EOCP
16273         $cat >>try.c <<'EOCP'
16274 #include <stdio.h>
16275 #ifdef I_MEMORY
16276 #  include <memory.h>
16277 #endif
16278 #ifdef I_STDLIB
16279 #  include <stdlib.h>
16280 #endif
16281 #ifdef I_STRING
16282 #  include <string.h>
16283 #else
16284 #  include <strings.h>
16285 #endif
16286 #ifdef I_UNISTD
16287 #  include <unistd.h>  /* Needed for NetBSD */
16288 #endif
16289 int main()
16290 {
16291 char buf[128], abc[128];
16292 char *b;
16293 int len;
16294 int off;
16295 int align;
16296
16297 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16298    try to store the string in read-only memory. */
16299 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16300
16301 for (align = 7; align >= 0; align--) {
16302         for (len = 36; len; len--) {
16303                 b = buf+align;
16304                 memcpy(b, abc, len);
16305                 for (off = 1; off <= len; off++) {
16306                         memcpy(b+off, b, len);
16307                         memcpy(b, b+off, len);
16308                         if (memcmp(b, abc, len))
16309                                 exit(1);
16310                 }
16311         }
16312 }
16313 exit(0);
16314 }
16315 EOCP
16316                 set try
16317                 if eval $compile_ok; then
16318                         if $run ./try 2>/dev/null; then
16319                                 echo "Yes, it can."
16320                                 val="$define"
16321                         else
16322                                 echo "It can't, sorry."
16323                         fi
16324                 else
16325                         echo "(I can't compile the test program, so we'll assume not...)"
16326                 fi
16327                 ;;
16328         esac
16329         $rm_try
16330         ;;
16331 esac
16332 set d_safemcpy
16333 eval $setvar
16334
16335 : can memcmp be trusted to compare relative magnitude?
16336 val="$undef"
16337 case "$d_memcmp" in
16338 "$define")
16339         echo " "
16340         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16341         $cat >try.c <<EOCP
16342 #$i_memory I_MEMORY
16343 #$i_stdlib I_STDLIB
16344 #$i_string I_STRING
16345 #$i_unistd I_UNISTD
16346 EOCP
16347         $cat >>try.c <<'EOCP'
16348 #include <stdio.h>
16349 #ifdef I_MEMORY
16350 #  include <memory.h>
16351 #endif
16352 #ifdef I_STDLIB
16353 #  include <stdlib.h>
16354 #endif
16355 #ifdef I_STRING
16356 #  include <string.h>
16357 #else
16358 #  include <strings.h>
16359 #endif
16360 #ifdef I_UNISTD
16361 #  include <unistd.h>  /* Needed for NetBSD */
16362 #endif
16363 int main()
16364 {
16365 char a = -1;
16366 char b = 0;
16367 if ((a < b) && memcmp(&a, &b, 1) < 0)
16368         exit(1);
16369 exit(0);
16370 }
16371 EOCP
16372         set try
16373         if eval $compile_ok; then
16374                 if $run ./try 2>/dev/null; then
16375                         echo "Yes, it can."
16376                         val="$define"
16377                 else
16378                         echo "No, it can't (it uses signed chars)."
16379                 fi
16380         else
16381                 echo "(I can't compile the test program, so we'll assume not...)"
16382         fi
16383         ;;
16384 esac
16385 $rm_try
16386 set d_sanemcmp
16387 eval $setvar
16388
16389 : see if prototype for sbrk is available
16390 echo " "
16391 set d_sbrkproto sbrk $i_unistd unistd.h
16392 eval $hasproto
16393
16394 : see if select exists
16395 set select d_select
16396 eval $inlibc
16397
16398 : see if semctl exists
16399 set semctl d_semctl
16400 eval $inlibc
16401
16402 : see if semget exists
16403 set semget d_semget
16404 eval $inlibc
16405
16406 : see if semop exists
16407 set semop d_semop
16408 eval $inlibc
16409
16410 : see how much of the 'sem*(2)' library is present.
16411 h_sem=true
16412 echo " "
16413 case "$d_semctl$d_semget$d_semop" in
16414 *"$undef"*) h_sem=false;;
16415 esac
16416 case "$osname" in
16417 freebsd)
16418     case "`ipcs 2>&1`" in
16419     "SVID messages"*"not configured"*)
16420         echo "Your $osname does not have the sem*(2) configured." >&4
16421         h_sem=false
16422         val="$undef"
16423         set semctl d_semctl
16424         eval $setvar
16425         set semget d_semget
16426         eval $setvar
16427         set semop d_semop
16428         eval $setvar
16429         ;;
16430     esac
16431     ;;
16432 esac
16433 : we could also check for sys/ipc.h ...
16434 if $h_sem && $test `./findhdr sys/sem.h`; then
16435         echo "You have the full sem*(2) library." >&4
16436         val="$define"
16437 else
16438         echo "You don't have the full sem*(2) library." >&4
16439         val="$undef"
16440 fi
16441 set d_sem
16442 eval $setvar
16443
16444 : see whether sys/sem.h defines union semun
16445 echo " "
16446 $cat > try.c <<'END'
16447 #include <sys/types.h>
16448 #include <sys/ipc.h>
16449 #include <sys/sem.h>
16450 int main () { union semun semun; semun.buf = 0; }
16451 END
16452 set try
16453 if eval $compile; then
16454     echo "You have union semun in <sys/sem.h>." >&4
16455     val="$define"
16456 else
16457     echo "You do not have union semun in <sys/sem.h>." >&4
16458     val="$undef"
16459 fi
16460 $rm_try
16461 set d_union_semun
16462 eval $setvar
16463
16464 : see how to do semctl IPC_STAT
16465 case "$d_sem" in
16466 $define)
16467     echo " "
16468     $cat > tryh.h <<END
16469 #ifndef S_IRUSR
16470 #   ifdef S_IREAD
16471 #       define S_IRUSR S_IREAD
16472 #       define S_IWUSR S_IWRITE
16473 #       define S_IXUSR S_IEXEC
16474 #   else
16475 #       define S_IRUSR 0400
16476 #       define S_IWUSR 0200
16477 #       define S_IXUSR 0100
16478 #   endif
16479 #   define S_IRGRP (S_IRUSR>>3)
16480 #   define S_IWGRP (S_IWUSR>>3)
16481 #   define S_IXGRP (S_IXUSR>>3)
16482 #   define S_IROTH (S_IRUSR>>6)
16483 #   define S_IWOTH (S_IWUSR>>6)
16484 #   define S_IXOTH (S_IXUSR>>6)
16485 #endif
16486 #ifndef S_IRWXU
16487 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16488 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16489 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16490 #endif
16491 END
16492     : see whether semctl IPC_STAT can use union semun
16493     case "$d_semctl_semun" in
16494     '')
16495       val="$undef"
16496       $cat > try.c <<END
16497 #include <sys/types.h>
16498 #include <sys/ipc.h>
16499 #include <sys/sem.h>
16500 #include <sys/stat.h>
16501 #include <stdio.h>
16502 #include <errno.h>
16503 #include "tryh.h"
16504 #ifndef errno
16505 extern int errno;
16506 #endif
16507 #$d_union_semun HAS_UNION_SEMUN
16508 int main() {
16509     union semun
16510 #ifndef HAS_UNION_SEMUN
16511     {
16512         int val;
16513         struct semid_ds *buf;
16514         unsigned short *array;
16515     }
16516 #endif
16517     arg;
16518     int sem, st;
16519
16520 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16521     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16522     if (sem > -1) {
16523         struct semid_ds argbuf;
16524         arg.buf = &argbuf;
16525 #       ifdef IPC_STAT
16526         st = semctl(sem, 0, IPC_STAT, arg);
16527         if (st == 0)
16528             printf("semun\n");
16529         else
16530 #       endif /* IPC_STAT */
16531             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16532 #       ifdef IPC_RMID
16533         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16534 #       endif /* IPC_RMID */
16535             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16536     } else
16537 #endif /* IPC_PRIVATE && ... */
16538         printf("semget failed: errno = %d\n", errno);
16539   return 0;
16540 }
16541 END
16542       set try
16543       if eval $compile; then
16544           xxx=`$run ./try`
16545           case "$xxx" in
16546           semun) val="$define" ;;
16547           esac
16548       fi
16549       $rm_try
16550       set d_semctl_semun
16551       eval $setvar
16552       ;;
16553     esac
16554     case "$d_semctl_semun" in
16555     $define)
16556         echo "You can use union semun for semctl IPC_STAT." >&4
16557         also='also'
16558         ;;
16559     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16560         also=''
16561         ;;
16562     esac
16563
16564     : see whether semctl IPC_STAT can use struct semid_ds pointer
16565     case "$d_semctl_semid_ds" in
16566     '')
16567       val="$undef"
16568       $cat > try.c <<'END'
16569 #include <sys/types.h>
16570 #include <sys/ipc.h>
16571 #include <sys/sem.h>
16572 #include <sys/stat.h>
16573 #include "tryh.h"
16574 #include <stdio.h>
16575 #include <errno.h>
16576 #ifndef errno
16577 extern int errno;
16578 #endif
16579 int main() {
16580     struct semid_ds arg;
16581     int sem, st;
16582
16583 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16584     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16585     if (sem > -1) {
16586 #       ifdef IPC_STAT
16587         st = semctl(sem, 0, IPC_STAT, &arg);
16588         if (st == 0)
16589             printf("semid_ds\n");
16590         else
16591 #       endif /* IPC_STAT */
16592             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16593 #       ifdef IPC_RMID
16594         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16595 #       endif /* IPC_RMID */
16596             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16597     } else
16598 #endif /* IPC_PRIVATE && ... */
16599         printf("semget failed: errno = %d\n", errno);
16600
16601     return 0;
16602 }
16603 END
16604       set try
16605       if eval $compile; then
16606           xxx=`$run ./try`
16607           case "$xxx" in
16608           semid_ds) val="$define" ;;
16609           esac
16610       fi
16611       $rm_try
16612       set d_semctl_semid_ds
16613       eval $setvar
16614       ;;
16615     esac
16616     case "$d_semctl_semid_ds" in
16617     $define)
16618         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16619         ;;
16620     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16621         ;;
16622     esac
16623     ;;
16624 *)  val="$undef"
16625
16626     # We do not have the full sem*(2) library, so assume we can not
16627     # use either.
16628
16629     set d_semctl_semun
16630     eval $setvar
16631
16632     set d_semctl_semid_ds
16633     eval $setvar
16634     ;;
16635 esac
16636 $rm_try tryh.h
16637
16638 : see if sendmsg exists
16639 set sendmsg d_sendmsg
16640 eval $inlibc
16641
16642 : see if setegid exists
16643 set setegid d_setegid
16644 eval $inlibc
16645
16646 : see if seteuid exists
16647 set seteuid d_seteuid
16648 eval $inlibc
16649
16650 : see if setgrent exists
16651 set setgrent d_setgrent
16652 eval $inlibc
16653
16654 : see if setgrent_r exists
16655 set setgrent_r d_setgrent_r
16656 eval $inlibc
16657 case "$d_setgrent_r" in
16658 "$define")
16659         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16660         case "$d_setgrent_r_proto:$usethreads" in
16661         ":define")      d_setgrent_r_proto=define
16662                 set d_setgrent_r_proto setgrent_r $hdrs
16663                 eval $hasproto ;;
16664         *)      ;;
16665         esac
16666         case "$d_setgrent_r_proto" in
16667         define)
16668         case "$setgrent_r_proto" in
16669         ''|0) try='int setgrent_r(FILE**);'
16670         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16671         esac
16672         case "$setgrent_r_proto" in
16673         ''|0) try='void setgrent_r(FILE**);'
16674         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16675         esac
16676         case "$setgrent_r_proto" in
16677         ''|0)   d_setgrent_r=undef
16678                 setgrent_r_proto=0
16679                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16680         * )     case "$setgrent_r_proto" in
16681                 REENTRANT_PROTO*) ;;
16682                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16683                 esac
16684                 echo "Prototype: $try" ;;
16685         esac
16686         ;;
16687         *)      case "$usethreads" in
16688                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16689                 esac
16690                 d_setgrent_r=undef
16691                 setgrent_r_proto=0
16692                 ;;
16693         esac
16694         ;;
16695 *)      setgrent_r_proto=0
16696         ;;
16697 esac
16698
16699 : see if sethostent exists
16700 set sethostent d_sethent
16701 eval $inlibc
16702
16703 : see if sethostent_r exists
16704 set sethostent_r d_sethostent_r
16705 eval $inlibc
16706 case "$d_sethostent_r" in
16707 "$define")
16708         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16709         case "$d_sethostent_r_proto:$usethreads" in
16710         ":define")      d_sethostent_r_proto=define
16711                 set d_sethostent_r_proto sethostent_r $hdrs
16712                 eval $hasproto ;;
16713         *)      ;;
16714         esac
16715         case "$d_sethostent_r_proto" in
16716         define)
16717         case "$sethostent_r_proto" in
16718         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16719         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16720         esac
16721         case "$sethostent_r_proto" in
16722         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16723         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16724         esac
16725         case "$sethostent_r_proto" in
16726         ''|0)   d_sethostent_r=undef
16727                 sethostent_r_proto=0
16728                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16729         * )     case "$sethostent_r_proto" in
16730                 REENTRANT_PROTO*) ;;
16731                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16732                 esac
16733                 echo "Prototype: $try" ;;
16734         esac
16735         ;;
16736         *)      case "$usethreads" in
16737                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16738                 esac
16739                 d_sethostent_r=undef
16740                 sethostent_r_proto=0
16741                 ;;
16742         esac
16743         ;;
16744 *)      sethostent_r_proto=0
16745         ;;
16746 esac
16747
16748 : see if setitimer exists
16749 set setitimer d_setitimer
16750 eval $inlibc
16751
16752 : see if setlinebuf exists
16753 set setlinebuf d_setlinebuf
16754 eval $inlibc
16755
16756 : see if setlocale exists
16757 set setlocale d_setlocale
16758 eval $inlibc
16759
16760 : see if locale.h is available
16761 set locale.h i_locale
16762 eval $inhdr
16763
16764 : see if setlocale_r exists
16765 set setlocale_r d_setlocale_r
16766 eval $inlibc
16767 case "$d_setlocale_r" in
16768 "$define")
16769         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16770         case "$d_setlocale_r_proto:$usethreads" in
16771         ":define")      d_setlocale_r_proto=define
16772                 set d_setlocale_r_proto setlocale_r $hdrs
16773                 eval $hasproto ;;
16774         *)      ;;
16775         esac
16776         case "$d_setlocale_r_proto" in
16777         define)
16778         case "$setlocale_r_proto" in
16779         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16780         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16781         esac
16782         case "$setlocale_r_proto" in
16783         ''|0)   d_setlocale_r=undef
16784                 setlocale_r_proto=0
16785                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16786         * )     case "$setlocale_r_proto" in
16787                 REENTRANT_PROTO*) ;;
16788                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16789                 esac
16790                 echo "Prototype: $try" ;;
16791         esac
16792         ;;
16793         *)      case "$usethreads" in
16794                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16795                 esac
16796                 d_setlocale_r=undef
16797                 setlocale_r_proto=0
16798                 ;;
16799         esac
16800         ;;
16801 *)      setlocale_r_proto=0
16802         ;;
16803 esac
16804
16805 : see if setnetent exists
16806 set setnetent d_setnent
16807 eval $inlibc
16808
16809 : see if setnetent_r exists
16810 set setnetent_r d_setnetent_r
16811 eval $inlibc
16812 case "$d_setnetent_r" in
16813 "$define")
16814         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16815         case "$d_setnetent_r_proto:$usethreads" in
16816         ":define")      d_setnetent_r_proto=define
16817                 set d_setnetent_r_proto setnetent_r $hdrs
16818                 eval $hasproto ;;
16819         *)      ;;
16820         esac
16821         case "$d_setnetent_r_proto" in
16822         define)
16823         case "$setnetent_r_proto" in
16824         ''|0) try='int setnetent_r(int, struct netent_data*);'
16825         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16826         esac
16827         case "$setnetent_r_proto" in
16828         ''|0) try='void setnetent_r(int, struct netent_data*);'
16829         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16830         esac
16831         case "$setnetent_r_proto" in
16832         ''|0)   d_setnetent_r=undef
16833                 setnetent_r_proto=0
16834                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16835         * )     case "$setnetent_r_proto" in
16836                 REENTRANT_PROTO*) ;;
16837                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16838                 esac
16839                 echo "Prototype: $try" ;;
16840         esac
16841         ;;
16842         *)      case "$usethreads" in
16843                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16844                 esac
16845                 d_setnetent_r=undef
16846                 setnetent_r_proto=0
16847                 ;;
16848         esac
16849         ;;
16850 *)      setnetent_r_proto=0
16851         ;;
16852 esac
16853
16854 : see if setprotoent exists
16855 set setprotoent d_setpent
16856 eval $inlibc
16857
16858 : see if setpgid exists
16859 set setpgid d_setpgid
16860 eval $inlibc
16861
16862 : see if setpgrp2 exists
16863 set setpgrp2 d_setpgrp2
16864 eval $inlibc
16865
16866 : see if setpriority exists
16867 set setpriority d_setprior
16868 eval $inlibc
16869
16870 : see if setproctitle exists
16871 set setproctitle d_setproctitle
16872 eval $inlibc
16873
16874 : see if setprotoent_r exists
16875 set setprotoent_r d_setprotoent_r
16876 eval $inlibc
16877 case "$d_setprotoent_r" in
16878 "$define")
16879         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16880         case "$d_setprotoent_r_proto:$usethreads" in
16881         ":define")      d_setprotoent_r_proto=define
16882                 set d_setprotoent_r_proto setprotoent_r $hdrs
16883                 eval $hasproto ;;
16884         *)      ;;
16885         esac
16886         case "$d_setprotoent_r_proto" in
16887         define)
16888         case "$setprotoent_r_proto" in
16889         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16890         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16891         esac
16892         case "$setprotoent_r_proto" in
16893         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16894         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16895         esac
16896         case "$setprotoent_r_proto" in
16897         ''|0)   d_setprotoent_r=undef
16898                 setprotoent_r_proto=0
16899                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16900         * )     case "$setprotoent_r_proto" in
16901                 REENTRANT_PROTO*) ;;
16902                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16903                 esac
16904                 echo "Prototype: $try" ;;
16905         esac
16906         ;;
16907         *)      case "$usethreads" in
16908                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16909                 esac
16910                 d_setprotoent_r=undef
16911                 setprotoent_r_proto=0
16912                 ;;
16913         esac
16914         ;;
16915 *)      setprotoent_r_proto=0
16916         ;;
16917 esac
16918
16919 : see if setpwent exists
16920 set setpwent d_setpwent
16921 eval $inlibc
16922
16923 : see if setpwent_r exists
16924 set setpwent_r d_setpwent_r
16925 eval $inlibc
16926 case "$d_setpwent_r" in
16927 "$define")
16928         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16929         case "$d_setpwent_r_proto:$usethreads" in
16930         ":define")      d_setpwent_r_proto=define
16931                 set d_setpwent_r_proto setpwent_r $hdrs
16932                 eval $hasproto ;;
16933         *)      ;;
16934         esac
16935         case "$d_setpwent_r_proto" in
16936         define)
16937         case "$setpwent_r_proto" in
16938         ''|0) try='int setpwent_r(FILE**);'
16939         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16940         esac
16941         case "$setpwent_r_proto" in
16942         ''|0) try='void setpwent_r(FILE**);'
16943         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16944         esac
16945         case "$setpwent_r_proto" in
16946         ''|0)   d_setpwent_r=undef
16947                 setpwent_r_proto=0
16948                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16949         * )     case "$setpwent_r_proto" in
16950                 REENTRANT_PROTO*) ;;
16951                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16952                 esac
16953                 echo "Prototype: $try" ;;
16954         esac
16955         ;;
16956         *)      case "$usethreads" in
16957                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16958                 esac
16959                 d_setpwent_r=undef
16960                 setpwent_r_proto=0
16961                 ;;
16962         esac
16963         ;;
16964 *)      setpwent_r_proto=0
16965         ;;
16966 esac
16967
16968 : see if setregid exists
16969 set setregid d_setregid
16970 eval $inlibc
16971 set setresgid d_setresgid
16972 eval $inlibc
16973
16974 : see if setreuid exists
16975 set setreuid d_setreuid
16976 eval $inlibc
16977 set setresuid d_setresuid
16978 eval $inlibc
16979
16980 : see if setrgid exists
16981 set setrgid d_setrgid
16982 eval $inlibc
16983
16984 : see if setruid exists
16985 set setruid d_setruid
16986 eval $inlibc
16987
16988 : see if setservent exists
16989 set setservent d_setsent
16990 eval $inlibc
16991
16992 : see if setservent_r exists
16993 set setservent_r d_setservent_r
16994 eval $inlibc
16995 case "$d_setservent_r" in
16996 "$define")
16997         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16998         case "$d_setservent_r_proto:$usethreads" in
16999         ":define")      d_setservent_r_proto=define
17000                 set d_setservent_r_proto setservent_r $hdrs
17001                 eval $hasproto ;;
17002         *)      ;;
17003         esac
17004         case "$d_setservent_r_proto" in
17005         define)
17006         case "$setservent_r_proto" in
17007         ''|0) try='int setservent_r(int, struct servent_data*);'
17008         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
17009         esac
17010         case "$setservent_r_proto" in
17011         ''|0) try='void setservent_r(int, struct servent_data*);'
17012         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
17013         esac
17014         case "$setservent_r_proto" in
17015         ''|0)   d_setservent_r=undef
17016                 setservent_r_proto=0
17017                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17018         * )     case "$setservent_r_proto" in
17019                 REENTRANT_PROTO*) ;;
17020                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17021                 esac
17022                 echo "Prototype: $try" ;;
17023         esac
17024         ;;
17025         *)      case "$usethreads" in
17026                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17027                 esac
17028                 d_setservent_r=undef
17029                 setservent_r_proto=0
17030                 ;;
17031         esac
17032         ;;
17033 *)      setservent_r_proto=0
17034         ;;
17035 esac
17036
17037 : see if setsid exists
17038 set setsid d_setsid
17039 eval $inlibc
17040
17041 : see if setvbuf exists
17042 set setvbuf d_setvbuf
17043 eval $inlibc
17044
17045 : see if sfio.h is available
17046 set sfio.h i_sfio
17047 eval $inhdr
17048
17049 : see if sfio library is available
17050 case "$i_sfio" in
17051 $define)
17052         val=''
17053         set sfreserve val
17054         eval $inlibc
17055         ;;
17056 *)
17057         val="$undef"
17058         ;;
17059 esac
17060 : Ok, but do we want to use it.
17061 case "$val" in
17062 $define)
17063         case "$usesfio" in
17064         true|$define|[yY]*) dflt='y';;
17065         *) dflt='n';;
17066         esac
17067         echo "$package can use the sfio library, but it is experimental."
17068         case "$useperlio" in
17069         "$undef")
17070             echo "For sfio also the PerlIO abstraction layer is needed."
17071             echo "Earlier you said you wouldn't want that."
17072             ;;
17073         esac
17074         rp="You seem to have sfio available, do you want to try using it?"
17075         . ./myread
17076         case "$ans" in
17077         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
17078                 useperlio="$define"
17079                 val="$define"
17080                 ;;
17081         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17082                 val="$undef"
17083                 ;;
17084         esac
17085         ;;
17086 *)      case "$usesfio" in
17087         true|$define|[yY]*)
17088                 echo "Sorry, cannot find sfio on this machine." >&4
17089                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17090                 val="$undef"
17091                 ;;
17092         esac
17093         ;;
17094 esac
17095 set d_sfio
17096 eval $setvar
17097 case "$d_sfio" in
17098 $define) usesfio='true';;
17099 *) usesfio='false';;
17100 esac
17101 case "$d_sfio" in
17102 $define) ;;
17103 *)      : Remove sfio from list of libraries to use
17104         case "$libs" in
17105         *-lsfio*)
17106                 echo "Removing unneeded -lsfio from library list" >&4
17107                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17108                 shift
17109                 libs="$*"
17110                 echo "libs = $libs" >&4
17111                 ;;
17112         esac
17113 ;;
17114 esac
17115
17116
17117 : see if shmctl exists
17118 set shmctl d_shmctl
17119 eval $inlibc
17120
17121 : see if shmget exists
17122 set shmget d_shmget
17123 eval $inlibc
17124
17125 : see if shmat exists
17126 set shmat d_shmat
17127 eval $inlibc
17128 : see what shmat returns
17129 case "$d_shmat" in
17130 "$define")
17131         $cat >shmat.c <<'END'
17132 #include <sys/shm.h>
17133 void *shmat();
17134 END
17135         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17136                 shmattype='void *'
17137         else
17138                 shmattype='char *'
17139         fi
17140         echo "and it returns ($shmattype)." >&4
17141         : see if a prototype for shmat is available
17142         xxx=`./findhdr sys/shm.h`
17143         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17144         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17145                 val="$define"
17146         else
17147                 val="$undef"
17148         fi
17149         $rm -f shmat.[co]
17150         ;;
17151 *)
17152         val="$undef"
17153         ;;
17154 esac
17155 set d_shmatprototype
17156 eval $setvar
17157
17158 : see if shmdt exists
17159 set shmdt d_shmdt
17160 eval $inlibc
17161
17162 : see how much of the 'shm*(2)' library is present.
17163 h_shm=true
17164 echo " "
17165 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17166 *"$undef"*) h_shm=false;;
17167 esac
17168 case "$osname" in
17169 freebsd)
17170     case "`ipcs 2>&1`" in
17171     "SVID shared memory"*"not configured"*)
17172         echo "Your $osname does not have the shm*(2) configured." >&4
17173         h_shm=false
17174         val="$undef"
17175         set shmctl d_shmctl
17176         evat $setvar
17177         set shmget d_shmget
17178         evat $setvar
17179         set shmat d_shmat
17180         evat $setvar
17181         set shmdt d_shmdt
17182         evat $setvar
17183         ;;
17184     esac
17185     ;;
17186 esac
17187 : we could also check for sys/ipc.h ...
17188 if $h_shm && $test `./findhdr sys/shm.h`; then
17189         echo "You have the full shm*(2) library." >&4
17190         val="$define"
17191 else
17192         echo "You don't have the full shm*(2) library." >&4
17193         val="$undef"
17194 fi
17195 set d_shm
17196 eval $setvar
17197
17198 : see if we have sigaction
17199 echo " "
17200 if set sigaction val -f d_sigaction; eval $csym; $val; then
17201         echo 'sigaction() found.' >&4
17202         $cat > try.c <<EOP
17203 #include <stdio.h>
17204 #include <sys/types.h>
17205 #include <signal.h>
17206 #$i_stdlib I_STDLIB
17207 #ifdef I_STDLIB
17208 #include <stdlib.h>
17209 #endif
17210 int main()
17211 {
17212     struct sigaction act, oact;
17213     act.sa_flags = 0;
17214     oact.sa_handler = 0;
17215     /* so that act and oact are used */
17216     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17217 }
17218 EOP
17219         set try
17220         if eval $compile_ok; then
17221                 val="$define"
17222         else
17223                 echo "But you don't seem to have a useable struct sigaction." >&4
17224                 val="$undef"
17225         fi
17226 else
17227         echo 'sigaction NOT found.' >&4
17228         val="$undef"
17229 fi
17230 set d_sigaction; eval $setvar
17231 $rm_try
17232
17233 : see if this is a sunmath.h system
17234 set sunmath.h i_sunmath
17235 eval $inhdr
17236
17237 : see if signbit exists
17238 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17239 $cat >try.c <<EOCP
17240 #$i_math I_MATH
17241 #$i_sunmath I_SUNMATH
17242 #ifdef I_MATH
17243 #  include <math.h>
17244 #endif
17245 #ifdef I_SUNMATH  /* Solaris special math library */
17246 #  include <sunmath.h>
17247 #endif
17248 #define NV $nvtype
17249 int main(int argc, char **argv)
17250 {
17251     NV x = 0.0;
17252     NV y = -0.0;
17253     if ((signbit(x) == 0) && (signbit(y) != 0))
17254         return 0;
17255     else
17256         return 1;
17257 }
17258 EOCP
17259 val="$undef"
17260 set try
17261 if eval $compile; then
17262     if $run ./try; then
17263         $echo "Yes." >&4
17264         val="$define"
17265     else
17266         $echo "Signbit seems to be available, but doesn't work as I expected."
17267         $echo "I won't use it." >&4
17268         val="$undef"
17269     fi
17270 else
17271     $echo "Nope." >&4
17272     dflt="$undef"
17273 fi
17274 set d_signbit
17275 eval $setvar
17276 $rm_try
17277
17278 : see if sigprocmask exists
17279 set sigprocmask d_sigprocmask
17280 eval $inlibc
17281
17282 : see if sigsetjmp exists
17283 echo " "
17284 case "$d_sigsetjmp" in
17285 '')
17286         $cat >try.c <<EOP
17287 #include <setjmp.h>
17288 #$i_stdlib I_STDLIB
17289 #ifdef I_STDLIB
17290 #include <stdlib.h>
17291 #endif
17292 sigjmp_buf env;
17293 int set = 1;
17294 int main()
17295 {
17296         if (sigsetjmp(env,1))
17297                 exit(set);
17298         set = 0;
17299         siglongjmp(env, 1);
17300         exit(1);
17301 }
17302 EOP
17303         set try
17304         if eval $compile; then
17305                 if $run ./try >/dev/null 2>&1; then
17306                         echo "POSIX sigsetjmp found." >&4
17307                         val="$define"
17308                 else
17309                         $cat >&4 <<EOM
17310 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17311 I'll ignore them.
17312 EOM
17313                         val="$undef"
17314                 fi
17315         else
17316                 echo "sigsetjmp not found." >&4
17317                 val="$undef"
17318         fi
17319         ;;
17320 *) val="$d_sigsetjmp"
17321         case "$d_sigsetjmp" in
17322         $define) echo "POSIX sigsetjmp found." >&4;;
17323         $undef) echo "sigsetjmp not found." >&4;;
17324         esac
17325         ;;
17326 esac
17327 set d_sigsetjmp
17328 eval $setvar
17329 $rm_try
17330
17331 : see if snprintf exists
17332 set snprintf d_snprintf
17333 eval $inlibc
17334
17335 : see if vsnprintf exists
17336 set vsnprintf d_vsnprintf
17337 eval $inlibc
17338
17339 case "$d_snprintf-$d_vsnprintf" in
17340 "$define-$define")
17341     $cat <<EOM
17342 Checking whether your snprintf() and vsnprintf() work okay...
17343 EOM
17344     $cat >try.c <<'EOCP'
17345 /* v?snprintf testing logic courtesy of Russ Allbery.
17346  * According to C99:
17347  * - if the buffer is too short it still must be \0-terminated
17348  * - if the buffer is too short the potentially required length
17349  *   must be returned and not -1
17350  * - if the buffer is NULL the potentially required length
17351  *   must be returned and not -1 or core dump
17352  */
17353 #include <stdio.h>
17354 #include <stdarg.h>
17355
17356 char buf[2];
17357
17358 int test (char *format, ...)
17359 {
17360     va_list args;
17361     int count;
17362
17363     va_start (args, format);
17364     count = vsnprintf (buf, sizeof buf, format, args);
17365     va_end (args);
17366     return count;
17367 }
17368
17369 int main ()
17370 {
17371     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17372              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17373 }
17374 EOCP
17375     set try
17376     if eval $compile; then
17377         `$run ./try`
17378         case "$?" in
17379         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17380         *) cat <<EOM >&4
17381 Your snprintf() and snprintf() don't seem to be working okay.
17382 EOM
17383            d_snprintf="$undef"
17384            d_vsnprintf="$undef"
17385            ;;
17386         esac
17387     else
17388         echo "(I can't seem to compile the test program--assuming they don't)"
17389         d_snprintf="$undef"
17390         d_vsnprintf="$undef"
17391     fi
17392     $rm_try
17393     ;;
17394 esac
17395
17396 : see if sockatmark exists
17397 set sockatmark d_sockatmark
17398 eval $inlibc
17399
17400 : see if prototype for sockatmark is available
17401 echo " "
17402 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17403 eval $hasproto
17404
17405 : see if socks5_init exists
17406 set socks5_init d_socks5_init
17407 eval $inlibc
17408
17409 : see if sprintf returns the length of the string in the buffer as per ANSI
17410 $echo "Checking whether sprintf returns the length of the string..." >&4
17411 $cat <<EOP >try.c
17412 #include <stdio.h>
17413 #$i_stdlib I_STDLIB
17414 #ifdef I_STDLIB
17415 #include <stdlib.h>
17416 #endif
17417 #$i_string I_STRING
17418 #ifdef I_STRING
17419 #  include <string.h>
17420 #else
17421 #  include <strings.h>
17422 #endif
17423 #$i_math I_MATH
17424 #ifdef I_MATH
17425 #include <math.h>
17426 #endif
17427
17428 char buffer[256];
17429
17430 int check (size_t expect, int test) {
17431   size_t got = strlen(buffer);
17432   if (expect == got)
17433     return 0;
17434
17435   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17436        test, buffer);
17437   exit (test);
17438 }
17439
17440 int main(int argc, char **argv) {
17441   int test = 0;
17442
17443   check(sprintf(buffer, ""), ++test);
17444   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17445   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17446
17447   return 0;
17448 }
17449 EOP
17450 set try
17451
17452 d_sprintf_returns_strlen="$undef"
17453 if eval $compile; then
17454     xxx="`$run ./try`"
17455     case "$?" in
17456         0) cat >&4 <<EOM
17457 sprintf returns the length of the string (as ANSI says it should)
17458 EOM
17459         d_sprintf_returns_strlen="$define"
17460         ;;
17461         *) cat >&4 <<EOM
17462 sprintf does not return the length of the string (how old is this system?)
17463 EOM
17464         d_sprintf_returns_strlen="$undef"
17465         ;;
17466     esac
17467 fi
17468 $rm_try
17469
17470 : see if srand48_r exists
17471 set srand48_r d_srand48_r
17472 eval $inlibc
17473 case "$d_srand48_r" in
17474 "$define")
17475         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17476         case "$d_srand48_r_proto:$usethreads" in
17477         ":define")      d_srand48_r_proto=define
17478                 set d_srand48_r_proto srand48_r $hdrs
17479                 eval $hasproto ;;
17480         *)      ;;
17481         esac
17482         case "$d_srand48_r_proto" in
17483         define)
17484         case "$srand48_r_proto" in
17485         ''|0) try='int srand48_r(long, struct drand48_data*);'
17486         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17487         esac
17488         case "$srand48_r_proto" in
17489         ''|0)   d_srand48_r=undef
17490                 srand48_r_proto=0
17491                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17492         * )     case "$srand48_r_proto" in
17493                 REENTRANT_PROTO*) ;;
17494                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17495                 esac
17496                 echo "Prototype: $try" ;;
17497         esac
17498         ;;
17499         *)      case "$usethreads" in
17500                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17501                 esac
17502                 d_srand48_r=undef
17503                 srand48_r_proto=0
17504                 ;;
17505         esac
17506         ;;
17507 *)      srand48_r_proto=0
17508         ;;
17509 esac
17510
17511 : see if srandom_r exists
17512 set srandom_r d_srandom_r
17513 eval $inlibc
17514 case "$d_srandom_r" in
17515 "$define")
17516         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17517         case "$d_srandom_r_proto:$usethreads" in
17518         ":define")      d_srandom_r_proto=define
17519                 set d_srandom_r_proto srandom_r $hdrs
17520                 eval $hasproto ;;
17521         *)      ;;
17522         esac
17523         case "$d_srandom_r_proto" in
17524         define)
17525         case "$srandom_r_proto" in
17526         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17527         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17528         esac
17529         case "$srandom_r_proto" in
17530         ''|0)   d_srandom_r=undef
17531                 srandom_r_proto=0
17532                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17533         * )     case "$srandom_r_proto" in
17534                 REENTRANT_PROTO*) ;;
17535                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17536                 esac
17537                 echo "Prototype: $try" ;;
17538         esac
17539         ;;
17540         *)      case "$usethreads" in
17541                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17542                 esac
17543                 d_srandom_r=undef
17544                 srandom_r_proto=0
17545                 ;;
17546         esac
17547         ;;
17548 *)      srandom_r_proto=0
17549         ;;
17550 esac
17551
17552 : see if prototype for setresgid is available
17553 echo " "
17554 set d_sresgproto setresgid $i_unistd unistd.h
17555 eval $hasproto
17556
17557 : see if prototype for setresuid is available
17558 echo " "
17559 set d_sresuproto setresuid $i_unistd unistd.h
17560 eval $hasproto
17561
17562 : see if sys/stat.h is available
17563 set sys/stat.h i_sysstat
17564 eval $inhdr
17565
17566 : see if stat knows about block sizes
17567 echo " "
17568 echo "Checking to see if your struct stat has st_blocks field..." >&4
17569 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17570 eval $hasfield
17571
17572 : see if this is a sys/vfs.h system
17573 set sys/vfs.h i_sysvfs
17574 eval $inhdr
17575
17576 : see if this is a sys/statfs.h system
17577 set sys/statfs.h i_sysstatfs
17578 eval $inhdr
17579
17580 : Check for statfs_s
17581 echo " "
17582 echo "Checking to see if your system supports struct statfs..." >&4
17583 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
17584 eval $hasstruct
17585 case "$d_statfs_s" in
17586 "$define")      echo "Yes, it does."   ;;
17587 *)              echo "No, it doesn't." ;;
17588 esac
17589
17590
17591 : see if struct statfs knows about f_flags
17592 case "$d_statfs_s" in
17593 define)
17594         echo " "
17595         echo "Checking to see if your struct statfs has f_flags field..." >&4
17596         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
17597         eval $hasfield
17598         ;;
17599 *)      val="$undef"
17600         set d_statfs_f_flags
17601         eval $setvar
17602         ;;
17603 esac
17604 case "$d_statfs_f_flags" in
17605 "$define")      echo "Yes, it does."   ;;
17606 *)              echo "No, it doesn't." ;;
17607 esac
17608
17609 : Check stream access
17610 $cat >&4 <<EOM
17611 Checking how to access stdio streams by file descriptor number...
17612 EOM
17613 case "$stdio_stream_array" in
17614 '')     $cat >try.c <<EOCP
17615 #include <stdio.h>
17616 int main() {
17617   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17618     printf("yes\n");
17619 }
17620 EOCP
17621         for s in _iob __iob __sF
17622         do
17623                 set try -DSTDIO_STREAM_ARRAY=$s
17624                 if eval $compile; then
17625                         case "`$run ./try`" in
17626                         yes)    stdio_stream_array=$s; break ;;
17627                         esac
17628                 fi
17629         done
17630         $rm_try
17631 esac
17632 case "$stdio_stream_array" in
17633 '')     $cat >&4 <<EOM
17634 I can't figure out how to access stdio streams by file descriptor number.
17635 EOM
17636         d_stdio_stream_array="$undef"
17637         ;;
17638 *)      $cat >&4 <<EOM
17639 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17640 EOM
17641         d_stdio_stream_array="$define"
17642         ;;
17643 esac
17644
17645 : see if strcoll exists
17646 set strcoll d_strcoll
17647 eval $inlibc
17648
17649 : check for structure copying
17650 echo " "
17651 echo "Checking to see if your C compiler can copy structs..." >&4
17652 $cat >try.c <<'EOCP'
17653 int main()
17654 {
17655         struct blurfl {
17656                 int dyick;
17657         } foo, bar;
17658
17659         foo = bar;
17660 }
17661 EOCP
17662 if $cc -c try.c >/dev/null 2>&1 ; then
17663         val="$define"
17664         echo "Yup, it can."
17665 else
17666         val="$undef"
17667         echo "Nope, it can't."
17668 fi
17669 set d_strctcpy
17670 eval $setvar
17671 $rm_try
17672
17673 : see if strerror and/or sys_errlist[] exist
17674 echo " "
17675 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17676     if set strerror val -f d_strerror; eval $csym; $val; then
17677                 echo 'strerror() found.' >&4
17678                 d_strerror="$define"
17679                 d_strerrm='strerror(e)'
17680                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17681                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17682                         d_syserrlst="$define"
17683                 else
17684                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17685                         d_syserrlst="$undef"
17686                 fi
17687     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17688                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17689                 echo 'strerror() found in string header.' >&4
17690                 d_strerror="$define"
17691                 d_strerrm='strerror(e)'
17692                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17693                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17694                                 d_syserrlst="$define"
17695                 else
17696                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17697                         d_syserrlst="$undef"
17698                 fi
17699     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17700                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17701                 d_strerror="$undef"
17702                 d_syserrlst="$define"
17703                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17704     else
17705                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17706                 d_strerror="$undef"
17707                 d_syserrlst="$undef"
17708                 d_strerrm='"unknown"'
17709     fi
17710 fi
17711
17712 : see if strerror_r exists
17713 set strerror_r d_strerror_r
17714 eval $inlibc
17715 case "$d_strerror_r" in
17716 "$define")
17717         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17718         case "$d_strerror_r_proto:$usethreads" in
17719         ":define")      d_strerror_r_proto=define
17720                 set d_strerror_r_proto strerror_r $hdrs
17721                 eval $hasproto ;;
17722         *)      ;;
17723         esac
17724         case "$d_strerror_r_proto" in
17725         define)
17726         case "$strerror_r_proto" in
17727         ''|0) try='int strerror_r(int, char*, size_t);'
17728         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17729         esac
17730         case "$strerror_r_proto" in
17731         ''|0) try='int strerror_r(int, char*, int);'
17732         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17733         esac
17734         case "$strerror_r_proto" in
17735         ''|0) try='char* strerror_r(int, char*, size_t);'
17736         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17737         esac
17738         case "$strerror_r_proto" in
17739         ''|0)   d_strerror_r=undef
17740                 strerror_r_proto=0
17741                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17742         * )     case "$strerror_r_proto" in
17743                 REENTRANT_PROTO*) ;;
17744                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17745                 esac
17746                 echo "Prototype: $try" ;;
17747         esac
17748         ;;
17749         *)      case "$usethreads" in
17750                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17751                 esac
17752                 d_strerror_r=undef
17753                 strerror_r_proto=0
17754                 ;;
17755         esac
17756         ;;
17757 *)      strerror_r_proto=0
17758         ;;
17759 esac
17760
17761 : see if strftime exists
17762 set strftime d_strftime
17763 eval $inlibc
17764
17765 : see if strlcat exists
17766 set strlcat d_strlcat
17767 eval $inlibc
17768
17769 : see if strlcpy exists
17770 set strlcpy d_strlcpy
17771 eval $inlibc
17772
17773 : see if strtod exists
17774 set strtod d_strtod
17775 eval $inlibc
17776
17777 : see if strtol exists
17778 set strtol d_strtol
17779 eval $inlibc
17780
17781 : see if strtold exists
17782 set strtold d_strtold
17783 eval $inlibc
17784
17785 : see if strtoll exists
17786 set strtoll d_strtoll
17787 eval $inlibc
17788
17789 case "$d_longlong-$d_strtoll" in
17790 "$define-$define")
17791         $cat <<EOM
17792 Checking whether your strtoll() works okay...
17793 EOM
17794         $cat >try.c <<'EOCP'
17795 #include <errno.h>
17796 #ifdef __hpux
17797 #define strtoll __strtoll
17798 #endif
17799 #ifdef __EMX__
17800 #define strtoll _strtoll
17801 #endif
17802 #include <stdio.h>
17803 extern long long int strtoll(char *s, char **, int);
17804 static int bad = 0;
17805 int check(char *s, long long ell, int een) {
17806         long long gll;
17807         errno = 0;
17808         gll = strtoll(s, 0, 10);
17809         if (!((gll == ell) && (errno == een)))
17810                 bad++;
17811 }
17812 int main() {
17813         check(" 1",                                      1LL, 0);
17814         check(" 0",                                      0LL, 0);
17815         check("-1",                                     -1LL, 0);
17816         check("-9223372036854775808", -9223372036854775808LL, 0);
17817         check("-9223372036854775808", -9223372036854775808LL, 0);
17818         check(" 9223372036854775807",  9223372036854775807LL, 0);
17819         check("-9223372036854775808", -9223372036854775808LL, 0);
17820         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17821         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17822         if (!bad)
17823                 printf("ok\n");
17824 }
17825 EOCP
17826         set try
17827         if eval $compile; then
17828                 yyy=`$run ./try`
17829                 case "$yyy" in
17830                 ok) echo "Your strtoll() seems to be working okay." ;;
17831                 *) cat <<EOM >&4
17832 Your strtoll() doesn't seem to be working okay.
17833 EOM
17834                    d_strtoll="$undef"
17835                    ;;
17836                 esac
17837         else
17838                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17839                 d_strtoll="$undef"
17840         fi
17841         ;;
17842 esac
17843
17844 : see if strtoq exists
17845 set strtoq d_strtoq
17846 eval $inlibc
17847
17848 : see if strtoul exists
17849 set strtoul d_strtoul
17850 eval $inlibc
17851
17852 case "$d_strtoul" in
17853 "$define")
17854         $cat <<EOM
17855 Checking whether your strtoul() works okay...
17856 EOM
17857         $cat >try.c <<'EOCP'
17858 #include <errno.h>
17859 #include <stdio.h>
17860 extern unsigned long int strtoul(char *s, char **, int);
17861 static int bad = 0;
17862 void check(char *s, unsigned long eul, int een) {
17863         unsigned long gul;
17864         errno = 0;
17865         gul = strtoul(s, 0, 10);
17866         if (!((gul == eul) && (errno == een)))
17867                 bad++;
17868 }
17869 int main() {
17870         check(" 1", 1L, 0);
17871         check(" 0", 0L, 0);
17872 EOCP
17873         case "$longsize" in
17874         8)
17875             $cat >>try.c <<'EOCP'
17876         check("18446744073709551615", 18446744073709551615UL, 0);
17877         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17878 #if 0 /* strtoul() for /^-/ strings is undefined. */
17879         check("-1", 18446744073709551615UL, 0);
17880         check("-18446744073709551614", 2, 0);
17881         check("-18446744073709551615", 1, 0);
17882         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17883         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17884 #endif
17885 EOCP
17886                 ;;
17887         4)
17888                     $cat >>try.c <<'EOCP'
17889         check("4294967295", 4294967295UL, 0);
17890         check("4294967296", 4294967295UL, ERANGE);
17891 #if 0 /* strtoul() for /^-/ strings is undefined. */
17892         check("-1", 4294967295UL, 0);
17893         check("-4294967294", 2, 0);
17894         check("-4294967295", 1, 0);
17895         check("-4294967296", 4294967295UL, ERANGE);
17896         check("-4294967297", 4294967295UL, ERANGE);
17897 #endif
17898 EOCP
17899                 ;;
17900         *)
17901 : Should we write these tests to be more portable by sprintf-ing
17902 : ~0 and then manipulating that char string as input for strtol?
17903                 ;;
17904         esac
17905         $cat >>try.c <<'EOCP'
17906         if (!bad)
17907                 printf("ok\n");
17908         return 0;
17909 }
17910 EOCP
17911         set try
17912         if eval $compile; then
17913                 case "`$run ./try`" in
17914                 ok) echo "Your strtoul() seems to be working okay." ;;
17915                 *) cat <<EOM >&4
17916 Your strtoul() doesn't seem to be working okay.
17917 EOM
17918                    d_strtoul="$undef"
17919                    ;;
17920                 esac
17921         else
17922                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17923                 d_strtoul="$undef"
17924         fi
17925         ;;
17926 esac
17927
17928 : see if strtoull exists
17929 set strtoull d_strtoull
17930 eval $inlibc
17931
17932 case "$d_longlong-$d_strtoull" in
17933 "$define-$define")
17934         $cat <<EOM
17935 Checking whether your strtoull() works okay...
17936 EOM
17937         $cat >try.c <<'EOCP'
17938 #include <errno.h>
17939 #ifdef __hpux
17940 #define strtoull __strtoull
17941 #endif
17942 #include <stdio.h>
17943 extern unsigned long long int strtoull(char *s, char **, int);
17944 static int bad = 0;
17945 int check(char *s, long long eull, int een) {
17946         long long gull;
17947         errno = 0;
17948         gull = strtoull(s, 0, 10);
17949         if (!((gull == eull) && (errno == een)))
17950                 bad++;
17951 }
17952 int main() {
17953         check(" 1",                                        1LL, 0);
17954         check(" 0",                                        0LL, 0);
17955         check("18446744073709551615",  18446744073709551615ULL, 0);
17956         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17957 #if 0 /* strtoull() for /^-/ strings is undefined. */
17958         check("-1",                    18446744073709551615ULL, 0);
17959         check("-18446744073709551614",                     2LL, 0);
17960         check("-18446744073709551615",                     1LL, 0);
17961         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17962         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17963 #endif
17964         if (!bad)
17965                 printf("ok\n");
17966 }
17967 EOCP
17968         set try
17969         if eval $compile; then
17970                 case "`$run ./try`" in
17971                 ok) echo "Your strtoull() seems to be working okay." ;;
17972                 *) cat <<EOM >&4
17973 Your strtoull() doesn't seem to be working okay.
17974 EOM
17975                    d_strtoull="$undef"
17976                    ;;
17977                 esac
17978         else
17979                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17980                 d_strtoull="$undef"
17981         fi
17982         ;;
17983 esac
17984
17985 : see if strtouq exists
17986 set strtouq d_strtouq
17987 eval $inlibc
17988
17989 case "$d_strtouq" in
17990 "$define")
17991         $cat <<EOM
17992 Checking whether your strtouq() works okay...
17993 EOM
17994         $cat >try.c <<'EOCP'
17995 #include <errno.h>
17996 #include <stdio.h>
17997 extern unsigned long long int strtouq(char *s, char **, int);
17998 static int bad = 0;
17999 void check(char *s, unsigned long long eull, int een) {
18000         unsigned long long gull;
18001         errno = 0;
18002         gull = strtouq(s, 0, 10);
18003         if (!((gull == eull) && (errno == een)))
18004                 bad++;
18005 }
18006 int main() {
18007         check(" 1",                                        1LL, 0);
18008         check(" 0",                                        0LL, 0);
18009         check("18446744073709551615",  18446744073709551615ULL, 0);
18010         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18011 #if 0 /* strtouq() for /^-/ strings is undefined. */
18012         check("-1",                    18446744073709551615ULL, 0);
18013         check("-18446744073709551614",                     2LL, 0);
18014         check("-18446744073709551615",                     1LL, 0);
18015         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18016         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18017 #endif
18018         if (!bad)
18019                 printf("ok\n");
18020         return 0;
18021 }
18022 EOCP
18023         set try
18024         if eval $compile; then
18025                 case "`$run ./try`" in
18026                 ok) echo "Your strtouq() seems to be working okay." ;;
18027                 *) cat <<EOM >&4
18028 Your strtouq() doesn't seem to be working okay.
18029 EOM
18030                    d_strtouq="$undef"
18031                    ;;
18032                 esac
18033         else
18034                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18035                 d_strtouq="$undef"
18036         fi
18037         ;;
18038 esac
18039
18040 : see if strxfrm exists
18041 set strxfrm d_strxfrm
18042 eval $inlibc
18043
18044 : see if symlink exists
18045 set symlink d_symlink
18046 eval $inlibc
18047
18048 : see if syscall exists
18049 set syscall d_syscall
18050 eval $inlibc
18051
18052 : see if prototype for syscall is available
18053 echo " "
18054 set d_syscallproto syscall $i_unistd unistd.h
18055 eval $hasproto
18056
18057 : see if sysconf exists
18058 set sysconf d_sysconf
18059 eval $inlibc
18060
18061 : see if system exists
18062 set system d_system
18063 eval $inlibc
18064
18065 : see if tcgetpgrp exists
18066 set tcgetpgrp d_tcgetpgrp
18067 eval $inlibc
18068
18069 : see if tcsetpgrp exists
18070 set tcsetpgrp d_tcsetpgrp
18071 eval $inlibc
18072
18073 : see if prototype for telldir is available
18074 echo " "
18075 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18076 eval $hasproto
18077
18078 : see if time exists
18079 echo " "
18080 if test "X$d_time" = X -o X"$timetype" = X; then
18081     if set time val -f d_time; eval $csym; $val; then
18082                 echo 'time() found.' >&4
18083                 val="$define"
18084                 rp="What is the type returned by time() on this system?"
18085                 set time_t timetype long stdio.h sys/types.h
18086                 eval $typedef_ask
18087     else
18088                 echo 'time() not found, hope that will do.' >&4
18089                 val="$undef"
18090                 timetype='int';
18091     fi
18092     set d_time
18093     eval $setvar
18094 fi
18095
18096 : see if this is a sys/times.h system
18097 set sys/times.h i_systimes
18098 eval $inhdr
18099
18100 : see if times exists
18101 echo " "
18102 if set times val -f d_times; eval $csym; $val; then
18103         echo 'times() found.' >&4
18104         d_times="$define"
18105         inc=''
18106         case "$i_systimes" in
18107         "$define") inc='sys/times.h';;
18108         esac
18109         rp="What is the type returned by times() on this system?"
18110         set clock_t clocktype long stdio.h sys/types.h $inc
18111         eval $typedef_ask
18112 else
18113         echo 'times() NOT found, hope that will do.' >&4
18114         d_times="$undef"
18115         clocktype='int'
18116 fi
18117
18118 : see if tmpnam_r exists
18119 set tmpnam_r d_tmpnam_r
18120 eval $inlibc
18121 case "$d_tmpnam_r" in
18122 "$define")
18123         hdrs="$i_systypes sys/types.h define stdio.h "
18124         case "$d_tmpnam_r_proto:$usethreads" in
18125         ":define")      d_tmpnam_r_proto=define
18126                 set d_tmpnam_r_proto tmpnam_r $hdrs
18127                 eval $hasproto ;;
18128         *)      ;;
18129         esac
18130         case "$d_tmpnam_r_proto" in
18131         define)
18132         case "$tmpnam_r_proto" in
18133         ''|0) try='char* tmpnam_r(char*);'
18134         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
18135         esac
18136         case "$tmpnam_r_proto" in
18137         ''|0)   d_tmpnam_r=undef
18138                 tmpnam_r_proto=0
18139                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18140         * )     case "$tmpnam_r_proto" in
18141                 REENTRANT_PROTO*) ;;
18142                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18143                 esac
18144                 echo "Prototype: $try" ;;
18145         esac
18146         ;;
18147         *)      case "$usethreads" in
18148                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18149                 esac
18150                 d_tmpnam_r=undef
18151                 tmpnam_r_proto=0
18152                 ;;
18153         esac
18154         ;;
18155 *)      tmpnam_r_proto=0
18156         ;;
18157 esac
18158
18159 : see if truncate exists
18160 set truncate d_truncate
18161 eval $inlibc
18162
18163 : see if ttyname_r exists
18164 set ttyname_r d_ttyname_r
18165 eval $inlibc
18166 case "$d_ttyname_r" in
18167 "$define")
18168         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18169         case "$d_ttyname_r_proto:$usethreads" in
18170         ":define")      d_ttyname_r_proto=define
18171                 set d_ttyname_r_proto ttyname_r $hdrs
18172                 eval $hasproto ;;
18173         *)      ;;
18174         esac
18175         case "$d_ttyname_r_proto" in
18176         define)
18177         case "$ttyname_r_proto" in
18178         ''|0) try='int ttyname_r(int, char*, size_t);'
18179         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
18180         esac
18181         case "$ttyname_r_proto" in
18182         ''|0) try='int ttyname_r(int, char*, int);'
18183         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
18184         esac
18185         case "$ttyname_r_proto" in
18186         ''|0) try='char* ttyname_r(int, char*, int);'
18187         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
18188         esac
18189         case "$ttyname_r_proto" in
18190         ''|0)   d_ttyname_r=undef
18191                 ttyname_r_proto=0
18192                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18193         * )     case "$ttyname_r_proto" in
18194                 REENTRANT_PROTO*) ;;
18195                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18196                 esac
18197                 echo "Prototype: $try" ;;
18198         esac
18199         ;;
18200         *)      case "$usethreads" in
18201                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18202                 esac
18203                 d_ttyname_r=undef
18204                 ttyname_r_proto=0
18205                 ;;
18206         esac
18207         ;;
18208 *)      ttyname_r_proto=0
18209         ;;
18210 esac
18211
18212 : see if tzname[] exists
18213 echo " "
18214 if set tzname val -a d_tzname; eval $csym; $val; then
18215         val="$define"
18216         echo 'tzname[] found.' >&4
18217 else
18218         val="$undef"
18219         echo 'tzname[] NOT found.' >&4
18220 fi
18221 set d_tzname
18222 eval $setvar
18223
18224 : Check if is a multiplatform env
18225 case "$osname" in
18226 next|rhapsody|darwin) multiarch="$define" ;;
18227 esac
18228 case "$multiarch" in
18229 ''|[nN]*) multiarch="$undef" ;;
18230 esac
18231
18232 : check for ordering of bytes in a UV
18233 echo " "
18234 case "$usecrosscompile$multiarch" in
18235 *$define*)
18236         $cat <<EOM
18237 You seem to be either cross-compiling or doing a multiarchitecture build,
18238 skipping the byteorder check.
18239
18240 EOM
18241         byteorder='ffff'
18242         ;;
18243 *)
18244         case "$byteorder" in
18245         '')
18246                 $cat <<'EOM'
18247 In the following, larger digits indicate more significance.  A big-endian
18248 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18249 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18250 machines may have weird orders like 3412.  A Cray will report 87654321,
18251 an Alpha will report 12345678. If the test program works the default is
18252 probably right.
18253 I'm now running the test program...
18254 EOM
18255                 $cat >try.c <<EOCP
18256 #include <stdio.h>
18257 #$i_stdlib I_STDLIB
18258 #ifdef I_STDLIB
18259 #include <stdlib.h>
18260 #endif
18261 #include <sys/types.h>
18262 typedef $uvtype UV;
18263 int main()
18264 {
18265         int i;
18266         union {
18267                 UV l;
18268                 char c[$uvsize];
18269         } u;
18270
18271         if ($uvsize > 4)
18272                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18273         else
18274                 u.l = (UV)0x04030201;
18275         for (i = 0; i < $uvsize; i++)
18276                 printf("%c", u.c[i]+'0');
18277         printf("\n");
18278         exit(0);
18279 }
18280 EOCP
18281                 xxx_prompt=y
18282                 set try
18283                 if eval $compile && $run ./try > /dev/null; then
18284                         dflt=`$run ./try`
18285                         case "$dflt" in
18286                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18287                                 echo "(The test program ran ok.)"
18288                                 echo "byteorder=$dflt"
18289                                 xxx_prompt=n
18290                         ;;
18291                         ????|????????) echo "(The test program ran ok.)" ;;
18292                         *) echo "(The test program didn't run right for some reason.)" ;;
18293                         esac
18294                 else
18295                         dflt='4321'
18296                         cat <<'EOM'
18297 (I can't seem to compile the test program.  Guessing big-endian...)
18298 EOM
18299                 fi
18300                 case "$xxx_prompt" in
18301                 y)
18302                         rp="What is the order of bytes in $uvtype?"
18303                         . ./myread
18304                         byteorder="$ans"
18305                         ;;
18306                 *)      byteorder=$dflt
18307                         ;;
18308                 esac
18309                 ;;
18310         esac
18311         $rm_try
18312         ;;
18313 esac
18314
18315 : Checking 32bit aligndness
18316 $cat <<EOM
18317
18318 Checking to see whether you can access character data unalignedly...
18319 EOM
18320 case "$d_u32align" in
18321 '')   $cat >try.c <<EOCP
18322 #include <stdio.h>
18323 #$i_stdlib I_STDLIB
18324 #ifdef I_STDLIB
18325 #include <stdlib.h>
18326 #endif
18327 #define U32 $u32type
18328 #define BYTEORDER 0x$byteorder
18329 #define U8 $u8type
18330 #include <signal.h>
18331 #ifdef SIGBUS
18332 $signal_t bletch(int s) { exit(4); }
18333 #endif
18334 int main() {
18335 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18336     U8 buf[8];
18337     U32 *up;
18338     int i;
18339
18340     if (sizeof(U32) != 4) {
18341         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18342         exit(1);
18343     }
18344
18345     fflush(stdout);
18346
18347 #ifdef SIGBUS
18348     signal(SIGBUS, bletch);
18349 #endif
18350
18351     buf[0] = 0;
18352     buf[1] = 0;
18353     buf[2] = 0;
18354     buf[3] = 1;
18355     buf[4] = 0;
18356     buf[5] = 0;
18357     buf[6] = 0;
18358     buf[7] = 1;
18359
18360     for (i = 0; i < 4; i++) {
18361         up = (U32*)(buf + i);
18362         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18363                (*up == 1 << (8*(3-i)))  /* little-endian */
18364               )
18365            )
18366         {
18367             printf("read failed (%x)\n", *up);
18368             exit(2);
18369         }
18370     }
18371
18372     /* write test */
18373     for (i = 0; i < 4; i++) {
18374         up = (U32*)(buf + i);
18375         *up = 0xBeef;
18376         if (*up != 0xBeef) {
18377             printf("write failed (%x)\n", *up);
18378             exit(3);
18379         }
18380     }
18381
18382     exit(0);
18383 #else
18384     printf("1\n");
18385     exit(1);
18386 #endif
18387     return 0;
18388 }
18389 EOCP
18390 set try
18391 if eval $compile_ok; then
18392         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18393         $run ./try 2>&1 >/dev/null
18394         case "$?" in
18395         0)      cat >&4 <<EOM
18396 You can access character data pretty unalignedly.
18397 EOM
18398                 d_u32align="$undef"
18399                 ;;
18400         *)      cat >&4 <<EOM
18401 It seems that you must access character data in an aligned manner.
18402 EOM
18403                 d_u32align="$define"
18404                 ;;
18405         esac
18406 else
18407         rp='Can you access character data at unaligned addresses?'
18408         dflt='n'
18409         . ./myread
18410         case "$ans" in
18411         [yY]*)  d_u32align="$undef"  ;;
18412         *)      d_u32align="$define" ;;
18413         esac
18414 fi
18415 $rm_try
18416 ;;
18417 esac
18418
18419 : see if ualarm exists
18420 set ualarm d_ualarm
18421 eval $inlibc
18422
18423 : see if umask exists
18424 set umask d_umask
18425 eval $inlibc
18426
18427 : see if unordered exists
18428 set unordered d_unordered
18429 eval $inlibc
18430
18431 : see if unsetenv exists
18432 set unsetenv d_unsetenv
18433 eval $inlibc
18434
18435 : see if usleep exists
18436 set usleep d_usleep
18437 eval $inlibc
18438
18439 : see if prototype for usleep is available
18440 echo " "
18441 set d_usleepproto usleep $i_unistd unistd.h
18442 eval $hasproto
18443
18444 : see if ustat exists
18445 set ustat d_ustat
18446 eval $inlibc
18447
18448 : see if closedir exists
18449 set closedir d_closedir
18450 eval $inlibc
18451
18452 case "$d_closedir" in
18453 "$define")
18454         echo " "
18455         echo "Checking whether closedir() returns a status..." >&4
18456         cat > try.c <<EOM
18457 #$i_dirent I_DIRENT             /**/
18458 #$i_sysdir I_SYS_DIR            /**/
18459 #$i_sysndir I_SYS_NDIR          /**/
18460 #$i_systypes I_SYS_TYPES        /**/
18461
18462 #if defined(I_SYS_TYPES)
18463 #include <sys/types.h>
18464 #endif
18465 #if defined(I_DIRENT)
18466 #include <dirent.h>
18467 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18468 #include <sys/dir.h>
18469 #endif
18470 #else
18471 #ifdef I_SYS_NDIR
18472 #include <sys/ndir.h>
18473 #else
18474 #ifdef I_SYS_DIR
18475 #ifdef hp9000s500
18476 #include <ndir.h>       /* may be wrong in the future */
18477 #else
18478 #include <sys/dir.h>
18479 #endif
18480 #endif
18481 #endif
18482 #endif
18483 int main() { return closedir(opendir(".")); }
18484 EOM
18485         set try
18486         if eval $compile_ok; then
18487                 if $run ./try > /dev/null 2>&1 ; then
18488                         echo "Yes, it does."
18489                         val="$undef"
18490                 else
18491                         echo "No, it doesn't."
18492                         val="$define"
18493                 fi
18494         else
18495                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18496                 val="$define"
18497         fi
18498         ;;
18499 *)
18500         val="$undef";
18501         ;;
18502 esac
18503 set d_void_closedir
18504 eval $setvar
18505 $rm_try
18506
18507 : see if there is a wait4
18508 set wait4 d_wait4
18509 eval $inlibc
18510
18511 : see if waitpid exists
18512 set waitpid d_waitpid
18513 eval $inlibc
18514
18515 : see if wcstombs exists
18516 set wcstombs d_wcstombs
18517 eval $inlibc
18518
18519 : see if wctomb exists
18520 set wctomb d_wctomb
18521 eval $inlibc
18522
18523 : see if writev exists
18524 set writev d_writev
18525 eval $inlibc
18526
18527 : preserve RCS keywords in files with variable substitution, grrr
18528 Date='$Date'
18529 Id='$Id'
18530 Log='$Log'
18531 RCSfile='$RCSfile'
18532 Revision='$Revision'
18533
18534 : check for alignment requirements
18535 echo " "
18536 case "$usecrosscompile$multiarch" in
18537 *$define*)
18538         $cat <<EOM
18539 You seem to be either cross-compiling or doing a multiarchitecture build,
18540 skipping the memory alignment check.
18541
18542 EOM
18543         case "$alignbytes" in
18544         '') alignbytes=8 ;;
18545         esac
18546         ;;
18547 *)
18548         case "$alignbytes" in
18549         '') echo "Checking alignment constraints..." >&4
18550                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18551                         $cat >try.c <<'EOCP'
18552 typedef long double NV;
18553 EOCP
18554                 else
18555                         $cat >try.c <<'EOCP'
18556 typedef double NV;
18557 EOCP
18558                 fi
18559                 $cat >>try.c <<'EOCP'
18560 #include <stdio.h>
18561 struct foobar {
18562         char foo;
18563         NV bar;
18564 } try_algn;
18565 int main()
18566 {
18567     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18568     return(0);
18569 }
18570 EOCP
18571                 set try
18572                 if eval $compile_ok; then
18573                         dflt=`$run ./try`
18574                 else
18575                         dflt='8'
18576                         echo "(I can't seem to compile the test program...)"
18577                 fi
18578                 ;;
18579         *) dflt="$alignbytes"
18580                 ;;
18581         esac
18582         rp="Doubles must be aligned on a how-many-byte boundary?"
18583         . ./myread
18584         alignbytes="$ans"
18585         $rm_try
18586         ;;
18587 esac
18588
18589
18590 : set the base revision
18591 baserev=5.0
18592
18593 : how do we concatenate cpp tokens here?
18594 echo " "
18595 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18596 $cat >cpp_stuff.c <<'EOCP'
18597 #define RCAT(a,b)a/**/b
18598 #define ACAT(a,b)a ## b
18599 RCAT(Rei,ser)
18600 ACAT(Cir,cus)
18601 EOCP
18602 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18603 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18604         echo "Oh!  Smells like ANSI's been here." >&4
18605         echo "We can catify or stringify, separately or together!"
18606         cpp_stuff=42
18607 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18608         echo "Ah, yes!  The good old days!" >&4
18609         echo "However, in the good old days we don't know how to stringify and"
18610         echo "catify at the same time."
18611         cpp_stuff=1
18612 else
18613         $cat >&4 <<EOM
18614 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18615 You're going to have to edit the values of CAT[2-5] in config.h...
18616 EOM
18617         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18618 fi
18619 $rm -f cpp_stuff.*
18620
18621 : see if this is a db.h system
18622 set db.h i_db
18623 eval $inhdr
18624
18625 case "$i_db" in
18626 $define)
18627         : Check db version.
18628         echo " "
18629         echo "Checking Berkeley DB version ..." >&4
18630         $cat >try.c <<EOCP
18631 #$d_const HASCONST
18632 #ifndef HASCONST
18633 #define const
18634 #endif
18635 #include <sys/types.h>
18636 #include <stdio.h>
18637 #$i_stdlib I_STDLIB
18638 #ifdef I_STDLIB
18639 #include <stdlib.h>
18640 #endif
18641 #include <db.h>
18642 int main(int argc, char *argv[])
18643 {
18644 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18645     int Major, Minor, Patch ;
18646     unsigned long Version ;
18647     (void)db_version(&Major, &Minor, &Patch) ;
18648     if (argc == 2) {
18649         printf("%d %d %d %d %d %d\n",
18650                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18651                Major, Minor, Patch);
18652         exit(0);
18653     }
18654     printf("You have Berkeley DB Version 2 or greater.\n");
18655
18656     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18657                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18658     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18659                 Major, Minor, Patch) ;
18660
18661     /* check that db.h & libdb are compatible */
18662     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18663         printf("db.h and libdb are incompatible.\n") ;
18664         exit(3);
18665     }
18666
18667     printf("db.h and libdb are compatible.\n") ;
18668
18669     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18670                 + DB_VERSION_PATCH ;
18671
18672     /* needs to be >= 2.3.4 */
18673     if (Version < 2003004) {
18674     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18675         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18676         exit(2);
18677     }
18678
18679     exit(0);
18680 #else
18681 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18682     if (argc == 2) {
18683         printf("1 0 0\n");
18684         exit(0);
18685     }
18686     printf("You have Berkeley DB Version 1.\n");
18687     exit(0);    /* DB version < 2: the coast is clear. */
18688 #else
18689     exit(1);    /* <db.h> not Berkeley DB? */
18690 #endif
18691 #endif
18692 }
18693 EOCP
18694         set try
18695         if eval $compile_ok && $run ./try; then
18696                 echo 'Looks OK.' >&4
18697                 set `$run ./try 1`
18698                 db_version_major=$1
18699                 db_version_minor=$2
18700                 db_version_patch=$3
18701         else
18702                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18703                 i_db=$undef
18704                 case " $libs " in
18705                 *"-ldb "*)
18706                         : Remove db from list of libraries to use
18707                         echo "Removing unusable -ldb from library list" >&4
18708                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18709                         shift
18710                         libs="$*"
18711                         echo "libs = $libs" >&4
18712                         ;;
18713                 esac
18714         fi
18715         $rm_try
18716         ;;
18717 esac
18718
18719 case "$i_db" in
18720 define)
18721         : Check the return type needed for hash
18722         echo " "
18723         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18724         $cat >try.c <<EOCP
18725 #$d_const HASCONST
18726 #ifndef HASCONST
18727 #define const
18728 #endif
18729 #include <sys/types.h>
18730 #include <db.h>
18731
18732 #ifndef DB_VERSION_MAJOR
18733 u_int32_t hash_cb (ptr, size)
18734 const void *ptr;
18735 size_t size;
18736 {
18737 }
18738 HASHINFO info;
18739 int main()
18740 {
18741         info.hash = hash_cb;
18742 }
18743 #endif
18744 EOCP
18745         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18746                 if $contains warning try.out >>/dev/null 2>&1 ; then
18747                         db_hashtype='int'
18748                 else
18749                         db_hashtype='u_int32_t'
18750                 fi
18751         else
18752                 : XXX Maybe we should just give up here.
18753                 db_hashtype=u_int32_t
18754                 $cat try.out >&4
18755                 echo "Help:  I can't seem to compile the db test program." >&4
18756                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18757         fi
18758         $rm_try
18759         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18760         ;;
18761 *)      db_hashtype=u_int32_t
18762         ;;
18763 esac
18764 case "$i_db" in
18765 define)
18766         : Check the return type needed for prefix
18767         echo " "
18768         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18769         cat >try.c <<EOCP
18770 #$d_const HASCONST
18771 #ifndef HASCONST
18772 #define const
18773 #endif
18774 #include <sys/types.h>
18775 #include <db.h>
18776
18777 #ifndef DB_VERSION_MAJOR
18778 size_t prefix_cb (key1, key2)
18779 const DBT *key1;
18780 const DBT *key2;
18781 {
18782 }
18783 BTREEINFO info;
18784 int main()
18785 {
18786         info.prefix = prefix_cb;
18787 }
18788 #endif
18789 EOCP
18790         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18791                 if $contains warning try.out >>/dev/null 2>&1 ; then
18792                         db_prefixtype='int'
18793                 else
18794                         db_prefixtype='size_t'
18795                 fi
18796         else
18797                 db_prefixtype='size_t'
18798                 : XXX Maybe we should just give up here.
18799                 $cat try.out >&4
18800                 echo "Help:  I can't seem to compile the db test program." >&4
18801                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18802         fi
18803         $rm_try
18804         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18805         ;;
18806 *)      db_prefixtype='size_t'
18807         ;;
18808 esac
18809
18810 : How can we generate normalized random numbers ?
18811 echo " "
18812 echo "Looking for a random number function..." >&4
18813 case "$randfunc" in
18814 '')
18815         if set drand48 val -f; eval $csym; $val; then
18816                 dflt="drand48"
18817                 echo "Good, found drand48()." >&4
18818         elif set random val -f; eval $csym; $val; then
18819                 dflt="random"
18820                 echo "OK, found random()." >&4
18821         else
18822                 dflt="rand"
18823                 echo "Yick, looks like I have to use rand()." >&4
18824         fi
18825         echo " "
18826         ;;
18827 *)
18828         dflt="$randfunc"
18829         ;;
18830 esac
18831 cont=true
18832
18833 case "$ccflags" in
18834 *-Dmy_rand=*|*-Dmy_srand=*)
18835         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18836         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18837         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18838         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18839         ;;
18840 esac
18841
18842 while $test "$cont"; do
18843         rp="Use which function to generate random numbers?"
18844         . ./myread
18845         if $test "$ans" = "$dflt"; then
18846                 : null
18847         else
18848                 randbits=''
18849         fi
18850         randfunc="$ans"
18851         if set $ans val -f; eval $csym; $val; then
18852                 cont=''
18853         else
18854                 dflt=y
18855                 rp="I cannot find function $ans. Use that name anyway?"
18856                 . ./myread
18857                 dflt=rand
18858                 case "$ans" in
18859                         [yY]*) cont='';;
18860                 esac
18861         fi
18862         case "$cont" in
18863         '')
18864                 case "$randfunc" in
18865                 drand48)
18866                         drand01="drand48()"
18867                         seedfunc="srand48"
18868                         randbits=48
18869                         randseedtype=long
18870                         ;;
18871                 rand|random)
18872                         case "$randbits" in
18873                         '')
18874 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18875                                 $cat >try.c <<EOCP
18876 #$i_unistd I_UNISTD
18877 #$i_stdlib I_STDLIB
18878 #include <stdio.h>
18879 #ifdef I_UNISTD
18880 #  include <unistd.h>
18881 #endif
18882 #ifdef I_STDLIB
18883 #  include <stdlib.h>
18884 #endif
18885 int main()
18886 {
18887         register int i;
18888         register unsigned long tmp;
18889         register unsigned long max = 0L;
18890
18891         for (i = 1000; i; i--) {
18892                 tmp = (unsigned long) $randfunc();
18893                 if (tmp > max) max = tmp;
18894         }
18895         for (i = 0; max; i++)
18896                 max /= 2;
18897         printf("%d\n",i);
18898 }
18899 EOCP
18900                                 set try
18901                                 if eval $compile_ok; then
18902                                         dflt=`try`
18903                                 else
18904                                         dflt='?'
18905                                         echo "(I can't seem to compile the test program...)"
18906                                 fi
18907                                 ;;
18908                         *)
18909                                 dflt="$randbits"
18910                                 ;;
18911                         esac
18912                         rp="How many bits does your $randfunc() function produce?"
18913                         . ./myread
18914                         randbits="$ans"
18915                         $rm_try
18916                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18917                         seedfunc="s$randfunc"
18918                         randseedtype=unsigned
18919                         ;;
18920                 *)
18921                         dflt="31"
18922                         rp="How many bits does your $randfunc() function produce?"
18923                         . ./myread
18924                         randbits="$ans"
18925                         seedfunc="s$randfunc"
18926                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18927                         if set $seedfunc val -f; eval $csym; $val; then
18928                                 echo "(Using $seedfunc() to seed random generator)"
18929                         else
18930                                 echo "(Warning: no $seedfunc() to seed random generator)"
18931                                 seedfunc=rand
18932                         fi
18933                         randseedtype=unsigned
18934                         ;;
18935                 esac
18936                 ;;
18937         esac
18938 done
18939
18940 : Determine if this is an EBCDIC system
18941 echo " "
18942 echo "Determining whether or not we are on an EBCDIC system..." >&4
18943 $cat >try.c <<'EOM'
18944 int main()
18945 {
18946   if ('M'==0xd4) return 0;
18947   return 1;
18948 }
18949 EOM
18950
18951 val=$undef
18952 set try
18953 if eval $compile_ok; then
18954         if $run ./try; then
18955                 echo "You seem to speak EBCDIC." >&4
18956                 val="$define"
18957         else
18958                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18959         fi
18960 else
18961         echo "I'm unable to compile the test program." >&4
18962         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18963 fi
18964 $rm_try
18965 set ebcdic
18966 eval $setvar
18967
18968 : Check how to flush
18969 echo " "
18970 $cat >&4 <<EOM
18971 Checking how to flush all pending stdio output...
18972 EOM
18973 # I only know how to find the first 32 possibly open files on SunOS.
18974 # See also hints/sunos_4_1.sh and util.c  --AD
18975 case "$osname" in
18976 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18977 esac
18978 $cat >>try.c <<EOCP
18979 #include <stdio.h>
18980 #$i_stdlib I_STDLIB
18981 #ifdef I_STDLIB
18982 #include <stdlib.h>
18983 #endif
18984 #$i_unistd I_UNISTD
18985 #ifdef I_UNISTD
18986 # include <unistd.h>
18987 #endif
18988 #$d_sysconf HAS_SYSCONF
18989 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18990 #ifdef HAS_STDIO_STREAM_ARRAY
18991 # define STDIO_STREAM_ARRAY $stdio_stream_array
18992 #endif
18993 int main() {
18994   FILE* p;
18995   unlink("try.out");
18996   p = fopen("try.out", "w");
18997 #ifdef TRY_FPUTC
18998   fputc('x', p);
18999 #else
19000 # ifdef TRY_FPRINTF
19001   fprintf(p, "x");
19002 # endif
19003 #endif
19004 #ifdef TRY_FFLUSH_NULL
19005   fflush(NULL);
19006 #endif
19007 #ifdef TRY_FFLUSH_ALL
19008   {
19009     long open_max = -1;
19010 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19011     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19012 # else
19013 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19014     open_max = sysconf(_SC_OPEN_MAX);
19015 #  else
19016 #   ifdef FOPEN_MAX
19017     open_max = FOPEN_MAX;
19018 #   else
19019 #    ifdef OPEN_MAX
19020     open_max = OPEN_MAX;
19021 #    else
19022 #     ifdef _NFILE
19023     open_max = _NFILE;
19024 #     endif
19025 #    endif
19026 #   endif
19027 #  endif
19028 # endif
19029 # ifdef HAS_STDIO_STREAM_ARRAY
19030     if (open_max > 0) {
19031       long i;
19032       for (i = 0; i < open_max; i++)
19033             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19034                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19035                 STDIO_STREAM_ARRAY[i]._flag)
19036                 fflush(&STDIO_STREAM_ARRAY[i]);
19037     }
19038   }
19039 # endif
19040 #endif
19041   _exit(42);
19042 }
19043 EOCP
19044 : first we have to find out how _not_ to flush
19045 $to try.c
19046 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19047     output=''
19048     set try -DTRY_FPUTC
19049     if eval $compile; then
19050             $run ./try 2>/dev/null
19051             code="$?"
19052             $from try.out
19053             if $test ! -s try.out -a "X$code" = X42; then
19054                 output=-DTRY_FPUTC
19055             fi
19056     fi
19057     case "$output" in
19058     '')
19059             set try -DTRY_FPRINTF
19060             if eval $compile; then
19061                     $run ./try 2>/dev/null
19062                     code="$?"
19063                     $from try.out
19064                     if $test ! -s try.out -a "X$code" = X42; then
19065                         output=-DTRY_FPRINTF
19066                     fi
19067             fi
19068         ;;
19069     esac
19070 fi
19071 : check for fflush NULL behaviour
19072 case "$fflushNULL" in
19073 '')     set try -DTRY_FFLUSH_NULL $output
19074         if eval $compile; then
19075                 $run ./try 2>/dev/null
19076                 code="$?"
19077                 $from try.out
19078                 if $test -s try.out -a "X$code" = X42; then
19079                         fflushNULL="`$cat try.out`"
19080                 else
19081                         if $test "X$code" != X42; then
19082                                 $cat >&4 <<EOM
19083 (If this test failed, don't worry, we'll try another method shortly.)
19084 EOM
19085                         fi
19086                 fi
19087         fi
19088         $rm_try
19089         case "$fflushNULL" in
19090         x)      $cat >&4 <<EOM
19091 Your fflush(NULL) works okay for output streams.
19092 Let's see if it clobbers input pipes...
19093 EOM
19094 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19095 # bug that improperly flushes the input end of pipes.  So we avoid the
19096 # autoflush on fork/system/exec support for now. :-(
19097 $cat >tryp.c <<EOCP
19098 #include <stdio.h>
19099 int
19100 main(int argc, char **argv)
19101 {
19102     char buf[1024];
19103     int i;
19104     char *bp = buf;
19105     while (1) {
19106         while ((i = getc(stdin)) != -1
19107                && (*bp++ = i) != '\n'
19108                && bp < &buf[1024])
19109         /* DO NOTHING */ ;
19110         *bp = '\0';
19111         fprintf(stdout, "%s", buf);
19112         fflush(NULL);
19113         if (i == -1)
19114             return 0;
19115         bp = buf;
19116     }
19117 }
19118 EOCP
19119                 fflushNULL="$define"
19120                 set tryp
19121                 if eval $compile; then
19122                     $rm -f tryp.out
19123                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19124                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19125                        $cat >&4 <<EOM
19126 fflush(NULL) seems to behave okay with input streams.
19127 EOM
19128                         fflushNULL="$define"
19129                     else
19130                         $cat >&4 <<EOM
19131 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19132 EOM
19133                         fflushNULL="$undef"
19134                     fi
19135                 fi
19136                 $rm -f core tryp.c tryp.core core.tryp.*
19137                 ;;
19138         '')     $cat >&4 <<EOM
19139 Your fflush(NULL) isn't working (contrary to ANSI C).
19140 EOM
19141                 fflushNULL="$undef"
19142                 ;;
19143         *)      $cat >&4 <<EOM
19144 Cannot figure out whether your fflush(NULL) works or not.
19145 I'm assuming it doesn't (contrary to ANSI C).
19146 EOM
19147                 fflushNULL="$undef"
19148                 ;;
19149         esac
19150         ;;
19151 $define|true|[yY]*)
19152         fflushNULL="$define"
19153         ;;
19154 *)
19155         fflushNULL="$undef"
19156         ;;
19157 esac
19158 : check explicit looping only if NULL did not work, and if the pipe
19159 : bug does not show up on an explicit flush too
19160 case "$fflushNULL" in
19161 "$undef")
19162         $cat >tryp.c <<EOCP
19163 #include <stdio.h>
19164 int
19165 main(int argc, char **argv)
19166 {
19167     char buf[1024];
19168     int i;
19169     char *bp = buf;
19170     while (1) {
19171         while ((i = getc(stdin)) != -1
19172                && (*bp++ = i) != '\n'
19173                && bp < &buf[1024])
19174         /* DO NOTHING */ ;
19175         *bp = '\0';
19176         fprintf(stdout, "%s", buf);
19177         fflush(stdin);
19178         if (i == -1)
19179             return 0;
19180         bp = buf;
19181     }
19182 }
19183 EOCP
19184         set tryp
19185         if eval $compile; then
19186             $rm -f tryp.out
19187             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19188             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19189                $cat >&4 <<EOM
19190 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19191 EOM
19192                 : now check for fflushall behaviour
19193                 case "$fflushall" in
19194                 '')     set try -DTRY_FFLUSH_ALL $output
19195                         if eval $compile; then
19196                                 $cat >&4 <<EOM
19197 (Now testing the other method--but note that this also may fail.)
19198 EOM
19199                                 $run ./try 2>/dev/null
19200                                 code=$?
19201                                 $from try.out
19202                                 if $test -s try.out -a "X$code" = X42; then
19203                                         fflushall="`$cat try.out`"
19204                                 fi
19205                         fi
19206                         $rm_try
19207                         case "$fflushall" in
19208                         x)      $cat >&4 <<EOM
19209 Whew. Flushing explicitly all the stdio streams works.
19210 EOM
19211                                 fflushall="$define"
19212                                 ;;
19213                         '')     $cat >&4 <<EOM
19214 Sigh. Flushing explicitly all the stdio streams doesn't work.
19215 EOM
19216                                 fflushall="$undef"
19217                                 ;;
19218                         *)      $cat >&4 <<EOM
19219 Cannot figure out whether flushing stdio streams explicitly works or not.
19220 I'm assuming it doesn't.
19221 EOM
19222                                 fflushall="$undef"
19223                                 ;;
19224                         esac
19225                         ;;
19226                 "$define"|true|[yY]*)
19227                         fflushall="$define"
19228                         ;;
19229                 *)
19230                         fflushall="$undef"
19231                         ;;
19232                 esac
19233             else
19234                 $cat >&4 <<EOM
19235 All is futile.  Even fflush(stdin) clobbers input pipes!
19236 EOM
19237                 fflushall="$undef"
19238             fi
19239         else
19240             fflushall="$undef"
19241         fi
19242         $rm -f core tryp.c tryp.core core.tryp.*
19243         ;;
19244 *)      fflushall="$undef"
19245         ;;
19246 esac
19247
19248 case "$fflushNULL$fflushall" in
19249 undefundef)
19250         $cat <<EOM
19251 OK, I give up.  I cannot figure out how to flush pending stdio output.
19252 We won't be flushing handles at all before fork/exec/popen.
19253 EOM
19254         ;;
19255 esac
19256 $rm_try tryp
19257
19258 : Store the full pathname to the ar program for use in the C program
19259 : Respect a hint or command line value for full_ar.
19260 case "$full_ar" in
19261 '') full_ar=$ar ;;
19262 esac
19263
19264 : Store the full pathname to the sed program for use in the C program
19265 full_sed=$sed
19266
19267 : see what type gids are declared as in the kernel
19268 echo " "
19269 echo "Looking for the type for group ids returned by getgid()."
19270 set gid_t gidtype xxx stdio.h sys/types.h
19271 eval $typedef
19272 case "$gidtype" in
19273 xxx)
19274         xxx=`./findhdr sys/user.h`
19275         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19276         case $1 in
19277         unsigned) dflt="$1 $2" ;;
19278         *) dflt="$1" ;;
19279         esac
19280         ;;
19281 *) dflt="$gidtype";;
19282 esac
19283 case "$gidtype" in
19284 gid_t) echo "gid_t found." ;;
19285 *)      rp="What is the type for group ids returned by getgid()?"
19286         . ./myread
19287         gidtype="$ans"
19288         ;;
19289 esac
19290
19291 : Check the size of GID
19292 echo " "
19293 case "$gidtype" in
19294 *_t) zzz="$gidtype"     ;;
19295 *)   zzz="gid"          ;;
19296 esac
19297 echo "Checking the size of $zzz..." >&4
19298 cat > try.c <<EOCP
19299 #include <sys/types.h>
19300 #include <stdio.h>
19301 #$i_stdlib I_STDLIB
19302 #ifdef I_STDLIB
19303 #include <stdlib.h>
19304 #endif
19305 int main() {
19306     printf("%d\n", (int)sizeof($gidtype));
19307     exit(0);
19308 }
19309 EOCP
19310 set try
19311 if eval $compile_ok; then
19312         yyy=`$run ./try`
19313         case "$yyy" in
19314         '')     gidsize=4
19315                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19316                 ;;
19317         *)      gidsize=$yyy
19318                 echo "Your $zzz is $gidsize bytes long."
19319                 ;;
19320         esac
19321 else
19322         gidsize=4
19323         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19324 fi
19325
19326
19327 : Check if GID is signed
19328 echo " "
19329 case "$gidtype" in
19330 *_t) zzz="$gidtype"     ;;
19331 *)   zzz="gid"          ;;
19332 esac
19333 echo "Checking the sign of $zzz..." >&4
19334 cat > try.c <<EOCP
19335 #include <sys/types.h>
19336 #include <stdio.h>
19337 int main() {
19338         $gidtype foo = -1;
19339         if (foo < 0)
19340                 printf("-1\n");
19341         else
19342                 printf("1\n");
19343 }
19344 EOCP
19345 set try
19346 if eval $compile; then
19347         yyy=`$run ./try`
19348         case "$yyy" in
19349         '')     gidsign=1
19350                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19351                 ;;
19352         *)      gidsign=$yyy
19353                 case "$gidsign" in
19354                  1) echo "Your $zzz is unsigned." ;;
19355                 -1) echo "Your $zzz is signed."   ;;
19356                 esac
19357                 ;;
19358         esac
19359 else
19360         gidsign=1
19361         echo "(I can't compile the test program--guessing unsigned.)" >&4
19362 fi
19363
19364
19365 : Check 64bit sizes
19366 echo " "
19367
19368 if $test X"$quadtype" != X; then
19369
19370 echo "Checking how to print 64-bit integers..." >&4
19371
19372 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19373         $cat >try.c <<'EOCP'
19374 #include <sys/types.h>
19375 #include <stdio.h>
19376 int main() {
19377   int q = 12345678901;
19378   printf("%ld\n", q);
19379 }
19380 EOCP
19381         set try
19382         if eval $compile; then
19383                 yyy=`$run ./try`
19384                 case "$yyy" in
19385                 12345678901)
19386                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19387                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19388                         echo "We will use %d."
19389                         ;;
19390                 esac
19391         fi
19392 fi
19393
19394 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19395         $cat >try.c <<'EOCP'
19396 #include <sys/types.h>
19397 #include <stdio.h>
19398 int main() {
19399   long q = 12345678901;
19400   printf("%ld\n", q);
19401 }
19402 EOCP
19403         set try
19404         if eval $compile; then
19405                 yyy=`$run ./try`
19406                 case "$yyy" in
19407                 12345678901)
19408                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19409                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19410                         echo "We will use %ld."
19411                         ;;
19412                 esac
19413         fi
19414 fi
19415
19416 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19417         $cat >try.c <<'EOCP'
19418 #include <sys/types.h>
19419 #include <inttypes.h>
19420 #include <stdio.h>
19421 int main() {
19422   int64_t q = 12345678901;
19423   printf("%" PRId64 "\n", q);
19424 }
19425 EOCP
19426         set try
19427         if eval $compile; then
19428                 yyy=`$run ./try`
19429                 case "$yyy" in
19430                 12345678901)
19431                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19432                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19433                         echo "We will use the C9X style."
19434                         ;;
19435                 esac
19436         fi
19437 fi
19438
19439 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19440         $cat >try.c <<EOCP
19441 #include <sys/types.h>
19442 #include <stdio.h>
19443 int main() {
19444   $quadtype q = 12345678901;
19445   printf("%Ld\n", q);
19446 }
19447 EOCP
19448         set try
19449         if eval $compile; then
19450                 yyy=`$run ./try`
19451                 case "$yyy" in
19452                 12345678901)
19453                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19454                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19455                         echo "We will use %Ld."
19456                         ;;
19457                 esac
19458         fi
19459 fi
19460
19461 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19462         $cat >try.c <<'EOCP'
19463 #include <sys/types.h>
19464 #include <stdio.h>
19465 int main() {
19466   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19467   printf("%lld\n", q);
19468 }
19469 EOCP
19470         set try
19471         if eval $compile; then
19472                 yyy=`$run ./try`
19473                 case "$yyy" in
19474                 12345678901)
19475                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19476                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19477                         echo "We will use the %lld style."
19478                         ;;
19479                 esac
19480         fi
19481 fi
19482
19483 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19484         $cat >try.c <<EOCP
19485 #include <sys/types.h>
19486 #include <stdio.h>
19487 int main() {
19488   $quadtype q = 12345678901;
19489   printf("%qd\n", q);
19490 }
19491 EOCP
19492         set try
19493         if eval $compile; then
19494                 yyy=`$run ./try`
19495                 case "$yyy" in
19496                 12345678901)
19497                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19498                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19499                         echo "We will use %qd."
19500                         ;;
19501                 esac
19502         fi
19503 fi
19504
19505 if $test X"$sPRId64" = X; then
19506         echo "Cannot figure out how to print 64-bit integers." >&4
19507 fi
19508 $rm_try
19509
19510 fi
19511
19512 case "$sPRId64" in
19513 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19514         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19515         ;;
19516 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19517         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19518         ;;
19519 esac
19520
19521 : Check format strings for internal types
19522 echo " "
19523 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19524
19525 if $test X"$ivsize" = X8; then
19526         ivdformat="$sPRId64"
19527         uvuformat="$sPRIu64"
19528         uvoformat="$sPRIo64"
19529         uvxformat="$sPRIx64"
19530         uvXUformat="$sPRIXU64"
19531 else
19532         if $test X"$ivsize" = X"$longsize"; then
19533                 ivdformat='"ld"'
19534                 uvuformat='"lu"'
19535                 uvoformat='"lo"'
19536                 uvxformat='"lx"'
19537                 uvXUformat='"lX"'
19538         else
19539                 if $test X"$ivsize" = X"$intsize"; then
19540                         ivdformat='"d"'
19541                         uvuformat='"u"'
19542                         uvoformat='"o"'
19543                         uvxformat='"x"'
19544                         uvXUformat='"X"'
19545                 else
19546                         : far out
19547                         if $test X"$ivsize" = X"$shortsize"; then
19548                                 ivdformat='"hd"'
19549                                 uvuformat='"hu"'
19550                                 uvoformat='"ho"'
19551                                 uvxformat='"hx"'
19552                                 uvXUformat='"hX"'
19553                         fi
19554                 fi
19555         fi
19556 fi
19557
19558 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19559         nveformat="$sPRIeldbl"
19560         nvfformat="$sPRIfldbl"
19561         nvgformat="$sPRIgldbl"
19562         nvEUformat="$sPRIEUldbl"
19563         nvFUformat="$sPRIFUldbl"
19564         nvGUformat="$sPRIGUldbl"
19565 else
19566         nveformat='"e"'
19567         nvfformat='"f"'
19568         nvgformat='"g"'
19569         nvEUformat='"E"'
19570         nvFUformat='"F"'
19571         nvGUformat='"G"'
19572 fi
19573
19574 case "$ivdformat" in
19575 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19576     exit 1
19577     ;;
19578 esac
19579
19580 : Check format string for GID
19581
19582 echo " "
19583 $echo "Checking the format string to be used for gids..." >&4
19584
19585 case "$gidsign" in
19586 -1)     if $test X"$gidsize" = X"$ivsize"; then
19587                 gidformat="$ivdformat"
19588         else
19589                 if $test X"$gidsize" = X"$longsize"; then
19590                         gidformat='"ld"'
19591                 else
19592                         if $test X"$gidsize" = X"$intsize"; then
19593                                 gidformat='"d"'
19594                         else
19595                                 if $test X"$gidsize" = X"$shortsize"; then
19596                                         gidformat='"hd"'
19597                                 fi
19598                         fi
19599                 fi
19600         fi
19601         ;;
19602 *)      if $test X"$gidsize" = X"$uvsize"; then
19603                 gidformat="$uvuformat"
19604         else
19605                 if $test X"$gidsize" = X"$longsize"; then
19606                         gidformat='"lu"'
19607                 else
19608                         if $test X"$gidsize" = X"$intsize"; then
19609                                 gidformat='"u"'
19610                         else
19611                                 if $test X"$gidsize" = X"$shortsize"; then
19612                                         gidformat='"hu"'
19613                                 fi
19614                         fi
19615                 fi
19616         fi
19617         ;;
19618 esac
19619
19620 : see if getgroups exists
19621 set getgroups d_getgrps
19622 eval $inlibc
19623
19624 : see if setgroups exists
19625 set setgroups d_setgrps
19626 eval $inlibc
19627
19628 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19629 echo " "
19630 case "$d_getgrps$d_setgrps" in
19631 *define*)
19632         case "$groupstype" in
19633         '') dflt="$gidtype" ;;
19634         *)  dflt="$groupstype" ;;
19635         esac
19636         $cat <<EOM
19637 What type of pointer is the second argument to getgroups() and setgroups()?
19638 Usually this is the same as group ids, $gidtype, but not always.
19639
19640 EOM
19641         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19642         . ./myread
19643         groupstype="$ans"
19644         ;;
19645 *)  groupstype="$gidtype";;
19646 esac
19647
19648 : MAD = Misc Attribute Definition
19649
19650 if $test $patchlevel -lt 9; then
19651 : MAD is not available in 5.8.x or earlier.
19652     ans=n;
19653 else
19654     case "$mad" in
19655     $define|true|[yY]*) dflt='y' ;;
19656     *)                  dflt='n' ;;
19657     esac
19658     cat <<EOM
19659
19660 Would you like to build with Misc Attribute Decoration? This is development
19661 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19662 overhead on the interpreter.
19663
19664 If this doesn't make any sense to you, just accept the default '$dflt'.
19665 EOM
19666     rp='Build Perl with MAD?'
19667     . ./myread
19668 fi
19669 case "$ans" in
19670 y|Y)    val="$define"
19671         madlyh='madly.h madly.act madly.tab'
19672         madlysrc='madly.c'
19673         madlyobj="madly$_o" ;;
19674 *)      val="$undef"
19675         madlyh=''
19676         madlysrc=''
19677         madlyobj='' ;;
19678 esac
19679 set mad
19680 eval $setvar
19681
19682 : check whether make sets MAKE
19683 echo " "
19684 echo "Checking if your $make program sets \$(MAKE)..." >&4
19685 case "$make_set_make" in
19686 '')
19687         $sed 's/^X //' > testmake.mak << 'EOF'
19688 Xall:
19689 X       @echo 'maketemp="$(MAKE)"'
19690 EOF
19691         case "`$make -f testmake.mak 2>/dev/null`" in
19692         *maketemp=*) make_set_make='#' ;;
19693         *)      make_set_make="MAKE=$make" ;;
19694         esac
19695         $rm -f testmake.mak
19696         ;;
19697 esac
19698 case "$make_set_make" in
19699 '#') echo "Yup, it does.";;
19700 *) echo "Nope, it doesn't.";;
19701 esac
19702
19703 : see what type is used for mode_t
19704 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19705 set mode_t modetype int stdio.h sys/types.h
19706 eval $typedef_ask
19707
19708 : see if we need va_copy
19709 echo " "
19710 case "$i_stdarg" in
19711 "$define")
19712         $cat >try.c <<EOCP
19713 #include <stdarg.h>
19714 #include <stdio.h>
19715 #$i_stdlib I_STDLIB
19716 #ifdef I_STDLIB
19717 #include <stdlib.h>
19718 #endif
19719 #include <signal.h>
19720
19721 int
19722 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19723 {
19724   return vfprintf(f, fmt, *valp);
19725 }
19726
19727 int
19728 myvfprintf(FILE *f, const  char *fmt, va_list val)
19729 {
19730   return ivfprintf(f, fmt, &val);
19731 }
19732
19733 int
19734 myprintf(char *fmt, ...)
19735 {
19736   va_list val;
19737   va_start(val, fmt);
19738   return myvfprintf(stdout, fmt, val);
19739 }
19740
19741 int
19742 main(int ac, char **av)
19743 {
19744   signal(SIGSEGV, exit);
19745
19746   myprintf("%s%cs all right, then\n", "that", '\'');
19747   exit(0);
19748 }
19749 EOCP
19750         set try
19751         if eval $compile && $run ./try 2>&1 >/dev/null; then
19752                 case "`$run ./try`" in
19753                 "that's all right, then")
19754                         okay=yes
19755                         ;;
19756                 esac
19757         fi
19758         case "$okay" in
19759         yes)    echo "It seems that you don't need va_copy()." >&4
19760                 need_va_copy="$undef"
19761                 ;;
19762         *)      echo "It seems that va_copy() or similar will be needed." >&4
19763                 need_va_copy="$define"
19764                 ;;
19765         esac
19766         $rm_try
19767         ;;
19768 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19769         ;;
19770 esac
19771
19772 : see what type is used for size_t
19773 rp="What is the type used for the length parameter for string functions?"
19774 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19775 eval $typedef_ask
19776
19777 : check for type of arguments to gethostbyaddr. 
19778 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19779         case "$d_gethbyaddr" in
19780         $define)
19781                 $cat <<EOM
19782
19783 Checking to see what type of arguments are accepted by gethostbyaddr().
19784 EOM
19785                 hdrs="$define sys/types.h
19786                         $d_socket sys/socket.h 
19787                         $i_niin netinet/in.h 
19788                         $i_netdb netdb.h
19789                         $i_unistd unistd.h"
19790                 : The first arg can 'char *' or 'void *'
19791                 : The second arg is some of integral type
19792                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19793                         for yyy in size_t long int; do
19794                                 case "$netdb_host_type" in
19795                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19796                                         if ./protochk "$try" $hdrs; then
19797                                                 echo "Your system accepts $xxx for the first arg."
19798                                                 echo "...and $yyy for the second arg."
19799                                                 netdb_host_type="$xxx"
19800                                                 netdb_hlen_type="$yyy"
19801                                         fi
19802                                         ;;
19803                                 esac
19804                         done
19805                 done
19806                 : In case none of those worked, prompt the user.
19807                 case "$netdb_host_type" in
19808                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19809                         dflt='char *'
19810                         . ./myread
19811                         netdb_host_type=$ans
19812                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19813                         dflt="$sizetype"
19814                         . ./myread
19815                         netdb_hlen_type=$ans
19816                         ;;
19817                 esac
19818                 ;;
19819         *)      : no gethostbyaddr, so pick harmless defaults
19820                 netdb_host_type='char *'
19821                 netdb_hlen_type="$sizetype"
19822                 ;;
19823         esac
19824         # Remove the "const" if needed. -- but then we'll have a 
19825         # prototype clash!
19826         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19827 fi
19828
19829 : check for type of argument to gethostbyname. 
19830 if test "X$netdb_name_type" = X ; then
19831         case "$d_gethbyname" in
19832         $define)
19833                 $cat <<EOM
19834
19835 Checking to see what type of argument is accepted by gethostbyname().
19836 EOM
19837                 hdrs="$define sys/types.h
19838                         $d_socket sys/socket.h 
19839                         $i_niin netinet/in.h 
19840                         $i_netdb netdb.h
19841                         $i_unistd unistd.h"
19842                 for xxx in "const char *" "char *"; do
19843                         case "$netdb_name_type" in
19844                         '')     try="extern struct hostent *gethostbyname($xxx);"
19845                                 if ./protochk "$try" $hdrs; then
19846                                         echo "Your system accepts $xxx."
19847                                         netdb_name_type="$xxx"
19848                                 fi
19849                                 ;;
19850                         esac
19851                 done
19852                 : In case none of those worked, prompt the user.
19853                 case "$netdb_name_type" in
19854                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19855                         dflt='char *'
19856                         . ./myread
19857                         netdb_name_type=$ans
19858                         ;;
19859                 esac
19860                 ;;
19861         *)      : no gethostbyname, so pick harmless default
19862                 netdb_name_type='char *'
19863                 ;;
19864         esac
19865 fi
19866
19867 : check for type of 1st argument to getnetbyaddr. 
19868 if test "X$netdb_net_type" = X ; then
19869         case "$d_getnbyaddr" in
19870         $define)
19871                 $cat <<EOM
19872
19873 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19874 EOM
19875                 hdrs="$define sys/types.h
19876                         $d_socket sys/socket.h 
19877                         $i_niin netinet/in.h 
19878                         $i_netdb netdb.h
19879                         $i_unistd unistd.h"
19880                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19881                         case "$netdb_net_type" in
19882                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19883                                 if ./protochk "$try" $hdrs; then
19884                                         echo "Your system accepts $xxx."
19885                                         netdb_net_type="$xxx"
19886                                 fi
19887                                 ;;
19888                         esac
19889                 done
19890                 : In case none of those worked, prompt the user.
19891                 case "$netdb_net_type" in
19892                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19893                         dflt='long'
19894                         . ./myread
19895                         netdb_net_type=$ans
19896                         ;;
19897                 esac
19898                 ;;
19899         *)      : no getnetbyaddr, so pick harmless default
19900                 netdb_net_type='long'
19901                 ;;
19902         esac
19903 fi
19904 : locate the preferred pager for this system
19905 fn=f/
19906 case "$pager" in
19907 '')
19908         dflt=''
19909         case "$pg" in
19910         /*) dflt=$pg;;
19911         [a-zA-Z]:/*) dflt=$pg;;
19912         esac
19913         case "$more" in
19914         /*) dflt=$more;;
19915         [a-zA-Z]:/*) dflt=$more;;
19916         esac
19917         case "$less" in
19918         /*) dflt=$less;;
19919         [a-zA-Z]:/*) dflt=$less;;
19920         esac
19921         case "$dflt" in
19922         '') dflt=/usr/ucb/more;;
19923         esac
19924         ;;
19925 *)      dflt="$pager"
19926         : Instruct ./getfile to trust the hinted or previous pager value,
19927         : even if it does not begin with a slash.  For example, on os2,
19928         : pager might be cmd /c more.  See comments in UU/getfile.
19929         fn="f/($pager)"
19930         ;;
19931 esac
19932 echo " "
19933 rp='What pager is used on your system?'
19934 . ./getfile
19935 pager="$ans"
19936
19937 : see what type pids are declared as in the kernel
19938 rp="What is the type of process ids on this system?"
19939 set pid_t pidtype int stdio.h sys/types.h
19940 eval $typedef_ask
19941
19942 : see if ar generates random libraries by itself
19943 echo " "
19944 echo "Checking how to generate random libraries on your machine..." >&4
19945 echo 'int bar1() { return bar2(); }' > bar1.c
19946 echo 'int bar2() { return 2; }' > bar2.c
19947 $cat > foo.c <<EOP
19948 #$i_stdlib I_STDLIB
19949 #ifdef I_STDLIB
19950 #include <stdlib.h>
19951 #endif
19952 int main() { printf("%d\n", bar1()); exit(0); }
19953 EOP
19954 $cc $ccflags -c bar1.c >/dev/null 2>&1
19955 $cc $ccflags -c bar2.c >/dev/null 2>&1
19956 $cc $ccflags -c foo.c >/dev/null 2>&1
19957 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19958 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19959         $run ./foobar >/dev/null 2>&1; then
19960         echo "$ar appears to generate random libraries itself."
19961         orderlib=false
19962         if [ "X$ranlib" = "X" ]; then
19963             ranlib=":"
19964         fi
19965 elif $ar s bar$_a >/dev/null 2>&1 &&
19966         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19967         $run ./foobar >/dev/null 2>&1; then
19968                 echo "a table of contents needs to be added with '$ar s'."
19969                 orderlib=false
19970                 ranlib="$ar s"
19971 elif $ar ts bar$_a >/dev/null 2>&1 &&
19972         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19973         $run ./foobar >/dev/null 2>&1; then
19974                 echo "a table of contents needs to be added with '$ar ts'."
19975                 orderlib=false
19976                 ranlib="$ar ts"
19977 else
19978         case "$ranlib" in
19979         :) ranlib='';;
19980         '')
19981                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19982                 $test -f $ranlib || ranlib=''
19983                 ;;
19984         esac
19985         if $test -n "$ranlib"; then
19986                 echo "your system has '$ranlib'; we'll use that."
19987                 orderlib=false
19988         else
19989                 echo "your system doesn't seem to support random libraries"
19990                 echo "so we'll use lorder and tsort to order the libraries."
19991                 orderlib=true
19992                 ranlib=":"
19993         fi
19994 fi
19995 $rm -f foo* bar*
19996
19997 : check for type of arguments to select.
19998 case "$selecttype" in
19999 '') case "$d_select" in
20000         $define)
20001                 echo " "
20002                 $cat <<EOM
20003 Checking to see what type of arguments are accepted by select().
20004 EOM
20005                 hdrs="$define sys/types.h
20006                         $i_systime sys/time.h
20007                         $i_sysselct sys/select.h
20008                         $d_socket sys/socket.h"
20009                 : The first arg can be int, unsigned, or size_t
20010                 : The last arg may or may not be 'const'
20011                 val=''
20012                 : void pointer has been seen but using that
20013                 : breaks the selectminbits test
20014                 for xxx in 'fd_set *' 'int *'; do
20015                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20016                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20017                                         case "$val" in
20018                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20019                                                 if ./protochk "$try" $hdrs; then
20020                                                         echo "Your system accepts $xxx."
20021                                                         val="$xxx"
20022                                                 fi
20023                                                 ;;
20024                                         esac
20025                                 done
20026                         done
20027                 done
20028                 case "$val" in
20029                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20030                         case "$d_fd_set" in
20031                                 $define) dflt="fd_set *" ;;
20032                                 *)              dflt="int *" ;;
20033                         esac
20034                         . ./myread
20035                         val=$ans
20036                         ;;
20037                 esac
20038                 selecttype="$val"
20039                 ;;
20040         *)      : no select, so pick a harmless default
20041                 selecttype='int *'
20042                 ;;
20043         esac
20044         ;;
20045 esac
20046
20047 : check for the select 'width'
20048 case "$selectminbits" in
20049 '') safebits=`expr $ptrsize \* 8`
20050     case "$d_select" in
20051         $define)
20052                 $cat <<EOM
20053
20054 Checking to see on how many bits at a time your select() operates...
20055 EOM
20056                 $cat >try.c <<EOCP
20057 #include <sys/types.h>
20058 #$i_time I_TIME
20059 #$i_systime I_SYS_TIME
20060 #$i_systimek I_SYS_TIME_KERNEL
20061 #ifdef I_TIME
20062 #   include <time.h>
20063 #endif
20064 #ifdef I_SYS_TIME
20065 #   ifdef I_SYS_TIME_KERNEL
20066 #       define KERNEL
20067 #   endif
20068 #   include <sys/time.h>
20069 #   ifdef I_SYS_TIME_KERNEL
20070 #       undef KERNEL
20071 #   endif
20072 #endif
20073 #$i_sysselct I_SYS_SELECT
20074 #ifdef I_SYS_SELECT
20075 #include <sys/select.h>
20076 #endif
20077 #$d_socket HAS_SOCKET
20078 #ifdef HAS_SOCKET
20079 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20080 #endif
20081 #include <stdio.h>
20082 #$i_stdlib I_STDLIB
20083 #ifdef I_STDLIB
20084 #include <stdlib.h>
20085 #endif
20086 $selecttype b;
20087 #define S sizeof(*(b))
20088 #define MINBITS 64
20089 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20090 #define NBITS  (NBYTES * 8)
20091 int main() {
20092     char *s = (char *)malloc(NBYTES);
20093     struct timeval t;
20094     int i;
20095     FILE* fp;
20096     int fd;
20097
20098     if (!s)
20099         exit(1);
20100     fclose(stdin);
20101     fp = fopen("try.c", "r");
20102     if (fp == 0)
20103       exit(2);
20104     fd = fileno(fp);
20105     if (fd < 0)
20106       exit(3);
20107     b = ($selecttype)s;
20108     for (i = 0; i < NBITS; i++)
20109         FD_SET(i, b);
20110     t.tv_sec  = 0;
20111     t.tv_usec = 0;
20112     select(fd + 1, b, 0, 0, &t);
20113     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20114     free(s);
20115     printf("%d\n", i + 1);
20116     return 0;
20117 }
20118 EOCP
20119                 set try
20120                 if eval $compile_ok; then
20121                         selectminbits=`$run ./try`
20122                         case "$selectminbits" in
20123                         '')     cat >&4 <<EOM
20124 Cannot figure out on how many bits at a time your select() operates.
20125 I'll play safe and guess it is $safebits bits.
20126 EOM
20127                                 selectminbits=$safebits
20128                                 bits="$safebits bits"
20129                                 ;;
20130                         1)      bits="1 bit" ;;
20131                         *)      bits="$selectminbits bits" ;;
20132                         esac
20133                         echo "Your select() operates on $bits at a time." >&4
20134                 else
20135                         rp='What is the minimum number of bits your select() operates on?'
20136                         case "$byteorder" in
20137                         12345678)       dflt=64 ;;
20138                         1234)           dflt=32 ;;
20139                         *)              dflt=1  ;;
20140                         esac
20141                         . ./myread
20142                         val=$ans
20143                         selectminbits="$val"
20144                 fi
20145                 $rm_try
20146                 ;;
20147         *)      : no select, so pick a harmless default
20148                 selectminbits=$safebits
20149                 ;;
20150         esac
20151         ;;
20152 esac
20153
20154 : Trace out the files included by signal.h, then look for SIGxxx names.
20155 if [ "X$fieldn" = X ]; then
20156         : Just make some guesses.  We check them later.
20157         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20158 else
20159         xxx=`echo '#include <signal.h>' |
20160         $cppstdin $cppminus $cppflags 2>/dev/null |
20161         $grep '^[       ]*#.*include' |
20162         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20163                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20164 fi
20165 xxxfiles=''
20166 for xx in $xxx /dev/null ; do
20167         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20168 done
20169 case "$xxxfiles" in
20170 '')     xxxfiles=`./findhdr signal.h` ;;
20171 esac
20172 xxx=`awk '
20173 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20174         print substr($2, 4, 20)
20175 }
20176 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20177         print substr($3, 4, 20)
20178 }' $xxxfiles`
20179 : Append some common names just in case the awk scan failed.
20180 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20181 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20182 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20183 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20184 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20185
20186 : generate a few handy files for later
20187 $cat > signal.c <<EOCP
20188 #include <sys/types.h>
20189 #include <signal.h>
20190 #$i_stdlib I_STDLIB
20191 #ifdef I_STDLIB
20192 #include <stdlib.h>
20193 #endif
20194 #include <stdio.h>
20195 int main() {
20196
20197 /* Strange style to avoid deeply-nested #if/#else/#endif */
20198 #ifndef NSIG
20199 #  ifdef _NSIG
20200 #    define NSIG (_NSIG)
20201 #  endif
20202 #endif
20203
20204 #ifndef NSIG
20205 #  ifdef SIGMAX
20206 #    define NSIG (SIGMAX+1)
20207 #  endif
20208 #endif
20209
20210 #ifndef NSIG
20211 #  ifdef SIG_MAX
20212 #    define NSIG (SIG_MAX+1)
20213 #  endif
20214 #endif
20215
20216 #ifndef NSIG
20217 #  ifdef _SIG_MAX
20218 #    define NSIG (_SIG_MAX+1)
20219 #  endif
20220 #endif
20221
20222 #ifndef NSIG
20223 #  ifdef MAXSIG
20224 #    define NSIG (MAXSIG+1)
20225 #  endif
20226 #endif
20227
20228 #ifndef NSIG
20229 #  ifdef MAX_SIG
20230 #    define NSIG (MAX_SIG+1)
20231 #  endif
20232 #endif
20233
20234 #ifndef NSIG
20235 #  ifdef SIGARRAYSIZE
20236 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20237 #  endif
20238 #endif
20239
20240 #ifndef NSIG
20241 #  ifdef _sys_nsig
20242 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20243 #  endif
20244 #endif
20245
20246 /* Default to some arbitrary number that's big enough to get most
20247    of the common signals.
20248 */
20249 #ifndef NSIG
20250 #    define NSIG 50
20251 #endif
20252
20253 printf("NSIG %d\n", NSIG);
20254
20255 #ifndef JUST_NSIG
20256
20257 EOCP
20258
20259 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20260 {
20261         printf "#ifdef SIG"; printf $1; printf "\n"
20262         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20263         printf $1; printf ");\n"
20264         printf "#endif\n"
20265 }
20266 END {
20267         printf "#endif /* JUST_NSIG */\n";
20268         printf "exit(0);\n}\n";
20269 }
20270 ' >>signal.c
20271 $cat >signal.awk <<'EOP'
20272 BEGIN { ndups = 0 }
20273 $1 ~ /^NSIG$/ { nsig = $2 }
20274 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20275     if ($2 > maxsig) { maxsig = $2 }
20276     if (sig_name[$2]) {
20277         dup_name[ndups] = $1
20278         dup_num[ndups] = $2
20279         ndups++
20280     }
20281     else {
20282         sig_name[$2] = $1
20283         sig_num[$2] = $2
20284     }
20285 }
20286 END {
20287     if (nsig == 0) {
20288         nsig = maxsig + 1
20289     }
20290     printf("NSIG %d\n", nsig);
20291     for (n = 1; n < nsig; n++) {
20292         if (sig_name[n]) {
20293             printf("%s %d\n", sig_name[n], sig_num[n])
20294         }
20295         else {
20296             printf("NUM%d %d\n", n, n)
20297         }
20298     }
20299     for (n = 0; n < ndups; n++) {
20300         printf("%s %d\n", dup_name[n], dup_num[n])
20301     }
20302 }
20303 EOP
20304 $cat >signal_cmd <<EOS
20305 $startsh
20306 if $test -s signal.lst; then
20307     echo "Using your existing signal.lst file"
20308         exit 0
20309 fi
20310 xxx="$xxx"
20311 EOS
20312 $cat >>signal_cmd <<'EOS'
20313
20314 set signal
20315 if eval $compile_ok; then
20316         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20317                 $uniq | $awk -f signal.awk >signal.lst
20318 else
20319         echo "(I can't seem be able to compile the whole test program)" >&4
20320         echo "(I'll try it in little pieces.)" >&4
20321         set signal -DJUST_NSIG
20322         if eval $compile_ok; then
20323                 $run ./signal$_exe > signal.nsg
20324                 $cat signal.nsg
20325         else
20326                 echo "I can't seem to figure out how many signals you have." >&4
20327                 echo "Guessing 50." >&4
20328                 echo 'NSIG 50' > signal.nsg
20329         fi
20330         : Now look at all the signal names, one at a time.
20331         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20332                 $cat > signal.c <<EOCP
20333 #include <sys/types.h>
20334 #include <signal.h>
20335 #include <stdio.h>
20336 int main() {
20337 printf("$xx %d\n", SIG${xx});
20338 return 0;
20339 }
20340 EOCP
20341                 set signal
20342                 if eval $compile; then
20343                         echo "SIG${xx} found."
20344                         $run ./signal$_exe  >> signal.ls1
20345                 else
20346                         echo "SIG${xx} NOT found."
20347                 fi
20348         done
20349         if $test -s signal.ls1; then
20350                 $cat signal.nsg signal.ls1 |
20351                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20352         fi
20353
20354 fi
20355 if $test -s signal.lst; then
20356         :
20357 else
20358         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20359         echo 'kill -l' >signal
20360         set X `csh -f <signal`
20361         $rm -f signal
20362         shift
20363         case $# in
20364         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20365         esac
20366         echo $@ | $tr ' ' $trnl | \
20367             $awk '{ printf "%s %d\n", $1, ++s; }
20368                   END { printf "NSIG %d\n", ++s }' >signal.lst
20369 fi
20370 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20371 EOS
20372 chmod a+x signal_cmd
20373 $eunicefix signal_cmd
20374
20375 : generate list of signal names
20376 echo " "
20377 case "$sig_name_init" in
20378 '') doinit=yes ;;
20379 *)  case "$sig_num_init" in
20380     ''|*,*) doinit=yes ;;
20381     esac ;;
20382 esac
20383 case "$doinit" in
20384 yes)
20385         echo "Generating a list of signal names and numbers..." >&4
20386         . ./signal_cmd
20387         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20388         sig_name=`$awk 'BEGIN { printf "ZERO " }
20389                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20390         sig_num=`$awk  'BEGIN { printf "0 " }
20391                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20392         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20393                              !/^NSIG/   { printf "\"%s\", ", $1 }
20394                              END        { printf "0\n" }' signal.lst`
20395         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20396                              !/^NSIG/   { printf "%d, ", $2}
20397                              END        { printf "0\n"}' signal.lst`
20398         ;;
20399 esac
20400 echo "The following $sig_count signals are available:"
20401 echo " "
20402 echo $sig_name | $awk \
20403 'BEGIN { linelen = 0 }
20404 {
20405         for (i = 1; i <= NF; i++) {
20406                 name = "SIG" $i " "
20407                 linelen = linelen + length(name)
20408                 if (linelen > 70) {
20409                         printf "\n"
20410                         linelen = length(name)
20411                 }
20412                 printf "%s", name
20413         }
20414         printf "\n"
20415 }'
20416 sig_size=`echo $sig_name | awk '{print NF}'`
20417 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20418
20419 : Check size of size
20420 echo " "
20421 case "$sizetype" in
20422 *_t) zzz="$sizetype"    ;;
20423 *)   zzz="filesize"     ;;
20424 esac
20425 echo "Checking the size of $zzz..." >&4
20426 cat > try.c <<EOCP
20427 #include <sys/types.h>
20428 #include <stdio.h>
20429 #$i_stdlib I_STDLIB
20430 #ifdef I_STDLIB
20431 #include <stdlib.h>
20432 #endif
20433 int main() {
20434     printf("%d\n", (int)sizeof($sizetype));
20435     exit(0);
20436 }
20437 EOCP
20438 set try
20439 if eval $compile_ok; then
20440         yyy=`$run ./try`
20441         case "$yyy" in
20442         '')     sizesize=4
20443                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20444                 ;;
20445         *)      sizesize=$yyy
20446                 echo "Your $zzz size is $sizesize bytes."
20447                 ;;
20448         esac
20449 else
20450         sizesize=4
20451         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20452 fi
20453
20454
20455 : check for socklen_t
20456 echo " "
20457 echo "Checking to see if you have socklen_t..." >&4
20458 $cat >try.c <<EOCP
20459 #include <sys/types.h>
20460 #$d_socket HAS_SOCKET
20461 #ifdef HAS_SOCKET
20462 #include <sys/socket.h>
20463 #endif
20464 int main() { socklen_t x = 16; }
20465 EOCP
20466 set try
20467 if eval $compile; then
20468         val="$define"
20469         echo "You have socklen_t."
20470 else
20471         val="$undef"
20472         echo "You do not have socklen_t."
20473         case "$sizetype" in
20474         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20475         esac
20476 fi
20477 $rm_try
20478 set d_socklen_t
20479 eval $setvar
20480
20481 : see if this is a socks.h system
20482 set socks.h i_socks
20483 eval $inhdr
20484
20485 : check for type of the size argument to socket calls
20486 case "$d_socket" in
20487 "$define")
20488         $cat <<EOM
20489
20490 Checking to see what type is the last argument of accept().
20491 EOM
20492         yyy=''
20493         case "$d_socklen_t" in
20494         "$define") yyy="$yyy socklen_t"
20495         esac
20496         yyy="$yyy $sizetype int long unsigned"
20497         for xxx in $yyy; do
20498                 case "$socksizetype" in
20499                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
20500                         case "$usesocks" in
20501                         "$define")
20502                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20503                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20504                                         socksizetype="$xxx"
20505                                 fi
20506                                 ;;
20507                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20508                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20509                                         socksizetype="$xxx"
20510                                 fi
20511                                 ;;
20512                         esac
20513                         ;;
20514                 esac
20515         done
20516 : In case none of those worked, prompt the user.
20517         case "$socksizetype" in
20518         '')     rp='What is the type for socket address structure sizes?'
20519                 dflt='int'
20520                 . ./myread
20521                 socksizetype=$ans
20522                 ;;
20523         esac
20524         ;;
20525 *)      : no sockets, so pick relatively harmless default
20526         socksizetype='int'
20527         ;;
20528 esac
20529
20530 : see what type is used for signed size_t
20531 set ssize_t ssizetype int stdio.h sys/types.h
20532 eval $typedef
20533 dflt="$ssizetype"
20534 $cat > try.c <<EOM
20535 #include <stdio.h>
20536 #$i_stdlib I_STDLIB
20537 #ifdef I_STDLIB
20538 #include <stdlib.h>
20539 #endif
20540 #include <sys/types.h>
20541 #define Size_t $sizetype
20542 #define SSize_t $dflt
20543 int main()
20544 {
20545         if (sizeof(Size_t) == sizeof(SSize_t))
20546                 printf("$dflt\n");
20547         else if (sizeof(Size_t) == sizeof(int))
20548                 printf("int\n");
20549         else
20550                 printf("long\n");
20551         exit(0);
20552 }
20553 EOM
20554 echo " "
20555 set try
20556 if eval $compile_ok && $run ./try > /dev/null; then
20557         ssizetype=`$run ./try`
20558         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20559 else
20560         $cat >&4 <<EOM
20561 Help! I can't compile and run the ssize_t test program: please enlighten me!
20562 (This is probably a misconfiguration in your system or libraries, and
20563 you really ought to fix it.  Still, I'll try anyway.)
20564
20565 I need a type that is the same size as $sizetype, but is guaranteed to
20566 be signed.  Common values are ssize_t, int and long.
20567
20568 EOM
20569         rp="What signed type is the same size as $sizetype?"
20570         . ./myread
20571         ssizetype="$ans"
20572 fi
20573 $rm_try
20574
20575 : see what type of char stdio uses.
20576 echo " "
20577 echo '#include <stdio.h>' > stdio.c
20578 $cppstdin $cppminus < stdio.c > stdioh
20579 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20580         echo "Your stdio uses unsigned chars." >&4
20581         stdchar="unsigned char"
20582 else
20583         echo "Your stdio uses signed chars." >&4
20584         stdchar="char"
20585 fi
20586 $rm -f stdio.* stdioh
20587
20588 : see what type uids are declared as in the kernel
20589 echo " "
20590 echo "Looking for the type for user ids returned by getuid()."
20591 set uid_t uidtype xxx stdio.h sys/types.h
20592 eval $typedef
20593 case "$uidtype" in
20594 xxx)
20595         xxx=`./findhdr sys/user.h`
20596         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20597         case $1 in
20598         unsigned) dflt="$1 $2" ;;
20599         *) dflt="$1" ;;
20600         esac
20601         ;;
20602 *) dflt="$uidtype";;
20603 esac
20604 case "$uidtype" in
20605 uid_t)  echo "uid_t found." ;;
20606 *)      rp="What is the type for user ids returned by getuid()?"
20607         . ./myread
20608         uidtype="$ans"
20609         ;;
20610 esac
20611
20612 : Check size of UID
20613 echo " "
20614 case "$uidtype" in
20615 *_t) zzz="$uidtype"     ;;
20616 *)   zzz="uid"          ;;
20617 esac
20618 echo "Checking the size of $zzz..." >&4
20619 cat > try.c <<EOCP
20620 #include <sys/types.h>
20621 #include <stdio.h>
20622 #$i_stdlib I_STDLIB
20623 #ifdef I_STDLIB
20624 #include <stdlib.h>
20625 #endif
20626 int main() {
20627     printf("%d\n", (int)sizeof($uidtype));
20628     exit(0);
20629 }
20630 EOCP
20631 set try
20632 if eval $compile_ok; then
20633         yyy=`$run ./try`
20634         case "$yyy" in
20635         '')     uidsize=4
20636                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20637                 ;;
20638         *)      uidsize=$yyy
20639                 echo "Your $zzz is $uidsize bytes long."
20640                 ;;
20641         esac
20642 else
20643         uidsize=4
20644         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20645 fi
20646
20647 : Check if UID is signed
20648 echo " "
20649 case "$uidtype" in
20650 *_t) zzz="$uidtype"     ;;
20651 *)   zzz="uid"          ;;
20652 esac
20653 echo "Checking the sign of $zzz..." >&4
20654 cat > try.c <<EOCP
20655 #include <sys/types.h>
20656 #include <stdio.h>
20657 int main() {
20658         $uidtype foo = -1;
20659         if (foo < 0)
20660                 printf("-1\n");
20661         else
20662                 printf("1\n");
20663 }
20664 EOCP
20665 set try
20666 if eval $compile; then
20667         yyy=`$run ./try`
20668         case "$yyy" in
20669         '')     uidsign=1
20670                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20671                 ;;
20672         *)      uidsign=$yyy
20673                 case "$uidsign" in
20674                  1) echo "Your $zzz is unsigned." ;;
20675                 -1) echo "Your $zzz is signed."   ;;
20676                 esac
20677                 ;;
20678         esac
20679 else
20680         uidsign=1
20681         echo "(I can't compile the test program--guessing unsigned.)" >&4
20682 fi
20683
20684
20685 : Check format string for UID
20686 echo " "
20687 $echo "Checking the format string to be used for uids..." >&4
20688
20689 case "$uidsign" in
20690 -1)     if $test X"$uidsize" = X"$ivsize"; then
20691                 uidformat="$ivdformat"
20692         else
20693                 if $test X"$uidsize" = X"$longsize"; then
20694                         uidformat='"ld"'
20695                 else
20696                         if $test X"$uidsize" = X"$intsize"; then
20697                                 uidformat='"d"'
20698                         else
20699                                 if $test X"$uidsize" = X"$shortsize"; then
20700                                         uidformat='"hd"'
20701                                 fi
20702                         fi
20703                 fi
20704         fi
20705         ;;
20706 *)      if $test X"$uidsize" = X"$uvsize"; then
20707                 uidformat="$uvuformat"
20708         else
20709                 if $test X"$uidsize" = X"$longsize"; then
20710                         uidformat='"lu"'
20711                 else
20712                         if $test X"$uidsize" = X"$intsize"; then
20713                                 uidformat='"u"'
20714                         else
20715                                 if $test X"$uidsize" = X"$shortsize"; then
20716                                         uidformat='"hu"'
20717                                 fi
20718                         fi
20719                 fi
20720         fi
20721         ;;
20722 esac
20723
20724 : Check if site customization support was requested
20725 case "$usesitecustomize" in
20726     $define|true|[Yy]*)
20727         usesitecustomize="$define"
20728         ;;
20729     *)
20730         usesitecustomize="$undef"
20731         ;;
20732     esac
20733
20734 : determine compiler compiler
20735 case "$yacc" in
20736 '')
20737         dflt=yacc;;
20738 *)
20739         dflt="$yacc";;
20740 esac
20741 echo " "
20742 comp='yacc'
20743 if $test -f "$byacc$_exe"; then
20744         dflt="$byacc"
20745         comp="byacc or $comp"
20746 fi
20747 if $test -f "$bison$_exe"; then
20748         comp="$comp or bison -y"
20749 fi
20750 rp="Which compiler compiler ($comp) shall I use?"
20751 . ./myread
20752 yacc="$ans"
20753 case "$yacc" in
20754 *bis*)
20755         case "$yacc" in
20756         *-y*) ;;
20757         *)
20758                 yacc="$yacc -y"
20759                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20760                 ;;
20761         esac
20762         ;;
20763 esac
20764
20765 : see if this is a assert.h system
20766 set assert.h i_assert
20767 eval $inhdr
20768
20769 : see if this is a fp.h system
20770 set fp.h i_fp
20771 eval $inhdr
20772
20773 : see if this is a fp_class.h system
20774 set fp_class.h i_fp_class
20775 eval $inhdr
20776
20777 : see if gdbm.h is available
20778 set gdbm.h t_gdbm
20779 eval $inhdr
20780 case "$t_gdbm" in
20781 $define)
20782         : see if gdbm_open exists
20783         set gdbm_open d_gdbm_open
20784         eval $inlibc
20785         case "$d_gdbm_open" in
20786         $undef)
20787                 t_gdbm="$undef"
20788                 echo "We won't be including <gdbm.h>"
20789                 ;;
20790         esac
20791         ;;
20792 esac
20793 val="$t_gdbm"
20794 set i_gdbm
20795 eval $setvar
20796
20797 : see if this is a ieeefp.h system
20798 case "$i_ieeefp" in
20799 '' ) set ieeefp.h i_ieeefp
20800      eval $inhdr
20801      ;;
20802 esac
20803
20804 : see if this is a libutil.h system
20805 set libutil.h i_libutil
20806 eval $inhdr
20807
20808 : see if mach cthreads are available
20809 if test "X$usethreads" = "X$define"; then
20810         set mach/cthreads.h i_machcthr
20811         eval $inhdr
20812 else
20813         i_machcthr="$undef"
20814 fi
20815
20816 : see if this is a mntent.h system
20817 set mntent.h i_mntent
20818 eval $inhdr
20819
20820 : see if ndbm.h is available
20821 set ndbm.h t_ndbm
20822 eval $inhdr
20823
20824 case "$t_ndbm" in
20825 $undef)
20826     # Some Linux distributions such as RedHat 7.1 put the
20827     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20828     if $test -f /usr/include/gdbm/ndbm.h; then
20829         echo '<gdbm/ndbm.h> found.'
20830         ccflags="$ccflags -I/usr/include/gdbm"
20831         cppflags="$cppflags -I/usr/include/gdbm"
20832         t_ndbm=$define
20833     fi
20834     ;;
20835 esac
20836
20837 case "$t_ndbm" in
20838 $define)
20839         : see if dbm_open exists
20840         set dbm_open d_dbm_open
20841         eval $inlibc
20842         case "$d_dbm_open" in
20843         $undef)
20844                 t_ndbm="$undef"
20845                 echo "We won't be including <ndbm.h>"
20846                 ;;
20847         esac
20848         ;;
20849 esac
20850 val="$t_ndbm"
20851 set i_ndbm
20852 eval $setvar
20853
20854 : see if net/errno.h is available
20855 val=''
20856 set net/errno.h val
20857 eval $inhdr
20858
20859 : Unfortunately, it causes problems on some systems.  Arrgh.
20860 case "$val" in
20861 $define)
20862         cat > try.c <<'EOM'
20863 #include <stdio.h>
20864 #include <errno.h>
20865 #include <net/errno.h>
20866 int func()
20867 {
20868         return ENOTSOCK;
20869 }
20870 EOM
20871         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20872                 echo "We'll be including <net/errno.h>." >&4
20873         else
20874                 echo "We won't be including <net/errno.h>." >&4
20875                 val="$undef"
20876         fi
20877         $rm_try
20878         ;;
20879 esac
20880 set i_neterrno
20881 eval $setvar
20882
20883 : see if netinet/tcp.h is available
20884 set netinet/tcp.h i_netinettcp
20885 eval $inhdr
20886
20887 : see if this is a poll.h system
20888 set poll.h i_poll
20889 eval $inhdr
20890
20891 : see if this is a prot.h system
20892 set prot.h i_prot
20893 eval $inhdr
20894
20895 : Preprocessor symbols
20896 echo " "
20897 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20898 $cat <<'EOSH' > Cppsym.know
20899 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20900 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20901 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20902 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20903 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20904 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20905 bull c cadmus clipper CMU COFF COMPILER_VERSION
20906 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20907 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20908 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20909 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20910 GLIBC GLIBC_MINOR
20911 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20912 H3050R H3050RX hbullx20 hcx host_mips
20913 hp200 hp300 hp700 HP700 hp800 hp9000
20914 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20915 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20916 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20917 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20918 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20919 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20920 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20921 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20922 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20923 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20924 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20925 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20926 MATH_HAS_NO_SIDE_EFFECTS
20927 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20928 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20929 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20930 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20931 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20932 NetBSD news1500 news1700 news1800 news1900 news3700
20933 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20934 ns32016 ns32332 ns32k nsc32000
20935 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20936 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20937 pc532 pdp11 PGC PIC plexus PORTAR posix
20938 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20939 POSIX_C_SOURCE POSIX_SOURCE POWER
20940 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
20941 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20942 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20943 sony sony_news sonyrisc sparc sparclite spectrum
20944 stardent stdc STDC_EXT stratos sun sun3 sun386
20945 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20946 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20947 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20948 sysV68 sysV88 Tek4132 Tek4300 titan
20949 TM3200 TM5400 TM5600
20950 tower tower32 tower32_200 tower32_600 tower32_700
20951 tower32_800 tower32_850 tss
20952 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20953 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20954 unix UNIX95 UNIX99 unixpc unos
20955 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20956 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20957 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20958 USGr4 USGr4_2
20959 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20960 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20961 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20962 z8000
20963 EOSH
20964 # Maybe put other stuff here too.
20965 cat <<EOSH >>Cppsym.know
20966 $osname
20967 EOSH
20968 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20969 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20970 $cat Cppsym.know > Cppsym.c
20971 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20972 $rm -f Cppsym.a Cppsym.b Cppsym.c
20973 cat <<EOSH > Cppsym
20974 $startsh
20975 if $test \$# -gt 0; then
20976     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20977     if $test -s Cppsym.got; then
20978         $rm -f Cppsym.got
20979         exit 0
20980     fi
20981     $rm -f Cppsym.got
20982     exit 1
20983 else
20984     $tr " " "$trnl" | ./Cppsym.try
20985     exit 0
20986 fi
20987 EOSH
20988 chmod +x Cppsym
20989 $eunicefix Cppsym
20990 cat <<EOSH > Cppsym.try
20991 $startsh
20992 cat <<'EOCP' > try.c
20993 #include <stdio.h>
20994 #if cpp_stuff == 1
20995 #define STRINGIFY(a)    "a"
20996 #endif
20997 #if cpp_stuff == 42
20998 #define StGiFy(a)  #a
20999 #define STRINGIFY(a)    StGiFy(a)
21000 #endif
21001 #if $cpp_stuff != 1 && $cpp_stuff != 42
21002 #   include "Bletch: How does this C preprocessor stringify macros?"
21003 #endif
21004 int main() {
21005 EOCP
21006 $awk \\
21007 EOSH
21008 cat <<'EOSH' >> Cppsym.try
21009 'length($1) > 0 {
21010     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21011     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21012     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21013     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21014 }'       >> try.c
21015 echo 'return 0;}' >> try.c
21016 EOSH
21017 cat <<EOSH >> Cppsym.try
21018 ccflags="$ccflags"
21019 case "$osname-$gccversion" in
21020 irix-) ccflags="\$ccflags -woff 1178" ;;
21021 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21022 esac
21023 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21024 EOSH
21025 chmod +x Cppsym.try
21026 $eunicefix Cppsym.try
21027 ./Cppsym < Cppsym.know > Cppsym.true
21028 : Add in any linux cpp "predefined macros":
21029 case "$osname::$gccversion" in
21030   *linux*::*.*)
21031     tHdrH=_tmpHdr
21032     rm -f $tHdrH'.h' $tHdrH
21033     touch $tHdrH'.h'
21034     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21035        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21036        if [ -s $tHdrH'_cppsym.real' ]; then
21037           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21038        fi
21039     fi
21040     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21041   ;;
21042 esac
21043 : now check the C compiler for additional symbols
21044 postprocess_cc_v=''
21045 case "$osname" in
21046 aix) postprocess_cc_v="|$tr , ' '" ;;
21047 esac
21048 $cat >ccsym <<EOS
21049 $startsh
21050 $cat >tmp.c <<EOF
21051 extern int foo;
21052 EOF
21053 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21054 do
21055         case "\$i" in
21056         -D*) echo "\$i" | $sed 's/^-D//';;
21057         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21058         esac
21059 done
21060 $rm_try
21061 EOS
21062 postprocess_cc_v=''
21063 chmod +x ccsym
21064 $eunicefix ccsym
21065 ./ccsym > ccsym1.raw
21066 if $test -s ccsym1.raw; then
21067        $sort ccsym1.raw | $uniq >ccsym.raw
21068 else
21069        mv ccsym1.raw ccsym.raw
21070 fi
21071
21072 $awk '/\=/ { print $0; next }
21073         { print $0"=1" }' ccsym.raw >ccsym.list
21074 $comm -13 Cppsym.true ccsym.list >ccsym.own
21075 $comm -12 Cppsym.true ccsym.list >ccsym.com
21076 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21077 also=''
21078 if $test -z ccsym.raw; then
21079         echo "Your C compiler doesn't seem to define any symbols!" >&4
21080         echo " "
21081         echo "However, your C preprocessor defines the following symbols:"
21082         $cat Cppsym.true
21083         ccsymbols=''
21084         cppsymbols=`$cat Cppsym.true`
21085         cppsymbols=`echo $cppsymbols`
21086         cppccsymbols="$cppsymbols"
21087 else
21088         if $test -s ccsym.com; then
21089                 echo "Your C compiler and pre-processor define these symbols:"
21090                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21091                 also='also '
21092                 symbols='ones'
21093                 cppccsymbols=`$cat ccsym.com`
21094                 cppccsymbols=`echo $cppccsymbols`
21095                 $test "$silent" || sleep 1
21096         fi
21097         if $test -s ccsym.cpp; then
21098                 $test "$also" && echo " "
21099                 echo "Your C pre-processor ${also}defines the following symbols:"
21100                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21101                 also='further '
21102                 cppsymbols=`$cat ccsym.cpp`
21103                 cppsymbols=`echo $cppsymbols`
21104                 $test "$silent" || sleep 1
21105         fi
21106         if $test -s ccsym.own; then
21107                 $test "$also" && echo " "
21108                 echo "Your C compiler ${also}defines the following cpp symbols:"
21109                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21110                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21111                 ccsymbols=`$cat ccsym.own`
21112                 ccsymbols=`echo $ccsymbols`
21113                 $test "$silent" || sleep 1
21114         fi
21115 fi
21116
21117 : see if this is a termio system
21118 val="$undef"
21119 val2="$undef"
21120 val3="$undef"
21121 if $test `./findhdr termios.h`; then
21122         set tcsetattr i_termios
21123         eval $inlibc
21124         val3="$i_termios"
21125 fi
21126 echo " "
21127 case "$val3" in
21128 "$define") echo "You have POSIX termios.h... good!" >&4;;
21129 *) if ./Cppsym pyr; then
21130                 case "`/bin/universe`" in
21131                 ucb) if $test `./findhdr sgtty.h`; then
21132                                 val2="$define"
21133                                 echo "<sgtty.h> found." >&4
21134                         else
21135                                 echo "System is pyramid with BSD universe."
21136                                 ./warn "<sgtty.h> not found--you could have problems."
21137                         fi;;
21138                 *) if $test `./findhdr termio.h`; then
21139                                 val="$define"
21140                                 echo "<termio.h> found." >&4
21141                         else
21142                                 echo "System is pyramid with USG universe."
21143                                 ./warn "<termio.h> not found--you could have problems."
21144                         fi;;
21145                 esac
21146         elif ./usg; then
21147                 if $test `./findhdr termio.h`; then
21148                         echo "<termio.h> found." >&4
21149                         val="$define"
21150                 elif $test `./findhdr sgtty.h`; then
21151                         echo "<sgtty.h> found." >&4
21152                         val2="$define"
21153                 else
21154                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21155                 fi
21156         else
21157                 if $test `./findhdr sgtty.h`; then
21158                         echo "<sgtty.h> found." >&4
21159                         val2="$define"
21160                 elif $test `./findhdr termio.h`; then
21161                         echo "<termio.h> found." >&4
21162                         val="$define"
21163                 else
21164                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
21165                 fi
21166         fi;;
21167 esac
21168 set i_termio; eval $setvar
21169 val=$val2; set i_sgtty; eval $setvar
21170 val=$val3; set i_termios; eval $setvar
21171
21172 : see if stddef is available
21173 set stddef.h i_stddef
21174 eval $inhdr
21175
21176 : see if sys/access.h is available
21177 set sys/access.h i_sysaccess
21178 eval $inhdr
21179
21180 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21181 set sys/filio.h i_sysfilio
21182 eval $inhdr
21183 echo " "
21184 if $test `./findhdr sys/ioctl.h`; then
21185         val="$define"
21186         echo '<sys/ioctl.h> found.' >&4
21187 else
21188         val="$undef"
21189         if $test $i_sysfilio = "$define"; then
21190             echo '<sys/ioctl.h> NOT found.' >&4
21191         else
21192                 $test $i_sgtty = "$define" && xxx="sgtty.h"
21193                 $test $i_termio = "$define" && xxx="termio.h"
21194                 $test $i_termios = "$define" && xxx="termios.h"
21195 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21196         fi
21197 fi
21198 set i_sysioctl
21199 eval $setvar
21200
21201 : see if socket ioctl defs are in sys/sockio.h
21202 echo " "
21203 xxx=`./findhdr sys/sockio.h`
21204 if $test "$xxx"; then
21205         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21206                 val="$define"
21207                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21208         else
21209                 val="$undef"
21210                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21211         fi
21212 else
21213         val="$undef"
21214         $cat <<EOM
21215 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21216 EOM
21217 fi
21218 set i_syssockio
21219 eval $setvar
21220
21221 : see if this is a syslog.h system
21222 set syslog.h i_syslog
21223 eval $inhdr
21224
21225 : see if this is a sys/mode.h system
21226 set sys/mode.h i_sysmode
21227 eval $inhdr
21228
21229 : see if there is a sys/poll.h file
21230 set sys/poll.h i_syspoll
21231 eval $inhdr
21232
21233 : see if sys/resource.h has to be included
21234 set sys/resource.h i_sysresrc
21235 eval $inhdr
21236
21237 : see if sys/security.h is available
21238 set sys/security.h i_syssecrt
21239 eval $inhdr
21240
21241 : see if this is a sys/statvfs.h system
21242 set sys/statvfs.h i_sysstatvfs
21243 eval $inhdr
21244
21245 : see if this is a sys/un.h system
21246 set sys/un.h i_sysun
21247 eval $inhdr
21248
21249 : see if this is a sys/utsname.h system
21250 set sys/utsname.h i_sysutsname
21251 eval $inhdr
21252
21253 : see if this is a syswait system
21254 set sys/wait.h i_syswait
21255 eval $inhdr
21256
21257 : see if this is a ustat.h system
21258 set ustat.h i_ustat
21259 eval $inhdr
21260
21261 : see if this is an utime system
21262 set utime.h i_utime
21263 eval $inhdr
21264
21265 : see if this is a values.h system
21266 set values.h i_values
21267 eval $inhdr
21268
21269 : see if this is a vfork system
21270 case "$d_vfork" in
21271 "$define")
21272         set vfork.h i_vfork
21273         eval $inhdr
21274         ;;
21275 *)
21276         i_vfork="$undef"
21277         ;;
21278 esac
21279
21280 : Check extensions
21281 echo " "
21282 echo "Looking for extensions..." >&4
21283 : If we are using the old config.sh, known_extensions may contain
21284 : old or inaccurate or duplicate values.
21285 known_extensions=''
21286 nonxs_extensions=''
21287 : We do not use find because it might not be available.
21288 : We do not just use MANIFEST because the user may have dropped
21289 : some additional extensions into the source tree and expect them
21290 : to be built.
21291
21292 : Function to recursively find available extensions, ignoring DynaLoader
21293 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21294 find_extensions='
21295     for xxx in *; do
21296         case "$xxx" in
21297             DynaLoader|dynaload) ;;
21298             *)
21299             if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
21300                 known_extensions="$known_extensions $1$xxx";
21301             elif $test -f $xxx/Makefile.PL; then
21302                 nonxs_extensions="$nonxs_extensions $1$xxx";
21303             else
21304                 if $test -d $xxx -a $# -lt 10; then
21305                     set $1$xxx/ $*;
21306                     cd "$xxx";
21307                     eval $find_extensions;
21308                     cd ..;
21309                     shift;
21310                 fi;
21311             fi
21312             ;;
21313         esac;
21314     done'
21315 tdir=`pwd`
21316 cd "$rsrc/ext"
21317 set X
21318 shift
21319 eval $find_extensions
21320 # Special case:  Add in modules that nest beyond the first level.
21321 # Currently threads/shared and Hash/Util/FieldHash, since they are
21322 # not picked up by the recursive find above (and adding in general
21323 # recursive finding breaks SDBM_File/sdbm).
21324 # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21325 known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21326 set X $known_extensions
21327 shift
21328 known_extensions="$*"
21329 set X $nonxs_extensions
21330 shift
21331 nonxs_extensions="$*"
21332 cd "$tdir"
21333
21334 : Now see which are supported on this system.
21335 avail_ext=''
21336 for xxx in $known_extensions ; do
21337         case "$xxx" in
21338         DB_File|db_file)
21339                 case "$i_db" in
21340                 $define) avail_ext="$avail_ext $xxx" ;;
21341                 esac
21342                 ;;
21343         GDBM_File|gdbm_fil)
21344                 case "$i_gdbm" in
21345                 $define) avail_ext="$avail_ext $xxx" ;;
21346                 esac
21347                 ;;
21348         I18N/Langinfo|i18n_lan)
21349                 case "$i_langinfo$d_nl_langinfo" in
21350                 $define$define) avail_ext="$avail_ext $xxx" ;;
21351                 esac
21352                 ;;
21353         IPC/SysV|ipc/sysv)
21354                 : XXX Do we need a useipcsysv variable here
21355                 case "${d_msg}${d_sem}${d_shm}" in
21356                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21357                 esac
21358                 ;;
21359         NDBM_File|ndbm_fil)
21360                 case "$i_ndbm" in
21361                 $define)
21362                     case "$osname-$use64bitint" in
21363                     hpux-define)
21364                         case "$libs" in
21365                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21366                         esac
21367                         ;;
21368                     *) avail_ext="$avail_ext $xxx" ;;
21369                     esac
21370                     ;;
21371                 esac
21372                 ;;
21373         ODBM_File|odbm_fil)
21374                 case "${i_dbm}${i_rpcsvcdbm}" in
21375                 *"${define}"*)
21376                     case "$d_cplusplus" in
21377                     define) ;; # delete as a function name will not work
21378                     *)  case "$osname-$use64bitint" in
21379                         hpux-define)
21380                             case "$libs" in
21381                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21382                             esac
21383                             ;;
21384                         *) avail_ext="$avail_ext $xxx" ;;
21385                         esac
21386                         ;;
21387                     esac
21388                     ;;
21389                 esac
21390                 ;;
21391         Opcode|opcode)
21392                 case "$useopcode" in
21393                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21394                 esac
21395                 ;;
21396         POSIX|posix)
21397                 case "$useposix" in
21398                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21399                 esac
21400                 ;;
21401         Socket|socket)
21402                 case "$d_socket" in
21403                 true|$define|y)
21404                     case "$osname" in
21405                     beos) ;; # not unless BONE
21406                     *) avail_ext="$avail_ext $xxx" ;;
21407                     esac
21408                     ;;
21409                 esac
21410                 ;;
21411         Sys/Syslog|sys/syslog)
21412                 : XXX syslog requires socket
21413                 case "$d_socket" in
21414                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21415                 esac
21416                 ;;
21417         Thread|thread)
21418                 case "$usethreads" in
21419                 true|$define|y)
21420                         case "$use5005threads" in
21421                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21422                         esac
21423                 esac
21424                 ;;
21425         threads|threads/shared)
21426                 # threads and threads::shared are special cases.
21427                 # To stop people from asking "Perl 5.8.0 was supposed
21428                 # to have this new fancy threads implementation but my
21429                 # perl doesn't have it" and from people trying to
21430                 # (re)install the threads module using CPAN.pm and
21431                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21432                 # the threads.pm and threads/shared.pm will always be
21433                 # there, croaking informatively ("you need to rebuild
21434                 # all of Perl with threads, sorry") when threads haven't
21435                 # been compiled in.
21436                 # --jhi
21437                 avail_ext="$avail_ext $xxx"
21438                 ;;
21439         Win32*)
21440                 case "$osname" in
21441                 cygwin) avail_ext="$avail_ext $xxx" ;;
21442                 esac
21443                 ;;
21444         XS/APItest|xs/apitest)
21445                 # This is just for testing.  Skip it unless we have dynamic loading.
21446
21447                 case "$usedl" in
21448                 $define) avail_ext="$avail_ext $xxx" ;;
21449                 esac
21450                 ;;
21451         XS/Typemap|xs/typemap)
21452                 # This is just for testing.  Skip it unless we have dynamic loading.
21453                 case "$usedl" in
21454                 $define) avail_ext="$avail_ext $xxx" ;;
21455                 esac
21456                 ;;
21457         *)      avail_ext="$avail_ext $xxx"
21458                 ;;
21459         esac
21460 done
21461
21462 set X $avail_ext
21463 shift
21464 avail_ext="$*"
21465
21466 case "$onlyextensions" in
21467 '') ;;
21468 *)  keepextensions=''
21469     echo "You have requested that only certains extensions be included..." >&4
21470     for i in $onlyextensions; do
21471         case " $avail_ext " in
21472         *" $i "*)
21473             echo "Keeping extension $i."
21474             keepextensions="$keepextensions $i"
21475             ;;
21476         *) echo "Ignoring extension $i." ;;
21477         esac
21478     done
21479     avail_ext="$keepextensions"
21480     ;;
21481 esac
21482
21483 case "$noextensions" in
21484 '') ;;
21485 *)  keepextensions=''
21486     echo "You have requested that certain extensions be ignored..." >&4
21487     for i in $avail_ext; do
21488         case " $noextensions " in
21489         *" $i "*) echo "Ignoring extension $i." ;;
21490         *) echo "Keeping extension $i.";
21491            keepextensions="$keepextensions $i"
21492            ;;
21493         esac
21494     done
21495     avail_ext="$keepextensions"
21496     ;;
21497 esac
21498
21499 : Now see which nonxs extensions are supported on this system.
21500 : For now assume all are.
21501 nonxs_ext=''
21502 for xxx in $nonxs_extensions ; do
21503         case "$xxx" in
21504         *)      nonxs_ext="$nonxs_ext $xxx"
21505                 ;;
21506         esac
21507 done
21508
21509 set X $nonxs_ext
21510 shift
21511 nonxs_ext="$*"
21512
21513 case $usedl in
21514 $define)
21515         $cat <<EOM
21516 A number of extensions are supplied with $package.  You may choose to
21517 compile these extensions for dynamic loading (the default), compile
21518 them into the $package executable (static loading), or not include
21519 them at all.  Answer "none" to include no extensions.
21520 Note that DynaLoader is always built and need not be mentioned here.
21521
21522 EOM
21523         case "$dynamic_ext" in
21524         '')
21525                 : Exclude those listed in static_ext
21526                 dflt=''
21527                 for xxx in $avail_ext; do
21528                         case " $static_ext " in
21529                         *" $xxx "*) ;;
21530                         *) dflt="$dflt $xxx" ;;
21531                         esac
21532                 done
21533                 set X $dflt
21534                 shift
21535                 dflt="$*"
21536                 ;;
21537         *)      dflt="$dynamic_ext"
21538                 # Perhaps we are reusing an old out-of-date config.sh.
21539                 case "$hint" in
21540                 previous)
21541                         if test X"$dynamic_ext" != X"$avail_ext"; then
21542                                 $cat <<EOM
21543 NOTICE:  Your previous config.sh list may be incorrect.
21544 The extensions now available to you are
21545         ${avail_ext}
21546 but the default list from your previous config.sh is
21547         ${dynamic_ext}
21548
21549 EOM
21550                         fi
21551                         ;;
21552                 esac
21553                 ;;
21554         esac
21555         case "$dflt" in
21556         '')     dflt=none;;
21557         esac
21558         rp="What extensions do you wish to load dynamically?"
21559         . ./myread
21560         case "$ans" in
21561         none) dynamic_ext=' ' ;;
21562         *) dynamic_ext="$ans" ;;
21563         esac
21564
21565         case "$static_ext" in
21566         '')
21567                 : Exclude those already listed in dynamic linking
21568                 dflt=''
21569                 for xxx in $avail_ext; do
21570                         case " $dynamic_ext " in
21571                         *" $xxx "*) ;;
21572                         *) dflt="$dflt $xxx" ;;
21573                         esac
21574                 done
21575                 set X $dflt
21576                 shift
21577                 dflt="$*"
21578                 ;;
21579         *)  dflt="$static_ext"
21580                 ;;
21581         esac
21582
21583         case "$dflt" in
21584         '')     dflt=none;;
21585         esac
21586         rp="What extensions do you wish to load statically?"
21587         . ./myread
21588         case "$ans" in
21589         none) static_ext=' ' ;;
21590         *) static_ext="$ans" ;;
21591         esac
21592         ;;
21593 *)
21594         $cat <<EOM
21595 A number of extensions are supplied with $package.  Answer "none"
21596 to include no extensions.
21597 Note that DynaLoader is always built and need not be mentioned here.
21598
21599 EOM
21600         case "$static_ext" in
21601         '') dflt="$avail_ext" ;;
21602         *)      dflt="$static_ext"
21603                 # Perhaps we are reusing an old out-of-date config.sh.
21604                 case "$hint" in
21605                 previous)
21606                         if test X"$static_ext" != X"$avail_ext"; then
21607                                 $cat <<EOM
21608 NOTICE:  Your previous config.sh list may be incorrect.
21609 The extensions now available to you are
21610         ${avail_ext}
21611 but the default list from your previous config.sh is
21612         ${static_ext}
21613
21614 EOM
21615                         fi
21616                         ;;
21617                 esac
21618                 ;;
21619         esac
21620         : Exclude those that are not xs extensions
21621         case "$dflt" in
21622         '')     dflt=none;;
21623         esac
21624         rp="What extensions do you wish to include?"
21625         . ./myread
21626         case "$ans" in
21627         none) static_ext=' ' ;;
21628         *) static_ext="$ans" ;;
21629         esac
21630         ;;
21631 esac
21632 #
21633 # Encode is a special case.  If we are building Encode as a static
21634 # extension, we need to explicitly list its subextensions as well.
21635 # For other nested extensions, this is handled automatically by
21636 # the appropriate Makefile.PL.
21637 case " $static_ext " in
21638         *" Encode "*) # Add the subextensions of Encode
21639         cd "$rsrc/ext"
21640         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21641                 static_ext="$static_ext Encode/$xxx"
21642         done
21643         cd "$tdir"
21644         ;;
21645 esac
21646
21647 set X $dynamic_ext $static_ext $nonxs_ext
21648 shift
21649 extensions="$*"
21650
21651 # Sanity check:  We require an extension suitable for use with
21652 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21653 # should show up as failures in the test suite, but it's helpful to
21654 # catch them now.) The 'extensions' list is normally sorted
21655 # alphabetically, so we need to accept either
21656 #    DB_File ... Fcntl ... IO  ....
21657 # or something like
21658 #    Fcntl ... NDBM_File ... IO  ....
21659 case " $extensions"  in
21660 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21661 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21662 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21663 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21664    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21665    ;;
21666 esac
21667
21668 : Remove libraries needed only for extensions
21669 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21670 : The exception is SunOS 4.x, which needs them.
21671 case "${osname}X${osvers}" in
21672 sunos*X4*)
21673     perllibs="$libs"
21674     ;;
21675 *) case "$usedl" in
21676     $define|true|[yY]*)
21677             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21678             shift
21679             perllibs="$*"
21680             ;;
21681     *)  perllibs="$libs"
21682             ;;
21683     esac
21684     ;;
21685 esac
21686
21687 : Remove build directory name from cppstdin so it can be used from
21688 : either the present location or the final installed location.
21689 echo " "
21690 : Get out of the UU directory to get correct path name.
21691 cd ..
21692 case "$cppstdin" in
21693 `pwd`/cppstdin)
21694         echo "Stripping down cppstdin path name"
21695         cppstdin=cppstdin
21696         ;;
21697 esac
21698 cd UU
21699
21700 : end of configuration questions
21701 echo " "
21702 echo "End of configuration questions."
21703 echo " "
21704
21705 : back to where it started
21706 if test -d ../UU; then
21707         cd ..
21708 fi
21709
21710 : configuration may be unconditionally patched via a 'config.arch' file
21711 if $test -f config.arch; then
21712         echo "I see a config.arch file, loading it." >&4
21713         . ./config.arch
21714 fi
21715
21716 : configuration may be patched via a 'config.over' file
21717 if $test -f config.over; then
21718         echo " "
21719         dflt=y
21720         rp='I see a config.over file.  Do you wish to load it?'
21721         . UU/myread
21722         case "$ans" in
21723         n*) echo "OK, I'll ignore it.";;
21724         *)      . ./config.over
21725                 echo "Configuration override changes have been loaded."
21726                 ;;
21727         esac
21728 fi
21729
21730 : in case they want portability, strip down executable paths
21731 case "$d_portable" in
21732 "$define")
21733         echo " "
21734         echo "Stripping down executable paths..." >&4
21735         for file in $loclist $trylist; do
21736                 eval temp=\$$file
21737                 eval $file=`basename $temp`
21738         done
21739         ;;
21740 esac
21741
21742 : create config.sh file
21743 echo " "
21744 echo "Creating config.sh..." >&4
21745 $spitshell <<EOT >config.sh
21746 $startsh
21747 #
21748 # This file was produced by running the Configure script. It holds all the
21749 # definitions figured out by Configure. Should you modify one of these values,
21750 # do not forget to propagate your changes by running "Configure -der". You may
21751 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21752 #
21753
21754 # Package name      : $package
21755 # Source directory  : $src
21756 # Configuration time: $cf_time
21757 # Configured by     : $cf_by
21758 # Target system     : $myuname
21759
21760 EOT
21761 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21762 $spitshell <<EOT >>config.sh
21763
21764 Author='$Author'
21765 Date='$Date'
21766 Header='$Header'
21767 Id='$Id'
21768 Locker='$Locker'
21769 Log='$Log'
21770 RCSfile='$RCSfile'
21771 Revision='$Revision'
21772 Source='$Source'
21773 State='$State'
21774 _a='$_a'
21775 _exe='$_exe'
21776 _o='$_o'
21777 afs='$afs'
21778 afsroot='$afsroot'
21779 alignbytes='$alignbytes'
21780 ansi2knr='$ansi2knr'
21781 aphostname='$aphostname'
21782 api_revision='$api_revision'
21783 api_subversion='$api_subversion'
21784 api_version='$api_version'
21785 api_versionstring='$api_versionstring'
21786 ar='$ar'
21787 archlib='$archlib'
21788 archlibexp='$archlibexp'
21789 archname64='$archname64'
21790 archname='$archname'
21791 archobjs='$archobjs'
21792 asctime_r_proto='$asctime_r_proto'
21793 awk='$awk'
21794 baserev='$baserev'
21795 bash='$bash'
21796 bin='$bin'
21797 binexp='$binexp'
21798 bison='$bison'
21799 byacc='$byacc'
21800 byteorder='$byteorder'
21801 c='$c'
21802 castflags='$castflags'
21803 cat='$cat'
21804 cc='$cc'
21805 cccdlflags='$cccdlflags'
21806 ccdlflags='$ccdlflags'
21807 ccflags='$ccflags'
21808 ccflags_uselargefiles='$ccflags_uselargefiles'
21809 ccname='$ccname'
21810 ccsymbols='$ccsymbols'
21811 ccversion='$ccversion'
21812 cf_by='$cf_by'
21813 cf_email='$cf_email'
21814 cf_time='$cf_time'
21815 chgrp='$chgrp'
21816 chmod='$chmod'
21817 chown='$chown'
21818 clocktype='$clocktype'
21819 comm='$comm'
21820 compress='$compress'
21821 contains='$contains'
21822 cp='$cp'
21823 cpio='$cpio'
21824 cpp='$cpp'
21825 cpp_stuff='$cpp_stuff'
21826 cppccsymbols='$cppccsymbols'
21827 cppflags='$cppflags'
21828 cpplast='$cpplast'
21829 cppminus='$cppminus'
21830 cpprun='$cpprun'
21831 cppstdin='$cppstdin'
21832 cppsymbols='$cppsymbols'
21833 crypt_r_proto='$crypt_r_proto'
21834 cryptlib='$cryptlib'
21835 csh='$csh'
21836 ctermid_r_proto='$ctermid_r_proto'
21837 ctime_r_proto='$ctime_r_proto'
21838 d_Gconvert='$d_Gconvert'
21839 d_PRIEUldbl='$d_PRIEUldbl'
21840 d_PRIFUldbl='$d_PRIFUldbl'
21841 d_PRIGUldbl='$d_PRIGUldbl'
21842 d_PRIXU64='$d_PRIXU64'
21843 d_PRId64='$d_PRId64'
21844 d_PRIeldbl='$d_PRIeldbl'
21845 d_PRIfldbl='$d_PRIfldbl'
21846 d_PRIgldbl='$d_PRIgldbl'
21847 d_PRIi64='$d_PRIi64'
21848 d_PRIo64='$d_PRIo64'
21849 d_PRIu64='$d_PRIu64'
21850 d_PRIx64='$d_PRIx64'
21851 d_SCNfldbl='$d_SCNfldbl'
21852 d__fwalk='$d__fwalk'
21853 d_access='$d_access'
21854 d_accessx='$d_accessx'
21855 d_aintl='$d_aintl'
21856 d_alarm='$d_alarm'
21857 d_archlib='$d_archlib'
21858 d_asctime_r='$d_asctime_r'
21859 d_atolf='$d_atolf'
21860 d_atoll='$d_atoll'
21861 d_attribute_format='$d_attribute_format'
21862 d_attribute_malloc='$d_attribute_malloc'
21863 d_attribute_nonnull='$d_attribute_nonnull'
21864 d_attribute_noreturn='$d_attribute_noreturn'
21865 d_attribute_pure='$d_attribute_pure'
21866 d_attribute_unused='$d_attribute_unused'
21867 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21868 d_bcmp='$d_bcmp'
21869 d_bcopy='$d_bcopy'
21870 d_bsd='$d_bsd'
21871 d_bsdgetpgrp='$d_bsdgetpgrp'
21872 d_bsdsetpgrp='$d_bsdsetpgrp'
21873 d_builtin_choose_expr='$d_builtin_choose_expr'
21874 d_builtin_expect='$d_builtin_expect'
21875 d_bzero='$d_bzero'
21876 d_c99_variadic_macros='$d_c99_variadic_macros'
21877 d_casti32='$d_casti32'
21878 d_castneg='$d_castneg'
21879 d_charvspr='$d_charvspr'
21880 d_chown='$d_chown'
21881 d_chroot='$d_chroot'
21882 d_chsize='$d_chsize'
21883 d_class='$d_class'
21884 d_clearenv='$d_clearenv'
21885 d_closedir='$d_closedir'
21886 d_cmsghdr_s='$d_cmsghdr_s'
21887 d_const='$d_const'
21888 d_copysignl='$d_copysignl'
21889 d_cplusplus='$d_cplusplus'
21890 d_crypt='$d_crypt'
21891 d_crypt_r='$d_crypt_r'
21892 d_csh='$d_csh'
21893 d_ctermid='$d_ctermid'
21894 d_ctermid_r='$d_ctermid_r'
21895 d_ctime_r='$d_ctime_r'
21896 d_cuserid='$d_cuserid'
21897 d_dbl_dig='$d_dbl_dig'
21898 d_dbminitproto='$d_dbminitproto'
21899 d_difftime='$d_difftime'
21900 d_dir_dd_fd='$d_dir_dd_fd'
21901 d_dirfd='$d_dirfd'
21902 d_dirnamlen='$d_dirnamlen'
21903 d_dlerror='$d_dlerror'
21904 d_dlopen='$d_dlopen'
21905 d_dlsymun='$d_dlsymun'
21906 d_dosuid='$d_dosuid'
21907 d_drand48_r='$d_drand48_r'
21908 d_drand48proto='$d_drand48proto'
21909 d_dup2='$d_dup2'
21910 d_eaccess='$d_eaccess'
21911 d_endgrent='$d_endgrent'
21912 d_endgrent_r='$d_endgrent_r'
21913 d_endhent='$d_endhent'
21914 d_endhostent_r='$d_endhostent_r'
21915 d_endnent='$d_endnent'
21916 d_endnetent_r='$d_endnetent_r'
21917 d_endpent='$d_endpent'
21918 d_endprotoent_r='$d_endprotoent_r'
21919 d_endpwent='$d_endpwent'
21920 d_endpwent_r='$d_endpwent_r'
21921 d_endsent='$d_endsent'
21922 d_endservent_r='$d_endservent_r'
21923 d_eofnblk='$d_eofnblk'
21924 d_eunice='$d_eunice'
21925 d_faststdio='$d_faststdio'
21926 d_fchdir='$d_fchdir'
21927 d_fchmod='$d_fchmod'
21928 d_fchown='$d_fchown'
21929 d_fcntl='$d_fcntl'
21930 d_fcntl_can_lock='$d_fcntl_can_lock'
21931 d_fd_macros='$d_fd_macros'
21932 d_fd_set='$d_fd_set'
21933 d_fds_bits='$d_fds_bits'
21934 d_fgetpos='$d_fgetpos'
21935 d_finite='$d_finite'
21936 d_finitel='$d_finitel'
21937 d_flexfnam='$d_flexfnam'
21938 d_flock='$d_flock'
21939 d_flockproto='$d_flockproto'
21940 d_fork='$d_fork'
21941 d_fp_class='$d_fp_class'
21942 d_fpathconf='$d_fpathconf'
21943 d_fpclass='$d_fpclass'
21944 d_fpclassify='$d_fpclassify'
21945 d_fpclassl='$d_fpclassl'
21946 d_fpos64_t='$d_fpos64_t'
21947 d_frexpl='$d_frexpl'
21948 d_fs_data_s='$d_fs_data_s'
21949 d_fseeko='$d_fseeko'
21950 d_fsetpos='$d_fsetpos'
21951 d_fstatfs='$d_fstatfs'
21952 d_fstatvfs='$d_fstatvfs'
21953 d_fsync='$d_fsync'
21954 d_ftello='$d_ftello'
21955 d_ftime='$d_ftime'
21956 d_futimes='$d_futimes'
21957 d_getcwd='$d_getcwd'
21958 d_getespwnam='$d_getespwnam'
21959 d_getfsstat='$d_getfsstat'
21960 d_getgrent='$d_getgrent'
21961 d_getgrent_r='$d_getgrent_r'
21962 d_getgrgid_r='$d_getgrgid_r'
21963 d_getgrnam_r='$d_getgrnam_r'
21964 d_getgrps='$d_getgrps'
21965 d_gethbyaddr='$d_gethbyaddr'
21966 d_gethbyname='$d_gethbyname'
21967 d_gethent='$d_gethent'
21968 d_gethname='$d_gethname'
21969 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21970 d_gethostbyname_r='$d_gethostbyname_r'
21971 d_gethostent_r='$d_gethostent_r'
21972 d_gethostprotos='$d_gethostprotos'
21973 d_getitimer='$d_getitimer'
21974 d_getlogin='$d_getlogin'
21975 d_getlogin_r='$d_getlogin_r'
21976 d_getmnt='$d_getmnt'
21977 d_getmntent='$d_getmntent'
21978 d_getnbyaddr='$d_getnbyaddr'
21979 d_getnbyname='$d_getnbyname'
21980 d_getnent='$d_getnent'
21981 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21982 d_getnetbyname_r='$d_getnetbyname_r'
21983 d_getnetent_r='$d_getnetent_r'
21984 d_getnetprotos='$d_getnetprotos'
21985 d_getpagsz='$d_getpagsz'
21986 d_getpbyname='$d_getpbyname'
21987 d_getpbynumber='$d_getpbynumber'
21988 d_getpent='$d_getpent'
21989 d_getpgid='$d_getpgid'
21990 d_getpgrp2='$d_getpgrp2'
21991 d_getpgrp='$d_getpgrp'
21992 d_getppid='$d_getppid'
21993 d_getprior='$d_getprior'
21994 d_getprotobyname_r='$d_getprotobyname_r'
21995 d_getprotobynumber_r='$d_getprotobynumber_r'
21996 d_getprotoent_r='$d_getprotoent_r'
21997 d_getprotoprotos='$d_getprotoprotos'
21998 d_getprpwnam='$d_getprpwnam'
21999 d_getpwent='$d_getpwent'
22000 d_getpwent_r='$d_getpwent_r'
22001 d_getpwnam_r='$d_getpwnam_r'
22002 d_getpwuid_r='$d_getpwuid_r'
22003 d_getsbyname='$d_getsbyname'
22004 d_getsbyport='$d_getsbyport'
22005 d_getsent='$d_getsent'
22006 d_getservbyname_r='$d_getservbyname_r'
22007 d_getservbyport_r='$d_getservbyport_r'
22008 d_getservent_r='$d_getservent_r'
22009 d_getservprotos='$d_getservprotos'
22010 d_getspnam='$d_getspnam'
22011 d_getspnam_r='$d_getspnam_r'
22012 d_gettimeod='$d_gettimeod'
22013 d_gmtime_r='$d_gmtime_r'
22014 d_gnulibc='$d_gnulibc'
22015 d_grpasswd='$d_grpasswd'
22016 d_hasmntopt='$d_hasmntopt'
22017 d_htonl='$d_htonl'
22018 d_ilogbl='$d_ilogbl'
22019 d_inc_version_list='$d_inc_version_list'
22020 d_index='$d_index'
22021 d_inetaton='$d_inetaton'
22022 d_int64_t='$d_int64_t'
22023 d_isascii='$d_isascii'
22024 d_isfinite='$d_isfinite'
22025 d_isinf='$d_isinf'
22026 d_isnan='$d_isnan'
22027 d_isnanl='$d_isnanl'
22028 d_killpg='$d_killpg'
22029 d_lchown='$d_lchown'
22030 d_ldbl_dig='$d_ldbl_dig'
22031 d_libm_lib_version='$d_libm_lib_version'
22032 d_link='$d_link'
22033 d_localtime_r='$d_localtime_r'
22034 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22035 d_locconv='$d_locconv'
22036 d_lockf='$d_lockf'
22037 d_longdbl='$d_longdbl'
22038 d_longlong='$d_longlong'
22039 d_lseekproto='$d_lseekproto'
22040 d_lstat='$d_lstat'
22041 d_madvise='$d_madvise'
22042 d_malloc_good_size='$d_malloc_good_size'
22043 d_malloc_size='$d_malloc_size'
22044 d_mblen='$d_mblen'
22045 d_mbstowcs='$d_mbstowcs'
22046 d_mbtowc='$d_mbtowc'
22047 d_memchr='$d_memchr'
22048 d_memcmp='$d_memcmp'
22049 d_memcpy='$d_memcpy'
22050 d_memmove='$d_memmove'
22051 d_memset='$d_memset'
22052 d_mkdir='$d_mkdir'
22053 d_mkdtemp='$d_mkdtemp'
22054 d_mkfifo='$d_mkfifo'
22055 d_mkstemp='$d_mkstemp'
22056 d_mkstemps='$d_mkstemps'
22057 d_mktime='$d_mktime'
22058 d_mmap='$d_mmap'
22059 d_modfl='$d_modfl'
22060 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22061 d_modflproto='$d_modflproto'
22062 d_mprotect='$d_mprotect'
22063 d_msg='$d_msg'
22064 d_msg_ctrunc='$d_msg_ctrunc'
22065 d_msg_dontroute='$d_msg_dontroute'
22066 d_msg_oob='$d_msg_oob'
22067 d_msg_peek='$d_msg_peek'
22068 d_msg_proxy='$d_msg_proxy'
22069 d_msgctl='$d_msgctl'
22070 d_msgget='$d_msgget'
22071 d_msghdr_s='$d_msghdr_s'
22072 d_msgrcv='$d_msgrcv'
22073 d_msgsnd='$d_msgsnd'
22074 d_msync='$d_msync'
22075 d_munmap='$d_munmap'
22076 d_mymalloc='$d_mymalloc'
22077 d_nice='$d_nice'
22078 d_nl_langinfo='$d_nl_langinfo'
22079 d_nv_preserves_uv='$d_nv_preserves_uv'
22080 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22081 d_off64_t='$d_off64_t'
22082 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22083 d_oldpthreads='$d_oldpthreads'
22084 d_oldsock='$d_oldsock'
22085 d_open3='$d_open3'
22086 d_pathconf='$d_pathconf'
22087 d_pause='$d_pause'
22088 d_perl_otherlibdirs='$d_perl_otherlibdirs'
22089 d_phostname='$d_phostname'
22090 d_pipe='$d_pipe'
22091 d_poll='$d_poll'
22092 d_portable='$d_portable'
22093 d_printf_format_null='$d_printf_format_null'
22094 d_procselfexe='$d_procselfexe'
22095 d_pseudofork='$d_pseudofork'
22096 d_pthread_atfork='$d_pthread_atfork'
22097 d_pthread_attr_setscope='$d_pthread_attr_setscope'
22098 d_pthread_yield='$d_pthread_yield'
22099 d_pwage='$d_pwage'
22100 d_pwchange='$d_pwchange'
22101 d_pwclass='$d_pwclass'
22102 d_pwcomment='$d_pwcomment'
22103 d_pwexpire='$d_pwexpire'
22104 d_pwgecos='$d_pwgecos'
22105 d_pwpasswd='$d_pwpasswd'
22106 d_pwquota='$d_pwquota'
22107 d_qgcvt='$d_qgcvt'
22108 d_quad='$d_quad'
22109 d_random_r='$d_random_r'
22110 d_readdir64_r='$d_readdir64_r'
22111 d_readdir='$d_readdir'
22112 d_readdir_r='$d_readdir_r'
22113 d_readlink='$d_readlink'
22114 d_readv='$d_readv'
22115 d_recvmsg='$d_recvmsg'
22116 d_rename='$d_rename'
22117 d_rewinddir='$d_rewinddir'
22118 d_rmdir='$d_rmdir'
22119 d_safebcpy='$d_safebcpy'
22120 d_safemcpy='$d_safemcpy'
22121 d_sanemcmp='$d_sanemcmp'
22122 d_sbrkproto='$d_sbrkproto'
22123 d_scalbnl='$d_scalbnl'
22124 d_sched_yield='$d_sched_yield'
22125 d_scm_rights='$d_scm_rights'
22126 d_seekdir='$d_seekdir'
22127 d_select='$d_select'
22128 d_sem='$d_sem'
22129 d_semctl='$d_semctl'
22130 d_semctl_semid_ds='$d_semctl_semid_ds'
22131 d_semctl_semun='$d_semctl_semun'
22132 d_semget='$d_semget'
22133 d_semop='$d_semop'
22134 d_sendmsg='$d_sendmsg'
22135 d_setegid='$d_setegid'
22136 d_seteuid='$d_seteuid'
22137 d_setgrent='$d_setgrent'
22138 d_setgrent_r='$d_setgrent_r'
22139 d_setgrps='$d_setgrps'
22140 d_sethent='$d_sethent'
22141 d_sethostent_r='$d_sethostent_r'
22142 d_setitimer='$d_setitimer'
22143 d_setlinebuf='$d_setlinebuf'
22144 d_setlocale='$d_setlocale'
22145 d_setlocale_r='$d_setlocale_r'
22146 d_setnent='$d_setnent'
22147 d_setnetent_r='$d_setnetent_r'
22148 d_setpent='$d_setpent'
22149 d_setpgid='$d_setpgid'
22150 d_setpgrp2='$d_setpgrp2'
22151 d_setpgrp='$d_setpgrp'
22152 d_setprior='$d_setprior'
22153 d_setproctitle='$d_setproctitle'
22154 d_setprotoent_r='$d_setprotoent_r'
22155 d_setpwent='$d_setpwent'
22156 d_setpwent_r='$d_setpwent_r'
22157 d_setregid='$d_setregid'
22158 d_setresgid='$d_setresgid'
22159 d_setresuid='$d_setresuid'
22160 d_setreuid='$d_setreuid'
22161 d_setrgid='$d_setrgid'
22162 d_setruid='$d_setruid'
22163 d_setsent='$d_setsent'
22164 d_setservent_r='$d_setservent_r'
22165 d_setsid='$d_setsid'
22166 d_setvbuf='$d_setvbuf'
22167 d_sfio='$d_sfio'
22168 d_shm='$d_shm'
22169 d_shmat='$d_shmat'
22170 d_shmatprototype='$d_shmatprototype'
22171 d_shmctl='$d_shmctl'
22172 d_shmdt='$d_shmdt'
22173 d_shmget='$d_shmget'
22174 d_sigaction='$d_sigaction'
22175 d_signbit='$d_signbit'
22176 d_sigprocmask='$d_sigprocmask'
22177 d_sigsetjmp='$d_sigsetjmp'
22178 d_sitearch='$d_sitearch'
22179 d_snprintf='$d_snprintf'
22180 d_sockatmark='$d_sockatmark'
22181 d_sockatmarkproto='$d_sockatmarkproto'
22182 d_socket='$d_socket'
22183 d_socklen_t='$d_socklen_t'
22184 d_sockpair='$d_sockpair'
22185 d_socks5_init='$d_socks5_init'
22186 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22187 d_sqrtl='$d_sqrtl'
22188 d_srand48_r='$d_srand48_r'
22189 d_srandom_r='$d_srandom_r'
22190 d_sresgproto='$d_sresgproto'
22191 d_sresuproto='$d_sresuproto'
22192 d_statblks='$d_statblks'
22193 d_statfs_f_flags='$d_statfs_f_flags'
22194 d_statfs_s='$d_statfs_s'
22195 d_statvfs='$d_statvfs'
22196 d_stdio_cnt_lval='$d_stdio_cnt_lval'
22197 d_stdio_ptr_lval='$d_stdio_ptr_lval'
22198 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22199 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22200 d_stdio_stream_array='$d_stdio_stream_array'
22201 d_stdiobase='$d_stdiobase'
22202 d_stdstdio='$d_stdstdio'
22203 d_strchr='$d_strchr'
22204 d_strcoll='$d_strcoll'
22205 d_strctcpy='$d_strctcpy'
22206 d_strerrm='$d_strerrm'
22207 d_strerror='$d_strerror'
22208 d_strerror_r='$d_strerror_r'
22209 d_strftime='$d_strftime'
22210 d_strlcat='$d_strlcat'
22211 d_strlcpy='$d_strlcpy'
22212 d_strtod='$d_strtod'
22213 d_strtol='$d_strtol'
22214 d_strtold='$d_strtold'
22215 d_strtoll='$d_strtoll'
22216 d_strtoq='$d_strtoq'
22217 d_strtoul='$d_strtoul'
22218 d_strtoull='$d_strtoull'
22219 d_strtouq='$d_strtouq'
22220 d_strxfrm='$d_strxfrm'
22221 d_suidsafe='$d_suidsafe'
22222 d_symlink='$d_symlink'
22223 d_syscall='$d_syscall'
22224 d_syscallproto='$d_syscallproto'
22225 d_sysconf='$d_sysconf'
22226 d_sysernlst='$d_sysernlst'
22227 d_syserrlst='$d_syserrlst'
22228 d_system='$d_system'
22229 d_tcgetpgrp='$d_tcgetpgrp'
22230 d_tcsetpgrp='$d_tcsetpgrp'
22231 d_telldir='$d_telldir'
22232 d_telldirproto='$d_telldirproto'
22233 d_time='$d_time'
22234 d_times='$d_times'
22235 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22236 d_tm_tm_zone='$d_tm_tm_zone'
22237 d_tmpnam_r='$d_tmpnam_r'
22238 d_truncate='$d_truncate'
22239 d_ttyname_r='$d_ttyname_r'
22240 d_tzname='$d_tzname'
22241 d_u32align='$d_u32align'
22242 d_ualarm='$d_ualarm'
22243 d_umask='$d_umask'
22244 d_uname='$d_uname'
22245 d_union_semun='$d_union_semun'
22246 d_unordered='$d_unordered'
22247 d_unsetenv='$d_unsetenv'
22248 d_usleep='$d_usleep'
22249 d_usleepproto='$d_usleepproto'
22250 d_ustat='$d_ustat'
22251 d_vendorarch='$d_vendorarch'
22252 d_vendorbin='$d_vendorbin'
22253 d_vendorlib='$d_vendorlib'
22254 d_vendorscript='$d_vendorscript'
22255 d_vfork='$d_vfork'
22256 d_void_closedir='$d_void_closedir'
22257 d_voidsig='$d_voidsig'
22258 d_voidtty='$d_voidtty'
22259 d_volatile='$d_volatile'
22260 d_vprintf='$d_vprintf'
22261 d_vsnprintf='$d_vsnprintf'
22262 d_wait4='$d_wait4'
22263 d_waitpid='$d_waitpid'
22264 d_wcstombs='$d_wcstombs'
22265 d_wctomb='$d_wctomb'
22266 d_writev='$d_writev'
22267 d_xenix='$d_xenix'
22268 date='$date'
22269 db_hashtype='$db_hashtype'
22270 db_prefixtype='$db_prefixtype'
22271 db_version_major='$db_version_major'
22272 db_version_minor='$db_version_minor'
22273 db_version_patch='$db_version_patch'
22274 defvoidused='$defvoidused'
22275 direntrytype='$direntrytype'
22276 dlext='$dlext'
22277 dlsrc='$dlsrc'
22278 doublesize='$doublesize'
22279 drand01='$drand01'
22280 drand48_r_proto='$drand48_r_proto'
22281 dtrace='$dtrace'
22282 dynamic_ext='$dynamic_ext'
22283 eagain='$eagain'
22284 ebcdic='$ebcdic'
22285 echo='$echo'
22286 egrep='$egrep'
22287 emacs='$emacs'
22288 endgrent_r_proto='$endgrent_r_proto'
22289 endhostent_r_proto='$endhostent_r_proto'
22290 endnetent_r_proto='$endnetent_r_proto'
22291 endprotoent_r_proto='$endprotoent_r_proto'
22292 endpwent_r_proto='$endpwent_r_proto'
22293 endservent_r_proto='$endservent_r_proto'
22294 eunicefix='$eunicefix'
22295 exe_ext='$exe_ext'
22296 expr='$expr'
22297 extensions='$extensions'
22298 extras='$extras'
22299 fflushNULL='$fflushNULL'
22300 fflushall='$fflushall'
22301 find='$find'
22302 firstmakefile='$firstmakefile'
22303 flex='$flex'
22304 fpossize='$fpossize'
22305 fpostype='$fpostype'
22306 freetype='$freetype'
22307 from='$from'
22308 full_ar='$full_ar'
22309 full_csh='$full_csh'
22310 full_sed='$full_sed'
22311 gccansipedantic='$gccansipedantic'
22312 gccosandvers='$gccosandvers'
22313 gccversion='$gccversion'
22314 getgrent_r_proto='$getgrent_r_proto'
22315 getgrgid_r_proto='$getgrgid_r_proto'
22316 getgrnam_r_proto='$getgrnam_r_proto'
22317 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22318 gethostbyname_r_proto='$gethostbyname_r_proto'
22319 gethostent_r_proto='$gethostent_r_proto'
22320 getlogin_r_proto='$getlogin_r_proto'
22321 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22322 getnetbyname_r_proto='$getnetbyname_r_proto'
22323 getnetent_r_proto='$getnetent_r_proto'
22324 getprotobyname_r_proto='$getprotobyname_r_proto'
22325 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22326 getprotoent_r_proto='$getprotoent_r_proto'
22327 getpwent_r_proto='$getpwent_r_proto'
22328 getpwnam_r_proto='$getpwnam_r_proto'
22329 getpwuid_r_proto='$getpwuid_r_proto'
22330 getservbyname_r_proto='$getservbyname_r_proto'
22331 getservbyport_r_proto='$getservbyport_r_proto'
22332 getservent_r_proto='$getservent_r_proto'
22333 getspnam_r_proto='$getspnam_r_proto'
22334 gidformat='$gidformat'
22335 gidsign='$gidsign'
22336 gidsize='$gidsize'
22337 gidtype='$gidtype'
22338 glibpth='$glibpth'
22339 gmake='$gmake'
22340 gmtime_r_proto='$gmtime_r_proto'
22341 gnulibc_version='$gnulibc_version'
22342 grep='$grep'
22343 groupcat='$groupcat'
22344 groupstype='$groupstype'
22345 gzip='$gzip'
22346 h_fcntl='$h_fcntl'
22347 h_sysfile='$h_sysfile'
22348 hint='$hint'
22349 hostcat='$hostcat'
22350 html1dir='$html1dir'
22351 html1direxp='$html1direxp'
22352 html3dir='$html3dir'
22353 html3direxp='$html3direxp'
22354 i16size='$i16size'
22355 i16type='$i16type'
22356 i32size='$i32size'
22357 i32type='$i32type'
22358 i64size='$i64size'
22359 i64type='$i64type'
22360 i8size='$i8size'
22361 i8type='$i8type'
22362 i_arpainet='$i_arpainet'
22363 i_assert='$i_assert'
22364 i_bsdioctl='$i_bsdioctl'
22365 i_crypt='$i_crypt'
22366 i_db='$i_db'
22367 i_dbm='$i_dbm'
22368 i_dirent='$i_dirent'
22369 i_dld='$i_dld'
22370 i_dlfcn='$i_dlfcn'
22371 i_fcntl='$i_fcntl'
22372 i_float='$i_float'
22373 i_fp='$i_fp'
22374 i_fp_class='$i_fp_class'
22375 i_gdbm='$i_gdbm'
22376 i_grp='$i_grp'
22377 i_ieeefp='$i_ieeefp'
22378 i_inttypes='$i_inttypes'
22379 i_langinfo='$i_langinfo'
22380 i_libutil='$i_libutil'
22381 i_limits='$i_limits'
22382 i_locale='$i_locale'
22383 i_machcthr='$i_machcthr'
22384 i_malloc='$i_malloc'
22385 i_mallocmalloc='$i_mallocmalloc'
22386 i_math='$i_math'
22387 i_memory='$i_memory'
22388 i_mntent='$i_mntent'
22389 i_ndbm='$i_ndbm'
22390 i_netdb='$i_netdb'
22391 i_neterrno='$i_neterrno'
22392 i_netinettcp='$i_netinettcp'
22393 i_niin='$i_niin'
22394 i_poll='$i_poll'
22395 i_prot='$i_prot'
22396 i_pthread='$i_pthread'
22397 i_pwd='$i_pwd'
22398 i_rpcsvcdbm='$i_rpcsvcdbm'
22399 i_sfio='$i_sfio'
22400 i_sgtty='$i_sgtty'
22401 i_shadow='$i_shadow'
22402 i_socks='$i_socks'
22403 i_stdarg='$i_stdarg'
22404 i_stddef='$i_stddef'
22405 i_stdlib='$i_stdlib'
22406 i_string='$i_string'
22407 i_sunmath='$i_sunmath'
22408 i_sysaccess='$i_sysaccess'
22409 i_sysdir='$i_sysdir'
22410 i_sysfile='$i_sysfile'
22411 i_sysfilio='$i_sysfilio'
22412 i_sysin='$i_sysin'
22413 i_sysioctl='$i_sysioctl'
22414 i_syslog='$i_syslog'
22415 i_sysmman='$i_sysmman'
22416 i_sysmode='$i_sysmode'
22417 i_sysmount='$i_sysmount'
22418 i_sysndir='$i_sysndir'
22419 i_sysparam='$i_sysparam'
22420 i_syspoll='$i_syspoll'
22421 i_sysresrc='$i_sysresrc'
22422 i_syssecrt='$i_syssecrt'
22423 i_sysselct='$i_sysselct'
22424 i_syssockio='$i_syssockio'
22425 i_sysstat='$i_sysstat'
22426 i_sysstatfs='$i_sysstatfs'
22427 i_sysstatvfs='$i_sysstatvfs'
22428 i_systime='$i_systime'
22429 i_systimek='$i_systimek'
22430 i_systimes='$i_systimes'
22431 i_systypes='$i_systypes'
22432 i_sysuio='$i_sysuio'
22433 i_sysun='$i_sysun'
22434 i_sysutsname='$i_sysutsname'
22435 i_sysvfs='$i_sysvfs'
22436 i_syswait='$i_syswait'
22437 i_termio='$i_termio'
22438 i_termios='$i_termios'
22439 i_time='$i_time'
22440 i_unistd='$i_unistd'
22441 i_ustat='$i_ustat'
22442 i_utime='$i_utime'
22443 i_values='$i_values'
22444 i_varargs='$i_varargs'
22445 i_varhdr='$i_varhdr'
22446 i_vfork='$i_vfork'
22447 ignore_versioned_solibs='$ignore_versioned_solibs'
22448 inc_version_list='$inc_version_list'
22449 inc_version_list_init='$inc_version_list_init'
22450 incpath='$incpath'
22451 inews='$inews'
22452 initialinstalllocation='$initialinstalllocation'
22453 installarchlib='$installarchlib'
22454 installbin='$installbin'
22455 installhtml1dir='$installhtml1dir'
22456 installhtml3dir='$installhtml3dir'
22457 installman1dir='$installman1dir'
22458 installman3dir='$installman3dir'
22459 installprefix='$installprefix'
22460 installprefixexp='$installprefixexp'
22461 installprivlib='$installprivlib'
22462 installscript='$installscript'
22463 installsitearch='$installsitearch'
22464 installsitebin='$installsitebin'
22465 installsitehtml1dir='$installsitehtml1dir'
22466 installsitehtml3dir='$installsitehtml3dir'
22467 installsitelib='$installsitelib'
22468 installsiteman1dir='$installsiteman1dir'
22469 installsiteman3dir='$installsiteman3dir'
22470 installsitescript='$installsitescript'
22471 installstyle='$installstyle'
22472 installusrbinperl='$installusrbinperl'
22473 installvendorarch='$installvendorarch'
22474 installvendorbin='$installvendorbin'
22475 installvendorhtml1dir='$installvendorhtml1dir'
22476 installvendorhtml3dir='$installvendorhtml3dir'
22477 installvendorlib='$installvendorlib'
22478 installvendorman1dir='$installvendorman1dir'
22479 installvendorman3dir='$installvendorman3dir'
22480 installvendorscript='$installvendorscript'
22481 intsize='$intsize'
22482 issymlink='$issymlink'
22483 ivdformat='$ivdformat'
22484 ivsize='$ivsize'
22485 ivtype='$ivtype'
22486 known_extensions='$known_extensions'
22487 ksh='$ksh'
22488 ld='$ld'
22489 lddlflags='$lddlflags'
22490 ldflags='$ldflags'
22491 ldflags_uselargefiles='$ldflags_uselargefiles'
22492 ldlibpthname='$ldlibpthname'
22493 less='$less'
22494 lib_ext='$lib_ext'
22495 libc='$libc'
22496 libperl='$libperl'
22497 libpth='$libpth'
22498 libs='$libs'
22499 libsdirs='$libsdirs'
22500 libsfiles='$libsfiles'
22501 libsfound='$libsfound'
22502 libspath='$libspath'
22503 libswanted='$libswanted'
22504 libswanted_uselargefiles='$libswanted_uselargefiles'
22505 line='$line'
22506 lint='$lint'
22507 lkflags='$lkflags'
22508 ln='$ln'
22509 lns='$lns'
22510 localtime_r_proto='$localtime_r_proto'
22511 locincpth='$locincpth'
22512 loclibpth='$loclibpth'
22513 longdblsize='$longdblsize'
22514 longlongsize='$longlongsize'
22515 longsize='$longsize'
22516 lp='$lp'
22517 lpr='$lpr'
22518 ls='$ls'
22519 lseeksize='$lseeksize'
22520 lseektype='$lseektype'
22521 mad='$mad'
22522 madlyh='$madlyh'
22523 madlyobj='$madlyobj'
22524 madlysrc='$madlysrc'
22525 mail='$mail'
22526 mailx='$mailx'
22527 make='$make'
22528 make_set_make='$make_set_make'
22529 mallocobj='$mallocobj'
22530 mallocsrc='$mallocsrc'
22531 malloctype='$malloctype'
22532 man1dir='$man1dir'
22533 man1direxp='$man1direxp'
22534 man1ext='$man1ext'
22535 man3dir='$man3dir'
22536 man3direxp='$man3direxp'
22537 man3ext='$man3ext'
22538 mips_type='$mips_type'
22539 mistrustnm='$mistrustnm'
22540 mkdir='$mkdir'
22541 mmaptype='$mmaptype'
22542 modetype='$modetype'
22543 more='$more'
22544 multiarch='$multiarch'
22545 mv='$mv'
22546 myarchname='$myarchname'
22547 mydomain='$mydomain'
22548 myhostname='$myhostname'
22549 myuname='$myuname'
22550 n='$n'
22551 need_va_copy='$need_va_copy'
22552 netdb_hlen_type='$netdb_hlen_type'
22553 netdb_host_type='$netdb_host_type'
22554 netdb_name_type='$netdb_name_type'
22555 netdb_net_type='$netdb_net_type'
22556 nm='$nm'
22557 nm_opt='$nm_opt'
22558 nm_so_opt='$nm_so_opt'
22559 nonxs_ext='$nonxs_ext'
22560 nroff='$nroff'
22561 nvEUformat='$nvEUformat'
22562 nvFUformat='$nvFUformat'
22563 nvGUformat='$nvGUformat'
22564 nv_overflows_integers_at='$nv_overflows_integers_at'
22565 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22566 nveformat='$nveformat'
22567 nvfformat='$nvfformat'
22568 nvgformat='$nvgformat'
22569 nvsize='$nvsize'
22570 nvtype='$nvtype'
22571 o_nonblock='$o_nonblock'
22572 obj_ext='$obj_ext'
22573 old_pthread_create_joinable='$old_pthread_create_joinable'
22574 optimize='$optimize'
22575 orderlib='$orderlib'
22576 osname='$osname'
22577 osvers='$osvers'
22578 otherlibdirs='$otherlibdirs'
22579 package='$package'
22580 pager='$pager'
22581 passcat='$passcat'
22582 patchlevel='$patchlevel'
22583 path_sep='$path_sep'
22584 perl5='$perl5'
22585 perl='$perl'
22586 perl_patchlevel='$perl_patchlevel'
22587 perladmin='$perladmin'
22588 perllibs='$perllibs'
22589 perlpath='$perlpath'
22590 pg='$pg'
22591 phostname='$phostname'
22592 pidtype='$pidtype'
22593 plibpth='$plibpth'
22594 pmake='$pmake'
22595 pr='$pr'
22596 prefix='$prefix'
22597 prefixexp='$prefixexp'
22598 privlib='$privlib'
22599 privlibexp='$privlibexp'
22600 procselfexe='$procselfexe'
22601 prototype='$prototype'
22602 ptrsize='$ptrsize'
22603 quadkind='$quadkind'
22604 quadtype='$quadtype'
22605 randbits='$randbits'
22606 randfunc='$randfunc'
22607 random_r_proto='$random_r_proto'
22608 randseedtype='$randseedtype'
22609 ranlib='$ranlib'
22610 rd_nodata='$rd_nodata'
22611 readdir64_r_proto='$readdir64_r_proto'
22612 readdir_r_proto='$readdir_r_proto'
22613 revision='$revision'
22614 rm='$rm'
22615 rm_try='$rm_try'
22616 rmail='$rmail'
22617 run='$run'
22618 runnm='$runnm'
22619 sPRIEUldbl='$sPRIEUldbl'
22620 sPRIFUldbl='$sPRIFUldbl'
22621 sPRIGUldbl='$sPRIGUldbl'
22622 sPRIXU64='$sPRIXU64'
22623 sPRId64='$sPRId64'
22624 sPRIeldbl='$sPRIeldbl'
22625 sPRIfldbl='$sPRIfldbl'
22626 sPRIgldbl='$sPRIgldbl'
22627 sPRIi64='$sPRIi64'
22628 sPRIo64='$sPRIo64'
22629 sPRIu64='$sPRIu64'
22630 sPRIx64='$sPRIx64'
22631 sSCNfldbl='$sSCNfldbl'
22632 sched_yield='$sched_yield'
22633 scriptdir='$scriptdir'
22634 scriptdirexp='$scriptdirexp'
22635 sed='$sed'
22636 seedfunc='$seedfunc'
22637 selectminbits='$selectminbits'
22638 selecttype='$selecttype'
22639 sendmail='$sendmail'
22640 setgrent_r_proto='$setgrent_r_proto'
22641 sethostent_r_proto='$sethostent_r_proto'
22642 setlocale_r_proto='$setlocale_r_proto'
22643 setnetent_r_proto='$setnetent_r_proto'
22644 setprotoent_r_proto='$setprotoent_r_proto'
22645 setpwent_r_proto='$setpwent_r_proto'
22646 setservent_r_proto='$setservent_r_proto'
22647 sh='$sh'
22648 shar='$shar'
22649 sharpbang='$sharpbang'
22650 shmattype='$shmattype'
22651 shortsize='$shortsize'
22652 shrpenv='$shrpenv'
22653 shsharp='$shsharp'
22654 sig_count='$sig_count'
22655 sig_name='$sig_name'
22656 sig_name_init='$sig_name_init'
22657 sig_num='$sig_num'
22658 sig_num_init='$sig_num_init'
22659 sig_size='$sig_size'
22660 signal_t='$signal_t'
22661 sitearch='$sitearch'
22662 sitearchexp='$sitearchexp'
22663 sitebin='$sitebin'
22664 sitebinexp='$sitebinexp'
22665 sitehtml1dir='$sitehtml1dir'
22666 sitehtml1direxp='$sitehtml1direxp'
22667 sitehtml3dir='$sitehtml3dir'
22668 sitehtml3direxp='$sitehtml3direxp'
22669 sitelib='$sitelib'
22670 sitelib_stem='$sitelib_stem'
22671 sitelibexp='$sitelibexp'
22672 siteman1dir='$siteman1dir'
22673 siteman1direxp='$siteman1direxp'
22674 siteman3dir='$siteman3dir'
22675 siteman3direxp='$siteman3direxp'
22676 siteprefix='$siteprefix'
22677 siteprefixexp='$siteprefixexp'
22678 sitescript='$sitescript'
22679 sitescriptexp='$sitescriptexp'
22680 sizesize='$sizesize'
22681 sizetype='$sizetype'
22682 sleep='$sleep'
22683 smail='$smail'
22684 so='$so'
22685 sockethdr='$sockethdr'
22686 socketlib='$socketlib'
22687 socksizetype='$socksizetype'
22688 sort='$sort'
22689 spackage='$spackage'
22690 spitshell='$spitshell'
22691 srand48_r_proto='$srand48_r_proto'
22692 srandom_r_proto='$srandom_r_proto'
22693 src='$src'
22694 ssizetype='$ssizetype'
22695 startperl='$startperl'
22696 startsh='$startsh'
22697 static_ext='$static_ext'
22698 stdchar='$stdchar'
22699 stdio_base='$stdio_base'
22700 stdio_bufsiz='$stdio_bufsiz'
22701 stdio_cnt='$stdio_cnt'
22702 stdio_filbuf='$stdio_filbuf'
22703 stdio_ptr='$stdio_ptr'
22704 stdio_stream_array='$stdio_stream_array'
22705 strerror_r_proto='$strerror_r_proto'
22706 strings='$strings'
22707 submit='$submit'
22708 subversion='$subversion'
22709 sysman='$sysman'
22710 tail='$tail'
22711 tar='$tar'
22712 targetarch='$targetarch'
22713 tbl='$tbl'
22714 tee='$tee'
22715 test='$test'
22716 timeincl='$timeincl'
22717 timetype='$timetype'
22718 tmpnam_r_proto='$tmpnam_r_proto'
22719 to='$to'
22720 touch='$touch'
22721 tr='$tr'
22722 trnl='$trnl'
22723 troff='$troff'
22724 ttyname_r_proto='$ttyname_r_proto'
22725 u16size='$u16size'
22726 u16type='$u16type'
22727 u32size='$u32size'
22728 u32type='$u32type'
22729 u64size='$u64size'
22730 u64type='$u64type'
22731 u8size='$u8size'
22732 u8type='$u8type'
22733 uidformat='$uidformat'
22734 uidsign='$uidsign'
22735 uidsize='$uidsize'
22736 uidtype='$uidtype'
22737 uname='$uname'
22738 uniq='$uniq'
22739 uquadtype='$uquadtype'
22740 use5005threads='$use5005threads'
22741 use64bitall='$use64bitall'
22742 use64bitint='$use64bitint'
22743 usecrosscompile='$usecrosscompile'
22744 usedl='$usedl'
22745 usedtrace='$usedtrace'
22746 usefaststdio='$usefaststdio'
22747 useithreads='$useithreads'
22748 uselargefiles='$uselargefiles'
22749 uselongdouble='$uselongdouble'
22750 usemallocwrap='$usemallocwrap'
22751 usemorebits='$usemorebits'
22752 usemultiplicity='$usemultiplicity'
22753 usemymalloc='$usemymalloc'
22754 usenm='$usenm'
22755 useopcode='$useopcode'
22756 useperlio='$useperlio'
22757 useposix='$useposix'
22758 usereentrant='$usereentrant'
22759 userelocatableinc='$userelocatableinc'
22760 usesfio='$usesfio'
22761 useshrplib='$useshrplib'
22762 usesitecustomize='$usesitecustomize'
22763 usesocks='$usesocks'
22764 usethreads='$usethreads'
22765 usevendorprefix='$usevendorprefix'
22766 usevfork='$usevfork'
22767 usrinc='$usrinc'
22768 uuname='$uuname'
22769 uvXUformat='$uvXUformat'
22770 uvoformat='$uvoformat'
22771 uvsize='$uvsize'
22772 uvtype='$uvtype'
22773 uvuformat='$uvuformat'
22774 uvxformat='$uvxformat'
22775 vendorarch='$vendorarch'
22776 vendorarchexp='$vendorarchexp'
22777 vendorbin='$vendorbin'
22778 vendorbinexp='$vendorbinexp'
22779 vendorhtml1dir='$vendorhtml1dir'
22780 vendorhtml1direxp='$vendorhtml1direxp'
22781 vendorhtml3dir='$vendorhtml3dir'
22782 vendorhtml3direxp='$vendorhtml3direxp'
22783 vendorlib='$vendorlib'
22784 vendorlib_stem='$vendorlib_stem'
22785 vendorlibexp='$vendorlibexp'
22786 vendorman1dir='$vendorman1dir'
22787 vendorman1direxp='$vendorman1direxp'
22788 vendorman3dir='$vendorman3dir'
22789 vendorman3direxp='$vendorman3direxp'
22790 vendorprefix='$vendorprefix'
22791 vendorprefixexp='$vendorprefixexp'
22792 vendorscript='$vendorscript'
22793 vendorscriptexp='$vendorscriptexp'
22794 version='$version'
22795 version_patchlevel_string='$version_patchlevel_string'
22796 versiononly='$versiononly'
22797 vi='$vi'
22798 voidflags='$voidflags'
22799 xlibpth='$xlibpth'
22800 yacc='$yacc'
22801 yaccflags='$yaccflags'
22802 zcat='$zcat'
22803 zip='$zip'
22804 EOT
22805
22806 : Add in command line options if available
22807 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22808
22809 : add special variables
22810 $test -f $src/patchlevel.h && \
22811 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22812 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22813 echo "PERL_CONFIG_SH=true" >>config.sh
22814
22815 : propagate old symbols
22816 if $test -f UU/config.sh; then
22817         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22818         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
22819                 config.sh config.sh UU/oldconfig.sh |\
22820                 $sort | $uniq -u >UU/oldsyms
22821         set X `cat UU/oldsyms`
22822         shift
22823         case $# in
22824         0) ;;
22825         *)
22826                 cat <<EOM
22827 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22828 EOM
22829                 echo ": Variables propagated from previous config.sh file." >>config.sh
22830                 for sym in `cat UU/oldsyms`; do
22831                         echo "    Propagating $hint variable "'$'"$sym..."
22832                         eval 'tmp="$'"${sym}"'"'
22833                         echo "$tmp" | \
22834                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22835                 done
22836                 ;;
22837         esac
22838 fi
22839
22840 : Finish up by extracting the .SH files
22841 case "$alldone" in
22842 exit)
22843         $rm -rf UU
22844         echo "Extraction done."
22845         exit 0
22846         ;;
22847 cont)
22848         ;;
22849 '')
22850         dflt=''
22851         nostick=true
22852         $cat <<EOM
22853
22854 If you'd like to make any changes to the config.sh file before I begin
22855 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22856
22857 EOM
22858         rp="Press return or use a shell escape to edit config.sh:"
22859         . UU/myread
22860         nostick=''
22861         case "$ans" in
22862         '') ;;
22863         *) : in case they cannot read
22864                 sh 1>&4 -c "$ans";;
22865         esac
22866         ;;
22867 esac
22868
22869 : if this fails, just run all the .SH files by hand
22870 . ./config.sh
22871
22872 echo " "
22873 exec 1>&4
22874 pwd=`pwd`
22875 . ./UU/extract
22876 cd "$pwd"
22877
22878 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22879         dflt=y
22880         case "$silent" in
22881         true) ;;
22882         *)
22883                 $cat <<EOM
22884
22885 Now you need to generate make dependencies by running "$make depend".
22886 You might prefer to run it in background: "$make depend > makedepend.out &"
22887 It can take a while, so you might not want to run it right now.
22888
22889 EOM
22890                 ;;
22891         esac
22892         rp="Run $make depend now?"
22893         . UU/myread
22894         case "$ans" in
22895         y*)
22896                 $make depend && echo "Now you must run '$make'."
22897                 ;;
22898         *)
22899                 echo "You must run '$make depend' then '$make'."
22900                 ;;
22901         esac
22902 elif test -f [Mm]akefile; then
22903         echo " "
22904         echo "Now you must run a $make."
22905 else
22906         echo "Configure done."
22907 fi
22908
22909 if $test -f Policy.sh; then
22910     $cat <<EOM
22911
22912 If you compile $package on a different machine or from a different object
22913 directory, copy the Policy.sh file from this object directory to the
22914 new one before you run Configure -- this will help you with most of
22915 the policy defaults.
22916
22917 EOM
22918 fi
22919 if $test -f config.msg; then
22920     echo "Hmm.  I also noted the following information while running:"
22921     echo " "
22922     $cat config.msg >&4
22923     $rm -f config.msg
22924 fi
22925 $rm -f kit*isdone ark*isdone
22926 $rm -rf UU
22927
22928 : End of Configure
22929