This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
In bisect-runner.pl, refactor the calls to system @ARGV into a function.
[perl5.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist package (which contains metaconfig) is available via SVN:
17 #     svn co https://svn.code.sf.net/p/dist/code/trunk/dist
18 #
19 # Though this script was generated by metaconfig from metaunits, it is
20 # OK to send patches against Configure itself. It's up to the Configure
21 # pumpkin to backport the patch to the metaunits if it is accepted.
22 # For more information on patching Configure, see pod/perlhack.pod
23 #
24 # The metaunits are also available from the public git repository:
25 #     http://perl5.git.perl.org/metaconfig.git/ or
26 #     $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
27 #
28 # See Porting/pumpkin.pod for more information on metaconfig.
29 #
30
31 # Generated on Mon May 27 09:27:16 CEST 2013 [metaconfig 3.5 PL0]
32 # (with additional metaconfig patches by perlbug@perl.org)
33
34 cat >c1$$ <<EOF
35 ARGGGHHHH!!!!!
36
37 SCO csh still thinks true is false.  Write to SCO today and tell them that next
38 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
39
40 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
41 we'd have to do is go in and swap the && and || tokens, wherever they are.)
42
43 [End of diatribe. We now return you to your regularly scheduled programming...]
44 EOF
45 cat >c2$$ <<EOF
46
47 OOPS!  You naughty creature!  You didn't run Configure with sh!
48 I will attempt to remedy the situation by running sh for you...
49 EOF
50
51 true || cat c1$$ c2$$
52 true || exec sh $0 $argv:q
53
54 (exit $?0) || cat c2$$
55 (exit $?0) || exec sh $0 $argv:q
56 rm -f c1$$ c2$$
57
58 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
59         cat <<EOF
60 ***
61 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
62 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
63 *** Please read the README.plan9 for further instructions.
64 *** Cannot continue, aborting.
65 ***
66 EOF
67         exit 1
68 fi
69
70 if test ! -c /dev/null ; then
71         cat <<EOF
72 ***
73 *** I'm sorry, but /dev/null appears to be a file rather than a device.
74 *** Please consult your operating sytem's notes for making a device
75 *** in /dev.
76 *** Cannot continue, aborting.
77 ***
78 EOF
79         exit 1
80 fi
81
82 : compute my invocation name
83 me=$0
84 case "$0" in
85 */*)
86         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
87         test "$me" || me=$0
88         ;;
89 esac
90
91 : Proper separator for the PATH environment variable
92 p_=:
93 : On OS/2 this directory should exist if this is not floppy only system ":-]"
94 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
95         if test -n "$OS2_SHELL"; then
96                 p_=\;
97                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
98                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
99                 is_os2=yes
100         elif test -n "$DJGPP"; then
101                 case "X${MACHTYPE:-nonesuchmach}" in
102                 *cygwin|*msys) ;;
103                 *) p_=\; ;;
104                 esac
105         fi
106 fi
107
108 : Proper PATH setting
109 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
110 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
111 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
112 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
113 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
114 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
115 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
116 paths="$paths /sbin /usr/sbin /usr/libexec"
117 paths="$paths /system/gnu_library/bin"
118
119 for p in $paths
120 do
121         case "$p_$PATH$p_" in
122         *$p_$p$p_*) ;;
123         *) test -d $p && PATH=$PATH$p_$p ;;
124         esac
125 done
126
127 PATH=.$p_$PATH
128 export PATH
129
130 : shall we be using ksh?
131 inksh=''
132 needksh=''
133 avoidksh=''
134 newsh=/bin/ksh
135 changesh=''
136 if (PATH=.; alias -x) >/dev/null 2>&1; then
137                 inksh=true
138 fi
139 if test -f /hp-ux -a -f /bin/ksh; then
140         needksh='to avoid sh bug in "here document" expansion'
141 fi
142 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
143         if test X`/usr/bin/uname -v` = X4; then
144                 avoidksh="to avoid AIX 4's /bin/sh"
145                 newsh=/usr/bin/bsh
146         fi
147 fi
148 if test -f /osf_boot -a -f /usr/sbin/setld; then
149         if test X`/usr/bin/uname -s` = XOSF1; then
150                 avoidksh="to avoid Digital UNIX' ksh"
151                 newsh=/bin/sh
152                 unset BIN_SH
153         fi
154 fi
155 case "$inksh/$needksh" in
156 /[a-z]*)
157                 ENV=''
158                 changesh=true
159                 reason="$needksh"
160         ;;
161 esac
162 case "$inksh/$avoidksh" in
163 true/[a-z]*)
164         changesh=true
165         reason="$avoidksh"
166         ;;
167 esac
168 case "$inksh/$needksh-$avoidksh-" in
169 true/--)
170                 cat <<EOM
171 (I see you are using the Korn shell.  Some ksh's blow up on $me,
172 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
173 EOM
174         ;;
175 esac
176 case "$changesh" in
177 true)
178         export newsh
179         echo "(Feeding myself to $newsh $reason.)"
180         case "$0" in
181         Configure|*/Configure) exec $newsh $0 "$@";;
182         *) exec $newsh Configure "$@";;
183         esac
184         ;;
185 esac
186 test -x "${newsh}" || unset newsh
187
188 : if needed, set CDPATH to a harmless value that is not chatty
189 : avoid bash 2.02 problems with empty CDPATH.
190 case "$CDPATH" in
191 '')     ;;
192 *)      case "$SHELL" in
193         *bash*) CDPATH='.' ;;
194         *) CDPATH='' ;;
195         esac
196         ;;
197 esac
198
199 : Configure runs within the UU subdirectory
200 test -d UU || mkdir UU
201 cd UU && rm -f ./*
202
203 ccname=''
204 ccversion=''
205 ccsymbols=''
206 cppccsymbols=''
207 cppsymbols=''
208 from=''
209 run=''
210 targetarch=''
211 to=''
212 usecrosscompile=''
213 extern_C=''
214 mistrustnm=''
215 usedevel=''
216 perllibs=''
217 dynamic_ext=''
218 extensions=''
219 known_extensions=''
220 nonxs_ext=''
221 static_ext=''
222 useopcode=''
223 useposix=''
224 extras=''
225 d_bsd=''
226 d_eunice=''
227 d_xenix=''
228 eunicefix=''
229 ar=''
230 awk=''
231 bash=''
232 bison=''
233 byacc=''
234 cat=''
235 chgrp=''
236 chmod=''
237 chown=''
238 comm=''
239 compress=''
240 cp=''
241 cpio=''
242 cpp=''
243 csh=''
244 date=''
245 echo=''
246 egrep=''
247 emacs=''
248 expr=''
249 find=''
250 flex=''
251 gmake=''
252 grep=''
253 gzip=''
254 inews=''
255 ksh=''
256 less=''
257 line=''
258 lint=''
259 ln=''
260 lp=''
261 lpr=''
262 ls=''
263 mail=''
264 mailx=''
265 make=''
266 mkdir=''
267 more=''
268 mv=''
269 nm=''
270 nroff=''
271 perl=''
272 pg=''
273 pmake=''
274 pr=''
275 rm=''
276 rmail=''
277 sed=''
278 sendmail=''
279 shar=''
280 sleep=''
281 smail=''
282 sort=''
283 submit=''
284 tail=''
285 tar=''
286 tbl=''
287 tee=''
288 test=''
289 touch=''
290 tr=''
291 troff=''
292 uname=''
293 uniq=''
294 uuname=''
295 vi=''
296 zcat=''
297 zip=''
298 full_ar=''
299 full_sed=''
300 libswanted=''
301 hint=''
302 myuname=''
303 osname=''
304 osvers=''
305 Author=''
306 Date=''
307 Header=''
308 Id=''
309 Locker=''
310 Log=''
311 RCSfile=''
312 Revision=''
313 Source=''
314 State=''
315 _a=''
316 _exe=''
317 _o=''
318 archobjs=''
319 exe_ext=''
320 firstmakefile=''
321 lib_ext=''
322 obj_ext=''
323 path_sep=''
324 rm_try=''
325 afs=''
326 afsroot=''
327 alignbytes=''
328 ansi2knr=''
329 archlib=''
330 archlibexp=''
331 d_archlib=''
332 installarchlib=''
333 archname=''
334 myarchname=''
335 useversionedarchname=''
336 d_atolf=''
337 d_atoll=''
338 baserev=''
339 bin=''
340 binexp=''
341 initialinstalllocation=''
342 installbin=''
343 userelocatableinc=''
344 byteorder=''
345 cc=''
346 ccflags=''
347 cppflags=''
348 ldflags=''
349 lkflags=''
350 locincpth=''
351 optimize=''
352 cf_email=''
353 cf_by=''
354 cf_time=''
355 charbits=''
356 charsize=''
357 contains=''
358 cpp_stuff=''
359 cpplast=''
360 cppminus=''
361 cpprun=''
362 cppstdin=''
363 d__fwalk=''
364 d_access=''
365 d_accessx=''
366 d_aintl=''
367 d_alarm=''
368 asctime_r_proto=''
369 d_asctime_r=''
370 d_attribute_deprecated=''
371 d_attribute_format=''
372 d_attribute_malloc=''
373 d_attribute_nonnull=''
374 d_attribute_noreturn=''
375 d_attribute_pure=''
376 d_attribute_unused=''
377 d_attribute_warn_unused_result=''
378 d_printf_format_null=''
379 d_bcmp=''
380 d_bcopy=''
381 d_builtin_choose_expr=''
382 d_builtin_expect=''
383 d_bzero=''
384 d_c99_variadic_macros=''
385 d_casti32=''
386 castflags=''
387 d_castneg=''
388 d_chown=''
389 d_chroot=''
390 d_chsize=''
391 d_class=''
392 d_clearenv=''
393 d_closedir=''
394 d_void_closedir=''
395 d_cmsghdr_s=''
396 d_const=''
397 d_copysignl=''
398 d_cplusplus=''
399 cryptlib=''
400 d_crypt=''
401 crypt_r_proto=''
402 d_crypt_r=''
403 d_csh=''
404 full_csh=''
405 d_ctermid=''
406 ctermid_r_proto=''
407 d_ctermid_r=''
408 ctime_r_proto=''
409 d_ctime_r=''
410 d_cuserid=''
411 d_dbl_dig=''
412 d_dbminitproto=''
413 d_difftime=''
414 d_dir_dd_fd=''
415 d_dirfd=''
416 d_dlerror=''
417 d_dlopen=''
418 d_dlsymun=''
419 d_dosuid=''
420 d_suidsafe=''
421 d_drand48_r=''
422 drand48_r_proto=''
423 d_drand48proto=''
424 d_dup2=''
425 d_eaccess=''
426 d_endgrent=''
427 d_endgrent_r=''
428 endgrent_r_proto=''
429 d_endhent=''
430 d_endhostent_r=''
431 endhostent_r_proto=''
432 d_endnent=''
433 d_endnetent_r=''
434 endnetent_r_proto=''
435 d_endpent=''
436 d_endprotoent_r=''
437 endprotoent_r_proto=''
438 d_endpwent=''
439 d_endpwent_r=''
440 endpwent_r_proto=''
441 d_endsent=''
442 d_endservent_r=''
443 endservent_r_proto=''
444 d_faststdio=''
445 d_fchdir=''
446 d_fchmod=''
447 d_fchown=''
448 d_fcntl=''
449 d_fcntl_can_lock=''
450 d_fd_macros=''
451 d_fd_set=''
452 d_fds_bits=''
453 d_fgetpos=''
454 d_finite=''
455 d_finitel=''
456 d_flexfnam=''
457 d_flock=''
458 d_flockproto=''
459 d_fork=''
460 d_fp_class=''
461 d_fpclass=''
462 d_fpclassify=''
463 d_fpclassl=''
464 d_fpos64_t=''
465 d_frexpl=''
466 d_fs_data_s=''
467 d_fseeko=''
468 d_fsetpos=''
469 d_fstatfs=''
470 d_fsync=''
471 d_ftello=''
472 d_ftime=''
473 d_gettimeod=''
474 d_futimes=''
475 d_Gconvert=''
476 d_getaddrinfo=''
477 d_getcwd=''
478 d_getespwnam=''
479 d_getfsstat=''
480 d_getgrent=''
481 d_getgrent_r=''
482 getgrent_r_proto=''
483 d_getgrgid_r=''
484 getgrgid_r_proto=''
485 d_getgrnam_r=''
486 getgrnam_r_proto=''
487 d_getgrps=''
488 d_gethbyaddr=''
489 d_gethbyname=''
490 d_gethent=''
491 aphostname=''
492 d_gethname=''
493 d_phostname=''
494 d_uname=''
495 d_gethostbyaddr_r=''
496 gethostbyaddr_r_proto=''
497 d_gethostbyname_r=''
498 gethostbyname_r_proto=''
499 d_gethostent_r=''
500 gethostent_r_proto=''
501 d_gethostprotos=''
502 d_getitimer=''
503 d_getlogin=''
504 d_getlogin_r=''
505 getlogin_r_proto=''
506 d_getmnt=''
507 d_getmntent=''
508 d_getnameinfo=''
509 d_getnbyaddr=''
510 d_getnbyname=''
511 d_getnent=''
512 d_getnetbyaddr_r=''
513 getnetbyaddr_r_proto=''
514 d_getnetbyname_r=''
515 getnetbyname_r_proto=''
516 d_getnetent_r=''
517 getnetent_r_proto=''
518 d_getnetprotos=''
519 d_getpagsz=''
520 d_getpent=''
521 d_getpgid=''
522 d_getpgrp2=''
523 d_bsdgetpgrp=''
524 d_getpgrp=''
525 d_getppid=''
526 d_getprior=''
527 d_getpbyname=''
528 d_getpbynumber=''
529 d_getprotobyname_r=''
530 getprotobyname_r_proto=''
531 d_getprotobynumber_r=''
532 getprotobynumber_r_proto=''
533 d_getprotoent_r=''
534 getprotoent_r_proto=''
535 d_getprotoprotos=''
536 d_getprpwnam=''
537 d_getpwent=''
538 d_getpwent_r=''
539 getpwent_r_proto=''
540 d_getpwnam_r=''
541 getpwnam_r_proto=''
542 d_getpwuid_r=''
543 getpwuid_r_proto=''
544 d_getsent=''
545 d_getservbyname_r=''
546 getservbyname_r_proto=''
547 d_getservbyport_r=''
548 getservbyport_r_proto=''
549 d_getservent_r=''
550 getservent_r_proto=''
551 d_getservprotos=''
552 d_getspnam=''
553 d_getspnam_r=''
554 getspnam_r_proto=''
555 d_getsbyname=''
556 d_getsbyport=''
557 d_gmtime_r=''
558 gmtime_r_proto=''
559 d_gnulibc=''
560 gnulibc_version=''
561 d_hasmntopt=''
562 d_htonl=''
563 d_ilogbl=''
564 d_inetaton=''
565 d_inetntop=''
566 d_inetpton=''
567 d_int64_t=''
568 d_isascii=''
569 d_isblank=''
570 d_isfinite=''
571 d_isinf=''
572 d_isnan=''
573 d_isnanl=''
574 d_killpg=''
575 d_lchown=''
576 d_ldbl_dig=''
577 d_libm_lib_version=''
578 d_link=''
579 d_localtime_r=''
580 d_localtime_r_needs_tzset=''
581 localtime_r_proto=''
582 d_locconv=''
583 d_lockf=''
584 d_longdbl=''
585 longdblsize=''
586 d_longlong=''
587 longlongsize=''
588 d_lseekproto=''
589 d_lstat=''
590 d_madvise=''
591 d_malloc_good_size=''
592 d_malloc_size=''
593 d_mblen=''
594 d_mbstowcs=''
595 d_mbtowc=''
596 d_memchr=''
597 d_memcmp=''
598 d_memcpy=''
599 d_memmove=''
600 d_memset=''
601 d_mkdir=''
602 d_mkdtemp=''
603 d_mkfifo=''
604 d_mkstemp=''
605 d_mkstemps=''
606 d_mktime=''
607 d_mmap=''
608 mmaptype=''
609 d_modfl=''
610 d_modfl_pow32_bug=''
611 d_modflproto=''
612 d_mprotect=''
613 d_msg=''
614 d_msgctl=''
615 d_msgget=''
616 d_msghdr_s=''
617 d_msgrcv=''
618 d_msgsnd=''
619 d_msync=''
620 d_munmap=''
621 d_nice=''
622 d_nl_langinfo=''
623 d_off64_t=''
624 d_open3=''
625 d_fpathconf=''
626 d_pathconf=''
627 d_pause=''
628 d_pipe=''
629 d_poll=''
630 d_portable=''
631 d_prctl=''
632 d_prctl_set_name=''
633 d_procselfexe=''
634 procselfexe=''
635 d_old_pthread_create_joinable=''
636 old_pthread_create_joinable=''
637 d_pthread_atfork=''
638 d_pthread_attr_setscope=''
639 d_pthread_yield=''
640 d_sched_yield=''
641 sched_yield=''
642 d_qgcvt=''
643 d_random_r=''
644 random_r_proto=''
645 d_readdir64_r=''
646 readdir64_r_proto=''
647 d_readdir=''
648 d_rewinddir=''
649 d_seekdir=''
650 d_telldir=''
651 d_readdir_r=''
652 readdir_r_proto=''
653 d_readlink=''
654 d_readv=''
655 d_recvmsg=''
656 d_rename=''
657 d_rmdir=''
658 d_safebcpy=''
659 d_safemcpy=''
660 d_sanemcmp=''
661 d_sbrkproto=''
662 d_scalbnl=''
663 d_select=''
664 d_sem=''
665 d_semctl=''
666 d_semget=''
667 d_semop=''
668 d_sendmsg=''
669 d_setegid=''
670 d_seteuid=''
671 d_setgrent=''
672 d_setgrent_r=''
673 setgrent_r_proto=''
674 d_setgrps=''
675 d_sethent=''
676 d_sethostent_r=''
677 sethostent_r_proto=''
678 d_setitimer=''
679 d_setlinebuf=''
680 d_setlocale=''
681 d_setlocale_r=''
682 setlocale_r_proto=''
683 d_setnent=''
684 d_setnetent_r=''
685 setnetent_r_proto=''
686 d_setpent=''
687 d_setpgid=''
688 d_setpgrp2=''
689 d_bsdsetpgrp=''
690 d_setpgrp=''
691 d_setprior=''
692 d_setproctitle=''
693 d_setprotoent_r=''
694 setprotoent_r_proto=''
695 d_setpwent=''
696 d_setpwent_r=''
697 setpwent_r_proto=''
698 d_setregid=''
699 d_setresgid=''
700 d_setresuid=''
701 d_setreuid=''
702 d_setrgid=''
703 d_setruid=''
704 d_setsent=''
705 d_setservent_r=''
706 setservent_r_proto=''
707 d_setsid=''
708 d_setvbuf=''
709 d_sfio=''
710 usesfio=''
711 d_shm=''
712 d_shmat=''
713 d_shmatprototype=''
714 shmattype=''
715 d_shmctl=''
716 d_shmdt=''
717 d_shmget=''
718 d_sigaction=''
719 d_signbit=''
720 d_sigprocmask=''
721 d_sigsetjmp=''
722 usesitecustomize=''
723 d_snprintf=''
724 d_vsnprintf=''
725 d_sockatmark=''
726 d_sockatmarkproto=''
727 d_ip_mreq=''
728 d_ip_mreq_source=''
729 d_ipv6_mreq=''
730 d_ipv6_mreq_source=''
731 d_msg_ctrunc=''
732 d_msg_dontroute=''
733 d_msg_oob=''
734 d_msg_peek=''
735 d_msg_proxy=''
736 d_oldsock=''
737 d_scm_rights=''
738 d_sin6_scope_id=''
739 d_sockaddr_in6=''
740 d_sockaddr_sa_len=''
741 d_socket=''
742 d_sockpair=''
743 sockethdr=''
744 socketlib=''
745 d_socklen_t=''
746 d_socks5_init=''
747 d_sprintf_returns_strlen=''
748 d_sqrtl=''
749 d_srand48_r=''
750 srand48_r_proto=''
751 d_srandom_r=''
752 srandom_r_proto=''
753 d_sresgproto=''
754 d_sresuproto=''
755 d_statblks=''
756 d_statfs_f_flags=''
757 d_statfs_s=''
758 d_static_inline=''
759 perl_static_inline=''
760 d_fstatvfs=''
761 d_statvfs=''
762 d_stdio_cnt_lval=''
763 d_stdio_ptr_lval=''
764 d_stdio_ptr_lval_nochange_cnt=''
765 d_stdio_ptr_lval_sets_cnt=''
766 d_stdiobase=''
767 d_stdstdio=''
768 stdio_base=''
769 stdio_bufsiz=''
770 stdio_cnt=''
771 stdio_filbuf=''
772 stdio_ptr=''
773 d_index=''
774 d_strchr=''
775 d_strcoll=''
776 d_strctcpy=''
777 d_strerrm=''
778 d_strerror=''
779 d_sysernlst=''
780 d_syserrlst=''
781 d_strerror_r=''
782 strerror_r_proto=''
783 d_strftime=''
784 d_strlcat=''
785 d_strlcpy=''
786 d_strtod=''
787 d_strtol=''
788 d_strtold=''
789 d_strtoll=''
790 d_strtoq=''
791 d_strtoul=''
792 d_strtoull=''
793 d_strtouq=''
794 d_strxfrm=''
795 d_symlink=''
796 d_syscall=''
797 d_syscallproto=''
798 d_sysconf=''
799 d_system=''
800 d_tcgetpgrp=''
801 d_tcsetpgrp=''
802 d_telldirproto=''
803 d_time=''
804 timetype=''
805 d_asctime64=''
806 d_ctime64=''
807 d_difftime64=''
808 d_gmtime64=''
809 d_localtime64=''
810 d_mktime64=''
811 d_timegm=''
812 clocktype=''
813 d_times=''
814 d_tmpnam_r=''
815 tmpnam_r_proto=''
816 d_truncate=''
817 d_ttyname_r=''
818 ttyname_r_proto=''
819 d_tzname=''
820 d_u32align=''
821 d_ualarm=''
822 d_umask=''
823 d_semctl_semid_ds=''
824 d_semctl_semun=''
825 d_union_semun=''
826 d_unordered=''
827 d_unsetenv=''
828 d_usleep=''
829 d_usleepproto=''
830 d_ustat=''
831 d_pseudofork=''
832 d_vfork=''
833 usevfork=''
834 d_voidsig=''
835 signal_t=''
836 d_volatile=''
837 d_charvspr=''
838 d_vprintf=''
839 d_wait4=''
840 d_waitpid=''
841 d_wcstombs=''
842 d_wctomb=''
843 d_writev=''
844 dlext=''
845 bin_ELF=''
846 cccdlflags=''
847 ccdlflags=''
848 dlsrc=''
849 ld=''
850 ld_can_script=''
851 lddlflags=''
852 usedl=''
853 doublesize=''
854 bootstrap_charset=''
855 ebcdic=''
856 fflushNULL=''
857 fflushall=''
858 fpossize=''
859 fpostype=''
860 gccansipedantic=''
861 gccosandvers=''
862 gccversion=''
863 gidformat=''
864 gidsign=''
865 gidsize=''
866 gidtype=''
867 groupstype=''
868 h_fcntl=''
869 h_sysfile=''
870 html1dir=''
871 html1direxp=''
872 installhtml1dir=''
873 html3dir=''
874 html3direxp=''
875 installhtml3dir=''
876 i_arpainet=''
877 i_assert=''
878 i_crypt=''
879 db_hashtype=''
880 db_prefixtype=''
881 db_version_major=''
882 db_version_minor=''
883 db_version_patch=''
884 i_db=''
885 i_dbm=''
886 i_rpcsvcdbm=''
887 d_dirnamlen=''
888 direntrytype=''
889 i_dirent=''
890 i_dld=''
891 i_dlfcn=''
892 i_fcntl=''
893 i_float=''
894 i_fp=''
895 i_fp_class=''
896 i_gdbm=''
897 d_grpasswd=''
898 i_grp=''
899 i_ieeefp=''
900 i_inttypes=''
901 i_langinfo=''
902 i_libutil=''
903 i_limits=''
904 i_locale=''
905 i_machcthr=''
906 i_malloc=''
907 i_mallocmalloc=''
908 i_math=''
909 i_memory=''
910 i_mntent=''
911 d_gdbm_ndbm_h_uses_prototypes=''
912 d_gdbmndbm_h_uses_prototypes=''
913 d_ndbm=''
914 d_ndbm_h_uses_prototypes=''
915 i_gdbm_ndbm=''
916 i_gdbmndbm=''
917 i_ndbm=''
918 i_netdb=''
919 i_neterrno=''
920 i_netinettcp=''
921 i_niin=''
922 i_sysin=''
923 i_poll=''
924 i_prot=''
925 i_pthread=''
926 d_pwage=''
927 d_pwchange=''
928 d_pwclass=''
929 d_pwcomment=''
930 d_pwexpire=''
931 d_pwgecos=''
932 d_pwpasswd=''
933 d_pwquota=''
934 i_pwd=''
935 i_sfio=''
936 i_shadow=''
937 i_socks=''
938 i_stdbool=''
939 i_stddef=''
940 i_stdlib=''
941 i_string=''
942 strings=''
943 i_sunmath=''
944 i_sysaccess=''
945 i_sysdir=''
946 i_sysfile=''
947 d_voidtty=''
948 i_bsdioctl=''
949 i_sysfilio=''
950 i_sysioctl=''
951 i_syssockio=''
952 i_syslog=''
953 i_sysmman=''
954 i_sysmode=''
955 i_sysmount=''
956 i_sysndir=''
957 i_sysparam=''
958 i_syspoll=''
959 i_sysresrc=''
960 i_syssecrt=''
961 i_sysselct=''
962 i_sysstat=''
963 i_sysstatfs=''
964 i_sysstatvfs=''
965 i_systimes=''
966 i_systypes=''
967 i_sysuio=''
968 i_sysun=''
969 i_sysutsname=''
970 i_sysvfs=''
971 i_syswait=''
972 i_sgtty=''
973 i_termio=''
974 i_termios=''
975 d_tm_tm_gmtoff=''
976 d_tm_tm_zone=''
977 i_systime=''
978 i_systimek=''
979 i_time=''
980 timeincl=''
981 i_unistd=''
982 i_ustat=''
983 i_utime=''
984 i_values=''
985 i_stdarg=''
986 i_varargs=''
987 i_varhdr=''
988 i_vfork=''
989 d_inc_version_list=''
990 inc_version_list=''
991 inc_version_list_init=''
992 installprefix=''
993 installprefixexp=''
994 installstyle=''
995 installusrbinperl=''
996 intsize=''
997 longsize=''
998 shortsize=''
999 issymlink=''
1000 libc=''
1001 ldlibpthname=''
1002 libperl=''
1003 shrpenv=''
1004 useshrplib=''
1005 glibpth=''
1006 libpth=''
1007 loclibpth=''
1008 plibpth=''
1009 xlibpth=''
1010 ignore_versioned_solibs=''
1011 libs=''
1012 libsdirs=''
1013 libsfiles=''
1014 libsfound=''
1015 libspath=''
1016 lns=''
1017 d_PRIEUldbl=''
1018 d_PRIFUldbl=''
1019 d_PRIGUldbl=''
1020 d_PRIeldbl=''
1021 d_PRIfldbl=''
1022 d_PRIgldbl=''
1023 d_SCNfldbl=''
1024 sPRIEUldbl=''
1025 sPRIFUldbl=''
1026 sPRIGUldbl=''
1027 sPRIeldbl=''
1028 sPRIfldbl=''
1029 sPRIgldbl=''
1030 sSCNfldbl=''
1031 lseeksize=''
1032 lseektype=''
1033 mad=''
1034 madlyh=''
1035 madlyobj=''
1036 madlysrc=''
1037 make_set_make=''
1038 d_mymalloc=''
1039 freetype=''
1040 mallocobj=''
1041 mallocsrc=''
1042 malloctype=''
1043 usemallocwrap=''
1044 usemymalloc=''
1045 installman1dir=''
1046 man1dir=''
1047 man1direxp=''
1048 man1ext=''
1049 installman3dir=''
1050 man3dir=''
1051 man3direxp=''
1052 man3ext=''
1053 modetype=''
1054 multiarch=''
1055 mydomain=''
1056 myhostname=''
1057 phostname=''
1058 c=''
1059 n=''
1060 d_eofnblk=''
1061 eagain=''
1062 o_nonblock=''
1063 rd_nodata=''
1064 need_va_copy=''
1065 netdb_hlen_type=''
1066 netdb_host_type=''
1067 netdb_name_type=''
1068 netdb_net_type=''
1069 groupcat=''
1070 hostcat=''
1071 passcat=''
1072 orderlib=''
1073 ranlib=''
1074 d_perl_otherlibdirs=''
1075 otherlibdirs=''
1076 package=''
1077 spackage=''
1078 pager=''
1079 api_revision=''
1080 api_subversion=''
1081 api_version=''
1082 api_versionstring=''
1083 patchlevel=''
1084 perl_patchlevel=''
1085 revision=''
1086 subversion=''
1087 version=''
1088 version_patchlevel_string=''
1089 perl5=''
1090 perladmin=''
1091 perlpath=''
1092 d_nv_preserves_uv=''
1093 d_nv_zero_is_allbits_zero=''
1094 i16size=''
1095 i16type=''
1096 i32size=''
1097 i32type=''
1098 i64size=''
1099 i64type=''
1100 i8size=''
1101 i8type=''
1102 ivsize=''
1103 ivtype=''
1104 nv_overflows_integers_at=''
1105 nv_preserves_uv_bits=''
1106 nvsize=''
1107 nvtype=''
1108 u16size=''
1109 u16type=''
1110 u32size=''
1111 u32type=''
1112 u64size=''
1113 u64type=''
1114 u8size=''
1115 u8type=''
1116 uvsize=''
1117 uvtype=''
1118 ivdformat=''
1119 nvEUformat=''
1120 nvFUformat=''
1121 nvGUformat=''
1122 nveformat=''
1123 nvfformat=''
1124 nvgformat=''
1125 uvXUformat=''
1126 uvoformat=''
1127 uvuformat=''
1128 uvxformat=''
1129 pidtype=''
1130 prefix=''
1131 prefixexp=''
1132 installprivlib=''
1133 privlib=''
1134 privlibexp=''
1135 prototype=''
1136 ptrsize=''
1137 d_PRIXU64=''
1138 d_PRId64=''
1139 d_PRIi64=''
1140 d_PRIo64=''
1141 d_PRIu64=''
1142 d_PRIx64=''
1143 sPRIXU64=''
1144 sPRId64=''
1145 sPRIi64=''
1146 sPRIo64=''
1147 sPRIu64=''
1148 sPRIx64=''
1149 d_quad=''
1150 quadkind=''
1151 quadtype=''
1152 uquadtype=''
1153 drand01=''
1154 randbits=''
1155 randfunc=''
1156 randseedtype=''
1157 seedfunc=''
1158 installscript=''
1159 scriptdir=''
1160 scriptdirexp=''
1161 selectminbits=''
1162 selecttype=''
1163 sh=''
1164 sig_count=''
1165 sig_name=''
1166 sig_name_init=''
1167 sig_num=''
1168 sig_num_init=''
1169 sig_size=''
1170 d_sitearch=''
1171 installsitearch=''
1172 sitearch=''
1173 sitearchexp=''
1174 installsitebin=''
1175 sitebin=''
1176 sitebinexp=''
1177 installsitehtml1dir=''
1178 sitehtml1dir=''
1179 sitehtml1direxp=''
1180 installsitehtml3dir=''
1181 sitehtml3dir=''
1182 sitehtml3direxp=''
1183 installsitelib=''
1184 sitelib=''
1185 sitelib_stem=''
1186 sitelibexp=''
1187 installsiteman1dir=''
1188 siteman1dir=''
1189 siteman1direxp=''
1190 installsiteman3dir=''
1191 siteman3dir=''
1192 siteman3direxp=''
1193 siteprefix=''
1194 siteprefixexp=''
1195 installsitescript=''
1196 sitescript=''
1197 sitescriptexp=''
1198 sizesize=''
1199 sizetype=''
1200 so=''
1201 socksizetype=''
1202 sharpbang=''
1203 shsharp=''
1204 spitshell=''
1205 src=''
1206 ssizetype=''
1207 st_ino_sign=''
1208 st_ino_size=''
1209 startperl=''
1210 startsh=''
1211 stdchar=''
1212 d_stdio_stream_array=''
1213 stdio_stream_array=''
1214 sysman=''
1215 sGMTIME_max=''
1216 sGMTIME_min=''
1217 sLOCALTIME_max=''
1218 sLOCALTIME_min=''
1219 trnl=''
1220 uidformat=''
1221 uidsign=''
1222 uidsize=''
1223 uidtype=''
1224 archname64=''
1225 use64bitall=''
1226 use64bitint=''
1227 dtrace=''
1228 usedtrace=''
1229 usefaststdio=''
1230 usekernprocpathname=''
1231 ccflags_uselargefiles=''
1232 ldflags_uselargefiles=''
1233 libswanted_uselargefiles=''
1234 uselargefiles=''
1235 uselongdouble=''
1236 usemorebits=''
1237 usemultiplicity=''
1238 nm_opt=''
1239 nm_so_opt=''
1240 runnm=''
1241 usenm=''
1242 usensgetexecutablepath=''
1243 useperlio=''
1244 usesocks=''
1245 d_oldpthreads=''
1246 use5005threads=''
1247 useithreads=''
1248 usereentrant=''
1249 usethreads=''
1250 incpath=''
1251 mips_type=''
1252 usrinc=''
1253 vaproto=''
1254 d_vendorarch=''
1255 installvendorarch=''
1256 vendorarch=''
1257 vendorarchexp=''
1258 d_vendorbin=''
1259 installvendorbin=''
1260 vendorbin=''
1261 vendorbinexp=''
1262 installvendorhtml1dir=''
1263 vendorhtml1dir=''
1264 vendorhtml1direxp=''
1265 installvendorhtml3dir=''
1266 vendorhtml3dir=''
1267 vendorhtml3direxp=''
1268 d_vendorlib=''
1269 installvendorlib=''
1270 vendorlib=''
1271 vendorlib_stem=''
1272 vendorlibexp=''
1273 installvendorman1dir=''
1274 vendorman1dir=''
1275 vendorman1direxp=''
1276 installvendorman3dir=''
1277 vendorman3dir=''
1278 vendorman3direxp=''
1279 usevendorprefix=''
1280 vendorprefix=''
1281 vendorprefixexp=''
1282 d_vendorscript=''
1283 installvendorscript=''
1284 vendorscript=''
1285 vendorscriptexp=''
1286 versiononly=''
1287 defvoidused=''
1288 voidflags=''
1289 yacc=''
1290 yaccflags=''
1291 CONFIG=''
1292
1293 : Detect odd OSs
1294 define='define'
1295 undef='undef'
1296 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1297 rmlist=''
1298
1299 : We must find out about Eunice early
1300 eunicefix=':'
1301 if test -f /etc/unixtovms; then
1302         eunicefix=/etc/unixtovms
1303 fi
1304 if test -f /etc/unixtovms.exe; then
1305         eunicefix=/etc/unixtovms.exe
1306 fi
1307
1308 : Set executable suffix now -- needed before hints available
1309 if test -f "/libs/version.library"; then
1310 : Amiga OS
1311     _exe=""
1312 elif test -f "/system/gnu_library/bin/ar.pm"; then
1313 : Stratus VOS
1314     _exe=".pm"
1315 elif test -n "$DJGPP"; then
1316 : DOS DJGPP
1317     _exe=".exe"
1318 elif test -d c:/. -o -n "$is_os2" ; then
1319 : OS/2 or cygwin
1320     _exe=".exe"
1321 fi
1322
1323 groupstype=''
1324 i_whoami=''
1325 : Trailing extension.  Override this in a hint file, if needed.
1326 : Extra object files, if any, needed on this platform.
1327 archobjs=''
1328 archname=''
1329 : Possible local include directories to search.
1330 : Set locincpth to "" in a hint file to defeat local include searches.
1331 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1332 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1333 :
1334 : no include file wanted by default
1335 inclwanted=''
1336
1337 : Enable -DEBUGGING and -DDEBUGGING from the command line
1338 EBUGGING=''
1339 DEBUGGING=''
1340
1341 libnames=''
1342 : change the next line if compiling for Xenix/286 on Xenix/386
1343 xlibpth='/usr/lib/386 /lib/386'
1344 : Possible local library directories to search.
1345 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1346 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1347
1348 : general looking path for locating libraries
1349 glibpth="/lib /usr/lib $xlibpth"
1350 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1351 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1352 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1353 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1354
1355 : Private path used by Configure to find libraries.  Its value
1356 : is prepended to libpth. This variable takes care of special
1357 : machines, like the mips.  Usually, it should be empty.
1358 plibpth=''
1359
1360 : default library list
1361 libswanted=''
1362 : some systems want to use only the non-versioned libso:s
1363 ignore_versioned_solibs=''
1364 : set usethreads on the Configure command line to enable threads.
1365 usereentrant='undef'
1366 : full support for void wanted by default
1367 defvoidused=15
1368
1369 ccname=''
1370 ccversion=''
1371 perllibs=''
1372 : set useposix=false in your hint file to disable the POSIX extension.
1373 useposix=true
1374 : set useopcode=false in your hint file to disable the Opcode extension.
1375 useopcode=true
1376 archname64=''
1377 ccflags_uselargefiles=''
1378 ldflags_uselargefiles=''
1379 libswanted_uselargefiles=''
1380 : set usemultiplicity on the Configure command line to enable multiplicity.
1381 : set usesocks on the Configure command line to enable socks.
1382 : List of libraries we want.
1383 : If anyone needs extra -lxxx, put those in a hint file.
1384 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1385 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1386 : We probably want to search /usr/shlib before most other libraries.
1387 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1388 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1389 glibpth="/usr/shlib $glibpth"
1390 : Do not use vfork unless overridden by a hint file.
1391 usevfork=false
1392
1393 : Find the basic shell for Bourne shell scripts
1394 case "$sh" in
1395 '')
1396         case "$SYSTYPE" in
1397         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1398         *) xxx='/bin/sh';;
1399         esac
1400         if test -f "$xxx"; then
1401                 sh="$xxx"
1402         else
1403                 : Build up a list and do a single loop so we can 'break' out.
1404                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1405                 for xxx in sh bash ksh pdksh ash; do
1406                         for p in $pth; do
1407                                 try="$try ${p}/${xxx}"
1408                         done
1409                 done
1410                 for xxx in $try; do
1411                         if test -f "$xxx"; then
1412                                 sh="$xxx";
1413                                 break
1414                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1415                                 sh="$xxx";
1416                                 break
1417                         elif test -f "$xxx.exe"; then
1418                                 sh="$xxx";
1419                                 break
1420                         fi
1421                 done
1422         fi
1423         ;;
1424 esac
1425
1426 case "$sh" in
1427 '')     cat >&2 <<EOM
1428 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1429
1430 Usually it's in /bin/sh.  How did you even get this far?
1431 Please contact me (Perl Maintainers) at perlbug@perl.org and
1432 we'll try to straighten this all out.
1433 EOM
1434         exit 1
1435         ;;
1436 esac
1437
1438 : see if sh knows # comments
1439 if `$sh -c '#' >/dev/null 2>&1`; then
1440         shsharp=true
1441         spitshell=cat
1442         xcat=/bin/cat
1443         test -f $xcat$_exe || xcat=/usr/bin/cat
1444         if test ! -f $xcat$_exe; then
1445                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1446                         if test -f $p/cat$_exe; then
1447                                 xcat=$p/cat
1448                                 break
1449                         fi
1450                 done
1451                 if test ! -f $xcat$_exe; then
1452                         echo "Can't find cat anywhere!"
1453                         exit 1
1454                 fi
1455         fi
1456         echo "#!$xcat" >sharp
1457         $eunicefix sharp
1458         chmod +x sharp
1459         ./sharp > today 2>/dev/null
1460         if test -s today; then
1461                 sharpbang='#!'
1462         else
1463                 echo "#! $xcat" > sharp
1464                 $eunicefix sharp
1465                 chmod +x sharp
1466                 ./sharp > today 2>/dev/null
1467                 if test -s today; then
1468                         sharpbang='#! '
1469                 else
1470                         sharpbang=': use '
1471                 fi
1472         fi
1473 else
1474         echo " "
1475         echo "Your $sh doesn't grok # comments--I will strip them later on."
1476         shsharp=false
1477         cd ..
1478         echo "exec grep -v '^[  ]*#'" >spitshell
1479         chmod +x spitshell
1480         $eunicefix spitshell
1481         spitshell=`pwd`/spitshell
1482         cd UU
1483         echo "I presume that if # doesn't work, #! won't work either!"
1484         sharpbang=': use '
1485 fi
1486 rm -f sharp today
1487
1488 : figure out how to guarantee sh startup
1489 case "$startsh" in
1490 '') startsh=${sharpbang}${sh} ;;
1491 *)
1492 esac
1493 cat >sharp <<EOSS
1494 $startsh
1495 set abc
1496 test "$?abc" != 1
1497 EOSS
1498
1499 chmod +x sharp
1500 $eunicefix sharp
1501 if ./sharp; then
1502         : echo "Yup, it does."
1503 else
1504         echo "Hmm... '$startsh' does not guarantee sh startup..."
1505         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1506 fi
1507 rm -f sharp
1508
1509 : Save command line options in file UU/cmdline.opt for later use in
1510 : generating config.sh.
1511 cat > cmdline.opt <<EOSH
1512 : Configure command line arguments.
1513 config_arg0='$0'
1514 config_args='$*'
1515 config_argc=$#
1516 EOSH
1517 argn=1
1518 args_exp=''
1519 args_sep=''
1520 for arg in "$@"; do
1521         cat >>cmdline.opt <<EOSH
1522 config_arg$argn='$arg'
1523 EOSH
1524         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1525 $arg
1526 EOC
1527         arg_exp=`cat cmdl.opt`
1528         args_exp="$args_exp$args_sep'$arg_exp'"
1529         argn=`expr $argn + 1`
1530         args_sep=' '
1531 done
1532 rm -f cmdl.opt
1533
1534 : produce awk script to parse command line options
1535 cat >options.awk <<'EOF'
1536 BEGIN {
1537         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1538
1539         len = length(optstr);
1540         for (i = 1; i <= len; i++) {
1541                 c = substr(optstr, i, 1);
1542                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1543                 if (a == ":") {
1544                         arg[c] = 1;
1545                         i++;
1546                 }
1547                 opt[c] = 1;
1548         }
1549 }
1550 {
1551         expect = 0;
1552         str = $0;
1553         if (substr(str, 1, 1) != "-") {
1554                 printf("'%s'\n", str);
1555                 next;
1556         }
1557         len = length($0);
1558         for (i = 2; i <= len; i++) {
1559                 c = substr(str, i, 1);
1560                 if (!opt[c]) {
1561                         printf("-%s\n", substr(str, i));
1562                         next;
1563                 }
1564                 printf("-%s\n", c);
1565                 if (arg[c]) {
1566                         if (i < len)
1567                                 printf("'%s'\n", substr(str, i + 1));
1568                         else
1569                                 expect = 1;
1570                         next;
1571                 }
1572         }
1573 }
1574 END {
1575         if (expect)
1576                 print "?";
1577 }
1578 EOF
1579
1580 : process the command line options
1581 set X `for arg in "$@"; do echo "X$arg"; done |
1582         sed -e s/X// | awk -f options.awk`
1583 eval "set $*"
1584 shift
1585 rm -f options.awk
1586
1587 : set up default values
1588 fastread=''
1589 reuseval=false
1590 config_sh=''
1591 alldone=''
1592 error=''
1593 silent=''
1594 extractsh=''
1595 override=''
1596 knowitall=''
1597 rm -f optdef.sh posthint.sh
1598 cat >optdef.sh <<EOS
1599 $startsh
1600 EOS
1601
1602
1603 : option parsing
1604 while test $# -gt 0; do
1605         case "$1" in
1606         -d) shift; fastread=yes;;
1607         -e) shift; alldone=cont;;
1608         -f)
1609                 shift
1610                 cd ..
1611                 if test -r "$1"; then
1612                         config_sh="$1"
1613                 else
1614                         echo "$me: cannot read config file $1." >&2
1615                         error=true
1616                 fi
1617                 cd UU
1618                 shift;;
1619         --help|\
1620         -h) shift; error=true;;
1621         -r) shift; reuseval=true;;
1622         -s) shift; silent=true; realsilent=true;;
1623         -E) shift; alldone=exit;;
1624         -K) shift; knowitall=true;;
1625         -O) shift; override=true;;
1626         -S) shift; silent=true; extractsh=true;;
1627         -D)
1628                 shift
1629                 case "$1" in
1630                 *=)
1631                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1632                         echo "$me: ignoring -D $1" >&2
1633                         ;;
1634                 *=*) echo "$1" | \
1635                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1636                 *) echo "$1='define'" >> optdef.sh;;
1637                 esac
1638                 shift
1639                 ;;
1640         -U)
1641                 shift
1642                 case "$1" in
1643                 *=) echo "$1" >> optdef.sh;;
1644                 *=*)
1645                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1646                         echo "$me: ignoring -U $1" >&2
1647                         ;;
1648                 *) echo "$1='undef'" >> optdef.sh;;
1649                 esac
1650                 shift
1651                 ;;
1652         -A)
1653             shift
1654             xxx=''
1655             yyy="$1"
1656             zzz=''
1657             uuu=undef
1658             case "$yyy" in
1659             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1660                  case "$zzz" in
1661                  *:*) zzz='' ;;
1662                  *)   xxx=append
1663                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1664                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1665                  esac
1666                  ;;
1667             esac
1668             case "$xxx" in
1669             '')  case "$yyy" in
1670                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1671                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1672                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1673                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1674                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1675                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1676                  esac
1677                  ;;
1678             esac
1679             case "$xxx" in
1680             append)
1681                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1682             clear)
1683                 echo "$yyy=''"                  >> posthint.sh ;;
1684             define)
1685                 case "$zzz" in
1686                 '') zzz=define ;;
1687                 esac
1688                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1689             eval)
1690                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1691             prepend)
1692                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1693             undef)
1694                 case "$zzz" in
1695                 '') zzz="$uuu" ;;
1696                 esac
1697                 echo "$yyy=$zzz"                >> posthint.sh ;;
1698             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1699             esac
1700             shift
1701             ;;
1702         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1703             exit 0;;
1704         --) break;;
1705         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1706         *) break;;
1707         esac
1708 done
1709
1710 case "$error" in
1711 true)
1712         cat >&2 <<EOM
1713 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1714                  [-U symbol] [-U symbol=] [-A command:symbol...]
1715   -d : use defaults for all answers.
1716   -e : go on without questioning past the production of config.sh.
1717   -f : specify an alternate default configuration file.
1718   -h : print this help message and exit (with an error status).
1719   -r : reuse C symbols value if possible (skips costly nm extraction).
1720   -s : silent mode, only echoes questions and essential information.
1721   -D : define symbol to have some value:
1722          -D symbol         symbol gets the value 'define'
1723          -D symbol=value   symbol gets the value 'value'
1724        common used examples (see INSTALL for more info):
1725          -Duse64bitint            use 64bit integers
1726          -Duse64bitall            use 64bit integers and pointers
1727          -Dusethreads             use thread support
1728          -Dinc_version_list=none  do not include older perl trees in @INC
1729          -DEBUGGING=none          DEBUGGING options
1730          -Dcc=gcc                 choose your compiler
1731          -Dprefix=/opt/perl5      choose your destination
1732   -E : stop at the end of questions, after having produced config.sh.
1733   -K : do not use unless you know what you are doing.
1734   -O : let -D and -U override definitions from loaded configuration file.
1735   -S : perform variable substitutions on all .SH files (can mix with -f)
1736   -U : undefine symbol:
1737          -U symbol    symbol gets the value 'undef'
1738          -U symbol=   symbol gets completely empty
1739        e.g.:  -Uversiononly
1740   -A : manipulate symbol after the platform specific hints have been applied:
1741          -A append:symbol=value   append value to symbol
1742          -A symbol=value          like append:, but with a separating space
1743          -A define:symbol=value   define symbol to have value
1744          -A clear:symbol          define symbol to be ''
1745          -A define:symbol         define symbol to be 'define'
1746          -A eval:symbol=value     define symbol to be eval of value
1747          -A prepend:symbol=value  prepend value to symbol
1748          -A undef:symbol          define symbol to be 'undef'
1749          -A undef:symbol=         define symbol to be ''
1750        e.g.:  -A prepend:libswanted='cl pthread '
1751               -A ccflags=-DSOME_MACRO
1752   -V : print version number and exit (with a zero status).
1753 EOM
1754         exit 1
1755         ;;
1756 esac
1757
1758 : Sanity checks
1759 case "$fastread$alldone" in
1760 yescont|yesexit) ;;
1761 *)
1762         case "$extractsh" in
1763         true) ;;
1764         *)
1765                 if test ! -t 0; then
1766                         echo "Say 'sh Configure', not 'sh <Configure'"
1767                         exit 1
1768                 fi
1769                 ;;
1770         esac
1771         ;;
1772 esac
1773
1774 exec 4>&1
1775 case "$silent" in
1776 true) exec 1>/dev/null;;
1777 esac
1778
1779 : run the defines and the undefines, if any, but leave the file out there...
1780 touch optdef.sh
1781 . ./optdef.sh
1782 : create the posthint manipulation script and leave the file out there...
1783 touch posthint.sh
1784
1785 : set package name
1786 package='perl5'
1787 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1788 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1789 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1790 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1791 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1792 esac
1793
1794 : Some greps do not return status, grrr.
1795 echo "grimblepritz" >grimble
1796 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1797         contains=contains
1798 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1799         contains=grep
1800 else
1801         contains=contains
1802 fi
1803 rm -f grimble
1804 : the following should work in any shell
1805 case "$contains" in
1806 contains*)
1807         echo " "
1808         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1809         cat >contains <<'EOSS'
1810 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1811 EOSS
1812 chmod +x contains
1813 esac
1814
1815 : Find the path to the source tree
1816 case "$src" in
1817 '') case "$0" in
1818     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1819          case "$src" in
1820          /*)    ;;
1821          .)     ;;
1822          *)     src=`cd ../$src && pwd` ;;
1823          esac
1824          ;;
1825     *)   src='.';;
1826     esac;;
1827 esac
1828 case "$src" in
1829 '')     src=/
1830         rsrc=/
1831         ;;
1832 /*)     rsrc="$src";;
1833 *)      rsrc="../$src";;
1834 esac
1835 if test -f $rsrc/Configure && \
1836         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1837 then
1838    : found it, so we are ok.
1839 else
1840         rsrc=''
1841         for src in . .. ../.. ../../.. ../../../..; do
1842                 if test -f ../$src/Configure && \
1843                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1844                 then
1845                         rsrc=../$src
1846                         break
1847                 fi
1848         done
1849 fi
1850 case "$rsrc" in
1851 '')
1852         cat <<EOM >&4
1853
1854 Sorry, I can't seem to locate the source dir for $package.  Please start
1855 Configure with an explicit path -- i.e. /some/path/Configure.
1856
1857 EOM
1858         exit 1
1859         ;;
1860 ../.)   rsrc='..';;
1861 *)
1862         echo " "
1863         echo "Sources for $package found in \"$src\"." >&4
1864         ;;
1865 esac
1866
1867 : script used to extract .SH files with variable substitutions
1868 cat >extract <<'EOS'
1869 PERL_CONFIG_SH=true
1870 echo "Doing variable substitutions on .SH files..."
1871 if test -f MANIFEST; then
1872         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1873 else
1874         echo "(Looking for .SH files under the source directory.)"
1875         set x `(cd "$src"; find . -name "*.SH" -print)`
1876 fi
1877 shift
1878 case $# in
1879 0) set x `(cd "$src"; echo *.SH)`; shift;;
1880 esac
1881 if test ! -f "$src/$1"; then
1882         shift
1883 fi
1884 mkdir_p='
1885 name=$1;
1886 create="";
1887 while test $name; do
1888         if test ! -d "$name"; then
1889                 create="$name $create";
1890                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1891                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1892         else
1893                 name="";
1894         fi;
1895 done;
1896 for file in $create; do
1897         mkdir $file;
1898 done
1899 '
1900 for file in $*; do
1901         case "$src" in
1902         ".")
1903                 case "$file" in
1904                 */*)
1905                         dir=`expr X$file : 'X\(.*\)/'`
1906                         file=`expr X$file : 'X.*/\(.*\)'`
1907                         (cd "$dir" && . ./$file)
1908                         ;;
1909                 *)
1910                         . ./$file
1911                         ;;
1912                 esac
1913                 ;;
1914         *)
1915                 case "$file" in
1916                 */*)
1917                         dir=`expr X$file : 'X\(.*\)/'`
1918                         file=`expr X$file : 'X.*/\(.*\)'`
1919                         (set x $dir; shift; eval $mkdir_p)
1920                         sh <"$src/$dir/$file"
1921                         ;;
1922                 *)
1923                         sh <"$src/$file"
1924                         ;;
1925                 esac
1926                 ;;
1927         esac
1928 done
1929 if test -f "$src/config_h.SH"; then
1930         if test ! -f config.h; then
1931         : oops, they left it out of MANIFEST, probably, so do it anyway.
1932         . "$src/config_h.SH"
1933         fi
1934 fi
1935 EOS
1936
1937 : extract files and exit if asked to do so
1938 case "$extractsh" in
1939 true)
1940         case "$realsilent" in
1941         true) ;;
1942         *) exec 1>&4;;
1943         esac
1944         case "$config_sh" in
1945         '') config_sh='config.sh';;
1946         esac
1947         echo " "
1948         echo "Fetching answers from $config_sh..."
1949         cd ..
1950         . $config_sh
1951         test "$override" && . ./optdef.sh
1952         echo " "
1953         . UU/extract
1954         rm -rf UU
1955         echo "Extraction done."
1956         exit 0
1957         ;;
1958 esac
1959
1960 : Eunice requires " " instead of "", can you believe it
1961 echo " "
1962 : Here we go...
1963 echo "Beginning of configuration questions for $package."
1964
1965 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1966
1967 : first determine how to suppress newline on echo command
1968 echo " "
1969 echo "Checking echo to see how to suppress newlines..."
1970 (echo "hi there\c" ; echo " ") >.echotmp
1971 if $contains c .echotmp >/dev/null 2>&1 ; then
1972         echo "...using -n."
1973         n='-n'
1974         c=''
1975 else
1976         cat <<'EOM'
1977 ...using \c
1978 EOM
1979         n=''
1980         c='\c'
1981 fi
1982 echo $n "The star should be here-->$c"
1983 echo '*'
1984 rm -f .echotmp
1985
1986 : Now test for existence of everything in MANIFEST
1987 echo " "
1988 if test -f "$rsrc/MANIFEST"; then
1989         echo "First let's make sure your kit is complete.  Checking..." >&4
1990         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1991                 (split -l 50 2>/dev/null || split -50)
1992         rm -f missing
1993         tmppwd=`pwd`
1994         for filelist in x??; do
1995                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1996                         >/dev/null 2>>"$tmppwd/missing")
1997         done
1998         if test -s missing; then
1999                 cat missing >&4
2000                 cat >&4 <<'EOM'
2001
2002 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2003
2004 You have the option of continuing the configuration process, despite the
2005 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2006 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2007 and contact the author (perlbug@perl.org).
2008
2009 EOM
2010                 echo $n "Continue? [n] $c" >&4
2011                 read ans
2012                 case "$ans" in
2013                 y*)
2014                         echo "Continuing..." >&4
2015                         rm -f missing
2016                         ;;
2017                 *)
2018                         echo "ABORTING..." >&4
2019                         kill $$
2020                         ;;
2021                 esac
2022         else
2023                 echo "Looks good..."
2024         fi
2025 else
2026         echo "There is no MANIFEST file.  I hope your kit is complete !"
2027 fi
2028 rm -f missing x??
2029
2030 : Find the appropriate value for a newline for tr
2031 echo " "
2032 if test -n "$DJGPP"; then
2033        trnl='\012'
2034 fi
2035 if test X"$trnl" = X; then
2036         case "`echo foo|tr '\n' x 2>/dev/null`" in
2037         foox) trnl='\n' ;;
2038         esac
2039 fi
2040 if test X"$trnl" = X; then
2041         case "`echo foo|tr '\012' x 2>/dev/null`" in
2042         foox) trnl='\012' ;;
2043         esac
2044 fi
2045 if test X"$trnl" = X; then
2046        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2047        fooxy) trnl='\n\r' ;;
2048        esac
2049 fi
2050 if test X"$trnl" = X; then
2051         cat <<EOM >&2
2052
2053 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2054
2055 EOM
2056         exit 1
2057 fi
2058
2059 : compute the number of columns on the terminal for proper question formatting
2060 case "$COLUMNS" in
2061 '') COLUMNS='80';;
2062 esac
2063
2064 : set up the echo used in my read
2065 myecho="case \"\$xxxm\" in
2066 '') echo $n \"\$rp $c\" >&4;;
2067 *) case \"\$rp\" in
2068         '') echo $n \"[\$xxxm] $c\";;
2069         *)
2070                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2071                         echo \"\$rp\" >&4
2072                         echo $n \"[\$xxxm] $c\" >&4
2073                 else
2074                         echo $n \"\$rp [\$xxxm] $c\" >&4
2075                 fi
2076                 ;;
2077         esac;;
2078 esac"
2079
2080 : now set up to do reads with possible shell escape and default assignment
2081 cat <<EOSC >myread
2082 $startsh
2083 xxxm=\$dflt
2084 $myecho
2085 ans='!'
2086 case "\$fastread" in
2087 yes) case "\$dflt" in
2088         '') ;;
2089         *) ans='';
2090                 case "\$silent-\$rp" in
2091                 true-) ;;
2092                 *) echo " " >&4;;
2093                 esac;;
2094         esac;;
2095 *) case "\$silent" in
2096         true) case "\$rp" in
2097                 '') ans='';;
2098                 esac;;
2099         esac;;
2100 esac
2101 while expr "X\$ans" : "X!" >/dev/null; do
2102         read answ
2103         set x \$xxxm
2104         shift
2105         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2106         case  "\$answ" in
2107         "!")
2108                 sh 1>&4
2109                 echo " "
2110                 $myecho
2111                 ;;
2112         !*)
2113                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2114                 shift
2115                 sh 1>&4 -c "\$*"
2116                 echo " "
2117                 $myecho
2118                 ;;
2119         "\$ans")
2120                 case "\$ans" in
2121                 \\&*)
2122                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2123                         shift
2124                         case "\$1" in
2125                         -d)
2126                                 fastread=yes
2127                                 echo "(OK, I'll run with -d after this question.)" >&4
2128                                 ;;
2129                         -*)
2130                                 echo "*** Sorry, \$1 not supported yet." >&4
2131                                 ;;
2132                         esac
2133                         $myecho
2134                         ans=!
2135                         ;;
2136                 esac;;
2137         *)
2138                 case "\$aok" in
2139                 y)
2140                         echo "*** Substitution done -- please confirm."
2141                         xxxm="\$ans"
2142                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2143                         xxxm="\$ans"
2144                         ans=!
2145                         ;;
2146                 *)
2147                         echo "*** Error -- try again."
2148                         ans=!
2149                         ;;
2150                 esac
2151                 $myecho
2152                 ;;
2153         esac
2154         case "\$ans\$xxxm\$nostick" in
2155         '')
2156                 ans=!
2157                 $myecho
2158                 ;;
2159         esac
2160 done
2161 case "\$ans" in
2162 '') ans="\$xxxm";;
2163 esac
2164 EOSC
2165
2166 : create .config dir to save info across Configure sessions
2167 test -d ../.config || mkdir ../.config
2168 cat >../.config/README <<EOF
2169 This directory created by Configure to save information that should
2170 persist across sessions for $package.
2171
2172 You may safely delete it if you wish.
2173 EOF
2174
2175 : See if we are using a devel version and want that
2176 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2177 case "$usedevel" in
2178 $define|true|[yY]*)
2179     usedevel="$define" ;;
2180 *) case "$xversion" in
2181    *[13579])
2182         cat >&4 <<EOH
2183 *** WHOA THERE!!! ***
2184
2185     This is an UNSTABLE DEVELOPMENT release.
2186     The version of this $package distribution is $xversion, that is, odd,
2187     (as opposed to even) and that signifies a development release.
2188     If you want a maintenance release, you want an even-numbered version.
2189
2190     Do ***NOT*** install this into production use.
2191     Data corruption and crashes are possible.
2192
2193     It is most seriously suggested that you do not continue any further
2194     unless you want to help in developing and debugging Perl.
2195
2196     If you *still* want to build perl, you can answer 'y' now,
2197     or pass -Dusedevel to Configure.
2198
2199 EOH
2200         rp='Do you really want to continue?'
2201         dflt='n'
2202         . ./myread
2203         case "$ans" in
2204         [yY]) echo >&4 "Okay, continuing."
2205               usedevel="$define" ;;
2206         *) echo >&4 "Okay, bye."
2207            exit 1
2208            ;;
2209         esac
2210         ;;
2211     esac
2212     usedevel="$undef"
2213     ;;
2214 esac
2215 case "$usedevel" in
2216 $define|true|[yY]*)
2217         case "$versiononly" in
2218         '') versiononly="$define" ;;
2219         esac
2220         case "$installusrbinperl" in
2221         '') installusrbinperl="$undef" ;;
2222         esac
2223         ;;
2224 esac
2225
2226 : general instructions
2227 needman=true
2228 firsttime=true
2229 user=`(logname) 2>/dev/null`
2230 case "$user" in
2231 '') user=`whoami 2>&1`;;
2232 esac
2233 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2234         firsttime=false
2235         echo " "
2236         rp='Would you like to see the instructions?'
2237         dflt=n
2238         . ./myread
2239         case "$ans" in
2240         [yY]*) ;;
2241         *) needman=false;;
2242         esac
2243 fi
2244 if $needman; then
2245         cat <<EOH
2246
2247 This installation shell script will examine your system and ask you questions
2248 to determine how the perl5 package should be installed. If you get
2249 stuck on a question, you may use a ! shell escape to start a subshell or
2250 execute a command.  Many of the questions will have default answers in square
2251 brackets; typing carriage return will give you the default.
2252
2253 On some of the questions which ask for file or directory names you are allowed
2254 to use the ~name construct to specify the login directory belonging to "name",
2255 even if you don't have a shell which knows about that.  Questions where this is
2256 allowed will be marked "(~name ok)".
2257
2258 EOH
2259         rp=''
2260         dflt='Type carriage return to continue'
2261         . ./myread
2262         cat <<'EOH'
2263
2264 The prompter used in this script allows you to use shell variables and
2265 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2266 in the default answer, as if the default line was a set of arguments given to a
2267 script shell.  This means you may also use $* to repeat the whole default line,
2268 so you do not have to re-type everything to add something to the default.
2269
2270 Every time there is a substitution, you will have to confirm.  If there is an
2271 error (e.g. an unmatched backtick), the default answer will remain unchanged
2272 and you will be prompted again.
2273
2274 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2275 the questions and use the computed defaults (or the previous answers if there
2276 was already a config.sh file). Type 'Configure -h' for a list of options.
2277 You may also start interactively and then answer '& -d' at any prompt to turn
2278 on the non-interactive behaviour for the remainder of the execution.
2279
2280 EOH
2281         . ./myread
2282         cat <<EOH
2283
2284 Much effort has been expended to ensure that this shell script will run on any
2285 Unix system.  If despite that it blows up on yours, your best bet is to edit
2286 Configure and run it again.  If you can't run Configure for some reason,
2287 you'll have to generate a config.sh file by hand.  Whatever problems you
2288 have, let me (perlbug@perl.org) know how I blew it.
2289
2290 This installation script affects things in two ways:
2291
2292 1) it may do direct variable substitutions on some of the files included
2293    in this kit.
2294 2) it builds a config.h file for inclusion in C programs.  You may edit
2295    any of these files as the need arises after running this script.
2296
2297 If you make a mistake on a question, there is no easy way to back up to it
2298 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2299 files.  Configure will offer to let you do this before it runs the SH files.
2300
2301 EOH
2302         dflt='Type carriage return to continue'
2303         . ./myread
2304         case "$firsttime" in
2305         true) echo $user >>../.config/instruct;;
2306         esac
2307 fi
2308
2309 : find out where common programs are
2310 echo " "
2311 echo "Locating common programs..." >&4
2312 cat <<EOSC >loc
2313 $startsh
2314 case \$# in
2315 0) exit 1;;
2316 esac
2317 thing=\$1
2318 shift
2319 dflt=\$1
2320 shift
2321 for dir in \$*; do
2322         case "\$thing" in
2323         .)
2324         if test -d \$dir/\$thing; then
2325                 echo \$dir
2326                 exit 0
2327         fi
2328         ;;
2329         *)
2330         for thisthing in \$dir/\$thing; do
2331                 : just loop through to pick last item
2332         done
2333         if test -f \$thisthing; then
2334                 echo \$thisthing
2335                 exit 0
2336         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2337                 echo \$thisthing
2338                 exit 0
2339         elif test -f \$dir/\$thing.exe; then
2340                 if test -n "$DJGPP"; then
2341                         echo \$dir/\$thing.exe
2342                 elif test "$eunicefix" != ":"; then
2343                         : on Eunice apparently
2344                         echo \$dir/\$thing
2345                 fi
2346                 exit 0
2347         fi
2348         ;;
2349         esac
2350 done
2351 echo \$dflt
2352 exit 1
2353 EOSC
2354 chmod +x loc
2355 $eunicefix loc
2356 loclist="
2357 awk
2358 cat
2359 chmod
2360 comm
2361 cp
2362 echo
2363 expr
2364 grep
2365 ls
2366 mkdir
2367 rm
2368 sed
2369 sort
2370 touch
2371 tr
2372 uniq
2373 "
2374 trylist="
2375 ar
2376 bison
2377 byacc
2378 cpp
2379 csh
2380 date
2381 egrep
2382 gmake
2383 gzip
2384 less
2385 ln
2386 make
2387 more
2388 nm
2389 nroff
2390 perl
2391 pg
2392 test
2393 uname
2394 zip
2395 "
2396 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2397 pth="$pth /lib /usr/lib"
2398 for file in $loclist; do
2399         eval xxx=\$$file
2400         case "$xxx" in
2401         /*|?:[\\/]*)
2402                 if test -f "$xxx"; then
2403                         : ok
2404                 else
2405                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2406                         xxx=`./loc $file $file $pth`
2407                 fi
2408                 ;;
2409         '') xxx=`./loc $file $file $pth`;;
2410         *) xxx=`./loc $xxx $xxx $pth`;;
2411         esac
2412         eval $file=$xxx$_exe
2413         eval _$file=$xxx
2414         case "$xxx" in
2415         /*)
2416                 echo $file is in $xxx.
2417                 ;;
2418         ?:[\\/]*)
2419                 echo $file is in $xxx.
2420                 ;;
2421         *)
2422                 echo "I don't know where '$file' is, and my life depends on it." >&4
2423                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2424                 exit 1
2425                 ;;
2426         esac
2427 done
2428 echo " "
2429 echo "Don't worry if any of the following aren't found..."
2430 say=offhand
2431 for file in $trylist; do
2432         eval xxx=\$$file
2433         case "$xxx" in
2434         /*|?:[\\/]*)
2435                 if test -f "$xxx"; then
2436                         : ok
2437                 else
2438                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2439                         xxx=`./loc $file $file $pth`
2440                 fi
2441                 ;;
2442         '') xxx=`./loc $file $file $pth`;;
2443         *) xxx=`./loc $xxx $xxx $pth`;;
2444         esac
2445         eval $file=$xxx$_exe
2446         eval _$file=$xxx
2447         case "$xxx" in
2448         /*)
2449                 echo $file is in $xxx.
2450                 ;;
2451         ?:[\\/]*)
2452                 echo $file is in $xxx.
2453                 ;;
2454         *)
2455                 echo "I don't see $file out there, $say."
2456                 say=either
2457                 ;;
2458         esac
2459 done
2460 case "$egrep" in
2461 egrep)
2462         echo "Substituting grep for egrep."
2463         egrep=$grep
2464         _egrep=$grep
2465         ;;
2466 esac
2467 case "$less" in
2468 '')     ;;
2469 *)      if $less -R </dev/null >/dev/null; then
2470                echo "Substituting less -R for less."
2471                less="$less -R"
2472                _less=$less
2473         fi
2474         ;;
2475 esac
2476 case "$ln" in
2477 ln)
2478         echo "Substituting cp for ln."
2479         ln=$cp
2480         _ln=$cp
2481         ;;
2482 esac
2483 case "$make" in
2484 make)
2485         case "$gmake" in
2486         gmake)
2487         echo "I can't find make or gmake, and my life depends on it." >&4
2488         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2489         exit 1
2490         ;;
2491         esac
2492         ;;
2493 esac
2494 case "$gmake" in
2495 gmake)  ;;
2496 *)      # We can't have osname yet.
2497         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2498                 # Assume that gmake, if found, is definitely GNU make
2499                 # and prefer it over the system make.
2500                 echo "Substituting gmake for make."
2501                 make=$gmake
2502                 _make=$gmake
2503         fi
2504         ;;
2505 esac
2506 case "$test" in
2507 test)
2508         echo "Hopefully test is built into your sh."
2509         ;;
2510 *)
2511         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2512                 echo "Using the test built into your sh."
2513                 test=test
2514                 _test=test
2515         fi
2516         ;;
2517 esac
2518 case "$echo" in
2519 echo)
2520         echo "Hopefully echo is built into your sh."
2521         ;;
2522 '') ;;
2523 *)
2524         echo " "
2525 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2526         $echo $n "hi there$c" >foo1
2527         echo $n "hi there$c" >foo2
2528         if cmp foo1 foo2 >/dev/null 2>&1; then
2529                 echo "They are compatible.  In fact, they may be identical."
2530         else
2531                 case "$n" in
2532                 '-n') n='' c='\c';;
2533                 *) n='-n' c='';;
2534                 esac
2535                 cat <<FOO
2536 They are not compatible!  You are probably running ksh on a non-USG system.
2537 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2538 have echo built in and we may have to run some Bourne shell scripts.  That
2539 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2540
2541 FOO
2542                 $echo $n "The star should be here-->$c"
2543                 $echo "*"
2544         fi
2545         $rm -f foo1 foo2
2546         ;;
2547 esac
2548
2549 # This question was auctioned at YAPC::Europe-2007 in Vienna
2550 # I never promised you could answer it. I only auctioned the question.
2551 cat <<FOO
2552 The following message is sponsored by
2553
2554   Dresden.pm<--The stars should be here.
2555
2556 Dear Perl user, system administrator or package
2557 maintainer, the Perl community sends greetings to
2558 you. Do you (emblematical) greet back [Y/n]? n
2559
2560 FOO
2561
2562 : Check what type of C compiler we use
2563 cat <<EOS >trygcc
2564 $startsh
2565 EOS
2566 cat <<'EOSC' >>trygcc
2567 case "$cc" in
2568 '') ;;
2569 *)  $rm -f try try.*
2570     $cat >try.c <<EOM
2571 int main(int argc, char *argv[]) {
2572   return 0;
2573 }
2574 EOM
2575     if $cc -o try $ccflags $ldflags try.c; then
2576        :
2577     else
2578         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2579         despair=yes
2580         trygcc=yes
2581         case "$cc" in
2582         *gcc*) trygcc=no ;;
2583         esac
2584         # Skip this test because it gives a false match on output like:
2585         #    ./trygcc: line 23: cc: command not found
2586         # case "`$cc -v -c try.c 2>&1`" in
2587         # *gcc*) trygcc=no ;;
2588         # esac
2589         if $test X"$trygcc" = Xyes; then
2590             if gcc -o try -c try.c; then
2591                 echo " "
2592                 echo "You seem to have a working gcc, though." >&4
2593                 # Switching compilers may undo the work of hints files.
2594                 # The most common problem is -D_REENTRANT for threads.
2595                 # This heuristic catches that case, but gets false positives
2596                 # if -Dusethreads was not actually specified.  Better to
2597                 # bail out here with a useful message than fail 
2598                 # mysteriously later. Should we perhaps just try to
2599                 # re-invoke Configure -Dcc=gcc config_args ?
2600                 if $test -f usethreads.cbu; then
2601                         $cat >&4 <<EOM 
2602
2603 *** However, any setting of the C compiler flags (e.g. for thread support)
2604 *** will be lost.  It may be necessary for you to restart Configure and
2605 *** add -Dcc=gcc to your Configure command line.
2606
2607 EOM
2608                         rp="Would you like to go ahead and try gcc anyway?"
2609                         dflt=n
2610                 else
2611                         rp="Would you like to use it?"
2612                         dflt=y
2613                 fi
2614                 if $test -f myread; then
2615                     . ./myread
2616                 else
2617                     if $test -f UU/myread; then
2618                         . ./UU/myread
2619                     else
2620                         echo "Cannot find myread, sorry.  Aborting." >&2
2621                         exit 1
2622                     fi
2623                 fi  
2624                 case "$ans" in
2625                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2626                 esac
2627             fi
2628         fi
2629     fi
2630     $rm -f try try.*
2631     ;;
2632 esac
2633 EOSC
2634
2635 cat <<EOS >checkcc
2636 $startsh
2637 EOS
2638 cat <<'EOSC' >>checkcc
2639 case "$cc" in        
2640 '') ;;
2641 *)  $rm -f try try.*              
2642     $cat >try.c <<EOM
2643 int main(int argc, char *argv[]) {
2644   return 0;
2645 }
2646 EOM
2647     if $cc -o try $ccflags $ldflags try.c; then
2648        :
2649     else
2650         if $test X"$despair" = Xyes; then
2651            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2652         fi
2653         $cat >&4 <<EOM         
2654 You need to find a working C compiler.
2655 Either (purchase and) install the C compiler supplied by your OS vendor,
2656 or for a free C compiler try http://gcc.gnu.org/
2657 I cannot continue any further, aborting.
2658 EOM
2659         exit 1
2660     fi
2661     $rm -f try try.*
2662     ;;
2663 esac
2664 EOSC
2665
2666 : determine whether symbolic links are supported
2667 echo " "
2668 $touch blurfl
2669 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2670         echo "Symbolic links are supported." >&4
2671         lns="$ln -s"
2672 else
2673         echo "Symbolic links are NOT supported." >&4
2674         lns="$ln"
2675 fi
2676 $rm -f blurfl sym
2677
2678 : determine whether symbolic links are supported
2679 echo " "
2680 case "$lns" in
2681 *"ln"*" -s")
2682         echo "Checking how to test for symbolic links..." >&4
2683         $lns blurfl sym
2684         if $test "X$issymlink" = X; then
2685                 case "$newsh" in
2686                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2687                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2688                 esac
2689                 if test $? = 0; then
2690                         issymlink="test -h"
2691                 else
2692                         echo "Your builtin 'test -h' may be broken." >&4
2693                         case "$test" in
2694                         /*)     ;;
2695                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2696                                 for p in $pth
2697                                 do
2698                                         if test -f "$p/$test"; then
2699                                                 test="$p/$test"
2700                                                 break
2701                                         fi
2702                                 done
2703                                 ;;
2704                         esac
2705                         case "$test" in
2706                         /*)
2707                                 echo "Trying external '$test -h'." >&4
2708                                 issymlink="$test -h"
2709                                 if $test ! -h sym >/dev/null 2>&1; then
2710                                         echo "External '$test -h' is broken, too." >&4
2711                                         issymlink=''
2712                                 fi
2713                                 ;;
2714                         *)      issymlink='' ;;
2715                         esac
2716                 fi
2717         fi
2718         if $test "X$issymlink" = X; then
2719                 if $test -L sym 2>/dev/null; then
2720                         issymlink="$test -L"
2721                         echo "The builtin '$test -L' worked." >&4
2722                 fi
2723         fi
2724         if $test "X$issymlink" != X; then
2725                 echo "You can test for symbolic links with '$issymlink'." >&4
2726         else
2727                 echo "I do not know how you can test for symbolic links." >&4
2728         fi
2729         $rm -f blurfl sym
2730         ;;
2731 *)      echo "No symbolic links, so not testing for their testing..." >&4
2732         ;;
2733 esac
2734 echo " "
2735
2736 : Make symlinks util
2737 case "$mksymlinks" in
2738 $define|true|[yY]*)
2739         case "$src" in
2740         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2741                 exit 1
2742                 ;;
2743         *)      case "$lns:$issymlink" in
2744                 *"ln"*" -s:"*"test -"?)
2745                         echo "Creating the symbolic links..." >&4
2746                         echo "(First creating the subdirectories...)" >&4
2747                         cd ..
2748                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2749                                 read directory
2750                                 test -z "$directory" && break
2751                                 mkdir -p $directory
2752                         done
2753                         # Sanity check 1.
2754                         if test ! -d t/base; then
2755                                 echo "Failed to create the subdirectories.  Aborting." >&4
2756                                 exit 1
2757                         fi
2758                         echo "(Then creating the symlinks...)" >&4
2759                         awk '{print $1}' $src/MANIFEST | while true; do
2760                                 read filename
2761                                 test -z "$filename" && break
2762                                 if test -f $filename; then
2763                                         if $issymlink $filename; then
2764                                                 rm -f $filename
2765                                         fi
2766                                 fi
2767                                 if test -f $filename; then
2768                                         echo "$filename already exists, not symlinking."
2769                                 else
2770                                         ln -s $src/$filename $filename
2771                                 fi
2772                         done
2773                         # Sanity check 2.
2774                         if test ! -f t/base/lex.t; then
2775                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2776                                 exit 1
2777                         fi
2778                         cd UU
2779                         ;;
2780                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2781                         ;;
2782                 esac
2783                 ;;
2784         esac
2785         ;;
2786 esac
2787
2788 : Check for Cross-Compilation
2789 case "$usecrosscompile" in
2790 $define|true|[yY]*)
2791         $echo "Cross-compiling..."
2792         croak=''
2793         case "$cc" in
2794         *-*-gcc) # A cross-compiling gcc, probably.
2795             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2796             ar=$targetarch-ar
2797             # leave out ld, choosing it is more complex
2798             nm=$targetarch-nm
2799             ranlib=$targetarch-ranlib
2800             $echo 'extern int foo;' > try.c
2801             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2802             shift
2803             if $test $# -gt 0; then
2804                 incpth="$incpth $*"
2805                 incpth="`$echo $incpth|$sed 's/^ //'`"
2806                 echo "Guessing incpth '$incpth'." >&4
2807                 for i in $*; do
2808                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2809                     if $test -d $j; then
2810                         libpth="$libpth $j"
2811                     fi
2812                 done   
2813                 libpth="`$echo $libpth|$sed 's/^ //'`"
2814                 echo "Guessing libpth '$libpth'." >&4
2815             fi
2816             $rm -f try.c
2817             ;;
2818         esac
2819         case "$targetarch" in
2820         '') echo "Targetarch not defined." >&4; croak=y ;;
2821         *)  echo "Using targetarch $targetarch." >&4 ;;
2822         esac
2823         case "$incpth" in
2824         '') echo "Incpth not defined." >&4; croak=y ;;
2825         *)  echo "Using incpth '$incpth'." >&4 ;;
2826         esac
2827         case "$libpth" in
2828         '') echo "Libpth not defined." >&4; croak=y ;;
2829         *)  echo "Using libpth '$libpth'." >&4 ;;
2830         esac
2831         case "$usrinc" in
2832         '') for i in $incpth; do
2833                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2834                     usrinc=$i
2835                     echo "Guessing usrinc $usrinc." >&4
2836                     break
2837                 fi
2838             done
2839             case "$usrinc" in
2840             '') echo "Usrinc not defined." >&4; croak=y ;;
2841             esac
2842             ;;
2843         *)  echo "Using usrinc $usrinc." >&4 ;;
2844         esac
2845         case "$targethost" in
2846         '') echo "Targethost not defined." >&4; croak=y ;;
2847         *)  echo "Using targethost $targethost." >&4
2848         esac
2849         locincpth=' '
2850         loclibpth=' '
2851         case "$croak" in
2852         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2853         esac
2854         case "$src" in
2855         /*) run=$src/Cross/run
2856             targetmkdir=$src/Cross/mkdir
2857             to=$src/Cross/to
2858             from=$src/Cross/from
2859             ;;
2860         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2861             run=$pwd/Cross/run
2862             targetmkdir=$pwd/Cross/mkdir
2863             to=$pwd/Cross/to
2864             from=$pwd/Cross/from
2865             ;;
2866         esac
2867         case "$targetrun" in
2868         '') targetrun=ssh ;;
2869         esac
2870         case "$targetto" in
2871         '') targetto=scp ;;
2872         esac
2873         case "$targetfrom" in
2874         '') targetfrom=scp ;;
2875         esac
2876         run=$run-$targetrun
2877         to=$to-$targetto
2878         from=$from-$targetfrom
2879         case "$targetdir" in
2880         '')  targetdir=/tmp
2881              echo "Guessing targetdir $targetdir." >&4
2882              ;;
2883         esac
2884         case "$targetuser" in
2885         '')  targetuser=root
2886              echo "Guessing targetuser $targetuser." >&4
2887              ;;
2888         esac
2889         case "$targetfrom" in
2890         scp)    q=-q ;;
2891         *)      q='' ;;
2892         esac
2893         case "$targetrun" in
2894         ssh|rsh)
2895             cat >$run <<EOF
2896 #!/bin/sh
2897 case "\$1" in
2898 -cwd)
2899   shift
2900   cwd=\$1
2901   shift
2902   ;;
2903 esac
2904 case "\$cwd" in
2905 '') cwd=$targetdir ;;
2906 esac
2907 exe=\$1
2908 shift
2909 if $test ! -f \$exe.xok; then
2910   $to \$exe
2911   $touch \$exe.xok
2912 fi
2913 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2914 EOF
2915             ;;
2916         *)  echo "Unknown targetrun '$targetrun'" >&4
2917             exit 1
2918             ;;
2919         esac
2920         case "$targetmkdir" in
2921         */Cross/mkdir)
2922             cat >$targetmkdir <<EOF
2923 #!/bin/sh
2924 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2925 EOF
2926             $chmod a+rx $targetmkdir
2927             ;;
2928         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2929             exit 1
2930             ;;
2931         esac
2932         case "$targetto" in
2933         scp|rcp)
2934             cat >$to <<EOF
2935 #!/bin/sh
2936 for f in \$@
2937 do
2938   case "\$f" in
2939   /*)
2940     $targetmkdir \`dirname \$f\`
2941     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2942     ;;
2943   *)
2944     $targetmkdir $targetdir/\`dirname \$f\`
2945     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2946     ;;
2947   esac
2948 done
2949 exit 0
2950 EOF
2951             ;;
2952         cp) cat >$to <<EOF
2953 #!/bin/sh
2954 for f in \$@
2955 do
2956   case "\$f" in
2957   /*)
2958     $mkdir -p $targetdir/\`dirname \$f\`
2959     $cp \$f $targetdir/\$f || exit 1
2960     ;;
2961   *)
2962     $targetmkdir $targetdir/\`dirname \$f\`
2963     $cp \$f $targetdir/\$f || exit 1
2964     ;;
2965   esac
2966 done
2967 exit 0
2968 EOF
2969             ;;
2970         *)  echo "Unknown targetto '$targetto'" >&4
2971             exit 1
2972             ;;
2973         esac
2974         case "$targetfrom" in
2975         scp|rcp)
2976           cat >$from <<EOF
2977 #!/bin/sh
2978 for f in \$@
2979 do
2980   $rm -f \$f
2981   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2982 done
2983 exit 0
2984 EOF
2985             ;;
2986         cp) cat >$from <<EOF
2987 #!/bin/sh
2988 for f in \$@
2989 do
2990   $rm -f \$f
2991   cp $targetdir/\$f . || exit 1
2992 done
2993 exit 0
2994 EOF
2995             ;;
2996         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2997             exit 1
2998             ;;
2999         esac
3000         if $test ! -f $run; then
3001             echo "Target 'run' script '$run' not found." >&4
3002         else
3003             $chmod a+rx $run
3004         fi
3005         if $test ! -f $to; then
3006             echo "Target 'to' script '$to' not found." >&4
3007         else
3008             $chmod a+rx $to
3009         fi
3010         if $test ! -f $from; then
3011             echo "Target 'from' script '$from' not found." >&4
3012         else
3013             $chmod a+rx $from
3014         fi
3015         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3016             exit 1
3017         fi
3018         cat >&4 <<EOF
3019 Using '$run' for remote execution,
3020 and '$from' and '$to'
3021 for remote file transfer.
3022 EOF
3023         ;;
3024 *)      run=''
3025         to=:
3026         from=:
3027         usecrosscompile='undef'
3028         targetarch=''
3029         ;;
3030 esac
3031
3032 : see whether [:lower:] and [:upper:] are supported character classes
3033 echo " "
3034 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3035 ABYZ)
3036         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3037         up='[:upper:]'
3038         low='[:lower:]'
3039         ;;
3040 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3041         # (0xd9 and 0xe2), therefore that is a nice testing point.
3042         if test "X$up" = X -o "X$low" = X; then
3043             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3044             rs) up='[A-Z]'
3045                 low='[a-z]'
3046                 ;;
3047             esac
3048         fi
3049         if test "X$up" = X -o "X$low" = X; then
3050             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3051             rs) up='A-Z'
3052                 low='a-z'
3053                 ;;
3054             esac
3055         fi
3056         if test "X$up" = X -o "X$low" = X; then
3057             case "`echo RS | od -x 2>/dev/null`" in
3058             *D9E2*|*d9e2*)
3059                 echo "Hey, this might be EBCDIC." >&4
3060                 if test "X$up" = X -o "X$low" = X; then
3061                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3062                     rs) up='[A-IJ-RS-Z]'
3063                         low='[a-ij-rs-z]'
3064                         ;;
3065                     esac
3066                 fi
3067                 if test "X$up" = X -o "X$low" = X; then
3068                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3069                     rs) up='A-IJ-RS-Z'
3070                         low='a-ij-rs-z'
3071                         ;;
3072                     esac
3073                 fi
3074                 ;;
3075             esac
3076         fi
3077 esac
3078 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3079 rs)
3080     echo "Using $up and $low to convert case." >&4
3081     ;;
3082 *)
3083     echo "I don't know how to translate letters from upper to lower case." >&4
3084     echo "Your tr is not acting any way I know of." >&4
3085     exit 1
3086     ;;
3087 esac
3088 : set up the translation script tr, must be called with ./tr of course
3089 cat >tr <<EOSC
3090 $startsh
3091 case "\$1\$2" in
3092 '[A-Z][a-z]') exec $tr '$up' '$low';;
3093 '[a-z][A-Z]') exec $tr '$low' '$up';;
3094 esac
3095 exec $tr "\$@"
3096 EOSC
3097 chmod +x tr
3098 $eunicefix tr
3099
3100 : Try to determine whether config.sh was made on this system
3101 case "$config_sh" in
3102 '')
3103 myuname=`$uname -a 2>/dev/null`
3104 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3105 # Downcase everything to avoid ambiguity.
3106 # Remove slashes and single quotes so we can use parts of this in
3107 # directory and file names.
3108 # Remove newlines so myuname is sane to use elsewhere.
3109 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3110 # because the A-Z/a-z are not consecutive.
3111 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3112         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3113 newmyuname="$myuname"
3114 dflt=n
3115 case "$knowitall" in
3116 '')
3117         if test -f ../config.sh; then
3118                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3119                         eval "`grep myuname= ../config.sh`"
3120                 fi
3121                 if test "X$myuname" = "X$newmyuname"; then
3122                         dflt=y
3123                 fi
3124         fi
3125         ;;
3126 *) dflt=y;;
3127 esac
3128
3129 : Get old answers from old config file if Configure was run on the
3130 : same system, otherwise use the hints.
3131 hint=default
3132 cd ..
3133 if test -f config.sh; then
3134         echo " "
3135         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3136         . UU/myread
3137         case "$ans" in
3138         n*|N*) echo "OK, I'll ignore it."
3139                 mv config.sh config.sh.old
3140                 myuname="$newmyuname"
3141                 ;;
3142         *)  echo "Fetching default answers from your old config.sh file..." >&4
3143                 tmp_n="$n"
3144                 tmp_c="$c"
3145                 tmp_sh="$sh"
3146                 . ./config.sh
3147                 cp config.sh UU
3148                 n="$tmp_n"
3149                 c="$tmp_c"
3150                 : Older versions did not always set $sh.  Catch re-use of such
3151                 : an old config.sh.
3152                 case "$sh" in
3153                 '') sh="$tmp_sh" ;;
3154                 esac
3155                 hint=previous
3156                 ;;
3157         esac
3158 fi
3159 . ./UU/checkcc
3160 if test ! -f config.sh; then
3161         $cat <<EOM
3162
3163 First time through, eh?  I have some defaults handy for some systems
3164 that need some extra help getting the Configure answers right:
3165
3166 EOM
3167         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3168         dflt=''
3169         : Half the following guesses are probably wrong... If you have better
3170         : tests or hints, please send them to perlbug@perl.org
3171         : The metaconfig authors would also appreciate a copy...
3172         $test -f /irix && osname=irix
3173         $test -f /xenix && osname=sco_xenix
3174         $test -f /dynix && osname=dynix
3175         $test -f /dnix && osname=dnix
3176         $test -f /lynx.os && osname=lynxos
3177         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3178         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3179         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3180         $test -f /bin/mips && /bin/mips && osname=mips
3181         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3182                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3183         $test -d /usr/apollo/bin && osname=apollo
3184         $test -f /etc/saf/_sactab && osname=svr4
3185         $test -d /usr/include/minix && osname=minix
3186         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3187         if $test -d /MachTen -o -d /MachTen_Folder; then
3188                 osname=machten
3189                 if $test -x /sbin/version; then
3190                         osvers=`/sbin/version | $awk '{print $2}' |
3191                         $sed -e 's/[A-Za-z]$//'`
3192                 elif $test -x /usr/etc/version; then
3193                         osvers=`/usr/etc/version | $awk '{print $2}' |
3194                         $sed -e 's/[A-Za-z]$//'`
3195                 else
3196                         osvers="$2.$3"
3197                 fi
3198         fi
3199
3200         $test -f /sys/posix.dll &&
3201                 $test -f /usr/bin/what &&
3202                 set X `/usr/bin/what /sys/posix.dll` &&
3203                 $test "$3" = UWIN &&
3204                 osname=uwin &&
3205                 osvers="$5"
3206
3207         if $test -f $uname; then
3208                 set X $myuname
3209                 shift
3210
3211                 case "$5" in
3212                 fps*) osname=fps ;;
3213                 mips*)
3214                         case "$4" in
3215                         umips) osname=umips ;;
3216                         *) osname=mips ;;
3217                         esac;;
3218                 [23]100) osname=mips ;;
3219                 next*) osname=next ;;
3220                 i386*)
3221                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3222                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3223                                 osname='sco'
3224                                 osvers=$tmp
3225                         elif $test -f /etc/kconfig; then
3226                                 osname=isc
3227                                 if test "$lns" = "$ln -s"; then
3228                                         osvers=4
3229                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3230                                         osvers=3
3231                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3232                                         osvers=2
3233                                 fi
3234                         fi
3235                         tmp=''
3236                         ;;
3237                 pc*)
3238                         if test -n "$DJGPP"; then
3239                                 osname=dos
3240                                 osvers=djgpp
3241                         fi
3242                         ;;
3243                 esac
3244
3245                 case "$1" in
3246                 aix) osname=aix
3247                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3248                         case "$tmp" in
3249                         # oslevel can fail with:
3250                         # oslevel: Unable to acquire lock.
3251                         *not\ found) osvers="$4"."$3" ;;
3252                         '<3240'|'<>3240') osvers=3.2.0 ;;
3253                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3254                         '=3250'|'>3250') osvers=3.2.5 ;;
3255                         *) osvers=$tmp;;
3256                         esac
3257                         ;;
3258                 bsd386) osname=bsd386
3259                         osvers=`$uname -r`
3260                         ;;
3261                 cygwin*) osname=cygwin
3262                         osvers="$3"
3263                         ;;
3264                 *dc.osx) osname=dcosx
3265                         osvers="$3"
3266                         ;;
3267                 dnix) osname=dnix
3268                         osvers="$3"
3269                         ;;
3270                 domainos) osname=apollo
3271                         osvers="$3"
3272                         ;;
3273                 dgux)   osname=dgux
3274                         osvers="$3"
3275                         ;;
3276                 dragonfly) osname=dragonfly
3277                         osvers="$3"
3278                         ;;
3279                 dynixptx*) osname=dynixptx
3280                         osvers=`echo "$4"|sed 's/^v//'`
3281                         ;;
3282                 freebsd) osname=freebsd
3283                         osvers="$3" ;;
3284                 genix)  osname=genix ;;
3285                 gnu)    osname=gnu
3286                         osvers="$3" ;;
3287                 hp*)    osname=hpux
3288                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3289                         ;;
3290                 irix*)  osname=irix
3291                         case "$3" in
3292                         4*) osvers=4 ;;
3293                         5*) osvers=5 ;;
3294                         *)      osvers="$3" ;;
3295                         esac
3296                         ;;
3297                 linux)  osname=linux
3298                         case "$3" in
3299                         *)      osvers="$3" ;;
3300                         esac
3301                         ;;
3302                 MiNT)   osname=mint
3303                         ;;
3304                 netbsd*) osname=netbsd
3305                         osvers="$3"
3306                         ;;
3307                 news-os) osvers="$3"
3308                         case "$3" in
3309                         4*) osname=newsos4 ;;
3310                         *) osname=newsos ;;
3311                         esac
3312                         ;;
3313                 next*) osname=next ;;
3314                 nonstop-ux) osname=nonstopux ;;
3315                 openbsd) osname=openbsd
3316                         osvers="$3"
3317                         ;;
3318                 os2)    osname=os2
3319                         osvers="$4"
3320                         ;;
3321                 POSIX-BC | posix-bc ) osname=posix-bc
3322                         osvers="$3"
3323                         ;;
3324                 powerux | power_ux | powermax_os | powermaxos | \
3325                 powerunix | power_unix) osname=powerux
3326                         osvers="$3"
3327                         ;;
3328                 qnx) osname=qnx
3329                         osvers="$4"
3330                         ;;
3331                 solaris) osname=solaris
3332                         case "$3" in
3333                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3334                         *)      osvers="$3" ;;
3335                         esac
3336                         ;;
3337                 sunos) osname=sunos
3338                         case "$3" in
3339                         5*) osname=solaris
3340                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3341                         *)      osvers="$3" ;;
3342                         esac
3343                         ;;
3344                 titanos) osname=titanos
3345                         case "$3" in
3346                         1*) osvers=1 ;;
3347                         2*) osvers=2 ;;
3348                         3*) osvers=3 ;;
3349                         4*) osvers=4 ;;
3350                         *)      osvers="$3" ;;
3351                         esac
3352                         ;;
3353                 ultrix) osname=ultrix
3354                         osvers="$3"
3355                         ;;
3356                 osf1|mls+)      case "$5" in
3357                                 alpha)
3358                                         osname=dec_osf
3359                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3360                                         case "$osvers" in
3361                                         [1-9].[0-9]*) ;;
3362                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3363                                         esac
3364                                         ;;
3365                         hp*)    osname=hp_osf1  ;;
3366                         mips)   osname=mips_osf1 ;;
3367                         esac
3368                         ;;
3369                 # UnixWare 7.1.2 is known as Open UNIX 8
3370                 openunix|unixware) osname=svr5
3371                         osvers="$4"
3372                         ;;
3373                 uts)    osname=uts
3374                         osvers="$3"
3375                         ;;
3376                 vos) osvers="$3"
3377                         ;;
3378                 $2) case "$osname" in
3379                         *isc*) ;;
3380                         *freebsd*) ;;
3381                         svr*)
3382                                 : svr4.x or possibly later
3383                                 case "svr$3" in
3384                                 ${osname}*)
3385                                         osname=svr$3
3386                                         osvers=$4
3387                                         ;;
3388                                 esac
3389                                 case "$osname" in
3390                                 svr4.0)
3391                                         : Check for ESIX
3392                                         if test -f /stand/boot ; then
3393                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3394                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3395                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3396                                                         if test -n "$isesix"; then
3397                                                                 osname=esix4
3398                                                         fi
3399                                                 fi
3400                                         fi
3401                                         ;;
3402                                 esac
3403                                 ;;
3404                         *)      if test -f /etc/systemid; then
3405                                         osname=sco
3406                                         set `echo $3 | $sed 's/\./ /g'` $4
3407                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3408                                                 osvers=$1.$2.$3
3409                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3410                                                 osvers=$1.$2
3411                                         elif $test -f $src/hints/sco_$1.sh; then
3412                                                 osvers=$1
3413                                         fi
3414                                 else
3415                                         case "$osname" in
3416                                         '') : Still unknown.  Probably a generic Sys V.
3417                                                 osname="sysv"
3418                                                 osvers="$3"
3419                                                 ;;
3420                                         esac
3421                                 fi
3422                                 ;;
3423                         esac
3424                         ;;
3425                 *)      case "$osname" in
3426                         '') : Still unknown.  Probably a generic BSD.
3427                                 osname="$1"
3428                                 osvers="$3"
3429                                 ;;
3430                         esac
3431                         ;;
3432                 esac
3433         else
3434                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3435                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3436                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3437                                 osname=news_os
3438                         fi
3439                         $rm -f UU/kernel.what
3440                 elif test -d c:/. -o -n "$is_os2" ; then
3441                         set X $myuname
3442                         osname=os2
3443                         osvers="$5"
3444                 fi
3445         fi
3446
3447         case "$targetarch" in
3448         '') ;;
3449         *)  hostarch=$osname
3450             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3451             osvers=''
3452             ;;
3453         esac
3454
3455         : Now look for a hint file osname_osvers, unless one has been
3456         : specified already.
3457         case "$hintfile" in
3458         ''|' ')
3459                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3460                 : Also try without trailing minor version numbers.
3461                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3462                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3463                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3464                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3465                 case "$file" in
3466                 '') dflt=none ;;
3467                 *)  case "$osvers" in
3468                         '') dflt=$file
3469                                 ;;
3470                         *)  if $test -f $src/hints/$file.sh ; then
3471                                         dflt=$file
3472                                 elif $test -f $src/hints/$xfile.sh ; then
3473                                         dflt=$xfile
3474                                 elif $test -f $src/hints/$xxfile.sh ; then
3475                                         dflt=$xxfile
3476                                 elif $test -f $src/hints/$xxxfile.sh ; then
3477                                         dflt=$xxxfile
3478                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3479                                         dflt=$xxxxfile
3480                                 elif $test -f "$src/hints/${osname}.sh" ; then
3481                                         dflt="${osname}"
3482                                 else
3483                                         dflt=none
3484                                 fi
3485                                 ;;
3486                         esac
3487                         ;;
3488                 esac
3489                 if $test -f Policy.sh ; then
3490                         case "$dflt" in
3491                         *Policy*) ;;
3492                         none) dflt="Policy" ;;
3493                         *) dflt="Policy $dflt" ;;
3494                         esac
3495                 fi
3496                 ;;
3497         *)
3498                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3499                 ;;
3500         esac
3501
3502         if $test -f Policy.sh ; then
3503                 $cat <<EOM
3504
3505 There's also a Policy hint file available, which should make the
3506 site-specific (policy) questions easier to answer.
3507 EOM
3508
3509         fi
3510
3511         $cat <<EOM
3512
3513 You may give one or more space-separated answers, or "none" if appropriate.
3514 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3515 previous run of Configure, you may specify it as well as or instead of
3516 OS-specific hints.  If hints are provided for your OS, you should use them:
3517 although Perl can probably be built without hints on many platforms, using
3518 hints often improve performance and may enable features that Configure can't
3519 set up on its own. If there are no hints that match your OS, specify "none";
3520 DO NOT give a wrong version or a wrong OS.
3521
3522 EOM
3523
3524         rp="Which of these apply, if any?"
3525         . UU/myread
3526         tans=$ans
3527         for file in $tans; do
3528                 if $test X$file = XPolicy -a -f Policy.sh; then
3529                         . Policy.sh
3530                         $cat Policy.sh >> UU/config.sh
3531                 elif $test -f $src/hints/$file.sh; then
3532                         . $src/hints/$file.sh
3533                         $cat $src/hints/$file.sh >> UU/config.sh
3534                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3535                         : nothing
3536                 else
3537                         : Give one chance to correct a possible typo.
3538                         echo "$file.sh does not exist"
3539                         dflt=$file
3540                         rp="hint to use instead?"
3541                         . UU/myread
3542                         for file in $ans; do
3543                                 if $test -f "$src/hints/$file.sh"; then
3544                                         . $src/hints/$file.sh
3545                                         $cat $src/hints/$file.sh >> UU/config.sh
3546                                 elif $test X$ans = X -o X$ans = Xnone ; then
3547                                         : nothing
3548                                 else
3549                                         echo "$file.sh does not exist -- ignored."
3550                                 fi
3551                         done
3552                 fi
3553         done
3554
3555         hint=recommended
3556         : Remember our hint file for later.
3557         if $test -f "$src/hints/$file.sh" ; then
3558                 hintfile="$file"
3559         else
3560                 hintfile=''
3561         fi
3562 fi
3563 cd UU
3564 ;;
3565 *)
3566         echo " "
3567         echo "Fetching default answers from $config_sh..." >&4
3568         tmp_n="$n"
3569         tmp_c="$c"
3570         cd ..
3571         cp $config_sh config.sh 2>/dev/null
3572         chmod +w config.sh
3573         . ./config.sh
3574         cd UU
3575         cp ../config.sh .
3576         n="$tmp_n"
3577         c="$tmp_c"
3578         hint=previous
3579         ;;
3580 esac
3581 test "$override" && . ./optdef.sh
3582
3583 : Restore computed paths
3584 for file in $loclist $trylist; do
3585         eval $file="\$_$file"
3586 done
3587
3588 cat << EOM
3589
3590 Configure uses the operating system name and version to set some defaults.
3591 The default value is probably right if the name rings a bell. Otherwise,
3592 since spelling matters for me, either accept the default or answer "none"
3593 to leave it blank.
3594
3595 EOM
3596 case "$osname" in
3597         ''|' ')
3598                 case "$hintfile" in
3599                 ''|' '|none) dflt=none ;;
3600                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3601                 esac
3602                 ;;
3603         *) dflt="$osname" ;;
3604 esac
3605 rp="Operating system name?"
3606 . ./myread
3607 case "$ans" in
3608 none)  osname='' ;;
3609 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3610 esac
3611 echo " "
3612 case "$osvers" in
3613         ''|' ')
3614                 case "$hintfile" in
3615                 ''|' '|none) dflt=none ;;
3616                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3617                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3618                         case "$dflt" in
3619                         ''|' ') dflt=none ;;
3620                         esac
3621                         ;;
3622                 esac
3623                 ;;
3624         *) dflt="$osvers" ;;
3625 esac
3626 rp="Operating system version?"
3627 . ./myread
3628 case "$ans" in
3629 none)  osvers='' ;;
3630 *) osvers="$ans" ;;
3631 esac
3632
3633
3634 . ./posthint.sh
3635
3636 : who configured the system
3637 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3638 case "$cf_by" in
3639 "")
3640         cf_by=`(logname) 2>/dev/null`
3641         case "$cf_by" in
3642         "")
3643                 cf_by=`(whoami) 2>/dev/null`
3644                 case "$cf_by" in
3645                 "") cf_by=unknown ;;
3646                 esac ;;
3647         esac ;;
3648 esac
3649
3650 : decide how portable to be.  Allow command line overrides.
3651 case "$d_portable" in
3652 "$undef") ;;
3653 *)      d_portable="$define" ;;
3654 esac
3655
3656 : set up shell script to do ~ expansion
3657 cat >filexp <<EOSS
3658 $startsh
3659 : expand filename
3660 case "\$1" in
3661  \~/*|\~)
3662         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3663         ;;
3664  \~*)
3665         if $test -f /bin/csh; then
3666                 /bin/csh -f -c "glob \$1"
3667                 failed=\$?
3668                 echo ""
3669                 exit \$failed
3670         else
3671                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3672                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3673                 if $test ! -d "\$dir"; then
3674                         me=\`basename \$0\`
3675                         echo "\$me: can't locate home directory for: \$name" >&2
3676                         exit 1
3677                 fi
3678                 case "\$1" in
3679                 */*)
3680                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3681                         ;;
3682                 *)
3683                         echo \$dir
3684                         ;;
3685                 esac
3686         fi
3687         ;;
3688 *)
3689         echo \$1
3690         ;;
3691 esac
3692 EOSS
3693 chmod +x filexp
3694 $eunicefix filexp
3695
3696 : now set up to get a file name
3697 cat <<EOS >getfile
3698 $startsh
3699 EOS
3700 cat <<'EOSC' >>getfile
3701 tilde=''
3702 fullpath=''
3703 already=''
3704 skip=''
3705 none_ok=''
3706 exp_file=''
3707 nopath_ok=''
3708 orig_rp="$rp"
3709 orig_dflt="$dflt"
3710 case "$gfpth" in
3711 '') gfpth='.' ;;
3712 esac
3713
3714 case "$fn" in
3715 *\(*)
3716         : getfile will accept an answer from the comma-separated list
3717         : enclosed in parentheses even if it does not meet other criteria.
3718         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3719         fn=`echo $fn | sed 's/(.*)//'`
3720         ;;
3721 esac
3722
3723 case "$fn" in
3724 *:*)
3725         loc_file=`expr $fn : '.*:\(.*\)'`
3726         fn=`expr $fn : '\(.*\):.*'`
3727         ;;
3728 esac
3729
3730 case "$fn" in
3731 *~*) tilde=true;;
3732 esac
3733 case "$fn" in
3734 */*) fullpath=true;;
3735 esac
3736 case "$fn" in
3737 *+*) skip=true;;
3738 esac
3739 case "$fn" in
3740 *n*) none_ok=true;;
3741 esac
3742 case "$fn" in
3743 *e*) exp_file=true;;
3744 esac
3745 case "$fn" in
3746 *p*) nopath_ok=true;;
3747 esac
3748
3749 case "$fn" in
3750 *f*) type='File';;
3751 *d*) type='Directory';;
3752 *l*) type='Locate';;
3753 esac
3754
3755 what="$type"
3756 case "$what" in
3757 Locate) what='File';;
3758 esac
3759
3760 case "$exp_file" in
3761 '')
3762         case "$d_portable" in
3763         "$define") ;;
3764         *) exp_file=true;;
3765         esac
3766         ;;
3767 esac
3768
3769 cd ..
3770 while test "$type"; do
3771         redo=''
3772         rp="$orig_rp"
3773         dflt="$orig_dflt"
3774         case "$tilde" in
3775         true) rp="$rp (~name ok)";;
3776         esac
3777         . UU/myread
3778         if test -f UU/getfile.ok && \
3779                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3780         then
3781                 value="$ans"
3782                 ansexp="$ans"
3783                 break
3784         fi
3785         case "$ans" in
3786         none)
3787                 value=''
3788                 ansexp=''
3789                 case "$none_ok" in
3790                 true) type='';;
3791                 esac
3792                 ;;
3793         *)
3794                 case "$tilde" in
3795                 '') value="$ans"
3796                         ansexp="$ans";;
3797                 *)
3798                         value=`UU/filexp $ans`
3799                         case $? in
3800                         0)
3801                                 if test "$ans" != "$value"; then
3802                                         echo "(That expands to $value on this system.)"
3803                                 fi
3804                                 ;;
3805                         *) value="$ans";;
3806                         esac
3807                         ansexp="$value"
3808                         case "$exp_file" in
3809                         '') value="$ans";;
3810                         esac
3811                         ;;
3812                 esac
3813                 case "$fullpath" in
3814                 true)
3815                         case "$ansexp" in
3816                         /*) value="$ansexp" ;;
3817                         [a-zA-Z]:/*) value="$ansexp" ;;
3818                         *)
3819                                 redo=true
3820                                 case "$already" in
3821                                 true)
3822                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3823                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3824                                         ;;
3825                                 *)
3826                                 echo "Please give a full path name, starting with slash." >&4
3827                                         case "$tilde" in
3828                                         true)
3829                                 echo "Note that using ~name is ok provided it expands well." >&4
3830                                                 already=true
3831                                                 ;;
3832                                         esac
3833                                 esac
3834                                 ;;
3835                         esac
3836                         ;;
3837                 esac
3838                 case "$redo" in
3839                 '')
3840                         case "$type" in
3841                         File)
3842                                 for fp in $gfpth; do
3843                                         if test "X$fp" = X.; then
3844                                             pf="$ansexp"
3845                                         else    
3846                                             pf="$fp/$ansexp"
3847                                         fi
3848                                         if test -f "$pf"; then
3849                                                 type=''
3850                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3851                                         then
3852                                                 echo "($value is not a plain file, but that's ok.)"
3853                                                 type=''
3854                                         fi
3855                                         if test X"$type" = X; then
3856                                             value="$pf"
3857                                             break
3858                                         fi
3859                                 done
3860                                 ;;
3861                         Directory)
3862                                 for fp in $gfpth; do
3863                                         if test "X$fp" = X.; then
3864                                             dir="$ans"
3865                                             direxp="$ansexp"
3866                                         else    
3867                                             dir="$fp/$ansexp"
3868                                             direxp="$fp/$ansexp"
3869                                         fi
3870                                         if test -d "$direxp"; then
3871                                                 type=''
3872                                                 value="$dir"
3873                                                 break
3874                                         fi
3875                                 done
3876                                 ;;
3877                         Locate)
3878                                 if test -d "$ansexp"; then
3879                                         echo "(Looking for $loc_file in directory $value.)"
3880                                         value="$value/$loc_file"
3881                                         ansexp="$ansexp/$loc_file"
3882                                 fi
3883                                 if test -f "$ansexp"; then
3884                                         type=''
3885                                 fi
3886                                 case "$nopath_ok" in
3887                                 true)   case "$value" in
3888                                         */*) ;;
3889                                         *)      echo "Assuming $value will be in people's path."
3890                                                 type=''
3891                                                 ;;
3892                                         esac
3893                                         ;;
3894                                 esac
3895                                 ;;
3896                         esac
3897
3898                         case "$skip" in
3899                         true) type='';
3900                         esac
3901
3902                         case "$type" in
3903                         '') ;;
3904                         *)
3905                                 if test "$fastread" = yes; then
3906                                         dflt=y
3907                                 else
3908                                         dflt=n
3909                                 fi
3910                                 rp="$what $value doesn't exist.  Use that name anyway?"
3911                                 . UU/myread
3912                                 dflt=''
3913                                 case "$ans" in
3914                                 y*) type='';;
3915                                 *) echo " ";;
3916                                 esac
3917                                 ;;
3918                         esac
3919                         ;;
3920                 esac
3921                 ;;
3922         esac
3923 done
3924 cd UU
3925 ans="$value"
3926 rp="$orig_rp"
3927 dflt="$orig_dflt"
3928 rm -f getfile.ok
3929 test "X$gfpthkeep" != Xy && gfpth=""
3930 EOSC
3931
3932 : determine root of directory hierarchy where package will be installed.
3933 case "$prefix" in
3934 '')
3935         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3936         ;;
3937 *?/)
3938         dflt=`echo "$prefix" | sed 's/.$//'`
3939         ;;
3940 *)
3941         dflt="$prefix"
3942         ;;
3943 esac
3944 $cat <<EOM
3945
3946 By default, $package will be installed in $dflt/bin, manual pages
3947 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3948 installation directories. Typically this is something like /usr/local.
3949 If you wish to have binaries under /usr/bin but other parts of the
3950 installation under /usr/local, that's ok: you will be prompted
3951 separately for each of the installation directories, the prefix being
3952 only used to set the defaults.
3953
3954 EOM
3955 fn=d~
3956 rp='Installation prefix to use?'
3957 . ./getfile
3958 oldprefix=''
3959 case "$prefix" in
3960 '') ;;
3961 *)
3962         case "$ans" in
3963         "$prefix") ;;
3964         *) oldprefix="$prefix";;
3965         esac
3966         ;;
3967 esac
3968 prefix="$ans"
3969 prefixexp="$ansexp"
3970
3971 : allow them to override the AFS root
3972 case "$afsroot" in
3973 '')     afsroot=/afs ;;
3974 *)      afsroot=$afsroot ;;
3975 esac
3976
3977 : is AFS running?
3978 echo " "
3979 case "$afs" in
3980 $define|true)   afs=true ;;
3981 $undef|false)   afs=false ;;
3982 *)      if $test -d $afsroot; then
3983                 afs=true
3984         else
3985                 afs=false
3986         fi
3987         ;;
3988 esac
3989 if $afs; then
3990         echo "AFS may be running... I'll be extra cautious then..." >&4
3991 else
3992         echo "AFS does not seem to be running..." >&4
3993 fi
3994
3995 : determine installation prefix for where package is to be installed.
3996 if $afs; then
3997 $cat <<EOM
3998
3999 Since you are running AFS, I need to distinguish the directory in which
4000 files will reside from the directory in which they are installed (and from
4001 which they are presumably copied to the former directory by occult means).
4002
4003 EOM
4004         case "$installprefix" in
4005         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4006         *) dflt="$installprefix";;
4007         esac
4008 else
4009 $cat <<EOM
4010
4011 In some special cases, particularly when building $package for distribution,
4012 it is convenient to distinguish the directory in which files should be
4013 installed from the directory ($prefix) in which they will
4014 eventually reside.  For most users, these two directories are the same.
4015
4016 EOM
4017         case "$installprefix" in
4018         '') dflt=$prefix ;;
4019         *) dflt=$installprefix;;
4020         esac
4021 fi
4022 fn=d~
4023 rp='What installation prefix should I use for installing files?'
4024 . ./getfile
4025 installprefix="$ans"
4026 installprefixexp="$ansexp"
4027
4028 : Perform the prefixexp/installprefixexp correction if necessary
4029 cat <<EOS >installprefix
4030 $startsh
4031 EOS
4032 cat <<'EOSC' >>installprefix
4033 : Change installation prefix, if necessary.
4034 if $test X"$prefix" != X"$installprefix"; then
4035     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4036 else
4037     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4038 fi
4039 EOSC
4040 chmod +x installprefix
4041 $eunicefix installprefix
4042
4043 : Set variables such as privlib and privlibexp from the output of ./getfile
4044 : performing the prefixexp/installprefixexp correction if necessary.
4045 cat <<EOS >setprefixvar
4046 $startsh
4047 EOS
4048 cat <<'EOSC' >>setprefixvar
4049 eval "${prefixvar}=\"\$ans\""
4050 eval "${prefixvar}exp=\"\$ansexp\""
4051 . ./installprefix
4052 EOSC
4053 chmod +x setprefixvar
4054 $eunicefix setprefixvar
4055
4056 : set up the script used to warn in case of inconsistency
4057 cat <<EOS >whoa
4058 $startsh
4059 EOS
4060 cat <<'EOSC' >>whoa
4061 dflt=y
4062 case "$hint" in
4063     recommended)
4064         case "$hintfile" in
4065         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4066                 ;;
4067         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4068                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4069                 ;;
4070         esac
4071         ;;
4072     *)  echo " "
4073         echo "*** WHOA THERE!!! ***" >&4
4074         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4075         ;;
4076 esac
4077 rp="    Keep the $hint value?"
4078 . ./myread
4079 case "$ans" in
4080 y) td=$was; tu=$was;;
4081 esac
4082 EOSC
4083
4084 : function used to set '$1' to '$val'
4085 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4086 case "$val$was" in
4087 $define$undef) . ./whoa; eval "$var=\$td";;
4088 $undef$define) . ./whoa; eval "$var=\$tu";;
4089 *) eval "$var=$val";;
4090 esac'
4091
4092 : get the patchlevel
4093 echo " "
4094 echo "Getting the current patchlevel..." >&4
4095 if $test -r $rsrc/patchlevel.h;then
4096         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4097         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4098         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4099         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4100         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4101         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4102         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4103 else
4104         revision=0
4105         patchlevel=0
4106         subversion=0
4107         api_revision=0
4108         api_version=0
4109         api_subversion=0
4110         perl_patchlevel=0
4111         $echo "(You do not have patchlevel.h.  Eek.)"
4112 fi
4113 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4114 version_patchlevel_string="version $patchlevel subversion $subversion"
4115 case "$perl_patchlevel" in
4116 0|'') ;;
4117 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4118     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4119     ;;
4120 esac
4121
4122 $echo "(You have $package $version_patchlevel_string.)"
4123
4124 case "$osname" in
4125 dos|vms)
4126         : XXX Should be a Configure test for double-dots in filenames.
4127         version=`echo $revision $patchlevel $subversion | \
4128                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4129         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4130                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4131         ;;
4132 *)
4133         version=`echo $revision $patchlevel $subversion | \
4134                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4135         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4136                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4137         ;;
4138 esac
4139 : Special case the 5.005_xx maintenance series, which used 5.005
4140 : without any subversion label as a subdirectory in $sitelib
4141 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4142         api_versionstring='5.005'
4143 fi
4144
4145 : Do we want threads support and if so, what type
4146 case "$usethreads" in
4147 $define|true|[yY]*)     dflt='y';;
4148 *)     # Catch case where user specified ithreads or 5005threads but
4149        # forgot -Dusethreads (A.D. 4/2002)
4150        case "$useithreads$use5005threads" in
4151        *$define*)       dflt='y';;
4152        *)               dflt='n';;
4153        esac
4154        ;;
4155 esac
4156 cat <<EOM
4157
4158 Perl can be built to take advantage of threads on some systems.
4159 To do so, Configure can be run with -Dusethreads.
4160
4161 Note that Perl built with threading support runs slightly slower
4162 and uses more memory than plain Perl. The current implementation
4163 is believed to be stable, but it is fairly new, and so should be
4164 treated with caution.
4165
4166 If this doesn't make any sense to you, just accept the default '$dflt'.
4167 EOM
4168 rp='Build a threading Perl?'
4169 . ./myread
4170 case "$ans" in
4171 y|Y)    val="$define" ;;
4172 *)      val="$undef" ;;
4173 esac
4174 set usethreads
4175 eval $setvar
4176
4177 if $test $patchlevel -lt 9; then
4178     case "$usethreads" in
4179     $define)
4180         $cat <<EOM
4181
4182 Since release 5.6, Perl has had two different threading implementations,
4183 the newer interpreter-based version (ithreads) with one interpreter per
4184 thread, and the older 5.005 version (5005threads).
4185 The 5005threads version is effectively unmaintained and will probably be
4186 removed in Perl 5.10, so there should be no need to build a Perl using it
4187 unless needed for backwards compatibility with some existing 5.005threads
4188 code.
4189
4190 EOM
4191         : Default to ithreads unless overridden on command line or with
4192         : old config.sh
4193         dflt='y'
4194         case "$use5005threads" in
4195                 $define|true|[yY]*) dflt='n';;
4196         esac
4197         case "$useithreads" in
4198                 $undef|false|[nN]*) dflt='n';;
4199         esac
4200         rp='Use the newer interpreter-based ithreads?'
4201         . ./myread
4202         case "$ans" in
4203         y|Y)    val="$define" ;;
4204         *)      val="$undef" ;;
4205         esac
4206         set useithreads
4207         eval $setvar
4208         : Now set use5005threads to the opposite value.
4209         case "$useithreads" in
4210         $define) val="$undef" ;;
4211         *) val="$define" ;;
4212         esac
4213         set use5005threads
4214         eval $setvar
4215         ;;
4216     *)
4217         useithreads="$undef"
4218         use5005threads="$undef"
4219         ;;
4220     esac
4221
4222     case "$useithreads$use5005threads" in
4223     "$define$define")
4224         $cat >&4 <<EOM
4225
4226 You cannot have both the ithreads and the 5.005 threads enabled
4227 at the same time.  Disabling the 5.005 threads since they are
4228 much less stable than the ithreads.
4229
4230 EOM
4231         use5005threads="$undef"
4232         ;;
4233     esac
4234
4235 else
4236 : perl-5.9.x and later
4237
4238     if test X"$usethreads" = "X$define"; then
4239         case "$use5005threads" in
4240             $define|true|[yY]*)
4241                 $cat >&4 <<EOM
4242
4243 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4244
4245 EOM
4246             ;;
4247         esac
4248     fi
4249
4250     use5005threads="$undef"
4251     useithreads="$usethreads"
4252 fi
4253
4254 case "$d_oldpthreads" in
4255 '')     : Configure tests would be welcome here.  For now, assume undef.
4256         val="$undef" ;;
4257 *)      val="$d_oldpthreads" ;;
4258 esac
4259 set d_oldpthreads
4260 eval $setvar
4261
4262
4263 : Look for a hint-file generated 'call-back-unit'.  If the
4264 : user has specified that a threading perl is to be built,
4265 : we may need to set or change some other defaults.
4266 if $test -f usethreads.cbu; then
4267     echo "Your platform has some specific hints regarding threaded builds, using them..."
4268     . ./usethreads.cbu
4269 else
4270     case "$usethreads" in
4271         "$define"|true|[yY]*)
4272                 $cat <<EOM
4273 (Your platform does not have any specific hints for threaded builds.
4274  Assuming POSIX threads, then.)
4275 EOM
4276         ;;
4277     esac
4278 fi
4279
4280 : Check if multiplicity is required
4281 cat <<EOM
4282
4283 Perl can be built so that multiple Perl interpreters can coexist
4284 within the same Perl executable.
4285 EOM
4286
4287 case "$useithreads" in
4288 $define)
4289         cat <<EOM
4290 This multiple interpreter support is required for interpreter-based threads.
4291 EOM
4292         val="$define"
4293         ;;
4294 *)      case "$usemultiplicity" in
4295         $define|true|[yY]*)     dflt='y';;
4296         *) dflt='n';;
4297         esac
4298         echo " "
4299         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4300         rp='Build Perl for multiplicity?'
4301         . ./myread
4302         case "$ans" in
4303         y|Y)    val="$define" ;;
4304         *)      val="$undef" ;;
4305         esac
4306         ;;
4307 esac
4308 set usemultiplicity
4309 eval $setvar
4310
4311 : Check if morebits is requested
4312 case "$usemorebits" in
4313 "$define"|true|[yY]*)
4314         use64bitint="$define"
4315         uselongdouble="$define"
4316         usemorebits="$define"
4317         ;;
4318 *)      usemorebits="$undef"
4319         ;;
4320 esac
4321
4322 : Determine the C compiler to be used
4323 echo " "
4324 case "$cc" in
4325 '') dflt=cc;;
4326 *) dflt="$cc";;
4327 esac
4328 rp="Use which C compiler?"
4329 . ./myread
4330 cc="$ans"
4331
4332 : See whether they have no cc but they do have gcc
4333 . ./trygcc
4334 if $test -f cc.cbu; then
4335     . ./cc.cbu
4336 fi
4337 . ./checkcc
4338
4339 : make some quick guesses about what we are up against
4340 echo " "
4341 $echo $n "Hmm...  $c"
4342 echo exit 1 >bsd
4343 echo exit 1 >usg
4344 echo exit 1 >v7
4345 echo exit 1 >osf1
4346 echo exit 1 >eunice
4347 echo exit 1 >xenix
4348 echo exit 1 >venix
4349 echo exit 1 >os2
4350 d_bsd="$undef"
4351 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4352 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4353 then
4354         echo "Looks kind of like an OSF/1 system, but we'll see..."
4355         echo exit 0 >osf1
4356 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4357         xxx=`./loc addbib blurfl $pth`
4358         if $test -f $xxx; then
4359         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4360                 echo exit 0 >bsd
4361                 echo exit 0 >usg
4362         else
4363                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4364                         echo "Looks kind of like an extended USG system, but we'll see..."
4365                 else
4366                         echo "Looks kind of like a USG system, but we'll see..."
4367                 fi
4368                 echo exit 0 >usg
4369         fi
4370 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4371         echo "Looks kind of like a BSD system, but we'll see..."
4372         d_bsd="$define"
4373         echo exit 0 >bsd
4374 else
4375         echo "Looks kind of like a Version 7 system, but we'll see..."
4376         echo exit 0 >v7
4377 fi
4378 case "$eunicefix" in
4379 *unixtovms*)
4380         $cat <<'EOI'
4381 There is, however, a strange, musty smell in the air that reminds me of
4382 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4383 EOI
4384         echo exit 0 >eunice
4385         d_eunice="$define"
4386 : it so happens the Eunice I know will not run shell scripts in Unix format
4387         ;;
4388 *)
4389         echo " "
4390         echo "Congratulations.  You aren't running Eunice."
4391         d_eunice="$undef"
4392         ;;
4393 esac
4394 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4395 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4396 : semicolon as a patch separator
4397 case "$p_" in
4398 :) ;;
4399 *)
4400         $cat <<'EOI'
4401 I have the feeling something is not exactly right, however...don't tell me...
4402 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4403 (Or you may be running DOS with DJGPP.)
4404 EOI
4405         echo exit 0 >os2
4406         ;;
4407 esac
4408 if test -f /xenix; then
4409         echo "Actually, this looks more like a XENIX system..."
4410         echo exit 0 >xenix
4411         d_xenix="$define"
4412 else
4413         echo " "
4414         echo "It's not Xenix..."
4415         d_xenix="$undef"
4416 fi
4417 chmod +x xenix
4418 $eunicefix xenix
4419 if test -f /venix; then
4420         echo "Actually, this looks more like a VENIX system..."
4421         echo exit 0 >venix
4422 else
4423         echo " "
4424         if ./xenix; then
4425                 : null
4426         else
4427                 echo "Nor is it Venix..."
4428         fi
4429 fi
4430 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4431 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4432 $rm -f foo
4433
4434 : Check if we are using GNU gcc and what its version is
4435 echo " "
4436 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4437 $cat >try.c <<EOM
4438 #include <stdio.h>
4439 int main() {
4440 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4441 #ifdef __VERSION__
4442         printf("%s\n", __VERSION__);
4443 #else
4444         printf("%s\n", "1");
4445 #endif
4446 #endif
4447         return(0);
4448 }
4449 EOM
4450 if $cc -o try $ccflags $ldflags try.c; then
4451         gccversion=`$run ./try`
4452         case "$gccversion" in
4453         '') echo "You are not using GNU cc." ;;
4454         *)  echo "You are using GNU cc $gccversion."
4455             ccname=gcc
4456             ;;
4457         esac
4458 else
4459         echo " "
4460         echo "*** WHOA THERE!!! ***" >&4
4461         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4462         case "$knowitall" in
4463         '')
4464         echo "    You'd better start hunting for one and let me know about it." >&4
4465                 exit 1
4466                 ;;
4467         esac
4468 fi
4469 $rm -f try try.*
4470 case "$gccversion" in
4471 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4472 esac
4473 case "$gccversion" in
4474 '') gccosandvers='' ;;
4475 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4476    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4477    gccshortvers=''
4478    case "$gccosandvers" in
4479    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4480    $osname$osvers) ;; # looking good
4481    $osname*) cat <<EOM >&4
4482
4483 *** WHOA THERE!!! ***
4484
4485     Your gcc has not been compiled for the exact release of
4486     your operating system ($gccosandvers versus $osname$osvers).
4487
4488     In general it is a good idea to keep gcc synchronized with
4489     the operating system because otherwise serious problems
4490     may ensue when trying to compile software, like Perl.
4491
4492     I'm trying to be optimistic here, though, and will continue.
4493     If later during the configuration and build icky compilation
4494     problems appear (headerfile conflicts being the most common
4495     manifestation), I suggest reinstalling the gcc to match
4496     your operating system release.
4497
4498 EOM
4499       ;;
4500    *) gccosandvers='' ;; # failed to parse, better be silent
4501    esac
4502    ;;
4503 esac
4504 case "$ccname" in
4505 '') ccname="$cc" ;;
4506 esac
4507
4508 # gcc 3.* complain about adding -Idirectories that they already know about,
4509 # so we will take those off from locincpth.
4510 case "$gccversion" in
4511 3*)
4512     echo "main(){}">try.c
4513     for incdir in $locincpth; do
4514        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4515              grep '^c[cp]p*[01]: warning: changing search order '`
4516        if test "X$warn" != X; then
4517            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4518        fi
4519     done
4520     $rm -f try try.*
4521 esac
4522
4523 : What should the include directory be ?
4524 echo " "
4525 $echo $n "Hmm...  $c"
4526 dflt='/usr/include'
4527 incpath=''
4528 mips_type=''
4529 if $test -f /bin/mips && /bin/mips; then
4530         echo "Looks like a MIPS system..."
4531         $cat >usr.c <<'EOCP'
4532 #ifdef SYSTYPE_BSD43
4533 /bsd43
4534 #endif
4535 EOCP
4536         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4537                 dflt='/bsd43/usr/include'
4538                 incpath='/bsd43'
4539                 mips_type='BSD 4.3'
4540         else
4541                 mips_type='System V'
4542         fi
4543         $rm -f usr.c usr.out
4544         echo "and you're compiling with the $mips_type compiler and libraries."
4545         xxx_prompt=y
4546         echo "exit 0" >mips
4547 else
4548         echo "Doesn't look like a MIPS system."
4549         xxx_prompt=n
4550         echo "exit 1" >mips
4551 fi
4552 chmod +x mips
4553 $eunicefix mips
4554 case "$usrinc" in
4555 '') ;;
4556 *) dflt="$usrinc";;
4557 esac
4558 case "$xxx_prompt" in
4559 y)      fn=d/
4560         echo " "
4561         rp='Where are the include files you want to use?'
4562         . ./getfile
4563         usrinc="$ans"
4564         ;;
4565 *)      usrinc="$dflt"
4566         ;;
4567 esac
4568
4569 : see how we invoke the C preprocessor
4570 echo " "
4571 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4572 cat <<'EOT' >testcpp.c
4573 #define ABC abc
4574 #define XYZ xyz
4575 ABC.XYZ
4576 EOT
4577 cd ..
4578 if test ! -f cppstdin; then
4579         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4580                 # AIX cc -E doesn't show the absolute headerfile
4581                 # locations but we'll cheat by using the -M flag.
4582                 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
4583         else
4584                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4585         fi
4586 else
4587         echo "Keeping your $hint cppstdin wrapper."
4588 fi
4589 chmod 755 cppstdin
4590 wrapper=`pwd`/cppstdin
4591 ok='false'
4592 cd UU
4593
4594 if $test "X$cppstdin" != "X" && \
4595         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4596         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4597 then
4598         echo "You used to use $cppstdin $cppminus so we'll use that again."
4599         case "$cpprun" in
4600         '') echo "But let's see if we can live without a wrapper..." ;;
4601         *)
4602                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4603                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4604                 then
4605                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4606                         ok='true'
4607                 else
4608                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4609                 fi
4610                 ;;
4611         esac
4612 else
4613         case "$cppstdin" in
4614         '') ;;
4615         *)
4616                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4617                 ;;
4618         esac
4619 fi
4620
4621 if $ok; then
4622         : nothing
4623 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4624         $cc -E <testcpp.c >testcpp.out 2>&1; \
4625         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4626         echo "Yup, it does."
4627         x_cpp="$cc -E"
4628         x_minus='';
4629 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4630         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4631         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4632         echo "Yup, it does."
4633         x_cpp="$cc -E"
4634         x_minus='-';
4635 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4636         $cc -P <testcpp.c >testcpp.out 2>&1; \
4637         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4638         echo "Yipee, that works!"
4639         x_cpp="$cc -P"
4640         x_minus='';
4641 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4642         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4643         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4644         echo "At long last!"
4645         x_cpp="$cc -P"
4646         x_minus='-';
4647 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4648         $cpp <testcpp.c >testcpp.out 2>&1; \
4649         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4650         echo "It works!"
4651         x_cpp="$cpp"
4652         x_minus='';
4653 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4654         $cpp - <testcpp.c >testcpp.out 2>&1; \
4655         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4656         echo "Hooray, it works!  I was beginning to wonder."
4657         x_cpp="$cpp"
4658         x_minus='-';
4659 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4660         $wrapper <testcpp.c >testcpp.out 2>&1; \
4661         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4662         x_cpp="$wrapper"
4663         x_minus=''
4664         echo "Eureka!"
4665 else
4666         dflt=''
4667         rp="No dice.  I can't find a C preprocessor.  Name one:"
4668         . ./myread
4669         x_cpp="$ans"
4670         x_minus=''
4671         $x_cpp <testcpp.c >testcpp.out 2>&1
4672         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4673                 echo "OK, that will do." >&4
4674         else
4675 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4676                 exit 1
4677         fi
4678 fi
4679
4680 case "$ok" in
4681 false)
4682         cppstdin="$x_cpp"
4683         cppminus="$x_minus"
4684         cpprun="$x_cpp"
4685         cpplast="$x_minus"
4686         set X $x_cpp
4687         shift
4688         case "$1" in
4689         "$cpp")
4690                 echo "Perhaps can we force $cc -E using a wrapper..."
4691                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4692                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4693                 then
4694                         echo "Yup, we can."
4695                         cppstdin="$wrapper"
4696                         cppminus='';
4697                 else
4698                         echo "Nope, we'll have to live without it..."
4699                 fi
4700                 ;;
4701         esac
4702         case "$cpprun" in
4703         "$wrapper")
4704                 cpprun=''
4705                 cpplast=''
4706                 ;;
4707         esac
4708         ;;
4709 esac
4710
4711 case "$cppstdin" in
4712 "$wrapper"|'cppstdin') ;;
4713 *) $rm -f $wrapper;;
4714 esac
4715 $rm -f testcpp.c testcpp.out
4716
4717 : Set private lib path
4718 case "$plibpth" in
4719 '') if ./mips; then
4720                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4721         fi;;
4722 esac
4723 case "$libpth" in
4724 ' ') dlist='';;
4725 '') dlist="$loclibpth $plibpth $glibpth";;
4726 *) dlist="$libpth";;
4727 esac
4728
4729 : Now check and see which directories actually exist, avoiding duplicates
4730 libpth=''
4731 for xxx in $dlist
4732 do
4733     if $test -d $xxx; then
4734                 case " $libpth " in
4735                 *" $xxx "*) ;;
4736                 *) libpth="$libpth $xxx";;
4737                 esac
4738     fi
4739 done
4740 $cat <<'EOM'
4741
4742 Some systems have incompatible or broken versions of libraries.  Among
4743 the directories listed in the question below, please remove any you
4744 know not to be holding relevant libraries, and add any that are needed.
4745 Say "none" for none.
4746
4747 EOM
4748 case "$libpth" in
4749 '') dflt='none';;
4750 *)
4751         set X $libpth
4752         shift
4753         dflt=${1+"$@"}
4754         ;;
4755 esac
4756 rp="Directories to use for library searches?"
4757 . ./myread
4758 case "$ans" in
4759 none) libpth=' ';;
4760 *) libpth="$ans";;
4761 esac
4762
4763 : compute shared library extension
4764 case "$so" in
4765 '')
4766         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4767                 dflt='sl'
4768         else
4769                 dflt='so'
4770         fi
4771         ;;
4772 *) dflt="$so";;
4773 esac
4774 $cat <<EOM
4775
4776 On some systems, shared libraries may be available.  Answer 'none' if
4777 you want to suppress searching of shared libraries for the remainder
4778 of this configuration.
4779
4780 EOM
4781 rp='What is the file extension used for shared libraries?'
4782 . ./myread
4783 so="$ans"
4784
4785 : Define several unixisms.
4786 : Hints files or command line option can be used to override them.
4787 : The convoluted testing is in case hints files set either the old
4788 : or the new name.
4789 case "$_exe" in
4790 '')     case "$exe_ext" in
4791         '')     ;;
4792         *)      _exe="$exe_ext" ;;
4793         esac
4794         ;;
4795 esac
4796 case "$_a" in
4797 '')     case "$lib_ext" in
4798     '') _a='.a';;
4799         *)      _a="$lib_ext" ;;
4800         esac
4801         ;;
4802 esac
4803 case "$_o" in
4804 '') case "$obj_ext" in
4805         '')     _o='.o';;
4806         *)      _o="$obj_ext";;
4807         esac
4808         ;;
4809 esac
4810 case "$p_" in
4811 '') case "$path_sep" in
4812         '')     p_=':';;
4813         *)      p_="$path_sep";;
4814         esac
4815         ;;
4816 esac
4817 exe_ext=$_exe
4818 lib_ext=$_a
4819 obj_ext=$_o
4820 path_sep=$p_
4821
4822 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4823
4824 : Which makefile gets called first.  This is used by make depend.
4825 case "$firstmakefile" in
4826 '') firstmakefile='makefile';;
4827 esac
4828
4829 : Check is we will use socks
4830 case "$usesocks" in
4831 $define|true|[yY]*)     dflt='y';;
4832 *) dflt='n';;
4833 esac
4834 cat <<EOM
4835
4836 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4837 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4838 to use the PerlIO abstraction layer, this will be implicitly selected.
4839
4840 If this doesn't make any sense to you, just accept the default '$dflt'.
4841 EOM
4842 rp='Build Perl for SOCKS?'
4843 . ./myread
4844 case "$ans" in
4845 y|Y)    val="$define" ;;
4846 *)      val="$undef" ;;
4847 esac
4848 set usesocks
4849 eval $setvar
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         ;;
5262 *) dflt="$ldflags";;
5263 esac
5264 # See note above about -fstack-protector
5265 case "$ccflags" in
5266 *-fstack-protector*)
5267         case "$dflt" in
5268         *-fstack-protector*) ;; # Don't add it again
5269         *) dflt="$dflt -fstack-protector" ;;
5270         esac
5271         ;;
5272 esac
5273
5274 : Try to guess additional flags to pick up local libraries.
5275 for thislibdir in $libpth; do
5276         case " $loclibpth " in
5277         *" $thislibdir "*)
5278                 case "$dflt " in
5279                 *"-L$thislibdir "*) ;;
5280                 *)  dflt="$dflt -L$thislibdir" ;;
5281                 esac
5282                 ;;
5283         esac
5284 done
5285
5286 case "$dflt" in
5287 '') dflt='none' ;;
5288 esac
5289
5290 $cat <<EOH
5291
5292 Your C linker may need flags.  For this question you should
5293 include -L/whatever and any other flags used by the C linker, but you
5294 should NOT include libraries like -lwhatever.
5295
5296 Make sure you include the appropriate -L/path flags if your C linker
5297 does not normally search all of the directories you specified above,
5298 namely
5299         $libpth
5300 To use no flags, specify the word "none".
5301
5302 EOH
5303
5304 rp="Any additional ld flags (NOT including libraries)?"
5305 . ./myread
5306 case "$ans" in
5307 none) ldflags='';;
5308 *) ldflags="$ans";;
5309 esac
5310 rmlist="$rmlist pdp11"
5311
5312 : coherency check
5313 echo " "
5314 echo "Checking your choice of C compiler and flags for coherency..." >&4
5315 $cat > try.c <<'EOF'
5316 #include <stdio.h>
5317 int main() { printf("Ok\n"); return(0); }
5318 EOF
5319 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5320 shift
5321 $cat >try.msg <<'EOM'
5322 I've tried to compile and run the following simple program:
5323
5324 EOM
5325 $cat try.c >> try.msg
5326
5327 $cat >> try.msg <<EOM
5328
5329 I used the command:
5330
5331         $*
5332         $run ./try
5333
5334 and I got the following output:
5335
5336 EOM
5337 dflt=y
5338 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5339         if $sh -c "$run ./try " >>try.msg 2>&1; then
5340                 xxx=`$run ./try`
5341                 case "$xxx" in
5342                 "Ok") dflt=n ;;
5343                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5344                         case " $libs " in
5345                         *" -lsfio "*)
5346                                 cat >> try.msg <<'EOQS'
5347 If $libs contains -lsfio, and sfio is mis-configured, then it
5348 sometimes (apparently) runs and exits with a 0 status, but with no
5349 output!  It may have to do with sfio's use of _exit vs. exit.
5350
5351 EOQS
5352                                 rp="You have a big problem.  Shall I abort Configure"
5353                                 dflt=y
5354                                 ;;
5355                         esac
5356                         ;;
5357                 esac
5358         else
5359                 echo "The program compiled OK, but exited with status $?." >>try.msg
5360                 rp="You have a problem.  Shall I abort Configure"
5361                 dflt=y
5362         fi
5363 else
5364         echo "I can't compile the test program." >>try.msg
5365         rp="You have a BIG problem.  Shall I abort Configure"
5366         dflt=y
5367 fi
5368 case "$dflt" in
5369 y)
5370         $cat try.msg >&4
5371         case "$knowitall" in
5372         '')
5373                 echo "(The supplied flags or libraries might be incorrect.)"
5374                 ;;
5375         *) dflt=n;;
5376         esac
5377         echo " "
5378         . ./myread
5379         case "$ans" in
5380         n*|N*) ;;
5381         *)      echo "Ok.  Stopping Configure." >&4
5382                 exit 1
5383                 ;;
5384         esac
5385         ;;
5386 n) echo "OK, that should do.";;
5387 esac
5388 $rm_try gcctest gcctest.out
5389
5390 : define a shorthand compile call
5391 compile='
5392 mc_file=$1;
5393 shift;
5394 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5395 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5396 exit 1;
5397 fi;
5398 esac;
5399 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5400 : define a shorthand compile call for compilations that should be ok.
5401 compile_ok='
5402 mc_file=$1;
5403 shift;
5404 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5405
5406 : determine filename position in cpp output
5407 echo " "
5408 echo "Computing filename position in cpp output for #include directives..." >&4
5409 case "$osname" in
5410 vos) testaccess=-e ;;
5411 *)   testaccess=-r ;;
5412 esac
5413 echo '#include <stdio.h>' > foo.c
5414 $cat >fieldn <<EOF
5415 $startsh
5416 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5417 $grep '^[       ]*#.*stdio\.h' | \
5418 while read cline; do
5419         pos=1
5420         set \$cline
5421         while $test \$# -gt 0; do
5422                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5423                         echo "\$pos"
5424                         exit 0
5425                 fi
5426                 shift
5427                 pos=\`expr \$pos + 1\`
5428         done
5429 done
5430 EOF
5431 chmod +x fieldn
5432 fieldn=`./fieldn`
5433 $rm -f foo.c fieldn
5434 case $fieldn in
5435 '') pos='???';;
5436 1) pos=first;;
5437 2) pos=second;;
5438 3) pos=third;;
5439 *) pos="${fieldn}th";;
5440 esac
5441 echo "Your cpp writes the filename in the $pos field of the line."
5442
5443 case "$osname" in
5444 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5445 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5446 *)   cppfilter='' ;;
5447 esac
5448 : locate header file
5449 $cat >findhdr <<EOF
5450 $startsh
5451 wanted=\$1
5452 name=''
5453 for usrincdir in $usrinc
5454 do
5455         if test -f \$usrincdir/\$wanted; then
5456                 echo "\$usrincdir/\$wanted"
5457                 exit 0
5458         fi
5459 done
5460 awkprg='{ print \$$fieldn }'
5461 echo "#include <\$wanted>" > foo\$\$.c
5462 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5463 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5464 while read cline; do
5465         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5466         case "\$name" in
5467         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5468         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5469         *) exit 2;;
5470         esac;
5471 done;
5472 #
5473 # status = 0: grep returned 0 lines, case statement not executed
5474 # status = 1: headerfile found
5475 # status = 2: while loop executed, no headerfile found
5476 #
5477 status=\$?
5478 $rm -f foo\$\$.c;
5479 if test \$status -eq 1; then
5480         exit 0;
5481 fi
5482 exit 1
5483 EOF
5484 chmod +x findhdr
5485
5486 : define an alternate in-header-list? function
5487 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5488 cont=true; xxf="echo \"<\$1> found.\" >&4";
5489 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5490 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5491 esac;
5492 case $# in 4) instead=instead;; *) instead="at last";; esac;
5493 while $test "$cont"; do
5494         xxx=`./findhdr $1`
5495         var=$2; eval "was=\$$2";
5496         if $test "$xxx" && $test -r "$xxx";
5497         then eval $xxf;
5498         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5499                 cont="";
5500         else eval $xxnf;
5501         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5502         set $yyy; shift; shift; yyy=$@;
5503         case $# in 0) cont="";;
5504         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5505                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5506         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5507                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5508         esac;
5509 done;
5510 while $test "$yyy";
5511 do set $yyy; var=$2; eval "was=\$$2";
5512         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5513         set $yyy; shift; shift; yyy=$@;
5514 done'
5515
5516 : see if stdlib is available
5517 set stdlib.h i_stdlib
5518 eval $inhdr
5519
5520 : check for lengths of integral types
5521 echo " "
5522 case "$intsize" in
5523 '')
5524         echo "Checking to see how big your integers are..." >&4
5525         $cat >try.c <<EOCP
5526 #include <stdio.h>
5527 #$i_stdlib I_STDLIB
5528 #ifdef I_STDLIB
5529 #include <stdlib.h>
5530 #endif
5531 int main()
5532 {
5533         printf("intsize=%d;\n", (int)sizeof(int));
5534         printf("longsize=%d;\n", (int)sizeof(long));
5535         printf("shortsize=%d;\n", (int)sizeof(short));
5536         exit(0);
5537 }
5538 EOCP
5539         set try
5540         if eval $compile_ok && $run ./try > /dev/null; then
5541                 eval `$run ./try`
5542                 echo "Your integers are $intsize bytes long."
5543                 echo "Your long integers are $longsize bytes long."
5544                 echo "Your short integers are $shortsize bytes long."
5545         else
5546                 $cat >&4 <<EOM
5547 !
5548 Help! I can't compile and run the intsize test program: please enlighten me!
5549 (This is probably a misconfiguration in your system or libraries, and
5550 you really ought to fix it.  Still, I'll try anyway.)
5551 !
5552 EOM
5553                 dflt=4
5554                 rp="What is the size of an integer (in bytes)?"
5555                 . ./myread
5556                 intsize="$ans"
5557                 dflt=$intsize
5558                 rp="What is the size of a long integer (in bytes)?"
5559                 . ./myread
5560                 longsize="$ans"
5561                 dflt=2
5562                 rp="What is the size of a short integer (in bytes)?"
5563                 . ./myread
5564                 shortsize="$ans"
5565         fi
5566         ;;
5567 esac
5568 $rm_try
5569
5570 : check for long long
5571 echo " "
5572 echo "Checking to see if you have long long..." >&4
5573 echo 'int main() { long long x = 7; return 0; }' > try.c
5574 set try
5575 if eval $compile; then
5576         val="$define"
5577         echo "You have long long."
5578 else
5579         val="$undef"
5580         echo "You do not have long long."
5581 fi
5582 $rm_try
5583 set d_longlong
5584 eval $setvar
5585
5586 : check for length of long long
5587 case "${d_longlong}${longlongsize}" in
5588 $define)
5589         echo " "
5590         echo "Checking to see how big your long longs are..." >&4
5591         $cat >try.c <<'EOCP'
5592 #include <stdio.h>
5593 int main()
5594 {
5595     printf("%d\n", (int)sizeof(long long));
5596     return(0);
5597 }
5598 EOCP
5599         set try
5600         if eval $compile_ok; then
5601                 longlongsize=`$run ./try`
5602                 echo "Your long longs are $longlongsize bytes long."
5603         else
5604                 dflt='8'
5605                 echo " "
5606                 echo "(I can't seem to compile the test program.  Guessing...)"
5607                 rp="What is the size of a long long (in bytes)?"
5608                 . ./myread
5609                 longlongsize="$ans"
5610         fi
5611         if $test "X$longsize" = "X$longlongsize"; then
5612                 echo "(That isn't any different from an ordinary long.)"
5613         fi
5614         ;;
5615 esac
5616 $rm_try
5617
5618 : see if inttypes.h is available
5619 : we want a real compile instead of Inhdr because some systems
5620 : have an inttypes.h which includes non-existent headers
5621 echo " "
5622 $cat >try.c <<EOCP
5623 #include <inttypes.h>
5624 int main() {
5625         static int32_t foo32 = 0x12345678;
5626 }
5627 EOCP
5628 set try
5629 if eval $compile; then
5630         echo "<inttypes.h> found." >&4
5631         val="$define"
5632 else
5633         echo "<inttypes.h> NOT found." >&4
5634         val="$undef"
5635 fi
5636 $rm_try
5637 set i_inttypes
5638 eval $setvar
5639
5640 : check for int64_t
5641 echo " "
5642 echo "Checking to see if you have int64_t..." >&4
5643 $cat >try.c <<EOCP
5644 #include <sys/types.h>
5645 #$i_inttypes I_INTTYPES
5646 #ifdef I_INTTYPES
5647 #include <inttypes.h>
5648 #endif
5649 int main() { int64_t x = 7; }
5650 EOCP
5651 set try
5652 if eval $compile; then
5653         val="$define"
5654         echo "You have int64_t."
5655 else
5656         val="$undef"
5657         echo "You do not have int64_t."
5658 fi
5659 $rm_try
5660 set d_int64_t
5661 eval $setvar
5662
5663 : Check if 64bit ints have a quad type
5664 echo " "
5665 echo "Checking which 64-bit integer type we could use..." >&4
5666
5667 case "$intsize" in
5668 8) val=int
5669    set quadtype
5670    eval $setvar
5671    val='"unsigned int"'
5672    set uquadtype
5673    eval $setvar
5674    quadkind=1
5675    ;;
5676 *) case "$longsize" in
5677    8) val=long
5678       set quadtype
5679       eval $setvar
5680       val='"unsigned long"'
5681       set uquadtype
5682       eval $setvar
5683       quadkind=2
5684       ;;
5685    *) case "$d_longlong:$longlongsize" in
5686       define:8)
5687         val='"long long"'
5688         set quadtype
5689         eval $setvar
5690         val='"unsigned long long"'
5691         set uquadtype
5692         eval $setvar
5693         quadkind=3
5694         ;;
5695       *) case "$d_int64_t" in
5696          define)
5697            val=int64_t
5698            set quadtype
5699            eval $setvar
5700            val=uint64_t
5701            set uquadtype
5702            eval $setvar
5703            quadkind=4
5704            ;;
5705          esac
5706          ;;
5707       esac
5708       ;;
5709    esac
5710    ;;
5711 esac
5712
5713 case "$quadtype" in
5714 '')     echo "Alas, no 64-bit integer types in sight." >&4
5715         d_quad="$undef"
5716         ;;
5717 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5718         d_quad="$define"
5719         ;;
5720 esac
5721
5722 : Do we want 64bit support
5723 case "$uselonglong" in
5724 "$define"|true|[yY]*)
5725         cat <<EOM >&4
5726
5727 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5728 EOM
5729         use64bitint="$define"
5730         ;;
5731 esac
5732 case "$use64bits" in
5733 "$define"|true|[yY]*)
5734         cat <<EOM >&4
5735
5736 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5737 EOM
5738         use64bitint="$define"
5739         ;;
5740 esac
5741 case "$use64bitints" in
5742 "$define"|true|[yY]*)
5743         cat <<EOM >&4
5744
5745 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5746 EOM
5747         use64bitint="$define"
5748         ;;
5749 esac
5750 case "$use64bitsint" in
5751 "$define"|true|[yY]*)
5752         cat <<EOM >&4
5753
5754 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5755 EOM
5756         use64bitint="$define"
5757         ;;
5758 esac
5759 case "$uselonglongs" in
5760 "$define"|true|[yY]*)
5761         cat <<EOM >&4
5762
5763 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5764 EOM
5765         use64bitint="$define"
5766         ;;
5767 esac
5768 case "$use64bitsall" in
5769 "$define"|true|[yY]*)
5770         cat <<EOM >&4
5771
5772 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5773 EOM
5774         use64bitall="$define"
5775         ;;
5776 esac
5777
5778 case "$ccflags" in
5779 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5780 esac
5781 case "$use64bitall" in
5782 "$define"|true|[yY]*) use64bitint="$define" ;;
5783 esac
5784
5785 case "$longsize" in
5786 8) cat <<EOM
5787
5788 You have natively 64-bit long integers.
5789 EOM
5790    val="$define"
5791    ;;
5792 *) case "$use64bitint" in
5793    "$define"|true|[yY]*) dflt='y';;
5794    *) dflt='n';;
5795    esac
5796    case "$d_quad" in
5797    "$define") ;;
5798    *) dflt='n' ;;
5799    esac
5800    cat <<EOM
5801
5802 Perl can be built to take advantage of 64-bit integer types
5803 on some systems.  To do so, Configure can be run with -Duse64bitint.
5804 Choosing this option will most probably introduce binary incompatibilities.
5805
5806 If this doesn't make any sense to you, just accept the default '$dflt'.
5807 (The default has been chosen based on your configuration.)
5808 EOM
5809    rp='Try to use 64-bit integers, if available?'
5810    . ./myread
5811    case "$ans" in
5812    [yY]*) val="$define" ;;
5813    *)     val="$undef"  ;;
5814    esac
5815    ;;
5816 esac
5817 set use64bitint
5818 eval $setvar
5819
5820 case "$use64bitall" in
5821 "$define"|true|[yY]*) dflt='y' ;;
5822 *) case "$longsize" in
5823    8) dflt='y' ;;
5824    *) dflt='n' ;;
5825    esac
5826    ;;
5827 esac
5828 cat <<EOM
5829
5830 You may also choose to try maximal 64-bitness.  It means using as much
5831 64-bitness as possible on the platform.  This in turn means even more
5832 binary incompatibilities.  On the other hand, your platform may not
5833 have any more 64-bitness available than what you already have chosen.
5834
5835 If this doesn't make any sense to you, just accept the default '$dflt'.
5836 (The default has been chosen based on your configuration.)
5837 EOM
5838 rp='Try to use maximal 64-bit support, if available?'
5839 . ./myread
5840 case "$ans" in
5841 [yY]*) val="$define" ;;
5842 *)     val="$undef"  ;;
5843 esac
5844 set use64bitall
5845 eval $setvar
5846 case "$use64bitall" in
5847 "$define")
5848         case "$use64bitint" in
5849         "$undef")
5850                 cat <<EOM
5851
5852 Since you have chosen a maximally 64-bit build, I'm also turning on
5853 the use of 64-bit integers.
5854 EOM
5855                 use64bitint="$define" ;;
5856         esac
5857         ;;
5858 esac
5859
5860 : Look for a hint-file generated 'call-back-unit'.  If the
5861 : user has specified that a 64-bit perl is to be built,
5862 : we may need to set or change some other defaults.
5863 if $test -f use64bitint.cbu; then
5864         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5865         . ./use64bitint.cbu
5866 fi
5867 case "$use64bitint" in
5868 "$define"|true|[yY]*)
5869         case "$longsize" in
5870         4) case "$archname64" in
5871            '') archname64=64int ;;
5872            esac
5873            ;;
5874         esac
5875         ;;
5876 esac
5877
5878 : Look for a hint-file generated 'call-back-unit'.  If the
5879 : user has specified that a maximally 64-bit perl is to be built,
5880 : we may need to set or change some other defaults.
5881 if $test -f use64bitall.cbu; then
5882         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5883         . ./use64bitall.cbu
5884 fi
5885 case "$use64bitall" in
5886 "$define"|true|[yY]*)
5887         case "$longsize" in
5888         4) case "$archname64" in
5889            ''|64int) archname64=64all ;;
5890            esac
5891            ;;
5892         esac
5893         ;;
5894 esac
5895
5896 case "$d_quad:$use64bitint" in
5897 $undef:$define)
5898         cat >&4 <<EOF
5899
5900 *** You have chosen to use 64-bit integers,
5901 *** but none can be found.
5902 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5903 *** Cannot continue, aborting.
5904
5905 EOF
5906         exit 1
5907         ;;
5908 esac
5909
5910 : check for length of double
5911 echo " "
5912 case "$doublesize" in
5913 '')
5914         echo "Checking to see how big your double precision numbers are..." >&4
5915         $cat >try.c <<EOCP
5916 #include <stdio.h>
5917 #$i_stdlib I_STDLIB
5918 #ifdef I_STDLIB
5919 #include <stdlib.h>
5920 #endif
5921 int main()
5922 {
5923     printf("%d\n", (int)sizeof(double));
5924     exit(0);
5925 }
5926 EOCP
5927         set try
5928         if eval $compile_ok; then
5929                 doublesize=`$run ./try`
5930                 echo "Your double is $doublesize bytes long."
5931         else
5932                 dflt='8'
5933                 echo "(I can't seem to compile the test program.  Guessing...)"
5934                 rp="What is the size of a double precision number (in bytes)?"
5935                 . ./myread
5936                 doublesize="$ans"
5937         fi
5938         ;;
5939 esac
5940 $rm_try
5941
5942 : check for long doubles
5943 echo " "
5944 echo "Checking to see if you have long double..." >&4
5945 echo 'int main() { long double x = 7.0; }' > try.c
5946 set try
5947 if eval $compile; then
5948         val="$define"
5949         echo "You have long double."
5950 else
5951         val="$undef"
5952         echo "You do not have long double."
5953 fi
5954 $rm_try
5955 set d_longdbl
5956 eval $setvar
5957
5958 : check for length of long double
5959 case "${d_longdbl}${longdblsize}" in
5960 $define)
5961         echo " "
5962         echo "Checking to see how big your long doubles are..." >&4
5963         $cat >try.c <<'EOCP'
5964 #include <stdio.h>
5965 int main()
5966 {
5967         printf("%d\n", sizeof(long double));
5968 }
5969 EOCP
5970         set try
5971         set try
5972         if eval $compile; then
5973                 longdblsize=`$run ./try`
5974                 echo "Your long doubles are $longdblsize bytes long."
5975         else
5976                 dflt='8'
5977                 echo " "
5978                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5979                 rp="What is the size of a long double (in bytes)?"
5980                 . ./myread
5981                 longdblsize="$ans"
5982         fi
5983         if $test "X$doublesize" = "X$longdblsize"; then
5984                 echo "That isn't any different from an ordinary double."
5985                 echo "I'll keep your setting anyway, but you may see some"
5986                 echo "harmless compilation warnings."
5987         fi
5988         ;;
5989 esac
5990 $rm_try
5991
5992 : determine the architecture name
5993 echo " "
5994 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5995         tarch=`arch`"-$osname"
5996 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5997         if uname -m > tmparch 2>&1 ; then
5998                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5999                         -e 's/$/'"-$osname/" tmparch`
6000         else
6001                 tarch="$osname"
6002         fi
6003         $rm -f tmparch
6004 else
6005         tarch="$osname"
6006 fi
6007 case "$myarchname" in
6008 ''|"$tarch") ;;
6009 *)
6010         echo "(Your architecture name used to be $myarchname.)"
6011         archname=''
6012         ;;
6013 esac
6014 case "$targetarch" in
6015 '') ;;
6016 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6017 esac
6018 myarchname="$tarch"
6019 case "$archname" in
6020 '') dflt="$tarch";;
6021 *) dflt="$archname";;
6022 esac
6023 rp='What is your architecture name'
6024 . ./myread
6025 archname="$ans"
6026
6027 : optionally add API version to the architecture for versioned archlibs
6028 case "$useversionedarchname" in
6029 $define|true|[yY]*) dflt='y';;
6030 *)                  dflt='n';;
6031 esac
6032 rp='Add the Perl API version to your archname?'
6033 . ./myread
6034 case "$ans" in
6035 y|Y)    useversionedarchname="$define" ;;
6036 *)      useversionedarchname="$undef" ;;
6037 esac
6038 case "$useversionedarchname" in
6039 $define)
6040         case "$archname" in
6041         *-$api_versionstring)
6042                 echo "...and architecture name already has -$api_versionstring" >&4
6043                 ;;
6044         *)
6045                 archname="$archname-$api_versionstring"
6046                 echo "...setting architecture name to $archname." >&4
6047                 ;;
6048         esac
6049         ;;
6050 esac
6051
6052 case "$usethreads" in
6053 $define)
6054         echo "Threads selected." >&4
6055         case "$archname" in
6056         *-thread*) echo "...and architecture name already has -thread." >&4
6057                 ;;
6058         *)      archname="$archname-thread"
6059                 echo "...setting architecture name to $archname." >&4
6060                 ;;
6061         esac
6062         ;;
6063 esac
6064 case "$usemultiplicity" in
6065 $define)
6066         echo "Multiplicity selected." >&4
6067         case "$archname" in
6068         *-multi*) echo "...and architecture name already has -multi." >&4
6069                 ;;
6070         *)      archname="$archname-multi"
6071                 echo "...setting architecture name to $archname." >&4
6072                 ;;
6073         esac
6074         ;;
6075 esac
6076 case "$use64bitint$use64bitall" in
6077 *"$define"*)
6078         case "$archname64" in
6079         '')
6080                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6081                 ;;
6082         *)
6083                 case "$use64bitint" in
6084                 "$define") echo "64 bit integers selected." >&4 ;;
6085                 esac
6086                 case "$use64bitall" in
6087                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6088                 esac
6089                 case "$archname" in
6090                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6091                         ;;
6092                 *)      archname="$archname-$archname64"
6093                         echo "...setting architecture name to $archname." >&4
6094                         ;;
6095                 esac
6096                 ;;
6097         esac
6098 esac
6099 case "$uselongdouble" in
6100 $define)
6101         echo "Long doubles selected." >&4
6102         case "$longdblsize" in
6103         $doublesize)
6104                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6105                 ;;
6106         *)
6107                 case "$archname" in
6108                 *-ld*) echo "...and architecture name already has -ld." >&4
6109                         ;;
6110                 *)      archname="$archname-ld"
6111                         echo "...setting architecture name to $archname." >&4
6112                         ;;
6113                 esac
6114                 ;;
6115         esac
6116         ;;
6117 esac
6118 if $test -f archname.cbu; then
6119         echo "Your platform has some specific hints for architecture name, using them..."
6120         . ./archname.cbu
6121 fi
6122
6123 : set the prefixit variable, to compute a suitable default value
6124 prefixit='case "$3" in
6125 ""|none)
6126         case "$oldprefix" in
6127         "") eval "$1=\"\$$2\"";;
6128         *)
6129                 case "$3" in
6130                 "") eval "$1=";;
6131                 none)
6132                         eval "tp=\"\$$2\"";
6133                         case "$tp" in
6134                         ""|" ") eval "$1=\"\$$2\"";;
6135                         *) eval "$1=";;
6136                         esac;;
6137                 esac;;
6138         esac;;
6139 *)
6140         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6141         case "$tp" in
6142         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6143         /*-$oldprefix/*|\~*-$oldprefix/*)
6144                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6145         *) eval "$1=\"\$$2\"";;
6146         esac;;
6147 esac'
6148
6149 : determine installation style
6150 : For now, try to deduce it from prefix unless it is already set.
6151 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6152 case "$installstyle" in
6153 '')     case "$prefix" in
6154                 *perl*) dflt='lib';;
6155                 *) dflt='lib/perl5' ;;
6156         esac
6157         ;;
6158 *)      dflt="$installstyle" ;;
6159 esac
6160 : Probably not worth prompting for this since we prompt for all
6161 : the directories individually, and the prompt would be too long and
6162 : confusing anyway.
6163 installstyle=$dflt
6164
6165 : determine where public executables go
6166 echo " "
6167 set dflt bin bin
6168 eval $prefixit
6169 fn=d~
6170 rp='Pathname where the public executables will reside?'
6171 . ./getfile
6172 if $test "X$ansexp" != "X$binexp"; then
6173         installbin=''
6174 fi
6175 prefixvar=bin
6176 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6177 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6178 :     this via initialinstalllocation
6179 . ./setprefixvar
6180
6181 case "$userelocatableinc" in
6182 $define|true|[yY]*)     dflt='y' ;;
6183 *)                      dflt='n' ;;
6184 esac
6185 cat <<EOM
6186
6187 Would you like to build Perl so that the installation is relocatable, so that
6188 library paths in @INC are determined relative to the path of the perl binary?
6189 This is not advised for system Perl installs, or if you need to run setid
6190 scripts or scripts under taint mode.
6191
6192 If this doesn't make any sense to you, just accept the default '$dflt'.
6193 EOM
6194 rp='Use relocatable @INC?'
6195 . ./myread
6196 case "$ans" in
6197 y|Y)    val="$define" ;;
6198 *)      val="$undef"  ;;
6199 esac
6200 set userelocatableinc
6201 eval $setvar
6202
6203 initialinstalllocation="$binexp"
6204 : Default prefix is now "up one level from where the binaries are"
6205 case "$userelocatableinc" in
6206 $define|true|[yY]*)
6207     bin=".../"
6208     binexp=".../"
6209     prefix=".../.."
6210     prefixexp=".../.."
6211     installprefixexp=".../.."
6212     ;;
6213 esac
6214
6215 : determine where private library files go
6216 : Usual default is /usr/local/lib/perl5/$version.
6217 : Also allow things like /opt/perl/lib/$version, since
6218 : /opt/perl/lib/perl5... would be redundant.
6219 : The default "style" setting is made in installstyle.U
6220 case "$installstyle" in
6221 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6222 *)       set dflt privlib lib/$version ;;
6223 esac
6224 eval $prefixit
6225 $cat <<EOM
6226
6227 There are some auxiliary files for $package that need to be put into a
6228 private library directory that is accessible by everyone.
6229
6230 EOM
6231 fn=$binexp
6232 fn=d~+
6233 rp='Pathname where the private library files will reside?'
6234 . ./getfile
6235 prefixvar=privlib
6236 . ./setprefixvar
6237
6238 : set the prefixup variable, to restore leading tilda escape
6239 prefixup='case "$prefixexp" in
6240 "$prefix") ;;
6241 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6242 esac'
6243
6244 : determine where public architecture dependent libraries go
6245 set archlib archlib
6246 eval $prefixit
6247 : privlib default is /usr/local/lib/$package/$version
6248 : archlib default is /usr/local/lib/$package/$version/$archname
6249 : privlib may have an optional trailing /share.
6250 tdflt=`echo $privlib | $sed 's,/share$,,'`
6251 tdflt=$tdflt/$archname
6252 case "$archlib" in
6253 '')     dflt=$tdflt
6254         ;;
6255 *)      dflt="$archlib"
6256     ;;
6257 esac
6258 $cat <<EOM
6259
6260 $spackage contains architecture-dependent library files.  If you are
6261 sharing libraries in a heterogeneous environment, you might store
6262 these files in a separate location.  Otherwise, you can just include
6263 them with the rest of the public library files.
6264
6265 EOM
6266 fn=$binexp
6267 fn=d+~
6268 rp='Where do you want to put the public architecture-dependent libraries?'
6269 . ./getfile
6270 prefixvar=archlib
6271 . ./setprefixvar
6272 if $test X"$archlib" = X"$privlib"; then
6273         d_archlib="$undef"
6274 else
6275         d_archlib="$define"
6276 fi
6277
6278 : see if setuid scripts can be secure
6279 $cat <<EOM
6280
6281 Some kernels have a bug that prevents setuid #! scripts from being
6282 secure.  Some sites have disabled setuid #! scripts because of this.
6283
6284 First let's decide if your kernel supports secure setuid #! scripts.
6285 (If setuid #! scripts would be secure but have been disabled anyway,
6286 don't say that they are secure if asked.)
6287
6288 EOM
6289
6290 val="$undef"
6291 if $test -d /dev/fd; then
6292         echo "#!$ls" >reflect
6293         chmod +x,u+s reflect
6294         ./reflect >flect 2>&1
6295         if $contains "/dev/fd" flect >/dev/null; then
6296                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6297                 val="$define"
6298         else
6299                 $cat <<EOM
6300 If you are not sure if they are secure, I can check but I'll need a
6301 username and password different from the one you are using right now.
6302 If you don't have such a username or don't want me to test, simply
6303 enter 'none'.
6304
6305 EOM
6306                 rp='Other username to test security of setuid scripts with?'
6307                 dflt='none'
6308                 . ./myread
6309                 case "$ans" in
6310                 n|none)
6311                         case "$d_suidsafe" in
6312                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6313                                 dflt=n;;
6314                         "$undef")
6315                                 echo "Well, the $hint value is *not* secure." >&4
6316                                 dflt=n;;
6317                         *)      echo "Well, the $hint value *is* secure." >&4
6318                                 dflt=y;;
6319                         esac
6320                         ;;
6321                 *)
6322                         $rm -f reflect flect
6323                         echo "#!$ls" >reflect
6324                         chmod +x,u+s reflect
6325                         echo >flect
6326                         chmod a+w flect
6327                         echo '"su" will (probably) prompt you for '"$ans's password."
6328                         su $ans -c './reflect >flect'
6329                         if $contains "/dev/fd" flect >/dev/null; then
6330                                 echo "Okay, it looks like setuid scripts are secure." >&4
6331                                 dflt=y
6332                         else
6333                                 echo "I don't think setuid scripts are secure." >&4
6334                                 dflt=n
6335                         fi
6336                         ;;
6337                 esac
6338                 rp='Does your kernel have *secure* setuid scripts?'
6339                 . ./myread
6340                 case "$ans" in
6341                 [yY]*)  val="$define";;
6342                 *)      val="$undef";;
6343                 esac
6344         fi
6345 else
6346         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6347         echo "(That's for file descriptors, not floppy disks.)"
6348         val="$undef"
6349 fi
6350 set d_suidsafe
6351 eval $setvar
6352
6353 $rm -f reflect flect
6354
6355 : now see if they want to do setuid emulation
6356 if $test $patchlevel -lt 11; then
6357 echo " "
6358 val="$undef"
6359 case "$d_suidsafe" in
6360 "$define")
6361         val="$undef"
6362         echo "No need to emulate SUID scripts since they are secure here." >&4
6363         ;;
6364 *)
6365         $cat <<EOM
6366 Some systems have disabled setuid scripts, especially systems where
6367 setuid scripts cannot be secure.  On systems where setuid scripts have
6368 been disabled, the setuid/setgid bits on scripts are currently
6369 useless.  It is possible for $package to detect those bits and emulate
6370 setuid/setgid in a secure fashion.  This emulation will only work if
6371 setuid scripts have been disabled in your kernel.
6372
6373 EOM
6374         case "$d_dosuid" in
6375         "$define") dflt=y ;;
6376         *) dflt=n ;;
6377         esac
6378         rp="Do you want to do setuid/setgid emulation?"
6379         . ./myread
6380         case "$ans" in
6381         [yY]*)  val="$define";;
6382         *)      val="$undef";;
6383         esac
6384         ;;
6385 esac
6386 set d_dosuid
6387 eval $setvar
6388 else
6389     case "$d_dosuid" in
6390         "$define")
6391         cat >&4 <<EOH
6392
6393 SUID emulation has been removed for 5.12
6394 Please re-run Configure without -Dd_dosuid
6395
6396 EOH
6397         exit 1;
6398         ;;
6399     esac
6400     d_dosuid=undef
6401 fi
6402
6403 : Find perl5.005 or later.
6404 echo "Looking for a previously installed perl5.005 or later... "
6405 case "$perl5" in
6406 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6407                 : Check if this perl is recent and can load a simple module
6408                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6409                         perl5=$tdir/perl
6410                         break;
6411                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6412                         perl5=$tdir/perl5
6413                         break;
6414                 fi
6415         done
6416         ;;
6417 *)      perl5="$perl5"
6418         ;;
6419 esac
6420 case "$perl5" in
6421 '')     echo "None found.  That's ok.";;
6422 *)      echo "Using $perl5." ;;
6423 esac
6424
6425 : Set the siteprefix variables
6426 $cat <<EOM
6427
6428 After $package is installed, you may wish to install various
6429 add-on modules and utilities.  Typically, these add-ons will
6430 be installed under $prefix with the rest
6431 of this package.  However, you may wish to install such add-ons
6432 elsewhere under a different prefix.
6433
6434 If you do not wish to put everything under a single prefix, that's
6435 ok.  You will be prompted for the individual locations; this siteprefix
6436 is only used to suggest the defaults.
6437
6438 The default should be fine for most people.
6439
6440 EOM
6441 fn=d~+
6442 rp='Installation prefix to use for add-on modules and utilities?'
6443 : XXX Here might be another good place for an installstyle setting.
6444 case "$siteprefix" in
6445 '') dflt=$prefix ;;
6446 *)  dflt=$siteprefix ;;
6447 esac
6448 . ./getfile
6449 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6450 oldsiteprefix=''
6451 case "$siteprefix" in
6452 '') ;;
6453 *)      case "$ans" in
6454         "$prefix") ;;
6455         *) oldsiteprefix="$prefix";;
6456         esac
6457         ;;
6458 esac
6459 siteprefix="$ans"
6460 siteprefixexp="$ansexp"
6461
6462 : determine where site specific libraries go.
6463 : Usual default is /usr/local/lib/perl5/site_perl/$version
6464 : The default "style" setting is made in installstyle.U
6465 : XXX No longer works with Prefixit stuff.
6466 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6467 case "$sitelib" in
6468 '') case "$installstyle" in
6469         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6470         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6471         esac
6472         ;;
6473 *)      dflt="$sitelib"
6474         ;;
6475 esac
6476 $cat <<EOM
6477
6478 The installation process will create a directory for
6479 site-specific extensions and modules.  Most users find it convenient
6480 to place all site-specific files in this directory rather than in the
6481 main distribution directory.
6482
6483 EOM
6484 fn=d~+
6485 rp='Pathname for the site-specific library files?'
6486 . ./getfile
6487 prefixvar=sitelib
6488 . ./setprefixvar
6489 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6490
6491 : Determine list of previous versions to include in @INC
6492 $cat > getverlist <<EOPL
6493 #!$perl5 -w
6494 use File::Basename;
6495 \$api_versionstring = "$api_versionstring";
6496 \$version = "$version";
6497 \$stem = "$sitelib_stem";
6498 \$archname = "$archname";
6499 EOPL
6500         $cat >> getverlist <<'EOPL'
6501 # The list found is store twice for each entry: the original name, and
6502 # the binary broken down version as pack "sss", so sorting is easy and
6503 # unambiguous. This will work for all versions that have a maximum of
6504 # three digit groups, separate by '.'s or '_'s. Names are extended with
6505 # ".0.0" to ensure at least three elements for the pack.
6506 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6507
6508 # Can't have leading @ because metaconfig interprets it as a command!
6509 ;@inc_version_list=();
6510 # XXX Redo to do opendir/readdir?
6511 if (-d $stem) {
6512     chdir($stem);
6513     ;@candidates = map {
6514         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6515     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6516 }
6517 else {
6518     ;@candidates = ();
6519 }
6520
6521 ($pversion, $aversion, $vsn5005) = map {
6522     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6523 foreach $d (@candidates) {
6524     if ($d->[1] lt $pversion) {
6525         if ($d->[1] ge $aversion) {
6526             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6527         }
6528         elsif ($d->[1] ge $vsn5005) {
6529             unshift(@inc_version_list, grep { -d } $d->[0]);
6530         }
6531     }
6532     else {
6533         # Skip newer version.  I.e. don't look in
6534         # 5.7.0 if we're installing 5.6.1.
6535     }
6536 }
6537
6538 if (@inc_version_list) {
6539     print join(' ', @inc_version_list);
6540 }
6541 else {
6542     # Blank space to preserve value for next Configure run.
6543     print " ";
6544 }
6545 EOPL
6546 chmod +x getverlist
6547 case "$inc_version_list" in
6548 '')     if test -x "$perl5$exe_ext"; then
6549                 dflt=`$perl5 getverlist`
6550         else
6551                 dflt='none'
6552         fi
6553         ;;
6554 $undef) dflt='none' ;;
6555 *)  eval dflt=\"$inc_version_list\" ;;
6556 esac
6557 case "$dflt" in
6558 ''|' ') dflt=none ;;
6559 esac
6560 case "$dflt" in
6561 5.005) dflt=none ;;
6562 esac
6563 $cat <<EOM
6564
6565 In order to ease the process of upgrading, this version of perl
6566 can be configured to use modules built and installed with earlier
6567 versions of perl that were installed under $prefix.  Specify here
6568 the list of earlier versions that this version of perl should check.
6569 If Configure detected no earlier versions of perl installed under
6570 $prefix, then the list will be empty.  Answer 'none' to tell perl
6571 to not search earlier versions.
6572
6573 The default should almost always be sensible, so if you're not sure,
6574 just accept the default.
6575 EOM
6576
6577 rp='List of earlier versions to include in @INC?'
6578 . ./myread
6579 case "$ans" in
6580 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6581 *) inc_version_list="$ans" ;;
6582 esac
6583 case "$inc_version_list" in
6584 ''|' ')
6585         inc_version_list_init='0'
6586         d_inc_version_list="$undef"
6587         ;;
6588 *)      inc_version_list_init=`echo $inc_version_list |
6589                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6590         d_inc_version_list="$define"
6591         ;;
6592 esac
6593 $rm -f getverlist
6594
6595 : see if malloc/malloc.h has to be included
6596 set malloc/malloc.h i_mallocmalloc
6597 eval $inhdr
6598
6599 : see if this is a malloc.h system
6600 : we want a real compile instead of Inhdr because some systems have a
6601 : malloc.h that just gives a compile error saying to use stdlib.h instead
6602 echo " "
6603 $cat >try.c <<EOCP
6604 #include <stdlib.h>
6605 #include <malloc.h>
6606 #$i_mallocmalloc I_MALLOCMALLOC
6607 #ifdef I_MALLOCMALLOC
6608 # include <malloc/malloc.h>
6609 #endif
6610
6611 int main () { return 0; }
6612 EOCP
6613 set try
6614 if eval $compile; then
6615     echo "<malloc.h> found." >&4
6616     val="$define"
6617 else
6618     echo "<malloc.h> NOT found." >&4
6619     val="$undef"
6620 fi
6621 $rm_try
6622 set i_malloc
6623 eval $setvar
6624
6625 : check for void type
6626 echo " "
6627 echo "Checking to see how well your C compiler groks the void type..." >&4
6628 case "$voidflags" in
6629 '')
6630         $cat >try.c <<EOCP
6631 #$i_stdlib I_STDLIB
6632 #ifdef I_STDLIB
6633 #include <stdlib.h>
6634 #endif
6635 #if TRY & 1
6636 void sub() {
6637 #else
6638 sub() {
6639 #endif
6640         extern void moo();      /* function returning void */
6641         void (*goo)();          /* ptr to func returning void */
6642 #if TRY & 8
6643         void *hue;              /* generic ptr */
6644 #endif
6645 #if TRY & 2
6646         void (*foo[10])();
6647 #endif
6648
6649 #if TRY & 4
6650         if(goo == moo) {
6651                 exit(0);
6652         }
6653 #endif
6654         exit(0);
6655 }
6656 int main() { sub(); }
6657 EOCP
6658         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6659                 voidflags=$defvoidused
6660         echo "Good.  It appears to support void to the level $package wants.">&4
6661                 if $contains warning .out >/dev/null 2>&1; then
6662                         echo "However, you might get some warnings that look like this:"
6663                         $cat .out
6664                 fi
6665         else
6666 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6667                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6668                         echo "It supports 1..."
6669                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6670                                 echo "It also supports 2..."
6671                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6672                                         voidflags=7
6673                                         echo "And it supports 4 but not 8 definitely."
6674                                 else
6675                                         echo "It doesn't support 4..."
6676                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6677                                                 voidflags=11
6678                                                 echo "But it supports 8."
6679                                         else
6680                                                 voidflags=3
6681                                                 echo "Neither does it support 8."
6682                                         fi
6683                                 fi
6684                         else
6685                                 echo "It does not support 2..."
6686                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6687                                         voidflags=13
6688                                         echo "But it supports 4 and 8."
6689                                 else
6690                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6691                                                 voidflags=5
6692                                                 echo "And it supports 4 but has not heard about 8."
6693                                         else
6694                                                 echo "However it supports 8 but not 4."
6695                                         fi
6696                                 fi
6697                         fi
6698                 else
6699                         echo "There is no support at all for void."
6700                         voidflags=0
6701                 fi
6702         fi
6703 esac
6704 case "$voidflags" in
6705 "$defvoidused") ;;
6706 *)      $cat >&4 <<'EOM'
6707   Support flag bits are:
6708     1: basic void declarations.
6709     2: arrays of pointers to functions returning void.
6710     4: operations between pointers to and addresses of void functions.
6711     8: generic void pointers.
6712 EOM
6713         dflt="$voidflags";
6714         rp="Your void support flags add up to what?"
6715         . ./myread
6716         voidflags="$ans"
6717         ;;
6718 esac
6719 $rm_try
6720
6721 : check for length of pointer
6722 echo " "
6723 case "$ptrsize" in
6724 '')
6725         echo "Checking to see how big your pointers are..." >&4
6726         if test "$voidflags" -gt 7; then
6727                 echo '#define VOID_PTR char *' > try.c
6728         else
6729                 echo '#define VOID_PTR void *' > try.c
6730         fi
6731         $cat >>try.c <<EOCP
6732 #include <stdio.h>
6733 #$i_stdlib I_STDLIB
6734 #ifdef I_STDLIB
6735 #include <stdlib.h>
6736 #endif
6737 int main()
6738 {
6739     printf("%d\n", (int)sizeof(VOID_PTR));
6740     exit(0);
6741 }
6742 EOCP
6743         set try
6744         if eval $compile_ok; then
6745                 ptrsize=`$run ./try`
6746                 echo "Your pointers are $ptrsize bytes long."
6747         else
6748                 dflt='4'
6749                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6750                 rp="What is the size of a pointer (in bytes)?"
6751                 . ./myread
6752                 ptrsize="$ans"
6753         fi
6754         ;;
6755 esac
6756 $rm_try
6757 case "$use64bitall" in
6758 "$define"|true|[yY]*)
6759         case "$ptrsize" in
6760         4)      cat <<EOM >&4
6761
6762 *** You have chosen a maximally 64-bit build,
6763 *** but your pointers are only 4 bytes wide.
6764 *** Please rerun Configure without -Duse64bitall.
6765 EOM
6766                 case "$d_quad" in
6767                 define)
6768                         cat <<EOM >&4
6769 *** Since you have quads, you could possibly try with -Duse64bitint.
6770 EOM
6771                         ;;
6772                 esac
6773                 cat <<EOM >&4
6774 *** Cannot continue, aborting.
6775
6776 EOM
6777
6778                 exit 1
6779                 ;;
6780         esac
6781         ;;
6782 esac
6783
6784
6785 : determine whether to use malloc wrapping
6786 echo " "
6787 case "$usemallocwrap" in
6788 [yY]*|true|$define)     dflt='y' ;;
6789 [nN]*|false|$undef)     dflt='n' ;;
6790 *)      case "$usedevel" in
6791         [yY]*|true|$define)     dflt='y' ;;
6792         *) dflt='n' ;;
6793         esac
6794         ;;
6795 esac
6796 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6797 . ./myread
6798 usemallocwrap="$ans"
6799 case "$ans" in
6800 y*|true)
6801         usemallocwrap="$define" ;;
6802 *)
6803         usemallocwrap="$undef" ;;
6804 esac
6805
6806 : determine which malloc to compile in
6807 echo " "
6808 case "$usemymalloc" in
6809 [yY]*|true|$define)     dflt='y' ;;
6810 [nN]*|false|$undef)     dflt='n' ;;
6811 *)      case "$ptrsize" in
6812         4) dflt='y' ;;
6813         *) dflt='n' ;;
6814         esac
6815         if test "$useithreads" = "$define"; then dflt='n'; fi
6816         ;;
6817 esac
6818 rp="Do you wish to attempt to use the malloc that comes with $package?"
6819 . ./myread
6820 usemymalloc="$ans"
6821 case "$ans" in
6822 y*|true)
6823         usemymalloc='y'
6824         mallocsrc='malloc.c'
6825         mallocobj="malloc$_o"
6826         d_mymalloc="$define"
6827         case "$libs" in
6828         *-lmalloc*)
6829                 : Remove malloc from list of libraries to use
6830                 echo "Removing unneeded -lmalloc from library list" >&4
6831                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6832                 shift
6833                 libs="$*"
6834                 echo "libs = $libs" >&4
6835                 ;;
6836         esac
6837         ;;
6838 *)
6839         usemymalloc='n'
6840         mallocsrc=''
6841         mallocobj=''
6842         d_mymalloc="$undef"
6843         ;;
6844 esac
6845
6846 : compute the return types of malloc and free
6847 echo " "
6848 $cat >malloc.c <<END
6849 #$i_malloc I_MALLOC
6850 #$i_stdlib I_STDLIB
6851 #include <stdio.h>
6852 #include <sys/types.h>
6853 #ifdef I_MALLOC
6854 #include <malloc.h>
6855 #endif
6856 #ifdef I_STDLIB
6857 #include <stdlib.h>
6858 #endif
6859 #ifdef TRY_MALLOC
6860 void *malloc();
6861 #endif
6862 #ifdef TRY_FREE
6863 void free();
6864 #endif
6865 END
6866 case "$malloctype" in
6867 '')
6868         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6869                 malloctype='void *'
6870         else
6871                 malloctype='char *'
6872         fi
6873         ;;
6874 esac
6875 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6876
6877 case "$freetype" in
6878 '')
6879         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6880                 freetype='void'
6881         else
6882                 freetype='int'
6883         fi
6884         ;;
6885 esac
6886 echo "Your system uses $freetype free(), it would seem." >&4
6887 $rm -f malloc.[co]
6888 : determine where site specific architecture-dependent libraries go.
6889 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6890 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6891 : sitelib may have an optional trailing /share.
6892 case "$sitearch" in
6893 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6894         dflt="$dflt/$archname"
6895         ;;
6896 *)      dflt="$sitearch"
6897         ;;
6898 esac
6899 set sitearch sitearch none
6900 eval $prefixit
6901 $cat <<EOM
6902
6903 The installation process will also create a directory for
6904 architecture-dependent site-specific extensions and modules.
6905
6906 EOM
6907 fn=d~+
6908 rp='Pathname for the site-specific architecture-dependent library files?'
6909 . ./getfile
6910 prefixvar=sitearch
6911 . ./setprefixvar
6912 if $test X"$sitearch" = X"$sitelib"; then
6913         d_sitearch="$undef"
6914 else
6915         d_sitearch="$define"
6916 fi
6917
6918 : Set the vendorprefix variables
6919 $cat <<EOM
6920
6921 The installation process will also create a directory for
6922 vendor-supplied add-ons.  Vendors who supply perl with their system
6923 may find it convenient to place all vendor-supplied files in this
6924 directory rather than in the main distribution directory.  This will
6925 ease upgrades between binary-compatible maintenance versions of perl.
6926
6927 Of course you may also use these directories in whatever way you see
6928 fit.  For example, you might use them to access modules shared over a
6929 company-wide network.
6930
6931 The default answer should be fine for most people.
6932 This causes further questions about vendor add-ons to be skipped
6933 and no vendor-specific directories will be configured for perl.
6934
6935 EOM
6936 rp='Do you want to configure vendor-specific add-on directories?'
6937 case "$usevendorprefix" in
6938 define|true|[yY]*) dflt=y ;;
6939 *)      : User may have set vendorprefix directly on Configure command line.
6940         case "$vendorprefix" in
6941         ''|' ') dflt=n ;;
6942         *)      dflt=y ;;
6943         esac
6944         ;;
6945 esac
6946 . ./myread
6947 case "$ans" in
6948 [yY]*)  fn=d~+
6949         rp='Installation prefix to use for vendor-supplied add-ons?'
6950         case "$vendorprefix" in
6951         '') dflt="$prefix" ;;
6952         *)  dflt=$vendorprefix ;;
6953         esac
6954         . ./getfile
6955         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6956         oldvendorprefix=''
6957         case "$vendorprefix" in
6958         '') ;;
6959         *)      case "$ans" in
6960                 "$prefix") ;;
6961                 *) oldvendorprefix="$prefix";;
6962                 esac
6963                 ;;
6964         esac
6965         usevendorprefix="$define"
6966         vendorprefix="$ans"
6967         vendorprefixexp="$ansexp"
6968         ;;
6969 *)      usevendorprefix="$undef"
6970         vendorprefix=''
6971         vendorprefixexp=''
6972         ;;
6973 esac
6974
6975 : Set the vendorlib variables
6976 case "$vendorprefix" in
6977 '')     d_vendorlib="$undef"
6978         vendorlib=''
6979         vendorlibexp=''
6980         ;;
6981 *)      d_vendorlib="$define"
6982         : determine where vendor-supplied modules go.
6983         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6984         case "$vendorlib" in
6985         '')
6986                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6987                 case "$installstyle" in
6988                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6989                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6990                 esac
6991                 ;;
6992         *)      dflt="$vendorlib"
6993                 ;;
6994         esac
6995         fn=d~+
6996         rp='Pathname for the vendor-supplied library files?'
6997         . ./getfile
6998         vendorlib="$ans"
6999         vendorlibexp="$ansexp"
7000         ;;
7001 esac
7002 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7003 prefixvar=vendorlib
7004 . ./installprefix
7005
7006 : Set the vendorarch variables
7007 case "$vendorprefix" in
7008 '')     d_vendorarch="$undef"
7009         vendorarch=''
7010         vendorarchexp=''
7011         ;;
7012 *)      d_vendorarch="$define"
7013         : determine where vendor-supplied architecture-dependent libraries go.
7014         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7015         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7016         : vendorlib may have an optional trailing /share.
7017         case "$vendorarch" in
7018         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7019                 dflt="$dflt/$archname"
7020                 ;;
7021         *)      dflt="$vendorarch" ;;
7022         esac
7023         fn=d~+
7024         rp='Pathname for vendor-supplied architecture-dependent files?'
7025         . ./getfile
7026         vendorarch="$ans"
7027         vendorarchexp="$ansexp"
7028         ;;
7029 esac
7030 prefixvar=vendorarch
7031 . ./installprefix
7032 if $test X"$vendorarch" = X"$vendorlib"; then
7033         d_vendorarch="$undef"
7034 else
7035         d_vendorarch="$define"
7036 fi
7037
7038 : Final catch-all directories to search
7039 $cat <<EOM
7040
7041 Lastly, you can have perl look in other directories for extensions and
7042 modules in addition to those already specified.
7043 These directories will be searched after
7044         $sitearch
7045         $sitelib
7046 EOM
7047 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7048 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7049 echo ' '
7050 case "$otherlibdirs" in
7051 ''|' ') dflt='none' ;;
7052 *)      dflt="$otherlibdirs" ;;
7053 esac
7054 $cat <<EOM
7055 Enter a colon-separated set of extra paths to include in perl's @INC
7056 search path, or enter 'none' for no extra paths.
7057
7058 EOM
7059
7060 rp='Colon-separated list of additional directories for perl to search?'
7061 . ./myread
7062 case "$ans" in
7063 ' '|''|none)    otherlibdirs=' ' ;;
7064 *)      otherlibdirs="$ans" ;;
7065 esac
7066 case "$otherlibdirs" in
7067 ' ') val=$undef ;;
7068 *)      val=$define ;;
7069 esac
7070 set d_perl_otherlibdirs
7071 eval $setvar
7072
7073 : Cruising for prototypes
7074 echo " "
7075 echo "Checking out function prototypes..." >&4
7076 $cat >prototype.c <<EOCP
7077 #$i_stdlib I_STDLIB
7078 #ifdef I_STDLIB
7079 #include <stdlib.h>
7080 #endif
7081 int main(int argc, char *argv[]) {
7082         exit(0);}
7083 EOCP
7084 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7085         echo "Your C compiler appears to support function prototypes."
7086         val="$define"
7087 else
7088         echo "Your C compiler doesn't seem to understand function prototypes."
7089         val="$undef"
7090 fi
7091 set prototype
7092 eval $setvar
7093 $rm -f prototype*
7094
7095 : Check if ansi2knr is required
7096 case "$prototype" in
7097 "$define") ;;
7098 *)      ansi2knr='ansi2knr'
7099         echo " "
7100         cat <<EOM >&4
7101
7102 $me:  FATAL ERROR:
7103 This version of $package can only be compiled by a compiler that 
7104 understands function prototypes.  Unfortunately, your C compiler 
7105         $cc $ccflags
7106 doesn't seem to understand them.  Sorry about that.
7107
7108 If GNU cc is available for your system, perhaps you could try that instead.  
7109
7110 Eventually, we hope to support building Perl with pre-ANSI compilers.
7111 If you would like to help in that effort, please contact <perlbug@perl.org>.
7112
7113 Aborting Configure now.
7114 EOM
7115         exit 2
7116         ;;
7117 esac
7118
7119 : DTrace support
7120 dflt_dtrace='/usr/sbin/dtrace'
7121 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7122
7123 cat <<EOM
7124
7125 Perl can be built to support DTrace on platforms that support it.
7126 DTrace is a diagnosis and performance analysis tool from Sun.
7127
7128 If this doesn't make any sense to you, just accept the default '$dflt'.
7129 EOM
7130
7131 while $test 1 ; do
7132         case "$usedtrace" in
7133         $define|true|[yY]*)
7134                 dflt='y'
7135                 ;;
7136         ?*)
7137                 dflt='y'
7138                 dflt_dtrace=$usedtrace
7139                 ;;
7140         *)
7141                 dflt='n'
7142                 ;;
7143         esac
7144
7145         rp='Support DTrace if available?'
7146         . ./myread
7147         case "$ans" in
7148         y|Y)    val="$define" ;;
7149         *)      val="$undef" ;;
7150         esac
7151         set usedtrace
7152         eval $setvar
7153
7154         test "X$usedtrace" != "X$define" && break
7155
7156         echo " "
7157         rp='Where is the dtrace executable?'
7158         dflt=$dflt_dtrace
7159         . ./getfile
7160         val="$ans"
7161         set dtrace
7162         eval $setvar
7163
7164         if $test -f $dtrace
7165         then
7166                 if $dtrace -h -s ../perldtrace.d \
7167                         -o perldtrace.tmp >/dev/null 2>&1 \
7168                         && rm -f perldtrace.tmp
7169                 then
7170                         echo " "
7171                         echo "Good: your $dtrace knows about the -h flag."
7172                 else
7173                         cat >&2 <<EOM
7174
7175 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7176 ***
7177 *** Your installed dtrace doesn't support the -h switch to compile a D
7178 *** program into a C header. Can't continue.
7179
7180 EOM
7181                         exit 1
7182                 fi
7183                 break;
7184         fi
7185
7186         case "$fastread" in
7187         yes)
7188                 cat >&2 <<EOM
7189
7190 *** $me:  Fatal Error:  $dtrace not found.
7191 *** Can't continue.
7192
7193 EOM
7194                 exit 1
7195                 ;;
7196         *)
7197                 echo "*** $dtrace was not found."
7198                 echo " "
7199                 ;;
7200         esac
7201 done
7202
7203 : See if we want extra modules installed
7204 echo " "
7205 case "$extras" in
7206 '') dflt='n';;
7207 *) dflt='y';;
7208 esac
7209 cat <<EOM
7210 Perl can be built with extra modules or bundles of modules which
7211 will be fetched from the CPAN and installed alongside Perl.
7212
7213 Notice that you will need access to the CPAN; either via the Internet,
7214 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7215 be asked later to configure the CPAN.pm module which will in turn do
7216 the installation of the rest of the extra modules or bundles.)
7217
7218 Notice also that if the modules require any external software such as
7219 libraries and headers (the libz library and the zlib.h header for the
7220 Compress::Zlib module, for example) you MUST have any such software
7221 already installed, this configuration process will NOT install such
7222 things for you.
7223
7224 If this doesn't make any sense to you, just accept the default '$dflt'.
7225 EOM
7226 rp='Install any extra modules (y or n)?'
7227 . ./myread
7228 case "$ans" in
7229 y|Y)
7230         cat <<EOM
7231
7232 Please list any extra modules or bundles to be installed from CPAN,
7233 with spaces between the names.  The names can be in any format the
7234 'install' command of CPAN.pm will understand.  (Answer 'none',
7235 without the quotes, to install no extra modules or bundles.)
7236 EOM
7237         rp='Extras?'
7238         dflt="$extras"
7239         . ./myread
7240         extras="$ans"
7241 esac
7242 case "$extras" in
7243 ''|'none')
7244         val=''
7245         $rm -f ../extras.lst
7246         ;;
7247 *)      echo "(Saving the list of extras for later...)"
7248         echo "$extras" > ../extras.lst
7249         val="'$extras'"
7250         ;;
7251 esac
7252 set extras
7253 eval $setvar
7254 echo " "
7255
7256 : determine where html pages for programs go
7257 set html1dir html1dir none
7258 eval $prefixit
7259 $cat <<EOM
7260
7261 If you wish to install html files for programs in $spackage, indicate
7262 the appropriate directory here.  To skip installing html files,
7263 answer "none".
7264 EOM
7265 case "$html1dir" in
7266 ''|none|$undef|' ') dflt=none ;;
7267 *) dflt=$html1dir ;;
7268 esac
7269 fn=dn+~
7270 rp="Directory for the main $spackage html pages?"
7271 . ./getfile
7272 prefixvar=html1dir
7273 . ./setprefixvar
7274 : Use ' ' for none so value is preserved next time through Configure
7275 $test X"$html1dir" = "X" && html1dir=' '
7276
7277 : determine where html pages for libraries and modules go
7278 set html3dir html3dir none
7279 eval $prefixit
7280 $cat <<EOM
7281
7282 If you wish to install html files for modules associated with $spackage,
7283 indicate the appropriate directory here.  To skip installing html files,
7284 answer "none".
7285 EOM
7286 : There is no obvious default.  If they have specified html1dir, then
7287 : try to key off that, possibly changing .../html1 into .../html3.
7288 case "$html3dir" in
7289 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7290 *) dflt=$html3dir ;;
7291 esac
7292 fn=dn+~
7293 rp="Directory for the $spackage module html pages?"
7294 . ./getfile
7295 prefixvar=html3dir
7296 . ./setprefixvar
7297 : Use ' ' for none so value is preserved next time through Configure
7298 $test X"$html3dir" = "X" && html3dir=' '
7299
7300 : determine whether to install perl also as /usr/bin/perl
7301
7302 echo " "
7303 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7304         $cat <<EOM
7305 Many scripts expect perl to be installed as /usr/bin/perl.
7306
7307 If you want to, I can install the perl you are about to compile
7308 as /usr/bin/perl (in addition to $bin/perl).
7309 EOM
7310         if test -f /usr/bin/perl; then
7311             $cat <<EOM
7312
7313 However, please note that because you already have a /usr/bin/perl,
7314 overwriting that with a new Perl would very probably cause problems.
7315 Therefore I'm assuming you don't want to do that (unless you insist).
7316
7317 EOM
7318             case "$installusrbinperl" in
7319             "$define"|[yY]*)    dflt='y';;
7320             *)                  dflt='n';;
7321             esac
7322         else
7323             $cat <<EOM
7324
7325 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7326
7327 EOM
7328             case "$installusrbinperl" in
7329             "$undef"|[nN]*)     dflt='n';;
7330             *)                  dflt='y';;
7331             esac
7332         fi
7333         rp="Do you want to install perl as /usr/bin/perl?"
7334         . ./myread
7335         case "$ans" in
7336         [yY]*)  val="$define";;
7337         *)      val="$undef" ;;
7338         esac
7339 else
7340         val="$undef"
7341 fi
7342 set installusrbinperl
7343 eval $setvar
7344
7345 : Check if we are using the GNU C library
7346 echo " "
7347 echo "Checking for GNU C Library..." >&4
7348 cat >try.c <<'EOCP'
7349 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7350    alone are insufficient to distinguish different versions, such as
7351    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7352    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7353 */
7354 #include <stdio.h>
7355 int main(void)
7356 {
7357 #ifdef __GLIBC__
7358 #   ifdef __GLIBC_MINOR__
7359 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7360 #           include <gnu/libc-version.h>
7361             printf("%s\n",  gnu_get_libc_version());
7362 #       else
7363             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7364 #       endif
7365 #   else
7366         printf("%d\n",  __GLIBC__);
7367 #   endif
7368     return 0;
7369 #else
7370     return 1;
7371 #endif
7372 }
7373 EOCP
7374 set try
7375 if eval $compile_ok && $run ./try > glibc.ver; then
7376         val="$define"
7377         gnulibc_version=`$cat glibc.ver`
7378         echo "You are using the GNU C Library version $gnulibc_version"
7379 else
7380         val="$undef"
7381         gnulibc_version=''
7382         echo "You are not using the GNU C Library"
7383 fi
7384 $rm_try glibc.ver
7385 set d_gnulibc
7386 eval $setvar
7387
7388 : see if nm is to be used to determine whether a symbol is defined or not
7389 case "$usenm" in
7390 '')
7391         dflt=''
7392         case "$d_gnulibc" in
7393         "$define")
7394                 echo " "
7395                 echo "nm probably won't work on the GNU C Library." >&4
7396                 dflt=n
7397                 ;;
7398         esac
7399         case "$dflt" in
7400         '')
7401                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7402                         echo " "
7403                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7404                         echo "'nm' won't be sufficient on this system." >&4
7405                         dflt=n
7406                 fi
7407                 ;;
7408         esac
7409         case "$dflt" in
7410         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7411                 if $test $dflt -gt 20; then
7412                         dflt=y
7413                 else
7414                         dflt=n
7415                 fi
7416                 ;;
7417         esac
7418         ;;
7419 *)
7420         case "$usenm" in
7421         true|$define) dflt=y;;
7422         *) dflt=n;;
7423         esac
7424         ;;
7425 esac
7426 $cat <<EOM
7427
7428 I can use $nm to extract the symbols from your C libraries. This
7429 is a time consuming task which may generate huge output on the disk (up
7430 to 3 megabytes) but that should make the symbols extraction faster. The
7431 alternative is to skip the 'nm' extraction part and to compile a small
7432 test program instead to determine whether each symbol is present. If
7433 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7434 this may be the best solution.
7435
7436 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7437
7438 EOM
7439 rp="Shall I use $nm to extract C symbols from the libraries?"
7440 . ./myread
7441 case "$ans" in
7442 [Nn]*) usenm=false;;
7443 *) usenm=true;;
7444 esac
7445
7446 runnm=$usenm
7447 case "$reuseval" in
7448 true) runnm=false;;
7449 esac
7450
7451 : nm options which may be necessary
7452 case "$nm_opt" in
7453 '') if $test -f /mach_boot; then
7454                 nm_opt=''       # Mach
7455         elif $test -d /usr/ccs/lib; then
7456                 nm_opt='-p'     # Solaris (and SunOS?)
7457         elif $test -f /dgux; then
7458                 nm_opt='-p'     # DG-UX
7459         elif $test -f /lib64/rld; then
7460                 nm_opt='-p'     # 64-bit Irix
7461         else
7462                 nm_opt=''
7463         fi;;
7464 esac
7465
7466 : nm options which may be necessary for shared libraries but illegal
7467 : for archive libraries.  Thank you, Linux.
7468 case "$nm_so_opt" in
7469 '')     case "$myuname" in
7470         *linux*|gnu*)
7471                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7472                         nm_so_opt='--dynamic'
7473                 fi
7474                 ;;
7475         esac
7476         ;;
7477 esac
7478
7479 : Figure out where the libc is located
7480 case "$runnm" in
7481 true)
7482 : get list of predefined functions in a handy place
7483 echo " "
7484 case "$libc" in
7485 '') libc=unknown
7486         case "$libs" in
7487         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7488         esac
7489         ;;
7490 esac
7491 case "$libs" in
7492 '') ;;
7493 *)  for thislib in $libs; do
7494         case "$thislib" in
7495         -lc|-lc_s)
7496                 : Handle C library specially below.
7497                 ;;
7498         -l*)
7499                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7500                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7501                         :
7502                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7503                         :
7504                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7505                         :
7506                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7507                         :
7508                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7509                         :
7510                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7511                         :
7512                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7513                         :
7514                 else
7515                         try=''
7516                 fi
7517                 libnames="$libnames $try"
7518                 ;;
7519         *) libnames="$libnames $thislib" ;;
7520         esac
7521         done
7522         ;;
7523 esac
7524 xxx=normal
7525 case "$libc" in
7526 unknown)
7527         set /lib/libc.$so
7528         for xxx in $libpth; do
7529                 $test -r $1 || set $xxx/libc.$so
7530                 : The messy sed command sorts on library version numbers.
7531                 $test -r $1 || \
7532                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7533                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7534                                 h
7535                                 s/[0-9][0-9]*/0000&/g
7536                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7537                                 G
7538                                 s/\n/ /' | \
7539                          $sort | $sed -e 's/^.* //'`
7540                 eval set \$$#
7541         done
7542         $test -r $1 || set /usr/ccs/lib/libc.$so
7543         $test -r $1 || set /lib/libsys_s$_a
7544         ;;
7545 *)
7546         set blurfl
7547         ;;
7548 esac
7549 if $test -r "$1"; then
7550         echo "Your (shared) C library seems to be in $1."
7551         libc="$1"
7552 elif $test -r /lib/libc && $test -r /lib/clib; then
7553         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7554         xxx=apollo
7555         libc='/lib/clib /lib/libc'
7556         if $test -r /lib/syslib; then
7557                 echo "(Your math library is in /lib/syslib.)"
7558                 libc="$libc /lib/syslib"
7559         fi
7560 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7561         echo "Your C library seems to be in $libc, as you said before."
7562 elif $test -r $incpath/usr/lib/libc$_a; then
7563         libc=$incpath/usr/lib/libc$_a;
7564         echo "Your C library seems to be in $libc.  That's fine."
7565 elif $test -r /lib/libc$_a; then
7566         libc=/lib/libc$_a;
7567         echo "Your C library seems to be in $libc.  You're normal."
7568 else
7569         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7570                 :
7571         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7572                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7573         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7574                 :
7575         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7576                 :
7577         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7578                 :
7579         else
7580                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7581         fi
7582         if $test -r "$tans"; then
7583                 echo "Your C library seems to be in $tans, of all places."
7584                 libc=$tans
7585         else
7586                 libc='blurfl'
7587         fi
7588 fi
7589 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7590         dflt="$libc"
7591         cat <<EOM
7592
7593 If the guess above is wrong (which it might be if you're using a strange
7594 compiler, or your machine supports multiple models), you can override it here.
7595
7596 EOM
7597 else
7598         dflt=''
7599         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7600         cat >&4 <<EOM
7601 I can't seem to find your C library.  I've looked in the following places:
7602
7603 EOM
7604         $sed 's/^/      /' libpath
7605         cat <<EOM
7606
7607 None of these seems to contain your C library. I need to get its name...
7608
7609 EOM
7610 fi
7611 fn=f
7612 rp='Where is your C library?'
7613 . ./getfile
7614 libc="$ans"
7615
7616 echo " "
7617 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7618 set X `cat libnames`
7619 shift
7620 xxx=files
7621 case $# in 1) xxx=file; esac
7622 echo "Extracting names from the following $xxx for later perusal:" >&4
7623 echo " "
7624 $sed 's/^/      /' libnames >&4
7625 echo " "
7626 $echo $n "This may take a while...$c" >&4
7627
7628 for file in $*; do
7629         case $file in
7630         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7631         *) $nm $nm_opt $file 2>/dev/null;;
7632         esac
7633 done >libc.tmp
7634
7635 $echo $n ".$c"
7636 $grep fprintf libc.tmp > libc.ptf
7637 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7638 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7639 xxx='[ADTSIWi]'
7640 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7641         eval $xscan;\
7642         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7643                 eval $xrun
7644 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7645         eval $xscan;\
7646         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7647                 eval $xrun
7648 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7649         eval $xscan;\
7650         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7651                 eval $xrun
7652 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7653         eval $xscan;\
7654         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7655                 eval $xrun
7656 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7657         eval $xscan;\
7658         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7659                 eval $xrun
7660 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7661         eval $xscan;\
7662         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7663                 eval $xrun
7664 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7665                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7666         eval $xscan;\
7667         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7668                 eval $xrun
7669 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7670         eval $xscan;\
7671         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7672                 eval $xrun
7673 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7674         eval $xscan;\
7675         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7676                 eval $xrun
7677 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7678         eval $xscan;\
7679         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7680                 eval $xrun
7681 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7682         eval $xscan;\
7683         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7684                 eval $xrun
7685 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7686         eval $xscan;\
7687         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7688                 eval $xrun
7689 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7690         eval $xscan;\
7691         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7692                 eval $xrun
7693 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7694         eval $xscan;\
7695         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7696                 eval $xrun
7697 else
7698         $nm -p $* 2>/dev/null >libc.tmp
7699         $grep fprintf libc.tmp > libc.ptf
7700         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7701                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7702         then
7703                 nm_opt='-p'
7704                 eval $xrun
7705         else
7706                 echo " "
7707                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7708                 com=''
7709                 if $ar t $libc > libc.tmp && \
7710                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7711                 then
7712                         for thisname in $libnames $libc; do
7713                                 $ar t $thisname >>libc.tmp
7714                         done
7715                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7716                         echo "Ok." >&4
7717                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7718                         for thisname in $libnames $libc; do
7719                                 $ar tv $thisname >>libc.tmp
7720                                 emximp -o tmp.imp $thisname \
7721                                     2>/dev/null && \
7722                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7723                                     < tmp.imp >>libc.tmp
7724                                 $rm -f tmp.imp
7725                         done
7726                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7727                         echo "Ok." >&4
7728                 else
7729                         echo "$ar didn't seem to work right." >&4
7730                         echo "Maybe this is a Cray...trying bld instead..." >&4
7731                         if  bld t $libc | \
7732                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7733                                 $test -s libc.list
7734                         then
7735                                 for thisname in $libnames; do
7736                                         bld t $libnames | \
7737                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7738                                         $ar t $thisname >>libc.tmp
7739                                 done
7740                                 echo "Ok." >&4
7741                         else
7742                                 echo "That didn't work either.  Giving up." >&4
7743                                 exit 1
7744                         fi
7745                 fi
7746         fi
7747 fi
7748 nm_extract="$com"
7749 case "$PASE" in
7750 define)
7751     echo " "
7752     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7753     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7754     ;;
7755 *)  if $test -f /lib/syscalls.exp; then
7756         echo " "
7757         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7758         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7759                 /lib/syscalls.exp >>libc.list
7760     fi
7761     ;;
7762 esac
7763 ;;
7764 esac
7765 $rm -f libnames libpath
7766
7767 : see if dld is available
7768 set dld.h i_dld
7769 eval $inhdr
7770
7771 : Check if we are using C++
7772 echo " "
7773 echo "Checking for C++..." >&4
7774 $cat >try.c <<'EOCP'
7775 #include <stdio.h>
7776 int main(void)
7777 {
7778 #ifdef __cplusplus
7779     return 0;
7780 #else
7781     return 1;
7782 #endif
7783 }
7784 EOCP
7785 set try
7786 if eval $compile_ok && $run ./try; then
7787         val="$define"
7788         echo "You are using a C++ compiler."
7789 else
7790         val="$undef"
7791         echo "You are not using a C++ compiler."
7792 fi
7793 $rm_try cplusplus$$
7794 set d_cplusplus
7795 eval $setvar
7796
7797 : is a C symbol defined?
7798 csym='tlook=$1;
7799 case "$3" in
7800 -v) tf=libc.tmp; tdc="";;
7801 -a) tf=libc.tmp; tdc="[]";;
7802 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7803 esac;
7804 case "$d_cplusplus" in
7805     $define)    extern_C="extern \"C\"" ;;
7806     *)          extern_C="extern"       ;;
7807 esac;
7808 tx=yes;
7809 case "$reuseval-$4" in
7810 true-) ;;
7811 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7812 esac;
7813 case "$tx" in
7814 yes)
7815         tval=false;
7816         if $test "$runnm" = true; then
7817                 if $contains $tlook $tf >/dev/null 2>&1; then
7818                         tval=true;
7819                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7820                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7821                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7822                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7823                         $rm_try;
7824                 fi;
7825         else
7826                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7827                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7828                 $rm_try;
7829         fi;
7830         ;;
7831 *)
7832         case "$tval" in
7833         $define) tval=true;;
7834         *) tval=false;;
7835         esac;
7836         ;;
7837 esac;
7838 eval "$2=$tval"'
7839
7840 : define an is-in-libc? function
7841 inlibc='echo " "; td=$define; tu=$undef;
7842 sym=$1; var=$2; eval "was=\$$2";
7843 tx=yes;
7844 case "$reuseval$was" in
7845 true) ;;
7846 true*) tx=no;;
7847 esac;
7848 case "$tx" in
7849 yes)
7850         set $sym tres -f;
7851         eval $csym;
7852         case "$tres" in
7853         true)
7854                 echo "$sym() found." >&4;
7855                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7856         *)
7857                 echo "$sym() NOT found." >&4;
7858                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7859         esac;;
7860 *)
7861         case "$was" in
7862         $define) echo "$sym() found." >&4;;
7863         *) echo "$sym() NOT found." >&4;;
7864         esac;;
7865 esac'
7866
7867 : see if dlopen exists
7868 xxx_runnm="$runnm"
7869 xxx_ccflags="$ccflags"
7870 runnm=false
7871 : with g++ one needs -shared to get is-in-libc to work for dlopen
7872 case "$gccversion" in
7873 '')     ;;
7874 *)      case "$d_cplusplus" in
7875         "$define") ccflags="$ccflags -shared" ;;
7876         esac
7877         ;;
7878 esac
7879 set dlopen d_dlopen
7880 eval $inlibc
7881 runnm="$xxx_runnm"
7882 ccflags="$xxx_ccflags"
7883
7884 : see if this is a unistd.h system
7885 set unistd.h i_unistd
7886 eval $inhdr
7887
7888 : determine which dynamic loading, if any, to compile in
7889 echo " "
7890 dldir="ext/DynaLoader"
7891 case "$usedl" in
7892 $define|y|true)
7893         dflt='y'
7894         usedl="$define"
7895         ;;
7896 $undef|n|false)
7897         dflt='n'
7898         usedl="$undef"
7899         ;;
7900 *)
7901         dflt='n'
7902         case "$d_dlopen" in
7903             $define) dflt='y' ;;
7904         esac
7905         case "$i_dld" in
7906             $define) dflt='y' ;;
7907         esac
7908         : Does a dl_xxx.xs file exist for this operating system
7909         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7910         ;;
7911 esac
7912 rp="Do you wish to use dynamic loading?"
7913 . ./myread
7914 usedl="$ans"
7915 bin_ELF="$undef"
7916 case "$ans" in
7917 y*) usedl="$define"
7918         case "$dlsrc" in
7919         '')
7920                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7921                         dflt="$dldir/dl_${osname}.xs"
7922                 elif $test "$d_dlopen" = "$define" ; then
7923                         dflt="$dldir/dl_dlopen.xs"
7924                 elif $test "$i_dld" = "$define" ; then
7925                         dflt="$dldir/dl_dld.xs"
7926                 else
7927                         dflt=''
7928                 fi
7929                 ;;
7930         *)      dflt="$dldir/$dlsrc"
7931                 ;;
7932         esac
7933     echo "The following dynamic loading files are available:"
7934         : Can not go over to $dldir because getfile has path hard-coded in.
7935         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7936         rp="Source file to use for dynamic loading"
7937         fn="fne"
7938         gfpth="$src"
7939         . ./getfile
7940         usedl="$define"
7941         : emulate basename
7942         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7943
7944         $cat << EOM
7945
7946 Some systems may require passing special flags to $cc -c to
7947 compile modules that will be used to create a shared library.
7948 To use no flags, say "none".
7949
7950 EOM
7951     case "$cccdlflags" in
7952     '') case "$gccversion" in
7953                 '') case "$osname" in
7954                         hpux)   dflt='+z' ;;
7955                         next)   dflt='none' ;;
7956                         irix*)  dflt='-KPIC' ;;
7957                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7958                         sunos)  dflt='-pic' ;;
7959                         *)      dflt='none' ;;
7960                     esac
7961                         ;;
7962                 *)  case "$osname" in
7963                         darwin) dflt='none' ;;
7964                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7965                         *)      dflt='-fpic' ;;
7966                     esac ;;
7967             esac ;;
7968         ' ') dflt='none' ;;
7969     *)  dflt="$cccdlflags" ;;
7970     esac
7971     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7972     . ./myread
7973     case "$ans" in
7974     none) cccdlflags=' ' ;;
7975     *) cccdlflags="$ans" ;;
7976     esac
7977
7978     cat << EOM
7979
7980 Some systems use ld to create libraries that can be dynamically loaded,
7981 while other systems (such as those using ELF) use $cc.
7982
7983 EOM
7984
7985 : Determine if this is ELF
7986         $cat >try.c <<EOM
7987 /* Test for whether ELF binaries are produced */
7988 #include <fcntl.h>
7989 #$i_stdlib I_STDLIB
7990 #ifdef I_STDLIB
7991 #include <stdlib.h>
7992 #endif
7993 #$i_unistd I_UNISTD
7994 #ifdef I_UNISTD
7995 #include <unistd.h>
7996 #endif
7997 int main() {
7998         char b[4];
7999         int i = open("a.out",O_RDONLY);
8000         if(i == -1)
8001                 exit(1); /* fail */
8002         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8003                 exit(0); /* succeed (yes, it is ELF) */
8004         else
8005                 exit(1); /* fail */
8006 }
8007 EOM
8008         if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8009                 bin_ELF="$define"
8010         fi
8011         $rm_try
8012
8013         case "$ld" in
8014         '')     if $test $bin_ELF = "$define"; then
8015                         cat <<EOM
8016 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8017 EOM
8018                         dflt="$cc"
8019                 else
8020                         echo "I'll use ld to build dynamic libraries."
8021                         dflt='ld'
8022                 fi
8023                 ;;
8024         *)      dflt="$ld"
8025                 ;;
8026         esac
8027
8028     rp="What command should be used to create dynamic libraries?"
8029     . ./myread
8030         ld="$ans"
8031
8032     cat << EOM
8033
8034 Some systems may require passing special flags to $ld to create a
8035 library that can be dynamically loaded.  If your ld flags include
8036 -L/other/path options to locate libraries outside your loader's normal
8037 search path, you may need to specify those -L options here as well.  To
8038 use no flags, say "none".
8039
8040 EOM
8041     case "$lddlflags" in
8042     '') case "$osname" in
8043                         haiku) dflt='-shared' ;;
8044                         hpux) dflt='-b';
8045                               case "$gccversion" in
8046                               '') dflt="$dflt +vnocompatwarnings" ;;
8047                               esac
8048                               ;;
8049                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8050                         next)  dflt='none' ;;
8051                         solaris) # See [perl #66604].
8052                                 # On Solaris 11, gcc -m64 on amd64 
8053                                 # appears not to understand -G.  gcc versions at
8054                                 # least as old as 3.4.3 support -shared, so just
8055                                 # use that with Solaris 11 and later, but keep
8056                                 # the old behavior for older Solaris versions.
8057                                 case "$gccversion" in
8058                                         '') dflt='-G' ;;
8059                                         *)      case "$osvers" in
8060                                                         2.?|2.10) dflt='-G' ;;
8061                                                         *) dflt='-shared' ;;
8062                                                 esac
8063                                                 ;;
8064                                 esac
8065                                 ;;
8066                         sunos) dflt='-assert nodefinitions' ;;
8067                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8068                 *)     dflt='none' ;;
8069                         esac
8070                         ;;
8071     *) dflt="$lddlflags" ;;
8072     esac
8073
8074         : Try to guess additional flags to pick up local libraries.
8075         : Be careful not to append to a plain 'none'
8076         case "$dflt" in
8077         none) dflt='' ;;
8078         esac
8079         for thisflag in $ldflags; do
8080                 case "$thisflag" in
8081                 -L*|-R*|-Wl,-R*)
8082                         case " $dflt " in
8083                         *" $thisflag "*) ;;
8084                         *) dflt="$dflt $thisflag" ;;
8085                         esac
8086                         ;;
8087                 esac
8088         done
8089
8090         case "$dflt" in
8091         ''|' ') dflt='none' ;;
8092         esac
8093
8094         case "$ldflags" in
8095         *-fstack-protector*)
8096             case "$dflt" in
8097                         *-fstack-protector*) ;; # Don't add it again
8098                         *) dflt="$dflt -fstack-protector" ;; 
8099                 esac
8100                 ;;
8101         esac
8102
8103
8104     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8105     . ./myread
8106     case "$ans" in
8107     none) lddlflags=' ' ;;
8108     *) lddlflags="$ans" ;;
8109     esac
8110
8111         cat <<EOM
8112
8113 Some systems may require passing special flags to $cc to indicate that
8114 the resulting executable will use dynamic linking.  To use no flags,
8115 say "none".
8116
8117 EOM
8118     case "$ccdlflags" in
8119     '') case "$osname" in
8120             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8121             next|sunos) dflt='none' ;;
8122             *)          dflt='none' ;;
8123             esac ;;
8124     ' ')  dflt='none' ;;
8125     *)  dflt="$ccdlflags" ;;
8126     esac
8127     rp="Any special flags to pass to $cc to use dynamic linking?"
8128     . ./myread
8129     case "$ans" in
8130     none) ccdlflags=' ' ;;
8131     *) ccdlflags="$ans" ;;
8132     esac
8133     ;;
8134 *)  usedl="$undef"
8135         ld='ld'
8136     dlsrc='dl_none.xs'
8137     lddlflags=''
8138     ccdlflags=''
8139     ;;
8140 esac
8141
8142 ld_can_script="$undef"
8143 case "$bin_ELF$usedl" in
8144 $define$define)
8145     # Abuse try.h and a.out names for neat cleanup
8146     $cat >try.c <<EOM
8147 void foo() {}
8148 void bar() {}
8149 EOM
8150     $cat >try.h <<EOM
8151 LIBTEST_42 {
8152  global:
8153   foo;
8154  local: *;
8155  };
8156 EOM
8157     if $cc $cccdlflags $ccdlflags $ccflags \
8158            $ldflags $lddlflags -o a.out try.c \
8159            -Wl,--version-script=try.h >/dev/null 2>&1 \
8160        &&  $test -s a.out ; then
8161         echo "ld supports scripting" >&4
8162         ld_can_script="$define"
8163     else
8164         echo "ld does not support scripting" >&4
8165     fi
8166     $rm_try
8167     ;;
8168 esac
8169
8170 : Do we want a shared libperl?
8171 also=''
8172 case "$usedl" in
8173 $undef)
8174         # No dynamic loading being used, so don't bother even to prompt.
8175         useshrplib='false'
8176         ;;
8177 *)      case "$useshrplib" in
8178         '')     case "$osname" in
8179                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8180                         dflt=y
8181                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8182                         ;;
8183                 next*)
8184                         case "$osvers" in
8185                         4*)     dflt=y
8186                                 also='Building a shared libperl is needed for MAB support.'
8187                                 ;;
8188                         *)      dflt=n
8189                                 ;;
8190                         esac
8191                         ;;
8192                 *)      dflt=n
8193                         ;;
8194                 esac
8195                 ;;
8196         $define|true|[Yy]*)
8197                 dflt=y
8198                 ;;
8199         *)      dflt=n
8200                 ;;
8201         esac
8202         $cat << EOM
8203
8204 The perl executable is normally obtained by linking perlmain.c with
8205 libperl${_a}, any static extensions (usually just DynaLoader), and
8206 any other libraries needed on this system (such as -lm, etc.).  Since
8207 your system supports dynamic loading, it is probably possible to build
8208 a shared libperl.$so.  If you will have more than one executable linked
8209 to libperl.$so, this will significantly reduce the size of each
8210 executable, but it may have a noticeable effect on performance.  The
8211 default is probably sensible for your system.
8212 $also
8213
8214 EOM
8215         rp="Build a shared libperl.$so (y/n)"
8216         . ./myread
8217         case "$ans" in
8218         true|$define|[Yy]*)
8219                 useshrplib='true'  ;;
8220         *)      useshrplib='false' ;;
8221         esac
8222         ;;
8223 esac
8224
8225 case "$useshrplib" in
8226 true)
8227         case "$userelocatableinc" in
8228         true|define)
8229                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8230                 echo "See INSTALL for an explanation why that won't work." >&4
8231                 exit 4
8232                 ;;
8233         esac
8234         case "$libperl" in
8235         '')
8236                 # Figure out a good name for libperl.so.  Since it gets stored in
8237                 # a version-specific architecture-dependent library, the version
8238                 # number isn't really that important, except for making cc/ld happy.
8239                 #
8240                 # A name such as libperl.so.10.1
8241                 majmin="libperl.$so.$patchlevel.$subversion"
8242                 # A name such as libperl.so.100
8243                 majonly=`echo $patchlevel $subversion |
8244                         $awk '{printf "%d%02d", $1, $2}'`
8245                 majonly=libperl.$so.$majonly
8246                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8247                 # rely on figuring it out from the naming of libc.
8248                 case "${osname}${osvers}" in
8249                 next4*)
8250                         dflt=libperl.5.$so
8251                         # XXX How handle the --version stuff for MAB?
8252                         ;;
8253                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8254                         dflt=libperl.$so
8255                         ;;
8256                 cygwin*) # ld links now against the dll directly
8257                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8258                         majonly=`echo $patchlevel $subversion |
8259                                 $awk '{printf "%03d%03d", $1, $2}'`
8260                         majonly=cygperl5.$majonly.$so
8261                         dflt=$majmin
8262                         ;;
8263                 *)      # Try to guess based on whether libc has major.minor.
8264                         case "$libc" in
8265                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8266                         *libc.$so.[0-9]*) dflt=$majonly ;;
8267                         *)      dflt=libperl.$so ;;
8268                         esac
8269                         ;;
8270                 esac
8271                 ;;
8272         *)      dflt=$libperl
8273                 ;;
8274         esac
8275         cat << EOM
8276
8277 I need to select a good name for the shared libperl.  If your system uses
8278 library names with major and minor numbers, then you might want something
8279 like $majmin.  Alternatively, if your system uses a single version
8280 number for shared libraries, then you might want to use $majonly.
8281 Or, your system might be quite happy with a simple libperl.$so.
8282
8283 Since the shared libperl will get installed into a version-specific
8284 architecture-dependent directory, the version number of the shared perl
8285 library probably isn't important, so the default should be o.k.
8286
8287 EOM
8288         rp='What name do you want to give to the shared libperl?'
8289         . ./myread
8290         libperl=$ans
8291         echo "Ok, I'll use $libperl"
8292         ;;
8293 *)
8294         libperl="libperl${_a}"
8295         ;;
8296 esac
8297
8298 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8299 case "$shrpdir" in
8300 '') ;;
8301 *)      $cat >&4 <<EOM
8302 WARNING:  Use of the shrpdir variable for the installation location of
8303 the shared $libperl is not supported.  It was never documented and
8304 will not work in this version.  Let me (perlbug@perl.org)
8305 know of any problems this may cause.
8306
8307 EOM
8308         case "$shrpdir" in
8309         "$archlibexp/CORE")
8310                 $cat >&4 <<EOM
8311 But your current setting of $shrpdir is
8312 the default anyway, so it's harmless.
8313 EOM
8314                 ;;
8315         *)
8316                 $cat >&4 <<EOM
8317 Further, your current attempted setting of $shrpdir
8318 conflicts with the value of $archlibexp/CORE
8319 that installperl will use.
8320 EOM
8321                 ;;
8322         esac
8323         ;;
8324 esac
8325
8326 # How will the perl executable find the installed shared $libperl?
8327 # Add $xxx to ccdlflags.
8328 # If we can't figure out a command-line option, use $shrpenv to
8329 # set env LD_RUN_PATH.  The main perl makefile uses this.
8330 shrpdir=$archlibexp/CORE
8331 xxx=''
8332 tmp_shrpenv=''
8333 if "$useshrplib"; then
8334     case "$osname" in
8335         aix)
8336                 # We'll set it in Makefile.SH...
8337                 ;;
8338         solaris)
8339                 xxx="-R $shrpdir"
8340                 ;;
8341         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly)
8342                 xxx="-Wl,-R$shrpdir"
8343                 ;;
8344         bsdos|linux|irix*|dec_osf|gnu*)
8345                 xxx="-Wl,-rpath,$shrpdir"
8346                 ;;
8347         next)
8348                 # next doesn't like the default...
8349                 ;;
8350         haiku)
8351                 # Haiku doesn't like the default, either.
8352                 ;;
8353         hpux*)
8354                 # hpux doesn't like the default, either.
8355                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8356                 ;;
8357         cygwin)
8358                 # cygwin needs only ldlibpth
8359                 ;;
8360         *)
8361                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8362                 ;;
8363         esac
8364         case "$xxx" in
8365         '') ;;
8366         *)
8367                 # Only add $xxx if it isn't already in ccdlflags.
8368                 case " $ccdlflags " in
8369                 *" $xxx "*)     ;;
8370                 *)      ccdlflags="$ccdlflags $xxx"
8371                         cat <<EOM >&4
8372
8373 Adding $xxx to the flags
8374 passed to $ld so that the perl executable will find the
8375 installed shared $libperl.
8376
8377 EOM
8378                         ;;
8379                 esac
8380                 ;;
8381         esac
8382 fi
8383 # Fix ccdlflags in AIX for building external extensions.
8384 # (For building Perl itself bare -bE:perl.exp is needed,
8385 #  Makefile.SH takes care of this.)
8386 case "$osname" in
8387 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8388 esac
8389 # Respect a hint or command-line value.
8390 case "$shrpenv" in
8391 '') shrpenv="$tmp_shrpenv" ;;
8392 esac
8393 case "$ldlibpthname" in
8394 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8395 none)   ldlibpthname='' ;;
8396 esac
8397
8398 : determine where manual pages are on this system
8399 echo " "
8400 case "$sysman" in
8401 '')
8402         syspath='/usr/share/man/man1 /usr/man/man1'
8403         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8404         syspath="$syspath /usr/man/u_man/man1"
8405         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8406         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8407         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8408         sysman=`./loc . /usr/man/man1 $syspath`
8409         ;;
8410 esac
8411 if $test -d "$sysman"; then
8412         echo "System manual is in $sysman." >&4
8413 else
8414         echo "Could not find manual pages in source form." >&4
8415 fi
8416
8417 : determine where manual pages go
8418 set man1dir man1dir none
8419 eval $prefixit
8420 $cat <<EOM
8421
8422 $spackage has manual pages available in source form.
8423 EOM
8424 case "$nroff" in
8425 nroff)
8426         echo "However, you don't have nroff, so they're probably useless to you."
8427         case "$man1dir" in
8428         '') man1dir="none";;
8429         esac;;
8430 esac
8431 echo "If you don't want the manual sources installed, answer 'none'."
8432 case "$man1dir" in
8433 ' ') dflt=none
8434         ;;
8435 '')
8436         lookpath="$prefixexp/share/man/man1"
8437         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8438         lookpath="$lookpath $prefixexp/man/p_man/man1"
8439         lookpath="$lookpath $prefixexp/man/u_man/man1"
8440         lookpath="$lookpath $prefixexp/man/man.1"
8441         case "$sysman" in
8442         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8443         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8444         esac
8445         set dflt
8446         eval $prefixup
8447         ;;
8448 *)  dflt="$man1dir"
8449         ;;
8450 esac
8451 echo " "
8452 fn=dn+~
8453 rp="Where do the main $spackage manual pages (source) go?"
8454 . ./getfile
8455 if $test "X$man1direxp" != "X$ansexp"; then
8456         installman1dir=''
8457 fi
8458 prefixvar=man1dir
8459 . ./setprefixvar
8460
8461 case "$man1dir" in
8462 '')     man1dir=' '
8463         installman1dir='';;
8464 esac
8465
8466 : What suffix to use on installed man pages
8467
8468 case "$man1dir" in
8469 ' ')
8470         man1ext='0'
8471         ;;
8472 *)
8473         rp="What suffix should be used for the main $spackage man pages?"
8474         case "$man1ext" in
8475         '')     case "$man1dir" in
8476                 *1)  dflt=1 ;;
8477                 *1p) dflt=1p ;;
8478                 *1pm) dflt=1pm ;;
8479                 *l) dflt=l;;
8480                 *n) dflt=n;;
8481                 *o) dflt=o;;
8482                 *p) dflt=p;;
8483                 *C) dflt=C;;
8484                 *L) dflt=L;;
8485                 *L1) dflt=L1;;
8486                 *) dflt=1;;
8487                 esac
8488                 ;;
8489         *)      dflt="$man1ext";;
8490         esac
8491         . ./myread
8492         man1ext="$ans"
8493         ;;
8494 esac
8495
8496 : see if we can have long filenames
8497 echo " "
8498 first=123456789abcdef
8499 $rm -f $first
8500 if (echo hi >$first) 2>/dev/null; then
8501         if $test -f 123456789abcde; then
8502                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8503                 val="$undef"
8504         else
8505                 echo 'You can have filenames longer than 14 characters.'>&4
8506                 val="$define"
8507         fi
8508 else
8509         $cat <<'EOM'
8510 You can't have filenames longer than 14 chars.
8511 You can't even think about them!
8512 EOM
8513         val="$undef"
8514 fi
8515 set d_flexfnam
8516 eval $setvar
8517 $rm -rf 123456789abcde*
8518
8519 : determine where library module manual pages go
8520 set man3dir man3dir none
8521 eval $prefixit
8522 $cat <<EOM
8523
8524 $spackage has manual pages for many of the library modules.
8525 EOM
8526
8527 case "$nroff" in
8528 nroff)
8529         $cat <<'EOM'
8530 However, you don't have nroff, so they're probably useless to you.
8531 EOM
8532         case "$man3dir" in
8533         '') man3dir="none";;
8534         esac;;
8535 esac
8536
8537 case "$d_flexfnam" in
8538 undef)
8539         $cat <<'EOM'
8540 However, your system can't handle the long file names like File::Basename.3.
8541 EOM
8542         case "$man3dir" in
8543         '') man3dir="none";;
8544         esac;;
8545 esac
8546
8547 echo "If you don't want the manual sources installed, answer 'none'."
8548 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8549 case "$man3dir" in
8550 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8551         if $test -d "$privlib/man/man3"; then
8552                 cat <<EOM >&4
8553
8554 WARNING:  Previous versions of perl installed man3 pages into
8555 $privlib/man/man3.  This version will suggest a
8556 new default of $dflt.
8557 EOM
8558                 tdflt=$dflt
8559                 dflt='n'
8560                 rp='Do you wish to preserve the old behavior?(y/n)'
8561                 . ./myread
8562                 case "$ans" in
8563                 y*) dflt="$privlib/man/man3" ;;
8564                 *)  dflt=$tdflt ;;
8565                 esac
8566     fi
8567         ;;
8568 *)      dflt="$man3dir" ;;
8569 esac
8570 case "$dflt" in
8571 ' ') dflt=none ;;
8572 esac
8573 echo " "
8574 fn=dn+~
8575 rp="Where do the $package library man pages (source) go?"
8576 . ./getfile
8577 prefixvar=man3dir
8578 . ./setprefixvar
8579
8580 case "$man3dir" in
8581 '')     man3dir=' '
8582         installman3dir='';;
8583 esac
8584
8585 : What suffix to use on installed man pages
8586 case "$man3dir" in
8587 ' ')
8588         man3ext='0'
8589         ;;
8590 *)
8591         rp="What suffix should be used for the $package library man pages?"
8592         case "$man3ext" in
8593         '')     case "$man3dir" in
8594                 *3)  dflt=3 ;;
8595                 *3p) dflt=3p ;;
8596                 *3pm) dflt=3pm ;;
8597                 *l) dflt=l;;
8598                 *n) dflt=n;;
8599                 *o) dflt=o;;
8600                 *p) dflt=p;;
8601                 *C) dflt=C;;
8602                 *L) dflt=L;;
8603                 *L3) dflt=L3;;
8604                 *) dflt=3;;
8605                 esac
8606                 ;;
8607         *)      dflt="$man3ext";;
8608         esac
8609         . ./myread
8610         man3ext="$ans"
8611         ;;
8612 esac
8613
8614 : see if we have to deal with yellow pages, now NIS.
8615 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8616         if $test -f /usr/etc/nibindd; then
8617                 echo " "
8618                 echo "I'm fairly confident you're on a NeXT."
8619                 echo " "
8620                 rp='Do you get the hosts file via NetInfo?'
8621                 dflt=y
8622                 case "$hostcat" in
8623                 nidump*) ;;
8624                 '') ;;
8625                 *) dflt=n;;
8626                 esac
8627                 . ./myread
8628                 case "$ans" in
8629                 y*) hostcat='nidump hosts .';;
8630                 *)      case "$hostcat" in
8631                         nidump*) hostcat='';;
8632                         esac
8633                         ;;
8634                 esac
8635         fi
8636         case "$hostcat" in
8637         nidump*) ;;
8638         *)
8639                 case "$hostcat" in
8640                 *ypcat*) dflt=y;;
8641                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8642                                 dflt=y
8643                         else
8644                                 dflt=n
8645                         fi;;
8646                 *) dflt=n;;
8647                 esac
8648                 echo " "
8649                 rp='Are you getting the hosts file via yellow pages?'
8650                 . ./myread
8651                 case "$ans" in
8652                 y*) hostcat='ypcat hosts';;
8653                 *) hostcat='cat /etc/hosts';;
8654                 esac
8655                 ;;
8656         esac
8657 fi
8658 case "$hostcat" in
8659 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8660 esac
8661 case "$groupcat" in
8662 '') test -f /etc/group && groupcat='cat /etc/group';;
8663 esac
8664 case "$passcat" in
8665 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8666 esac
8667
8668 : now get the host name
8669 echo " "
8670 echo "Figuring out host name..." >&4
8671 case "$myhostname" in
8672 '') cont=true
8673         echo 'Maybe "hostname" will work...'
8674         if tans=`sh -c hostname 2>&1` ; then
8675                 myhostname=$tans
8676                 phostname=hostname
8677                 cont=''
8678         fi
8679         ;;
8680 *) cont='';;
8681 esac
8682 if $test "$cont"; then
8683         if ./xenix; then
8684                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8685                 if tans=`cat /etc/systemid 2>&1` ; then
8686                         myhostname=$tans
8687                         phostname='cat /etc/systemid'
8688                         echo "Whadyaknow.  Xenix always was a bit strange..."
8689                         cont=''
8690                 fi
8691         elif $test -r /etc/systemid; then
8692                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8693         fi
8694 fi
8695 if $test "$cont"; then
8696         echo 'No, maybe "uuname -l" will work...'
8697         if tans=`sh -c 'uuname -l' 2>&1` ; then
8698                 myhostname=$tans
8699                 phostname='uuname -l'
8700         else
8701                 echo 'Strange.  Maybe "uname -n" will work...'
8702                 if tans=`sh -c 'uname -n' 2>&1` ; then
8703                         myhostname=$tans
8704                         phostname='uname -n'
8705                 else
8706                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8707                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8708                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8709                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8710                         else
8711                                 case "$myhostname" in
8712                                 '') echo "Does this machine have an identity crisis or something?"
8713                                         phostname='';;
8714                                 *)
8715                                         echo "Well, you said $myhostname before..."
8716                                         phostname='echo $myhostname';;
8717                                 esac
8718                         fi
8719                 fi
8720         fi
8721 fi
8722 case "$myhostname" in
8723 '') myhostname=noname ;;
8724 esac
8725 : you do not want to know about this
8726 set $myhostname
8727 myhostname=$1
8728
8729 : verify guess
8730 if $test "$myhostname" ; then
8731         dflt=y
8732         rp='Your host name appears to be "'$myhostname'".'" Right?"
8733         . ./myread
8734         case "$ans" in
8735         y*) ;;
8736         *) myhostname='';;
8737         esac
8738 fi
8739
8740 : bad guess or no guess
8741 while $test "X$myhostname" = X ; do
8742         dflt=''
8743         rp="Please type the (one word) name of your host:"
8744         . ./myread
8745         myhostname="$ans"
8746 done
8747
8748 : translate upper to lower if necessary
8749 case "$myhostname" in
8750 *[A-Z]*)
8751         echo "(Normalizing case in your host name)"
8752         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8753         ;;
8754 esac
8755
8756 case "$myhostname" in
8757 *.*)
8758         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8759         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8760         echo "(Trimming domain name from host name--host name is now $myhostname)"
8761         ;;
8762 *) case "$mydomain" in
8763         '')
8764                 {
8765                         test "X$hostcat" = "Xypcat hosts" &&
8766                         ypmatch "$myhostname" hosts 2>/dev/null |\
8767                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8768                         $test -s hosts
8769                 } || {
8770                         test "X$hostcat" != "X" &&
8771                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8772                                         /[       ]$myhostname[  . ]/p" > hosts
8773                 }
8774                 tmp_re="[       . ]"
8775                 if $test -f hosts; then
8776                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8777                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8778                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8779                                 hosts | $sort | $uniq | \
8780                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8781                         case `$echo X$dflt` in
8782                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8783                                 dflt=.
8784                                 ;;
8785                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8786                                 ;;
8787                         esac
8788                 else
8789                         echo "(I cannot locate a hosts database anywhere)"
8790                         dflt=.
8791                 fi
8792                 case "$dflt" in
8793                 .)
8794                         tans=`./loc resolv.conf X /etc /usr/etc`
8795                         if $test -f "$tans"; then
8796                                 echo "(Attempting domain name extraction from $tans)"
8797                                 dflt=.`$sed -n -e 's/   / /g' \
8798                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8799                                   -e 1q 2>/dev/null`
8800                                 case "$dflt" in
8801                                 .) dflt=.`$sed -n -e 's/        / /g' \
8802                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8803                                      -e 1q 2>/dev/null`
8804                                         ;;
8805                                 esac
8806                         fi
8807                         ;;
8808                 esac
8809                 case "$dflt" in
8810                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8811                         dflt=.`sh -c domainname 2>/dev/null`
8812                         case "$dflt" in
8813                         '') dflt='.';;
8814                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8815                         esac
8816                         ;;
8817                 esac
8818                 case "$dflt$osname" in
8819                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8820                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8821                         ;;
8822                 esac
8823                 case "$dflt" in
8824                 .) echo "(Lost all hope -- silly guess then)"
8825                         dflt='.nonet'
8826                         ;;
8827                 esac
8828                 $rm -f hosts
8829                 ;;
8830         *) dflt="$mydomain";;
8831         esac;;
8832 esac
8833 echo " "
8834 rp="What is your domain name?"
8835 . ./myread
8836 tans="$ans"
8837 case "$ans" in
8838 '') ;;
8839 .*) ;;
8840 *) tans=".$tans";;
8841 esac
8842 mydomain="$tans"
8843
8844 : translate upper to lower if necessary
8845 case "$mydomain" in
8846 *[A-Z]*)
8847         echo "(Normalizing case in your domain name)"
8848         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8849         ;;
8850 esac
8851
8852 : a little sanity check here
8853 case "$phostname" in
8854 '') ;;
8855 *)
8856         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8857         $myhostname$mydomain|$myhostname) ;;
8858         *)
8859                 case "$phostname" in
8860                 sed*)
8861                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8862                         ;;
8863                 *)
8864                         echo "(That doesn't agree with your $phostname command, by the way.)"
8865                         ;;
8866                 esac
8867         ;;
8868         esac
8869         ;;
8870 esac
8871
8872 : determine the e-mail address of the user who is running us
8873 $cat <<EOM
8874
8875 I need to get your e-mail address in Internet format if possible, i.e.
8876 something like user@host.domain. Please answer accurately since I have
8877 no easy means to double check it. The default value provided below
8878 is most probably close to reality but may not be valid from outside
8879 your organization...
8880
8881 EOM
8882 cont=x
8883 while test "$cont"; do
8884         case "$MAILDOMAIN" in
8885         '')
8886                 if $test -s /etc/mailname; then
8887                         maildomain=`$cat /etc/mailname`
8888                 else
8889                         maildomain="$myhostname$mydomain"
8890                 fi
8891                 ;;
8892         *)  maildomain="$MAILDOMAIN";;
8893         esac
8894         case "$cf_email" in
8895         '') dflt="$cf_by@$maildomain";;
8896         *)  dflt="$cf_email";;
8897         esac
8898         rp='What is your e-mail address?'
8899         . ./myread
8900         cf_email="$ans"
8901         case "$cf_email" in
8902         *@*.*) cont='' ;;
8903         *)
8904                 rp='Address does not look like an Internet one.  Use it anyway?'
8905                 case "$fastread" in
8906                 yes) dflt=y ;;
8907                 *) dflt=n ;;
8908                 esac
8909                 . ./myread
8910                 case "$ans" in
8911                 y*) cont='' ;;
8912                 *) echo " " ;;
8913                 esac
8914                 ;;
8915         esac
8916 done
8917
8918 : Ask e-mail of administrator
8919 $cat <<EOM
8920
8921 If you or somebody else will be maintaining perl at your site, please
8922 fill in the correct e-mail address here so that they may be contacted
8923 if necessary. Currently, the "perlbug" program included with perl
8924 will send mail to this address in addition to perlbug@perl.org. You may
8925 enter "none" for no administrator.
8926
8927 EOM
8928 case "$perladmin" in
8929 '') dflt="$cf_email";;
8930 *) dflt="$perladmin";;
8931 esac
8932 rp='Perl administrator e-mail address'
8933 . ./myread
8934 perladmin="$ans"
8935
8936 : determine whether to only install version-specific parts.
8937 echo " "
8938 $cat <<EOM
8939 Do you want to install only the version-specific parts of the perl
8940 distribution?  Usually you do *not* want to do this.
8941 EOM
8942 case "$versiononly" in
8943 "$define"|[Yy]*|true) dflt='y' ;;
8944 *) dflt='n';
8945 esac
8946 rp="Do you want to install only the version-specific parts of perl?"
8947 . ./myread
8948 case "$ans" in
8949 [yY]*)  val="$define";;
8950 *)      val="$undef" ;;
8951 esac
8952 set versiononly
8953 eval $setvar
8954
8955 case "$versiononly" in
8956 "$define") inc_version_list=''
8957            inc_version_list_init=0
8958            ;;
8959 esac
8960
8961 : figure out how to guarantee perl startup
8962 : XXX Note that this currently takes advantage of the bug that binexp ignores
8963 :     the Configure -Dinstallprefix setting, which in turn means that under
8964 :     relocatable @INC, initialinstalllocation is what binexp started as.
8965 case "$startperl" in
8966 '')
8967         case "$sharpbang" in
8968         *!)
8969                 $cat <<EOH
8970
8971 I can use the #! construct to start perl on your system. This will
8972 make startup of perl scripts faster, but may cause problems if you
8973 want to share those scripts and perl is not in a standard place
8974 ($initialinstalllocation/perl) on all your platforms. The alternative
8975 is to force a shell by starting the script with a single ':' character.
8976
8977 EOH
8978                 case "$versiononly" in
8979                 "$define")      dflt="$initialinstalllocation/perl$version";;
8980                 *)              dflt="$initialinstalllocation/perl";;
8981                 esac
8982                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8983                 . ./myread
8984                 case "$ans" in
8985                 none)   startperl=": # use perl";;
8986                 *)      startperl="#!$ans"
8987                         if $test 30 -lt `echo "$ans" | wc -c`; then
8988                                 $cat >&4 <<EOM
8989
8990 WARNING:  Some systems limit the #! command to 32 characters.
8991 If you experience difficulty running Perl scripts with #!, try
8992 installing Perl in a directory with a shorter pathname.
8993
8994 EOM
8995                         fi ;;
8996                 esac
8997                 ;;
8998         *) startperl=": # use perl"
8999                 ;;
9000         esac
9001         ;;
9002 esac
9003 echo "I'll use $startperl to start perl scripts."
9004
9005 : figure best path for perl in scripts
9006 case "$perlpath" in
9007 '')
9008         case "$versiononly" in
9009         "$define")      perlpath="$initialinstalllocation/perl$version";;
9010         *)              perlpath="$initialinstalllocation/perl";;
9011         esac
9012         case "$startperl" in
9013         *!*) ;;
9014         *)
9015                 $cat <<EOH
9016
9017 I will use the "eval 'exec'" idiom to start Perl on your system.
9018 I can use the full path of your Perl binary for this purpose, but
9019 doing so may cause problems if you want to share those scripts and
9020 Perl is not always in a standard place ($initialinstalllocation/perl).
9021
9022 EOH
9023                 dflt="$initialinstalllocation/perl"
9024                 rp="What path shall I use in \"eval 'exec'\"?"
9025                 . ./myread
9026                 perlpath="$ans"
9027                 ;;
9028         esac
9029         ;;
9030 esac
9031 case "$startperl" in
9032 *!*)    ;;
9033 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9034 esac
9035
9036 : determine where public executable scripts go
9037 set scriptdir scriptdir
9038 eval $prefixit
9039 case "$scriptdir" in
9040 '')
9041         dflt="$bin"
9042         : guess some guesses
9043         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9044         $test -d /usr/share/bin     && dflt=/usr/share/bin
9045         $test -d /usr/local/script  && dflt=/usr/local/script
9046         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9047         $test -d $prefixexp/script  && dflt=$prefixexp/script
9048         set dflt
9049         eval $prefixup
9050         ;;
9051 *)  dflt="$scriptdir"
9052         ;;
9053 esac
9054 $cat <<EOM
9055
9056 Some installations have a separate directory just for executable scripts so
9057 that they can mount it across multiple architectures but keep the scripts in
9058 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9059 Or you might just lump your scripts in with all your other executables.
9060
9061 EOM
9062 fn=d~
9063 rp='Where do you keep publicly executable scripts?'
9064 . ./getfile
9065 if $test "X$ansexp" != "X$scriptdirexp"; then
9066         installscript=''
9067 fi
9068 installscriptdir=''
9069 prefixvar=scriptdir
9070 . ./setprefixvar
9071 : A little fix up for an irregularly named variable.
9072 installscript="$installscriptdir"
9073
9074 : determine where add-on public executables go
9075 case "$sitebin" in
9076 '')     dflt=$siteprefix/bin ;;
9077 *)      dflt=$sitebin ;;
9078 esac
9079 fn=d~
9080 rp='Pathname where the add-on public executables should be installed?'
9081 . ./getfile
9082 prefixvar=sitebin
9083 . ./setprefixvar
9084
9085 : determine where add-on html pages go
9086 : There is no standard location, so try to copy the previously-selected
9087 : directory structure for the core html pages.
9088 case "$sitehtml1dir" in
9089 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9090 *)     dflt=$sitehtml1dir ;;
9091 esac
9092 case "$dflt" in
9093 ''|' ') dflt=none ;;
9094 esac
9095 fn=dn+~
9096 rp='Pathname where the site-specific html pages should be installed?'
9097 . ./getfile
9098 prefixvar=sitehtml1dir
9099 . ./setprefixvar
9100
9101 : determine where add-on library html pages go
9102 : There is no standard location, so try to copy the previously-selected
9103 : directory structure for the core html pages.
9104 case "$sitehtml3dir" in
9105 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9106 *)     dflt=$sitehtml3dir ;;
9107 esac
9108 case "$dflt" in
9109 ''|' ') dflt=none ;;
9110 esac
9111 fn=dn+~
9112 rp='Pathname where the site-specific library html pages should be installed?'
9113 . ./getfile
9114 prefixvar=sitehtml3dir
9115 . ./setprefixvar
9116
9117 : determine where add-on manual pages go
9118 case "$siteman1dir" in
9119 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9120 *)      dflt=$siteman1dir ;;
9121 esac
9122 case "$dflt" in
9123 ''|' ') dflt=none ;;
9124 esac
9125 fn=dn+~
9126 rp='Pathname where the site-specific manual pages should be installed?'
9127 . ./getfile
9128 prefixvar=siteman1dir
9129 . ./setprefixvar
9130
9131 : determine where add-on library man pages go
9132 case "$siteman3dir" in
9133 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9134 *)      dflt=$siteman3dir ;;
9135 esac
9136 case "$dflt" in
9137 ''|' ') dflt=none ;;
9138 esac
9139 fn=dn+~
9140 rp='Pathname where the site-specific library manual pages should be installed?'
9141 . ./getfile
9142 prefixvar=siteman3dir
9143 . ./setprefixvar
9144
9145 : determine where add-on public executable scripts go
9146 case "$sitescript" in
9147 '')     dflt=$siteprefix/script
9148         $test -d $dflt || dflt=$sitebin ;;
9149 *)  dflt="$sitescript" ;;
9150 esac
9151 fn=d~+
9152 rp='Pathname where add-on public executable scripts should be installed?'
9153 . ./getfile
9154 prefixvar=sitescript
9155 . ./setprefixvar
9156
9157 : Check if faststdio is requested and available
9158 case "$usefaststdio" in
9159 $define|true|[yY]*|'')
9160         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9161         case "$xversion" in
9162         [68])   dflt='y' ;;
9163         *)      dflt='n' ;;
9164         esac
9165         ;;
9166 *) dflt='n';;
9167 esac
9168 cat <<EOM
9169
9170 Perl can be built to use 'fast stdio', which means using the stdio
9171 library but also directly manipulating the stdio buffers to enable
9172 faster I/O.  Using stdio is better for backward compatibility (especially
9173 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9174 interface has been preferred instead of stdio.
9175
9176 If this doesn't make any sense to you, just accept the default '$dflt'.
9177 EOM
9178 rp='Use the "fast stdio" if available?'
9179 . ./myread
9180 case "$ans" in
9181 y|Y)    val="$define" ;;
9182 *)      val="$undef" ;;
9183 esac
9184 set usefaststdio
9185 eval $setvar
9186
9187
9188 : define an is-a-typedef? function
9189 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9190 case "$inclist" in
9191 "") inclist="sys/types.h";;
9192 esac;
9193 eval "varval=\$$var";
9194 case "$varval" in
9195 "")
9196         $rm -f temp.c;
9197         for inc in $inclist; do
9198                 echo "#include <$inc>" >>temp.c;
9199         done;
9200         echo "#ifdef $type" >> temp.c;
9201         echo "printf(\"We have $type\");" >> temp.c;
9202         echo "#endif" >> temp.c;
9203         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9204         if $contains $type temp.E >/dev/null 2>&1; then
9205                 eval "$var=\$type";
9206         else
9207                 eval "$var=\$def";
9208         fi;
9209         $rm -f temp.?;;
9210 *) eval "$var=\$varval";;
9211 esac'
9212
9213 : define an is-a-typedef? function that prompts if the type is not available.
9214 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9215 case "$inclist" in
9216 "") inclist="sys/types.h";;
9217 esac;
9218 eval "varval=\$$var";
9219 case "$varval" in
9220 "")
9221         $rm -f temp.c;
9222         for inc in $inclist; do
9223                 echo "#include <$inc>" >>temp.c;
9224         done;
9225         echo "#ifdef $type" >> temp.c;
9226         echo "printf(\"We have $type\");" >> temp.c;
9227         echo "#endif" >> temp.c;
9228         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9229         echo " " ;
9230         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9231         if $contains $type temp.E >/dev/null 2>&1; then
9232                 echo "$type found." >&4;
9233                 eval "$var=\$type";
9234         else
9235                 echo "$type NOT found." >&4;
9236                 dflt="$def";
9237                 . ./myread ;
9238                 eval "$var=\$ans";
9239         fi;
9240         $rm -f temp.?;;
9241 *) eval "$var=\$varval";;
9242 esac'
9243
9244 : see what type lseek is declared as in the kernel
9245 rp="What is the type used for lseek's offset on this system?"
9246 set off_t lseektype long stdio.h sys/types.h
9247 eval $typedef_ask
9248
9249 echo " "
9250 echo "Checking to see how big your file offsets are..." >&4
9251 $cat >try.c <<EOCP
9252 #include <sys/types.h>
9253 #include <stdio.h>
9254 int main()
9255 {
9256     printf("%d\n", (int)sizeof($lseektype));
9257     return(0);
9258 }
9259 EOCP
9260 set try
9261 if eval $compile_ok; then
9262         lseeksize=`$run ./try`
9263         echo "Your file offsets are $lseeksize bytes long."
9264 else
9265         dflt=$longsize
9266         echo " "
9267         echo "(I can't seem to compile the test program.  Guessing...)"
9268         rp="What is the size of your file offsets (in bytes)?"
9269         . ./myread
9270         lseeksize="$ans"
9271 fi
9272 $rm_try
9273
9274 : see what type file positions are declared as in the library
9275 rp="What is the type for file position used by fsetpos()?"
9276 set fpos_t fpostype long stdio.h sys/types.h
9277 eval $typedef_ask
9278
9279 : Check size for Fpos_t
9280 echo " "
9281 case "$fpostype" in
9282 *_t) zzz="$fpostype"    ;;
9283 *)   zzz="fpos_t"       ;;
9284 esac
9285 echo "Checking the size of $zzz..." >&4
9286 cat > try.c <<EOCP
9287 #include <sys/types.h>
9288 #include <stdio.h>
9289 #$i_stdlib I_STDLIB
9290 #ifdef I_STDLIB
9291 #include <stdlib.h>
9292 #endif
9293 int main() {
9294     printf("%d\n", (int)sizeof($fpostype));
9295     exit(0);
9296 }
9297 EOCP
9298 set try
9299 if eval $compile_ok; then
9300         yyy=`$run ./try`
9301         case "$yyy" in
9302         '')     fpossize=4
9303                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9304                 ;;
9305         *)      fpossize=$yyy
9306                 echo "Your $zzz is $fpossize bytes long."
9307                 ;;
9308         esac
9309 else
9310         dflt="$longsize"
9311         echo " " >&4
9312         echo "(I can't compile the test program.  Guessing...)" >&4
9313         rp="What is the size of your file positions (in bytes)?"
9314         . ./myread
9315         fpossize="$ans"
9316 fi
9317
9318 : Check for large file support
9319 # Backward compatibility (uselfs is deprecated).
9320 case "$uselfs" in
9321 "$define"|true|[yY]*)
9322         cat <<EOM >&4
9323
9324 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9325 EOM
9326         uselargefiles="$define"
9327         ;;
9328 esac
9329
9330 case "$lseeksize:$fpossize" in
9331 8:8) cat <<EOM
9332
9333 You can have files larger than 2 gigabytes.
9334 EOM
9335    val="$define" ;;
9336 *)    case "$uselargefiles" in
9337    "$undef"|false|[nN]*) dflt='n' ;;
9338    *)   dflt='y' ;;
9339    esac
9340    cat <<EOM
9341
9342 Perl can be built to understand large files (files larger than 2 gigabytes)
9343 on some systems.  To do so, Configure can be run with -Duselargefiles.
9344
9345 If this doesn't make any sense to you, just accept the default '$dflt'.
9346 EOM
9347    rp='Try to understand large files, if available?'
9348    . ./myread
9349    case "$ans" in
9350    y|Y)         val="$define" ;;
9351    *)           val="$undef"  ;;
9352    esac
9353    ;;
9354 esac
9355 set uselargefiles
9356 eval $setvar
9357 : Look for a hint-file generated 'call-back-unit'.  If the
9358 : user has specified that a large files perl is to be built,
9359 : we may need to set or change some other defaults.
9360 if $test -f uselargefiles.cbu; then
9361         echo "Your platform has some specific hints regarding large file builds, using them..."
9362         . ./uselargefiles.cbu
9363 fi
9364 case "$uselargefiles" in
9365 "$define")
9366         if $test -f uselargefiles.cbu; then
9367                 echo " "
9368                 echo "Rechecking to see how big your file offsets are..." >&4
9369                 $cat >try.c <<EOCP
9370 #include <sys/types.h>
9371 #include <stdio.h>
9372 int main()
9373 {
9374     printf("%d\n", (int)sizeof($lseektype));
9375     return(0);
9376 }
9377 EOCP
9378                 set try
9379                 if eval $compile_ok; then
9380                         lseeksize=`$run ./try`
9381                         $echo "Your file offsets are now $lseeksize bytes long."
9382                 else
9383                         dflt="$lseeksize"
9384                         echo " "
9385                         echo "(I can't seem to compile the test program.  Guessing...)"
9386                         rp="What is the size of your file offsets (in bytes)?"
9387                         . ./myread
9388                         lseeksize="$ans"
9389                 fi
9390                 case "$fpostype" in
9391                 *_t) zzz="$fpostype"    ;;
9392                 *)   zzz="fpos_t"       ;;
9393                 esac
9394                 $echo $n "Rechecking the size of $zzz...$c" >&4
9395                 $cat > try.c <<EOCP
9396 #include <sys/types.h>
9397 #include <stdio.h>
9398 #$i_stdlib I_STDLIB
9399 #ifdef I_STDLIB
9400 #include <stdlib.h>
9401 #endif
9402 int main() {
9403     printf("%d\n", (int)sizeof($fpostype));
9404     return(0);
9405 }
9406 EOCP
9407                 set try
9408                 if eval $compile_ok; then
9409                         yyy=`$run ./try`
9410                         dflt="$lseeksize"
9411                         case "$yyy" in
9412                         '')     echo " "
9413                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9414                                 ;;
9415                         *)      fpossize=$yyy
9416                                 echo " $fpossize bytes." >&4
9417                                 ;;
9418                         esac
9419                 else
9420                         dflt="$fpossize"
9421                         echo " "
9422                         echo "(I can't compile the test program.  Guessing...)" >&4
9423                         rp="What is the size of your file positions (in bytes)?"
9424                         . ./myread
9425                         fpossize="$ans"
9426                 fi
9427                 $rm_try
9428         fi
9429         ;;
9430 esac
9431
9432 : Check if we want perlio
9433 useperlio="$define"
9434
9435 : Set the vendorbin variables
9436 case "$vendorprefix" in
9437 '')     d_vendorbin="$undef"
9438         vendorbin=''
9439         vendorbinexp=''
9440         ;;
9441 *)      d_vendorbin="$define"
9442         : determine where vendor-supplied executables go.
9443         case "$vendorbin" in
9444         '') dflt=$vendorprefix/bin ;;
9445         *)      dflt="$vendorbin" ;;
9446         esac
9447         fn=d~+
9448         rp='Pathname for the vendor-supplied executables directory?'
9449         . ./getfile
9450         vendorbin="$ans"
9451         vendorbinexp="$ansexp"
9452         ;;
9453 esac
9454 prefixvar=vendorbin
9455 . ./installprefix
9456
9457 : Set the vendorhtml1dir variables
9458 case "$vendorprefix" in
9459 '')     vendorhtml1dir=''
9460         vendorhtml1direxp=''
9461         ;;
9462 *)      : determine where vendor-supplied html pages go.
9463         : There is no standard location, so try to copy the previously-selected
9464         : directory structure for the core html pages.
9465         : XXX Better default suggestions would be welcome.
9466         case "$vendorhtml1dir" in
9467         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9468         *)      dflt=$vendorhtml1dir ;;
9469         esac
9470         case "$dflt" in
9471         ''|' ') dflt=none ;;
9472         esac
9473         fn=dn+~
9474         rp='Pathname for the vendor-supplied html pages?'
9475         . ./getfile
9476         vendorhtml1dir="$ans"
9477         vendorhtml1direxp="$ansexp"
9478         ;;
9479 esac
9480 : Use ' ' for none so value is preserved next time through Configure
9481 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9482 prefixvar=vendorhtml1dir
9483 . ./installprefix
9484
9485 : Set the vendorhtml3dir variables
9486 case "$vendorprefix" in
9487 '')     vendorhtml3dir=''
9488         vendorhtml3direxp=''
9489         ;;
9490 *)      : determine where vendor-supplied module html pages go.
9491         : There is no standard location, so try to copy the previously-selected
9492         : directory structure for the core html pages.
9493         : XXX Better default suggestions would be welcome.
9494         case "$vendorhtml3dir" in
9495         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9496         *)      dflt=$vendorhtml3dir ;;
9497         esac
9498         case "$dflt" in
9499         ''|' ') dflt=none ;;
9500         esac
9501         fn=dn+~
9502         rp='Pathname for the vendor-supplied html pages?'
9503         . ./getfile
9504         vendorhtml3dir="$ans"
9505         vendorhtml3direxp="$ansexp"
9506         ;;
9507 esac
9508 : Use ' ' for none so value is preserved next time through Configure
9509 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9510 prefixvar=vendorhtml3dir
9511 . ./installprefix
9512
9513 : Set the vendorman1dir variables
9514 case "$vendorprefix" in
9515 '')     vendorman1dir=''
9516         vendorman1direxp=''
9517         ;;
9518 *)      : determine where vendor-supplied manual pages go.
9519         case "$vendorman1dir" in
9520         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9521         *)      dflt=$vendorman1dir ;;
9522         esac
9523         case "$dflt" in
9524         ''|' ') dflt=none ;;
9525         esac
9526         fn=nd~+
9527         rp='Pathname for the vendor-supplied manual section 1 pages?'
9528         . ./getfile
9529         vendorman1dir="$ans"
9530         vendorman1direxp="$ansexp"
9531         ;;
9532 esac
9533 : Use ' ' for none so value is preserved next time through Configure
9534 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9535 prefixvar=vendorman1dir
9536 . ./installprefix
9537
9538 : Set the vendorman3dir variables
9539 case "$vendorprefix" in
9540 '')     vendorman3dir=''
9541         vendorman3direxp=''
9542         ;;
9543 *)      : determine where vendor-supplied module manual pages go.
9544         case "$vendorman3dir" in
9545         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9546         *)      dflt=$vendorman3dir ;;
9547         esac
9548         case "$dflt" in
9549         ''|' ') dflt=none ;;
9550         esac
9551         fn=nd~+
9552         rp='Pathname for the vendor-supplied manual section 3 pages?'
9553         . ./getfile
9554         vendorman3dir="$ans"
9555         vendorman3direxp="$ansexp"
9556         ;;
9557 esac
9558 : Use ' ' for none so value is preserved next time through Configure
9559 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9560 prefixvar=vendorman3dir
9561 . ./installprefix
9562
9563 : Set the vendorscript variables
9564 case "$vendorprefix" in
9565 '')     d_vendorscript="$undef"
9566         vendorscript=''
9567         vendorscriptexp=''
9568         ;;
9569 *)      d_vendorscript="$define"
9570         : determine where vendor-supplied scripts go.
9571         case "$vendorscript" in
9572         '')     dflt=$vendorprefix/script
9573                 $test -d $dflt || dflt=$vendorbin ;;
9574         *)  dflt="$vendorscript" ;;
9575         esac
9576         $cat <<EOM
9577
9578 The installation process will create a directory for
9579 vendor-supplied scripts.
9580
9581 EOM
9582         fn=d~+
9583         rp='Pathname for the vendor-supplied scripts directory?'
9584         . ./getfile
9585         vendorscript="$ans"
9586         vendorscriptexp="$ansexp"
9587         ;;
9588 esac
9589 prefixvar=vendorscript
9590 . ./installprefix
9591
9592 : script used to emit important warnings
9593 cat >warn <<EOS
9594 $startsh
9595 if test \$# -gt 0; then
9596         echo "\$@" >msg
9597 else
9598         cat >msg
9599 fi
9600 echo "*** WARNING:" >&4
9601 sed -e 's/^/*** /' <msg >&4
9602 echo "*** " >&4
9603 cat msg >>config.msg
9604 echo " " >>config.msg
9605 rm -f msg
9606 EOS
9607 chmod +x warn
9608 $eunicefix warn
9609
9610 : see which of string.h or strings.h is needed
9611 echo " "
9612 strings=`./findhdr string.h`
9613 if $test "$strings" && $test -r "$strings"; then
9614         echo "Using <string.h> instead of <strings.h>." >&4
9615         val="$define"
9616 else
9617         val="$undef"
9618         strings=`./findhdr strings.h`
9619         if $test "$strings" && $test -r "$strings"; then
9620                 echo "Using <strings.h> instead of <string.h>." >&4
9621         else
9622                 ./warn "No string header found -- You'll surely have problems."
9623         fi
9624 fi
9625 set i_string
9626 eval $setvar
9627 case "$i_string" in
9628 "$undef") strings=`./findhdr strings.h`;;
9629 *)        strings=`./findhdr string.h`;;
9630 esac
9631
9632 : see if qgcvt exists
9633 set qgcvt d_qgcvt
9634 eval $inlibc
9635
9636 : Check print/scan long double stuff
9637 echo " "
9638
9639 if $test X"$d_longdbl" = X"$define"; then
9640
9641 echo "Checking how to print long doubles..." >&4
9642
9643 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9644         $cat >try.c <<'EOCP'
9645 #include <sys/types.h>
9646 #include <stdio.h>
9647 int main() {
9648   double d = 123.456;
9649   printf("%.3f\n", d);
9650 }
9651 EOCP
9652         set try
9653         if eval $compile; then
9654                 yyy=`$run ./try`
9655                 case "$yyy" in
9656                 123.456)
9657                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9658                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9659                         echo "We will use %f."
9660                         ;;
9661                 esac
9662         fi
9663 fi
9664
9665 if $test X"$sPRIfldbl" = X; then
9666         $cat >try.c <<'EOCP'
9667 #include <sys/types.h>
9668 #include <stdio.h>
9669 int main() {
9670   long double d = 123.456;
9671   printf("%.3Lf\n", d);
9672 }
9673 EOCP
9674         set try
9675         if eval $compile; then
9676                 yyy=`$run ./try`
9677                 case "$yyy" in
9678                 123.456)
9679                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9680                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9681                         echo "We will use %Lf."
9682                         ;;
9683                 esac
9684         fi
9685 fi
9686
9687 if $test X"$sPRIfldbl" = X; then
9688         $cat >try.c <<'EOCP'
9689 #include <sys/types.h>
9690 #include <stdio.h>
9691 int main() {
9692   long double d = 123.456;
9693   printf("%.3llf\n", d);
9694 }
9695 EOCP
9696         set try
9697         if eval $compile; then
9698                 yyy=`$run ./try`
9699                 case "$yyy" in
9700                 123.456)
9701                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9702                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9703                         echo "We will use %llf."
9704                         ;;
9705                 esac
9706         fi
9707 fi
9708
9709 if $test X"$sPRIfldbl" = X; then
9710         $cat >try.c <<'EOCP'
9711 #include <sys/types.h>
9712 #include <stdio.h>
9713 int main() {
9714   long double d = 123.456;
9715   printf("%.3lf\n", d);
9716 }
9717 EOCP
9718         set try
9719         if eval $compile; then
9720                 yyy=`$run ./try`
9721                 case "$yyy" in
9722                 123.456)
9723                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9724                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9725                         echo "We will use %lf."
9726                         ;;
9727                 esac
9728         fi
9729 fi
9730
9731 if $test X"$sPRIfldbl" = X; then
9732         echo "Cannot figure out how to print long doubles." >&4
9733 else
9734         sSCNfldbl=$sPRIfldbl    # expect consistency
9735 fi
9736
9737 $rm_try
9738
9739 fi # d_longdbl
9740
9741 case "$sPRIfldbl" in
9742 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9743         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9744         d_SCNfldbl="$undef";
9745         ;;
9746 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9747         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9748         d_SCNfldbl="$define";
9749         ;;
9750 esac
9751
9752 : Check how to convert floats to strings.
9753
9754 if test "X$d_Gconvert" = X; then
9755
9756 echo " "
9757 echo "Checking for an efficient way to convert floats to strings."
9758 echo " " > try.c
9759 case "$uselongdouble" in
9760 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9761 esac
9762 case "$d_longdbl" in
9763 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9764 esac
9765 case "$d_PRIgldbl" in
9766 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9767 esac
9768 $cat >>try.c <<EOP
9769 #ifdef TRY_gconvert
9770 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9771 char *myname = "gconvert";
9772 #endif
9773 #ifdef TRY_gcvt
9774 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9775 char *myname = "gcvt";
9776 #endif
9777 #ifdef TRY_qgcvt
9778 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9779 char *myname = "qgcvt";
9780 #define DOUBLETYPE long double
9781 #endif
9782 #ifdef TRY_sprintf
9783 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9784 #ifdef HAS_PRIgldbl
9785 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9786 #else
9787 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9788 #endif
9789 #else
9790 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9791 #endif
9792 char *myname = "sprintf";
9793 #endif
9794
9795 #ifndef DOUBLETYPE
9796 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9797 #define DOUBLETYPE long double
9798 #else
9799 #define DOUBLETYPE double
9800 #endif
9801 #endif
9802
9803 #include <stdio.h>
9804
9805 #$i_stdlib I_STDLIB
9806 #ifdef I_STDLIB
9807 #include <stdlib.h>
9808 #endif
9809 #$i_string I_STRING
9810 #ifdef I_STRING
9811 #  include <string.h>
9812 #else
9813 #  include <strings.h>
9814 #endif
9815
9816 int checkit(char *expect, char *got)
9817 {
9818     if (strcmp(expect, got)) {
9819                 printf("%s oddity:  Expected %s, got %s\n",
9820                         myname, expect, got);
9821                 exit(1);
9822         }
9823 }
9824
9825 int main()
9826 {
9827         char buf[64];
9828         buf[63] = '\0';
9829
9830         /* This must be 1st test on (which?) platform */
9831         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9832         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9833         checkit("0.1", buf);
9834
9835         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9836         checkit("0.01", buf);
9837
9838         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9839         checkit("0.001", buf);
9840
9841         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9842         checkit("0.0001", buf);
9843
9844         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9845         if (strlen(buf) > 5)
9846             checkit("9e-005", buf); /* for Microsoft ?? */
9847         else
9848             checkit("9e-05", buf);
9849
9850         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9851         checkit("1", buf);
9852
9853         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9854         checkit("1.1", buf);
9855
9856         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9857         checkit("1.01", buf);
9858
9859         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9860         checkit("1.001", buf);
9861
9862         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9863         checkit("1.0001", buf);
9864
9865         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9866         checkit("1.00001", buf);
9867
9868         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9869         checkit("1.000001", buf);
9870
9871         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9872         checkit("0", buf);
9873
9874         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9875         checkit("-1", buf);
9876
9877         /* Some Linux gcvt's give 1.e+5 here. */
9878         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9879         checkit("100000", buf);
9880
9881         /* Some Linux gcvt's give -1.e+5 here. */
9882         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9883         checkit("-100000", buf);
9884
9885         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9886         checkit("123.456", buf);
9887
9888         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9889         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9890         /* 34 should be enough to scare even long double
9891          * places into using the e notation. */
9892         if (strlen(buf) > 5)
9893             checkit("1e+034", buf); /* for Microsoft */
9894         else
9895             checkit("1e+34", buf);
9896
9897         /* For Perl, if you add additional tests here, also add them to
9898          * t/base/num.t for benefit of platforms not using Configure or
9899          * overriding d_Gconvert */
9900
9901         exit(0);
9902 }
9903 EOP
9904 : first add preferred functions to our list
9905 xxx_list=""
9906 for xxx_convert in $gconvert_preference; do
9907     case $xxx_convert in
9908     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9909     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9910     esac
9911 done
9912 : then add any others
9913 for xxx_convert in gconvert gcvt sprintf; do
9914     case "$xxx_list" in
9915     *$xxx_convert*) ;;
9916     *) xxx_list="$xxx_list $xxx_convert" ;;
9917     esac
9918 done
9919
9920 case "$d_longdbl$uselongdouble" in
9921 "$define$define")
9922     : again, add preferred functions to our list first
9923     xxx_ld_list=""
9924     for xxx_convert in $gconvert_ld_preference; do
9925         case $xxx_convert in
9926         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9927         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9928         esac
9929     done
9930     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9931     for xxx_convert in qgcvt sprintf $xxx_list; do
9932         case "$xxx_ld_list" in
9933         $xxx_convert*|*" $xxx_convert"*) ;;
9934         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9935         esac
9936     done
9937     : if sprintf cannot do long doubles, move it to the end
9938     if test "$d_PRIgldbl" != "$define"; then
9939         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9940     fi
9941     : if no qgcvt, remove it
9942     if test "$d_qgcvt" != "$define"; then
9943         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9944     fi
9945     : use the ld_list
9946     xxx_list="$xxx_ld_list"
9947     ;;
9948 esac
9949
9950 for xxx_convert in $xxx_list; do
9951         echo "Trying $xxx_convert..."
9952         $rm -f try try$_o core
9953         set try -DTRY_$xxx_convert
9954         if eval $compile; then
9955                 echo "$xxx_convert() found." >&4
9956                 if $run ./try; then
9957                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9958                         break;
9959                 else
9960                         echo "...But $xxx_convert didn't work as I expected."
9961                         xxx_convert=''
9962                 fi
9963         else
9964                 echo "$xxx_convert NOT found." >&4
9965         fi
9966 done
9967
9968 if test X$xxx_convert = X; then
9969     echo "*** WHOA THERE!!! ***" >&4
9970     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9971     xxx_convert=sprintf
9972 fi
9973
9974 case "$xxx_convert" in
9975 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9976 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9977 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9978 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9979    "$define$define$define")
9980       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9981    "$define$define$undef")
9982       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9983    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9984    esac
9985    ;;
9986 esac
9987
9988 fi
9989 $rm_try
9990
9991 : see if _fwalk exists
9992 set fwalk d__fwalk
9993 eval $inlibc
9994
9995 : Initialize h_fcntl
9996 h_fcntl=false
9997
9998 : Initialize h_sysfile
9999 h_sysfile=false
10000
10001 : access call always available on UNIX
10002 set access d_access
10003 eval $inlibc
10004
10005 : locate the flags for 'access()'
10006 case "$d_access" in
10007 "$define")
10008         echo " "
10009         $cat >access.c <<EOCP
10010 #include <sys/types.h>
10011 #ifdef I_FCNTL
10012 #include <fcntl.h>
10013 #endif
10014 #ifdef I_SYS_FILE
10015 #include <sys/file.h>
10016 #endif
10017 #ifdef I_UNISTD
10018 #include <unistd.h>
10019 #endif
10020 #$i_stdlib I_STDLIB
10021 #ifdef I_STDLIB
10022 #include <stdlib.h>
10023 #endif
10024 int main() {
10025         exit(R_OK);
10026 }
10027 EOCP
10028         : check sys/file.h first, no particular reason here
10029         if $test `./findhdr sys/file.h` && \
10030                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10031                 h_sysfile=true;
10032                 echo "<sys/file.h> defines the *_OK access constants." >&4
10033         elif $test `./findhdr fcntl.h` && \
10034                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10035                 h_fcntl=true;
10036                 echo "<fcntl.h> defines the *_OK access constants." >&4
10037         elif $test `./findhdr unistd.h` && \
10038                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10039                 echo "<unistd.h> defines the *_OK access constants." >&4
10040         else
10041                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10042         fi
10043         ;;
10044 esac
10045 $rm -f access*
10046
10047 : see if accessx exists
10048 set accessx d_accessx
10049 eval $inlibc
10050
10051 : see if aintl exists
10052 set aintl d_aintl
10053 eval $inlibc
10054
10055 : see if alarm exists
10056 set alarm d_alarm
10057 eval $inlibc
10058
10059 : see if 64bit time functions exists
10060
10061 set ctime64 d_ctime64
10062 eval $inlibc
10063
10064 set localtime64 d_localtime64
10065 eval $inlibc
10066
10067 set gmtime64 d_gmtime64
10068 eval $inlibc
10069
10070 set mktime64 d_mktime64
10071 eval $inlibc
10072
10073 set difftime64 d_difftime64
10074 eval $inlibc
10075
10076 set asctime64 d_asctime64
10077 eval $inlibc
10078
10079 : see if POSIX threads are available
10080 set pthread.h i_pthread
10081 eval $inhdr
10082
10083 : define a function to check prototypes
10084 $cat > protochk <<EOSH
10085 $startsh
10086 cc="$cc"
10087 optimize="$optimize"
10088 ccflags="$ccflags"
10089 prototype="$prototype"
10090 define="$define"
10091 rm_try="$rm_try"
10092 usethreads=$usethreads
10093 i_pthread=$i_pthread
10094 pthread_h_first=$pthread_h_first
10095 EOSH
10096
10097 $cat >> protochk <<'EOSH'
10098
10099 $rm_try
10100 foo="$1"
10101 shift
10102 while test $# -ge 2; do
10103         case "$1" in
10104                 $define) echo "#include <$2>" >> try.c ;;
10105                 literal) echo "$2" >> try.c ;;
10106         esac
10107     # Extra magic for the benefit of systems that need pthread.h
10108     # to be included early to correctly detect threadsafe functions.
10109     # Such functions must guarantee themselves, though, that the usethreads
10110     # and i_pthread have been defined, before calling protochk.
10111     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10112         echo "#include <pthread.h>" >> try.c
10113         pthread_h_done=yes
10114     fi
10115     shift 2
10116 done
10117 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10118 cat >> try.c <<'EOCP'
10119 #ifdef CAN_PROTOTYPE
10120 #define _(args) args
10121 #else
10122 #define _(args) ()
10123 #endif
10124 EOCP
10125 echo "$foo" >> try.c
10126 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10127 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10128 status=$?
10129 $rm_try
10130 exit $status
10131 EOSH
10132 chmod +x protochk
10133 $eunicefix protochk
10134
10135 : Define hasproto macro for Configure internal use
10136 hasproto='varname=$1; func=$2; shift; shift;
10137 while $test $# -ge 2; do
10138         case "$1" in
10139         $define) echo "#include <$2>";;
10140         esac ;
10141     shift 2;
10142 done > try.c;
10143 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10144 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10145         echo "$func() prototype found.";
10146         val="$define";
10147 else
10148         echo "$func() prototype NOT found.";
10149         val="$undef";
10150 fi;
10151 set $varname;
10152 eval $setvar;
10153 $rm_try tryout.c'
10154
10155 : see if sys/types.h has to be included
10156 set sys/types.h i_systypes
10157 eval $inhdr
10158
10159 : see if sys/select.h has to be included
10160 set sys/select.h i_sysselct
10161 eval $inhdr
10162
10163 : Define hasfield macro for Configure internal use
10164 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10165 while $test $# -ge 2; do
10166         case "$1" in
10167         $define) echo "#include <$2>";;
10168         esac ;
10169     shift 2;
10170 done > try.c;
10171 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10172 set try;
10173 if eval $compile; then
10174         val="$define";
10175 else
10176         val="$undef";
10177 fi;
10178 set $varname;
10179 eval $setvar;
10180 $rm_try'
10181
10182 : see if we should include time.h, sys/time.h, or both
10183 echo " "
10184 if test "X$timeincl" = X; then
10185         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10186         $echo $n "I'm now running the test program...$c"
10187         $cat >try.c <<EOCP
10188 #include <sys/types.h>
10189 #ifdef I_TIME
10190 #include <time.h>
10191 #endif
10192 #ifdef I_SYSTIME
10193 #ifdef SYSTIMEKERNEL
10194 #define KERNEL
10195 #endif
10196 #include <sys/time.h>
10197 #endif
10198 #ifdef I_SYSSELECT
10199 #include <sys/select.h>
10200 #endif
10201 #$i_stdlib I_STDLIB
10202 #ifdef I_STDLIB
10203 #include <stdlib.h>
10204 #endif
10205 int main()
10206 {
10207         struct tm foo;
10208 #ifdef S_TIMEVAL
10209         struct timeval bar;
10210 #endif
10211 #ifdef S_TIMEZONE
10212         struct timezone tzp;
10213 #endif
10214         if (foo.tm_sec == foo.tm_sec)
10215                 exit(0);
10216 #ifdef S_TIMEVAL
10217         if (bar.tv_sec == bar.tv_sec)
10218                 exit(0);
10219 #endif
10220         exit(1);
10221 }
10222 EOCP
10223         flags=''
10224         for s_timezone in '-DS_TIMEZONE' ''; do
10225         sysselect=''
10226         for s_timeval in '-DS_TIMEVAL' ''; do
10227         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10228         for i_time in '' '-DI_TIME'; do
10229         for i_systime in '-DI_SYSTIME' ''; do
10230                 case "$flags" in
10231                 '') $echo $n ".$c"
10232                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10233                         if eval $compile; then
10234                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10235                                 shift
10236                                 flags="$*"
10237                                 echo " "
10238                                 $echo $n "Succeeded with $flags$c"
10239                         fi
10240                         ;;
10241                 esac
10242         done
10243         done
10244         done
10245         done
10246         done
10247         timeincl=''
10248         echo " "
10249         case "$flags" in
10250         *SYSTIMEKERNEL*) i_systimek="$define"
10251                 timeincl=`./findhdr sys/time.h`
10252                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10253         *) i_systimek="$undef";;
10254         esac
10255         case "$flags" in
10256         *I_TIME*) i_time="$define"
10257                 timeincl=`./findhdr time.h`" $timeincl"
10258                 echo "We'll include <time.h>." >&4;;
10259         *) i_time="$undef";;
10260         esac
10261         case "$flags" in
10262         *I_SYSTIME*) i_systime="$define"
10263                 timeincl=`./findhdr sys/time.h`" $timeincl"
10264                 echo "We'll include <sys/time.h>." >&4;;
10265         *) i_systime="$undef";;
10266         esac
10267         $rm_try
10268 fi
10269 : see if struct tm knows about tm_zone
10270 case "$i_systime$i_time" in
10271 *$define*)
10272         echo " "
10273         echo "Checking to see if your struct tm has tm_zone field..." >&4
10274         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10275         eval $hasfield
10276         ;;
10277 *)      val="$undef"
10278         set d_tm_tm_zone
10279         eval $setvar
10280         ;;
10281 esac
10282 case "$d_tm_tm_zone" in
10283 "$define")      echo "Yes, it does."   ;;
10284 *)              echo "No, it doesn't." ;;
10285 esac
10286 : see if struct tm knows about tm_gmtoff
10287 case "$i_systime$i_time" in
10288 *$define*)
10289         echo " "
10290         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10291         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10292         eval $hasfield
10293         ;;
10294 *)      val="$undef"
10295         set d_tm_tm_gmtoff
10296         eval $setvar
10297         ;;
10298 esac
10299 case "$d_tm_tm_gmtoff" in
10300 "$define")      echo "Yes, it does."   ;;
10301 *)              echo "No, it doesn't." ;;
10302 esac
10303
10304 : see if asctime_r exists
10305 set asctime_r d_asctime_r
10306 eval $inlibc
10307 case "$d_asctime_r" in
10308 "$define")
10309         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10310         case "$d_asctime_r_proto:$usethreads" in
10311         ":define")      d_asctime_r_proto=define
10312                 set d_asctime_r_proto asctime_r $hdrs
10313                 eval $hasproto ;;
10314         *)      ;;
10315         esac
10316         case "$d_asctime_r_proto" in
10317         define)
10318         case "$asctime_r_proto" in
10319         ''|0) try='char* asctime_r(const struct tm*, char*);'
10320         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10321         esac
10322         case "$asctime_r_proto" in
10323         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10324         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10325         esac
10326         case "$asctime_r_proto" in
10327         ''|0) try='int asctime_r(const struct tm*, char*);'
10328         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10329         esac
10330         case "$asctime_r_proto" in
10331         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10332         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10333         esac
10334         case "$asctime_r_proto" in
10335         ''|0)   d_asctime_r=undef
10336                 asctime_r_proto=0
10337                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10338         * )     case "$asctime_r_proto" in
10339                 REENTRANT_PROTO*) ;;
10340                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10341                 esac
10342                 echo "Prototype: $try" ;;
10343         esac
10344         ;;
10345         *)      case "$usethreads" in
10346                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10347                 esac
10348                 d_asctime_r=undef
10349                 asctime_r_proto=0
10350                 ;;
10351         esac
10352         ;;
10353 *)      asctime_r_proto=0
10354         ;;
10355 esac
10356
10357 : see if atolf exists
10358 set atolf d_atolf
10359 eval $inlibc
10360
10361 : see if atoll exists
10362 set atoll d_atoll
10363 eval $inlibc
10364
10365 : Look for GCC-style attribute format
10366 case "$d_attribute_format" in
10367 '')
10368 echo " "
10369 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10370 $cat >attrib.c <<'EOCP'
10371 #include <stdio.h>
10372 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10373 EOCP
10374 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10375         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10376                 echo "Your C compiler doesn't support __attribute__((format))."
10377                 val="$undef"
10378         else
10379                 echo "Your C compiler supports __attribute__((format))."
10380                 val="$define"
10381         fi
10382 else
10383         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10384         val="$undef"
10385 fi
10386 ;;
10387 *) val="$d_attribute_format" ;;
10388 esac
10389 set d_attribute_format
10390 eval $setvar
10391 $rm -f attrib*
10392
10393 : Look for GCC-style attribute format with null format allowed
10394 case "$d_printf_format_null" in
10395 '') case "$d_attribute_format" in
10396     $define)
10397         echo " "
10398         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10399 $cat >attrib.c <<EOCP
10400 #include <stdio.h>
10401 #$i_stdlib I_STDLIB
10402 #ifdef I_STDLIB
10403 #include <stdlib.h>
10404 #endif
10405 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10406 int null_printf (char* pat,...) { return (int)pat; }
10407 int main () { exit(null_printf(NULL)); }
10408 EOCP
10409         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10410             : run the executable in case it produces a run-time warning
10411             if $run ./attrib >>attrib.out 2>&1; then
10412                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10413                     echo "Your C compiler doesn't allow __printf__ format to be null."
10414                     val="$undef"
10415                 else
10416                     echo "Your C compiler allows __printf__ format to be null."
10417                     val="$define"
10418                 fi
10419             else
10420             echo "Your C compiler executable failed with __printf__ format null."
10421             val="$undef"
10422         fi
10423     else
10424         echo "Your C compiler fails with __printf__ format null."
10425         val="$undef"
10426     fi
10427     ;;
10428     *)  val="$undef" ;;
10429     esac
10430 ;;
10431 *)  val="$d_printf_format_null" ;;
10432 esac
10433 set d_printf_format_null
10434 eval $setvar
10435 $rm -f attrib*
10436
10437 : Look for GCC-style attribute malloc
10438 case "$d_attribute_malloc" in
10439 '')
10440 echo " "
10441 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10442 $cat >attrib.c <<'EOCP'
10443 #include <stdio.h>
10444 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10445 EOCP
10446 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10447         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10448                 echo "Your C compiler doesn't support __attribute__((malloc))."
10449                 val="$undef"
10450         else
10451                 echo "Your C compiler supports __attribute__((malloc))."
10452                 val="$define"
10453         fi
10454 else
10455         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10456         val="$undef"
10457 fi
10458 ;;
10459 *) val="$d_attribute_malloc" ;;
10460 esac
10461 set d_attribute_malloc
10462 eval $setvar
10463 $rm -f attrib*
10464
10465 : Look for GCC-style attribute nonnull
10466 case "$d_attribute_nonnull" in
10467 '')
10468 echo " "
10469 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10470 $cat >attrib.c <<'EOCP'
10471 #include <stdio.h>
10472 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10473 EOCP
10474 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10475         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10476                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10477                 val="$undef"
10478         else
10479                 echo "Your C compiler supports __attribute__((nonnull))."
10480                 val="$define"
10481         fi
10482 else
10483         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10484         val="$undef"
10485 fi
10486 ;;
10487 *) val="$d_attribute_nonnull" ;;
10488 esac
10489 set d_attribute_nonnull
10490 eval $setvar
10491 $rm -f attrib*
10492
10493 : Look for GCC-style attribute noreturn
10494 case "$d_attribute_noreturn" in
10495 '')
10496 echo " "
10497 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10498 $cat >attrib.c <<'EOCP'
10499 #include <stdio.h>
10500 void fall_over_dead( void ) __attribute__((noreturn));
10501 EOCP
10502 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10503         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10504                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10505                 val="$undef"
10506         else
10507                 echo "Your C compiler supports __attribute__((noreturn))."
10508                 val="$define"
10509         fi
10510 else
10511         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10512         val="$undef"
10513 fi
10514 ;;
10515 *) val="$d_attribute_noreturn" ;;
10516 esac
10517 set d_attribute_noreturn
10518 eval $setvar
10519 $rm -f attrib*
10520
10521 : Look for GCC-style attribute pure
10522 case "$d_attribute_pure" in
10523 '')
10524 echo " "
10525 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10526 $cat >attrib.c <<'EOCP'
10527 #include <stdio.h>
10528 int square( int n ) __attribute__((pure));
10529 EOCP
10530 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10531         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10532                 echo "Your C compiler doesn't support __attribute__((pure))."
10533                 val="$undef"
10534         else
10535                 echo "Your C compiler supports __attribute__((pure))."
10536                 val="$define"
10537         fi
10538 else
10539         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10540         val="$undef"
10541 fi
10542 ;;
10543 *) val="$d_attribute_pure" ;;
10544 esac
10545 set d_attribute_pure
10546 eval $setvar
10547 $rm -f attrib*
10548
10549 : Look for GCC-style attribute unused
10550 case "$d_attribute_unused" in
10551 '')
10552 echo " "
10553 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10554 $cat >attrib.c <<'EOCP'
10555 #include <stdio.h>
10556 int do_something( int dummy __attribute__((unused)), int n );
10557 EOCP
10558 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10559         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10560                 echo "Your C compiler doesn't support __attribute__((unused))."
10561                 val="$undef"
10562         else
10563                 echo "Your C compiler supports __attribute__((unused))."
10564                 val="$define"
10565         fi
10566 else
10567         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10568         val="$undef"
10569 fi
10570 ;;
10571 *) val="$d_attribute_unused" ;;
10572 esac
10573 set d_attribute_unused
10574 eval $setvar
10575 $rm -f attrib*
10576
10577 : Look for GCC-style attribute deprecated
10578 case "$d_attribute_deprecated" in
10579 '')
10580 echo " "
10581 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10582 $cat >attrib.c <<'EOCP'
10583 #include <stdio.h>
10584 int I_am_deprecated(void) __attribute__((deprecated));
10585 EOCP
10586 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10587         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10588                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10589                 val="$undef"
10590         else
10591                 echo "Your C compiler supports __attribute__((deprecated))."
10592                 val="$define"
10593         fi
10594 else
10595         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10596         val="$undef"
10597 fi
10598 ;;
10599 *) val="$d_attribute_deprecated" ;;
10600 esac
10601 set d_attribute_deprecated
10602 eval $setvar
10603 $rm -f attrib*
10604
10605 : Look for GCC-style attribute warn_unused_result
10606 case "$d_attribute_warn_unused_result" in
10607 '')
10608 echo " "
10609 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10610 $cat >attrib.c <<'EOCP'
10611 #include <stdio.h>
10612 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10613 EOCP
10614 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10615         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10616                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10617                 val="$undef"
10618         else
10619                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10620                 val="$define"
10621         fi
10622 else
10623         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10624         val="$undef"
10625 fi
10626 ;;
10627 *) val="$d_attribute_warn_unused_result" ;;
10628 esac
10629 set d_attribute_warn_unused_result
10630 eval $setvar
10631 $rm -f attrib*
10632
10633 : see if bcmp exists
10634 set bcmp d_bcmp
10635 eval $inlibc
10636
10637 : see if bcopy exists
10638 set bcopy d_bcopy
10639 eval $inlibc
10640
10641 : see if getpgrp exists
10642 set getpgrp d_getpgrp
10643 eval $inlibc
10644
10645 case "$d_getpgrp" in
10646 "$define")
10647         echo " "
10648         echo "Checking to see which flavor of getpgrp is in use..."
10649         $cat >try.c <<EOP
10650 #$i_unistd I_UNISTD
10651 #include <sys/types.h>
10652 #ifdef I_UNISTD
10653 #  include <unistd.h>
10654 #endif
10655 #$i_stdlib I_STDLIB
10656 #ifdef I_STDLIB
10657 #include <stdlib.h>
10658 #endif
10659 int main()
10660 {
10661         if (getuid() == 0) {
10662                 printf("(I see you are running Configure as super-user...)\n");
10663                 setuid(1);
10664         }
10665 #ifdef TRY_BSD_PGRP
10666         if (getpgrp(1) == 0)
10667                 exit(0);
10668 #else
10669         if (getpgrp() > 0)
10670                 exit(0);
10671 #endif
10672         exit(1);
10673 }
10674 EOP
10675         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10676                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10677                 val="$define"
10678         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10679                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10680                 val="$undef"
10681         else
10682                 echo "I can't seem to compile and run the test program."
10683                 if ./usg; then
10684                         xxx="a USG one, i.e. you use getpgrp()."
10685                 else
10686                         # SVR4 systems can appear rather BSD-ish.
10687                         case "$i_unistd" in
10688                         $undef)
10689                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10690                                 val="$define"
10691                                 ;;
10692                         $define)
10693                                 xxx="probably a USG one, i.e. you use getpgrp()."
10694                                 val="$undef"
10695                                 ;;
10696                         esac
10697                 fi
10698                 echo "Assuming your getpgrp is $xxx" >&4
10699         fi
10700         ;;
10701 *) val="$undef";;
10702 esac
10703 set d_bsdgetpgrp
10704 eval $setvar
10705 $rm_try
10706
10707 : see if setpgrp exists
10708 set setpgrp d_setpgrp
10709 eval $inlibc
10710
10711 case "$d_setpgrp" in
10712 "$define")
10713         echo " "
10714         echo "Checking to see which flavor of setpgrp is in use..."
10715         $cat >try.c <<EOP
10716 #$i_unistd I_UNISTD
10717 #include <sys/types.h>
10718 #ifdef I_UNISTD
10719 #  include <unistd.h>
10720 #endif
10721 #$i_stdlib I_STDLIB
10722 #ifdef I_STDLIB
10723 #include <stdlib.h>
10724 #endif
10725 int main()
10726 {
10727         if (getuid() == 0) {
10728                 printf("(I see you are running Configure as super-user...)\n");
10729                 setuid(1);
10730         }
10731 #ifdef TRY_BSD_PGRP
10732         if (-1 == setpgrp(1, 1))
10733                 exit(0);
10734 #else
10735         if (setpgrp() != -1)
10736                 exit(0);
10737 #endif
10738         exit(1);
10739 }
10740 EOP
10741         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10742                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10743                 val="$define"
10744         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10745                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10746                 val="$undef"
10747         else
10748                 echo "(I can't seem to compile and run the test program.)"
10749                 if ./usg; then
10750                         xxx="a USG one, i.e. you use setpgrp()."
10751                 else
10752                         # SVR4 systems can appear rather BSD-ish.
10753                         case "$i_unistd" in
10754                         $undef)
10755                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10756                                 val="$define"
10757                                 ;;
10758                         $define)
10759                                 xxx="probably a USG one, i.e. you use setpgrp()."
10760                                 val="$undef"
10761                                 ;;
10762                         esac
10763                 fi
10764                 echo "Assuming your setpgrp is $xxx" >&4
10765         fi
10766         ;;
10767 *) val="$undef";;
10768 esac
10769 set d_bsdsetpgrp
10770 eval $setvar
10771 $rm_try
10772
10773 : Look for GCC-style __builtin_choose_expr
10774 case "$d_builtin_choose_expr" in
10775 '')
10776     echo " "
10777     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10778     $cat >try.c <<'EOCP'
10779 #include <assert.h>
10780 #include <stdlib.h>
10781 #include <stdio.h>
10782
10783 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10784
10785 int main(void) {
10786     assert( SYRINX(1) == 2112 );
10787     assert( SYRINX(1) != 5150 );
10788     assert( SYRINX(0) == 5150 );
10789     assert( SYRINX(0) != 2112 );
10790     puts( "All good!" );
10791     exit(0);
10792 }
10793
10794 EOCP
10795     set try
10796     if eval $compile && $run ./try; then
10797         echo "Your C compiler supports __builtin_choose_expr."
10798         val="$define"
10799     else
10800         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10801         val="$undef"
10802     fi
10803 ;;
10804 *) val="$d_builtin_choose_expr" ;;
10805 esac
10806
10807 set d_builtin_choose_expr
10808 eval $setvar
10809 $rm_try
10810
10811 : Look for GCC-style __builtin_expect
10812 case "$d_builtin_expect" in
10813 '')
10814     echo " "
10815     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10816     $cat >try.c <<'EOCP'
10817 int main(void) {
10818     int n = 50;
10819     if ( __builtin_expect(n, 0) ) n = 1;
10820     /* Remember shell exit code truth is 0, C truth is non-zero */
10821     return !(n == 1);
10822 }
10823 EOCP
10824     set try
10825     if eval $compile && $run ./try; then
10826         echo "Your C compiler supports __builtin_expect."
10827         val="$define"
10828     else
10829         echo "Your C compiler doesn't seem to understand __builtin_expect."
10830         val="$undef"
10831     fi
10832     ;;
10833 *) val="$d_builtin_expect" ;;
10834 esac
10835
10836 set d_builtin_expect
10837 eval $setvar
10838 $rm_try
10839
10840 : see if bzero exists
10841 set bzero d_bzero
10842 eval $inlibc
10843
10844 : see if stdarg is available
10845 echo " "
10846 if $test `./findhdr stdarg.h`; then
10847         echo "<stdarg.h> found." >&4
10848         valstd="$define"
10849 else
10850         echo "<stdarg.h> NOT found." >&4
10851         valstd="$undef"
10852 fi
10853
10854 : see if varargs is available
10855 echo " "
10856 if $test `./findhdr varargs.h`; then
10857         echo "<varargs.h> found." >&4
10858 else
10859         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10860 fi
10861
10862 : set up the varargs testing programs
10863 $cat > varargs.c <<EOP
10864 #ifdef I_STDARG
10865 #include <stdarg.h>
10866 #endif
10867 #ifdef I_VARARGS
10868 #include <varargs.h>
10869 #endif
10870
10871 #ifdef I_STDARG
10872 int f(char *p, ...)
10873 #else
10874 int f(va_alist)
10875 va_dcl
10876 #endif
10877 {
10878         va_list ap;
10879 #ifndef I_STDARG
10880         char *p;
10881 #endif
10882 #ifdef I_STDARG
10883         va_start(ap,p);
10884 #else
10885         va_start(ap);
10886         p = va_arg(ap, char *);
10887 #endif
10888         va_end(ap);
10889         return 0;
10890 }
10891 EOP
10892 $cat > varargs <<EOP
10893 $startsh
10894 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10895         echo "true"
10896 else
10897         echo "false"
10898 fi
10899 $rm -f varargs$_o
10900 EOP
10901 chmod +x varargs
10902
10903 : now check which varargs header should be included
10904 echo " "
10905 i_varhdr=''
10906 val=''
10907 case "$valstd" in
10908 "$define")
10909         if `./varargs I_STDARG`; then
10910                 val='stdarg.h'
10911         elif `./varargs I_VARARGS`; then
10912                 val='varargs.h'
10913         fi
10914         ;;
10915 *)
10916         if `./varargs I_VARARGS`; then
10917                 val='varargs.h'
10918         fi
10919         ;;
10920 esac
10921 case "$val" in
10922 '')
10923         echo " "
10924         echo "*** WHOA THERE!!! ***" >&4
10925         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
10926         case "$knowitall" in
10927         '')
10928         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
10929                 exit 1
10930                 ;;
10931         esac
10932 echo "I could not find the definition for va_dcl... You have problems..." >&4
10933         val="$undef"; set i_stdarg; eval $setvar
10934         val="$undef"; set i_varargs; eval $setvar
10935         ;;
10936 *)
10937         set i_varhdr
10938         eval $setvar
10939         case "$i_varhdr" in
10940         stdarg.h)
10941                 val="$define"; set i_stdarg; eval $setvar
10942                 val="$undef"; set i_varargs; eval $setvar
10943                 ;;
10944         varargs.h)
10945                 val="$undef"; set i_stdarg; eval $setvar
10946                 val="$define"; set i_varargs; eval $setvar
10947                 ;;
10948         esac
10949         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10950 esac
10951 $rm -f varargs*
10952
10953 : see if the Compiler supports C99 variadic macros
10954 case "$i_stdarg$i_stdlib" in
10955     "$define$define")
10956     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10957     $cat >try.c <<EOCP
10958 #include <stdio.h>
10959 #include <stdarg.h>
10960
10961 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10962
10963 int main() {
10964   char buf[20];
10965   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10966   puts(buf);
10967   return 0;
10968 }
10969 EOCP
10970     set try
10971     if eval $compile && $run ./try 2>&1 >/dev/null; then
10972         case "`$run ./try`" in
10973             "123 456 789")
10974             echo "You have C99 variadic macros." >&4
10975             d_c99_variadic_macros="$define"
10976             ;;
10977             *)
10978             echo "You don't have functional C99 variadic macros." >&4
10979             d_c99_variadic_macros="$undef"
10980             ;;
10981         esac
10982     else
10983         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10984         d_c99_variadic_macros="$undef"
10985     fi
10986     $rm_try
10987     ;;
10988     *)
10989     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10990     d_c99_variadic_macros="$undef"
10991     ;;
10992 esac
10993
10994 : see if signal is declared as pointer to function returning int or void
10995 echo " "
10996 xxx=`./findhdr signal.h`
10997 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10998 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10999         echo "You have int (*signal())() instead of void." >&4
11000         val="$undef"
11001 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11002         echo "You have void (*signal())()." >&4
11003         val="$define"
11004 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11005         echo "You have int (*signal())() instead of void." >&4
11006         val="$undef"
11007 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11008         echo "You have void (*signal())()." >&4
11009         val="$define"
11010 else
11011         case "$d_voidsig" in
11012         '')
11013         echo "I can't determine whether signal handler returns void or int..." >&4
11014                 dflt=void
11015                 rp="What type does your signal handler return?"
11016                 . ./myread
11017                 case "$ans" in
11018                 v*) val="$define";;
11019                 *) val="$undef";;
11020                 esac;;
11021         "$define")
11022                 echo "As you already told me, signal handler returns void." >&4
11023                 val="$define"
11024                 ;;
11025         *)      echo "As you already told me, signal handler returns int." >&4
11026                 val="$undef"
11027                 ;;
11028         esac
11029 fi
11030 set d_voidsig
11031 eval $setvar
11032 case "$d_voidsig" in
11033 "$define") signal_t="void";;
11034 *) signal_t="int";;
11035 esac
11036 $rm -f $$.tmp
11037
11038 : check for ability to cast large floats to 32-bit ints.
11039 echo " "
11040 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11041 if $test "$intsize" -ge 4; then
11042         xxx=int
11043 else
11044         xxx=long
11045 fi
11046 $cat >try.c <<EOCP
11047 #include <stdio.h>
11048 #$i_stdlib I_STDLIB
11049 #ifdef I_STDLIB
11050 #include <stdlib.h>
11051 #endif
11052 #include <sys/types.h>
11053 #include <signal.h>
11054 $signal_t blech(int s) { exit(3); }
11055 int main()
11056 {
11057         $xxx i32;
11058         double f, g;
11059         int result = 0;
11060         char str[16];
11061         signal(SIGFPE, blech);
11062
11063         /* Don't let compiler optimize the test away.  Store the number
11064            in a writable string for gcc to pass to sscanf under HP-UX.
11065         */
11066         sprintf(str, "2147483647");
11067         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11068         g = 10 * f;
11069         i32  = ($xxx) g;
11070
11071         /* x86 processors will probably give 0x8000 0000, which is a
11072            sign change.  We don't want that.  We want to mimic SPARC
11073            behavior here, which is to preserve the sign and give
11074            back 0x7fff ffff.
11075         */
11076         if (i32 != ($xxx) f)
11077                 result |= 1;
11078         exit(result);
11079 }
11080 EOCP
11081 set try
11082 if eval $compile_ok; then
11083         $run ./try
11084         yyy=$?
11085 else
11086         echo "(I can't seem to compile the test program--assuming it can't)"
11087         yyy=1
11088 fi
11089 case "$yyy" in
11090 0)      val="$define"
11091         echo "Yup, it can."
11092         ;;
11093 *)      val="$undef"
11094         echo "Nope, it can't."
11095         ;;
11096 esac
11097 set d_casti32
11098 eval $setvar
11099 $rm_try
11100
11101 : check for ability to cast negative floats to unsigned
11102 echo " "
11103 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11104 $cat >try.c <<EOCP
11105 #include <stdio.h>
11106 #$i_stdlib I_STDLIB
11107 #ifdef I_STDLIB
11108 #include <stdlib.h>
11109 #endif
11110 #include <sys/types.h>
11111 #include <signal.h>
11112 $signal_t blech(int s) { exit(7); }
11113 $signal_t blech_in_list(int s) { exit(4); }
11114 unsigned long dummy_long(unsigned long p) { return p; }
11115 unsigned int dummy_int(unsigned int p) { return p; }
11116 unsigned short dummy_short(unsigned short p) { return p; }
11117 int main()
11118 {
11119         double f;
11120         unsigned long along;
11121         unsigned int aint;
11122         unsigned short ashort;
11123         int result = 0;
11124         char str[16];
11125
11126         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11127            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11128            optimized the whole file away
11129         */
11130         /* Store the number in a writable string for gcc to pass to
11131            sscanf under HP-UX.
11132         */
11133         sprintf(str, "-123");
11134         sscanf(str, "%lf", &f);  /* f = -123.; */
11135
11136         signal(SIGFPE, blech);
11137         along = (unsigned long)f;
11138         aint = (unsigned int)f;
11139         ashort = (unsigned short)f;
11140         if (along != (unsigned long)-123)
11141                 result |= 1;
11142         if (aint != (unsigned int)-123)
11143                 result |= 1;
11144         if (ashort != (unsigned short)-123)
11145                 result |= 1;
11146         sprintf(str, "1073741824.");
11147         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11148         f = f + f;
11149         along = 0;
11150         along = (unsigned long)f;
11151         if (along != 0x80000000)
11152                 result |= 2;
11153         f -= 1.;
11154         along = 0;
11155         along = (unsigned long)f;
11156         if (along != 0x7fffffff)
11157                 result |= 1;
11158         f += 2.;
11159         along = 0;
11160         along = (unsigned long)f;
11161         if (along != 0x80000001)
11162                 result |= 2;
11163         if (result)
11164                 exit(result);
11165         signal(SIGFPE, blech_in_list);
11166         sprintf(str, "123.");
11167         sscanf(str, "%lf", &f);  /* f = 123.; */
11168         along = dummy_long((unsigned long)f);
11169         aint = dummy_int((unsigned int)f);
11170         ashort = dummy_short((unsigned short)f);
11171         if (along != (unsigned long)123)
11172                 result |= 4;
11173         if (aint != (unsigned int)123)
11174                 result |= 4;
11175         if (ashort != (unsigned short)123)
11176                 result |= 4;
11177         exit(result);
11178
11179 }
11180 EOCP
11181 set try
11182 if eval $compile_ok; then
11183         $run ./try
11184         castflags=$?
11185 else
11186         echo "(I can't seem to compile the test program--assuming it can't)"
11187         castflags=7
11188 fi
11189 case "$castflags" in
11190 0)      val="$define"
11191         echo "Yup, it can."
11192         ;;
11193 *)      val="$undef"
11194         echo "Nope, it can't."
11195         ;;
11196 esac
11197 set d_castneg
11198 eval $setvar
11199 $rm_try
11200
11201 : see if vprintf exists
11202 echo " "
11203 if set vprintf val -f d_vprintf; eval $csym; $val; then
11204         echo 'vprintf() found.' >&4
11205         val="$define"
11206         $cat >try.c <<EOF
11207 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11208 #$i_varargs I_VARARGS
11209
11210 #$i_stdlib I_STDLIB
11211 #$i_unistd I_UNISTD
11212
11213 #ifdef I_STDARG
11214 #  include <stdarg.h>
11215 #else /* I_VARARGS */
11216 #  include <varargs.h>
11217 #endif
11218
11219 #ifdef I_UNISTD
11220 #  include <unistd.h>
11221 #endif
11222
11223 #ifdef I_STDLIB
11224 #  include <stdlib.h>
11225 #endif
11226
11227 #include <stdio.h> /* vsprintf prototype */
11228
11229 #ifdef I_STDARG
11230 void xxx(int n, ...)
11231 {
11232     va_list args;
11233     char buf[10];
11234     va_start(args, n);
11235     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11236 }
11237 int main() { xxx(1, "foo"); }
11238
11239 #else /* I_VARARGS */
11240
11241 xxx(va_alist)
11242 va_dcl
11243 {
11244     va_list args;
11245     char buf[10];
11246     va_start(args);
11247     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11248 }
11249 int main() { xxx("foo"); }
11250
11251 #endif
11252
11253 EOF
11254         set try
11255         if eval $compile_ok; then
11256                 if $run ./try; then
11257                         echo "Your vsprintf() returns (int)." >&4
11258                         val2="$undef"
11259                 else
11260                         echo "Your vsprintf() returns (char*)." >&4
11261                         val2="$define"
11262                 fi
11263         else
11264                 echo 'I am unable to compile the vsprintf() test program.' >&4
11265                 # We shouldn't get here.  If we do, assume the standard signature,
11266                 # not the old BSD one.
11267                 echo 'Guessing that vsprintf() returns (int).' >&4
11268                 val2="$undef"
11269         fi
11270 else
11271         echo 'vprintf() NOT found.' >&4
11272         val="$undef"
11273         val2="$undef"
11274 fi
11275 $rm_try
11276 set d_vprintf
11277 eval $setvar
11278 val=$val2
11279 set d_charvspr
11280 eval $setvar
11281
11282 : see if chown exists
11283 set chown d_chown
11284 eval $inlibc
11285
11286 : see if chroot exists
11287 set chroot d_chroot
11288 eval $inlibc
11289
11290 : see if chsize exists
11291 set chsize d_chsize
11292 eval $inlibc
11293
11294 : see if class exists
11295 set class d_class
11296 eval $inlibc
11297
11298 : see if clearenv exists
11299 set clearenv d_clearenv
11300 eval $inlibc
11301
11302 : Define hasstruct macro for Configure internal use
11303 hasstruct='varname=$1; struct=$2; shift; shift;
11304 while $test $# -ge 2; do
11305         case "$1" in
11306         $define) echo "#include <$2>";;
11307         esac ;
11308     shift 2;
11309 done > try.c;
11310 echo "int main () { struct $struct foo; }" >> try.c;
11311 set try;
11312 if eval $compile; then
11313         val="$define";
11314 else
11315         val="$undef";
11316 fi;
11317 set $varname;
11318 eval $setvar;
11319 $rm_try'
11320
11321 : see whether socket exists
11322 socketlib=''
11323 sockethdr=''
11324 echo " "
11325 $echo $n "Hmm... $c" >&4
11326 if set socket val -f d_socket; eval $csym; $val; then
11327         echo "Looks like you have Berkeley networking support." >&4
11328         d_socket="$define"
11329         if set setsockopt val -f; eval $csym; $val; then
11330                 d_oldsock="$undef"
11331         else
11332                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11333                 d_oldsock="$define"
11334         fi
11335 else
11336         if $contains socklib libc.list >/dev/null 2>&1; then
11337                 echo "Looks like you have Berkeley networking support." >&4
11338                 d_socket="$define"
11339                 : we will have to assume that it supports the 4.2 BSD interface
11340                 d_oldsock="$undef"
11341         else
11342                 echo "You don't have Berkeley networking in libc$_a..." >&4
11343                 if test "X$d_socket" = "X$define"; then
11344                    echo "...but you seem to believe that you have sockets." >&4
11345                 else
11346                         for net in net socket
11347                         do
11348                                 if test -f /usr/lib/lib$net$_a; then
11349                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11350                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11351                                         if $contains socket libc.list >/dev/null 2>&1; then
11352                                                 d_socket="$define"
11353                                                 socketlib="-l$net"
11354                                                 case "$net" in
11355                                                 net)
11356                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11357                                                         sockethdr="-I/usr/netinclude"
11358                                                         ;;
11359                                                 esac
11360                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11361                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11362                                                         d_oldsock="$undef"
11363                                                 else
11364                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11365                                                         d_oldsock="$define"
11366                                                 fi
11367                                                 break
11368                                         fi
11369                                 fi
11370                         done
11371                         if test "X$d_socket" != "X$define"; then
11372                            echo "or anywhere else I see." >&4
11373                            d_socket="$undef"
11374                            d_oldsock="$undef"
11375                         fi
11376                 fi
11377         fi
11378 fi
11379
11380 : see if socketpair exists
11381 set socketpair d_sockpair
11382 eval $inlibc
11383
11384
11385 echo " "
11386 echo "Checking the availability sa_len in the sock struct ..." >&4
11387 $cat >try.c <<EOF
11388 #include <sys/types.h>
11389 #include <sys/socket.h>
11390 int main() {
11391 struct sockaddr sa;
11392 return (sa.sa_len);
11393 }
11394 EOF
11395 val="$undef"
11396 set try; if eval $compile; then
11397         val="$define"
11398 fi
11399 set d_sockaddr_sa_len; eval $setvar
11400 $rm_try
11401
11402 echo " "
11403 echo "Checking the availability struct sockaddr_in6 ..." >&4
11404 $cat >try.c <<EOF
11405 #include <sys/types.h>
11406 #include <sys/socket.h>
11407 #include <netinet/in.h>
11408 int main() {
11409 struct sockaddr_in6 sin6;
11410 return (sin6.sin6_family);
11411 }
11412 EOF
11413 val="$undef"
11414 set try; if eval $compile; then
11415         val="$define"
11416 fi
11417 set d_sockaddr_in6; eval $setvar
11418 $rm_try
11419
11420 echo " "
11421 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11422 $cat >try.c <<EOF
11423 #include <sys/types.h>
11424 #include <sys/socket.h>
11425 #include <netinet/in.h>
11426 int main() {
11427 struct sockaddr_in6 sin6;
11428 return (sin6.sin6_scope_id);
11429 }
11430 EOF
11431 val="$undef"
11432 set try; if eval $compile; then
11433         val="$define"
11434 fi
11435 set d_sin6_scope_id; eval $setvar
11436 $rm_try
11437
11438 echo " "
11439 echo "Checking the availability struct ip_mreq ..." >&4
11440 $cat >try.c <<EOF
11441 #include <sys/types.h>
11442 #include <sys/socket.h>
11443 #include <netinet/in.h>
11444 int main() {
11445 struct ip_mreq mreq;
11446 return (mreq.imr_multiaddr.s_addr);
11447 }
11448 EOF
11449 val="$undef"
11450 set try; if eval $compile; then
11451        val="$define"
11452 fi
11453 set d_ip_mreq; eval $setvar
11454 $rm_try
11455
11456 echo " "
11457 echo "Checking the availability struct ip_mreq_source ..." >&4
11458 $cat >try.c <<EOF
11459 #include <sys/types.h>
11460 #include <sys/socket.h>
11461 #include <netinet/in.h>
11462 int main() {
11463 struct ip_mreq_source mreq;
11464 return (mreq.imr_multiaddr.s_addr);
11465 }
11466 EOF
11467 val="$undef"
11468 set try; if eval $compile; then
11469        val="$define"
11470 fi
11471 set d_ip_mreq_source; eval $setvar
11472 $rm_try
11473
11474 echo " "
11475 echo "Checking the availability struct ipv6_mreq ..." >&4
11476 $cat >try.c <<EOF
11477 #include <sys/types.h>
11478 #include <sys/socket.h>
11479 #include <netinet/in.h>
11480 int main() {
11481 struct ipv6_mreq mreq;
11482 return (mreq.ipv6mr_interface);
11483 }
11484 EOF
11485 val="$undef"
11486 set try; if eval $compile; then
11487         val="$define"
11488 fi
11489 set d_ipv6_mreq; eval $setvar
11490 $rm_try
11491
11492 echo " "
11493 echo "Checking the availability struct ipv6_mreq_source ..." >&4
11494 $cat >try.c <<EOF
11495 #include <sys/types.h>
11496 #include <sys/socket.h>
11497 #include <netinet/in.h>
11498 int main() {
11499 struct ipv6_mreq_source mreq;
11500 return (mreq.imr_multiaddr.s_addr);
11501 }
11502 EOF
11503 val="$undef"
11504 set try; if eval $compile; then
11505        val="$define"
11506 fi
11507 set d_ipv6_mreq_source; eval $setvar
11508 $rm_try
11509
11510 echo " "
11511 echo "Checking the availability of certain socket constants..." >&4
11512 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11513         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11514         $cat >try.c <<EOF
11515 #include <sys/types.h>
11516 #include <sys/socket.h>
11517 int main() {
11518     int i = $ENUM;
11519 }
11520 EOF
11521         val="$undef"
11522         set try; if eval $compile; then
11523                 val="$define"
11524         fi
11525         set d_${enum}; eval $setvar
11526         $rm_try
11527 done
11528
11529 : see if this is a sys/uio.h system
11530 set sys/uio.h i_sysuio
11531 eval $inhdr
11532
11533 : Check for cmsghdr support
11534 echo " "
11535 echo "Checking to see if your system supports struct cmsghdr..." >&4
11536 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11537 eval $hasstruct
11538 case "$d_cmsghdr_s" in
11539 "$define")      echo "Yes, it does."   ;;
11540 *)              echo "No, it doesn't." ;;
11541 esac
11542
11543
11544 : check for const keyword
11545 echo " "
11546 echo 'Checking to see if your C compiler knows about "const"...' >&4
11547 $cat >const.c <<'EOCP'
11548 typedef struct spug { int drokk; } spug;
11549 int main()
11550 {
11551         const char *foo;
11552         const spug y = { 0 };
11553 }
11554 EOCP
11555 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11556         val="$define"
11557         echo "Yup, it does."
11558 else
11559         val="$undef"
11560         echo "Nope, it doesn't."
11561 fi
11562 set d_const
11563 eval $setvar
11564
11565 : see if copysignl exists
11566 set copysignl d_copysignl
11567 eval $inlibc
11568
11569 : see if crypt exists
11570 echo " "
11571 set crypt d_crypt
11572 eval $inlibc
11573 case "$d_crypt" in
11574 $define) cryptlib='' ;;
11575 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11576                 echo 'crypt() found.' >&4
11577                 val="$define"
11578                 cryptlib=''
11579         else
11580                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11581                 if $test -z "$cryptlib"; then
11582                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11583                 else
11584                         cryptlib=-lcrypt
11585                 fi
11586                 if $test -z "$cryptlib"; then
11587                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11588                 else
11589                         cryptlib=-lcrypt
11590                 fi
11591                 if $test -z "$cryptlib"; then
11592                         cryptlib=`./loc libcrypt$_a "" $libpth`
11593                 else
11594                         cryptlib=-lcrypt
11595                 fi
11596                 if $test -z "$cryptlib"; then
11597                         echo 'crypt() NOT found.' >&4
11598                         val="$undef"
11599                 else
11600                         val="$define"
11601                 fi
11602         fi
11603         set d_crypt
11604         eval $setvar
11605         ;;
11606 esac
11607
11608 : see if this is a crypt.h system
11609 set crypt.h i_crypt
11610 eval $inhdr
11611
11612 : see if crypt_r exists
11613 set crypt_r d_crypt_r
11614 eval $inlibc
11615 case "$d_crypt_r" in
11616 "$define")
11617         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11618         case "$d_crypt_r_proto:$usethreads" in
11619         ":define")      d_crypt_r_proto=define
11620                 set d_crypt_r_proto crypt_r $hdrs
11621                 eval $hasproto ;;
11622         *)      ;;
11623         esac
11624         case "$d_crypt_r_proto" in
11625         define)
11626         case "$crypt_r_proto" in
11627         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11628         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11629         esac
11630         case "$crypt_r_proto" in
11631         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11632         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11633         esac
11634         case "$crypt_r_proto" in
11635         ''|0)   d_crypt_r=undef
11636                 crypt_r_proto=0
11637                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11638         * )     case "$crypt_r_proto" in
11639                 REENTRANT_PROTO*) ;;
11640                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11641                 esac
11642                 echo "Prototype: $try" ;;
11643         esac
11644         ;;
11645         *)      case "$usethreads" in
11646                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11647                 esac
11648                 d_crypt_r=undef
11649                 crypt_r_proto=0
11650                 ;;
11651         esac
11652         ;;
11653 *)      crypt_r_proto=0
11654         ;;
11655 esac
11656
11657 : get csh whereabouts
11658 case "$csh" in
11659 'csh') val="$undef" ;;
11660 *) val="$define" ;;
11661 esac
11662 set d_csh
11663 eval $setvar
11664 : Respect a hint or command line value for full_csh.
11665 case "$full_csh" in
11666 '') full_csh=$csh ;;
11667 esac
11668
11669 : see if ctermid exists
11670 set ctermid d_ctermid
11671 eval $inlibc
11672
11673 : see if ctermid_r exists
11674 set ctermid_r d_ctermid_r
11675 eval $inlibc
11676 case "$d_ctermid_r" in
11677 "$define")
11678         hdrs="$i_systypes sys/types.h define stdio.h "
11679         case "$d_ctermid_r_proto:$usethreads" in
11680         ":define")      d_ctermid_r_proto=define
11681                 set d_ctermid_r_proto ctermid_r $hdrs
11682                 eval $hasproto ;;
11683         *)      ;;
11684         esac
11685         case "$d_ctermid_r_proto" in
11686         define)
11687         case "$ctermid_r_proto" in
11688         ''|0) try='char* ctermid_r(char*);'
11689         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11690         esac
11691         case "$ctermid_r_proto" in
11692         ''|0)   d_ctermid_r=undef
11693                 ctermid_r_proto=0
11694                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11695         * )     case "$ctermid_r_proto" in
11696                 REENTRANT_PROTO*) ;;
11697                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11698                 esac
11699                 echo "Prototype: $try" ;;
11700         esac
11701         ;;
11702         *)      case "$usethreads" in
11703                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11704                 esac
11705                 d_ctermid_r=undef
11706                 ctermid_r_proto=0
11707                 ;;
11708         esac
11709         ;;
11710 *)      ctermid_r_proto=0
11711         ;;
11712 esac
11713
11714 : see if ctime_r exists
11715 set ctime_r d_ctime_r
11716 eval $inlibc
11717 case "$d_ctime_r" in
11718 "$define")
11719         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11720         case "$d_ctime_r_proto:$usethreads" in
11721         ":define")      d_ctime_r_proto=define
11722                 set d_ctime_r_proto ctime_r $hdrs
11723                 eval $hasproto ;;
11724         *)      ;;
11725         esac
11726         case "$d_ctime_r_proto" in
11727         define)
11728         case "$ctime_r_proto" in
11729         ''|0) try='char* ctime_r(const time_t*, char*);'
11730         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11731         esac
11732         case "$ctime_r_proto" in
11733         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11734         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11735         esac
11736         case "$ctime_r_proto" in
11737         ''|0) try='int ctime_r(const time_t*, char*);'
11738         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11739         esac
11740         case "$ctime_r_proto" in
11741         ''|0) try='int ctime_r(const time_t*, char*, int);'
11742         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11743         esac
11744         case "$ctime_r_proto" in
11745         ''|0)   d_ctime_r=undef
11746                 ctime_r_proto=0
11747                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11748         * )     case "$ctime_r_proto" in
11749                 REENTRANT_PROTO*) ;;
11750                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11751                 esac
11752                 echo "Prototype: $try" ;;
11753         esac
11754         ;;
11755         *)      case "$usethreads" in
11756                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11757                 esac
11758                 d_ctime_r=undef
11759                 ctime_r_proto=0
11760                 ;;
11761         esac
11762         ;;
11763 *)      ctime_r_proto=0
11764         ;;
11765 esac
11766
11767 : see if cuserid exists
11768 set cuserid d_cuserid
11769 eval $inlibc
11770
11771 : see if this is a limits.h system
11772 set limits.h i_limits
11773 eval $inhdr
11774
11775 : see if this is a float.h system
11776 set float.h i_float
11777 eval $inhdr
11778
11779 : See if number of significant digits in a double precision number is known
11780 echo " "
11781 $cat >dbl_dig.c <<EOM
11782 #$i_limits I_LIMITS
11783 #$i_float I_FLOAT
11784 #ifdef I_LIMITS
11785 #include <limits.h>
11786 #endif
11787 #ifdef I_FLOAT
11788 #include <float.h>
11789 #endif
11790 #ifdef DBL_DIG
11791 printf("Contains DBL_DIG");
11792 #endif
11793 EOM
11794 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11795 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11796         echo "DBL_DIG found." >&4
11797         val="$define"
11798 else
11799         echo "DBL_DIG NOT found." >&4
11800         val="$undef"
11801 fi
11802 $rm -f dbl_dig.?
11803 set d_dbl_dig
11804 eval $setvar
11805
11806 : see if dbm.h is available
11807 : see if dbmclose exists
11808 set dbmclose d_dbmclose
11809 eval $inlibc
11810
11811 case "$d_dbmclose" in
11812 $define)
11813         set dbm.h i_dbm
11814         eval $inhdr
11815         case "$i_dbm" in
11816         $define)
11817                 val="$undef"
11818                 set i_rpcsvcdbm
11819                 eval $setvar
11820                 ;;
11821         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11822                 eval $inhdr
11823                 ;;
11824         esac
11825         ;;
11826 *)      echo "We won't be including <dbm.h>"
11827         val="$undef"
11828         set i_dbm
11829         eval $setvar
11830         val="$undef"
11831         set i_rpcsvcdbm
11832         eval $setvar
11833         ;;
11834 esac
11835
11836 : see if prototype for dbminit is available
11837 echo " "
11838 set d_dbminitproto dbminit $i_dbm dbm.h
11839 eval $hasproto
11840
11841 : see if difftime exists
11842 set difftime d_difftime
11843 eval $inlibc
11844
11845 : see if this is a dirent system
11846 echo " "
11847 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11848         val="$define"
11849         echo "<dirent.h> found." >&4
11850 else
11851         val="$undef"
11852         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11853                 echo "<sys/dir.h> found." >&4
11854                 echo " "
11855         else
11856                 xinc=`./findhdr sys/ndir.h`
11857         fi
11858         echo "<dirent.h> NOT found." >&4
11859 fi
11860 set i_dirent
11861 eval $setvar
11862
11863 : Look for type of directory structure.
11864 echo " "
11865 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11866
11867 case "$direntrytype" in
11868 ''|' ')
11869         case "$i_dirent" in
11870         $define) guess1='struct dirent' ;;
11871         *) guess1='struct direct'  ;;
11872         esac
11873         ;;
11874 *)      guess1="$direntrytype"
11875         ;;
11876 esac
11877
11878 case "$guess1" in
11879 'struct dirent') guess2='struct direct' ;;
11880 *) guess2='struct dirent' ;;
11881 esac
11882
11883 if $contains "$guess1" try.c >/dev/null 2>&1; then
11884         direntrytype="$guess1"
11885         echo "Your directory entries are $direntrytype." >&4
11886 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11887         direntrytype="$guess2"
11888         echo "Your directory entries seem to be $direntrytype." >&4
11889 else
11890         echo "I don't recognize your system's directory entries." >&4
11891         rp="What type is used for directory entries on this system?"
11892         dflt="$guess1"
11893         . ./myread
11894         direntrytype="$ans"
11895 fi
11896 $rm_try
11897
11898 : see if the directory entry stores field length
11899 echo " "
11900 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11901 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11902         echo "Good, your directory entry keeps length information in d_namlen." >&4
11903         val="$define"
11904 else
11905         echo "Your directory entry does not know about the d_namlen field." >&4
11906         val="$undef"
11907 fi
11908 set d_dirnamlen
11909 eval $setvar
11910 $rm_try
11911
11912 : Look for DIR.dd_fd
11913 case "$i_dirent" in
11914 "$define")
11915     echo "Checking to see if DIR has a dd_fd member variable" >&4
11916     $cat >try.c <<EOCP
11917 #$i_stdlib I_STDLIB
11918 #ifdef I_STDLIB
11919 #include <stdlib.h>
11920 #endif
11921 #include <dirent.h>
11922
11923 int main() {
11924     DIR dir;
11925     dir.dd_fd = 1;
11926     return 0;
11927 }
11928 EOCP
11929     val=$undef
11930     set try
11931     if eval $compile; then
11932         echo "Yes, it does."
11933         val="$define"
11934     else
11935         echo "No, it does not."
11936         val="$undef"
11937     fi
11938     ;;
11939 *)
11940     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11941     val="$undef"
11942     ;;
11943 esac
11944 set d_dir_dd_fd
11945 eval $setvar
11946 $rm_try
11947
11948 : see if this is an sysdir system
11949 set sys/dir.h i_sysdir
11950 eval $inhdr
11951
11952 : see if this is an sysndir system
11953 set sys/ndir.h i_sysndir
11954 eval $inhdr
11955
11956 : Look for dirfd
11957 echo " "
11958 $cat >dirfd.c <<EOM
11959 #include <stdio.h>
11960 #$i_stdlib I_STDLIB
11961 #ifdef I_STDLIB
11962 #include <stdlib.h>
11963 #endif
11964 #$i_dirent I_DIRENT             /**/
11965 #$i_sysdir I_SYS_DIR            /**/
11966 #$i_sysndir I_SYS_NDIR          /**/
11967 #$i_systypes I_SYS_TYPES        /**/
11968 #if defined(I_SYS_TYPES)
11969 #include <sys/types.h>
11970 #endif
11971 #if defined(I_DIRENT)
11972 #include <dirent.h>
11973 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11974 #include <sys/dir.h>
11975 #endif
11976 #else
11977 #ifdef I_SYS_NDIR
11978 #include <sys/ndir.h>
11979 #else
11980 #ifdef I_SYS_DIR
11981 #ifdef hp9000s500
11982 #include <ndir.h>       /* may be wrong in the future */
11983 #else
11984 #include <sys/dir.h>
11985 #endif
11986 #endif
11987 #endif
11988 #endif
11989 int main() {
11990         DIR *dirp = opendir(".");
11991         if (dirfd(dirp) >= 0)
11992                 exit(0);
11993         else
11994                 exit(1);
11995 }
11996 EOM
11997 val=$undef
11998 set dirfd
11999 if eval $compile; then
12000         val="$define"
12001 fi
12002 case "$val" in
12003 $define)        echo "dirfd() found." >&4       ;;
12004 *)              echo "dirfd() NOT found." >&4   ;;
12005 esac
12006 set d_dirfd
12007 eval $setvar
12008 $rm -f dirfd*
12009
12010 : see if dlerror exists
12011 xxx_runnm="$runnm"
12012 runnm=false
12013 set dlerror d_dlerror
12014 eval $inlibc
12015 runnm="$xxx_runnm"
12016
12017 : see if dlfcn is available
12018 set dlfcn.h i_dlfcn
12019 eval $inhdr
12020
12021 : Check what extension to use for shared libs
12022 case "$usedl" in
12023 $define|y|true)
12024         $cat << EOM
12025
12026 On a few systems, the dynamically loaded modules that perl generates and uses
12027 will need a different extension than shared libs. The default will probably
12028 be appropriate.
12029
12030 EOM
12031         case "$dlext" in
12032         '')     dflt="$so" ;;
12033         *)      dflt="$dlext" ;;
12034         esac
12035         rp='What is the extension of dynamically loaded modules'
12036         . ./myread
12037         dlext="$ans"
12038         ;;
12039 *)
12040         dlext="none"
12041         ;;
12042 esac
12043
12044 : Check if dlsym need a leading underscore
12045 echo " "
12046 val="$undef"
12047
12048 case "$dlsrc" in
12049 dl_dlopen.xs)
12050         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12051         $cat >dyna.c <<'EOM'
12052 fred () { }
12053 EOM
12054
12055 $cat >fred.c<<EOM
12056
12057 #include <stdio.h>
12058 #$i_stdlib I_STDLIB
12059 #ifdef I_STDLIB
12060 #include <stdlib.h>
12061 #endif
12062 #$i_dlfcn I_DLFCN
12063 #ifdef I_DLFCN
12064 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12065 #else
12066 #include <sys/types.h>
12067 #include <nlist.h>
12068 #include <link.h>
12069 #endif
12070
12071 extern int fred() ;
12072
12073 int main()
12074 {
12075     void * handle ;
12076     void * symbol ;
12077 #ifndef RTLD_LAZY
12078     int mode = 1 ;
12079 #else
12080     int mode = RTLD_LAZY ;
12081 #endif
12082     handle = dlopen("./dyna.$dlext", mode) ;
12083     if (handle == NULL) {
12084         printf ("1\n") ;
12085         fflush (stdout) ;
12086         exit(0);
12087     }
12088     symbol = dlsym(handle, "fred") ;
12089     if (symbol == NULL) {
12090         /* try putting a leading underscore */
12091         symbol = dlsym(handle, "_fred") ;
12092         if (symbol == NULL) {
12093             printf ("2\n") ;
12094             fflush (stdout) ;
12095             exit(0);
12096         }
12097         printf ("3\n") ;
12098     }
12099     else
12100         printf ("4\n") ;
12101     fflush (stdout) ;
12102     exit(0);
12103 }
12104 EOM
12105         : Call the object file tmp-dyna.o in case dlext=o.
12106         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12107                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12108                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12109                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12110                 xxx=`$run ./fred`
12111                 case $xxx in
12112                 1)      echo "Test program failed using dlopen." >&4
12113                         echo "Perhaps you should not use dynamic loading." >&4;;
12114                 2)      echo "Test program failed using dlsym." >&4
12115                         echo "Perhaps you should not use dynamic loading." >&4;;
12116                 3)      echo "dlsym needs a leading underscore" >&4
12117                         val="$define" ;;
12118                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12119                 esac
12120         else
12121                 echo "I can't compile and run the test program." >&4
12122                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12123         fi
12124         ;;
12125 esac
12126
12127 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12128
12129 set d_dlsymun
12130 eval $setvar
12131
12132 : see if drand48_r exists
12133 set drand48_r d_drand48_r
12134 eval $inlibc
12135 case "$d_drand48_r" in
12136 "$define")
12137         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12138         case "$d_drand48_r_proto:$usethreads" in
12139         ":define")      d_drand48_r_proto=define
12140                 set d_drand48_r_proto drand48_r $hdrs
12141                 eval $hasproto ;;
12142         *)      ;;
12143         esac
12144         case "$d_drand48_r_proto" in
12145         define)
12146         case "$drand48_r_proto" in
12147         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12148         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12149         esac
12150         case "$drand48_r_proto" in
12151         ''|0)   d_drand48_r=undef
12152                 drand48_r_proto=0
12153                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12154         * )     case "$drand48_r_proto" in
12155                 REENTRANT_PROTO*) ;;
12156                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12157                 esac
12158                 echo "Prototype: $try" ;;
12159         esac
12160         ;;
12161         *)      case "$usethreads" in
12162                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12163                 esac
12164                 d_drand48_r=undef
12165                 drand48_r_proto=0
12166                 ;;
12167         esac
12168         ;;
12169 *)      drand48_r_proto=0
12170         ;;
12171 esac
12172
12173 : see if prototype for drand48 is available
12174 echo " "
12175 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12176 eval $hasproto
12177
12178 : see if dup2 exists
12179 set dup2 d_dup2
12180 eval $inlibc
12181
12182 : see if eaccess exists
12183 set eaccess d_eaccess
12184 eval $inlibc
12185
12186 : see if endgrent exists
12187 set endgrent d_endgrent
12188 eval $inlibc
12189
12190 : see if this is an grp system
12191 set grp.h i_grp
12192 eval $inhdr
12193
12194 case "$i_grp" in
12195 $define)
12196         xxx=`./findhdr grp.h`
12197         $cppstdin $cppflags $cppminus < $xxx >$$.h
12198
12199         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12200                 val="$define"
12201         else
12202                 val="$undef"
12203         fi
12204         set d_grpasswd
12205         eval $setvar
12206
12207         $rm -f $$.h
12208         ;;
12209 *)
12210         val="$undef";
12211         set d_grpasswd; eval $setvar
12212         ;;
12213 esac
12214
12215 : see if endgrent_r exists
12216 set endgrent_r d_endgrent_r
12217 eval $inlibc
12218 case "$d_endgrent_r" in
12219 "$define")
12220         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12221         case "$d_endgrent_r_proto:$usethreads" in
12222         ":define")      d_endgrent_r_proto=define
12223                 set d_endgrent_r_proto endgrent_r $hdrs
12224                 eval $hasproto ;;
12225         *)      ;;
12226         esac
12227         case "$d_endgrent_r_proto" in
12228         define)
12229         case "$endgrent_r_proto" in
12230         ''|0) try='int endgrent_r(FILE**);'
12231         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12232         esac
12233         case "$endgrent_r_proto" in
12234         ''|0) try='void endgrent_r(FILE**);'
12235         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12236         esac
12237         case "$endgrent_r_proto" in
12238         ''|0)   d_endgrent_r=undef
12239                 endgrent_r_proto=0
12240                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12241         * )     case "$endgrent_r_proto" in
12242                 REENTRANT_PROTO*) ;;
12243                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12244                 esac
12245                 echo "Prototype: $try" ;;
12246         esac
12247         ;;
12248         *)      case "$usethreads" in
12249                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12250                 esac
12251                 d_endgrent_r=undef
12252                 endgrent_r_proto=0
12253                 ;;
12254         esac
12255         ;;
12256 *)      endgrent_r_proto=0
12257         ;;
12258 esac
12259
12260 : see if endhostent exists
12261 set endhostent d_endhent
12262 eval $inlibc
12263
12264 : see if this is a netdb.h system
12265 set netdb.h i_netdb
12266 eval $inhdr
12267
12268 : see if endhostent_r exists
12269 set endhostent_r d_endhostent_r
12270 eval $inlibc
12271 case "$d_endhostent_r" in
12272 "$define")
12273         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12274         case "$d_endhostent_r_proto:$usethreads" in
12275         ":define")      d_endhostent_r_proto=define
12276                 set d_endhostent_r_proto endhostent_r $hdrs
12277                 eval $hasproto ;;
12278         *)      ;;
12279         esac
12280         case "$d_endhostent_r_proto" in
12281         define)
12282         case "$endhostent_r_proto" in
12283         ''|0) try='int endhostent_r(struct hostent_data*);'
12284         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12285         esac
12286         case "$endhostent_r_proto" in
12287         ''|0) try='void endhostent_r(struct hostent_data*);'
12288         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12289         esac
12290         case "$endhostent_r_proto" in
12291         ''|0)   d_endhostent_r=undef
12292                 endhostent_r_proto=0
12293                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12294         * )     case "$endhostent_r_proto" in
12295                 REENTRANT_PROTO*) ;;
12296                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12297                 esac
12298                 echo "Prototype: $try" ;;
12299         esac
12300         ;;
12301         *)      case "$usethreads" in
12302                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12303                 esac
12304                 d_endhostent_r=undef
12305                 endhostent_r_proto=0
12306                 ;;
12307         esac
12308         ;;
12309 *)      endhostent_r_proto=0
12310         ;;
12311 esac
12312
12313 : see if endnetent exists
12314 set endnetent d_endnent
12315 eval $inlibc
12316
12317 : see if endnetent_r exists
12318 set endnetent_r d_endnetent_r
12319 eval $inlibc
12320 case "$d_endnetent_r" in
12321 "$define")
12322         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12323         case "$d_endnetent_r_proto:$usethreads" in
12324         ":define")      d_endnetent_r_proto=define
12325                 set d_endnetent_r_proto endnetent_r $hdrs
12326                 eval $hasproto ;;
12327         *)      ;;
12328         esac
12329         case "$d_endnetent_r_proto" in
12330         define)
12331         case "$endnetent_r_proto" in
12332         ''|0) try='int endnetent_r(struct netent_data*);'
12333         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12334         esac
12335         case "$endnetent_r_proto" in
12336         ''|0) try='void endnetent_r(struct netent_data*);'
12337         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12338         esac
12339         case "$endnetent_r_proto" in
12340         ''|0)   d_endnetent_r=undef
12341                 endnetent_r_proto=0
12342                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12343         * )     case "$endnetent_r_proto" in
12344                 REENTRANT_PROTO*) ;;
12345                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12346                 esac
12347                 echo "Prototype: $try" ;;
12348         esac
12349         ;;
12350         *)      case "$usethreads" in
12351                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12352                 esac
12353                 d_endnetent_r=undef
12354                 endnetent_r_proto=0
12355                 ;;
12356         esac
12357         ;;
12358 *)      endnetent_r_proto=0
12359         ;;
12360 esac
12361
12362 : see if endprotoent exists
12363 set endprotoent d_endpent
12364 eval $inlibc
12365
12366 : see if endprotoent_r exists
12367 set endprotoent_r d_endprotoent_r
12368 eval $inlibc
12369 case "$d_endprotoent_r" in
12370 "$define")
12371         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12372         case "$d_endprotoent_r_proto:$usethreads" in
12373         ":define")      d_endprotoent_r_proto=define
12374                 set d_endprotoent_r_proto endprotoent_r $hdrs
12375                 eval $hasproto ;;
12376         *)      ;;
12377         esac
12378         case "$d_endprotoent_r_proto" in
12379         define)
12380         case "$endprotoent_r_proto" in
12381         ''|0) try='int endprotoent_r(struct protoent_data*);'
12382         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12383         esac
12384         case "$endprotoent_r_proto" in
12385         ''|0) try='void endprotoent_r(struct protoent_data*);'
12386         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12387         esac
12388         case "$endprotoent_r_proto" in
12389         ''|0)   d_endprotoent_r=undef
12390                 endprotoent_r_proto=0
12391                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12392         * )     case "$endprotoent_r_proto" in
12393                 REENTRANT_PROTO*) ;;
12394                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12395                 esac
12396                 echo "Prototype: $try" ;;
12397         esac
12398         ;;
12399         *)      case "$usethreads" in
12400                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12401                 esac
12402                 d_endprotoent_r=undef
12403                 endprotoent_r_proto=0
12404                 ;;
12405         esac
12406         ;;
12407 *)      endprotoent_r_proto=0
12408         ;;
12409 esac
12410
12411 : see if endpwent exists
12412 set endpwent d_endpwent
12413 eval $inlibc
12414
12415 : see if this is a pwd.h system
12416 set pwd.h i_pwd
12417 eval $inhdr
12418
12419 case "$i_pwd" in
12420 $define)
12421         xxx=`./findhdr pwd.h`
12422         $cppstdin $cppflags $cppminus < $xxx >$$.h
12423
12424         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12425                 val="$define"
12426         else
12427                 val="$undef"
12428         fi
12429         set d_pwquota
12430         eval $setvar
12431
12432         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12433                 val="$define"
12434         else
12435                 val="$undef"
12436         fi
12437         set d_pwage
12438         eval $setvar
12439
12440         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12441                 val="$define"
12442         else
12443                 val="$undef"
12444         fi
12445         set d_pwchange
12446         eval $setvar
12447
12448         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12449                 val="$define"
12450         else
12451                 val="$undef"
12452         fi
12453         set d_pwclass
12454         eval $setvar
12455
12456         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12457                 val="$define"
12458         else
12459                 val="$undef"
12460         fi
12461         set d_pwexpire
12462         eval $setvar
12463
12464         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12465                 val="$define"
12466         else
12467                 val="$undef"
12468         fi
12469         set d_pwcomment
12470         eval $setvar
12471
12472         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12473                 val="$define"
12474         else
12475                 val="$undef"
12476         fi
12477         set d_pwgecos
12478         eval $setvar
12479
12480         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12481                 val="$define"
12482         else
12483                 val="$undef"
12484         fi
12485         set d_pwpasswd
12486         eval $setvar
12487
12488         $rm -f $$.h
12489         ;;
12490 *)
12491         val="$undef";
12492         set d_pwquota; eval $setvar
12493         set d_pwage; eval $setvar
12494         set d_pwchange; eval $setvar
12495         set d_pwclass; eval $setvar
12496         set d_pwexpire; eval $setvar
12497         set d_pwcomment; eval $setvar
12498         set d_pwgecos; eval $setvar
12499         set d_pwpasswd; eval $setvar
12500         ;;
12501 esac
12502
12503 : see if endpwent_r exists
12504 set endpwent_r d_endpwent_r
12505 eval $inlibc
12506 case "$d_endpwent_r" in
12507 "$define")
12508         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12509         case "$d_endpwent_r_proto:$usethreads" in
12510         ":define")      d_endpwent_r_proto=define
12511                 set d_endpwent_r_proto endpwent_r $hdrs
12512                 eval $hasproto ;;
12513         *)      ;;
12514         esac
12515         case "$d_endpwent_r_proto" in
12516         define)
12517         case "$endpwent_r_proto" in
12518         ''|0) try='int endpwent_r(FILE**);'
12519         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12520         esac
12521         case "$endpwent_r_proto" in
12522         ''|0) try='void endpwent_r(FILE**);'
12523         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12524         esac
12525         case "$endpwent_r_proto" in
12526         ''|0)   d_endpwent_r=undef
12527                 endpwent_r_proto=0
12528                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12529         * )     case "$endpwent_r_proto" in
12530                 REENTRANT_PROTO*) ;;
12531                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12532                 esac
12533                 echo "Prototype: $try" ;;
12534         esac
12535         ;;
12536         *)      case "$usethreads" in
12537                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12538                 esac
12539                 d_endpwent_r=undef
12540                 endpwent_r_proto=0
12541                 ;;
12542         esac
12543         ;;
12544 *)      endpwent_r_proto=0
12545         ;;
12546 esac
12547
12548 : see if endservent exists
12549 set endservent d_endsent
12550 eval $inlibc
12551
12552 : see if endservent_r exists
12553 set endservent_r d_endservent_r
12554 eval $inlibc
12555 case "$d_endservent_r" in
12556 "$define")
12557         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12558         case "$d_endservent_r_proto:$usethreads" in
12559         ":define")      d_endservent_r_proto=define
12560                 set d_endservent_r_proto endservent_r $hdrs
12561                 eval $hasproto ;;
12562         *)      ;;
12563         esac
12564         case "$d_endservent_r_proto" in
12565         define)
12566         case "$endservent_r_proto" in
12567         ''|0) try='int endservent_r(struct servent_data*);'
12568         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12569         esac
12570         case "$endservent_r_proto" in
12571         ''|0) try='void endservent_r(struct servent_data*);'
12572         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12573         esac
12574         case "$endservent_r_proto" in
12575         ''|0)   d_endservent_r=undef
12576                 endservent_r_proto=0
12577                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12578         * )     case "$endservent_r_proto" in
12579                 REENTRANT_PROTO*) ;;
12580                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12581                 esac
12582                 echo "Prototype: $try" ;;
12583         esac
12584         ;;
12585         *)      case "$usethreads" in
12586                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12587                 esac
12588                 d_endservent_r=undef
12589                 endservent_r_proto=0
12590                 ;;
12591         esac
12592         ;;
12593 *)      endservent_r_proto=0
12594         ;;
12595 esac
12596
12597 : Locate the flags for 'open()'
12598 echo " "
12599 $cat >try.c <<EOCP
12600 #include <sys/types.h>
12601 #ifdef I_FCNTL
12602 #include <fcntl.h>
12603 #endif
12604 #ifdef I_SYS_FILE
12605 #include <sys/file.h>
12606 #endif
12607 #$i_stdlib I_STDLIB
12608 #ifdef I_STDLIB
12609 #include <stdlib.h>
12610 #endif
12611 int main() {
12612         if(O_RDONLY);
12613 #ifdef O_TRUNC
12614         exit(0);
12615 #else
12616         exit(1);
12617 #endif
12618 }
12619 EOCP
12620 : check sys/file.h first to get FREAD on Sun
12621 if $test `./findhdr sys/file.h` && \
12622                 set try -DI_SYS_FILE && eval $compile; then
12623         h_sysfile=true;
12624         echo "<sys/file.h> defines the O_* constants..." >&4
12625         if $run ./try; then
12626                 echo "and you have the 3 argument form of open()." >&4
12627                 val="$define"
12628         else
12629                 echo "but not the 3 argument form of open().  Oh, well." >&4
12630                 val="$undef"
12631         fi
12632 elif $test `./findhdr fcntl.h` && \
12633                 set try -DI_FCNTL && eval $compile; then
12634         h_fcntl=true;
12635         echo "<fcntl.h> defines the O_* constants..." >&4
12636         if $run ./try; then
12637                 echo "and you have the 3 argument form of open()." >&4
12638                 val="$define"
12639         else
12640                 echo "but not the 3 argument form of open().  Oh, well." >&4
12641                 val="$undef"
12642         fi
12643 else
12644         val="$undef"
12645         echo "I can't find the O_* constant definitions!  You got problems." >&4
12646 fi
12647 set d_open3
12648 eval $setvar
12649 $rm_try
12650
12651 : see if this is a sys/file.h system
12652 val=''
12653 set sys/file.h val
12654 eval $inhdr
12655
12656 : do we need to include sys/file.h ?
12657 case "$val" in
12658 "$define")
12659         echo " "
12660         if $h_sysfile; then
12661                 val="$define"
12662                 echo "We'll be including <sys/file.h>." >&4
12663         else
12664                 val="$undef"
12665                 echo "We won't be including <sys/file.h>." >&4
12666         fi
12667         ;;
12668 *)
12669         h_sysfile=false
12670         ;;
12671 esac
12672 set i_sysfile
12673 eval $setvar
12674
12675 : see if fcntl.h is there
12676 val=''
12677 set fcntl.h val
12678 eval $inhdr
12679
12680 : see if we can include fcntl.h
12681 case "$val" in
12682 "$define")
12683         echo " "
12684         if $h_fcntl; then
12685                 val="$define"
12686                 echo "We'll be including <fcntl.h>." >&4
12687         else
12688                 val="$undef"
12689                 if $h_sysfile; then
12690         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12691                 else
12692                         echo "We won't be including <fcntl.h>." >&4
12693                 fi
12694         fi
12695         ;;
12696 *)
12697         h_fcntl=false
12698         val="$undef"
12699         ;;
12700 esac
12701 set i_fcntl
12702 eval $setvar
12703
12704 : see if fork exists
12705 set fork d_fork
12706 eval $inlibc
12707
12708 : see if pipe exists
12709 set pipe d_pipe
12710 eval $inlibc
12711
12712 : check for non-blocking I/O stuff
12713 case "$h_sysfile" in
12714 true) echo "#include <sys/file.h>" > head.c;;
12715 *)
12716        case "$h_fcntl" in
12717        true) echo "#include <fcntl.h>" > head.c;;
12718        *) echo "#include <sys/fcntl.h>" > head.c;;
12719        esac
12720        ;;
12721 esac
12722 echo " "
12723 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12724 case "$o_nonblock" in
12725 '')
12726         $cat head.c > try.c
12727         $cat >>try.c <<EOCP
12728 #include <stdio.h>
12729 #$i_stdlib I_STDLIB
12730 #ifdef I_STDLIB
12731 #include <stdlib.h>
12732 #endif
12733 #$i_fcntl I_FCNTL
12734 #ifdef I_FCNTL
12735 #include <fcntl.h>
12736 #endif
12737 int main() {
12738 #ifdef O_NONBLOCK
12739         printf("O_NONBLOCK\n");
12740         exit(0);
12741 #endif
12742 #ifdef O_NDELAY
12743         printf("O_NDELAY\n");
12744         exit(0);
12745 #endif
12746 #ifdef FNDELAY
12747         printf("FNDELAY\n");
12748         exit(0);
12749 #endif
12750         exit(0);
12751 }
12752 EOCP
12753         set try
12754         if eval $compile_ok; then
12755                 o_nonblock=`$run ./try`
12756                 case "$o_nonblock" in
12757                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12758                 *) echo "Seems like we can use $o_nonblock.";;
12759                 esac
12760         else
12761                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12762         fi
12763         ;;
12764 *) echo "Using $hint value $o_nonblock.";;
12765 esac
12766 $rm_try
12767
12768 echo " "
12769 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12770 case "$eagain" in
12771 '')
12772         case "$d_fork:$d_pipe" in
12773         define:define)
12774         $cat head.c > try.c
12775         $cat >>try.c <<EOCP
12776 #include <errno.h>
12777 #include <sys/types.h>
12778 #include <signal.h>
12779 #include <stdio.h>
12780 #$i_stdlib I_STDLIB
12781 #ifdef I_STDLIB
12782 #include <stdlib.h>
12783 #endif
12784 #$i_fcntl I_FCNTL
12785 #ifdef I_FCNTL
12786 #include <fcntl.h>
12787 #endif
12788 #define MY_O_NONBLOCK $o_nonblock
12789 #ifndef errno  /* XXX need better Configure test */
12790 extern int errno;
12791 #endif
12792 #$i_unistd I_UNISTD
12793 #ifdef I_UNISTD
12794 #include <unistd.h>
12795 #endif
12796 #$i_string I_STRING
12797 #ifdef I_STRING
12798 #include <string.h>
12799 #else
12800 #include <strings.h>
12801 #endif
12802 $signal_t blech(int x) { exit(3); }
12803 EOCP
12804         $cat >> try.c <<'EOCP'
12805 int main()
12806 {
12807         int pd[2];
12808         int pu[2];
12809         char buf[1];
12810         char string[100];
12811
12812         pipe(pd);       /* Down: child -> parent */
12813         pipe(pu);       /* Up: parent -> child */
12814         if (0 != fork()) {
12815                 int ret;
12816                 close(pd[1]);   /* Parent reads from pd[0] */
12817                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12818 #ifdef F_SETFL
12819                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12820                         exit(1);
12821 #else
12822                 exit(4);
12823 #endif
12824                 signal(SIGALRM, blech);
12825                 alarm(5);
12826                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12827                         exit(2);
12828                 sprintf(string, "%d\n", ret);
12829                 write(2, string, strlen(string));
12830                 alarm(0);
12831 #ifdef EAGAIN
12832                 if (errno == EAGAIN) {
12833                         printf("EAGAIN\n");
12834                         goto ok;
12835                 }
12836 #endif
12837 #ifdef EWOULDBLOCK
12838                 if (errno == EWOULDBLOCK)
12839                         printf("EWOULDBLOCK\n");
12840 #endif
12841         ok:
12842                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12843                 sleep(2);                               /* Give it time to close our pipe */
12844                 alarm(5);
12845                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12846                 alarm(0);
12847                 sprintf(string, "%d\n", ret);
12848                 write(4, string, strlen(string));
12849                 exit(0);
12850         }
12851
12852         close(pd[0]);                   /* We write to pd[1] */
12853         close(pu[1]);                   /* We read from pu[0] */
12854         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12855         close(pd[1]);                   /* Pipe pd is now fully closed! */
12856         exit(0);                                /* Bye bye, thank you for playing! */
12857 }
12858 EOCP
12859         set try
12860         if eval $compile_ok; then
12861                 echo "$startsh" >mtry
12862                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12863                 chmod +x mtry
12864                 ./mtry >/dev/null 2>&1
12865                 case $? in
12866                 0) eagain=`$cat try.out`;;
12867                 1) echo "Could not perform non-blocking setting!";;
12868                 2) echo "I did a successful read() for something that was not there!";;
12869                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12870                 4) echo "Could not find F_SETFL!";;
12871                 *) echo "Something terribly wrong happened during testing.";;
12872                 esac
12873                 rd_nodata=`$cat try.ret`
12874                 echo "A read() system call with no data present returns $rd_nodata."
12875                 case "$rd_nodata" in
12876                 0|-1) ;;
12877                 *)
12878                         echo "(That's peculiar, fixing that to be -1.)"
12879                         rd_nodata=-1
12880                         ;;
12881                 esac
12882                 case "$eagain" in
12883                 '')
12884                         echo "Forcing errno EAGAIN on read() with no data available."
12885                         eagain=EAGAIN
12886                         ;;
12887                 *)
12888                         echo "Your read() sets errno to $eagain when no data is available."
12889                         ;;
12890                 esac
12891                 status=`$cat try.err`
12892                 case "$status" in
12893                 0) echo "And it correctly returns 0 to signal EOF.";;
12894                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12895                 *) echo "However, your read() returns '$status' on EOF??";;
12896                 esac
12897                 val="$define"
12898                 if test "$status" = "$rd_nodata"; then
12899                         echo "WARNING: you can't distinguish between EOF and no data!"
12900                         val="$undef"
12901                 fi
12902         else
12903                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12904                 eagain=EAGAIN
12905         fi
12906         ;;
12907         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12908                 eagain=EAGAIN
12909                 val="$define"
12910                 ;;
12911         esac
12912         set d_eofnblk
12913         eval $setvar
12914         ;;
12915 *)
12916         echo "Using $hint value $eagain."
12917         echo "Your read() returns $rd_nodata when no data is present."
12918         case "$d_eofnblk" in
12919         "$define") echo "And you can see EOF because read() returns 0.";;
12920         "$undef") echo "But you can't see EOF status from read() returned value.";;
12921         *)
12922                 echo "(Assuming you can't see EOF status from read anyway.)"
12923                 d_eofnblk=$undef
12924                 ;;
12925         esac
12926         ;;
12927 esac
12928 $rm_try head.c mtry
12929
12930 : see if _ptr and _cnt from stdio act std
12931 echo " "
12932
12933 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12934         echo "(Looks like you have stdio.h from BSD.)"
12935         case "$stdio_ptr" in
12936         '') stdio_ptr='((fp)->_p)'
12937                 ptr_lval=$define
12938                 ;;
12939         *)      ptr_lval=$d_stdio_ptr_lval;;
12940         esac
12941         case "$stdio_cnt" in
12942         '') stdio_cnt='((fp)->_r)'
12943                 cnt_lval=$define
12944                 ;;
12945         *)      cnt_lval=$d_stdio_cnt_lval;;
12946         esac
12947         case "$stdio_base" in
12948         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12949         esac
12950         case "$stdio_bufsiz" in
12951         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12952         esac
12953 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12954         echo "(Looks like you have stdio.h from Linux.)"
12955         case "$stdio_ptr" in
12956         '') stdio_ptr='((fp)->_IO_read_ptr)'
12957                 ptr_lval=$define
12958                 ;;
12959         *)      ptr_lval=$d_stdio_ptr_lval;;
12960         esac
12961         case "$stdio_cnt" in
12962         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12963                 cnt_lval=$undef
12964                 ;;
12965         *)      cnt_lval=$d_stdio_cnt_lval;;
12966         esac
12967         case "$stdio_base" in
12968         '') stdio_base='((fp)->_IO_read_base)';;
12969         esac
12970         case "$stdio_bufsiz" in
12971         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12972         esac
12973 else
12974         case "$stdio_ptr" in
12975         '') stdio_ptr='((fp)->_ptr)'
12976                 ptr_lval=$define
12977                 ;;
12978         *)      ptr_lval=$d_stdio_ptr_lval;;
12979         esac
12980         case "$stdio_cnt" in
12981         '') stdio_cnt='((fp)->_cnt)'
12982                 cnt_lval=$define
12983                 ;;
12984         *)      cnt_lval=$d_stdio_cnt_lval;;
12985         esac
12986         case "$stdio_base" in
12987         '') stdio_base='((fp)->_base)';;
12988         esac
12989         case "$stdio_bufsiz" in
12990         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12991         esac
12992 fi
12993
12994 : test whether _ptr and _cnt really work
12995 echo "Checking how std your stdio is..." >&4
12996 $cat >try.c <<EOP
12997 #include <stdio.h>
12998 #$i_stdlib I_STDLIB
12999 #ifdef I_STDLIB
13000 #include <stdlib.h>
13001 #endif
13002 #define FILE_ptr(fp)    $stdio_ptr
13003 #define FILE_cnt(fp)    $stdio_cnt
13004 int main() {
13005         FILE *fp = fopen("try.c", "r");
13006         char c = getc(fp);
13007         if (
13008                 18 <= FILE_cnt(fp) &&
13009                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13010         )
13011                 exit(0);
13012         exit(1);
13013 }
13014 EOP
13015 val="$undef"
13016 set try
13017 if eval $compile && $to try.c; then
13018         if $run ./try; then
13019                 echo "Your stdio acts pretty std."
13020                 val="$define"
13021         else
13022                 echo "Your stdio isn't very std."
13023         fi
13024 else
13025         echo "Your stdio doesn't appear very std."
13026 fi
13027 $rm_try
13028
13029 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13030 # direct buffer manipulation no longer works.  The Configure tests
13031 # should be changed to correctly detect this, but until then,
13032 # the following check should at least let perl compile and run.
13033 # (This quick fix should be updated before 5.8.1.)
13034 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13035 # A. Dougherty, June 3, 2002.
13036 case "$d_gnulibc" in
13037 $define)
13038         case "$gnulibc_version" in
13039         2.[01]*)  ;;
13040         2.2) ;;
13041         2.2.[0-9]) ;;
13042         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13043                 val="$undef"
13044                 ;;
13045         esac
13046         ;;
13047 esac
13048 set d_stdstdio
13049 eval $setvar
13050
13051 : Can _ptr be used as an lvalue?
13052 case "$d_stdstdio$ptr_lval" in
13053 $define$define) val=$define ;;
13054 *) val=$undef ;;
13055 esac
13056 set d_stdio_ptr_lval
13057 eval $setvar
13058
13059 : Can _cnt be used as an lvalue?
13060 case "$d_stdstdio$cnt_lval" in
13061 $define$define) val=$define ;;
13062 *) val=$undef ;;
13063 esac
13064 set d_stdio_cnt_lval
13065 eval $setvar
13066
13067
13068 : test whether setting _ptr sets _cnt as a side effect
13069 d_stdio_ptr_lval_sets_cnt="$undef"
13070 d_stdio_ptr_lval_nochange_cnt="$undef"
13071 case "$d_stdio_ptr_lval$d_stdstdio" in
13072 $define$define)
13073         echo "Checking to see what happens if we set the stdio ptr..." >&4
13074 $cat >try.c <<EOP
13075 #include <stdio.h>
13076 /* Can we scream? */
13077 /* Eat dust sed :-) */
13078 /* In the buffer space, no one can hear you scream. */
13079 #$i_stdlib I_STDLIB
13080 #ifdef I_STDLIB
13081 #include <stdlib.h>
13082 #endif
13083 #define FILE_ptr(fp)    $stdio_ptr
13084 #define FILE_cnt(fp)    $stdio_cnt
13085 #include <sys/types.h>
13086 int main() {
13087         FILE *fp = fopen("try.c", "r");
13088         int c;
13089         char *ptr;
13090         size_t cnt;
13091         if (!fp) {
13092             puts("Fail even to read");
13093             exit(1);
13094         }
13095         c = getc(fp); /* Read away the first # */
13096         if (c == EOF) {
13097             puts("Fail even to read");
13098             exit(1);
13099         }
13100         if (!(
13101                 18 <= FILE_cnt(fp) &&
13102                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13103         )) {
13104                 puts("Fail even to read");
13105                 exit (1);
13106         }
13107         ptr = (char*) FILE_ptr(fp);
13108         cnt = (size_t)FILE_cnt(fp);
13109
13110         FILE_ptr(fp) += 42;
13111
13112         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13113                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13114                 exit (1);
13115         }
13116         if (FILE_cnt(fp) <= 20) {
13117                 printf ("Fail (<20 chars to test)");
13118                 exit (1);
13119         }
13120         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13121                 puts("Fail compare");
13122                 exit (1);
13123         }
13124         if (cnt == FILE_cnt(fp)) {
13125                 puts("Pass_unchanged");
13126                 exit (0);
13127         }
13128         if (FILE_cnt(fp) == (cnt - 42)) {
13129                 puts("Pass_changed");
13130                 exit (0);
13131         }
13132         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13133         return 1;
13134
13135 }
13136 EOP
13137         set try
13138         if eval $compile && $to try.c; then
13139                 case `$run ./try` in
13140                 Pass_changed)
13141                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13142                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13143                 Pass_unchanged)
13144                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13145                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13146                 Fail*)
13147                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13148                 *)
13149                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13150         esac
13151         else
13152                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13153         fi
13154         $rm_try
13155         ;;
13156 esac
13157
13158 : see if _base is also standard
13159 val="$undef"
13160 case "$d_stdstdio" in
13161 $define)
13162         $cat >try.c <<EOP
13163 #include <stdio.h>
13164 #$i_stdlib I_STDLIB
13165 #ifdef I_STDLIB
13166 #include <stdlib.h>
13167 #endif
13168 #define FILE_base(fp)   $stdio_base
13169 #define FILE_bufsiz(fp) $stdio_bufsiz
13170 int main() {
13171         FILE *fp = fopen("try.c", "r");
13172         char c = getc(fp);
13173         if (
13174                 19 <= FILE_bufsiz(fp) &&
13175                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13176         )
13177                 exit(0);
13178         exit(1);
13179 }
13180 EOP
13181         set try
13182         if eval $compile && $to try.c; then
13183                 if $run ./try; then
13184                         echo "And its _base field acts std."
13185                         val="$define"
13186                 else
13187                         echo "But its _base field isn't std."
13188                 fi
13189         else
13190                 echo "However, it seems to be lacking the _base field."
13191         fi
13192         $rm_try
13193         ;;
13194 esac
13195 set d_stdiobase
13196 eval $setvar
13197
13198 : see if fast_stdio exists
13199 val="$undef"
13200 case "$d_stdstdio:$d_stdio_ptr_lval" in
13201 "$define:$define")
13202         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13203         *$define*)
13204                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13205                 val="$define"
13206                 ;;
13207         esac
13208         ;;
13209 esac
13210 set d_faststdio
13211 eval $setvar
13212
13213
13214
13215 : see if fchdir exists
13216 set fchdir d_fchdir
13217 eval $inlibc
13218
13219 : see if fchmod exists
13220 set fchmod d_fchmod
13221 eval $inlibc
13222
13223 : see if fchown exists
13224 set fchown d_fchown
13225 eval $inlibc
13226
13227 : see if this is an fcntl system
13228 set fcntl d_fcntl
13229 eval $inlibc
13230
13231 : See if fcntl-based locking works.
13232 echo " "
13233 $cat >try.c <<EOCP
13234 #$i_stdlib I_STDLIB
13235 #ifdef I_STDLIB
13236 #include <stdlib.h>
13237 #endif
13238 #include <unistd.h>
13239 #include <fcntl.h>
13240 #include <signal.h>
13241 $signal_t blech(int x) { exit(3); }
13242 int main() {
13243 #if defined(F_SETLK) && defined(F_SETLKW)
13244      struct flock flock;
13245      int retval, fd;
13246      fd = open("try.c", O_RDONLY);
13247      flock.l_type = F_RDLCK;
13248      flock.l_whence = SEEK_SET;
13249      flock.l_start = flock.l_len = 0;
13250      signal(SIGALRM, blech);
13251      alarm(10);
13252      retval = fcntl(fd, F_SETLK, &flock);
13253      close(fd);
13254      (retval < 0 ? exit(2) : exit(0));
13255 #else
13256      exit(2);
13257 #endif
13258 }
13259 EOCP
13260 echo "Checking if fcntl-based file locking works... "
13261 case "$d_fcntl" in
13262 "$define")
13263         set try
13264         if eval $compile_ok; then
13265                 if $run ./try; then
13266                         echo "Yes, it seems to work."
13267                         val="$define"
13268                 else
13269                         echo "Nope, it didn't work."
13270                         val="$undef"
13271                         case "$?" in
13272                         3) $cat >&4 <<EOM
13273 ***
13274 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13275 *** This is (almost) impossible.
13276 *** If your NFS lock daemons are not feeling well, something like
13277 *** this may happen, please investigate.  Cannot continue, aborting.
13278 ***
13279 EOM
13280                                 exit 1
13281                                 ;;
13282                         esac
13283                 fi
13284         else
13285                 echo "I'm unable to compile the test program, so I'll assume not."
13286                 val="$undef"
13287         fi
13288         ;;
13289 *) val="$undef";
13290         echo "Nope, since you don't even have fcntl()."
13291         ;;
13292 esac
13293 set d_fcntl_can_lock
13294 eval $setvar
13295 $rm_try
13296
13297 : check for fd_set items
13298 $cat <<EOM
13299
13300 Checking to see how well your C compiler handles fd_set and friends ...
13301 EOM
13302 $cat >try.c <<EOCP
13303 #$i_stdlib I_STDLIB
13304 #ifdef I_STDLIB
13305 #include <stdlib.h>
13306 #endif
13307 #$i_systime I_SYS_TIME
13308 #$i_sysselct I_SYS_SELECT
13309 #$d_socket HAS_SOCKET
13310 #include <sys/types.h>
13311 #ifdef HAS_SOCKET
13312 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13313 #endif
13314 #ifdef I_SYS_TIME
13315 #include <sys/time.h>
13316 #endif
13317 #ifdef I_SYS_SELECT
13318 #include <sys/select.h>
13319 #endif
13320 int main() {
13321         fd_set fds;
13322
13323 #ifdef TRYBITS
13324         if(fds.fds_bits);
13325 #endif
13326
13327 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13328         exit(0);
13329 #else
13330         exit(1);
13331 #endif
13332 }
13333 EOCP
13334 set try -DTRYBITS
13335 if eval $compile; then
13336         d_fds_bits="$define"
13337         d_fd_set="$define"
13338         echo "Well, your system knows about the normal fd_set typedef..." >&4
13339         if $run ./try; then
13340                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13341                 d_fd_macros="$define"
13342         else
13343                 $cat >&4 <<'EOM'
13344 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13345 EOM
13346                 d_fd_macros="$undef"
13347         fi
13348 else
13349         $cat <<'EOM'
13350 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13351 EOM
13352         set try
13353         if eval $compile; then
13354                 d_fds_bits="$undef"
13355                 d_fd_set="$define"
13356                 echo "Well, your system has some sort of fd_set available..." >&4
13357                 if $run ./try; then
13358                         echo "and you have the normal fd_set macros." >&4
13359                         d_fd_macros="$define"
13360                 else
13361                         $cat <<'EOM'
13362 but not the normal fd_set macros!  Gross!  More work for me...
13363 EOM
13364                         d_fd_macros="$undef"
13365                 fi
13366         else
13367         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13368                 d_fd_set="$undef"
13369                 d_fds_bits="$undef"
13370                 d_fd_macros="$undef"
13371         fi
13372 fi
13373 $rm_try
13374
13375 : see if fgetpos exists
13376 set fgetpos d_fgetpos
13377 eval $inlibc
13378
13379 : see if finite exists
13380 set finite d_finite
13381 eval $inlibc
13382
13383 : see if finitel exists
13384 set finitel d_finitel
13385 eval $inlibc
13386
13387 : see if flock exists
13388 set flock d_flock
13389 eval $inlibc
13390
13391 : see if prototype for flock is available
13392 echo " "
13393 set d_flockproto flock $i_sysfile sys/file.h
13394 eval $hasproto
13395
13396 : see if fp_class exists
13397 set fp_class d_fp_class
13398 eval $inlibc
13399
13400 : see if pathconf exists
13401 set pathconf d_pathconf
13402 eval $inlibc
13403
13404 : see if fpathconf exists
13405 set fpathconf d_fpathconf
13406 eval $inlibc
13407
13408 : see if fpclass exists
13409 set fpclass d_fpclass
13410 eval $inlibc
13411
13412 : see if fpclassify exists
13413 set fpclassify d_fpclassify
13414 eval $inlibc
13415
13416 : see if fpclassl exists
13417 set fpclassl d_fpclassl
13418 eval $inlibc
13419
13420 : check for fpos64_t
13421 echo " "
13422 echo "Checking to see if you have fpos64_t..." >&4
13423 $cat >try.c <<EOCP
13424 #include <stdio.h>
13425 int main() { fpos64_t x = 7; }
13426 EOCP
13427 set try
13428 if eval $compile; then
13429         val="$define"
13430         echo "You have fpos64_t."
13431 else
13432         val="$undef"
13433         echo "You do not have fpos64_t."
13434         case "$fpossize" in
13435         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13436         esac
13437 fi
13438 $rm_try
13439 set d_fpos64_t
13440 eval $setvar
13441
13442 : see if frexpl exists
13443 set frexpl d_frexpl
13444 eval $inlibc
13445
13446 : see if this is a sys/param system
13447 set sys/param.h i_sysparam
13448 eval $inhdr
13449
13450 : see if this is a sys/mount.h system
13451 set sys/mount.h i_sysmount
13452 eval $inhdr
13453
13454 : Check for fs_data_s
13455 echo " "
13456 echo "Checking to see if your system supports struct fs_data..." >&4
13457 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13458 eval $hasstruct
13459 case "$d_fs_data_s" in
13460 "$define")      echo "Yes, it does."   ;;
13461 *)              echo "No, it doesn't." ;;
13462 esac
13463
13464 : see if fseeko exists
13465 set fseeko d_fseeko
13466 eval $inlibc
13467 case "$longsize" in
13468 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13469 esac
13470
13471 : see if fsetpos exists
13472 set fsetpos d_fsetpos
13473 eval $inlibc
13474
13475 : see if fstatfs exists
13476 set fstatfs d_fstatfs
13477 eval $inlibc
13478
13479 : see if statvfs exists
13480 set statvfs d_statvfs
13481 eval $inlibc
13482
13483 : see if fstatvfs exists
13484 set fstatvfs d_fstatvfs
13485 eval $inlibc
13486
13487
13488 : see if fsync exists
13489 set fsync d_fsync
13490 eval $inlibc
13491
13492 : see if ftello exists
13493 set ftello d_ftello
13494 eval $inlibc
13495 case "$longsize" in
13496 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13497 esac
13498
13499 : check for a working futimes
13500 d_futimes="$undef"
13501 echo " "
13502 echo "Checking if you have a working futimes()" >&4
13503 $cat >try.c <<EOCP
13504 #include <stdio.h>
13505 #include <sys/time.h>
13506 #include <errno.h>
13507 #include <fcntl.h>
13508
13509 int main ()
13510 {
13511     int fd, rv;
13512     fd = open ("try.c", O_RDWR);
13513     if (-1 == fd) exit (1);
13514     rv = futimes (fd, NULL);
13515     exit (rv == -1 ? errno : 0);
13516 }
13517 EOCP
13518 set try
13519 if eval $compile; then
13520     `$run ./try`
13521     rc=$?
13522     case "$rc" in
13523         0)  echo "Yes, you have" >&4
13524             d_futimes="$define"
13525             ;;
13526         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13527             ;;
13528     esac
13529 else
13530     echo "No, it does not (probably harmless)" >&4
13531 fi
13532 $rm_try
13533
13534 : see if ndbm.h is available
13535 set ndbm.h i_ndbm
13536 eval $inhdr
13537 : Compatibility location for RedHat 7.1
13538 set gdbm/ndbm.h i_gdbmndbm
13539 eval $inhdr
13540 : Compatibility location for Debian 4.0
13541 set gdbm-ndbm.h i_gdbm_ndbm
13542 eval $inhdr
13543
13544 val="$undef"
13545 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13546         : see if dbm_open exists
13547         set dbm_open d_dbm_open
13548         eval $inlibc
13549         case "$d_dbm_open" in
13550         $undef)
13551                 i_ndbm="$undef"
13552                 i_gdbmndbm="$undef"
13553                 i_gdbm_ndbm="$undef"
13554                 echo "We won't be including <ndbm.h>"
13555                 val="$undef"
13556                 ;;
13557         *) val="$define"
13558            ;;
13559         esac
13560 fi
13561 set d_ndbm
13562 eval $setvar
13563
13564 ndbm_hdr_protochk='name=$1; hdr=$2;
13565 eval "ihdr=\$""i_$name";
13566 val="$undef";
13567 if $test "$ihdr" = "$define"; then
13568         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13569         case "$d_cplusplus" in
13570         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13571         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13572         esac;
13573         case "$val" in
13574         $define) $echo "Your <$hdr> seems to have prototypes";;
13575         *) $echo "Your <$hdr> does not seem to have prototypes";;
13576         esac;
13577 fi;
13578 set "d_${name}_h_uses_prototypes";
13579 eval $setvar'
13580
13581 set ndbm ndbm.h
13582 eval $ndbm_hdr_protochk
13583 set gdbmndbm gdbm/ndbm.h
13584 eval $ndbm_hdr_protochk
13585 set gdbm_ndbm gdbm-ndbm.h
13586 eval $ndbm_hdr_protochk
13587
13588 : see if getaddrinfo exists
13589 set getaddrinfo d_getaddrinfo
13590 eval $inlibc
13591
13592 : see if getcwd exists
13593 set getcwd d_getcwd
13594 eval $inlibc
13595
13596 : see if getespwnam exists
13597 set getespwnam d_getespwnam
13598 eval $inlibc
13599
13600 : see if getfsstat exists
13601 set getfsstat d_getfsstat
13602 eval $inlibc
13603
13604 : see if getgrent exists
13605 set getgrent d_getgrent
13606 eval $inlibc
13607
13608 : see if getgrent_r exists
13609 set getgrent_r d_getgrent_r
13610 eval $inlibc
13611 case "$d_getgrent_r" in
13612 "$define")
13613         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13614         case "$d_getgrent_r_proto:$usethreads" in
13615         ":define")      d_getgrent_r_proto=define
13616                 set d_getgrent_r_proto getgrent_r $hdrs
13617                 eval $hasproto ;;
13618         *)      ;;
13619         esac
13620         case "$d_getgrent_r_proto" in
13621         define)
13622         case "$getgrent_r_proto" in
13623         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13624         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13625         esac
13626         case "$getgrent_r_proto" in
13627         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13628         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13629         esac
13630         case "$getgrent_r_proto" in
13631         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13632         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13633         esac
13634         case "$getgrent_r_proto" in
13635         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13636         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13637         esac
13638         case "$getgrent_r_proto" in
13639         ''|0) try='int getgrent_r(struct group*, char*, int);'
13640         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13641         esac
13642         case "$getgrent_r_proto" in
13643         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13644         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13645         esac
13646         case "$getgrent_r_proto" in
13647         ''|0)   d_getgrent_r=undef
13648                 getgrent_r_proto=0
13649                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13650         * )     case "$getgrent_r_proto" in
13651                 REENTRANT_PROTO*) ;;
13652                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13653                 esac
13654                 echo "Prototype: $try" ;;
13655         esac
13656         ;;
13657         *)      case "$usethreads" in
13658                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13659                 esac
13660                 d_getgrent_r=undef
13661                 getgrent_r_proto=0
13662                 ;;
13663         esac
13664         ;;
13665 *)      getgrent_r_proto=0
13666         ;;
13667 esac
13668
13669 : see if getgrgid_r exists
13670 set getgrgid_r d_getgrgid_r
13671 eval $inlibc
13672 case "$d_getgrgid_r" in
13673 "$define")
13674         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13675         case "$d_getgrgid_r_proto:$usethreads" in
13676         ":define")      d_getgrgid_r_proto=define
13677                 set d_getgrgid_r_proto getgrgid_r $hdrs
13678                 eval $hasproto ;;
13679         *)      ;;
13680         esac
13681         case "$d_getgrgid_r_proto" in
13682         define)
13683         case "$getgrgid_r_proto" in
13684         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13685         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13686         esac
13687         case "$getgrgid_r_proto" in
13688         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13689         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13690         esac
13691         case "$getgrgid_r_proto" in
13692         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13693         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13694         esac
13695         case "$getgrgid_r_proto" in
13696         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13697         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13698         esac
13699         case "$getgrgid_r_proto" in
13700         ''|0)   d_getgrgid_r=undef
13701                 getgrgid_r_proto=0
13702                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13703         * )     case "$getgrgid_r_proto" in
13704                 REENTRANT_PROTO*) ;;
13705                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13706                 esac
13707                 echo "Prototype: $try" ;;
13708         esac
13709         ;;
13710         *)      case "$usethreads" in
13711                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13712                 esac
13713                 d_getgrgid_r=undef
13714                 getgrgid_r_proto=0
13715                 ;;
13716         esac
13717         ;;
13718 *)      getgrgid_r_proto=0
13719         ;;
13720 esac
13721
13722 : see if getgrnam_r exists
13723 set getgrnam_r d_getgrnam_r
13724 eval $inlibc
13725 case "$d_getgrnam_r" in
13726 "$define")
13727         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13728         case "$d_getgrnam_r_proto:$usethreads" in
13729         ":define")      d_getgrnam_r_proto=define
13730                 set d_getgrnam_r_proto getgrnam_r $hdrs
13731                 eval $hasproto ;;
13732         *)      ;;
13733         esac
13734         case "$d_getgrnam_r_proto" in
13735         define)
13736         case "$getgrnam_r_proto" in
13737         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13738         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13739         esac
13740         case "$getgrnam_r_proto" in
13741         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13742         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13743         esac
13744         case "$getgrnam_r_proto" in
13745         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13746         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13747         esac
13748         case "$getgrnam_r_proto" in
13749         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13750         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13751         esac
13752         case "$getgrnam_r_proto" in
13753         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13754         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13755         esac
13756         case "$getgrnam_r_proto" in
13757         ''|0)   d_getgrnam_r=undef
13758                 getgrnam_r_proto=0
13759                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13760         * )     case "$getgrnam_r_proto" in
13761                 REENTRANT_PROTO*) ;;
13762                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13763                 esac
13764                 echo "Prototype: $try" ;;
13765         esac
13766         ;;
13767         *)      case "$usethreads" in
13768                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13769                 esac
13770                 d_getgrnam_r=undef
13771                 getgrnam_r_proto=0
13772                 ;;
13773         esac
13774         ;;
13775 *)      getgrnam_r_proto=0
13776         ;;
13777 esac
13778
13779 : see if gethostbyaddr exists
13780 set gethostbyaddr d_gethbyaddr
13781 eval $inlibc
13782
13783 : see if gethostbyname exists
13784 set gethostbyname d_gethbyname
13785 eval $inlibc
13786
13787 : see if gethostent exists
13788 set gethostent d_gethent
13789 eval $inlibc
13790
13791 : see how we will look up host name
13792 echo " "
13793 call=''
13794 if set gethostname val -f d_gethname; eval $csym; $val; then
13795         echo 'gethostname() found.' >&4
13796         d_gethname="$define"
13797         call=gethostname
13798 fi
13799 if set uname val -f d_uname; eval $csym; $val; then
13800         if ./xenix; then
13801                 $cat <<'EOM'
13802 uname() was found, but you're running xenix, and older versions of xenix
13803 have a broken uname(). If you don't really know whether your xenix is old
13804 enough to have a broken system call, use the default answer.
13805
13806 EOM
13807                 dflt=y
13808                 case "$d_uname" in
13809                 "$define") dflt=n;;
13810                 esac
13811                 rp='Is your uname() broken?'
13812                 . ./myread
13813                 case "$ans" in
13814                 n*) d_uname="$define"; call=uname;;
13815                 esac
13816         else
13817                 echo 'uname() found.' >&4
13818                 d_uname="$define"
13819                 case "$call" in
13820                 '') call=uname ;;
13821                 esac
13822         fi
13823 fi
13824 case "$d_gethname" in
13825 '') d_gethname="$undef";;
13826 esac
13827 case "$d_uname" in
13828 '') d_uname="$undef";;
13829 esac
13830 case "$d_uname$d_gethname" in
13831 *define*)
13832         dflt=n
13833         cat <<EOM
13834
13835 Every now and then someone has a $call() that lies about the hostname
13836 but can't be fixed for political or economic reasons.  If you wish, I can
13837 pretend $call() isn't there and maybe compute hostname at run-time
13838 thanks to the '$phostname' command.
13839
13840 EOM
13841         rp="Shall I ignore $call() from now on?"
13842         . ./myread
13843         case "$ans" in
13844         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13845         esac;;
13846 esac
13847 case "$phostname" in
13848 '') aphostname='';;
13849 *) case "$aphostname" in
13850         /*) ;;
13851         *) set X $phostname
13852                 shift
13853                 file=$1
13854                 shift
13855                 file=`./loc $file $file $pth`
13856                 aphostname=`echo $file $*`
13857                 ;;
13858         esac
13859         ;;
13860 esac
13861 case "$d_uname$d_gethname" in
13862 *define*) ;;
13863 *)
13864         case "$phostname" in
13865         '')
13866                 echo "There will be no way for $package to get your hostname." >&4;;
13867         *)
13868         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13869                 ;;
13870         esac;;
13871 esac
13872 case "$d_phostname" in
13873 '') d_phostname="$undef";;
13874 esac
13875
13876 : see if gethostbyaddr_r exists
13877 set gethostbyaddr_r d_gethostbyaddr_r
13878 eval $inlibc
13879 case "$d_gethostbyaddr_r" in
13880 "$define")
13881         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13882         case "$d_gethostbyaddr_r_proto:$usethreads" in
13883         ":define")      d_gethostbyaddr_r_proto=define
13884                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13885                 eval $hasproto ;;
13886         *)      ;;
13887         esac
13888         case "$d_gethostbyaddr_r_proto" in
13889         define)
13890         case "$gethostbyaddr_r_proto" in
13891         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13892         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13893         esac
13894         case "$gethostbyaddr_r_proto" in
13895         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13896         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13897         esac
13898         case "$gethostbyaddr_r_proto" in
13899         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13900         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13901         esac
13902         case "$gethostbyaddr_r_proto" in
13903         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13904         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13905         esac
13906         case "$gethostbyaddr_r_proto" in
13907         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13908         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13909         esac
13910         case "$gethostbyaddr_r_proto" in
13911         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13912         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13913         esac
13914         case "$gethostbyaddr_r_proto" in
13915         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13916         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13917         esac
13918         case "$gethostbyaddr_r_proto" in
13919         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13920         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13921         esac
13922         case "$gethostbyaddr_r_proto" in
13923         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13924         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13925         esac
13926         case "$gethostbyaddr_r_proto" in
13927         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13928         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13929         esac
13930         case "$gethostbyaddr_r_proto" in
13931         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13932         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13933         esac
13934         case "$gethostbyaddr_r_proto" in
13935         ''|0)   d_gethostbyaddr_r=undef
13936                 gethostbyaddr_r_proto=0
13937                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13938         * )     case "$gethostbyaddr_r_proto" in
13939                 REENTRANT_PROTO*) ;;
13940                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13941                 esac
13942                 echo "Prototype: $try" ;;
13943         esac
13944         ;;
13945         *)      case "$usethreads" in
13946                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13947                 esac
13948                 d_gethostbyaddr_r=undef
13949                 gethostbyaddr_r_proto=0
13950                 ;;
13951         esac
13952         ;;
13953 *)      gethostbyaddr_r_proto=0
13954         ;;
13955 esac
13956
13957 : see if gethostbyname_r exists
13958 set gethostbyname_r d_gethostbyname_r
13959 eval $inlibc
13960 case "$d_gethostbyname_r" in
13961 "$define")
13962         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13963         case "$d_gethostbyname_r_proto:$usethreads" in
13964         ":define")      d_gethostbyname_r_proto=define
13965                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13966                 eval $hasproto ;;
13967         *)      ;;
13968         esac
13969         case "$d_gethostbyname_r_proto" in
13970         define)
13971         case "$gethostbyname_r_proto" in
13972         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13973         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13974         esac
13975         case "$gethostbyname_r_proto" in
13976         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13977         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13978         esac
13979         case "$gethostbyname_r_proto" in
13980         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13981         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13982         esac
13983         case "$gethostbyname_r_proto" in
13984         ''|0)   d_gethostbyname_r=undef
13985                 gethostbyname_r_proto=0
13986                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13987         * )     case "$gethostbyname_r_proto" in
13988                 REENTRANT_PROTO*) ;;
13989                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13990                 esac
13991                 echo "Prototype: $try" ;;
13992         esac
13993         ;;
13994         *)      case "$usethreads" in
13995                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13996                 esac
13997                 d_gethostbyname_r=undef
13998                 gethostbyname_r_proto=0
13999                 ;;
14000         esac
14001         ;;
14002 *)      gethostbyname_r_proto=0
14003         ;;
14004 esac
14005
14006 : see if gethostent_r exists
14007 set gethostent_r d_gethostent_r
14008 eval $inlibc
14009 case "$d_gethostent_r" in
14010 "$define")
14011         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14012         case "$d_gethostent_r_proto:$usethreads" in
14013         ":define")      d_gethostent_r_proto=define
14014                 set d_gethostent_r_proto gethostent_r $hdrs
14015                 eval $hasproto ;;
14016         *)      ;;
14017         esac
14018         case "$d_gethostent_r_proto" in
14019         define)
14020         case "$gethostent_r_proto" in
14021         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14022         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14023         esac
14024         case "$gethostent_r_proto" in
14025         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14026         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14027         esac
14028         case "$gethostent_r_proto" in
14029         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14030         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14031         esac
14032         case "$gethostent_r_proto" in
14033         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14034         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14035         esac
14036         case "$gethostent_r_proto" in
14037         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14038         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14039         esac
14040         case "$gethostent_r_proto" in
14041         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14042         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14043         esac
14044         case "$gethostent_r_proto" in
14045         ''|0)   d_gethostent_r=undef
14046                 gethostent_r_proto=0
14047                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14048         * )     case "$gethostent_r_proto" in
14049                 REENTRANT_PROTO*) ;;
14050                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14051                 esac
14052                 echo "Prototype: $try" ;;
14053         esac
14054         ;;
14055         *)      case "$usethreads" in
14056                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14057                 esac
14058                 d_gethostent_r=undef
14059                 gethostent_r_proto=0
14060                 ;;
14061         esac
14062         ;;
14063 *)      gethostent_r_proto=0
14064         ;;
14065 esac
14066
14067 : see if prototypes for various gethostxxx netdb.h functions are available
14068 echo " "
14069 set d_gethostprotos gethostent $i_netdb netdb.h
14070 eval $hasproto
14071
14072 : see if getitimer exists
14073 set getitimer d_getitimer
14074 eval $inlibc
14075
14076 : see if getlogin exists
14077 set getlogin d_getlogin
14078 eval $inlibc
14079
14080 : see if getlogin_r exists
14081 set getlogin_r d_getlogin_r
14082 eval $inlibc
14083 case "$d_getlogin_r" in
14084 "$define")
14085         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14086         case "$d_getlogin_r_proto:$usethreads" in
14087         ":define")      d_getlogin_r_proto=define
14088                 set d_getlogin_r_proto getlogin_r $hdrs
14089                 eval $hasproto ;;
14090         *)      ;;
14091         esac
14092         case "$d_getlogin_r_proto" in
14093         define)
14094         case "$getlogin_r_proto" in
14095         ''|0) try='int getlogin_r(char*, size_t);'
14096         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14097         esac
14098         case "$getlogin_r_proto" in
14099         ''|0) try='int getlogin_r(char*, int);'
14100         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14101         esac
14102         case "$getlogin_r_proto" in
14103         ''|0) try='char* getlogin_r(char*, size_t);'
14104         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14105         esac
14106         case "$getlogin_r_proto" in
14107         ''|0) try='char* getlogin_r(char*, int);'
14108         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14109         esac
14110         case "$getlogin_r_proto" in
14111         ''|0)   d_getlogin_r=undef
14112                 getlogin_r_proto=0
14113                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14114         * )     case "$getlogin_r_proto" in
14115                 REENTRANT_PROTO*) ;;
14116                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14117                 esac
14118                 echo "Prototype: $try" ;;
14119         esac
14120         ;;
14121         *)      case "$usethreads" in
14122                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14123                 esac
14124                 d_getlogin_r=undef
14125                 getlogin_r_proto=0
14126                 ;;
14127         esac
14128         ;;
14129 *)      getlogin_r_proto=0
14130         ;;
14131 esac
14132
14133 : see if getmnt exists
14134 set getmnt d_getmnt
14135 eval $inlibc
14136
14137 : see if getmntent exists
14138 set getmntent d_getmntent
14139 eval $inlibc
14140
14141 : see if getnameinfo exists
14142 set getnameinfo d_getnameinfo
14143 eval $inlibc
14144
14145 : see if getnetbyaddr exists
14146 set getnetbyaddr d_getnbyaddr
14147 eval $inlibc
14148
14149 : see if getnetbyname exists
14150 set getnetbyname d_getnbyname
14151 eval $inlibc
14152
14153 : see if getnetent exists
14154 set getnetent d_getnent
14155 eval $inlibc
14156
14157 : see if getnetbyaddr_r exists
14158 set getnetbyaddr_r d_getnetbyaddr_r
14159 eval $inlibc
14160 case "$d_getnetbyaddr_r" in
14161 "$define")
14162         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14163         case "$d_getnetbyaddr_r_proto:$usethreads" in
14164         ":define")      d_getnetbyaddr_r_proto=define
14165                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14166                 eval $hasproto ;;
14167         *)      ;;
14168         esac
14169         case "$d_getnetbyaddr_r_proto" in
14170         define)
14171         case "$getnetbyaddr_r_proto" in
14172         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14173         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14174         esac
14175         case "$getnetbyaddr_r_proto" in
14176         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14177         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14178         esac
14179         case "$getnetbyaddr_r_proto" in
14180         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14181         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14182         esac
14183         case "$getnetbyaddr_r_proto" in
14184         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14185         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14186         esac
14187         case "$getnetbyaddr_r_proto" in
14188         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14189         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14190         esac
14191         case "$getnetbyaddr_r_proto" in
14192         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14193         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14194         esac
14195         case "$getnetbyaddr_r_proto" in
14196         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14197         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14198         esac
14199         case "$getnetbyaddr_r_proto" in
14200         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14201         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14202         esac
14203         case "$getnetbyaddr_r_proto" in
14204         ''|0)   d_getnetbyaddr_r=undef
14205                 getnetbyaddr_r_proto=0
14206                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14207         * )     case "$getnetbyaddr_r_proto" in
14208                 REENTRANT_PROTO*) ;;
14209                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14210                 esac
14211                 echo "Prototype: $try" ;;
14212         esac
14213         ;;
14214         *)      case "$usethreads" in
14215                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14216                 esac
14217                 d_getnetbyaddr_r=undef
14218                 getnetbyaddr_r_proto=0
14219                 ;;
14220         esac
14221         ;;
14222 *)      getnetbyaddr_r_proto=0
14223         ;;
14224 esac
14225
14226 : see if getnetbyname_r exists
14227 set getnetbyname_r d_getnetbyname_r
14228 eval $inlibc
14229 case "$d_getnetbyname_r" in
14230 "$define")
14231         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14232         case "$d_getnetbyname_r_proto:$usethreads" in
14233         ":define")      d_getnetbyname_r_proto=define
14234                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14235                 eval $hasproto ;;
14236         *)      ;;
14237         esac
14238         case "$d_getnetbyname_r_proto" in
14239         define)
14240         case "$getnetbyname_r_proto" in
14241         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14242         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14243         esac
14244         case "$getnetbyname_r_proto" in
14245         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14246         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14247         esac
14248         case "$getnetbyname_r_proto" in
14249         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14250         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14251         esac
14252         case "$getnetbyname_r_proto" in
14253         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14254         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14255         esac
14256         case "$getnetbyname_r_proto" in
14257         ''|0)   d_getnetbyname_r=undef
14258                 getnetbyname_r_proto=0
14259                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14260         * )     case "$getnetbyname_r_proto" in
14261                 REENTRANT_PROTO*) ;;
14262                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14263                 esac
14264                 echo "Prototype: $try" ;;
14265         esac
14266         ;;
14267         *)      case "$usethreads" in
14268                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14269                 esac
14270                 d_getnetbyname_r=undef
14271                 getnetbyname_r_proto=0
14272                 ;;
14273         esac
14274         ;;
14275 *)      getnetbyname_r_proto=0
14276         ;;
14277 esac
14278
14279 : see if getnetent_r exists
14280 set getnetent_r d_getnetent_r
14281 eval $inlibc
14282 case "$d_getnetent_r" in
14283 "$define")
14284         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14285         case "$d_getnetent_r_proto:$usethreads" in
14286         ":define")      d_getnetent_r_proto=define
14287                 set d_getnetent_r_proto getnetent_r $hdrs
14288                 eval $hasproto ;;
14289         *)      ;;
14290         esac
14291         case "$d_getnetent_r_proto" in
14292         define)
14293         case "$getnetent_r_proto" in
14294         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14295         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14296         esac
14297         case "$getnetent_r_proto" in
14298         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14299         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14300         esac
14301         case "$getnetent_r_proto" in
14302         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14303         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14304         esac
14305         case "$getnetent_r_proto" in
14306         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14307         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14308         esac
14309         case "$getnetent_r_proto" in
14310         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14311         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14312         esac
14313         case "$getnetent_r_proto" in
14314         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14315         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14316         esac
14317         case "$getnetent_r_proto" in
14318         ''|0)   d_getnetent_r=undef
14319                 getnetent_r_proto=0
14320                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14321         * )     case "$getnetent_r_proto" in
14322                 REENTRANT_PROTO*) ;;
14323                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14324                 esac
14325                 echo "Prototype: $try" ;;
14326         esac
14327         ;;
14328         *)      case "$usethreads" in
14329                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14330                 esac
14331                 d_getnetent_r=undef
14332                 getnetent_r_proto=0
14333                 ;;
14334         esac
14335         ;;
14336 *)      getnetent_r_proto=0
14337         ;;
14338 esac
14339
14340 : see if prototypes for various getnetxxx netdb.h functions are available
14341 echo " "
14342 set d_getnetprotos getnetent $i_netdb netdb.h
14343 eval $hasproto
14344
14345 : see if getpagesize exists
14346 set getpagesize d_getpagsz
14347 eval $inlibc
14348
14349 : Optional checks for getprotobyname and getprotobynumber
14350
14351 : see if getprotobyname exists
14352 set getprotobyname d_getpbyname
14353 eval $inlibc
14354
14355 : see if getprotobynumber exists
14356 set getprotobynumber d_getpbynumber
14357 eval $inlibc
14358
14359 : see if getprotoent exists
14360 set getprotoent d_getpent
14361 eval $inlibc
14362
14363 : see if getpgid exists
14364 set getpgid d_getpgid
14365 eval $inlibc
14366
14367 : see if getpgrp2 exists
14368 set getpgrp2 d_getpgrp2
14369 eval $inlibc
14370
14371 : see if getppid exists
14372 set getppid d_getppid
14373 eval $inlibc
14374
14375 : see if getpriority exists
14376 set getpriority d_getprior
14377 eval $inlibc
14378
14379 : see if getprotobyname_r exists
14380 set getprotobyname_r d_getprotobyname_r
14381 eval $inlibc
14382 case "$d_getprotobyname_r" in
14383 "$define")
14384         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14385         case "$d_getprotobyname_r_proto:$usethreads" in
14386         ":define")      d_getprotobyname_r_proto=define
14387                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14388                 eval $hasproto ;;
14389         *)      ;;
14390         esac
14391         case "$d_getprotobyname_r_proto" in
14392         define)
14393         case "$getprotobyname_r_proto" in
14394         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14395         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14396         esac
14397         case "$getprotobyname_r_proto" in
14398         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14399         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14400         esac
14401         case "$getprotobyname_r_proto" in
14402         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14403         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14404         esac
14405         case "$getprotobyname_r_proto" in
14406         ''|0)   d_getprotobyname_r=undef
14407                 getprotobyname_r_proto=0
14408                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14409         * )     case "$getprotobyname_r_proto" in
14410                 REENTRANT_PROTO*) ;;
14411                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14412                 esac
14413                 echo "Prototype: $try" ;;
14414         esac
14415         ;;
14416         *)      case "$usethreads" in
14417                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14418                 esac
14419                 d_getprotobyname_r=undef
14420                 getprotobyname_r_proto=0
14421                 ;;
14422         esac
14423         ;;
14424 *)      getprotobyname_r_proto=0
14425         ;;
14426 esac
14427
14428 : see if getprotobynumber_r exists
14429 set getprotobynumber_r d_getprotobynumber_r
14430 eval $inlibc
14431 case "$d_getprotobynumber_r" in
14432 "$define")
14433         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14434         case "$d_getprotobynumber_r_proto:$usethreads" in
14435         ":define")      d_getprotobynumber_r_proto=define
14436                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14437                 eval $hasproto ;;
14438         *)      ;;
14439         esac
14440         case "$d_getprotobynumber_r_proto" in
14441         define)
14442         case "$getprotobynumber_r_proto" in
14443         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14444         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14445         esac
14446         case "$getprotobynumber_r_proto" in
14447         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14448         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14449         esac
14450         case "$getprotobynumber_r_proto" in
14451         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14452         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14453         esac
14454         case "$getprotobynumber_r_proto" in
14455         ''|0)   d_getprotobynumber_r=undef
14456                 getprotobynumber_r_proto=0
14457                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14458         * )     case "$getprotobynumber_r_proto" in
14459                 REENTRANT_PROTO*) ;;
14460                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14461                 esac
14462                 echo "Prototype: $try" ;;
14463         esac
14464         ;;
14465         *)      case "$usethreads" in
14466                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14467                 esac
14468                 d_getprotobynumber_r=undef
14469                 getprotobynumber_r_proto=0
14470                 ;;
14471         esac
14472         ;;
14473 *)      getprotobynumber_r_proto=0
14474         ;;
14475 esac
14476
14477 : see if getprotoent_r exists
14478 set getprotoent_r d_getprotoent_r
14479 eval $inlibc
14480 case "$d_getprotoent_r" in
14481 "$define")
14482         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14483         case "$d_getprotoent_r_proto:$usethreads" in
14484         ":define")      d_getprotoent_r_proto=define
14485                 set d_getprotoent_r_proto getprotoent_r $hdrs
14486                 eval $hasproto ;;
14487         *)      ;;
14488         esac
14489         case "$d_getprotoent_r_proto" in
14490         define)
14491         case "$getprotoent_r_proto" in
14492         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14493         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14494         esac
14495         case "$getprotoent_r_proto" in
14496         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14497         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14498         esac
14499         case "$getprotoent_r_proto" in
14500         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14501         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14502         esac
14503         case "$getprotoent_r_proto" in
14504         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14505         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14506         esac
14507         case "$getprotoent_r_proto" in
14508         ''|0)   d_getprotoent_r=undef
14509                 getprotoent_r_proto=0
14510                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14511         * )     case "$getprotoent_r_proto" in
14512                 REENTRANT_PROTO*) ;;
14513                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14514                 esac
14515                 echo "Prototype: $try" ;;
14516         esac
14517         ;;
14518         *)      case "$usethreads" in
14519                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14520                 esac
14521                 d_getprotoent_r=undef
14522                 getprotoent_r_proto=0
14523                 ;;
14524         esac
14525         ;;
14526 *)      getprotoent_r_proto=0
14527         ;;
14528 esac
14529
14530 : see if prototypes for various getprotoxxx netdb.h functions are available
14531 echo " "
14532 set d_getprotoprotos getprotoent $i_netdb netdb.h
14533 eval $hasproto
14534
14535 : see if getprpwnam exists
14536 set getprpwnam d_getprpwnam
14537 eval $inlibc
14538
14539 : see if getpwent exists
14540 set getpwent d_getpwent
14541 eval $inlibc
14542
14543 : see if getpwent_r exists
14544 set getpwent_r d_getpwent_r
14545 eval $inlibc
14546 case "$d_getpwent_r" in
14547 "$define")
14548         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14549         case "$d_getpwent_r_proto:$usethreads" in
14550         ":define")      d_getpwent_r_proto=define
14551                 set d_getpwent_r_proto getpwent_r $hdrs
14552                 eval $hasproto ;;
14553         *)      ;;
14554         esac
14555         case "$d_getpwent_r_proto" in
14556         define)
14557         case "$getpwent_r_proto" in
14558         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14559         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14560         esac
14561         case "$getpwent_r_proto" in
14562         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14563         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14564         esac
14565         case "$getpwent_r_proto" in
14566         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14567         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14568         esac
14569         case "$getpwent_r_proto" in
14570         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14571         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14572         esac
14573         case "$getpwent_r_proto" in
14574         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14575         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14576         esac
14577         case "$getpwent_r_proto" in
14578         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14579         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14580         esac
14581         case "$getpwent_r_proto" in
14582         ''|0)   d_getpwent_r=undef
14583                 getpwent_r_proto=0
14584                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14585         * )     case "$getpwent_r_proto" in
14586                 REENTRANT_PROTO*) ;;
14587                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14588                 esac
14589                 echo "Prototype: $try" ;;
14590         esac
14591         ;;
14592         *)      case "$usethreads" in
14593                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14594                 esac
14595                 d_getpwent_r=undef
14596                 getpwent_r_proto=0
14597                 ;;
14598         esac
14599         ;;
14600 *)      getpwent_r_proto=0
14601         ;;
14602 esac
14603
14604 : see if getpwnam_r exists
14605 set getpwnam_r d_getpwnam_r
14606 eval $inlibc
14607 case "$d_getpwnam_r" in
14608 "$define")
14609         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14610         case "$d_getpwnam_r_proto:$usethreads" in
14611         ":define")      d_getpwnam_r_proto=define
14612                 set d_getpwnam_r_proto getpwnam_r $hdrs
14613                 eval $hasproto ;;
14614         *)      ;;
14615         esac
14616         case "$d_getpwnam_r_proto" in
14617         define)
14618         case "$getpwnam_r_proto" in
14619         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14620         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14621         esac
14622         case "$getpwnam_r_proto" in
14623         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14624         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14625         esac
14626         case "$getpwnam_r_proto" in
14627         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14628         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14629         esac
14630         case "$getpwnam_r_proto" in
14631         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14632         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14633         esac
14634         case "$getpwnam_r_proto" in
14635         ''|0)   d_getpwnam_r=undef
14636                 getpwnam_r_proto=0
14637                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14638         * )     case "$getpwnam_r_proto" in
14639                 REENTRANT_PROTO*) ;;
14640                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14641                 esac
14642                 echo "Prototype: $try" ;;
14643         esac
14644         ;;
14645         *)      case "$usethreads" in
14646                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14647                 esac
14648                 d_getpwnam_r=undef
14649                 getpwnam_r_proto=0
14650                 ;;
14651         esac
14652         ;;
14653 *)      getpwnam_r_proto=0
14654         ;;
14655 esac
14656
14657 : see if getpwuid_r exists
14658 set getpwuid_r d_getpwuid_r
14659 eval $inlibc
14660 case "$d_getpwuid_r" in
14661 "$define")
14662         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14663         case "$d_getpwuid_r_proto:$usethreads" in
14664         ":define")      d_getpwuid_r_proto=define
14665                 set d_getpwuid_r_proto getpwuid_r $hdrs
14666                 eval $hasproto ;;
14667         *)      ;;
14668         esac
14669         case "$d_getpwuid_r_proto" in
14670         define)
14671         case "$getpwuid_r_proto" in
14672         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14673         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14674         esac
14675         case "$getpwuid_r_proto" in
14676         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14677         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14678         esac
14679         case "$getpwuid_r_proto" in
14680         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14681         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14682         esac
14683         case "$getpwuid_r_proto" in
14684         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14685         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14686         esac
14687         case "$getpwuid_r_proto" in
14688         ''|0)   d_getpwuid_r=undef
14689                 getpwuid_r_proto=0
14690                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14691         * )     case "$getpwuid_r_proto" in
14692                 REENTRANT_PROTO*) ;;
14693                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14694                 esac
14695                 echo "Prototype: $try" ;;
14696         esac
14697         ;;
14698         *)      case "$usethreads" in
14699                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14700                 esac
14701                 d_getpwuid_r=undef
14702                 getpwuid_r_proto=0
14703                 ;;
14704         esac
14705         ;;
14706 *)      getpwuid_r_proto=0
14707         ;;
14708 esac
14709
14710 : Optional checks for getsbyname and getsbyport
14711
14712 : see if getservbyname exists
14713 set getservbyname d_getsbyname
14714 eval $inlibc
14715
14716 : see if getservbyport exists
14717 set getservbyport d_getsbyport
14718 eval $inlibc
14719
14720 : see if getservent exists
14721 set getservent d_getsent
14722 eval $inlibc
14723
14724 : see if getservbyname_r exists
14725 set getservbyname_r d_getservbyname_r
14726 eval $inlibc
14727 case "$d_getservbyname_r" in
14728 "$define")
14729         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14730         case "$d_getservbyname_r_proto:$usethreads" in
14731         ":define")      d_getservbyname_r_proto=define
14732                 set d_getservbyname_r_proto getservbyname_r $hdrs
14733                 eval $hasproto ;;
14734         *)      ;;
14735         esac
14736         case "$d_getservbyname_r_proto" in
14737         define)
14738         case "$getservbyname_r_proto" in
14739         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14740         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14741         esac
14742         case "$getservbyname_r_proto" in
14743         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14744         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14745         esac
14746         case "$getservbyname_r_proto" in
14747         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14748         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14749         esac
14750         case "$getservbyname_r_proto" in
14751         ''|0)   d_getservbyname_r=undef
14752                 getservbyname_r_proto=0
14753                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14754         * )     case "$getservbyname_r_proto" in
14755                 REENTRANT_PROTO*) ;;
14756                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14757                 esac
14758                 echo "Prototype: $try" ;;
14759         esac
14760         ;;
14761         *)      case "$usethreads" in
14762                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14763                 esac
14764                 d_getservbyname_r=undef
14765                 getservbyname_r_proto=0
14766                 ;;
14767         esac
14768         ;;
14769 *)      getservbyname_r_proto=0
14770         ;;
14771 esac
14772
14773 : see if getservbyport_r exists
14774 set getservbyport_r d_getservbyport_r
14775 eval $inlibc
14776 case "$d_getservbyport_r" in
14777 "$define")
14778         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14779         case "$d_getservbyport_r_proto:$usethreads" in
14780         ":define")      d_getservbyport_r_proto=define
14781                 set d_getservbyport_r_proto getservbyport_r $hdrs
14782                 eval $hasproto ;;
14783         *)      ;;
14784         esac
14785         case "$d_getservbyport_r_proto" in
14786         define)
14787         case "$getservbyport_r_proto" in
14788         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14789         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14790         esac
14791         case "$getservbyport_r_proto" in
14792         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14793         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14794         esac
14795         case "$getservbyport_r_proto" in
14796         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14797         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14798         esac
14799         case "$getservbyport_r_proto" in
14800         ''|0)   d_getservbyport_r=undef
14801                 getservbyport_r_proto=0
14802                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14803         * )     case "$getservbyport_r_proto" in
14804                 REENTRANT_PROTO*) ;;
14805                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14806                 esac
14807                 echo "Prototype: $try" ;;
14808         esac
14809         ;;
14810         *)      case "$usethreads" in
14811                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14812                 esac
14813                 d_getservbyport_r=undef
14814                 getservbyport_r_proto=0
14815                 ;;
14816         esac
14817         ;;
14818 *)      getservbyport_r_proto=0
14819         ;;
14820 esac
14821
14822 : see if getservent_r exists
14823 set getservent_r d_getservent_r
14824 eval $inlibc
14825 case "$d_getservent_r" in
14826 "$define")
14827         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14828         case "$d_getservent_r_proto:$usethreads" in
14829         ":define")      d_getservent_r_proto=define
14830                 set d_getservent_r_proto getservent_r $hdrs
14831                 eval $hasproto ;;
14832         *)      ;;
14833         esac
14834         case "$d_getservent_r_proto" in
14835         define)
14836         case "$getservent_r_proto" in
14837         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14838         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14839         esac
14840         case "$getservent_r_proto" in
14841         ''|0) try='int getservent_r(struct servent*, char*, int);'
14842         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14843         esac
14844         case "$getservent_r_proto" in
14845         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14846         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14847         esac
14848         case "$getservent_r_proto" in
14849         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14850         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14851         esac
14852         case "$getservent_r_proto" in
14853         ''|0)   d_getservent_r=undef
14854                 getservent_r_proto=0
14855                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14856         * )     case "$getservent_r_proto" in
14857                 REENTRANT_PROTO*) ;;
14858                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14859                 esac
14860                 echo "Prototype: $try" ;;
14861         esac
14862         ;;
14863         *)      case "$usethreads" in
14864                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14865                 esac
14866                 d_getservent_r=undef
14867                 getservent_r_proto=0
14868                 ;;
14869         esac
14870         ;;
14871 *)      getservent_r_proto=0
14872         ;;
14873 esac
14874
14875 : see if prototypes for various getservxxx netdb.h functions are available
14876 echo " "
14877 set d_getservprotos getservent $i_netdb netdb.h
14878 eval $hasproto
14879
14880 : see if getspnam exists
14881 set getspnam d_getspnam
14882 eval $inlibc
14883
14884 : see if this is a shadow.h system
14885 set shadow.h i_shadow
14886 eval $inhdr
14887
14888 : see if getspnam_r exists
14889 set getspnam_r d_getspnam_r
14890 eval $inlibc
14891 case "$d_getspnam_r" in
14892 "$define")
14893         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14894         case "$d_getspnam_r_proto:$usethreads" in
14895         ":define")      d_getspnam_r_proto=define
14896                 set d_getspnam_r_proto getspnam_r $hdrs
14897                 eval $hasproto ;;
14898         *)      ;;
14899         esac
14900         case "$d_getspnam_r_proto" in
14901         define)
14902         case "$getspnam_r_proto" in
14903         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14904         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14905         esac
14906         case "$getspnam_r_proto" in
14907         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14908         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14909         esac
14910         case "$getspnam_r_proto" in
14911         ''|0)   d_getspnam_r=undef
14912                 getspnam_r_proto=0
14913                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14914         * )     case "$getspnam_r_proto" in
14915                 REENTRANT_PROTO*) ;;
14916                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14917                 esac
14918                 echo "Prototype: $try" ;;
14919         esac
14920         ;;
14921         *)      case "$usethreads" in
14922                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14923                 esac
14924                 d_getspnam_r=undef
14925                 getspnam_r_proto=0
14926                 ;;
14927         esac
14928         ;;
14929 *)      getspnam_r_proto=0
14930         ;;
14931 esac
14932
14933 : see if gettimeofday or ftime exists
14934 set gettimeofday d_gettimeod
14935 eval $inlibc
14936 case "$d_gettimeod" in
14937 "$undef")
14938         set ftime d_ftime 
14939         eval $inlibc
14940         ;;
14941 *)
14942         val="$undef"; set d_ftime; eval $setvar
14943         ;;
14944 esac
14945 case "$d_gettimeod$d_ftime" in
14946 "$undef$undef")
14947         echo " "
14948         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14949         ;;
14950 esac
14951
14952 : see if gmtime_r exists
14953 set gmtime_r d_gmtime_r
14954 eval $inlibc
14955 case "$d_gmtime_r" in
14956 "$define")
14957         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14958         case "$d_gmtime_r_proto:$usethreads" in
14959         ":define")      d_gmtime_r_proto=define
14960                 set d_gmtime_r_proto gmtime_r $hdrs
14961                 eval $hasproto ;;
14962         *)      ;;
14963         esac
14964         case "$d_gmtime_r_proto" in
14965         define)
14966         case "$gmtime_r_proto" in
14967         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14968         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14969         esac
14970         case "$gmtime_r_proto" in
14971         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14972         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14973         esac
14974         case "$gmtime_r_proto" in
14975         ''|0)   d_gmtime_r=undef
14976                 gmtime_r_proto=0
14977                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14978         * )     case "$gmtime_r_proto" in
14979                 REENTRANT_PROTO*) ;;
14980                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14981                 esac
14982                 echo "Prototype: $try" ;;
14983         esac
14984         ;;
14985         *)      case "$usethreads" in
14986                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14987                 esac
14988                 d_gmtime_r=undef
14989                 gmtime_r_proto=0
14990                 ;;
14991         esac
14992         ;;
14993 *)      gmtime_r_proto=0
14994         ;;
14995 esac
14996
14997 : see if hasmntopt exists
14998 set hasmntopt d_hasmntopt
14999 eval $inlibc
15000
15001 : see if this is a netinet/in.h or sys/in.h system
15002 set netinet/in.h i_niin sys/in.h i_sysin
15003 eval $inhdr
15004
15005 : see if arpa/inet.h has to be included
15006 set arpa/inet.h i_arpainet
15007 eval $inhdr
15008
15009 : see if htonl --and friends-- exists
15010 val=''
15011 set htonl val
15012 eval $inlibc
15013
15014 : Maybe they are macros.
15015 case "$val" in
15016 $undef)
15017         $cat >htonl.c <<EOM
15018 #include <stdio.h>
15019 #include <sys/types.h>
15020 #$i_niin I_NETINET_IN
15021 #$i_sysin I_SYS_IN
15022 #$i_arpainet I_ARPA_INET
15023 #ifdef I_NETINET_IN
15024 #include <netinet/in.h>
15025 #endif
15026 #ifdef I_SYS_IN
15027 #include <sys/in.h>
15028 #endif
15029 #ifdef I_ARPA_INET
15030 #include <arpa/inet.h>
15031 #endif
15032 #ifdef htonl
15033 printf("Defined as a macro.");
15034 #endif
15035 EOM
15036         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15037         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15038                 val="$define"
15039                 echo "But it seems to be defined as a macro." >&4
15040         fi
15041         $rm -f htonl.?
15042         ;;
15043 esac
15044 set d_htonl
15045 eval $setvar
15046
15047 : see if ilogbl exists
15048 set ilogbl d_ilogbl
15049 eval $inlibc
15050
15051 : index or strchr
15052 echo " "
15053 if set index val -f; eval $csym; $val; then
15054         if set strchr val -f d_strchr; eval $csym; $val; then
15055                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15056                         val="$define"
15057                         vali="$undef"
15058                         echo "strchr() found." >&4
15059                 else
15060                         val="$undef"
15061                         vali="$define"
15062                         echo "index() found." >&4
15063                 fi
15064         else
15065                 val="$undef"
15066                 vali="$define"
15067                 echo "index() found." >&4
15068         fi
15069 else
15070         if set strchr val -f d_strchr; eval $csym; $val; then
15071                 val="$define"
15072                 vali="$undef"
15073                 echo "strchr() found." >&4
15074         else
15075                 echo "No index() or strchr() found!" >&4
15076                 val="$undef"
15077                 vali="$undef"
15078         fi
15079 fi
15080 set d_strchr; eval $setvar
15081 val="$vali"
15082 set d_index; eval $setvar
15083
15084 : check whether inet_aton exists
15085 set inet_aton d_inetaton
15086 eval $inlibc
15087
15088 : see if inet_ntop exists
15089 set inet_ntop d_inetntop
15090 eval $inlibc
15091
15092 : see if inet_pton exists
15093 set inet_pton d_inetpton
15094 eval $inlibc
15095
15096 : Look for isascii
15097 echo " "
15098 $cat >isascii.c <<EOCP
15099 #include <stdio.h>
15100 #include <ctype.h>
15101 #$i_stdlib I_STDLIB
15102 #ifdef I_STDLIB
15103 #include <stdlib.h>
15104 #endif
15105 int main() {
15106         int c = 'A';
15107         if (isascii(c))
15108                 exit(0);
15109         else
15110                 exit(1);
15111 }
15112 EOCP
15113 set isascii
15114 if eval $compile; then
15115         echo "isascii() found." >&4
15116         val="$define"
15117 else
15118         echo "isascii() NOT found." >&4
15119         val="$undef"
15120 fi
15121 set d_isascii
15122 eval $setvar
15123 $rm -f isascii*
15124
15125 : Look for isblank
15126 echo " "
15127 $cat >isblank.c <<'EOCP'
15128 #include <stdio.h>
15129 #include <ctype.h>
15130 int main() {
15131         int c = ' ';
15132         if (isblank(c))
15133                 return 0 ;
15134         else
15135                 return 1 ;
15136 }
15137 EOCP
15138 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15139         echo "isblank() found." >&4
15140         val="$define"
15141 else
15142         echo "isblank() NOT found." >&4
15143         val="$undef"
15144 fi
15145 set d_isblank
15146 eval $setvar
15147 $rm -f isblank*
15148
15149 : see if isfinite exists
15150 set isfinite d_isfinite
15151 eval $inlibc
15152
15153 : see if isinf exists
15154 set isinf d_isinf
15155 eval $inlibc
15156
15157 : see if isnan exists
15158 set isnan d_isnan
15159 eval $inlibc
15160
15161 : see if isnanl exists
15162 set isnanl d_isnanl
15163 eval $inlibc
15164
15165 : see if killpg exists
15166 set killpg d_killpg
15167 eval $inlibc
15168
15169 : see if lchown exists
15170 echo " "
15171 $cat > try.c <<'EOCP'
15172 /* System header to define __stub macros and hopefully few prototypes,
15173     which can conflict with char lchown(); below.  */
15174 #include <assert.h>
15175 /* Override any gcc2 internal prototype to avoid an error.  */
15176 /* We use char because int might match the return type of a gcc2
15177    builtin and then its argument prototype would still apply.  */
15178 char lchown();
15179 int main() {
15180     /*  The GNU C library defines this for functions which it implements
15181         to always fail with ENOSYS.  Some functions are actually named
15182         something starting with __ and the normal name is an alias.  */
15183 #if defined (__stub_lchown) || defined (__stub___lchown)
15184 choke me
15185 #else
15186 lchown();
15187 #endif
15188 ; return 0; }
15189 EOCP
15190 set try
15191 if eval $compile; then
15192     $echo "lchown() found." >&4
15193     val="$define"
15194 else
15195     $echo "lchown() NOT found." >&4
15196     val="$undef"
15197 fi
15198 set d_lchown
15199 eval $setvar
15200
15201 : See if number of significant digits in a double precision number is known
15202 echo " "
15203 $cat >ldbl_dig.c <<EOM
15204 #$i_limits I_LIMITS
15205 #$i_float I_FLOAT
15206 #ifdef I_LIMITS
15207 #include <limits.h>
15208 #endif
15209 #ifdef I_FLOAT
15210 #include <float.h>
15211 #endif
15212 #ifdef LDBL_DIG
15213 printf("Contains LDBL_DIG");
15214 #endif
15215 EOM
15216 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15217 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15218         echo "LDBL_DIG found." >&4
15219         val="$define"
15220 else
15221         echo "LDBL_DIG NOT found." >&4
15222         val="$undef"
15223 fi
15224 $rm -f ldbl_dig.?
15225 set d_ldbl_dig
15226 eval $setvar
15227
15228 : see if this is a math.h system
15229 set math.h i_math
15230 eval $inhdr
15231
15232 : check to see if math.h defines _LIB_VERSION
15233 d_libm_lib_version="$undef"
15234 case $i_math in
15235     $define)
15236         echo " "
15237         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15238         $cat >try.c <<EOCP
15239 #include <unistd.h>
15240 #include <math.h>
15241 int main (int argc, char *argv[])
15242 {
15243     printf ("%d\n", _LIB_VERSION);
15244     return (0);
15245     } /* main */
15246 EOCP
15247         set try
15248         if eval $compile; then
15249             foo=`$run ./try`
15250             echo "Yes, it does ($foo)" >&4
15251             d_libm_lib_version="$define"
15252         else
15253             echo "No, it does not (probably harmless)" >&4
15254             fi
15255         $rm_try
15256         ;;
15257
15258     esac
15259
15260 : see if link exists
15261 set link d_link
15262 eval $inlibc
15263
15264 : see if localtime_r exists
15265 set localtime_r d_localtime_r
15266 eval $inlibc
15267 case "$d_localtime_r" in
15268 "$define")
15269         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15270         case "$d_localtime_r_proto:$usethreads" in
15271         ":define")      d_localtime_r_proto=define
15272                 set d_localtime_r_proto localtime_r $hdrs
15273                 eval $hasproto ;;
15274         *)      ;;
15275         esac
15276         case "$d_localtime_r_proto" in
15277         define)
15278         case "$localtime_r_proto" in
15279         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15280         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15281         esac
15282         case "$localtime_r_proto" in
15283         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15284         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15285         esac
15286         case "$localtime_r_proto" in
15287         ''|0)   d_localtime_r=undef
15288                 localtime_r_proto=0
15289                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15290         * )     case "$localtime_r_proto" in
15291                 REENTRANT_PROTO*) ;;
15292                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15293                 esac
15294                 echo "Prototype: $try" ;;
15295         esac
15296         ;;
15297         *)      case "$usethreads" in
15298                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15299                 esac
15300                 d_localtime_r=undef
15301                 localtime_r_proto=0
15302                 ;;
15303         esac
15304         ;;
15305 *)      localtime_r_proto=0
15306         ;;
15307 esac
15308
15309 : see if localtime_r calls tzset
15310 case "$localtime_r_proto" in
15311 REENTRANT_PROTO*)
15312         $cat >try.c <<EOCP
15313 /*  Does our libc's localtime_r call tzset ?
15314  *  return 0 if so, 1 otherwise.
15315  */
15316 #$i_systypes    I_SYS_TYPES
15317 #$i_unistd      I_UNISTD
15318 #$i_time        I_TIME
15319 #$i_stdlib      I_STDLIB
15320 #$i_string      I_STRING
15321 #$i_malloc      I_MALLOC
15322 #ifdef I_SYS_TYPES
15323 #  include <sys/types.h>
15324 #endif
15325 #ifdef I_UNISTD
15326 #  include <unistd.h>
15327 #endif
15328 #ifdef I_TIME
15329 #  include <time.h>
15330 #endif
15331 #ifdef I_STDLIB
15332 #include <stdlib.h>
15333 #endif
15334 #ifdef I_STRING
15335 #  include <string.h>
15336 #else
15337 #  include <strings.h>
15338 #endif
15339 #ifdef I_MALLOC
15340 #  include <malloc.h>
15341 #endif
15342 int main()
15343 {
15344     time_t t = time(0L);
15345     char w_tz[]="TZ" "=GMT+5",
15346          e_tz[]="TZ" "=GMT-5",
15347         *tz_e = (char*)malloc(16),
15348         *tz_w = (char*)malloc(16);
15349     struct tm tm_e, tm_w;
15350     memset(&tm_e,'\0',sizeof(struct tm));
15351     memset(&tm_w,'\0',sizeof(struct tm));
15352     strcpy(tz_e,e_tz);
15353     strcpy(tz_w,w_tz);
15354
15355     putenv(tz_e);
15356     localtime_r(&t, &tm_e);
15357
15358     putenv(tz_w);
15359     localtime_r(&t, &tm_w);
15360
15361     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15362         return 1;
15363     return 0;
15364 }
15365 EOCP
15366         set try
15367         if eval $compile; then
15368             if $run ./try; then
15369                 d_localtime_r_needs_tzset=undef;
15370             else
15371                 d_localtime_r_needs_tzset=define;
15372             fi;
15373         else
15374             d_localtime_r_needs_tzset=undef;
15375         fi;
15376      ;;
15377   *)
15378      d_localtime_r_needs_tzset=undef;
15379      ;;
15380 esac
15381 $rm_try
15382
15383 : see if localeconv exists
15384 set localeconv d_locconv
15385 eval $inlibc
15386
15387 : see if lockf exists
15388 set lockf d_lockf
15389 eval $inlibc
15390
15391 : see if prototype for lseek is available
15392 echo " "
15393 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15394 eval $hasproto
15395
15396 : see if lstat exists
15397 set lstat d_lstat
15398 eval $inlibc
15399
15400 : see if madvise exists
15401 set madvise d_madvise
15402 eval $inlibc
15403
15404 : see if malloc_size exists
15405 set malloc_size d_malloc_size
15406 eval $inlibc
15407
15408 : see if malloc_size_good exists
15409 set malloc_good_size d_malloc_good_size
15410 eval $inlibc
15411
15412 : see if mblen exists
15413 set mblen d_mblen
15414 eval $inlibc
15415
15416 : see if mbstowcs exists
15417 set mbstowcs d_mbstowcs
15418 eval $inlibc
15419
15420 : see if mbtowc exists
15421 set mbtowc d_mbtowc
15422 eval $inlibc
15423
15424 : see if memchr exists
15425 set memchr d_memchr
15426 eval $inlibc
15427
15428 : see if memcmp exists
15429 set memcmp d_memcmp
15430 eval $inlibc
15431
15432 : see if memcpy exists
15433 set memcpy d_memcpy
15434 eval $inlibc
15435
15436 : see if memmove exists
15437 set memmove d_memmove
15438 eval $inlibc
15439
15440 : see if memset exists
15441 set memset d_memset
15442 eval $inlibc
15443
15444 : see if mkdir exists
15445 set mkdir d_mkdir
15446 eval $inlibc
15447
15448 : see if mkdtemp exists
15449 set mkdtemp d_mkdtemp
15450 eval $inlibc
15451
15452 : see if mkfifo exists
15453 set mkfifo d_mkfifo
15454 eval $inlibc
15455
15456 : see if mkstemp exists
15457 set mkstemp d_mkstemp
15458 eval $inlibc
15459
15460 : see if mkstemps exists
15461 set mkstemps d_mkstemps
15462 eval $inlibc
15463
15464 : see if mktime exists
15465 set mktime d_mktime
15466 eval $inlibc
15467
15468 : see if this is a sys/mman.h system
15469 set sys/mman.h i_sysmman
15470 eval $inhdr
15471
15472 : see if mmap exists
15473 set mmap d_mmap
15474 eval $inlibc
15475 : see what shmat returns
15476 : default to something harmless
15477 mmaptype='void *'
15478 case "$i_sysmman$d_mmap" in
15479 "$define$define")
15480         $cat >mmap.c <<'END'
15481 #include <sys/mman.h>
15482 void *mmap();
15483 END
15484         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15485                 mmaptype='void *'
15486         else
15487                 mmaptype='caddr_t'
15488         fi
15489         echo "and it returns ($mmaptype)." >&4
15490         ;;
15491 esac
15492
15493
15494
15495 : see if sqrtl exists
15496 set sqrtl d_sqrtl
15497 eval $inlibc
15498
15499 : see if scalbnl exists
15500 set scalbnl d_scalbnl
15501 eval $inlibc
15502
15503 : see if modfl exists
15504 set modfl d_modfl
15505 eval $inlibc
15506
15507 : see if prototype for modfl is available
15508 echo " "
15509 set d_modflproto modfl $i_math math.h
15510 eval $hasproto
15511
15512 d_modfl_pow32_bug="$undef"
15513
15514 case "$d_longdbl$d_modfl" in
15515 $define$define)
15516         $cat <<EOM
15517 Checking to see whether your modfl() is okay for large values...
15518 EOM
15519 $cat >try.c <<EOCP
15520 #include <math.h>
15521 #include <stdio.h>
15522 EOCP
15523 if $test "X$d_modflproto" != "X$define"; then
15524         $cat >>try.c <<EOCP
15525 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15526 long double modfl (long double, long double *);
15527 EOCP
15528 fi
15529 $cat >>try.c <<EOCP
15530 int main() {
15531     long double nv = 4294967303.15;
15532     long double v, w;
15533     v = modfl(nv, &w);
15534 #ifdef __GLIBC__
15535     printf("glibc");
15536 #endif
15537     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15538     return 0;
15539 }
15540 EOCP
15541         case "$osname:$gccversion" in
15542         aix:)   saveccflags="$ccflags"
15543                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15544         esac
15545         set try
15546         if eval $compile; then
15547                 foo=`$run ./try`
15548                 case "$foo" in
15549                 *" 4294967303.150000 1.150000 4294967302.000000")
15550                         echo >&4 "Your modfl() is broken for large values."
15551                         d_modfl_pow32_bug="$define"
15552                         case "$foo" in
15553                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15554                         ;;
15555                         esac
15556                         ;;
15557                 *" 4294967303.150000 0.150000 4294967303.000000")
15558                         echo >&4 "Your modfl() seems okay for large values."
15559                         ;;
15560                 *)      echo >&4 "I don't understand your modfl() at all."
15561                         d_modfl="$undef"
15562                         ;;
15563                 esac
15564                 $rm_try
15565         else
15566                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15567                 d_modfl="$undef"
15568         fi
15569         case "$osname:$gccversion" in
15570         aix:)   ccflags="$saveccflags" ;; # restore
15571         esac
15572         ;;
15573 esac
15574
15575 if $test "$uselongdouble" = "$define"; then
15576     message=""
15577     if $test "$d_sqrtl" != "$define"; then
15578         message="$message sqrtl"
15579     fi
15580     if $test "$d_modfl" != "$define"; then
15581         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15582             echo "You have both aintl and copysignl, so I can emulate modfl."
15583         else
15584             message="$message modfl"
15585         fi
15586     fi
15587     if $test "$d_frexpl" != "$define"; then
15588         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15589             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15590         else
15591             message="$message frexpl"
15592         fi
15593     fi
15594
15595     if $test "$message" != ""; then
15596         $cat <<EOM >&4
15597
15598 *** You requested the use of long doubles but you do not seem to have
15599 *** the following mathematical functions needed for long double support:
15600 ***    $message
15601 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15602 *** Cannot continue, aborting.
15603
15604 EOM
15605
15606         exit 1
15607     fi
15608 fi
15609
15610 : see if mprotect exists
15611 set mprotect d_mprotect
15612 eval $inlibc
15613
15614 : see if msgctl exists
15615 set msgctl d_msgctl
15616 eval $inlibc
15617
15618 : see if msgget exists
15619 set msgget d_msgget
15620 eval $inlibc
15621
15622 : see if msgsnd exists
15623 set msgsnd d_msgsnd
15624 eval $inlibc
15625
15626 : see if msgrcv exists
15627 set msgrcv d_msgrcv
15628 eval $inlibc
15629
15630 : see how much of the 'msg*(2)' library is present.
15631 h_msg=true
15632 echo " "
15633 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15634 *"$undef"*) h_msg=false;;
15635 esac
15636 case "$osname" in
15637 freebsd)
15638     case "`ipcs 2>&1`" in
15639     "SVID messages"*"not configured"*)
15640         echo "Your $osname does not have the msg*(2) configured." >&4
15641         h_msg=false
15642         val="$undef"
15643         set msgctl d_msgctl
15644         eval $setvar
15645         set msgget d_msgget
15646         eval $setvar
15647         set msgsnd d_msgsnd
15648         eval $setvar
15649         set msgrcv d_msgrcv
15650         eval $setvar
15651         ;;
15652     esac
15653     ;;
15654 esac
15655 : we could also check for sys/ipc.h ...
15656 if $h_msg && $test `./findhdr sys/msg.h`; then
15657         echo "You have the full msg*(2) library." >&4
15658         val="$define"
15659 else
15660         echo "You don't have the full msg*(2) library." >&4
15661         val="$undef"
15662 fi
15663 set d_msg
15664 eval $setvar
15665
15666 : Check for msghdr_s
15667 echo " "
15668 echo "Checking to see if your system supports struct msghdr..." >&4
15669 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15670 eval $hasstruct
15671 case "$d_msghdr_s" in
15672 "$define")      echo "Yes, it does."   ;;
15673 *)              echo "No, it doesn't." ;;
15674 esac
15675
15676
15677 : see if msync exists
15678 set msync d_msync
15679 eval $inlibc
15680
15681 : see if munmap exists
15682 set munmap d_munmap
15683 eval $inlibc
15684
15685 : see if nice exists
15686 set nice d_nice
15687 eval $inlibc
15688
15689 : see if this is a langinfo.h system
15690 set langinfo.h i_langinfo
15691 eval $inhdr
15692
15693 : see if nl_langinfo exists
15694 set nl_langinfo d_nl_langinfo
15695 eval $inlibc
15696
15697 : check for volatile keyword
15698 echo " "
15699 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15700 $cat >try.c <<'EOCP'
15701 int main()
15702 {
15703         typedef struct _goo_struct goo_struct;
15704         goo_struct * volatile goo = ((goo_struct *)0);
15705         struct _goo_struct {
15706                 long long_int;
15707                 int reg_int;
15708                 char char_var;
15709         };
15710         typedef unsigned short foo_t;
15711         char *volatile foo;
15712         volatile int bar;
15713         volatile foo_t blech;
15714         foo = foo;
15715 }
15716 EOCP
15717 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15718         val="$define"
15719         echo "Yup, it does."
15720 else
15721         val="$undef"
15722         echo "Nope, it doesn't."
15723 fi
15724 set d_volatile
15725 eval $setvar
15726 $rm_try
15727
15728 : Check basic sizes
15729 echo " "
15730 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15731
15732 case "$use64bitint:$d_quad:$quadtype" in
15733 define:define:?*)
15734         ivtype="$quadtype"
15735         uvtype="$uquadtype"
15736         ivsize=8
15737         uvsize=8
15738         ;;
15739 *)      ivtype="long"
15740         uvtype="unsigned long"
15741         ivsize=$longsize
15742         uvsize=$longsize
15743         ;;
15744 esac
15745
15746 case "$uselongdouble:$d_longdbl" in
15747 define:define)
15748         nvtype="long double"
15749         nvsize=$longdblsize
15750         ;;
15751 *)      nvtype=double
15752         nvsize=$doublesize
15753         ;;
15754 esac
15755
15756 $echo "(IV will be "$ivtype", $ivsize bytes)"
15757 $echo "(UV will be "$uvtype", $uvsize bytes)"
15758 $echo "(NV will be "$nvtype", $nvsize bytes)"
15759
15760 $cat >try.c <<EOCP
15761 #$i_inttypes I_INTTYPES
15762 #ifdef I_INTTYPES
15763 #include <inttypes.h>
15764 #endif
15765 #include <stdio.h>
15766 int main() {
15767 #ifdef INT8
15768    int8_t i =  INT8_MAX;
15769   uint8_t u = UINT8_MAX;
15770   printf("int8_t\n");
15771 #endif
15772 #ifdef INT16
15773    int16_t i =  INT16_MAX;
15774   uint16_t i = UINT16_MAX;
15775   printf("int16_t\n");
15776 #endif
15777 #ifdef INT32
15778    int32_t i =  INT32_MAX;
15779   uint32_t u = UINT32_MAX;
15780   printf("int32_t\n");
15781 #endif
15782 }
15783 EOCP
15784
15785 i8type="signed char"
15786 u8type="unsigned char"
15787 i8size=1
15788 u8size=1
15789
15790 case "$i16type" in
15791 '')     case "$shortsize" in
15792         2)      i16type=short
15793                 u16type="unsigned short"
15794                 i16size=$shortsize
15795                 u16size=$shortsize
15796                 ;;
15797         esac
15798         ;;
15799 esac
15800 case "$i16type" in
15801 '')     set try -DINT16
15802         if eval $compile; then
15803                 case "`$run ./try`" in
15804                 int16_t)
15805                         i16type=int16_t
15806                         u16type=uint16_t
15807                         i16size=2
15808                         u16size=2
15809                         ;;
15810                 esac
15811         fi
15812         ;;
15813 esac
15814 case "$i16type" in
15815 '')     if $test $shortsize -ge 2; then
15816                 i16type=short
15817                 u16type="unsigned short"
15818                 i16size=$shortsize
15819                 u16size=$shortsize
15820         fi
15821         ;;
15822 esac
15823
15824 case "$i32type" in
15825 '')     case "$longsize" in
15826         4)      i32type=long
15827                 u32type="unsigned long"
15828                 i32size=$longsize
15829                 u32size=$longsize
15830                 ;;
15831         *)      case "$intsize" in
15832                 4)      i32type=int
15833                         u32type="unsigned int"
15834                         i32size=$intsize
15835                         u32size=$intsize
15836                         ;;
15837                 esac
15838                 ;;
15839         esac
15840         ;;
15841 esac
15842 case "$i32type" in
15843 '')     set try -DINT32
15844         if eval $compile; then
15845                 case "`$run ./try`" in
15846                 int32_t)
15847                         i32type=int32_t
15848                         u32type=uint32_t
15849                         i32size=4
15850                         u32size=4
15851                         ;;
15852                 esac
15853         fi
15854         ;;
15855 esac
15856 case "$i32type" in
15857 '')     if $test $intsize -ge 4; then
15858                 i32type=int
15859                 u32type="unsigned int"
15860                 i32size=$intsize
15861                 u32size=$intsize
15862         fi
15863         ;;
15864 esac
15865
15866 case "$i64type" in
15867 '')     case "$d_quad:$quadtype" in
15868         define:?*)
15869                 i64type="$quadtype"
15870                 u64type="$uquadtype"
15871                 i64size=8
15872                 u64size=8
15873                 ;;
15874         esac
15875         ;;
15876 esac
15877
15878 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15879 : volatile so that the compiler has to store it out to memory.
15880 if test X"$d_volatile" = X"$define"; then
15881         volatile=volatile
15882 fi
15883 $cat <<EOP >try.c
15884 #include <stdio.h>
15885 #$i_stdlib I_STDLIB
15886 #ifdef I_STDLIB
15887 #include <stdlib.h>
15888 #endif
15889 #include <sys/types.h>
15890 #include <signal.h>
15891 #ifdef SIGFPE
15892 $volatile int bletched = 0;
15893 $signal_t blech(int s) { bletched = 1; }
15894 #endif
15895 int main() {
15896     $uvtype u = 0;
15897     $nvtype d;
15898     int     n = 8 * $uvsize;
15899     int     i;
15900 #ifdef SIGFPE
15901     signal(SIGFPE, blech);
15902 #endif
15903
15904     for (i = 0; i < n; i++) {
15905       u = u << 1 | ($uvtype)1;
15906       d = ($nvtype)u;
15907       if (($uvtype)d != u)
15908         break;
15909       if (d <= 0)
15910         break;
15911       d = ($nvtype)(u - 1);
15912       if (($uvtype)d != (u - 1))
15913         break;
15914 #ifdef SIGFPE
15915       if (bletched)
15916         break;
15917 #endif
15918     }
15919     printf("%d\n", ((i == n) ? -n : i));
15920     exit(0);
15921 }
15922 EOP
15923 set try
15924
15925 d_nv_preserves_uv="$undef"
15926 if eval $compile; then
15927         nv_preserves_uv_bits="`$run ./try`"
15928 fi
15929 case "$nv_preserves_uv_bits" in
15930 \-[1-9]*)
15931         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15932         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15933         d_nv_preserves_uv="$define"
15934         ;;
15935 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15936         d_nv_preserves_uv="$undef" ;;
15937 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15938         nv_preserves_uv_bits="0" ;;
15939 esac
15940 $rm_try
15941
15942 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15943 : volatile so that the compiler has to store it out to memory.
15944 if test X"$d_volatile" = X"$define"; then
15945         volatile=volatile
15946 fi
15947 $cat <<EOP >try.c
15948 #include <stdio.h>
15949
15950 typedef $nvtype NV;
15951
15952 int
15953 main() {
15954   NV value = 2;
15955   int count = 1;
15956
15957   while(count < 256) {
15958     $volatile NV up = value + 1.0;
15959     $volatile NV negated = -value;
15960     $volatile NV down = negated - 1.0;
15961     $volatile NV got_up = up - value;
15962     int up_good = got_up == 1.0;
15963     int got_down = down - negated;
15964     int down_good = got_down == -1.0;
15965
15966     if (down_good != up_good) {
15967       fprintf(stderr,
15968               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15969               up_good, (double) got_up, down_good, (double) got_down,
15970               count, (double) value);
15971       return 1;
15972     }
15973     if (!up_good) {
15974       while (1) {
15975         if (count > 8) {
15976           count -= 8;
15977           fputs("256.0", stdout);
15978         } else {
15979           count--;
15980           fputs("2.0", stdout);
15981         }
15982         if (!count) {
15983           puts("");
15984           return 0;
15985         }
15986         fputs("*", stdout);
15987       }
15988     }
15989     value *= 2;
15990     ++count;
15991   }
15992   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15993           count, (double) value);
15994   return 1;
15995 }
15996 EOP
15997 set try
15998
15999 nv_overflows_integers_at='0'
16000 if eval $compile; then
16001     xxx="`$run ./try`"
16002     case "$?" in
16003         0)
16004             case "$xxx" in
16005                 2*)  cat >&4 <<EOM
16006 The largest integer your NVs can preserve is equal to $xxx
16007 EOM
16008                     nv_overflows_integers_at="$xxx"
16009                     ;;
16010                 *)  cat >&4 <<EOM
16011 Cannot determine the largest integer value your NVs can hold, unexpected output
16012 '$xxx'
16013 EOM
16014                     ;;
16015             esac
16016             ;;
16017         *)  cat >&4 <<EOM
16018 Cannot determine the largest integer value your NVs can hold
16019 EOM
16020             ;;
16021     esac
16022 fi
16023 $rm_try
16024
16025 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16026 : volatile so that the compiler has to store it out to memory.
16027 if test X"$d_volatile" = X"$define"; then
16028         volatile=volatile
16029 fi
16030 $cat <<EOP >try.c
16031 #include <stdio.h>
16032 #$i_stdlib I_STDLIB
16033 #ifdef I_STDLIB
16034 #include <stdlib.h>
16035 #endif
16036 #$i_string I_STRING
16037 #ifdef I_STRING
16038 #  include <string.h>
16039 #else
16040 #  include <strings.h>
16041 #endif
16042 #include <sys/types.h>
16043 #include <signal.h>
16044 #ifdef SIGFPE
16045 $volatile int bletched = 0;
16046 $signal_t blech(int s) { bletched = 1; }
16047 #endif
16048
16049 int checkit($nvtype d, char *where) {
16050     unsigned char *p = (char *)&d;
16051     unsigned char *end = p + sizeof(d);
16052     int fail = 0;
16053
16054     while (p < end)
16055         fail += *p++;
16056
16057     if (!fail)
16058         return 0;
16059
16060     p = (char *)&d;
16061     printf("No - %s: 0x", where);
16062     while (p < end)
16063         printf ("%02X", *p++);
16064     printf("\n");
16065     return 1;
16066 }
16067
16068 int main(int argc, char **argv) {
16069     $nvtype d = 0.0;
16070     int fail = 0;
16071     fail += checkit(d, "0.0");
16072
16073     /* The compiler shouldn't be assuming that bletched is 0  */
16074     d = bletched;
16075
16076     fail += checkit(d, "bleched");
16077
16078 #ifdef SIGFPE
16079     signal(SIGFPE, blech);
16080 #endif
16081
16082     /* Paranoia - the compiler should have no way of knowing that ANSI says
16083        that argv[argc] will always be NULL.  Actually, if it did assume this it
16084        would be buggy, as this is C and main() can be called from elsewhere in
16085        the program.  */
16086     d = argv[argc] ? 1 : 0;
16087
16088     if (d) {
16089         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16090     }
16091
16092     fail += checkit(d, "ternary");
16093
16094     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16095
16096     if (d != 0.0) {
16097         printf("No - memset doesn't give 0.0\n");
16098         /* This might just blow up:  */
16099         printf("(gives %g)\n", d);
16100         return 1;
16101     }
16102
16103 #ifdef SIGFPE
16104     if (bletched) {
16105         printf("No - something bleched\n");
16106         return 1;
16107     }
16108 #endif
16109     if (fail) {
16110       printf("No - %d fail(s)\n", fail);
16111       return 1;
16112     }
16113     printf("Yes\n");
16114     return 0;
16115 }
16116 EOP
16117 set try
16118
16119 d_nv_zero_is_allbits_zero="$undef"
16120 if eval $compile; then
16121     xxx="`$run ./try`"
16122     case "$?" in
16123         0)
16124             case "$xxx" in
16125                 Yes)  cat >&4 <<EOM
16126 0.0 is represented as all bits zero in memory
16127 EOM
16128                     d_nv_zero_is_allbits_zero="$define"
16129                     ;;
16130                 *)  cat >&4 <<EOM
16131 0.0 is not represented as all bits zero in memory
16132 EOM
16133                     d_nv_zero_is_allbits_zero="$undef"
16134                     ;;
16135             esac
16136             ;;
16137         *)  cat >&4 <<EOM
16138 0.0 is not represented as all bits zero in memory
16139 EOM
16140             d_nv_zero_is_allbits_zero="$undef"
16141             ;;
16142     esac
16143 fi
16144 $rm_try
16145
16146 : check for off64_t
16147 echo " "
16148 echo "Checking to see if you have off64_t..." >&4
16149 $cat >try.c <<EOCP
16150 #include <sys/types.h>
16151 #include <unistd.h>
16152 int main() { off64_t x = 7; }
16153 EOCP
16154 set try
16155 if eval $compile; then
16156         val="$define"
16157         echo "You have off64_t."
16158 else
16159         val="$undef"
16160         echo "You do not have off64_t."
16161         case "$lseeksize" in
16162         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16163         esac
16164 fi
16165 $rm_try
16166 set d_off64_t
16167 eval $setvar
16168
16169 : how to create joinable pthreads
16170 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16171         echo " "
16172         echo "Checking what constant to use for creating joinable pthreads..." >&4
16173         $cat >try.c <<'EOCP'
16174 #include <pthread.h>
16175 int main() {
16176     int detachstate = JOINABLE;
16177 }
16178 EOCP
16179         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16180         if eval $compile; then
16181                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16182                 val="$undef" # Yes, undef.
16183                 set d_old_pthread_create_joinable
16184                 eval $setvar
16185                 val=""
16186                 set old_pthread_create_joinable
16187                 eval $setvar
16188         else
16189                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16190                 if eval $compile; then
16191                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16192                         val="$define"
16193                         set d_old_pthread_create_joinable
16194                         eval $setvar
16195                         val=PTHREAD_CREATE_UNDETACHED
16196                         set old_pthread_create_joinable
16197                         eval $setvar
16198                 else
16199                         set try -DJOINABLE=__UNDETACHED
16200                         if eval $compile; then
16201                                 echo "You seem to use __UNDETACHED." >&4
16202                                 val="$define"
16203                                 set d_old_pthread_create_joinable
16204                                 eval $setvar
16205                                 val=__UNDETACHED
16206                                 set old_pthread_create_joinable
16207                                 eval $setvar
16208                         else
16209                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16210                                 val="$define"
16211                                 set d_old_pthread_create_joinable
16212                                 eval $setvar
16213                                 val=0
16214                                 set old_pthread_create_joinable
16215                                 eval $setvar
16216                         fi
16217                 fi
16218         fi
16219         $rm_try
16220 else
16221     d_old_pthread_create_joinable="$undef"
16222     old_pthread_create_joinable=""
16223 fi
16224
16225 : see if pause exists
16226 set pause d_pause
16227 eval $inlibc
16228
16229 : see if poll exists
16230 set poll d_poll
16231 eval $inlibc
16232
16233 : see if prctl exists
16234 set prctl d_prctl
16235 eval $inlibc
16236
16237 : see if prctl supports PR_SET_NAME
16238 d_prctl_set_name=$undef
16239 case $d_prctl in
16240     $define)
16241         $cat >try.c <<EOM
16242 #include <sys/prctl.h>
16243
16244 int main (int argc, char *argv[])
16245 {
16246     return (prctl (PR_SET_NAME, "Test"));
16247     } /* main */
16248 EOM
16249         set try
16250         if eval $compile_ok && $run ./try; then
16251             echo "Your prctl (PR_SET_NAME, ...) works"
16252             d_prctl_set_name=$define
16253             fi
16254         $rm_try
16255         ;;
16256     esac
16257
16258 : see if readlink exists
16259 set readlink d_readlink
16260 eval $inlibc
16261
16262 : Check if exe is symlink to abs path of executing program
16263 echo " "
16264 procselfexe=''
16265 val="$undef"
16266 case "$d_readlink" in
16267     "$define")
16268         : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
16269         : more tidy to avoid an extra level of symlink
16270         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
16271         while test $# -gt 0; do
16272             type=$1; try=$2
16273             shift; shift
16274             if $issymlink $try; then
16275                 $ls -l $try > reflect
16276                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16277                     echo "You have $type-like $try."
16278                     procselfexe='"'$try'"'
16279                     val="$define"
16280                     : This will break out of the loop
16281                     set X; shift
16282                 fi
16283             fi
16284         done
16285         ;;
16286 esac
16287 $rm -f reflect
16288 set d_procselfexe
16289 eval $setvar
16290
16291 : backward compatibility for d_hvfork
16292 if test X$d_hvfork != X; then
16293         d_vfork="$d_hvfork"
16294         d_hvfork=''
16295 fi
16296 : see if there is a vfork
16297 val=''
16298 set vfork val
16299 eval $inlibc
16300
16301 d_pseudofork=$undef
16302
16303 : Ok, but do we want to use it. vfork is reportedly unreliable in
16304 : perl on Solaris 2.x, and probably elsewhere.
16305 case "$val" in
16306 $define)
16307         echo " "
16308         case "$usevfork" in
16309         false) dflt='n';;
16310         *) dflt='y';;
16311         esac
16312         cat <<'EOM'
16313
16314 Perl can only use a vfork() that doesn't suffer from strict
16315 restrictions on calling functions or modifying global data in
16316 the child.  For example, glibc-2.1 contains such a vfork()
16317 that is unsuitable.  If your system provides a proper fork()
16318 call, chances are that you do NOT want perl to use vfork().
16319
16320 EOM
16321         rp="Do you still want to use vfork()?"
16322         . ./myread
16323         case "$ans" in
16324         y|Y) ;;
16325         *)
16326                 echo "Ok, we won't use vfork()."
16327                 val="$undef"
16328                 ;;
16329         esac
16330         ;;
16331 esac
16332 set d_vfork
16333 eval $setvar
16334 case "$d_vfork" in
16335 $define) usevfork='true';;
16336 *) usevfork='false';;
16337 esac
16338
16339 : see whether the pthread_atfork exists
16340 $cat >try.c <<EOP
16341 #include <pthread.h>
16342 #include <stdio.h>
16343 int main() {
16344 #ifdef  PTHREAD_ATFORK
16345         pthread_atfork(NULL,NULL,NULL);
16346 #endif
16347 }
16348 EOP
16349
16350 : see if pthread_atfork exists
16351 set try -DPTHREAD_ATFORK
16352 if eval $compile; then
16353     val="$define"
16354 else
16355     val="$undef"
16356 fi
16357 case "$usethreads" in
16358 $define)
16359         case "$val" in
16360         $define) echo 'pthread_atfork found.' >&4        ;;
16361         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16362         esac
16363 esac
16364 set d_pthread_atfork
16365 eval $setvar
16366
16367 : see if pthread_attr_setscope exists
16368 set pthread_attr_setscope d_pthread_attr_setscope
16369 eval $inlibc
16370
16371 : see whether the various POSIXish _yields exist
16372 $cat >try.c <<EOP
16373 #include <pthread.h>
16374 #include <stdio.h>
16375 int main() {
16376 #ifdef SCHED_YIELD
16377         sched_yield();
16378 #else
16379 #ifdef PTHREAD_YIELD
16380         pthread_yield();
16381 #else
16382 #ifdef PTHREAD_YIELD_NULL
16383         pthread_yield(NULL);
16384 #endif
16385 #endif
16386 #endif
16387 }
16388 EOP
16389 : see if sched_yield exists
16390 set try -DSCHED_YIELD
16391 if eval $compile; then
16392     val="$define"
16393     sched_yield='sched_yield()'
16394 else
16395     val="$undef"
16396 fi
16397 case "$usethreads" in
16398 $define)
16399         case "$val" in
16400         $define) echo 'sched_yield() found.' >&4        ;;
16401         *)       echo 'sched_yield() NOT found.' >&4    ;;
16402         esac
16403 esac
16404 set d_sched_yield
16405 eval $setvar
16406
16407 : see if pthread_yield exists
16408 set try -DPTHREAD_YIELD
16409 if eval $compile; then
16410     val="$define"
16411     case "$sched_yield" in
16412     '') sched_yield='pthread_yield()' ;;
16413     esac
16414 else
16415     set try -DPTHREAD_YIELD_NULL
16416     if eval $compile; then
16417         val="$define"
16418         case "$sched_yield" in
16419         '') sched_yield='pthread_yield(NULL)' ;;
16420         esac
16421     else
16422         val="$undef"
16423     fi
16424 fi
16425 case "$usethreads" in
16426 $define)
16427         case "$val" in
16428         $define) echo 'pthread_yield() found.' >&4      ;;
16429         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16430         esac
16431         ;;
16432 esac
16433 set d_pthread_yield
16434 eval $setvar
16435 case "$sched_yield" in
16436 '') sched_yield=undef ;;
16437 esac
16438 $rm_try
16439
16440 : see if random_r exists
16441 set random_r d_random_r
16442 eval $inlibc
16443 case "$d_random_r" in
16444 "$define")
16445         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16446         case "$d_random_r_proto:$usethreads" in
16447         ":define")      d_random_r_proto=define
16448                 set d_random_r_proto random_r $hdrs
16449                 eval $hasproto ;;
16450         *)      ;;
16451         esac
16452         case "$d_random_r_proto" in
16453         define)
16454         case "$random_r_proto" in
16455         ''|0) try='int random_r(int*, struct random_data*);'
16456         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16457         esac
16458         case "$random_r_proto" in
16459         ''|0) try='int random_r(long*, struct random_data*);'
16460         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16461         esac
16462         case "$random_r_proto" in
16463         ''|0) try='int random_r(struct random_data*, int32_t*);'
16464         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16465         esac
16466         case "$random_r_proto" in
16467         ''|0)   d_random_r=undef
16468                 random_r_proto=0
16469                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16470         * )     case "$random_r_proto" in
16471                 REENTRANT_PROTO*) ;;
16472                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16473                 esac
16474                 echo "Prototype: $try" ;;
16475         esac
16476         ;;
16477         *)      case "$usethreads" in
16478                 define) echo "random_r has no prototype, not using it." >&4 ;;
16479                 esac
16480                 d_random_r=undef
16481                 random_r_proto=0
16482                 ;;
16483         esac
16484         ;;
16485 *)      random_r_proto=0
16486         ;;
16487 esac
16488
16489 : see if readdir and friends exist
16490 set readdir d_readdir
16491 eval $inlibc
16492 set seekdir d_seekdir
16493 eval $inlibc
16494 set telldir d_telldir
16495 eval $inlibc
16496 set rewinddir d_rewinddir
16497 eval $inlibc
16498
16499 : see if readdir64_r exists
16500 set readdir64_r d_readdir64_r
16501 eval $inlibc
16502 case "$d_readdir64_r" in
16503 "$define")
16504         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16505         case "$d_readdir64_r_proto:$usethreads" in
16506         ":define")      d_readdir64_r_proto=define
16507                 set d_readdir64_r_proto readdir64_r $hdrs
16508                 eval $hasproto ;;
16509         *)      ;;
16510         esac
16511         case "$d_readdir64_r_proto" in
16512         define)
16513         case "$readdir64_r_proto" in
16514         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16515         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16516         esac
16517         case "$readdir64_r_proto" in
16518         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16519         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16520         esac
16521         case "$readdir64_r_proto" in
16522         ''|0)   d_readdir64_r=undef
16523                 readdir64_r_proto=0
16524                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16525         * )     case "$readdir64_r_proto" in
16526                 REENTRANT_PROTO*) ;;
16527                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16528                 esac
16529                 echo "Prototype: $try" ;;
16530         esac
16531         ;;
16532         *)      case "$usethreads" in
16533                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16534                 esac
16535                 d_readdir64_r=undef
16536                 readdir64_r_proto=0
16537                 ;;
16538         esac
16539         ;;
16540 *)      readdir64_r_proto=0
16541         ;;
16542 esac
16543
16544 : see if readdir_r exists
16545 set readdir_r d_readdir_r
16546 eval $inlibc
16547 case "$d_readdir_r" in
16548 "$define")
16549         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16550         case "$d_readdir_r_proto:$usethreads" in
16551         ":define")      d_readdir_r_proto=define
16552                 set d_readdir_r_proto readdir_r $hdrs
16553                 eval $hasproto ;;
16554         *)      ;;
16555         esac
16556         case "$d_readdir_r_proto" in
16557         define)
16558         case "$readdir_r_proto" in
16559         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16560         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16561         esac
16562         case "$readdir_r_proto" in
16563         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16564         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16565         esac
16566         case "$readdir_r_proto" in
16567         ''|0)   d_readdir_r=undef
16568                 readdir_r_proto=0
16569                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16570         * )     case "$readdir_r_proto" in
16571                 REENTRANT_PROTO*) ;;
16572                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16573                 esac
16574                 echo "Prototype: $try" ;;
16575         esac
16576         ;;
16577         *)      case "$usethreads" in
16578                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16579                 esac
16580                 d_readdir_r=undef
16581                 readdir_r_proto=0
16582                 ;;
16583         esac
16584         ;;
16585 *)      readdir_r_proto=0
16586         ;;
16587 esac
16588
16589 : see if readv exists
16590 set readv d_readv
16591 eval $inlibc
16592
16593 : see if recvmsg exists
16594 set recvmsg d_recvmsg
16595 eval $inlibc
16596
16597 : see if rename exists
16598 set rename d_rename
16599 eval $inlibc
16600
16601 : see if rmdir exists
16602 set rmdir d_rmdir
16603 eval $inlibc
16604
16605 : see if memory.h is available.
16606 val=''
16607 set memory.h val
16608 eval $inhdr
16609
16610 : See if it conflicts with string.h
16611 case "$val" in
16612 $define)
16613         case "$strings" in
16614         '') ;;
16615         *)
16616                 $cppstdin $cppflags $cppminus < $strings > mem.h
16617                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16618                         echo " "
16619                         echo "We won't be including <memory.h>."
16620                         val="$undef"
16621                 fi
16622                 $rm -f mem.h
16623                 ;;
16624         esac
16625 esac
16626 set i_memory
16627 eval $setvar
16628
16629 : can bcopy handle overlapping blocks?
16630 echo " "
16631 val="$undef"
16632 case "$d_memmove" in
16633 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16634 *)      case "$d_bcopy" in
16635         "$define")
16636                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16637                 $cat >try.c <<EOCP
16638 #$i_memory I_MEMORY
16639 #$i_stdlib I_STDLIB
16640 #$i_string I_STRING
16641 #$i_unistd I_UNISTD
16642 EOCP
16643         $cat >>try.c <<'EOCP'
16644 #include <stdio.h>
16645 #ifdef I_MEMORY
16646 #  include <memory.h>
16647 #endif
16648 #ifdef I_STDLIB
16649 #  include <stdlib.h>
16650 #endif
16651 #ifdef I_STRING
16652 #  include <string.h>
16653 #else
16654 #  include <strings.h>
16655 #endif
16656 #ifdef I_UNISTD
16657 #  include <unistd.h>  /* Needed for NetBSD */
16658 #endif
16659 int main()
16660 {
16661 char buf[128], abc[128];
16662 char *b;
16663 int len;
16664 int off;
16665 int align;
16666
16667 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16668    try to store the string in read-only memory. */
16669 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16670
16671 for (align = 7; align >= 0; align--) {
16672         for (len = 36; len; len--) {
16673                 b = buf+align;
16674                 bcopy(abc, b, len);
16675                 for (off = 1; off <= len; off++) {
16676                         bcopy(b, b+off, len);
16677                         bcopy(b+off, b, len);
16678                         if (bcmp(b, abc, len))
16679                                 exit(1);
16680                 }
16681         }
16682 }
16683 exit(0);
16684 }
16685 EOCP
16686                 set try
16687                 if eval $compile_ok; then
16688                         if $run ./try 2>/dev/null; then
16689                                 echo "Yes, it can."
16690                                 val="$define"
16691                         else
16692                                 echo "It can't, sorry."
16693                         fi
16694                 else
16695                         echo "(I can't compile the test program, so we'll assume not...)"
16696                 fi
16697                 ;;
16698         esac
16699         $rm_try
16700         ;;
16701 esac
16702 set d_safebcpy
16703 eval $setvar
16704
16705 : can memcpy handle overlapping blocks?
16706 echo " "
16707 val="$undef"
16708 case "$d_memmove" in
16709 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16710 *)      case "$d_memcpy" in
16711         "$define")
16712                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16713                 $cat >try.c <<EOCP
16714 #$i_memory I_MEMORY
16715 #$i_stdlib I_STDLIB
16716 #$i_string I_STRING
16717 #$i_unistd I_UNISTD
16718 EOCP
16719         $cat >>try.c <<'EOCP'
16720 #include <stdio.h>
16721 #ifdef I_MEMORY
16722 #  include <memory.h>
16723 #endif
16724 #ifdef I_STDLIB
16725 #  include <stdlib.h>
16726 #endif
16727 #ifdef I_STRING
16728 #  include <string.h>
16729 #else
16730 #  include <strings.h>
16731 #endif
16732 #ifdef I_UNISTD
16733 #  include <unistd.h>  /* Needed for NetBSD */
16734 #endif
16735 int main()
16736 {
16737 char buf[128], abc[128];
16738 char *b;
16739 int len;
16740 int off;
16741 int align;
16742
16743 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16744    try to store the string in read-only memory. */
16745 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16746
16747 for (align = 7; align >= 0; align--) {
16748         for (len = 36; len; len--) {
16749                 b = buf+align;
16750                 memcpy(b, abc, len);
16751                 for (off = 1; off <= len; off++) {
16752                         memcpy(b+off, b, len);
16753                         memcpy(b, b+off, len);
16754                         if (memcmp(b, abc, len))
16755                                 exit(1);
16756                 }
16757         }
16758 }
16759 exit(0);
16760 }
16761 EOCP
16762                 set try
16763                 if eval $compile_ok; then
16764                         if $run ./try 2>/dev/null; then
16765                                 echo "Yes, it can."
16766                                 val="$define"
16767                         else
16768                                 echo "It can't, sorry."
16769                         fi
16770                 else
16771                         echo "(I can't compile the test program, so we'll assume not...)"
16772                 fi
16773                 ;;
16774         esac
16775         $rm_try
16776         ;;
16777 esac
16778 set d_safemcpy
16779 eval $setvar
16780
16781 : can memcmp be trusted to compare relative magnitude?
16782 val="$undef"
16783 case "$d_memcmp" in
16784 "$define")
16785         echo " "
16786         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16787         $cat >try.c <<EOCP
16788 #$i_memory I_MEMORY
16789 #$i_stdlib I_STDLIB
16790 #$i_string I_STRING
16791 #$i_unistd I_UNISTD
16792 EOCP
16793         $cat >>try.c <<'EOCP'
16794 #include <stdio.h>
16795 #ifdef I_MEMORY
16796 #  include <memory.h>
16797 #endif
16798 #ifdef I_STDLIB
16799 #  include <stdlib.h>
16800 #endif
16801 #ifdef I_STRING
16802 #  include <string.h>
16803 #else
16804 #  include <strings.h>
16805 #endif
16806 #ifdef I_UNISTD
16807 #  include <unistd.h>  /* Needed for NetBSD */
16808 #endif
16809 int main()
16810 {
16811 char a = -1;
16812 char b = 0;
16813 if ((a < b) && memcmp(&a, &b, 1) < 0)
16814         exit(1);
16815 exit(0);
16816 }
16817 EOCP
16818         set try
16819         if eval $compile_ok; then
16820                 if $run ./try 2>/dev/null; then
16821                         echo "Yes, it can."
16822                         val="$define"
16823                 else
16824                         echo "No, it can't (it uses signed chars)."
16825                 fi
16826         else
16827                 echo "(I can't compile the test program, so we'll assume not...)"
16828         fi
16829         ;;
16830 esac
16831 $rm_try
16832 set d_sanemcmp
16833 eval $setvar
16834
16835 : see if prototype for sbrk is available
16836 echo " "
16837 set d_sbrkproto sbrk $i_unistd unistd.h
16838 eval $hasproto
16839
16840 : see if select exists
16841 set select d_select
16842 eval $inlibc
16843
16844 : see if semctl exists
16845 set semctl d_semctl
16846 eval $inlibc
16847
16848 : see if semget exists
16849 set semget d_semget
16850 eval $inlibc
16851
16852 : see if semop exists
16853 set semop d_semop
16854 eval $inlibc
16855
16856 : see how much of the 'sem*(2)' library is present.
16857 h_sem=true
16858 echo " "
16859 case "$d_semctl$d_semget$d_semop" in
16860 *"$undef"*) h_sem=false;;
16861 esac
16862 case "$osname" in
16863 freebsd)
16864     case "`ipcs 2>&1`" in
16865     "SVID messages"*"not configured"*)
16866         echo "Your $osname does not have the sem*(2) configured." >&4
16867         h_sem=false
16868         val="$undef"
16869         set semctl d_semctl
16870         eval $setvar
16871         set semget d_semget
16872         eval $setvar
16873         set semop d_semop
16874         eval $setvar
16875         ;;
16876     esac
16877     ;;
16878 esac
16879 : we could also check for sys/ipc.h ...
16880 if $h_sem && $test `./findhdr sys/sem.h`; then
16881         echo "You have the full sem*(2) library." >&4
16882         val="$define"
16883 else
16884         echo "You don't have the full sem*(2) library." >&4
16885         val="$undef"
16886 fi
16887 set d_sem
16888 eval $setvar
16889
16890 : see whether sys/sem.h defines union semun
16891 echo " "
16892 $cat > try.c <<'END'
16893 #include <sys/types.h>
16894 #include <sys/ipc.h>
16895 #include <sys/sem.h>
16896 int main () { union semun semun; semun.buf = 0; }
16897 END
16898 set try
16899 if eval $compile; then
16900     echo "You have union semun in <sys/sem.h>." >&4
16901     val="$define"
16902 else
16903     echo "You do not have union semun in <sys/sem.h>." >&4
16904     val="$undef"
16905 fi
16906 $rm_try
16907 set d_union_semun
16908 eval $setvar
16909
16910 : see how to do semctl IPC_STAT
16911 case "$d_sem" in
16912 $define)
16913     echo " "
16914     $cat > tryh.h <<END
16915 #ifndef S_IRUSR
16916 #   ifdef S_IREAD
16917 #       define S_IRUSR S_IREAD
16918 #       define S_IWUSR S_IWRITE
16919 #       define S_IXUSR S_IEXEC
16920 #   else
16921 #       define S_IRUSR 0400
16922 #       define S_IWUSR 0200
16923 #       define S_IXUSR 0100
16924 #   endif
16925 #   define S_IRGRP (S_IRUSR>>3)
16926 #   define S_IWGRP (S_IWUSR>>3)
16927 #   define S_IXGRP (S_IXUSR>>3)
16928 #   define S_IROTH (S_IRUSR>>6)
16929 #   define S_IWOTH (S_IWUSR>>6)
16930 #   define S_IXOTH (S_IXUSR>>6)
16931 #endif
16932 #ifndef S_IRWXU
16933 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16934 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16935 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16936 #endif
16937 END
16938     : see whether semctl IPC_STAT can use union semun
16939     case "$d_semctl_semun" in
16940     '')
16941       val="$undef"
16942       $cat > try.c <<END
16943 #include <sys/types.h>
16944 #include <sys/ipc.h>
16945 #include <sys/sem.h>
16946 #include <sys/stat.h>
16947 #include <stdio.h>
16948 #include <errno.h>
16949 #include "tryh.h"
16950 #ifndef errno
16951 extern int errno;
16952 #endif
16953 #$d_union_semun HAS_UNION_SEMUN
16954 int main() {
16955     union semun
16956 #ifndef HAS_UNION_SEMUN
16957     {
16958         int val;
16959         struct semid_ds *buf;
16960         unsigned short *array;
16961     }
16962 #endif
16963     arg;
16964     int sem, st;
16965
16966 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16967     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16968     if (sem > -1) {
16969         struct semid_ds argbuf;
16970         arg.buf = &argbuf;
16971 #       ifdef IPC_STAT
16972         st = semctl(sem, 0, IPC_STAT, arg);
16973         if (st == 0)
16974             printf("semun\n");
16975         else
16976 #       endif /* IPC_STAT */
16977             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16978 #       ifdef IPC_RMID
16979         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16980 #       endif /* IPC_RMID */
16981             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16982     } else
16983 #endif /* IPC_PRIVATE && ... */
16984         printf("semget failed: errno = %d\n", errno);
16985   return 0;
16986 }
16987 END
16988       set try
16989       if eval $compile; then
16990           xxx=`$run ./try`
16991           case "$xxx" in
16992           semun) val="$define" ;;
16993           esac
16994       fi
16995       $rm_try
16996       set d_semctl_semun
16997       eval $setvar
16998       ;;
16999     esac
17000     case "$d_semctl_semun" in
17001     $define)
17002         echo "You can use union semun for semctl IPC_STAT." >&4
17003         also='also'
17004         ;;
17005     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17006         also=''
17007         ;;
17008     esac
17009
17010     : see whether semctl IPC_STAT can use struct semid_ds pointer
17011     case "$d_semctl_semid_ds" in
17012     '')
17013       val="$undef"
17014       $cat > try.c <<'END'
17015 #include <sys/types.h>
17016 #include <sys/ipc.h>
17017 #include <sys/sem.h>
17018 #include <sys/stat.h>
17019 #include "tryh.h"
17020 #include <stdio.h>
17021 #include <errno.h>
17022 #ifndef errno
17023 extern int errno;
17024 #endif
17025 int main() {
17026     struct semid_ds arg;
17027     int sem, st;
17028
17029 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17030     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17031     if (sem > -1) {
17032 #       ifdef IPC_STAT
17033         st = semctl(sem, 0, IPC_STAT, &arg);
17034         if (st == 0)
17035             printf("semid_ds\n");
17036         else
17037 #       endif /* IPC_STAT */
17038             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17039 #       ifdef IPC_RMID
17040         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
17041 #       endif /* IPC_RMID */
17042             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17043     } else
17044 #endif /* IPC_PRIVATE && ... */
17045         printf("semget failed: errno = %d\n", errno);
17046
17047     return 0;
17048 }
17049 END
17050       set try
17051       if eval $compile; then
17052           xxx=`$run ./try`
17053           case "$xxx" in
17054           semid_ds) val="$define" ;;
17055           esac
17056       fi
17057       $rm_try
17058       set d_semctl_semid_ds
17059       eval $setvar
17060       ;;
17061     esac
17062     case "$d_semctl_semid_ds" in
17063     $define)
17064         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17065         ;;
17066     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17067         ;;
17068     esac
17069     ;;
17070 *)  val="$undef"
17071
17072     # We do not have the full sem*(2) library, so assume we can not
17073     # use either.
17074
17075     set d_semctl_semun
17076     eval $setvar
17077
17078     set d_semctl_semid_ds
17079     eval $setvar
17080     ;;
17081 esac
17082 $rm_try tryh.h
17083
17084 : see if sendmsg exists
17085 set sendmsg d_sendmsg
17086 eval $inlibc
17087
17088 : see if setegid exists
17089 set setegid d_setegid
17090 eval $inlibc
17091
17092 : see if seteuid exists
17093 set seteuid d_seteuid
17094 eval $inlibc
17095
17096 : see if setgrent exists
17097 set setgrent d_setgrent
17098 eval $inlibc
17099
17100 : see if setgrent_r exists
17101 set setgrent_r d_setgrent_r
17102 eval $inlibc
17103 case "$d_setgrent_r" in
17104 "$define")
17105         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17106         case "$d_setgrent_r_proto:$usethreads" in
17107         ":define")      d_setgrent_r_proto=define
17108                 set d_setgrent_r_proto setgrent_r $hdrs
17109                 eval $hasproto ;;
17110         *)      ;;
17111         esac
17112         case "$d_setgrent_r_proto" in
17113         define)
17114         case "$setgrent_r_proto" in
17115         ''|0) try='int setgrent_r(FILE**);'
17116         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17117         esac
17118         case "$setgrent_r_proto" in
17119         ''|0) try='void setgrent_r(FILE**);'
17120         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17121         esac
17122         case "$setgrent_r_proto" in
17123         ''|0)   d_setgrent_r=undef
17124                 setgrent_r_proto=0
17125                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17126         * )     case "$setgrent_r_proto" in
17127                 REENTRANT_PROTO*) ;;
17128                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17129                 esac
17130                 echo "Prototype: $try" ;;
17131         esac
17132         ;;
17133         *)      case "$usethreads" in
17134                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17135                 esac
17136                 d_setgrent_r=undef
17137                 setgrent_r_proto=0
17138                 ;;
17139         esac
17140         ;;
17141 *)      setgrent_r_proto=0
17142         ;;
17143 esac
17144
17145 : see if sethostent exists
17146 set sethostent d_sethent
17147 eval $inlibc
17148
17149 : see if sethostent_r exists
17150 set sethostent_r d_sethostent_r
17151 eval $inlibc
17152 case "$d_sethostent_r" in
17153 "$define")
17154         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17155         case "$d_sethostent_r_proto:$usethreads" in
17156         ":define")      d_sethostent_r_proto=define
17157                 set d_sethostent_r_proto sethostent_r $hdrs
17158                 eval $hasproto ;;
17159         *)      ;;
17160         esac
17161         case "$d_sethostent_r_proto" in
17162         define)
17163         case "$sethostent_r_proto" in
17164         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17165         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17166         esac
17167         case "$sethostent_r_proto" in
17168         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17169         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17170         esac
17171         case "$sethostent_r_proto" in
17172         ''|0)   d_sethostent_r=undef
17173                 sethostent_r_proto=0
17174                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17175         * )     case "$sethostent_r_proto" in
17176                 REENTRANT_PROTO*) ;;
17177                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17178                 esac
17179                 echo "Prototype: $try" ;;
17180         esac
17181         ;;
17182         *)      case "$usethreads" in
17183                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17184                 esac
17185                 d_sethostent_r=undef
17186                 sethostent_r_proto=0
17187                 ;;
17188         esac
17189         ;;
17190 *)      sethostent_r_proto=0
17191         ;;
17192 esac
17193
17194 : see if setitimer exists
17195 set setitimer d_setitimer
17196 eval $inlibc
17197
17198 : see if setlinebuf exists
17199 set setlinebuf d_setlinebuf
17200 eval $inlibc
17201
17202 : see if setlocale exists
17203 set setlocale d_setlocale
17204 eval $inlibc
17205
17206 : see if locale.h is available
17207 set locale.h i_locale
17208 eval $inhdr
17209
17210 : see if setlocale_r exists
17211 set setlocale_r d_setlocale_r
17212 eval $inlibc
17213 case "$d_setlocale_r" in
17214 "$define")
17215         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17216         case "$d_setlocale_r_proto:$usethreads" in
17217         ":define")      d_setlocale_r_proto=define
17218                 set d_setlocale_r_proto setlocale_r $hdrs
17219                 eval $hasproto ;;
17220         *)      ;;
17221         esac
17222         case "$d_setlocale_r_proto" in
17223         define)
17224         case "$setlocale_r_proto" in
17225         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17226         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17227         esac
17228         case "$setlocale_r_proto" in
17229         ''|0)   d_setlocale_r=undef
17230                 setlocale_r_proto=0
17231                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17232         * )     case "$setlocale_r_proto" in
17233                 REENTRANT_PROTO*) ;;
17234                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17235                 esac
17236                 echo "Prototype: $try" ;;
17237         esac
17238         ;;
17239         *)      case "$usethreads" in
17240                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17241                 esac
17242                 d_setlocale_r=undef
17243                 setlocale_r_proto=0
17244                 ;;
17245         esac
17246         ;;
17247 *)      setlocale_r_proto=0
17248         ;;
17249 esac
17250
17251 : see if setnetent exists
17252 set setnetent d_setnent
17253 eval $inlibc
17254
17255 : see if setnetent_r exists
17256 set setnetent_r d_setnetent_r
17257 eval $inlibc
17258 case "$d_setnetent_r" in
17259 "$define")
17260         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17261         case "$d_setnetent_r_proto:$usethreads" in
17262         ":define")      d_setnetent_r_proto=define
17263                 set d_setnetent_r_proto setnetent_r $hdrs
17264                 eval $hasproto ;;
17265         *)      ;;
17266         esac
17267         case "$d_setnetent_r_proto" in
17268         define)
17269         case "$setnetent_r_proto" in
17270         ''|0) try='int setnetent_r(int, struct netent_data*);'
17271         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17272         esac
17273         case "$setnetent_r_proto" in
17274         ''|0) try='void setnetent_r(int, struct netent_data*);'
17275         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17276         esac
17277         case "$setnetent_r_proto" in
17278         ''|0)   d_setnetent_r=undef
17279                 setnetent_r_proto=0
17280                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17281         * )     case "$setnetent_r_proto" in
17282                 REENTRANT_PROTO*) ;;
17283                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17284                 esac
17285                 echo "Prototype: $try" ;;
17286         esac
17287         ;;
17288         *)      case "$usethreads" in
17289                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17290                 esac
17291                 d_setnetent_r=undef
17292                 setnetent_r_proto=0
17293                 ;;
17294         esac
17295         ;;
17296 *)      setnetent_r_proto=0
17297         ;;
17298 esac
17299
17300 : see if setprotoent exists
17301 set setprotoent d_setpent
17302 eval $inlibc
17303
17304 : see if setpgid exists
17305 set setpgid d_setpgid
17306 eval $inlibc
17307
17308 : see if setpgrp2 exists
17309 set setpgrp2 d_setpgrp2
17310 eval $inlibc
17311
17312 : see if setpriority exists
17313 set setpriority d_setprior
17314 eval $inlibc
17315
17316 : see if setproctitle exists
17317 set setproctitle d_setproctitle
17318 eval $inlibc
17319
17320 : see if setprotoent_r exists
17321 set setprotoent_r d_setprotoent_r
17322 eval $inlibc
17323 case "$d_setprotoent_r" in
17324 "$define")
17325         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17326         case "$d_setprotoent_r_proto:$usethreads" in
17327         ":define")      d_setprotoent_r_proto=define
17328                 set d_setprotoent_r_proto setprotoent_r $hdrs
17329                 eval $hasproto ;;
17330         *)      ;;
17331         esac
17332         case "$d_setprotoent_r_proto" in
17333         define)
17334         case "$setprotoent_r_proto" in
17335         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17336         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17337         esac
17338         case "$setprotoent_r_proto" in
17339         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17340         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17341         esac
17342         case "$setprotoent_r_proto" in
17343         ''|0)   d_setprotoent_r=undef
17344                 setprotoent_r_proto=0
17345                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17346         * )     case "$setprotoent_r_proto" in
17347                 REENTRANT_PROTO*) ;;
17348                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17349                 esac
17350                 echo "Prototype: $try" ;;
17351         esac
17352         ;;
17353         *)      case "$usethreads" in
17354                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17355                 esac
17356                 d_setprotoent_r=undef
17357                 setprotoent_r_proto=0
17358                 ;;
17359         esac
17360         ;;
17361 *)      setprotoent_r_proto=0
17362         ;;
17363 esac
17364
17365 : see if setpwent exists
17366 set setpwent d_setpwent
17367 eval $inlibc
17368
17369 : see if setpwent_r exists
17370 set setpwent_r d_setpwent_r
17371 eval $inlibc
17372 case "$d_setpwent_r" in
17373 "$define")
17374         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17375         case "$d_setpwent_r_proto:$usethreads" in
17376         ":define")      d_setpwent_r_proto=define
17377                 set d_setpwent_r_proto setpwent_r $hdrs
17378                 eval $hasproto ;;
17379         *)      ;;
17380         esac
17381         case "$d_setpwent_r_proto" in
17382         define)
17383         case "$setpwent_r_proto" in
17384         ''|0) try='int setpwent_r(FILE**);'
17385         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17386         esac
17387         case "$setpwent_r_proto" in
17388         ''|0) try='void setpwent_r(FILE**);'
17389         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17390         esac
17391         case "$setpwent_r_proto" in
17392         ''|0)   d_setpwent_r=undef
17393                 setpwent_r_proto=0
17394                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17395         * )     case "$setpwent_r_proto" in
17396                 REENTRANT_PROTO*) ;;
17397                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17398                 esac
17399                 echo "Prototype: $try" ;;
17400         esac
17401         ;;
17402         *)      case "$usethreads" in
17403                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17404                 esac
17405                 d_setpwent_r=undef
17406                 setpwent_r_proto=0
17407                 ;;
17408         esac
17409         ;;
17410 *)      setpwent_r_proto=0
17411         ;;
17412 esac
17413
17414 : see if setregid exists
17415 set setregid d_setregid
17416 eval $inlibc
17417 set setresgid d_setresgid
17418 eval $inlibc
17419
17420 : see if setreuid exists
17421 set setreuid d_setreuid
17422 eval $inlibc
17423 set setresuid d_setresuid
17424 eval $inlibc
17425
17426 : see if setrgid exists
17427 set setrgid d_setrgid
17428 eval $inlibc
17429
17430 : see if setruid exists
17431 set setruid d_setruid
17432 eval $inlibc
17433
17434 : see if setservent exists
17435 set setservent d_setsent
17436 eval $inlibc
17437
17438 : see if setservent_r exists
17439 set setservent_r d_setservent_r
17440 eval $inlibc
17441 case "$d_setservent_r" in
17442 "$define")
17443         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17444         case "$d_setservent_r_proto:$usethreads" in
17445         ":define")      d_setservent_r_proto=define
17446                 set d_setservent_r_proto setservent_r $hdrs
17447                 eval $hasproto ;;
17448         *)      ;;
17449         esac
17450         case "$d_setservent_r_proto" in
17451         define)
17452         case "$setservent_r_proto" in
17453         ''|0) try='int setservent_r(int, struct servent_data*);'
17454         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17455         esac
17456         case "$setservent_r_proto" in
17457         ''|0) try='void setservent_r(int, struct servent_data*);'
17458         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17459         esac
17460         case "$setservent_r_proto" in
17461         ''|0)   d_setservent_r=undef
17462                 setservent_r_proto=0
17463                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17464         * )     case "$setservent_r_proto" in
17465                 REENTRANT_PROTO*) ;;
17466                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17467                 esac
17468                 echo "Prototype: $try" ;;
17469         esac
17470         ;;
17471         *)      case "$usethreads" in
17472                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17473                 esac
17474                 d_setservent_r=undef
17475                 setservent_r_proto=0
17476                 ;;
17477         esac
17478         ;;
17479 *)      setservent_r_proto=0
17480         ;;
17481 esac
17482
17483 : see if setsid exists
17484 set setsid d_setsid
17485 eval $inlibc
17486
17487 : see if setvbuf exists
17488 set setvbuf d_setvbuf
17489 eval $inlibc
17490
17491 : see if sfio.h is available
17492 set sfio.h i_sfio
17493 eval $inhdr
17494
17495 : see if sfio library is available
17496 case "$i_sfio" in
17497 $define)
17498         val=''
17499         set sfreserve val
17500         eval $inlibc
17501         ;;
17502 *)
17503         val="$undef"
17504         ;;
17505 esac
17506 : Ok, but do we want to use it.
17507 case "$val" in
17508 $define)
17509         case "$usesfio" in
17510         true|$define|[yY]*) dflt='y';;
17511         *) dflt='n';;
17512         esac
17513         echo "$package can use the sfio library, but it is experimental."
17514         rp="You seem to have sfio available, do you want to try using it?"
17515         . ./myread
17516         case "$ans" in
17517         y|Y)    echo "Ok, turning on sfio then."
17518                 val="$define"
17519                 ;;
17520         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17521                 val="$undef"
17522                 ;;
17523         esac
17524         ;;
17525 *)      case "$usesfio" in
17526         true|$define|[yY]*)
17527                 echo "Sorry, cannot find sfio on this machine." >&4
17528                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17529                 val="$undef"
17530                 ;;
17531         esac
17532         ;;
17533 esac
17534 set d_sfio
17535 eval $setvar
17536 case "$d_sfio" in
17537 $define) usesfio='true';;
17538 *) usesfio='false';;
17539 esac
17540 case "$d_sfio" in
17541 $define) ;;
17542 *)      : Remove sfio from list of libraries to use
17543         case "$libs" in
17544         *-lsfio*)
17545                 echo "Removing unneeded -lsfio from library list" >&4
17546                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17547                 shift
17548                 libs="$*"
17549                 echo "libs = $libs" >&4
17550                 ;;
17551         esac
17552 ;;
17553 esac
17554
17555
17556 : see if shmctl exists
17557 set shmctl d_shmctl
17558 eval $inlibc
17559
17560 : see if shmget exists
17561 set shmget d_shmget
17562 eval $inlibc
17563
17564 : see if shmat exists
17565 set shmat d_shmat
17566 eval $inlibc
17567 : see what shmat returns
17568 case "$d_shmat" in
17569 "$define")
17570         $cat >shmat.c <<'END'
17571 #include <sys/shm.h>
17572 void *shmat();
17573 END
17574         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17575                 shmattype='void *'
17576         else
17577                 shmattype='char *'
17578         fi
17579         echo "and it returns ($shmattype)." >&4
17580         : see if a prototype for shmat is available
17581         xxx=`./findhdr sys/shm.h`
17582         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17583         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17584                 val="$define"
17585         else
17586                 val="$undef"
17587         fi
17588         $rm -f shmat.[co]
17589         ;;
17590 *)
17591         val="$undef"
17592         ;;
17593 esac
17594 set d_shmatprototype
17595 eval $setvar
17596
17597 : see if shmdt exists
17598 set shmdt d_shmdt
17599 eval $inlibc
17600
17601 : see how much of the 'shm*(2)' library is present.
17602 h_shm=true
17603 echo " "
17604 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17605 *"$undef"*) h_shm=false;;
17606 esac
17607 case "$osname" in
17608 freebsd)
17609     case "`ipcs 2>&1`" in
17610     "SVID shared memory"*"not configured"*)
17611         echo "Your $osname does not have the shm*(2) configured." >&4
17612         h_shm=false
17613         val="$undef"
17614         set shmctl d_shmctl
17615         evat $setvar
17616         set shmget d_shmget
17617         evat $setvar
17618         set shmat d_shmat
17619         evat $setvar
17620         set shmdt d_shmdt
17621         evat $setvar
17622         ;;
17623     esac
17624     ;;
17625 esac
17626 : we could also check for sys/ipc.h ...
17627 if $h_shm && $test `./findhdr sys/shm.h`; then
17628         echo "You have the full shm*(2) library." >&4
17629         val="$define"
17630 else
17631         echo "You don't have the full shm*(2) library." >&4
17632         val="$undef"
17633 fi
17634 set d_shm
17635 eval $setvar
17636
17637 : see if we have sigaction
17638 echo " "
17639 if set sigaction val -f d_sigaction; eval $csym; $val; then
17640         echo 'sigaction() found.' >&4
17641         $cat > try.c <<EOP
17642 #include <stdio.h>
17643 #include <sys/types.h>
17644 #include <signal.h>
17645 #$i_stdlib I_STDLIB
17646 #ifdef I_STDLIB
17647 #include <stdlib.h>
17648 #endif
17649 int main()
17650 {
17651     struct sigaction act, oact;
17652     act.sa_flags = 0;
17653     oact.sa_handler = 0;
17654     /* so that act and oact are used */
17655     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17656 }
17657 EOP
17658         set try
17659         if eval $compile_ok; then
17660                 val="$define"
17661         else
17662                 echo "But you don't seem to have a usable struct sigaction." >&4
17663                 val="$undef"
17664         fi
17665 else
17666         echo 'sigaction NOT found.' >&4
17667         val="$undef"
17668 fi
17669 set d_sigaction; eval $setvar
17670 $rm_try
17671
17672 : see if this is a sunmath.h system
17673 set sunmath.h i_sunmath
17674 eval $inhdr
17675
17676 : see if signbit exists
17677 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17678 $cat >try.c <<EOCP
17679 #$i_math I_MATH
17680 #$i_sunmath I_SUNMATH
17681 #ifdef I_MATH
17682 #  include <math.h>
17683 #endif
17684 #ifdef I_SUNMATH  /* Solaris special math library */
17685 #  include <sunmath.h>
17686 #endif
17687 #define NV $nvtype
17688 int main(int argc, char **argv)
17689 {
17690     NV x = 0.0;
17691     NV y = -0.0;
17692     if ((signbit(x) == 0) && (signbit(y) != 0))
17693         return 0;
17694     else
17695         return 1;
17696 }
17697 EOCP
17698 val="$undef"
17699 set try
17700 if eval $compile; then
17701     if $run ./try; then
17702         $echo "Yes." >&4
17703         val="$define"
17704     else
17705         $echo "Signbit seems to be available, but doesn't work as I expected."
17706         $echo "I won't use it." >&4
17707         val="$undef"
17708     fi
17709 else
17710     $echo "Nope." >&4
17711     dflt="$undef"
17712 fi
17713 set d_signbit
17714 eval $setvar
17715 $rm_try
17716
17717 : see if sigprocmask exists
17718 set sigprocmask d_sigprocmask
17719 eval $inlibc
17720
17721 : see if sigsetjmp exists
17722 echo " "
17723 case "$d_sigsetjmp" in
17724 '')
17725         $cat >try.c <<EOP
17726 #include <setjmp.h>
17727 #$i_stdlib I_STDLIB
17728 #ifdef I_STDLIB
17729 #include <stdlib.h>
17730 #endif
17731 sigjmp_buf env;
17732 int set = 1;
17733 int main()
17734 {
17735         if (sigsetjmp(env,1))
17736                 exit(set);
17737         set = 0;
17738         siglongjmp(env, 1);
17739         exit(1);
17740 }
17741 EOP
17742         set try
17743         if eval $compile; then
17744                 if $run ./try >/dev/null 2>&1; then
17745                         echo "POSIX sigsetjmp found." >&4
17746                         val="$define"
17747                 else
17748                         $cat >&4 <<EOM
17749 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17750 I'll ignore them.
17751 EOM
17752                         val="$undef"
17753                 fi
17754         else
17755                 echo "sigsetjmp not found." >&4
17756                 val="$undef"
17757         fi
17758         ;;
17759 *) val="$d_sigsetjmp"
17760         case "$d_sigsetjmp" in
17761         $define) echo "POSIX sigsetjmp found." >&4;;
17762         $undef) echo "sigsetjmp not found." >&4;;
17763         esac
17764         ;;
17765 esac
17766 set d_sigsetjmp
17767 eval $setvar
17768 $rm_try
17769
17770 : see if snprintf exists
17771 set snprintf d_snprintf
17772 eval $inlibc
17773
17774 : see if vsnprintf exists
17775 set vsnprintf d_vsnprintf
17776 eval $inlibc
17777
17778 case "$d_snprintf-$d_vsnprintf" in
17779 "$define-$define")
17780     $cat <<EOM
17781 Checking whether your snprintf() and vsnprintf() work okay...
17782 EOM
17783     $cat >try.c <<'EOCP'
17784 /* v?snprintf testing logic courtesy of Russ Allbery.
17785  * According to C99:
17786  * - if the buffer is too short it still must be \0-terminated
17787  * - if the buffer is too short the potentially required length
17788  *   must be returned and not -1
17789  * - if the buffer is NULL the potentially required length
17790  *   must be returned and not -1 or core dump
17791  */
17792 #include <stdio.h>
17793 #include <stdarg.h>
17794
17795 char buf[2];
17796
17797 int test (char *format, ...)
17798 {
17799     va_list args;
17800     int count;
17801
17802     va_start (args, format);
17803     count = vsnprintf (buf, sizeof buf, format, args);
17804     va_end (args);
17805     return count;
17806 }
17807
17808 int main ()
17809 {
17810     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17811              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17812 }
17813 EOCP
17814     set try
17815     if eval $compile; then
17816         `$run ./try`
17817         case "$?" in
17818         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17819         *) cat <<EOM >&4
17820 Your snprintf() and snprintf() don't seem to be working okay.
17821 EOM
17822            d_snprintf="$undef"
17823            d_vsnprintf="$undef"
17824            ;;
17825         esac
17826     else
17827         echo "(I can't seem to compile the test program--assuming they don't)"
17828         d_snprintf="$undef"
17829         d_vsnprintf="$undef"
17830     fi
17831     $rm_try
17832     ;;
17833 esac
17834
17835 : see if sockatmark exists
17836 set sockatmark d_sockatmark
17837 eval $inlibc
17838
17839 : see if prototype for sockatmark is available
17840 echo " "
17841 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17842 eval $hasproto
17843
17844 : see if socks5_init exists
17845 set socks5_init d_socks5_init
17846 eval $inlibc
17847
17848 : see if sprintf returns the length of the string in the buffer as per ANSI
17849 $echo "Checking whether sprintf returns the length of the string..." >&4
17850 $cat <<EOP >try.c
17851 #include <stdio.h>
17852 #$i_stdlib I_STDLIB
17853 #ifdef I_STDLIB
17854 #include <stdlib.h>
17855 #endif
17856 #$i_string I_STRING
17857 #ifdef I_STRING
17858 #  include <string.h>
17859 #else
17860 #  include <strings.h>
17861 #endif
17862 #$i_math I_MATH
17863 #ifdef I_MATH
17864 #include <math.h>
17865 #endif
17866
17867 char buffer[256];
17868
17869 int check (size_t expect, int test) {
17870   size_t got = strlen(buffer);
17871   if (expect == got)
17872     return 0;
17873
17874   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17875        test, buffer);
17876   exit (test);
17877 }
17878
17879 int main(int argc, char **argv) {
17880   int test = 0;
17881
17882   check(sprintf(buffer, ""), ++test);
17883   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17884   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17885
17886   return 0;
17887 }
17888 EOP
17889 set try
17890
17891 if eval $compile; then
17892     xxx="`$run ./try`"
17893     case "$?" in
17894         0) cat >&4 <<EOM
17895 sprintf returns the length of the string (as ANSI says it should)
17896 EOM
17897         d_sprintf_returns_strlen="$define"
17898         ;;
17899         *) cat >&4 <<EOM
17900 sprintf does not return the length of the string (how old is this system?)
17901 EOM
17902         d_sprintf_returns_strlen="$undef"
17903         ;;
17904     esac
17905 else
17906     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17907     d_sprintf_returns_strlen="$undef"
17908 fi
17909 $rm_try
17910
17911 : see if srand48_r exists
17912 set srand48_r d_srand48_r
17913 eval $inlibc
17914 case "$d_srand48_r" in
17915 "$define")
17916         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17917         case "$d_srand48_r_proto:$usethreads" in
17918         ":define")      d_srand48_r_proto=define
17919                 set d_srand48_r_proto srand48_r $hdrs
17920                 eval $hasproto ;;
17921         *)      ;;
17922         esac
17923         case "$d_srand48_r_proto" in
17924         define)
17925         case "$srand48_r_proto" in
17926         ''|0) try='int srand48_r(long, struct drand48_data*);'
17927         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17928         esac
17929         case "$srand48_r_proto" in
17930         ''|0)   d_srand48_r=undef
17931                 srand48_r_proto=0
17932                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17933         * )     case "$srand48_r_proto" in
17934                 REENTRANT_PROTO*) ;;
17935                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17936                 esac
17937                 echo "Prototype: $try" ;;
17938         esac
17939         ;;
17940         *)      case "$usethreads" in
17941                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17942                 esac
17943                 d_srand48_r=undef
17944                 srand48_r_proto=0
17945                 ;;
17946         esac
17947         ;;
17948 *)      srand48_r_proto=0
17949         ;;
17950 esac
17951
17952 : see if srandom_r exists
17953 set srandom_r d_srandom_r
17954 eval $inlibc
17955 case "$d_srandom_r" in
17956 "$define")
17957         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17958         case "$d_srandom_r_proto:$usethreads" in
17959         ":define")      d_srandom_r_proto=define
17960                 set d_srandom_r_proto srandom_r $hdrs
17961                 eval $hasproto ;;
17962         *)      ;;
17963         esac
17964         case "$d_srandom_r_proto" in
17965         define)
17966         case "$srandom_r_proto" in
17967         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17968         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17969         esac
17970         case "$srandom_r_proto" in
17971         ''|0)   d_srandom_r=undef
17972                 srandom_r_proto=0
17973                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17974         * )     case "$srandom_r_proto" in
17975                 REENTRANT_PROTO*) ;;
17976                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17977                 esac
17978                 echo "Prototype: $try" ;;
17979         esac
17980         ;;
17981         *)      case "$usethreads" in
17982                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17983                 esac
17984                 d_srandom_r=undef
17985                 srandom_r_proto=0
17986                 ;;
17987         esac
17988         ;;
17989 *)      srandom_r_proto=0
17990         ;;
17991 esac
17992
17993 : see if prototype for setresgid is available
17994 echo " "
17995 set d_sresgproto setresgid $i_unistd unistd.h
17996 eval $hasproto
17997
17998 : see if prototype for setresuid is available
17999 echo " "
18000 set d_sresuproto setresuid $i_unistd unistd.h
18001 eval $hasproto
18002
18003 : see if sys/stat.h is available
18004 set sys/stat.h i_sysstat
18005 eval $inhdr
18006
18007 : see if stat knows about block sizes
18008 echo " "
18009 echo "Checking to see if your struct stat has st_blocks field..." >&4
18010 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18011 eval $hasfield
18012
18013 : see if this is a sys/vfs.h system
18014 set sys/vfs.h i_sysvfs
18015 eval $inhdr
18016
18017 : see if this is a sys/statfs.h system
18018 set sys/statfs.h i_sysstatfs
18019 eval $inhdr
18020
18021 : Check for statfs_s
18022 echo " "
18023 echo "Checking to see if your system supports struct statfs..." >&4
18024 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
18025 eval $hasstruct
18026 case "$d_statfs_s" in
18027 "$define")      echo "Yes, it does."   ;;
18028 *)              echo "No, it doesn't." ;;
18029 esac
18030
18031
18032 : see if struct statfs knows about f_flags
18033 case "$d_statfs_s" in
18034 define)
18035         echo " "
18036         echo "Checking to see if your struct statfs has f_flags field..." >&4
18037         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
18038         eval $hasfield
18039         ;;
18040 *)      val="$undef"
18041         set d_statfs_f_flags
18042         eval $setvar
18043         ;;
18044 esac
18045 case "$d_statfs_f_flags" in
18046 "$define")      echo "Yes, it does."   ;;
18047 *)              echo "No, it doesn't." ;;
18048 esac
18049
18050 : see what flavor, if any, of static inline is supported
18051 echo " "
18052 echo "Checking to see if your system supports static inline..."
18053 $cat > try.c <<'EOCP'
18054 #include <stdlib.h>
18055 extern int f_via_a(int x);
18056 extern int f_via_b(int x);
18057 int main(int argc, char **argv)
18058 {
18059     int y;
18060
18061     y = f_via_a(0);
18062 #ifdef USE_B
18063     y = f_via_b(0);
18064 #endif
18065     if (y == 42) {
18066         return EXIT_SUCCESS;
18067     }
18068     else {
18069         return EXIT_FAILURE;
18070     }
18071 }
18072 EOCP
18073 $cat > a.c <<'EOCP'
18074 static INLINE int f(int x) {
18075     int y;
18076     y = x + 42;
18077     return y;
18078 }
18079
18080 int f_via_a(int x)
18081 {
18082     return f(x);
18083 }
18084 EOCP
18085 $cat > b.c <<'EOCP'
18086 extern int f(int x);
18087
18088 int f_via_b(int x)
18089 {
18090     return f(x);
18091 }
18092 EOCP
18093
18094 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18095 case "$perl_static_inline" in
18096 '')     # Check the various possibilities, and break out on success.
18097         # For gcc, prefer __inline__, which will still permit
18098         # cflags.SH to add in -ansi.
18099         case "$gccversion" in
18100                 '') xxx="inline __inline__ __inline _inline";;
18101                 *)  xxx="__inline__ inline __inline _inline";;
18102         esac
18103         for inline in $xxx; do
18104                 set try -DINLINE=$inline a.c
18105                 if eval $compile && $run ./try; then
18106                         # Now make sure there is no external linkage of static
18107                         # functions
18108                         set try -DINLINE=$inline -DUSE_B a.c b.c
18109                         if eval $compile && $run ./try; then
18110                                 $echo "Your compiler supports static $inline, " >&4
18111                                 $echo "but it also creates an external definition," >&4
18112                                 $echo "so I won't use it." >&4
18113                                 val=$undef
18114                         else
18115                                 $echo "Your compiler supports static $inline." >&4
18116                                 val=$define
18117                                 perl_static_inline="static $inline";
18118                                 break;
18119                         fi
18120                 else
18121                         $echo "Your compiler does NOT support static $inline." >&4
18122                         val="$undef"
18123                 fi
18124         done
18125         ;;
18126 *inline*) # Some variant of inline exists.
18127         echo "Keeping your $hint value of $perl_static_inline."
18128         val=$define
18129         ;;
18130 static)  # No inline capabilities
18131         echo "Keeping your $hint value of $perl_static_inline."
18132         val=$undef
18133         ;;
18134 *)  # Unrecognized previous value -- blindly trust the supplied
18135         # value and hope it makes sense.  Use old value for
18136         # d_static_inline, if there is one.
18137         echo "Keeping your $hint value of $perl_static_inline."
18138         case "$d_static_inline" in
18139                 '') val=$define ;;
18140                 *)  val=$d_static_inline ;;
18141         esac
18142         ;;
18143 esac
18144 # Fallback to plain 'static' if nothing worked.
18145 case "$perl_static_inline" in
18146 '')
18147         perl_static_inline="static"
18148         val=$undef
18149         ;;
18150 esac
18151 set d_static_inline
18152 eval $setvar
18153 $rm -f a.[co] b.[co]
18154 $rm_try
18155
18156 : Check stream access
18157 $cat >&4 <<EOM
18158 Checking how to access stdio streams by file descriptor number...
18159 EOM
18160 case "$stdio_stream_array" in
18161 '')     $cat >try.c <<EOCP
18162 #include <stdio.h>
18163 int main() {
18164   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18165     printf("yes\n");
18166 }
18167 EOCP
18168         for s in _iob __iob __sF
18169         do
18170                 set try -DSTDIO_STREAM_ARRAY=$s
18171                 if eval $compile; then
18172                         case "`$run ./try`" in
18173                         yes)    stdio_stream_array=$s; break ;;
18174                         esac
18175                 fi
18176         done
18177         $rm_try
18178 esac
18179 case "$stdio_stream_array" in
18180 '')     $cat >&4 <<EOM
18181 I can't figure out how to access stdio streams by file descriptor number.
18182 EOM
18183         d_stdio_stream_array="$undef"
18184         ;;
18185 *)      $cat >&4 <<EOM
18186 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18187 EOM
18188         d_stdio_stream_array="$define"
18189         ;;
18190 esac
18191
18192 : see if strcoll exists
18193 set strcoll d_strcoll
18194 eval $inlibc
18195
18196 : check for structure copying
18197 echo " "
18198 echo "Checking to see if your C compiler can copy structs..." >&4
18199 $cat >try.c <<'EOCP'
18200 int main()
18201 {
18202         struct blurfl {
18203                 int dyick;
18204         } foo, bar;
18205
18206         foo = bar;
18207 }
18208 EOCP
18209 if $cc -c try.c >/dev/null 2>&1 ; then
18210         val="$define"
18211         echo "Yup, it can."
18212 else
18213         val="$undef"
18214         echo "Nope, it can't."
18215 fi
18216 set d_strctcpy
18217 eval $setvar
18218 $rm_try
18219
18220 : see if strerror and/or sys_errlist[] exist
18221 echo " "
18222 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18223     if set strerror val -f d_strerror; eval $csym; $val; then
18224                 echo 'strerror() found.' >&4
18225                 d_strerror="$define"
18226                 d_strerrm='strerror(e)'
18227                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18228                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
18229                         d_syserrlst="$define"
18230                 else
18231                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
18232                         d_syserrlst="$undef"
18233                 fi
18234     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18235                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18236                 echo 'strerror() found in string header.' >&4
18237                 d_strerror="$define"
18238                 d_strerrm='strerror(e)'
18239                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18240                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18241                                 d_syserrlst="$define"
18242                 else
18243                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
18244                         d_syserrlst="$undef"
18245                 fi
18246     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18247                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18248                 d_strerror="$undef"
18249                 d_syserrlst="$define"
18250                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18251     else
18252                 echo 'strerror() and sys_errlist[] NOT found.' >&4
18253                 d_strerror="$undef"
18254                 d_syserrlst="$undef"
18255                 d_strerrm='"unknown"'
18256     fi
18257 fi
18258
18259 : see if strerror_r exists
18260 set strerror_r d_strerror_r
18261 eval $inlibc
18262 case "$d_strerror_r" in
18263 "$define")
18264         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18265         case "$d_strerror_r_proto:$usethreads" in
18266         ":define")      d_strerror_r_proto=define
18267                 set d_strerror_r_proto strerror_r $hdrs
18268                 eval $hasproto ;;
18269         *)      ;;
18270         esac
18271         case "$d_strerror_r_proto" in
18272         define)
18273         case "$strerror_r_proto" in
18274         ''|0) try='int strerror_r(int, char*, size_t);'
18275         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18276         esac
18277         case "$strerror_r_proto" in
18278         ''|0) try='int strerror_r(int, char*, int);'
18279         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18280         esac
18281         case "$strerror_r_proto" in
18282         ''|0) try='char* strerror_r(int, char*, size_t);'
18283         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18284         esac
18285         case "$strerror_r_proto" in
18286         ''|0)   d_strerror_r=undef
18287                 strerror_r_proto=0
18288                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18289         * )     case "$strerror_r_proto" in
18290                 REENTRANT_PROTO*) ;;
18291                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18292                 esac
18293                 echo "Prototype: $try" ;;
18294         esac
18295         ;;
18296         *)      case "$usethreads" in
18297                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18298                 esac
18299                 d_strerror_r=undef
18300                 strerror_r_proto=0
18301                 ;;
18302         esac
18303         ;;
18304 *)      strerror_r_proto=0
18305         ;;
18306 esac
18307
18308 : see if strftime exists
18309 set strftime d_strftime
18310 eval $inlibc
18311
18312 : see if strlcat exists
18313 set strlcat d_strlcat
18314 eval $inlibc
18315
18316 : see if strlcpy exists
18317 set strlcpy d_strlcpy
18318 eval $inlibc
18319
18320 : see if strtod exists
18321 set strtod d_strtod
18322 eval $inlibc
18323
18324 : see if strtol exists
18325 set strtol d_strtol
18326 eval $inlibc
18327
18328 : see if strtold exists
18329 set strtold d_strtold
18330 eval $inlibc
18331
18332 : see if strtoll exists
18333 set strtoll d_strtoll
18334 eval $inlibc
18335
18336 case "$d_longlong-$d_strtoll" in
18337 "$define-$define")
18338         $cat <<EOM
18339 Checking whether your strtoll() works okay...
18340 EOM
18341         $cat >try.c <<'EOCP'
18342 #include <errno.h>
18343 #ifdef __hpux
18344 #define strtoll __strtoll
18345 #endif
18346 #ifdef __EMX__
18347 #define strtoll _strtoll
18348 #endif
18349 #include <stdio.h>
18350 extern long long int strtoll(char *s, char **, int);
18351 static int bad = 0;
18352 int check(char *s, long long ell, int een) {
18353         long long gll;
18354         errno = 0;
18355         gll = strtoll(s, 0, 10);
18356         if (!((gll == ell) && (errno == een)))
18357                 bad++;
18358 }
18359 int main() {
18360         check(" 1",                                      1LL, 0);
18361         check(" 0",                                      0LL, 0);
18362         check("-1",                                     -1LL, 0);
18363         check("-9223372036854775808", -9223372036854775808LL, 0);
18364         check("-9223372036854775808", -9223372036854775808LL, 0);
18365         check(" 9223372036854775807",  9223372036854775807LL, 0);
18366         check("-9223372036854775808", -9223372036854775808LL, 0);
18367         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18368         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18369         if (!bad)
18370                 printf("ok\n");
18371 }
18372 EOCP
18373         set try
18374         if eval $compile; then
18375                 yyy=`$run ./try`
18376                 case "$yyy" in
18377                 ok) echo "Your strtoll() seems to be working okay." ;;
18378                 *) cat <<EOM >&4
18379 Your strtoll() doesn't seem to be working okay.
18380 EOM
18381                    d_strtoll="$undef"
18382                    ;;
18383                 esac
18384         else
18385                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18386                 d_strtoll="$undef"
18387         fi
18388         ;;
18389 esac
18390
18391 : see if strtoq exists
18392 set strtoq d_strtoq
18393 eval $inlibc
18394
18395 : see if strtoul exists
18396 set strtoul d_strtoul
18397 eval $inlibc
18398
18399 case "$d_strtoul" in
18400 "$define")
18401         $cat <<EOM
18402 Checking whether your strtoul() works okay...
18403 EOM
18404         $cat >try.c <<'EOCP'
18405 #include <errno.h>
18406 #include <stdio.h>
18407 extern unsigned long int strtoul(char *s, char **, int);
18408 static int bad = 0;
18409 void check(char *s, unsigned long eul, int een) {
18410         unsigned long gul;
18411         errno = 0;
18412         gul = strtoul(s, 0, 10);
18413         if (!((gul == eul) && (errno == een)))
18414                 bad++;
18415 }
18416 int main() {
18417         check(" 1", 1L, 0);
18418         check(" 0", 0L, 0);
18419 EOCP
18420         case "$longsize" in
18421         8)
18422             $cat >>try.c <<'EOCP'
18423         check("18446744073709551615", 18446744073709551615UL, 0);
18424         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18425 #if 0 /* strtoul() for /^-/ strings is undefined. */
18426         check("-1", 18446744073709551615UL, 0);
18427         check("-18446744073709551614", 2, 0);
18428         check("-18446744073709551615", 1, 0);
18429         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18430         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18431 #endif
18432 EOCP
18433                 ;;
18434         4)
18435                     $cat >>try.c <<'EOCP'
18436         check("4294967295", 4294967295UL, 0);
18437         check("4294967296", 4294967295UL, ERANGE);
18438 #if 0 /* strtoul() for /^-/ strings is undefined. */
18439         check("-1", 4294967295UL, 0);
18440         check("-4294967294", 2, 0);
18441         check("-4294967295", 1, 0);
18442         check("-4294967296", 4294967295UL, ERANGE);
18443         check("-4294967297", 4294967295UL, ERANGE);
18444 #endif
18445 EOCP
18446                 ;;
18447         *)
18448 : Should we write these tests to be more portable by sprintf-ing
18449 : ~0 and then manipulating that char string as input for strtol?
18450                 ;;
18451         esac
18452         $cat >>try.c <<'EOCP'
18453         if (!bad)
18454                 printf("ok\n");
18455         return 0;
18456 }
18457 EOCP
18458         set try
18459         if eval $compile; then
18460                 case "`$run ./try`" in
18461                 ok) echo "Your strtoul() seems to be working okay." ;;
18462                 *) cat <<EOM >&4
18463 Your strtoul() doesn't seem to be working okay.
18464 EOM
18465                    d_strtoul="$undef"
18466                    ;;
18467                 esac
18468         else
18469                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18470                 d_strtoul="$undef"
18471         fi
18472         ;;
18473 esac
18474
18475 : see if strtoull exists
18476 set strtoull d_strtoull
18477 eval $inlibc
18478
18479 case "$d_longlong-$d_strtoull" in
18480 "$define-$define")
18481         $cat <<EOM
18482 Checking whether your strtoull() works okay...
18483 EOM
18484         $cat >try.c <<'EOCP'
18485 #include <errno.h>
18486 #ifdef __hpux
18487 #define strtoull __strtoull
18488 #endif
18489 #include <stdio.h>
18490 extern unsigned long long int strtoull(char *s, char **, int);
18491 static int bad = 0;
18492 int check(char *s, long long eull, int een) {
18493         long long gull;
18494         errno = 0;
18495         gull = strtoull(s, 0, 10);
18496         if (!((gull == eull) && (errno == een)))
18497                 bad++;
18498 }
18499 int main() {
18500         check(" 1",                                        1LL, 0);
18501         check(" 0",                                        0LL, 0);
18502         check("18446744073709551615",  18446744073709551615ULL, 0);
18503         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18504 #if 0 /* strtoull() for /^-/ strings is undefined. */
18505         check("-1",                    18446744073709551615ULL, 0);
18506         check("-18446744073709551614",                     2LL, 0);
18507         check("-18446744073709551615",                     1LL, 0);
18508         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18509         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18510 #endif
18511         if (!bad)
18512                 printf("ok\n");
18513 }
18514 EOCP
18515         set try
18516         if eval $compile; then
18517                 case "`$run ./try`" in
18518                 ok) echo "Your strtoull() seems to be working okay." ;;
18519                 *) cat <<EOM >&4
18520 Your strtoull() doesn't seem to be working okay.
18521 EOM
18522                    d_strtoull="$undef"
18523                    ;;
18524                 esac
18525         else
18526                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18527                 d_strtoull="$undef"
18528         fi
18529         ;;
18530 esac
18531
18532 : see if strtouq exists
18533 set strtouq d_strtouq
18534 eval $inlibc
18535
18536 case "$d_strtouq" in
18537 "$define")
18538         $cat <<EOM
18539 Checking whether your strtouq() works okay...
18540 EOM
18541         $cat >try.c <<'EOCP'
18542 #include <errno.h>
18543 #include <stdio.h>
18544 extern unsigned long long int strtouq(char *s, char **, int);
18545 static int bad = 0;
18546 void check(char *s, unsigned long long eull, int een) {
18547         unsigned long long gull;
18548         errno = 0;
18549         gull = strtouq(s, 0, 10);
18550         if (!((gull == eull) && (errno == een)))
18551                 bad++;
18552 }
18553 int main() {
18554         check(" 1",                                        1LL, 0);
18555         check(" 0",                                        0LL, 0);
18556         check("18446744073709551615",  18446744073709551615ULL, 0);
18557         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18558 #if 0 /* strtouq() for /^-/ strings is undefined. */
18559         check("-1",                    18446744073709551615ULL, 0);
18560         check("-18446744073709551614",                     2LL, 0);
18561         check("-18446744073709551615",                     1LL, 0);
18562         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18563         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18564 #endif
18565         if (!bad)
18566                 printf("ok\n");
18567         return 0;
18568 }
18569 EOCP
18570         set try
18571         if eval $compile; then
18572                 case "`$run ./try`" in
18573                 ok) echo "Your strtouq() seems to be working okay." ;;
18574                 *) cat <<EOM >&4
18575 Your strtouq() doesn't seem to be working okay.
18576 EOM
18577                    d_strtouq="$undef"
18578                    ;;
18579                 esac
18580         else
18581                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18582                 d_strtouq="$undef"
18583         fi
18584         ;;
18585 esac
18586
18587 : see if strxfrm exists
18588 set strxfrm d_strxfrm
18589 eval $inlibc
18590
18591 : see if symlink exists
18592 set symlink d_symlink
18593 eval $inlibc
18594
18595 : see if syscall exists
18596 set syscall d_syscall
18597 eval $inlibc
18598
18599 : see if prototype for syscall is available
18600 echo " "
18601 set d_syscallproto syscall $i_unistd unistd.h
18602 eval $hasproto
18603
18604 : see if sysconf exists
18605 set sysconf d_sysconf
18606 eval $inlibc
18607
18608 : see if system exists
18609 set system d_system
18610 eval $inlibc
18611
18612 : see if tcgetpgrp exists
18613 set tcgetpgrp d_tcgetpgrp
18614 eval $inlibc
18615
18616 : see if tcsetpgrp exists
18617 set tcsetpgrp d_tcsetpgrp
18618 eval $inlibc
18619
18620 : see if prototype for telldir is available
18621 echo " "
18622 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18623 eval $hasproto
18624
18625 : see if time exists
18626 echo " "
18627 if test "X$d_time" = X -o X"$timetype" = X; then
18628     if set time val -f d_time; eval $csym; $val; then
18629                 echo 'time() found.' >&4
18630                 val="$define"
18631                 rp="What is the type returned by time() on this system?"
18632                 set time_t timetype long stdio.h sys/types.h
18633                 eval $typedef_ask
18634     else
18635                 echo 'time() not found, hope that will do.' >&4
18636                 val="$undef"
18637                 timetype='int';
18638     fi
18639     set d_time
18640     eval $setvar
18641 fi
18642
18643 : see if timegm exists
18644 set timegm d_timegm
18645 eval $inlibc
18646
18647 : see if this is a sys/times.h system
18648 set sys/times.h i_systimes
18649 eval $inhdr
18650
18651 : see if times exists
18652 echo " "
18653 if set times val -f d_times; eval $csym; $val; then
18654         echo 'times() found.' >&4
18655         d_times="$define"
18656         inc=''
18657         case "$i_systimes" in
18658         "$define") inc='sys/times.h';;
18659         esac
18660         rp="What is the type returned by times() on this system?"
18661         set clock_t clocktype long stdio.h sys/types.h $inc
18662         eval $typedef_ask
18663 else
18664         echo 'times() NOT found, hope that will do.' >&4
18665         d_times="$undef"
18666         clocktype='int'
18667 fi
18668
18669 : see if tmpnam_r exists
18670 set tmpnam_r d_tmpnam_r
18671 eval $inlibc
18672 case "$d_tmpnam_r" in
18673 "$define")
18674         hdrs="$i_systypes sys/types.h define stdio.h "
18675         case "$d_tmpnam_r_proto:$usethreads" in
18676         ":define")      d_tmpnam_r_proto=define
18677                 set d_tmpnam_r_proto tmpnam_r $hdrs
18678                 eval $hasproto ;;
18679         *)      ;;
18680         esac
18681         case "$d_tmpnam_r_proto" in
18682         define)
18683         case "$tmpnam_r_proto" in
18684         ''|0) try='char* tmpnam_r(char*);'
18685         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18686         esac
18687         case "$tmpnam_r_proto" in
18688         ''|0)   d_tmpnam_r=undef
18689                 tmpnam_r_proto=0
18690                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18691         * )     case "$tmpnam_r_proto" in
18692                 REENTRANT_PROTO*) ;;
18693                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18694                 esac
18695                 echo "Prototype: $try" ;;
18696         esac
18697         ;;
18698         *)      case "$usethreads" in
18699                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18700                 esac
18701                 d_tmpnam_r=undef
18702                 tmpnam_r_proto=0
18703                 ;;
18704         esac
18705         ;;
18706 *)      tmpnam_r_proto=0
18707         ;;
18708 esac
18709
18710 : see if truncate exists
18711 set truncate d_truncate
18712 eval $inlibc
18713
18714 : see if ttyname_r exists
18715 set ttyname_r d_ttyname_r
18716 eval $inlibc
18717 case "$d_ttyname_r" in
18718 "$define")
18719         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18720         case "$d_ttyname_r_proto:$usethreads" in
18721         ":define")      d_ttyname_r_proto=define
18722                 set d_ttyname_r_proto ttyname_r $hdrs
18723                 eval $hasproto ;;
18724         *)      ;;
18725         esac
18726         case "$d_ttyname_r_proto" in
18727         define)
18728         case "$ttyname_r_proto" in
18729         ''|0) try='int ttyname_r(int, char*, size_t);'
18730         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18731         esac
18732         case "$ttyname_r_proto" in
18733         ''|0) try='int ttyname_r(int, char*, int);'
18734         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18735         esac
18736         case "$ttyname_r_proto" in
18737         ''|0) try='char* ttyname_r(int, char*, int);'
18738         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18739         esac
18740         case "$ttyname_r_proto" in
18741         ''|0)   d_ttyname_r=undef
18742                 ttyname_r_proto=0
18743                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18744         * )     case "$ttyname_r_proto" in
18745                 REENTRANT_PROTO*) ;;
18746                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18747                 esac
18748                 echo "Prototype: $try" ;;
18749         esac
18750         ;;
18751         *)      case "$usethreads" in
18752                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18753                 esac
18754                 d_ttyname_r=undef
18755                 ttyname_r_proto=0
18756                 ;;
18757         esac
18758         ;;
18759 *)      ttyname_r_proto=0
18760         ;;
18761 esac
18762
18763 : see if tzname[] exists
18764 echo " "
18765 if set tzname val -a d_tzname; eval $csym; $val; then
18766         val="$define"
18767         echo 'tzname[] found.' >&4
18768 else
18769         val="$undef"
18770         echo 'tzname[] NOT found.' >&4
18771 fi
18772 set d_tzname
18773 eval $setvar
18774
18775 : Check if is a multiplatform env
18776 case "$osname" in
18777 next|darwin) multiarch="$define" ;;
18778 esac
18779 case "$multiarch" in
18780 ''|[nN]*) multiarch="$undef" ;;
18781 esac
18782
18783 : check for ordering of bytes in a UV
18784 echo " "
18785 case "$usecrosscompile$multiarch" in
18786 *$define*)
18787         $cat <<EOM
18788 You seem to be either cross-compiling or doing a multiarchitecture build,
18789 skipping the byteorder check.
18790
18791 EOM
18792         byteorder='ffff'
18793         ;;
18794 *)
18795         case "$byteorder" in
18796         '')
18797                 $cat <<'EOM'
18798 In the following, larger digits indicate more significance.  A big-endian
18799 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18800 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18801 machines may have weird orders like 3412.  A Cray will report 87654321,
18802 an Alpha will report 12345678. If the test program works the default is
18803 probably right.
18804 I'm now running the test program...
18805 EOM
18806                 $cat >try.c <<EOCP
18807 #include <stdio.h>
18808 #$i_stdlib I_STDLIB
18809 #ifdef I_STDLIB
18810 #include <stdlib.h>
18811 #endif
18812 #include <sys/types.h>
18813 typedef $uvtype UV;
18814 int main()
18815 {
18816         int i;
18817         union {
18818                 UV l;
18819                 char c[$uvsize];
18820         } u;
18821
18822         if ($uvsize > 4)
18823                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18824         else
18825                 u.l = (UV)0x04030201;
18826         for (i = 0; i < $uvsize; i++)
18827                 printf("%c", u.c[i]+'0');
18828         printf("\n");
18829         exit(0);
18830 }
18831 EOCP
18832                 xxx_prompt=y
18833                 set try
18834                 if eval $compile && $run ./try > /dev/null; then
18835                         dflt=`$run ./try`
18836                         case "$dflt" in
18837                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18838                                 echo "(The test program ran ok.)"
18839                                 echo "byteorder=$dflt"
18840                                 xxx_prompt=n
18841                         ;;
18842                         ????|????????) echo "(The test program ran ok.)" ;;
18843                         *) echo "(The test program didn't run right for some reason.)" ;;
18844                         esac
18845                 else
18846                         dflt='4321'
18847                         cat <<'EOM'
18848 (I can't seem to compile the test program.  Guessing big-endian...)
18849 EOM
18850                 fi
18851                 case "$xxx_prompt" in
18852                 y)
18853                         rp="What is the order of bytes in $uvtype?"
18854                         . ./myread
18855                         byteorder="$ans"
18856                         ;;
18857                 *)      byteorder=$dflt
18858                         ;;
18859                 esac
18860                 ;;
18861         esac
18862         $rm_try
18863         ;;
18864 esac
18865
18866 : Checking 32bit alignedness
18867 $cat <<EOM
18868
18869 Checking to see whether you can access character data unalignedly...
18870 EOM
18871 case "$d_u32align" in
18872 '')   $cat >try.c <<EOCP
18873 #include <stdio.h>
18874 #$i_stdlib I_STDLIB
18875 #ifdef I_STDLIB
18876 #include <stdlib.h>
18877 #endif
18878 #define U32 $u32type
18879 #define BYTEORDER 0x$byteorder
18880 #define U8 $u8type
18881 #include <signal.h>
18882 #ifdef SIGBUS
18883 $signal_t bletch(int s) { exit(4); }
18884 #endif
18885 int main() {
18886 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18887     volatile U8 buf[8];
18888     volatile U32 *up;
18889     int i;
18890
18891     if (sizeof(U32) != 4) {
18892         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18893         exit(1);
18894     }
18895
18896     fflush(stdout);
18897
18898 #ifdef SIGBUS
18899     signal(SIGBUS, bletch);
18900 #endif
18901
18902     buf[0] = 0;
18903     buf[1] = 0;
18904     buf[2] = 0;
18905     buf[3] = 1;
18906     buf[4] = 0;
18907     buf[5] = 0;
18908     buf[6] = 0;
18909     buf[7] = 1;
18910
18911     for (i = 0; i < 4; i++) {
18912         up = (U32*)(buf + i);
18913         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18914                (*up == 1 << (8*(3-i)))  /* little-endian */
18915               )
18916            )
18917         {
18918             printf("read failed (%x)\n", *up);
18919             exit(2);
18920         }
18921     }
18922
18923     /* write test */
18924     for (i = 0; i < 4; i++) {
18925         up = (U32*)(buf + i);
18926         *up = 0xBeef;
18927         if (*up != 0xBeef) {
18928             printf("write failed (%x)\n", *up);
18929             exit(3);
18930         }
18931     }
18932
18933     exit(0);
18934 #else
18935     printf("1\n");
18936     exit(1);
18937 #endif
18938     return 0;
18939 }
18940 EOCP
18941 set try
18942 if eval $compile_ok; then
18943         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18944         $run ./try 2>&1 >/dev/null
18945         case "$?" in
18946         0)      cat >&4 <<EOM
18947 You can access character data pretty unalignedly.
18948 EOM
18949                 d_u32align="$undef"
18950                 ;;
18951         *)      cat >&4 <<EOM
18952 It seems that you must access character data in an aligned manner.
18953 EOM
18954                 d_u32align="$define"
18955                 ;;
18956         esac
18957 else
18958         rp='Can you access character data at unaligned addresses?'
18959         dflt='n'
18960         . ./myread
18961         case "$ans" in
18962         [yY]*)  d_u32align="$undef"  ;;
18963         *)      d_u32align="$define" ;;
18964         esac
18965 fi
18966 $rm_try
18967 ;;
18968 esac
18969
18970 : see if ualarm exists
18971 set ualarm d_ualarm
18972 eval $inlibc
18973
18974 : see if umask exists
18975 set umask d_umask
18976 eval $inlibc
18977
18978 : see if unordered exists
18979 set unordered d_unordered
18980 eval $inlibc
18981
18982 : see if unsetenv exists
18983 set unsetenv d_unsetenv
18984 eval $inlibc
18985
18986 : see if usleep exists
18987 set usleep d_usleep
18988 eval $inlibc
18989
18990 : see if prototype for usleep is available
18991 echo " "
18992 set d_usleepproto usleep $i_unistd unistd.h
18993 eval $hasproto
18994
18995 : see if ustat exists
18996 set ustat d_ustat
18997 eval $inlibc
18998
18999 : see if closedir exists
19000 set closedir d_closedir
19001 eval $inlibc
19002
19003 case "$d_closedir" in
19004 "$define")
19005         echo " "
19006         echo "Checking whether closedir() returns a status..." >&4
19007         cat > try.c <<EOM
19008 #$i_dirent I_DIRENT             /**/
19009 #$i_sysdir I_SYS_DIR            /**/
19010 #$i_sysndir I_SYS_NDIR          /**/
19011 #$i_systypes I_SYS_TYPES        /**/
19012
19013 #if defined(I_SYS_TYPES)
19014 #include <sys/types.h>
19015 #endif
19016 #if defined(I_DIRENT)
19017 #include <dirent.h>
19018 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
19019 #include <sys/dir.h>
19020 #endif
19021 #else
19022 #ifdef I_SYS_NDIR
19023 #include <sys/ndir.h>
19024 #else
19025 #ifdef I_SYS_DIR
19026 #ifdef hp9000s500
19027 #include <ndir.h>       /* may be wrong in the future */
19028 #else
19029 #include <sys/dir.h>
19030 #endif
19031 #endif
19032 #endif
19033 #endif
19034 int main() { return closedir(opendir(".")); }
19035 EOM
19036         set try
19037         if eval $compile_ok; then
19038                 if $run ./try > /dev/null 2>&1 ; then
19039                         echo "Yes, it does."
19040                         val="$undef"
19041                 else
19042                         echo "No, it doesn't."
19043                         val="$define"
19044                 fi
19045         else
19046                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19047                 val="$define"
19048         fi
19049         ;;
19050 *)
19051         val="$undef";
19052         ;;
19053 esac
19054 set d_void_closedir
19055 eval $setvar
19056 $rm_try
19057
19058 : see if there is a wait4
19059 set wait4 d_wait4
19060 eval $inlibc
19061
19062 : see if waitpid exists
19063 set waitpid d_waitpid
19064 eval $inlibc
19065
19066 : see if wcstombs exists
19067 set wcstombs d_wcstombs
19068 eval $inlibc
19069
19070 : see if wctomb exists
19071 set wctomb d_wctomb
19072 eval $inlibc
19073
19074 : see if writev exists
19075 set writev d_writev
19076 eval $inlibc
19077
19078 : preserve RCS keywords in files with variable substitution, grrr
19079 Date='$Date'
19080 Id='$Id'
19081 Log='$Log'
19082 RCSfile='$RCSfile'
19083 Revision='$Revision'
19084
19085 : check for alignment requirements
19086 echo " "
19087 case "$usecrosscompile" in
19088 *$define*)
19089         $cat <<EOM
19090 You seem to be cross-compiling.  Skipping the memory alignment check.
19091
19092 EOM
19093         case "$alignbytes" in
19094         '') alignbytes=8 ;;
19095         esac
19096         ;;
19097 *)
19098         case "$alignbytes" in
19099         '') echo "Checking alignment constraints..." >&4
19100                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
19101                         $cat >try.c <<'EOCP'
19102 typedef long double NV;
19103 EOCP
19104                 else
19105                         $cat >try.c <<'EOCP'
19106 typedef double NV;
19107 EOCP
19108                 fi
19109                 $cat >>try.c <<'EOCP'
19110 #include <stdio.h>
19111 struct foobar {
19112         char foo;
19113         NV bar;
19114 } try_algn;
19115 int main()
19116 {
19117     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19118     return(0);
19119 }
19120 EOCP
19121                 set try
19122                 if eval $compile_ok; then
19123                         dflt=`$run ./try`
19124                 else
19125                         dflt='8'
19126                         echo "(I can't seem to compile the test program...)"
19127                 fi
19128                 case "$multiarch" in
19129                 *$define*)
19130                         : The usual safe value is 8, but Darwin with -Duselongdouble
19131                         : needs 16.  Hence, we will take 8 as a minimum, but allow
19132                         : Configure to pick a larger value if needed.
19133                         if $test "$dflt" -lt 8; then
19134                             dflt='8'
19135                                 echo "Setting alignment to 8 for multiarch support.">&4
19136                         fi
19137                         ;;
19138                 esac
19139                 ;;
19140         *) dflt="$alignbytes"
19141                 ;;
19142         esac
19143         rp="Doubles must be aligned on a how-many-byte boundary?"
19144         . ./myread
19145         alignbytes="$ans"
19146         $rm_try
19147         ;;
19148 esac
19149
19150
19151 : set the base revision
19152 baserev=5.0
19153
19154 : Determine if this is an EBCDIC system
19155 echo " "
19156 echo "Determining whether or not we are on an EBCDIC system..." >&4
19157 $cat >try.c <<'EOM'
19158 int main()
19159 {
19160   if ('M'==0xd4) return 0;
19161   return 1;
19162 }
19163 EOM
19164
19165 case "$BOOTSTRAP_CHARSET" in
19166     Y|y|define) bootstrap_charset=$define       ;;
19167     *)          bootstrap_charset=$undef        ;;
19168 esac
19169
19170 val=$undef
19171 set try
19172 if eval $compile_ok; then
19173         if $run ./try; then
19174                 echo "You seem to speak EBCDIC." >&4
19175                 val="$define"
19176         else
19177                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19178         fi
19179 else
19180         echo "I'm unable to compile the test program." >&4
19181         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19182 fi
19183 $rm_try
19184 set ebcdic
19185 eval $setvar
19186
19187 : length of character in bytes. Is always 1, otherwise it is not C
19188 : This used to be a test using sizeof
19189 charsize=1
19190
19191 : Check for the number of bits in a character
19192 case "$charbits" in
19193 '')     echo "Checking how long a character is (in bits)..." >&4
19194         $cat >try.c <<EOCP
19195 #include <stdio.h>
19196 int main ()
19197 {
19198     int n;
19199     unsigned char c;
19200     for (c = 1, n = 0; c; c <<= 1, n++) ;
19201     printf ("%d\n", n);
19202     return (0);
19203     }
19204 EOCP
19205         set try
19206         if eval $compile_ok; then
19207                 dflt=`$run ./try`
19208         else
19209                 dflt='8'
19210                 echo "(I can't seem to compile the test program.  Guessing...)"
19211         fi
19212         ;;
19213 *)
19214         dflt="$charbits"
19215         ;;
19216 esac
19217 rp="What is the length of a character (in bits)?"
19218 . ./myread
19219 charbits="$ans"
19220 $rm_try
19221 case "$charbits" in
19222 8)      ;;
19223 *)      cat >&4 << EOM
19224 Your system has an unsigned character size of $charbits bits, which
19225 is rather unusual (normally it is 8 bits).  Perl likely will not work
19226 correctly on your system, with subtle bugs in various places.
19227 EOM
19228         rp='Do you really want to continue?'
19229         dflt='n'
19230         . ./myread
19231         case "$ans" in
19232                 [yY])   echo >&4 "Okay, continuing."    ;;
19233                 *)      exit 1                          ;;
19234         esac
19235 esac
19236
19237 : how do we concatenate cpp tokens here?
19238 echo " "
19239 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19240 $cat >cpp_stuff.c <<'EOCP'
19241 #define RCAT(a,b)a/**/b
19242 #define ACAT(a,b)a ## b
19243 RCAT(Rei,ser)
19244 ACAT(Cir,cus)
19245 EOCP
19246 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19247 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19248         echo "Oh!  Smells like ANSI's been here." >&4
19249         echo "We can catify or stringify, separately or together!"
19250         cpp_stuff=42
19251 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19252         echo "Ah, yes!  The good old days!" >&4
19253         echo "However, in the good old days we don't know how to stringify and"
19254         echo "catify at the same time."
19255         cpp_stuff=1
19256 else
19257         $cat >&4 <<EOM
19258 Hmm, I don't seem to be able to concatenate tokens with your cpp.
19259 You're going to have to edit the values of CAT[2-5] in config.h...
19260 EOM
19261         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19262 fi
19263 $rm -f cpp_stuff.*
19264
19265 : see if this is a db.h system
19266 set db.h i_db
19267 eval $inhdr
19268
19269 case "$i_db" in
19270 $define)
19271         : Check db version.
19272         echo " "
19273         echo "Checking Berkeley DB version ..." >&4
19274         $cat >try.c <<EOCP
19275 #$d_const HASCONST
19276 #ifndef HASCONST
19277 #define const
19278 #endif
19279 #include <sys/types.h>
19280 #include <stdio.h>
19281 #$i_stdlib I_STDLIB
19282 #ifdef I_STDLIB
19283 #include <stdlib.h>
19284 #endif
19285 #include <db.h>
19286 int main(int argc, char *argv[])
19287 {
19288 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19289     int Major, Minor, Patch ;
19290     unsigned long Version ;
19291     (void)db_version(&Major, &Minor, &Patch) ;
19292     if (argc == 2) {
19293         printf("%d %d %d %d %d %d\n",
19294                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19295                Major, Minor, Patch);
19296         exit(0);
19297     }
19298     printf("You have Berkeley DB Version 2 or greater.\n");
19299
19300     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19301                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19302     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19303                 Major, Minor, Patch) ;
19304
19305     /* check that db.h & libdb are compatible */
19306     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19307         printf("db.h and libdb are incompatible.\n") ;
19308         exit(3);
19309     }
19310
19311     printf("db.h and libdb are compatible.\n") ;
19312
19313     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19314                 + DB_VERSION_PATCH ;
19315
19316     /* needs to be >= 2.3.4 */
19317     if (Version < 2003004) {
19318     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19319         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19320         exit(2);
19321     }
19322
19323     exit(0);
19324 #else
19325 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19326     if (argc == 2) {
19327         printf("1 0 0\n");
19328         exit(0);
19329     }
19330     printf("You have Berkeley DB Version 1.\n");
19331     exit(0);    /* DB version < 2: the coast is clear. */
19332 #else
19333     exit(1);    /* <db.h> not Berkeley DB? */
19334 #endif
19335 #endif
19336 }
19337 EOCP
19338         set try
19339         if eval $compile_ok && $run ./try; then
19340                 echo 'Looks OK.' >&4
19341                 set `$run ./try 1`
19342                 db_version_major=$1
19343                 db_version_minor=$2
19344                 db_version_patch=$3
19345         else
19346                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19347                 i_db=$undef
19348                 case " $libs " in
19349                 *"-ldb "*)
19350                         : Remove db from list of libraries to use
19351                         echo "Removing unusable -ldb from library list" >&4
19352                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19353                         shift
19354                         libs="$*"
19355                         echo "libs = $libs" >&4
19356                         ;;
19357                 esac
19358         fi
19359         $rm_try
19360         ;;
19361 esac
19362
19363 case "$i_db" in
19364 define)
19365         : Check the return type needed for hash
19366         echo " "
19367         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19368         $cat >try.c <<EOCP
19369 #$d_const HASCONST
19370 #ifndef HASCONST
19371 #define const
19372 #endif
19373 #include <sys/types.h>
19374 #include <db.h>
19375
19376 #ifndef DB_VERSION_MAJOR
19377 u_int32_t hash_cb (ptr, size)
19378 const void *ptr;
19379 size_t size;
19380 {
19381 }
19382 HASHINFO info;
19383 int main()
19384 {
19385         info.hash = hash_cb;
19386 }
19387 #endif
19388 EOCP
19389         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19390                 if $contains warning try.out >>/dev/null 2>&1 ; then
19391                         db_hashtype='int'
19392                 else
19393                         db_hashtype='u_int32_t'
19394                 fi
19395         else
19396                 : XXX Maybe we should just give up here.
19397                 db_hashtype=u_int32_t
19398                 $cat try.out >&4
19399                 echo "Help:  I can't seem to compile the db test program." >&4
19400                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19401         fi
19402         $rm_try
19403         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19404         ;;
19405 *)      db_hashtype=u_int32_t
19406         ;;
19407 esac
19408 case "$i_db" in
19409 define)
19410         : Check the return type needed for prefix
19411         echo " "
19412         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19413         cat >try.c <<EOCP
19414 #$d_const HASCONST
19415 #ifndef HASCONST
19416 #define const
19417 #endif
19418 #include <sys/types.h>
19419 #include <db.h>
19420
19421 #ifndef DB_VERSION_MAJOR
19422 size_t prefix_cb (key1, key2)
19423 const DBT *key1;
19424 const DBT *key2;
19425 {
19426 }
19427 BTREEINFO info;
19428 int main()
19429 {
19430         info.prefix = prefix_cb;
19431 }
19432 #endif
19433 EOCP
19434         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19435                 if $contains warning try.out >>/dev/null 2>&1 ; then
19436                         db_prefixtype='int'
19437                 else
19438                         db_prefixtype='size_t'
19439                 fi
19440         else
19441                 db_prefixtype='size_t'
19442                 : XXX Maybe we should just give up here.
19443                 $cat try.out >&4
19444                 echo "Help:  I can't seem to compile the db test program." >&4
19445                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19446         fi
19447         $rm_try
19448         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19449         ;;
19450 *)      db_prefixtype='size_t'
19451         ;;
19452 esac
19453
19454 : How can we generate normalized random numbers ?
19455 echo " "
19456 echo "Looking for a random number function..." >&4
19457 case "$randfunc" in
19458 '')
19459         if set drand48 val -f; eval $csym; $val; then
19460                 dflt="drand48"
19461                 echo "Good, found drand48()." >&4
19462         elif set random val -f; eval $csym; $val; then
19463                 dflt="random"
19464                 echo "OK, found random()." >&4
19465         else
19466                 dflt="rand"
19467                 echo "Yuck, looks like I have to use rand()." >&4
19468         fi
19469         echo " "
19470         ;;
19471 *)
19472         dflt="$randfunc"
19473         ;;
19474 esac
19475 cont=true
19476
19477 case "$ccflags" in
19478 *-Dmy_rand=*|*-Dmy_srand=*)
19479         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19480         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19481         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19482         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19483         ;;
19484 esac
19485
19486 while $test "$cont"; do
19487         rp="Use which function to generate random numbers?"
19488         . ./myread
19489         if $test "$ans" = "$dflt"; then
19490                 : null
19491         else
19492                 randbits=''
19493         fi
19494         randfunc="$ans"
19495         if set $ans val -f; eval $csym; $val; then
19496                 cont=''
19497         else
19498                 dflt=y
19499                 rp="I cannot find function $ans. Use that name anyway?"
19500                 . ./myread
19501                 dflt=rand
19502                 case "$ans" in
19503                         [yY]*) cont='';;
19504                 esac
19505         fi
19506         case "$cont" in
19507         '')
19508                 case "$randfunc" in
19509                 drand48)
19510                         drand01="drand48()"
19511                         seedfunc="srand48"
19512                         randbits=48
19513                         randseedtype=long
19514                         ;;
19515                 rand|random)
19516                         case "$randbits" in
19517                         '')
19518 echo "Checking to see how many bits your $randfunc() function produces..." >&4
19519                                 $cat >try.c <<EOCP
19520 #$i_unistd I_UNISTD
19521 #$i_stdlib I_STDLIB
19522 #include <stdio.h>
19523 #ifdef I_UNISTD
19524 #  include <unistd.h>
19525 #endif
19526 #ifdef I_STDLIB
19527 #  include <stdlib.h>
19528 #endif
19529 int main()
19530 {
19531         int i;
19532         unsigned long tmp;
19533         unsigned long max = 0L;
19534
19535         for (i = 1000; i; i--) {
19536                 tmp = (unsigned long) $randfunc();
19537                 if (tmp > max) max = tmp;
19538         }
19539         for (i = 0; max; i++)
19540                 max /= 2;
19541         printf("%d\n",i);
19542 }
19543 EOCP
19544                                 set try
19545                                 if eval $compile_ok; then
19546                                         dflt=`try`
19547                                 else
19548                                         dflt='?'
19549                                         echo "(I can't seem to compile the test program...)"
19550                                 fi
19551                                 ;;
19552                         *)
19553                                 dflt="$randbits"
19554                                 ;;
19555                         esac
19556                         rp="How many bits does your $randfunc() function produce?"
19557                         . ./myread
19558                         randbits="$ans"
19559                         $rm_try
19560                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19561                         seedfunc="s$randfunc"
19562                         randseedtype=unsigned
19563                         ;;
19564                 *)
19565                         dflt="31"
19566                         rp="How many bits does your $randfunc() function produce?"
19567                         . ./myread
19568                         randbits="$ans"
19569                         seedfunc="s$randfunc"
19570                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19571                         if set $seedfunc val -f; eval $csym; $val; then
19572                                 echo "(Using $seedfunc() to seed random generator)"
19573                         else
19574                                 echo "(Warning: no $seedfunc() to seed random generator)"
19575                                 seedfunc=rand
19576                         fi
19577                         randseedtype=unsigned
19578                         ;;
19579                 esac
19580                 ;;
19581         esac
19582 done
19583
19584 : Check how to flush
19585 echo " "
19586 $cat >&4 <<EOM
19587 Checking how to flush all pending stdio output...
19588 EOM
19589 # I only know how to find the first 32 possibly open files on SunOS.
19590 # See also hints/sunos_4_1.sh and util.c  --AD
19591 case "$osname" in
19592 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19593 esac
19594 $cat >>try.c <<EOCP
19595 #include <stdio.h>
19596 #$i_stdlib I_STDLIB
19597 #ifdef I_STDLIB
19598 #include <stdlib.h>
19599 #endif
19600 #$i_unistd I_UNISTD
19601 #ifdef I_UNISTD
19602 # include <unistd.h>
19603 #endif
19604 #$d_sysconf HAS_SYSCONF
19605 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19606 #ifdef HAS_STDIO_STREAM_ARRAY
19607 # define STDIO_STREAM_ARRAY $stdio_stream_array
19608 #endif
19609 int main() {
19610   FILE* p;
19611   unlink("try.out");
19612   p = fopen("try.out", "w");
19613 #ifdef TRY_FPUTC
19614   fputc('x', p);
19615 #else
19616 # ifdef TRY_FPRINTF
19617   fprintf(p, "x");
19618 # endif
19619 #endif
19620 #ifdef TRY_FFLUSH_NULL
19621   fflush(NULL);
19622 #endif
19623 #ifdef TRY_FFLUSH_ALL
19624   {
19625     long open_max = -1;
19626 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19627     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19628 # else
19629 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19630     open_max = sysconf(_SC_OPEN_MAX);
19631 #  else
19632 #   ifdef FOPEN_MAX
19633     open_max = FOPEN_MAX;
19634 #   else
19635 #    ifdef OPEN_MAX
19636     open_max = OPEN_MAX;
19637 #    else
19638 #     ifdef _NFILE
19639     open_max = _NFILE;
19640 #     endif
19641 #    endif
19642 #   endif
19643 #  endif
19644 # endif
19645 # ifdef HAS_STDIO_STREAM_ARRAY
19646     if (open_max > 0) {
19647       long i;
19648       for (i = 0; i < open_max; i++)
19649             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19650                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19651                 STDIO_STREAM_ARRAY[i]._flag)
19652                 fflush(&STDIO_STREAM_ARRAY[i]);
19653     }
19654   }
19655 # endif
19656 #endif
19657   _exit(42);
19658 }
19659 EOCP
19660 : first we have to find out how _not_ to flush
19661 $to try.c
19662 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19663     output=''
19664     set try -DTRY_FPUTC
19665     if eval $compile; then
19666             $run ./try 2>/dev/null
19667             code="$?"
19668             $from try.out
19669             if $test ! -s try.out -a "X$code" = X42; then
19670                 output=-DTRY_FPUTC
19671             fi
19672     fi
19673     case "$output" in
19674     '')
19675             set try -DTRY_FPRINTF
19676             if eval $compile; then
19677                     $run ./try 2>/dev/null
19678                     code="$?"
19679                     $from try.out
19680                     if $test ! -s try.out -a "X$code" = X42; then
19681                         output=-DTRY_FPRINTF
19682                     fi
19683             fi
19684         ;;
19685     esac
19686 fi
19687 : check for fflush NULL behavior
19688 case "$fflushNULL" in
19689 '')     set try -DTRY_FFLUSH_NULL $output
19690         if eval $compile; then
19691                 $run ./try 2>/dev/null
19692                 code="$?"
19693                 $from try.out
19694                 if $test -s try.out -a "X$code" = X42; then
19695                         fflushNULL="`$cat try.out`"
19696                 else
19697                         if $test "X$code" != X42; then
19698                                 $cat >&4 <<EOM
19699 (If this test failed, don't worry, we'll try another method shortly.)
19700 EOM
19701                         fi
19702                 fi
19703         fi
19704         $rm -f core try.core core.try.*
19705         case "$fflushNULL" in
19706         x)      $cat >&4 <<EOM
19707 Your fflush(NULL) works okay for output streams.
19708 Let's see if it clobbers input pipes...
19709 EOM
19710 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19711 # bug that improperly flushes the input end of pipes.  So we avoid the
19712 # autoflush on fork/system/exec support for now. :-(
19713 $cat >tryp.c <<EOCP
19714 #include <stdio.h>
19715 int
19716 main(int argc, char **argv)
19717 {
19718     char buf[1024];
19719     int i;
19720     char *bp = buf;
19721     while (1) {
19722         while ((i = getc(stdin)) != -1
19723                && (*bp++ = i) != '\n'
19724                && bp < &buf[1024])
19725         /* DO NOTHING */ ;
19726         *bp = '\0';
19727         fprintf(stdout, "%s", buf);
19728         fflush(NULL);
19729         if (i == -1)
19730             return 0;
19731         bp = buf;
19732     }
19733 }
19734 EOCP
19735                 fflushNULL="$define"
19736                 set tryp
19737                 if eval $compile; then
19738                     $rm -f tryp.out
19739                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19740                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19741                        $cat >&4 <<EOM
19742 fflush(NULL) seems to behave okay with input streams.
19743 EOM
19744                         fflushNULL="$define"
19745                     else
19746                         $cat >&4 <<EOM
19747 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19748 EOM
19749                         fflushNULL="$undef"
19750                     fi
19751                 fi
19752                 $rm -f core tryp.c tryp.core core.tryp.*
19753                 ;;
19754         '')     $cat >&4 <<EOM
19755 Your fflush(NULL) isn't working (contrary to ANSI C).
19756 EOM
19757                 fflushNULL="$undef"
19758                 ;;
19759         *)      $cat >&4 <<EOM
19760 Cannot figure out whether your fflush(NULL) works or not.
19761 I'm assuming it doesn't (contrary to ANSI C).
19762 EOM
19763                 fflushNULL="$undef"
19764                 ;;
19765         esac
19766         ;;
19767 $define|true|[yY]*)
19768         fflushNULL="$define"
19769         ;;
19770 *)
19771         fflushNULL="$undef"
19772         ;;
19773 esac
19774 : check explicit looping only if NULL did not work, and if the pipe
19775 : bug does not show up on an explicit flush too
19776 case "$fflushNULL" in
19777 "$undef")
19778         $cat >tryp.c <<EOCP
19779 #include <stdio.h>
19780 int
19781 main(int argc, char **argv)
19782 {
19783     char buf[1024];
19784     int i;
19785     char *bp = buf;
19786     while (1) {
19787         while ((i = getc(stdin)) != -1
19788                && (*bp++ = i) != '\n'
19789                && bp < &buf[1024])
19790         /* DO NOTHING */ ;
19791         *bp = '\0';
19792         fprintf(stdout, "%s", buf);
19793         fflush(stdin);
19794         if (i == -1)
19795             return 0;
19796         bp = buf;
19797     }
19798 }
19799 EOCP
19800         set tryp
19801         if eval $compile; then
19802             $rm -f tryp.out
19803             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19804             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19805                $cat >&4 <<EOM
19806 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19807 EOM
19808                 : now check for fflushall behaviour
19809                 case "$fflushall" in
19810                 '')     set try -DTRY_FFLUSH_ALL $output
19811                         if eval $compile; then
19812                                 $cat >&4 <<EOM
19813 (Now testing the other method--but note that this also may fail.)
19814 EOM
19815                                 $run ./try 2>/dev/null
19816                                 code=$?
19817                                 $from try.out
19818                                 if $test -s try.out -a "X$code" = X42; then
19819                                         fflushall="`$cat try.out`"
19820                                 fi
19821                         fi
19822                         $rm_try
19823                         case "$fflushall" in
19824                         x)      $cat >&4 <<EOM
19825 Whew. Flushing explicitly all the stdio streams works.
19826 EOM
19827                                 fflushall="$define"
19828                                 ;;
19829                         '')     $cat >&4 <<EOM
19830 Sigh. Flushing explicitly all the stdio streams doesn't work.
19831 EOM
19832                                 fflushall="$undef"
19833                                 ;;
19834                         *)      $cat >&4 <<EOM
19835 Cannot figure out whether flushing stdio streams explicitly works or not.
19836 I'm assuming it doesn't.
19837 EOM
19838                                 fflushall="$undef"
19839                                 ;;
19840                         esac
19841                         ;;
19842                 "$define"|true|[yY]*)
19843                         fflushall="$define"
19844                         ;;
19845                 *)
19846                         fflushall="$undef"
19847                         ;;
19848                 esac
19849             else
19850                 $cat >&4 <<EOM
19851 All is futile.  Even fflush(stdin) clobbers input pipes!
19852 EOM
19853                 fflushall="$undef"
19854             fi
19855         else
19856             fflushall="$undef"
19857         fi
19858         $rm -f core tryp.c tryp.core core.tryp.*
19859         ;;
19860 *)      fflushall="$undef"
19861         ;;
19862 esac
19863
19864 case "$fflushNULL$fflushall" in
19865 undefundef)
19866         $cat <<EOM
19867 OK, I give up.  I cannot figure out how to flush pending stdio output.
19868 We won't be flushing handles at all before fork/exec/popen.
19869 EOM
19870         ;;
19871 esac
19872 $rm_try tryp
19873
19874 : Store the full pathname to the ar program for use in the C program
19875 : Respect a hint or command line value for full_ar.
19876 case "$full_ar" in
19877 '') full_ar=$ar ;;
19878 esac
19879
19880 : Store the full pathname to the sed program for use in the C program
19881 full_sed=$sed
19882
19883 : see what type gids are declared as in the kernel
19884 echo " "
19885 echo "Looking for the type for group ids returned by getgid()."
19886 set gid_t gidtype xxx stdio.h sys/types.h
19887 eval $typedef
19888 case "$gidtype" in
19889 xxx)
19890         xxx=`./findhdr sys/user.h`
19891         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19892         case $1 in
19893         unsigned) dflt="$1 $2" ;;
19894         *) dflt="$1" ;;
19895         esac
19896         ;;
19897 *) dflt="$gidtype";;
19898 esac
19899 case "$gidtype" in
19900 gid_t) echo "gid_t found." ;;
19901 *)      rp="What is the type for group ids returned by getgid()?"
19902         . ./myread
19903         gidtype="$ans"
19904         ;;
19905 esac
19906
19907 : Check the size of GID
19908 echo " "
19909 case "$gidtype" in
19910 *_t) zzz="$gidtype"     ;;
19911 *)   zzz="gid"          ;;
19912 esac
19913 echo "Checking the size of $zzz..." >&4
19914 cat > try.c <<EOCP
19915 #include <sys/types.h>
19916 #include <stdio.h>
19917 #$i_stdlib I_STDLIB
19918 #ifdef I_STDLIB
19919 #include <stdlib.h>
19920 #endif
19921 int main() {
19922     printf("%d\n", (int)sizeof($gidtype));
19923     exit(0);
19924 }
19925 EOCP
19926 set try
19927 if eval $compile_ok; then
19928         yyy=`$run ./try`
19929         case "$yyy" in
19930         '')     gidsize=4
19931                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19932                 ;;
19933         *)      gidsize=$yyy
19934                 echo "Your $zzz is $gidsize bytes long."
19935                 ;;
19936         esac
19937 else
19938         gidsize=4
19939         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19940 fi
19941
19942
19943 : Check if GID is signed
19944 echo " "
19945 case "$gidtype" in
19946 *_t) zzz="$gidtype"     ;;
19947 *)   zzz="gid"          ;;
19948 esac
19949 echo "Checking the sign of $zzz..." >&4
19950 cat > try.c <<EOCP
19951 #include <sys/types.h>
19952 #include <stdio.h>
19953 int main() {
19954         $gidtype foo = -1;
19955         if (foo < 0)
19956                 printf("-1\n");
19957         else
19958                 printf("1\n");
19959 }
19960 EOCP
19961 set try
19962 if eval $compile; then
19963         yyy=`$run ./try`
19964         case "$yyy" in
19965         '')     gidsign=1
19966                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19967                 ;;
19968         *)      gidsign=$yyy
19969                 case "$gidsign" in
19970                  1) echo "Your $zzz is unsigned." ;;
19971                 -1) echo "Your $zzz is signed."   ;;
19972                 esac
19973                 ;;
19974         esac
19975 else
19976         gidsign=1
19977         echo "(I can't compile the test program--guessing unsigned.)" >&4
19978 fi
19979
19980
19981 : Check 64bit sizes
19982 echo " "
19983
19984 if $test X"$quadtype" != X; then
19985
19986 echo "Checking how to print 64-bit integers..." >&4
19987
19988 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19989         $cat >try.c <<'EOCP'
19990 #include <sys/types.h>
19991 #include <stdio.h>
19992 int main() {
19993   int q = 12345678901;
19994   printf("%ld\n", q);
19995 }
19996 EOCP
19997         set try
19998         if eval $compile; then
19999                 yyy=`$run ./try`
20000                 case "$yyy" in
20001                 12345678901)
20002                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
20003                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
20004                         echo "We will use %d."
20005                         ;;
20006                 esac
20007         fi
20008 fi
20009
20010 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
20011         $cat >try.c <<'EOCP'
20012 #include <sys/types.h>
20013 #include <stdio.h>
20014 int main() {
20015   long q = 12345678901;
20016   printf("%ld\n", q);
20017 }
20018 EOCP
20019         set try
20020         if eval $compile; then
20021                 yyy=`$run ./try`
20022                 case "$yyy" in
20023                 12345678901)
20024                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
20025                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
20026                         echo "We will use %ld."
20027                         ;;
20028                 esac
20029         fi
20030 fi
20031
20032 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
20033         $cat >try.c <<'EOCP'
20034 #include <sys/types.h>
20035 #include <inttypes.h>
20036 #include <stdio.h>
20037 int main() {
20038   int64_t q = 12345678901;
20039   printf("%" PRId64 "\n", q);
20040 }
20041 EOCP
20042         set try
20043         if eval $compile; then
20044                 yyy=`$run ./try`
20045                 case "$yyy" in
20046                 12345678901)
20047                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
20048                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
20049                         echo "We will use the C9X style."
20050                         ;;
20051                 esac
20052         fi
20053 fi
20054
20055 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20056         $cat >try.c <<EOCP
20057 #include <sys/types.h>
20058 #include <stdio.h>
20059 int main() {
20060   $quadtype q = 12345678901;
20061   printf("%Ld\n", q);
20062 }
20063 EOCP
20064         set try
20065         if eval $compile; then
20066                 yyy=`$run ./try`
20067                 case "$yyy" in
20068                 12345678901)
20069                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
20070                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
20071                         echo "We will use %Ld."
20072                         ;;
20073                 esac
20074         fi
20075 fi
20076
20077 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
20078         $cat >try.c <<'EOCP'
20079 #include <sys/types.h>
20080 #include <stdio.h>
20081 int main() {
20082   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
20083   printf("%lld\n", q);
20084 }
20085 EOCP
20086         set try
20087         if eval $compile; then
20088                 yyy=`$run ./try`
20089                 case "$yyy" in
20090                 12345678901)
20091                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
20092                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
20093                         echo "We will use the %lld style."
20094                         ;;
20095                 esac
20096         fi
20097 fi
20098
20099 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20100         $cat >try.c <<EOCP
20101 #include <sys/types.h>
20102 #include <stdio.h>
20103 int main() {
20104   $quadtype q = 12345678901;
20105   printf("%qd\n", q);
20106 }
20107 EOCP
20108         set try
20109         if eval $compile; then
20110                 yyy=`$run ./try`
20111                 case "$yyy" in
20112                 12345678901)
20113                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
20114                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
20115                         echo "We will use %qd."
20116                         ;;
20117                 esac
20118         fi
20119 fi
20120
20121 if $test X"$sPRId64" = X; then
20122         echo "Cannot figure out how to print 64-bit integers." >&4
20123 fi
20124 $rm_try
20125
20126 fi
20127
20128 case "$sPRId64" in
20129 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
20130         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
20131         ;;
20132 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
20133         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
20134         ;;
20135 esac
20136
20137 : Check format strings for internal types
20138 echo " "
20139 $echo "Checking the format strings to be used for Perl's internal types..." >&4
20140
20141 if $test X"$ivsize" = X8; then
20142         ivdformat="$sPRId64"
20143         uvuformat="$sPRIu64"
20144         uvoformat="$sPRIo64"
20145         uvxformat="$sPRIx64"
20146         uvXUformat="$sPRIXU64"
20147 else
20148         if $test X"$ivsize" = X"$longsize"; then
20149                 ivdformat='"ld"'
20150                 uvuformat='"lu"'
20151                 uvoformat='"lo"'
20152                 uvxformat='"lx"'
20153                 uvXUformat='"lX"'
20154         else
20155                 if $test X"$ivsize" = X"$intsize"; then
20156                         ivdformat='"d"'
20157                         uvuformat='"u"'
20158                         uvoformat='"o"'
20159                         uvxformat='"x"'
20160                         uvXUformat='"X"'
20161                 else
20162                         : far out
20163                         if $test X"$ivsize" = X"$shortsize"; then
20164                                 ivdformat='"hd"'
20165                                 uvuformat='"hu"'
20166                                 uvoformat='"ho"'
20167                                 uvxformat='"hx"'
20168                                 uvXUformat='"hX"'
20169                         fi
20170                 fi
20171         fi
20172 fi
20173
20174 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
20175         nveformat="$sPRIeldbl"
20176         nvfformat="$sPRIfldbl"
20177         nvgformat="$sPRIgldbl"
20178         nvEUformat="$sPRIEUldbl"
20179         nvFUformat="$sPRIFUldbl"
20180         nvGUformat="$sPRIGUldbl"
20181 else
20182         nveformat='"e"'
20183         nvfformat='"f"'
20184         nvgformat='"g"'
20185         nvEUformat='"E"'
20186         nvFUformat='"F"'
20187         nvGUformat='"G"'
20188 fi
20189
20190 case "$ivdformat" in
20191 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
20192     exit 1
20193     ;;
20194 esac
20195
20196 : Check format string for GID
20197
20198 echo " "
20199 $echo "Checking the format string to be used for gids..." >&4
20200
20201 case "$gidsign" in
20202 -1)     if $test X"$gidsize" = X"$ivsize"; then
20203                 gidformat="$ivdformat"
20204         else
20205                 if $test X"$gidsize" = X"$longsize"; then
20206                         gidformat='"ld"'
20207                 else
20208                         if $test X"$gidsize" = X"$intsize"; then
20209                                 gidformat='"d"'
20210                         else
20211                                 if $test X"$gidsize" = X"$shortsize"; then
20212                                         gidformat='"hd"'
20213                                 fi
20214                         fi
20215                 fi
20216         fi
20217         ;;
20218 *)      if $test X"$gidsize" = X"$uvsize"; then
20219                 gidformat="$uvuformat"
20220         else
20221                 if $test X"$gidsize" = X"$longsize"; then
20222                         gidformat='"lu"'
20223                 else
20224                         if $test X"$gidsize" = X"$intsize"; then
20225                                 gidformat='"u"'
20226                         else
20227                                 if $test X"$gidsize" = X"$shortsize"; then
20228                                         gidformat='"hu"'
20229                                 fi
20230                         fi
20231                 fi
20232         fi
20233         ;;
20234 esac
20235
20236 : see if getgroups exists
20237 set getgroups d_getgrps
20238 eval $inlibc
20239
20240 : see if setgroups exists
20241 set setgroups d_setgrps
20242 eval $inlibc
20243
20244 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20245 echo " "
20246 case "$d_getgrps$d_setgrps" in
20247 *define*)
20248         case "$groupstype" in
20249         '') dflt="$gidtype" ;;
20250         *)  dflt="$groupstype" ;;
20251         esac
20252         $cat <<EOM
20253 What type of pointer is the second argument to getgroups() and setgroups()?
20254 Usually this is the same as group ids, $gidtype, but not always.
20255
20256 EOM
20257         rp='What type pointer is the second argument to getgroups() and setgroups()?'
20258         . ./myread
20259         groupstype="$ans"
20260         ;;
20261 *)  groupstype="$gidtype";;
20262 esac
20263
20264 : MAD = Misc Attribute Definition
20265
20266 if $test $patchlevel -lt 9; then
20267 : MAD is not available in 5.8.x or earlier.
20268     ans=n;
20269 else
20270     case "$mad" in
20271     $define|true|[yY]*) dflt='y' ;;
20272     *)                  dflt='n' ;;
20273     esac
20274     cat <<EOM
20275
20276 Would you like to build with Misc Attribute Decoration? This is development
20277 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20278 overhead on the interpreter.
20279
20280 If this doesn't make any sense to you, just accept the default '$dflt'.
20281 EOM
20282     rp='Build Perl with MAD?'
20283     . ./myread
20284 fi
20285 case "$ans" in
20286 y|Y)    val="$define"
20287         madlyh='madly.h madly.act madly.tab'
20288         madlysrc='madly.c'
20289         madlyobj="madly$_o" ;;
20290 *)      val="$undef"
20291         madlyh=''
20292         madlysrc=''
20293         madlyobj='' ;;
20294 esac
20295 set mad
20296 eval $setvar
20297
20298 : check whether make sets MAKE
20299 echo " "
20300 echo "Checking if your $make program sets \$(MAKE)..." >&4
20301 case "$make_set_make" in
20302 '')
20303         $sed 's/^X //' > testmake.mak << 'EOF'
20304 Xall:
20305 X       @echo 'maketemp="$(MAKE)"'
20306 EOF
20307         case "`$make -f testmake.mak 2>/dev/null`" in
20308         *maketemp=*) make_set_make='#' ;;
20309         *)      make_set_make="MAKE=$make" ;;
20310         esac
20311         $rm -f testmake.mak
20312         ;;
20313 esac
20314 case "$make_set_make" in
20315 '#') echo "Yup, it does.";;
20316 *) echo "Nope, it doesn't.";;
20317 esac
20318
20319 : see what type is used for mode_t
20320 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20321 set mode_t modetype int stdio.h sys/types.h
20322 eval $typedef_ask
20323
20324 : see if we need va_copy
20325 echo " "
20326 case "$i_stdarg" in
20327 "$define")
20328         $cat >try.c <<EOCP
20329 #include <stdarg.h>
20330 #include <stdio.h>
20331 #$i_stdlib I_STDLIB
20332 #ifdef I_STDLIB
20333 #include <stdlib.h>
20334 #endif
20335 #include <signal.h>
20336
20337 int
20338 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20339 {
20340   return vfprintf(f, fmt, *valp);
20341 }
20342
20343 int
20344 myvfprintf(FILE *f, const  char *fmt, va_list val)
20345 {
20346   return ivfprintf(f, fmt, &val);
20347 }
20348
20349 int
20350 myprintf(char *fmt, ...)
20351 {
20352   va_list val;
20353   va_start(val, fmt);
20354   return myvfprintf(stdout, fmt, val);
20355 }
20356
20357 int
20358 main(int ac, char **av)
20359 {
20360   signal(SIGSEGV, exit);
20361
20362   myprintf("%s%cs all right, then\n", "that", '\'');
20363   exit(0);
20364 }
20365 EOCP
20366         set try
20367         if eval $compile && $run ./try 2>&1 >/dev/null; then
20368                 case "`$run ./try`" in
20369                 "that's all right, then")
20370                         okay=yes
20371                         ;;
20372                 esac
20373         fi
20374         case "$okay" in
20375         yes)    echo "It seems that you don't need va_copy()." >&4
20376                 need_va_copy="$undef"
20377                 ;;
20378         *)      echo "It seems that va_copy() or similar will be needed." >&4
20379                 need_va_copy="$define"
20380                 ;;
20381         esac
20382         $rm_try
20383         ;;
20384 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20385         need_va_copy="$undef"
20386         ;;
20387 esac
20388
20389 : see what type is used for size_t
20390 rp="What is the type used for the length parameter for string functions?"
20391 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20392 eval $typedef_ask
20393
20394 : check for type of arguments to gethostbyaddr. 
20395 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20396         case "$d_gethbyaddr" in
20397         $define)
20398                 $cat <<EOM
20399
20400 Checking to see what type of arguments are accepted by gethostbyaddr().
20401 EOM
20402                 hdrs="$define sys/types.h
20403                         $d_socket sys/socket.h 
20404                         $i_niin netinet/in.h 
20405                         $i_netdb netdb.h
20406                         $i_unistd unistd.h"
20407                 : The first arg can 'char *' or 'void *'
20408                 : The second arg is some of integral type
20409                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20410                         for yyy in size_t long int; do
20411                                 case "$netdb_host_type" in
20412                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20413                                         if ./protochk "$try" $hdrs; then
20414                                                 echo "Your system accepts $xxx for the first arg."
20415                                                 echo "...and $yyy for the second arg."
20416                                                 netdb_host_type="$xxx"
20417                                                 netdb_hlen_type="$yyy"
20418                                         fi
20419                                         ;;
20420                                 esac
20421                         done
20422                 done
20423                 : In case none of those worked, prompt the user.
20424                 case "$netdb_host_type" in
20425                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20426                         dflt='char *'
20427                         . ./myread
20428                         netdb_host_type=$ans
20429                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20430                         dflt="$sizetype"
20431                         . ./myread
20432                         netdb_hlen_type=$ans
20433                         ;;
20434                 esac
20435                 ;;
20436         *)      : no gethostbyaddr, so pick harmless defaults
20437                 netdb_host_type='char *'
20438                 netdb_hlen_type="$sizetype"
20439                 ;;
20440         esac
20441         # Remove the "const" if needed. -- but then we'll have a 
20442         # prototype clash!
20443         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20444 fi
20445
20446 : check for type of argument to gethostbyname. 
20447 if test "X$netdb_name_type" = X ; then
20448         case "$d_gethbyname" in
20449         $define)
20450                 $cat <<EOM
20451
20452 Checking to see what type of argument is accepted by gethostbyname().
20453 EOM
20454                 hdrs="$define sys/types.h
20455                         $d_socket sys/socket.h 
20456                         $i_niin netinet/in.h 
20457                         $i_netdb netdb.h
20458                         $i_unistd unistd.h"
20459                 for xxx in "const char *" "char *"; do
20460                         case "$netdb_name_type" in
20461                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20462                                 if ./protochk "$try" $hdrs; then
20463                                         echo "Your system accepts $xxx."
20464                                         netdb_name_type="$xxx"
20465                                 fi
20466                                 ;;
20467                         esac
20468                 done
20469                 : In case none of those worked, prompt the user.
20470                 case "$netdb_name_type" in
20471                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20472                         dflt='char *'
20473                         . ./myread
20474                         netdb_name_type=$ans
20475                         ;;
20476                 esac
20477                 ;;
20478         *)      : no gethostbyname, so pick harmless default
20479                 netdb_name_type='char *'
20480                 ;;
20481         esac
20482 fi
20483
20484 : check for type of 1st argument to getnetbyaddr. 
20485 if test "X$netdb_net_type" = X ; then
20486         case "$d_getnbyaddr" in
20487         $define)
20488                 $cat <<EOM
20489
20490 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20491 EOM
20492                 hdrs="$define sys/types.h
20493                         $d_socket sys/socket.h 
20494                         $i_niin netinet/in.h 
20495                         $i_netdb netdb.h
20496                         $i_unistd unistd.h"
20497                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20498                         case "$netdb_net_type" in
20499                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20500                                 if ./protochk "$try" $hdrs; then
20501                                         echo "Your system accepts $xxx."
20502                                         netdb_net_type="$xxx"
20503                                 fi
20504                                 ;;
20505                         esac
20506                 done
20507                 : In case none of those worked, prompt the user.
20508                 case "$netdb_net_type" in
20509                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20510                         dflt='long'
20511                         . ./myread
20512                         netdb_net_type=$ans
20513                         ;;
20514                 esac
20515                 ;;
20516         *)      : no getnetbyaddr, so pick harmless default
20517                 netdb_net_type='long'
20518                 ;;
20519         esac
20520 fi
20521 : locate the preferred pager for this system
20522 fn=f/
20523 case "$pager" in
20524 '')
20525         dflt=''
20526         case "$pg" in
20527         /*) dflt=$pg;;
20528         [a-zA-Z]:/*) dflt=$pg;;
20529         esac
20530         case "$more" in
20531         /*) dflt=$more;;
20532         [a-zA-Z]:/*) dflt=$more;;
20533         esac
20534         case "$less" in
20535         /*) dflt=$less;;
20536         [a-zA-Z]:/*) dflt=$less;;
20537         esac
20538         case "$dflt" in
20539         '') dflt=/usr/ucb/more;;
20540         esac
20541         ;;
20542 *)      dflt="$pager"
20543         ;;
20544 esac
20545 fn="f/($dflt)"
20546 echo " "
20547 rp='What pager is used on your system?'
20548 . ./getfile
20549 pager="$ans"
20550
20551 : see what type pids are declared as in the kernel
20552 rp="What is the type of process ids on this system?"
20553 set pid_t pidtype int stdio.h sys/types.h
20554 eval $typedef_ask
20555
20556 : see if ar generates random libraries by itself
20557 echo " "
20558 echo "Checking how to generate random libraries on your machine..." >&4
20559 echo 'int bar1() { return bar2(); }' > bar1.c
20560 echo 'int bar2() { return 2; }' > bar2.c
20561 $cat > foo.c <<EOP
20562 #$i_stdlib I_STDLIB
20563 #ifdef I_STDLIB
20564 #include <stdlib.h>
20565 #endif
20566 int main() { printf("%d\n", bar1()); exit(0); }
20567 EOP
20568 $cc $ccflags -c bar1.c >/dev/null 2>&1
20569 $cc $ccflags -c bar2.c >/dev/null 2>&1
20570 $cc $ccflags -c foo.c >/dev/null 2>&1
20571 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20572 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20573         $run ./foobar >/dev/null 2>&1; then
20574         echo "$ar appears to generate random libraries itself."
20575         orderlib=false
20576         if [ "X$ranlib" = "X" ]; then
20577             ranlib=":"
20578         fi
20579 elif $ar s bar$_a >/dev/null 2>&1 &&
20580         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20581         $run ./foobar >/dev/null 2>&1; then
20582                 echo "a table of contents needs to be added with '$ar s'."
20583                 orderlib=false
20584                 ranlib="$ar s"
20585 elif $ar ts bar$_a >/dev/null 2>&1 &&
20586         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20587         $run ./foobar >/dev/null 2>&1; then
20588                 echo "a table of contents needs to be added with '$ar ts'."
20589                 orderlib=false
20590                 ranlib="$ar ts"
20591 else
20592         case "$ranlib" in
20593         :) ranlib='';;
20594         '')
20595                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20596                 $test -f $ranlib || ranlib=''
20597                 ;;
20598         esac
20599         if $test -n "$ranlib"; then
20600                 echo "your system has '$ranlib'; we'll use that."
20601                 orderlib=false
20602         else
20603                 echo "your system doesn't seem to support random libraries"
20604                 echo "so we'll use lorder and tsort to order the libraries."
20605                 orderlib=true
20606                 ranlib=":"
20607         fi
20608 fi
20609 $rm -f foo* bar*
20610
20611 : see if this is a values.h system
20612 set values.h i_values
20613 eval $inhdr
20614
20615 : Check the max offset that gmtime and localtime accept
20616 echo "Checking max offsets that gmtime () accepts"
20617
20618 case $i_values in
20619     define) yyy="#include <values.h>" ;;
20620     *)      yyy="" ;;
20621     esac
20622
20623 case "$sGMTIME_min/$sGMTIME_max" in
20624     0/0|/)
20625         $cat >try.c <<EOCP
20626 #include <sys/types.h>
20627 #include <stdio.h>
20628 #include <time.h>
20629 $yyy
20630
20631 int i;
20632 struct tm *tmp;
20633 time_t pt;
20634
20635 void gm_check (time_t t, int min_year, int max_year)
20636 {
20637     tmp = gmtime (&t);
20638     if ( tmp == NULL ||
20639         /* Check tm_year overflow */
20640          tmp->tm_year < min_year || tmp->tm_year > max_year)
20641         tmp = NULL;
20642     else
20643         pt = t;
20644     } /* gm_check */
20645
20646 int check_max ()
20647 {
20648     tmp = NULL;
20649     pt  = 0;
20650 #ifdef MAXLONG
20651     gm_check (MAXLONG, 69, 0x7fffffff);
20652 #endif
20653     if (tmp == NULL || tmp->tm_year < 0) {
20654         for (i = 63; i >= 0; i--) {
20655             time_t x = pt | ((time_t)1 << i);
20656             if (x < 0 || x < pt) continue;
20657             gm_check (x, 69, 0x7fffffff);
20658             }
20659         }
20660     printf ("sGMTIME_max=%ld\n", pt);
20661     return (0);
20662     } /* check_max */
20663
20664 int check_min ()
20665 {
20666     tmp = NULL;
20667     pt  = 0;
20668 #ifdef MINLONG
20669     gm_check (MINLONG, -1900, 70);
20670 #endif
20671     if (tmp == NULL) {
20672         for (i = 36; i >= 0; i--) {
20673             time_t x = pt - ((time_t)1 << i);
20674             if (x > 0) continue;
20675             gm_check (x, -1900, 70);
20676             }
20677         }
20678     printf ("sGMTIME_min=%ld\n", pt);
20679     return (0);
20680     } /* check_min */
20681
20682 int main (int argc, char *argv[])
20683 {
20684     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20685     check_max ();
20686     check_min ();
20687     return (0);
20688     } /* main */
20689 EOCP
20690         set try
20691         if eval $compile; then
20692             eval `$run ./try`
20693         else
20694             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20695             fi
20696         $rm_try
20697         ;;
20698     esac
20699
20700 echo "Checking max offsets that localtime () accepts"
20701
20702 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20703     0/0|/)
20704         $cat >try.c <<EOCP
20705 #include <sys/types.h>
20706 #include <stdio.h>
20707 #include <time.h>
20708 $yyy
20709
20710 int i;
20711 struct tm *tmp;
20712 time_t pt;
20713
20714 void local_check (time_t t, int min_year, int max_year)
20715 {
20716     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20717         tmp = NULL;
20718     else
20719         tmp = localtime (&t);
20720     if ( tmp == NULL ||
20721         /* Check tm_year overflow */
20722          tmp->tm_year < min_year || tmp->tm_year > max_year)
20723         tmp = NULL;
20724     else
20725         pt = t;
20726     } /* local_check */
20727
20728 int check_max ()
20729 {
20730     tmp = NULL;
20731     pt  = 0;
20732 #ifdef MAXLONG
20733     local_check (MAXLONG, 69, 0x7fffffff);
20734 #endif
20735     if (tmp == NULL || tmp->tm_year < 0) {
20736         for (i = 63; i >= 0; i--) {
20737             time_t x = pt | ((time_t)1 << i);
20738             if (x < 0 || x < pt) continue;
20739             local_check (x, 69, 0x7fffffff);
20740             }
20741         }
20742     printf ("sLOCALTIME_max=%ld\n", pt);
20743     return (0);
20744    } /* check_max */
20745
20746 int check_min ()
20747 {
20748     tmp = NULL;
20749     pt  = 0;
20750 #ifdef MINLONG
20751     local_check (MINLONG, -1900, 70);
20752 #endif
20753     if (tmp == NULL) {
20754         for (i = 36; i >= 0; i--) {
20755             time_t x = pt - ((time_t)1 << i);
20756             if (x > 0) continue;
20757             local_check (x, -1900, 70);
20758             }
20759         }
20760     printf ("sLOCALTIME_min=%ld\n", pt);
20761     return (0);
20762     } /* check_min */
20763
20764 int main (int argc, char *argv[])
20765 {
20766     check_max ();
20767     check_min ();
20768     return (0);
20769     } /* main */
20770 EOCP
20771         set try
20772         if eval $compile; then
20773             eval `$run ./try`
20774         else
20775             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20776             fi
20777         $rm_try
20778         ;;
20779     esac
20780
20781 : check for type of arguments to select.
20782 case "$selecttype" in
20783 '') case "$d_select" in
20784         $define)
20785                 echo " "
20786                 $cat <<EOM
20787 Checking to see what type of arguments are accepted by select().
20788 EOM
20789                 hdrs="$define sys/types.h
20790                         $i_systime sys/time.h
20791                         $i_sysselct sys/select.h
20792                         $d_socket sys/socket.h"
20793                 : The first arg can be int, unsigned, or size_t
20794                 : The last arg may or may not be 'const'
20795                 val=''
20796                 : void pointer has been seen but using that
20797                 : breaks the selectminbits test
20798                 for xxx in 'fd_set *' 'int *'; do
20799                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20800                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20801                                         case "$val" in
20802                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20803                                                 if ./protochk "$try" $hdrs; then
20804                                                         echo "Your system accepts $xxx."
20805                                                         val="$xxx"
20806                                                 fi
20807                                                 ;;
20808                                         esac
20809                                 done
20810                         done
20811                 done
20812                 case "$val" in
20813                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20814                         case "$d_fd_set" in
20815                                 $define) dflt="fd_set *" ;;
20816                                 *)              dflt="int *" ;;
20817                         esac
20818                         . ./myread
20819                         val=$ans
20820                         ;;
20821                 esac
20822                 selecttype="$val"
20823                 ;;
20824         *)      : no select, so pick a harmless default
20825                 selecttype='int *'
20826                 ;;
20827         esac
20828         ;;
20829 esac
20830
20831 : check for the select 'width'
20832 case "$selectminbits" in
20833 '') safebits=`expr $ptrsize \* 8`
20834     case "$d_select" in
20835         $define)
20836                 $cat <<EOM
20837
20838 Checking to see on how many bits at a time your select() operates...
20839 EOM
20840                 $cat >try.c <<EOCP
20841 #include <sys/types.h>
20842 #$i_time I_TIME
20843 #$i_systime I_SYS_TIME
20844 #$i_systimek I_SYS_TIME_KERNEL
20845 #ifdef I_TIME
20846 #   include <time.h>
20847 #endif
20848 #ifdef I_SYS_TIME
20849 #   ifdef I_SYS_TIME_KERNEL
20850 #       define KERNEL
20851 #   endif
20852 #   include <sys/time.h>
20853 #   ifdef I_SYS_TIME_KERNEL
20854 #       undef KERNEL
20855 #   endif
20856 #endif
20857 #$i_sysselct I_SYS_SELECT
20858 #ifdef I_SYS_SELECT
20859 #include <sys/select.h>
20860 #endif
20861 #$d_socket HAS_SOCKET
20862 #ifdef HAS_SOCKET
20863 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20864 #endif
20865 #include <stdio.h>
20866 #$i_stdlib I_STDLIB
20867 #ifdef I_STDLIB
20868 #include <stdlib.h>
20869 #endif
20870 $selecttype b;
20871 #define S sizeof(*(b))
20872 #define MINBITS 64
20873 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20874 #define NBITS  (NBYTES * 8)
20875 int main() {
20876     char *s = (char *)malloc(NBYTES);
20877     struct timeval t;
20878     int i;
20879     FILE* fp;
20880     int fd;
20881
20882     if (!s)
20883         exit(1);
20884     fclose(stdin);
20885     fp = fopen("try.c", "r");
20886     if (fp == 0)
20887       exit(2);
20888     fd = fileno(fp);
20889     if (fd < 0)
20890       exit(3);
20891     b = ($selecttype)s;
20892     for (i = 0; i < NBITS; i++)
20893         FD_SET(i, b);
20894     t.tv_sec  = 0;
20895     t.tv_usec = 0;
20896     select(fd + 1, b, 0, 0, &t);
20897     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20898     free(s);
20899     printf("%d\n", i + 1);
20900     return 0;
20901 }
20902 EOCP
20903                 set try
20904                 if eval $compile_ok; then
20905                         selectminbits=`$run ./try`
20906                         case "$selectminbits" in
20907                         '')     cat >&4 <<EOM
20908 Cannot figure out on how many bits at a time your select() operates.
20909 I'll play safe and guess it is $safebits bits.
20910 EOM
20911                                 selectminbits=$safebits
20912                                 bits="$safebits bits"
20913                                 ;;
20914                         1)      bits="1 bit" ;;
20915                         *)      bits="$selectminbits bits" ;;
20916                         esac
20917                         echo "Your select() operates on $bits at a time." >&4
20918                 else
20919                         rp='What is the minimum number of bits your select() operates on?'
20920                         case "$byteorder" in
20921                         12345678)       dflt=64 ;;
20922                         1234)           dflt=32 ;;
20923                         *)              dflt=1  ;;
20924                         esac
20925                         . ./myread
20926                         val=$ans
20927                         selectminbits="$val"
20928                 fi
20929                 $rm_try
20930                 ;;
20931         *)      : no select, so pick a harmless default
20932                 selectminbits=$safebits
20933                 ;;
20934         esac
20935         ;;
20936 esac
20937
20938 : Trace out the files included by signal.h, then look for SIGxxx names.
20939 if [ "X$fieldn" = X ]; then
20940         : Just make some guesses.  We check them later.
20941         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20942 else
20943         xxx=`echo '#include <signal.h>' |
20944         $cppstdin $cppminus $cppflags 2>/dev/null |
20945         $grep '^[       ]*#.*include' |
20946         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20947                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20948 fi
20949 xxxfiles=''
20950 for xx in $xxx /dev/null ; do
20951         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20952 done
20953 case "$xxxfiles" in
20954 '')     xxxfiles=`./findhdr signal.h` ;;
20955 esac
20956 xxx=`awk '
20957 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20958         print substr($2, 4, 20)
20959 }
20960 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20961         print substr($3, 4, 20)
20962 }' $xxxfiles`
20963 : Append some common names just in case the awk scan failed.
20964 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20965 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20966 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20967 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20968 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20969
20970 : generate a few handy files for later
20971 $cat > signal.c <<EOCP
20972 #include <sys/types.h>
20973 #include <signal.h>
20974 #$i_stdlib I_STDLIB
20975 #ifdef I_STDLIB
20976 #include <stdlib.h>
20977 #endif
20978 #include <stdio.h>
20979 int main() {
20980
20981 /* Strange style to avoid deeply-nested #if/#else/#endif */
20982 #ifndef NSIG
20983 #  ifdef _NSIG
20984 #    define NSIG (_NSIG)
20985 #  endif
20986 #endif
20987
20988 #ifndef NSIG
20989 #  ifdef SIGMAX
20990 #    define NSIG (SIGMAX+1)
20991 #  endif
20992 #endif
20993
20994 #ifndef NSIG
20995 #  ifdef SIG_MAX
20996 #    define NSIG (SIG_MAX+1)
20997 #  endif
20998 #endif
20999
21000 #ifndef NSIG
21001 #  ifdef _SIG_MAX
21002 #    define NSIG (_SIG_MAX+1)
21003 #  endif
21004 #endif
21005
21006 #ifndef NSIG
21007 #  ifdef MAXSIG
21008 #    define NSIG (MAXSIG+1)
21009 #  endif
21010 #endif
21011
21012 #ifndef NSIG
21013 #  ifdef MAX_SIG
21014 #    define NSIG (MAX_SIG+1)
21015 #  endif
21016 #endif
21017
21018 #ifndef NSIG
21019 #  ifdef SIGARRAYSIZE
21020 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
21021 #  endif
21022 #endif
21023
21024 #ifndef NSIG
21025 #  ifdef _sys_nsig
21026 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
21027 #  endif
21028 #endif
21029
21030 /* Default to some arbitrary number that's big enough to get most
21031    of the common signals.
21032 */
21033 #ifndef NSIG
21034 #    define NSIG 50
21035 #endif
21036
21037 printf("NSIG %d\n", NSIG);
21038
21039 #ifndef JUST_NSIG
21040
21041 EOCP
21042
21043 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
21044 {
21045         printf "#ifdef SIG"; printf $1; printf "\n"
21046         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
21047         printf $1; printf ");\n"
21048         printf "#endif\n"
21049 }
21050 END {
21051         printf "#endif /* JUST_NSIG */\n";
21052         printf "exit(0);\n}\n";
21053 }
21054 ' >>signal.c
21055 $cat >signal.awk <<'EOP'
21056 BEGIN { ndups = 0 }
21057 $1 ~ /^NSIG$/ { nsig = $2 }
21058 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
21059     if ($2 > maxsig) { maxsig = $2 }
21060     if (sig_name[$2]) {
21061         dup_name[ndups] = $1
21062         dup_num[ndups] = $2
21063         ndups++
21064     }
21065     else {
21066         sig_name[$2] = $1
21067         sig_num[$2] = $2
21068     }
21069 }
21070 END {
21071     if (nsig == 0) {
21072         nsig = maxsig + 1
21073     }
21074     printf("NSIG %d\n", nsig);
21075     for (n = 1; n < nsig; n++) {
21076         if (sig_name[n]) {
21077             printf("%s %d\n", sig_name[n], sig_num[n])
21078         }
21079         else {
21080             printf("NUM%d %d\n", n, n)
21081         }
21082     }
21083     for (n = 0; n < ndups; n++) {
21084         printf("%s %d\n", dup_name[n], dup_num[n])
21085     }
21086 }
21087 EOP
21088 $cat >signal_cmd <<EOS
21089 $startsh
21090 if $test -s signal.lst; then
21091     echo "Using your existing signal.lst file"
21092         exit 0
21093 fi
21094 xxx="$xxx"
21095 EOS
21096 $cat >>signal_cmd <<'EOS'
21097
21098 set signal
21099 if eval $compile_ok; then
21100         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
21101                 $uniq | $awk -f signal.awk >signal.lst
21102 else
21103         echo "(I can't seem be able to compile the whole test program)" >&4
21104         echo "(I'll try it in little pieces.)" >&4
21105         set signal -DJUST_NSIG
21106         if eval $compile_ok; then
21107                 $run ./signal$_exe > signal.nsg
21108                 $cat signal.nsg
21109         else
21110                 echo "I can't seem to figure out how many signals you have." >&4
21111                 echo "Guessing 50." >&4
21112                 echo 'NSIG 50' > signal.nsg
21113         fi
21114         : Now look at all the signal names, one at a time.
21115         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
21116                 $cat > signal.c <<EOCP
21117 #include <sys/types.h>
21118 #include <signal.h>
21119 #include <stdio.h>
21120 int main() {
21121 printf("$xx %d\n", SIG${xx});
21122 return 0;
21123 }
21124 EOCP
21125                 set signal
21126                 if eval $compile; then
21127                         echo "SIG${xx} found."
21128                         $run ./signal$_exe  >> signal.ls1
21129                 else
21130                         echo "SIG${xx} NOT found."
21131                 fi
21132         done
21133         if $test -s signal.ls1; then
21134                 $cat signal.nsg signal.ls1 |
21135                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
21136         fi
21137
21138 fi
21139 if $test -s signal.lst; then
21140         :
21141 else
21142         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
21143         echo 'kill -l' >signal
21144         set X `csh -f <signal`
21145         $rm -f signal
21146         shift
21147         case $# in
21148         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
21149         esac
21150         echo $@ | $tr ' ' $trnl | \
21151             $awk '{ printf "%s %d\n", $1, ++s; }
21152                   END { printf "NSIG %d\n", ++s }' >signal.lst
21153 fi
21154 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
21155 EOS
21156 chmod a+x signal_cmd
21157 $eunicefix signal_cmd
21158
21159 : generate list of signal names
21160 echo " "
21161 case "$sig_name_init" in
21162 '') doinit=yes ;;
21163 *)  case "$sig_num_init" in
21164     ''|*,*) doinit=yes ;;
21165     esac ;;
21166 esac
21167 case "$doinit" in
21168 yes)
21169         echo "Generating a list of signal names and numbers..." >&4
21170         . ./signal_cmd
21171         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21172         sig_name=`$awk 'BEGIN { printf "ZERO " }
21173                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
21174         sig_num=`$awk  'BEGIN { printf "0 " }
21175                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
21176         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
21177                              !/^NSIG/   { printf "\"%s\", ", $1 }
21178                              END        { printf "0\n" }' signal.lst`
21179         sig_num_init=`$awk  'BEGIN      { printf "0, " }
21180                              !/^NSIG/   { printf "%d, ", $2}
21181                              END        { printf "0\n"}' signal.lst`
21182         ;;
21183 esac
21184 echo "The following $sig_count signals are available:"
21185 echo " "
21186 echo $sig_name | $awk \
21187 'BEGIN { linelen = 0 }
21188 {
21189         for (i = 1; i <= NF; i++) {
21190                 name = "SIG" $i " "
21191                 linelen = linelen + length(name)
21192                 if (linelen > 70) {
21193                         printf "\n"
21194                         linelen = length(name)
21195                 }
21196                 printf "%s", name
21197         }
21198         printf "\n"
21199 }'
21200 sig_size=`echo $sig_name | awk '{print NF}'`
21201 $rm -f signal signal.c signal.awk signal.lst signal_cmd
21202
21203 : Check size of size
21204 echo " "
21205 case "$sizetype" in
21206 *_t) zzz="$sizetype"    ;;
21207 *)   zzz="filesize"     ;;
21208 esac
21209 echo "Checking the size of $zzz..." >&4
21210 cat > try.c <<EOCP
21211 #include <sys/types.h>
21212 #include <stdio.h>
21213 #$i_stdlib I_STDLIB
21214 #ifdef I_STDLIB
21215 #include <stdlib.h>
21216 #endif
21217 int main() {
21218     printf("%d\n", (int)sizeof($sizetype));
21219     exit(0);
21220 }
21221 EOCP
21222 set try
21223 if eval $compile_ok; then
21224         yyy=`$run ./try`
21225         case "$yyy" in
21226         '')     sizesize=4
21227                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21228                 ;;
21229         *)      sizesize=$yyy
21230                 echo "Your $zzz size is $sizesize bytes."
21231                 ;;
21232         esac
21233 else
21234         sizesize=4
21235         echo "(I can't compile the test program--guessing $sizesize.)" >&4
21236 fi
21237
21238
21239 : check for socklen_t
21240 echo " "
21241 echo "Checking to see if you have socklen_t..." >&4
21242 $cat >try.c <<EOCP
21243 #include <sys/types.h>
21244 #$d_socket HAS_SOCKET
21245 #ifdef HAS_SOCKET
21246 #include <sys/socket.h>
21247 #endif
21248 int main() { socklen_t x = 16; }
21249 EOCP
21250 set try
21251 if eval $compile; then
21252         val="$define"
21253         echo "You have socklen_t."
21254 else
21255         val="$undef"
21256         echo "You do not have socklen_t."
21257         case "$sizetype" in
21258         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21259         esac
21260 fi
21261 $rm_try
21262 set d_socklen_t
21263 eval $setvar
21264
21265 : see if this is a socks.h system
21266 set socks.h i_socks
21267 eval $inhdr
21268
21269 : check for type of the size argument to socket calls
21270 case "$d_socket" in
21271 "$define")
21272         $cat <<EOM
21273
21274 Checking to see what type is the last argument of accept().
21275 EOM
21276         yyy=''
21277         case "$d_socklen_t" in
21278         "$define") yyy="$yyy socklen_t"
21279         esac
21280         yyy="$yyy $sizetype int long unsigned"
21281         for xxx in $yyy; do
21282                 case "$socksizetype" in
21283                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21284                         case "$usesocks" in
21285                         "$define")
21286                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21287                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21288                                         socksizetype="$xxx"
21289                                 fi
21290                                 ;;
21291                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21292                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21293                                         socksizetype="$xxx"
21294                                 fi
21295                                 ;;
21296                         esac
21297                         ;;
21298                 esac
21299         done
21300 : In case none of those worked, prompt the user.
21301         case "$socksizetype" in
21302         '')     rp='What is the type for socket address structure sizes?'
21303                 dflt='int'
21304                 . ./myread
21305                 socksizetype=$ans
21306                 ;;
21307         esac
21308         ;;
21309 *)      : no sockets, so pick relatively harmless default
21310         socksizetype='int'
21311         ;;
21312 esac
21313
21314 : see what type is used for signed size_t
21315 set ssize_t ssizetype int stdio.h sys/types.h
21316 eval $typedef
21317 dflt="$ssizetype"
21318 $cat > try.c <<EOM
21319 #include <stdio.h>
21320 #$i_stdlib I_STDLIB
21321 #ifdef I_STDLIB
21322 #include <stdlib.h>
21323 #endif
21324 #include <sys/types.h>
21325 #define Size_t $sizetype
21326 #define SSize_t $dflt
21327 int main()
21328 {
21329         if (sizeof(Size_t) == sizeof(SSize_t))
21330                 printf("$dflt\n");
21331         else if (sizeof(Size_t) == sizeof(int))
21332                 printf("int\n");
21333         else
21334                 printf("long\n");
21335         exit(0);
21336 }
21337 EOM
21338 echo " "
21339 set try
21340 if eval $compile_ok && $run ./try > /dev/null; then
21341         ssizetype=`$run ./try`
21342         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21343 else
21344         $cat >&4 <<EOM
21345 Help! I can't compile and run the ssize_t test program: please enlighten me!
21346 (This is probably a misconfiguration in your system or libraries, and
21347 you really ought to fix it.  Still, I'll try anyway.)
21348
21349 I need a type that is the same size as $sizetype, but is guaranteed to
21350 be signed.  Common values are ssize_t, int and long.
21351
21352 EOM
21353         rp="What signed type is the same size as $sizetype?"
21354         . ./myread
21355         ssizetype="$ans"
21356 fi
21357 $rm_try
21358
21359 : Check the size of st_ino
21360 $echo " "
21361 $echo "Checking the size of st_ino..." >&4
21362 $cat > try.c <<EOCP
21363 #include <sys/stat.h>
21364 #include <stdio.h>
21365 #$i_stdlib I_STDLIB
21366 #ifdef I_STDLIB
21367 #include <stdlib.h>
21368 #endif
21369 int main() {
21370     struct stat st;
21371     printf("%d\n", (int)sizeof(st.st_ino));
21372     exit(0);
21373 }
21374 EOCP
21375 set try
21376 if eval $compile_ok; then
21377         val=`$run ./try`
21378         case "$val" in
21379         '')     st_ino_size=4
21380                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21381                 ;;
21382         *)      st_ino_size=$val
21383                 $echo "Your st_ino is $st_ino_size bytes long."
21384                 ;;
21385         esac
21386 else
21387         st_ino_size=4
21388         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21389 fi
21390 $rm_try
21391
21392 : Check if st_ino is signed
21393 $echo " "
21394 $echo "Checking the sign of st_ino..." >&4
21395 $cat > try.c <<EOCP
21396 #include <sys/stat.h>
21397 #include <stdio.h>
21398 int main() {
21399         struct stat foo;
21400         foo.st_ino = -1;
21401         if (foo.st_ino < 0)
21402                 printf("-1\n");
21403         else
21404                 printf("1\n");
21405 }
21406 EOCP
21407 set try
21408 if eval $compile; then
21409         val=`$run ./try`
21410         case "$val" in
21411         '')     st_ino_sign=1
21412                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
21413                 ;;
21414         *)      st_ino_sign=$val
21415                 case "$st_ino_sign" in
21416                  1) $echo "Your st_ino is unsigned." ;;
21417                 -1) $echo "Your st_ino is signed."   ;;
21418                 esac
21419                 ;;
21420         esac
21421 else
21422         st_ino_sign=1
21423         $echo "(I can't compile the test program--guessing unsigned.)" >&4
21424 fi
21425 $rm_try
21426
21427 : see what type of char stdio uses.
21428 echo " "
21429 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21430 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21431         echo "Your stdio uses unsigned chars." >&4
21432         stdchar="unsigned char"
21433 else
21434         echo "Your stdio uses signed chars." >&4
21435         stdchar="char"
21436 fi
21437 $rm -f stdioh
21438
21439 : see what type uids are declared as in the kernel
21440 echo " "
21441 echo "Looking for the type for user ids returned by getuid()."
21442 set uid_t uidtype xxx stdio.h sys/types.h
21443 eval $typedef
21444 case "$uidtype" in
21445 xxx)
21446         xxx=`./findhdr sys/user.h`
21447         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21448         case $1 in
21449         unsigned) dflt="$1 $2" ;;
21450         *) dflt="$1" ;;
21451         esac
21452         ;;
21453 *) dflt="$uidtype";;
21454 esac
21455 case "$uidtype" in
21456 uid_t)  echo "uid_t found." ;;
21457 *)      rp="What is the type for user ids returned by getuid()?"
21458         . ./myread
21459         uidtype="$ans"
21460         ;;
21461 esac
21462
21463 : Check size of UID
21464 echo " "
21465 case "$uidtype" in
21466 *_t) zzz="$uidtype"     ;;
21467 *)   zzz="uid"          ;;
21468 esac
21469 echo "Checking the size of $zzz..." >&4
21470 cat > try.c <<EOCP
21471 #include <sys/types.h>
21472 #include <stdio.h>
21473 #$i_stdlib I_STDLIB
21474 #ifdef I_STDLIB
21475 #include <stdlib.h>
21476 #endif
21477 int main() {
21478     printf("%d\n", (int)sizeof($uidtype));
21479     exit(0);
21480 }
21481 EOCP
21482 set try
21483 if eval $compile_ok; then
21484         yyy=`$run ./try`
21485         case "$yyy" in
21486         '')     uidsize=4
21487                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21488                 ;;
21489         *)      uidsize=$yyy
21490                 echo "Your $zzz is $uidsize bytes long."
21491                 ;;
21492         esac
21493 else
21494         uidsize=4
21495         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21496 fi
21497
21498 : Check if UID is signed
21499 echo " "
21500 case "$uidtype" in
21501 *_t) zzz="$uidtype"     ;;
21502 *)   zzz="uid"          ;;
21503 esac
21504 echo "Checking the sign of $zzz..." >&4
21505 cat > try.c <<EOCP
21506 #include <sys/types.h>
21507 #include <stdio.h>
21508 int main() {
21509         $uidtype foo = -1;
21510         if (foo < 0)
21511                 printf("-1\n");
21512         else
21513                 printf("1\n");
21514 }
21515 EOCP
21516 set try
21517 if eval $compile; then
21518         yyy=`$run ./try`
21519         case "$yyy" in
21520         '')     uidsign=1
21521                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21522                 ;;
21523         *)      uidsign=$yyy
21524                 case "$uidsign" in
21525                  1) echo "Your $zzz is unsigned." ;;
21526                 -1) echo "Your $zzz is signed."   ;;
21527                 esac
21528                 ;;
21529         esac
21530 else
21531         uidsign=1
21532         echo "(I can't compile the test program--guessing unsigned.)" >&4
21533 fi
21534
21535
21536 : Check format string for UID
21537 echo " "
21538 $echo "Checking the format string to be used for uids..." >&4
21539
21540 case "$uidsign" in
21541 -1)     if $test X"$uidsize" = X"$ivsize"; then
21542                 uidformat="$ivdformat"
21543         else
21544                 if $test X"$uidsize" = X"$longsize"; then
21545                         uidformat='"ld"'
21546                 else
21547                         if $test X"$uidsize" = X"$intsize"; then
21548                                 uidformat='"d"'
21549                         else
21550                                 if $test X"$uidsize" = X"$shortsize"; then
21551                                         uidformat='"hd"'
21552                                 fi
21553                         fi
21554                 fi
21555         fi
21556         ;;
21557 *)      if $test X"$uidsize" = X"$uvsize"; then
21558                 uidformat="$uvuformat"
21559         else
21560                 if $test X"$uidsize" = X"$longsize"; then
21561                         uidformat='"lu"'
21562                 else
21563                         if $test X"$uidsize" = X"$intsize"; then
21564                                 uidformat='"u"'
21565                         else
21566                                 if $test X"$uidsize" = X"$shortsize"; then
21567                                         uidformat='"hu"'
21568                                 fi
21569                         fi
21570                 fi
21571         fi
21572         ;;
21573 esac
21574
21575 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
21576 echo " "
21577 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
21578 $cat >try.c <<'EOM'
21579 /* Intentionally a long probe as I'd like to sanity check that the exact
21580    approach is going to work, as thinking it will work, but only having it
21581    part working at runtime is worse than not having it.  */
21582
21583 #include <sys/types.h>
21584 #include <sys/sysctl.h>
21585 #include <sys/param.h>
21586 #include <stdio.h>
21587 #include <string.h>
21588 #include <stdlib.h>
21589 #include <unistd.h>
21590
21591 int
21592 main(int argc, char **argv) {
21593     char *buffer;
21594     char *argv_leaf = strrchr(argv[0], '/');
21595     char *buffer_leaf;
21596     size_t size = 0;
21597     int mib[4];
21598
21599     mib[0] = CTL_KERN;
21600     mib[1] = KERN_PROC;
21601     mib[2] = KERN_PROC_PATHNAME;
21602     mib[3] = -1;
21603
21604     if (!argv_leaf) {
21605         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21606         return 1;
21607     }
21608
21609     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
21610         perror("sysctl");
21611         return 2;
21612     }
21613
21614     if (size < strlen(argv_leaf) + 1) {
21615         fprintf(stderr, "size %lu is too short for a path\n",
21616                 (unsigned long) size);
21617         return 3;
21618     }
21619
21620     if (size > MAXPATHLEN * MAXPATHLEN) {
21621         fprintf(stderr, "size %lu is too long for a path\n",
21622                 (unsigned long) size);
21623         return 4;
21624     }
21625
21626     buffer = malloc(size);
21627     if (!buffer) {
21628         perror("malloc");
21629         return 5;
21630     }
21631
21632     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
21633         perror("sysctl");
21634         return 6;
21635     }
21636
21637     if (strlen(buffer) + 1 != size) {
21638         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
21639                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
21640         return 7;
21641     }
21642
21643
21644     if (*buffer != '/') {
21645         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
21646         return 8;
21647     }
21648
21649     if (strstr(buffer, "/./")) {
21650         fprintf(stderr, "Contains /./: '%s'\n", buffer);
21651         return 9;
21652     }
21653
21654     if (strstr(buffer, "/../")) {
21655         fprintf(stderr, "Contains /../: '%s'\n", buffer);
21656         return 10;
21657     }
21658
21659     buffer_leaf = strrchr(buffer, '/');
21660     if (strcmp(buffer_leaf, argv_leaf) != 0) {
21661         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
21662         return 11;
21663     }
21664
21665     free(buffer);
21666
21667     return 0;
21668 }
21669 EOM
21670
21671 val=$undef
21672 set try
21673 if eval $compile; then
21674         if $run ./try; then
21675                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
21676                 val="$define"
21677         else
21678                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
21679                 val="$undef"
21680         fi
21681 else
21682         echo "I'm unable to compile the test program." >&4
21683         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
21684         val="$undef"
21685 fi
21686 $rm_try
21687 set usekernprocpathname
21688 eval $setvar
21689
21690 : Determine if we can use _NSGetExecutablePath to find executing program
21691 echo " "
21692 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
21693 $cat >try.c <<'EOM'
21694 /* Intentionally a long probe as I'd like to sanity check that the exact
21695    approach is going to work, as thinking it will work, but only having it
21696    part working at runtime is worse than not having it.  */
21697 #include <mach-o/dyld.h>
21698 #include <stdio.h>
21699 #include <stdlib.h>
21700 #include <sys/param.h>
21701 #include <string.h>
21702
21703 int
21704 main(int argc, char **argv) {
21705     char buf[1];
21706     uint32_t size = sizeof(buf);
21707     int result;
21708     char *buffer;
21709     char *tidied;
21710     char *argv_leaf = strrchr(argv[0], '/');
21711     char *tidied_leaf;
21712
21713     if (!argv_leaf) {
21714         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21715         return 1;
21716     }
21717
21718     _NSGetExecutablePath(buf, &size);
21719     if (size > MAXPATHLEN * MAXPATHLEN) {
21720         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
21721                 (unsigned int) size);
21722         return 2;
21723     }
21724
21725     buffer = malloc(size);
21726     if (!buffer) {
21727         perror("malloc");
21728         return 3;
21729     }
21730
21731     result = _NSGetExecutablePath(buffer, &size);
21732     if (result != 0) {
21733         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
21734                 result, (unsigned int) size);
21735         return 4;
21736     }
21737
21738     tidied = realpath(buffer, NULL);
21739     if (!tidied) {
21740         perror("realpath");
21741         return 5;
21742     }
21743
21744     free(buffer);
21745
21746     if (*tidied != '/') {
21747         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
21748         return 6;
21749     }
21750
21751     if (strstr(tidied, "/./")) {
21752         fprintf(stderr, "Contains /./: '%s'\n", tidied);
21753         return 7;
21754     }
21755
21756     if (strstr(tidied, "/../")) {
21757         fprintf(stderr, "Contains /../: '%s'\n", tidied);
21758         return 8;
21759     }
21760
21761     tidied_leaf = strrchr(tidied, '/');
21762     if (strcmp(tidied_leaf, argv_leaf) != 0) {
21763         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
21764         return 9;
21765     }
21766
21767     free(tidied);
21768
21769     return 0;
21770 }
21771 EOM
21772
21773 val=$undef
21774 set try
21775 if eval $compile; then
21776         if $run ./try; then
21777                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
21778                 val="$define"
21779         else
21780                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
21781         fi
21782 else
21783         echo "I'm unable to compile the test program." >&4
21784         echo "I'll assume no _NSGetExecutablePath here." >&4
21785 fi
21786 $rm_try
21787 set usensgetexecutablepath
21788 eval $setvar
21789
21790 : Check if site customization support was requested
21791 case "$usesitecustomize" in
21792     $define|true|[Yy]*)
21793         usesitecustomize="$define"
21794         ;;
21795     *)
21796         usesitecustomize="$undef"
21797         ;;
21798     esac
21799
21800 : see if prototypes support variable argument declarations
21801 echo " "
21802 case "$prototype$i_stdarg" in
21803 $define$define)
21804         echo "It appears we'll be able to prototype varargs functions." >&4
21805         val="$define"
21806         ;;
21807 *)
21808         echo "Too bad... We won't be using prototyped varargs functions..." >&4
21809         val="$undef"
21810         ;;
21811 esac
21812 set vaproto
21813 eval $setvar
21814
21815 : determine compiler compiler
21816 case "$yacc" in
21817 '')
21818         dflt=yacc;;
21819 *)
21820         dflt="$yacc";;
21821 esac
21822 echo " "
21823 comp='yacc'
21824 if $test -f "$byacc$_exe"; then
21825         dflt="$byacc"
21826         comp="byacc or $comp"
21827 fi
21828 if $test -f "$bison$_exe"; then
21829         comp="$comp or bison -y"
21830 fi
21831 rp="Which compiler compiler ($comp) shall I use?"
21832 . ./myread
21833 yacc="$ans"
21834 case "$yacc" in
21835 *bis*)
21836         case "$yacc" in
21837         *-y*) ;;
21838         *)
21839                 yacc="$yacc -y"
21840                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
21841                 ;;
21842         esac
21843         ;;
21844 esac
21845
21846 : see if this is a assert.h system
21847 set assert.h i_assert
21848 eval $inhdr
21849
21850 : see if this is a fp.h system
21851 set fp.h i_fp
21852 eval $inhdr
21853
21854 : see if this is a fp_class.h system
21855 set fp_class.h i_fp_class
21856 eval $inhdr
21857
21858 : see if gdbm.h is available
21859 set gdbm.h t_gdbm
21860 eval $inhdr
21861 case "$t_gdbm" in
21862 $define)
21863         : see if gdbm_open exists
21864         set gdbm_open d_gdbm_open
21865         eval $inlibc
21866         case "$d_gdbm_open" in
21867         $undef)
21868                 t_gdbm="$undef"
21869                 echo "We won't be including <gdbm.h>"
21870                 ;;
21871         esac
21872         ;;
21873 esac
21874 val="$t_gdbm"
21875 set i_gdbm
21876 eval $setvar
21877
21878 : see if this is a ieeefp.h system
21879 case "$i_ieeefp" in
21880 '' ) set ieeefp.h i_ieeefp
21881      eval $inhdr
21882      ;;
21883 esac
21884
21885 : see if this is a libutil.h system
21886 set libutil.h i_libutil
21887 eval $inhdr
21888
21889 : see if mach cthreads are available
21890 if test "X$usethreads" = "X$define"; then
21891         set mach/cthreads.h i_machcthr
21892         eval $inhdr
21893 else
21894         i_machcthr="$undef"
21895 fi
21896
21897 : see if this is a mntent.h system
21898 set mntent.h i_mntent
21899 eval $inhdr
21900
21901 : see if net/errno.h is available
21902 val=''
21903 set net/errno.h val
21904 eval $inhdr
21905
21906 : Unfortunately, it causes problems on some systems.  Arrgh.
21907 case "$val" in
21908 $define)
21909         cat > try.c <<'EOM'
21910 #include <stdio.h>
21911 #include <errno.h>
21912 #include <net/errno.h>
21913 int func()
21914 {
21915         return ENOTSOCK;
21916 }
21917 EOM
21918         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21919                 echo "We'll be including <net/errno.h>." >&4
21920         else
21921                 echo "We won't be including <net/errno.h>." >&4
21922                 val="$undef"
21923         fi
21924         $rm_try
21925         ;;
21926 esac
21927 set i_neterrno
21928 eval $setvar
21929
21930 : see if netinet/tcp.h is available
21931 set netinet/tcp.h i_netinettcp
21932 eval $inhdr
21933
21934 : see if this is a poll.h system
21935 set poll.h i_poll
21936 eval $inhdr
21937
21938 : see if this is a prot.h system
21939 set prot.h i_prot
21940 eval $inhdr
21941
21942 : Preprocessor symbols
21943 echo " "
21944 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21945 $cat <<'EOSH' > Cppsym.know
21946 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21947 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21948 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21949 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21950 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21951 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21952 bull c cadmus clipper CMU COFF COMPILER_VERSION
21953 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21954 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21955 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21956 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21957 GLIBC GLIBC_MINOR
21958 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21959 H3050R H3050RX hbullx20 hcx host_mips
21960 hp200 hp300 hp700 HP700 hp800 hp9000
21961 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21962 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21963 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21964 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21965 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21966 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21967 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21968 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21969 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21970 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21971 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21972 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21973 MATH_HAS_NO_SIDE_EFFECTS
21974 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21975 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21976 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21977 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21978 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21979 NetBSD news1500 news1700 news1800 news1900 news3700
21980 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21981 ns32016 ns32332 ns32k nsc32000
21982 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21983 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21984 pc532 pdp11 PGC PIC plexus PORTAR posix
21985 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21986 POSIX_C_SOURCE POSIX_SOURCE POWER
21987 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21988 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21989 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21990 sony sony_news sonyrisc sparc sparclite spectrum
21991 stardent stdc STDC_EXT stratos sun sun3 sun386
21992 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21993 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21994 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21995 sysV68 sysV88 Tek4132 Tek4300 titan
21996 TM3200 TM5400 TM5600
21997 tower tower32 tower32_200 tower32_600 tower32_700
21998 tower32_800 tower32_850 tss
21999 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
22000 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
22001 unix UNIX95 UNIX99 unixpc unos
22002 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
22003 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
22004 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
22005 USGr4 USGr4_2
22006 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
22007 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
22008 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
22009 z8000
22010 EOSH
22011 # Maybe put other stuff here too.
22012 cat <<EOSH >>Cppsym.know
22013 $osname
22014 EOSH
22015 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
22016 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
22017 $cat Cppsym.know > Cppsym.c
22018 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
22019 $rm -f Cppsym.a Cppsym.b Cppsym.c
22020 cat <<EOSH > Cppsym
22021 $startsh
22022 if $test \$# -gt 0; then
22023     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
22024     if $test -s Cppsym.got; then
22025         $rm -f Cppsym.got
22026         exit 0
22027     fi
22028     $rm -f Cppsym.got
22029     exit 1
22030 else
22031     $tr " " "$trnl" | ./Cppsym.try
22032     exit 0
22033 fi
22034 EOSH
22035 chmod +x Cppsym
22036 $eunicefix Cppsym
22037 cat <<EOSH > Cppsym.try
22038 $startsh
22039 cat <<'EOCP' > try.c
22040 #include <stdio.h>
22041 #if cpp_stuff == 1
22042 #define STRINGIFY(a)    "a"
22043 #endif
22044 #if cpp_stuff == 42
22045 #define StGiFy(a)  #a
22046 #define STRINGIFY(a)    StGiFy(a)
22047 #endif
22048 #if $cpp_stuff != 1 && $cpp_stuff != 42
22049 #   include "Bletch: How does this C preprocessor stringify macros?"
22050 #endif
22051 int main() {
22052 EOCP
22053 $awk \\
22054 EOSH
22055 cat <<'EOSH' >> Cppsym.try
22056 'length($1) > 0 {
22057     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
22058     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
22059     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
22060     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
22061 }'       >> try.c
22062 echo 'return 0;}' >> try.c
22063 EOSH
22064 cat <<EOSH >> Cppsym.try
22065 ccflags="$ccflags"
22066 case "$osname-$gccversion" in
22067 irix-) ccflags="\$ccflags -woff 1178" ;;
22068 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
22069 esac
22070 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
22071 EOSH
22072 chmod +x Cppsym.try
22073 $eunicefix Cppsym.try
22074 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
22075 : Add in any Linux cpp "predefined macros":
22076 case "$osname::$gccversion" in
22077   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
22078     tHdrH=_tmpHdr
22079     rm -f $tHdrH'.h' $tHdrH
22080     touch $tHdrH'.h'
22081     # Filter out macro arguments, such as Linux's __INT8_C(c)
22082     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
22083        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
22084        if [ -s $tHdrH'_cppsym.real' ]; then
22085           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
22086        fi
22087     fi
22088     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
22089   ;;
22090 esac
22091 : now check the C compiler for additional symbols
22092 postprocess_cc_v=''
22093 case "$osname" in
22094 aix) postprocess_cc_v="|$tr , ' '" ;;
22095 esac
22096 $cat >ccsym <<EOS
22097 $startsh
22098 $cat >tmp.c <<EOF
22099 extern int foo;
22100 EOF
22101 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
22102 do
22103         case "\$i" in
22104         -D*) echo "\$i" | $sed 's/^-D//';;
22105         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
22106         esac
22107 done
22108 $rm_try
22109 EOS
22110 postprocess_cc_v=''
22111 chmod +x ccsym
22112 $eunicefix ccsym
22113 ./ccsym > ccsym1.raw
22114 if $test -s ccsym1.raw; then
22115        $sort ccsym1.raw | $uniq >ccsym.raw
22116 else
22117        mv ccsym1.raw ccsym.raw
22118 fi
22119
22120 $awk '/\=/ { print $0; next }
22121         { print $0"=1" }' ccsym.raw >ccsym.list
22122 $comm -13 Cppsym.true ccsym.list >ccsym.own
22123 $comm -12 Cppsym.true ccsym.list >ccsym.com
22124 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
22125 also=''
22126 if $test -z ccsym.raw; then
22127         echo "Your C compiler doesn't seem to define any symbols!" >&4
22128         echo " "
22129         echo "However, your C preprocessor defines the following symbols:"
22130         $cat Cppsym.true
22131         ccsymbols=''
22132         cppsymbols=`$cat Cppsym.true`
22133         cppsymbols=`echo $cppsymbols`
22134         cppccsymbols="$cppsymbols"
22135 else
22136         if $test -s ccsym.com; then
22137                 echo "Your C compiler and pre-processor define these symbols:"
22138                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
22139                 also='also '
22140                 symbols='ones'
22141                 cppccsymbols=`$cat ccsym.com`
22142                 cppccsymbols=`echo $cppccsymbols`
22143                 $test "$silent" || sleep 1
22144         fi
22145         if $test -s ccsym.cpp; then
22146                 $test "$also" && echo " "
22147                 echo "Your C pre-processor ${also}defines the following symbols:"
22148                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22149                 also='further '
22150                 cppsymbols=`$cat ccsym.cpp`
22151                 cppsymbols=`echo $cppsymbols`
22152                 $test "$silent" || sleep 1
22153         fi
22154         if $test -s ccsym.own; then
22155                 $test "$also" && echo " "
22156                 echo "Your C compiler ${also}defines the following cpp symbols:"
22157                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
22158                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22159                 ccsymbols=`$cat ccsym.own`
22160                 ccsymbols=`echo $ccsymbols`
22161                 $test "$silent" || sleep 1
22162         fi
22163 fi
22164
22165 : see if this is a termio system
22166 val="$undef"
22167 val2="$undef"
22168 val3="$undef"
22169 if $test `./findhdr termios.h`; then
22170         set tcsetattr i_termios
22171         eval $inlibc
22172         val3="$i_termios"
22173 fi
22174 echo " "
22175 case "$val3" in
22176 "$define") echo "You have POSIX termios.h... good!" >&4;;
22177 *) if ./Cppsym pyr; then
22178                 case "`/bin/universe`" in
22179                 ucb) if $test `./findhdr sgtty.h`; then
22180                                 val2="$define"
22181                                 echo "<sgtty.h> found." >&4
22182                         else
22183                                 echo "System is pyramid with BSD universe."
22184                                 ./warn "<sgtty.h> not found--you could have problems."
22185                         fi;;
22186                 *) if $test `./findhdr termio.h`; then
22187                                 val="$define"
22188                                 echo "<termio.h> found." >&4
22189                         else
22190                                 echo "System is pyramid with USG universe."
22191                                 ./warn "<termio.h> not found--you could have problems."
22192                         fi;;
22193                 esac
22194         elif ./usg; then
22195                 if $test `./findhdr termio.h`; then
22196                         echo "<termio.h> found." >&4
22197                         val="$define"
22198                 elif $test `./findhdr sgtty.h`; then
22199                         echo "<sgtty.h> found." >&4
22200                         val2="$define"
22201                 else
22202                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
22203                 fi
22204         else
22205                 if $test `./findhdr sgtty.h`; then
22206                         echo "<sgtty.h> found." >&4
22207                         val2="$define"
22208                 elif $test `./findhdr termio.h`; then
22209                         echo "<termio.h> found." >&4
22210                         val="$define"
22211                 else
22212                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
22213                 fi
22214         fi;;
22215 esac
22216 set i_termio; eval $setvar
22217 val=$val2; set i_sgtty; eval $setvar
22218 val=$val3; set i_termios; eval $setvar
22219
22220 : see if stdbool is available
22221 : we want a real compile instead of Inhdr because some Solaris systems
22222 : have stdbool.h, but it can only be used if the compiler indicates it
22223 : is sufficiently c99-compliant.
22224 echo " "
22225 $cat >try.c <<EOCP
22226 #include <stdio.h>
22227 #include <stdbool.h>
22228 int func(bool x)
22229 {
22230     return x ? 1 : 0;
22231 }
22232 int main(int argc, char **argv)
22233 {
22234     return func(0);
22235 }
22236 EOCP
22237 set try
22238 if eval $compile; then
22239         echo "<stdbool.h> found." >&4
22240         val="$define"
22241 else
22242         echo "<stdbool.h> NOT found." >&4
22243         val="$undef"
22244 fi
22245 $rm_try
22246 set i_stdbool
22247 eval $setvar
22248
22249 : see if stddef is available
22250 set stddef.h i_stddef
22251 eval $inhdr
22252
22253 : see if sys/access.h is available
22254 set sys/access.h i_sysaccess
22255 eval $inhdr
22256
22257 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
22258 set sys/filio.h i_sysfilio
22259 eval $inhdr
22260 echo " "
22261 if $test `./findhdr sys/ioctl.h`; then
22262         val="$define"
22263         echo '<sys/ioctl.h> found.' >&4
22264 else
22265         val="$undef"
22266         if $test $i_sysfilio = "$define"; then
22267             echo '<sys/ioctl.h> NOT found.' >&4
22268         else
22269                 $test $i_sgtty = "$define" && xxx="sgtty.h"
22270                 $test $i_termio = "$define" && xxx="termio.h"
22271                 $test $i_termios = "$define" && xxx="termios.h"
22272 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
22273         fi
22274 fi
22275 set i_sysioctl
22276 eval $setvar
22277
22278 : see if socket ioctl defs are in sys/sockio.h
22279 echo " "
22280 xxx=`./findhdr sys/sockio.h`
22281 if $test "$xxx"; then
22282         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
22283                 val="$define"
22284                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
22285         else
22286                 val="$undef"
22287                 echo "No socket ioctls found in <sys/sockio.h>." >&4
22288         fi
22289 else
22290         val="$undef"
22291         $cat <<EOM
22292 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
22293 EOM
22294 fi
22295 set i_syssockio
22296 eval $setvar
22297
22298 : see if this is a syslog.h system
22299 set syslog.h i_syslog
22300 eval $inhdr
22301
22302 : see if this is a sys/mode.h system
22303 set sys/mode.h i_sysmode
22304 eval $inhdr
22305
22306 : see if there is a sys/poll.h file
22307 set sys/poll.h i_syspoll
22308 eval $inhdr
22309
22310 : see if sys/resource.h has to be included
22311 set sys/resource.h i_sysresrc
22312 eval $inhdr
22313
22314 : see if sys/security.h is available
22315 set sys/security.h i_syssecrt
22316 eval $inhdr
22317
22318 : see if this is a sys/statvfs.h system
22319 set sys/statvfs.h i_sysstatvfs
22320 eval $inhdr
22321
22322 : see if this is a sys/un.h system
22323 set sys/un.h i_sysun
22324 eval $inhdr
22325
22326 : see if this is a sys/utsname.h system
22327 set sys/utsname.h i_sysutsname
22328 eval $inhdr
22329
22330 : see if this is a syswait system
22331 set sys/wait.h i_syswait
22332 eval $inhdr
22333
22334 : see if this is a ustat.h system
22335 set ustat.h i_ustat
22336 eval $inhdr
22337
22338 : see if this is an utime system
22339 set utime.h i_utime
22340 eval $inhdr
22341
22342 : see if this is a vfork system
22343 case "$d_vfork" in
22344 "$define")
22345         set vfork.h i_vfork
22346         eval $inhdr
22347         ;;
22348 *)
22349         i_vfork="$undef"
22350         ;;
22351 esac
22352
22353 : Check extensions
22354 echo " "
22355 echo "Looking for extensions..." >&4
22356 : If we are using the old config.sh, known_extensions may contain
22357 : old or inaccurate or duplicate values.
22358 known_extensions=''
22359 nonxs_extensions=''
22360 : We do not use find because it might not be available.
22361 : We do not just use MANIFEST because the user may have dropped
22362 : some additional extensions into the source tree and expect them
22363 : to be built.
22364
22365 : Function to recursively find available extensions, ignoring DynaLoader
22366 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
22367 : In 5.10.1 and later, extensions are stored in directories
22368 : like File-Glob instead of the older File/Glob/.
22369 find_extensions='
22370     for xxx in *; do
22371         case "$xxx" in
22372             DynaLoader|dynaload) ;;
22373             *)
22374             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
22375             leaf=`echo $xxx | $sed -e s/.*-//`;
22376             if $test -d File; then
22377                 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
22378                     known_extensions="$known_extensions $1$this_ext";
22379                 elif $test -f $xxx/Makefile.PL; then
22380                     nonxs_extensions="$nonxs_extensions $1$this_ext";
22381                 else
22382                     if $test -d $xxx -a $# -lt 10; then
22383                         set $1$xxx/ $*;
22384                         cd "$xxx";
22385                         eval $find_extensions;
22386                         cd ..;
22387                         shift;
22388                     fi;
22389                 fi;
22390             else
22391                 echo " $known_extensions $nonxs_extensions" > $$.tmp;
22392                 if $contains " $this_ext " $$.tmp; then
22393                     echo >&4;
22394                     echo "Duplicate directories detected for extension $xxx" >&4;
22395                     echo "Configure cannot correctly recover from this - shall I abort?" >&4;
22396                     case "$knowitall" in
22397                     "") dflt=y;;
22398                     *) dflt=n;;
22399                     esac;
22400                     . ../UU/myread;
22401                     case "$ans" in
22402                     n*|N*) ;;
22403                     *) echo >&4;
22404                        echo "Ok.  Stopping Configure." >&4;
22405                        echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
22406                         exit 1;;
22407                     esac;
22408                     echo "Ok.  You will need to correct config.sh before running make." >&4;
22409                 fi;
22410                 $ls -1 $xxx > $$.tmp;
22411                 if   $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
22412                     known_extensions="$known_extensions $this_ext";
22413                 elif $contains "\.c$"  $$.tmp > /dev/null 2>&1; then
22414                     known_extensions="$known_extensions $this_ext";
22415                 elif $test -d $xxx; then
22416                     nonxs_extensions="$nonxs_extensions $this_ext";
22417                 fi;
22418                 $rm -f $$.tmp;
22419             fi
22420             ;;
22421         esac;
22422     done'
22423 tdir=`pwd`
22424 cd "$rsrc/cpan"
22425 set X
22426 shift
22427 eval $find_extensions
22428 cd "$rsrc/dist"
22429 set X
22430 shift
22431 eval $find_extensions
22432 cd "$rsrc/ext"
22433 set X
22434 shift
22435 eval $find_extensions
22436 if $test -d File-Glob; then
22437     : All ext/ flattened
22438 else
22439     # Special case:  Add in modules that nest beyond the first level.
22440     # Currently threads/shared and Hash/Util/FieldHash, since they are
22441     # not picked up by the recursive find above (and adding in general
22442     # recursive finding breaks SDBM_File/sdbm).
22443     # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
22444     known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
22445 fi
22446 set X $known_extensions
22447 shift
22448 known_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22449 set X $nonxs_extensions
22450 shift
22451 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22452 cd "$tdir"
22453
22454 : Now see which are supported on this system.
22455 avail_ext=''
22456 for xxx in $known_extensions ; do
22457         case "$xxx" in
22458         DB_File|db_file)
22459                 case "$i_db" in
22460                 $define) avail_ext="$avail_ext $xxx" ;;
22461                 esac
22462                 ;;
22463         GDBM_File|gdbm_fil)
22464                 case "$i_gdbm" in
22465                 $define) avail_ext="$avail_ext $xxx" ;;
22466                 esac
22467                 ;;
22468         I18N/Langinfo|i18n_lan)
22469                 case "$i_langinfo$d_nl_langinfo" in
22470                 $define$define) avail_ext="$avail_ext $xxx" ;;
22471                 esac
22472                 ;;
22473         IPC/SysV|ipc/sysv)
22474                 : XXX Do we need a useipcsysv variable here
22475                 case "${d_msg}${d_sem}${d_shm}" in
22476                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
22477                 esac
22478                 ;;
22479         NDBM_File|ndbm_fil)
22480                 case "$d_ndbm" in
22481                 $define)
22482                     case "$osname-$use64bitint" in
22483                     hpux-define)
22484                         case "$libs" in
22485                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
22486                         esac
22487                         ;;
22488                     *) avail_ext="$avail_ext $xxx" ;;
22489                     esac
22490                     ;;
22491                 esac
22492                 ;;
22493         ODBM_File|odbm_fil)
22494                 case "${i_dbm}${i_rpcsvcdbm}" in
22495                 *"${define}"*)
22496                     case "$d_cplusplus" in
22497                     define) ;; # delete as a function name will not work
22498                     *)  case "$osname-$use64bitint" in
22499                         hpux-define)
22500                             case "$libs" in
22501                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22502                             esac
22503                             ;;
22504                         *) avail_ext="$avail_ext $xxx" ;;
22505                         esac
22506                         ;;
22507                     esac
22508                     ;;
22509                 esac
22510                 ;;
22511         Opcode|opcode)
22512                 case "$useopcode" in
22513                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22514                 esac
22515                 ;;
22516         POSIX|posix)
22517                 case "$useposix" in
22518                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22519                 esac
22520                 ;;
22521         Socket|socket)
22522                 case "$d_socket" in
22523                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22524                 esac
22525                 ;;
22526         Sys/Syslog|sys/syslog)
22527                 : XXX syslog requires socket
22528                 case "$d_socket" in
22529                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22530                 esac
22531                 ;;
22532         Thread|thread)
22533                 case "$usethreads" in
22534                 true|$define|y)
22535                         case "$use5005threads" in
22536                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
22537                         esac
22538                 esac
22539                 ;;
22540         threads|threads/shared)
22541                 # threads and threads::shared are special cases.
22542                 # To stop people from asking "Perl 5.8.0 was supposed
22543                 # to have this new fancy threads implementation but my
22544                 # perl doesn't have it" and from people trying to
22545                 # (re)install the threads module using CPAN.pm and
22546                 # CPAN.pm then offering to reinstall Perl 5.8.0,
22547                 # the threads.pm and threads/shared.pm will always be
22548                 # there, croaking informatively ("you need to rebuild
22549                 # all of Perl with threads, sorry") when threads haven't
22550                 # been compiled in.
22551                 # --jhi
22552                 avail_ext="$avail_ext $xxx"
22553                 ;;
22554         VMS*)
22555                 ;;
22556         Win32*)
22557                 case "$osname" in
22558                 cygwin) avail_ext="$avail_ext $xxx" ;;
22559                 esac
22560                 ;;
22561         XS/APItest|xs/apitest)
22562                 # This is just for testing.  Skip it unless we have dynamic loading.
22563
22564                 case "$usedl" in
22565                 $define) avail_ext="$avail_ext $xxx" ;;
22566                 esac
22567                 ;;
22568         XS/Typemap|xs/typemap)
22569                 # This is just for testing.  Skip it unless we have dynamic loading.
22570                 case "$usedl" in
22571                 $define) avail_ext="$avail_ext $xxx" ;;
22572                 esac
22573                 ;;
22574         *)      avail_ext="$avail_ext $xxx"
22575                 ;;
22576         esac
22577 done
22578
22579 set X $avail_ext
22580 shift
22581 avail_ext="$*"
22582
22583 case "$onlyextensions" in
22584 '') ;;
22585 *)  keepextensions=''
22586     echo "You have requested that only certain extensions be included..." >&4
22587     for i in $onlyextensions; do
22588         case " $avail_ext " in
22589         *" $i "*)
22590             echo "Keeping extension $i."
22591             keepextensions="$keepextensions $i"
22592             ;;
22593         *) echo "Ignoring extension $i." ;;
22594         esac
22595     done
22596     avail_ext="$keepextensions"
22597     ;;
22598 esac
22599
22600 case "$noextensions" in
22601 '') ;;
22602 *)  keepextensions=''
22603     echo "You have requested that certain extensions be ignored..." >&4
22604     for i in $avail_ext; do
22605         case " $noextensions " in
22606         *" $i "*) echo "Ignoring extension $i." ;;
22607         *) echo "Keeping extension $i.";
22608            keepextensions="$keepextensions $i"
22609            ;;
22610         esac
22611     done
22612     avail_ext="$keepextensions"
22613     ;;
22614 esac
22615
22616 : Now see which nonxs extensions are supported on this system.
22617 : For now assume all are.
22618 nonxs_ext=''
22619 for xxx in $nonxs_extensions ; do
22620         case "$xxx" in
22621         *)      nonxs_ext="$nonxs_ext $xxx"
22622                 ;;
22623         esac
22624 done
22625
22626 set X $nonxs_ext
22627 shift
22628 nonxs_ext="$*"
22629
22630 case $usedl in
22631 $define)
22632         $cat <<EOM
22633 A number of extensions are supplied with $package.  You may choose to
22634 compile these extensions for dynamic loading (the default), compile
22635 them into the $package executable (static loading), or not include
22636 them at all.  Answer "none" to include no extensions.
22637 Note that DynaLoader is always built and need not be mentioned here.
22638
22639 EOM
22640         case "$dynamic_ext" in
22641         '')
22642                 : Exclude those listed in static_ext
22643                 dflt=''
22644                 for xxx in $avail_ext; do
22645                         case " $static_ext " in
22646                         *" $xxx "*) ;;
22647                         *) dflt="$dflt $xxx" ;;
22648                         esac
22649                 done
22650                 set X $dflt
22651                 shift
22652                 dflt="$*"
22653                 ;;
22654         *)      dflt="$dynamic_ext"
22655                 # Perhaps we are reusing an old out-of-date config.sh.
22656                 case "$hint" in
22657                 previous)
22658                         if test X"$dynamic_ext" != X"$avail_ext"; then
22659                                 $cat <<EOM
22660 NOTICE:  Your previous config.sh list may be incorrect.
22661 The extensions now available to you are
22662         ${avail_ext}
22663 but the default list from your previous config.sh is
22664         ${dynamic_ext}
22665
22666 EOM
22667                         fi
22668                         ;;
22669                 esac
22670                 ;;
22671         esac
22672         case "$dflt" in
22673         '')     dflt=none;;
22674         esac
22675         rp="What extensions do you wish to load dynamically?"
22676         . ./myread
22677         case "$ans" in
22678         none) dynamic_ext=' ' ;;
22679         *) dynamic_ext="$ans" ;;
22680         esac
22681
22682         case "$static_ext" in
22683         '')
22684                 : Exclude those already listed in dynamic linking
22685                 dflt=''
22686                 for xxx in $avail_ext; do
22687                         case " $dynamic_ext " in
22688                         *" $xxx "*) ;;
22689                         *) dflt="$dflt $xxx" ;;
22690                         esac
22691                 done
22692                 set X $dflt
22693                 shift
22694                 dflt="$*"
22695                 ;;
22696         *)  dflt="$static_ext"
22697                 ;;
22698         esac
22699
22700         case "$dflt" in
22701         '')     dflt=none;;
22702         esac
22703         rp="What extensions do you wish to load statically?"
22704         . ./myread
22705         case "$ans" in
22706         none) static_ext=' ' ;;
22707         *) static_ext="$ans" ;;
22708         esac
22709         ;;
22710 *)
22711         $cat <<EOM
22712 A number of extensions are supplied with $package.  Answer "none"
22713 to include no extensions.
22714 Note that DynaLoader is always built and need not be mentioned here.
22715
22716 EOM
22717         case "$static_ext" in
22718         '') dflt="$avail_ext" ;;
22719         *)      dflt="$static_ext"
22720                 # Perhaps we are reusing an old out-of-date config.sh.
22721                 case "$hint" in
22722                 previous)
22723                         if test X"$static_ext" != X"$avail_ext"; then
22724                                 $cat <<EOM
22725 NOTICE:  Your previous config.sh list may be incorrect.
22726 The extensions now available to you are
22727         ${avail_ext}
22728 but the default list from your previous config.sh is
22729         ${static_ext}
22730
22731 EOM
22732                         fi
22733                         ;;
22734                 esac
22735                 ;;
22736         esac
22737         : Exclude those that are not xs extensions
22738         case "$dflt" in
22739         '')     dflt=none;;
22740         esac
22741         rp="What extensions do you wish to include?"
22742         . ./myread
22743         case "$ans" in
22744         none) static_ext=' ' ;;
22745         *) static_ext="$ans" ;;
22746         esac
22747         ;;
22748 esac
22749 #
22750 # Encode is a special case.  If we are building Encode as a static
22751 # extension, we need to explicitly list its subextensions as well.
22752 # For other nested extensions, this is handled automatically by
22753 # the appropriate Makefile.PL.
22754 case " $static_ext " in
22755         *" Encode "*) # Add the subextensions of Encode
22756         cd "$rsrc/cpan"
22757         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22758                 static_ext="$static_ext Encode/$xxx"
22759         done
22760         cd "$tdir"
22761         ;;
22762 esac
22763
22764 set X $dynamic_ext $static_ext $nonxs_ext
22765 shift
22766 extensions="$*"
22767
22768 # Sanity check:  We require an extension suitable for use with
22769 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22770 # should show up as failures in the test suite, but it's helpful to
22771 # catch them now.) The 'extensions' list is normally sorted
22772 # alphabetically, so we need to accept either
22773 #    DB_File ... Fcntl ... IO  ....
22774 # or something like
22775 #    Fcntl ... NDBM_File ... IO  ....
22776 case " $extensions"  in
22777 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22778 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22779 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22780 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22781    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22782    ;;
22783 esac
22784
22785 : Remove libraries needed only for extensions
22786 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22787 : The exception is SunOS 4.x, which needs them.
22788 case "${osname}X${osvers}" in
22789 sunos*X4*)
22790     perllibs="$libs"
22791     ;;
22792 *) case "$usedl" in
22793     $define|true|[yY]*)
22794             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
22795             shift
22796             perllibs="$*"
22797             ;;
22798     *)  perllibs="$libs"
22799             ;;
22800     esac
22801     ;;
22802 esac
22803
22804 : Remove build directory name from cppstdin so it can be used from
22805 : either the present location or the final installed location.
22806 echo " "
22807 : Get out of the UU directory to get correct path name.
22808 cd ..
22809 case "$cppstdin" in
22810 `pwd`/cppstdin)
22811         echo "Stripping down cppstdin path name"
22812         cppstdin=cppstdin
22813         ;;
22814 esac
22815 cd UU
22816
22817 : end of configuration questions
22818 echo " "
22819 echo "End of configuration questions."
22820 echo " "
22821
22822 : back to where it started
22823 if test -d ../UU; then
22824         cd ..
22825 fi
22826
22827 : configuration may be unconditionally patched via a 'config.arch' file
22828 if $test -f config.arch; then
22829         echo "I see a config.arch file, loading it." >&4
22830         . ./config.arch
22831 fi
22832
22833 : configuration may be patched via a 'config.over' file
22834 if $test -f config.over; then
22835         echo " "
22836         dflt=y
22837         rp='I see a config.over file.  Do you wish to load it?'
22838         . UU/myread
22839         case "$ans" in
22840         n*) echo "OK, I'll ignore it.";;
22841         *)      . ./config.over
22842                 echo "Configuration override changes have been loaded."
22843                 ;;
22844         esac
22845 fi
22846
22847 : in case they want portability, strip down executable paths
22848 case "$d_portable" in
22849 "$define")
22850         echo " "
22851         echo "Stripping down executable paths..." >&4
22852         for file in $loclist $trylist; do
22853                 eval temp=\$$file
22854                 eval $file=`basename $temp`
22855         done
22856         ;;
22857 esac
22858
22859 : create config.sh file
22860 echo " "
22861 echo "Creating config.sh..." >&4
22862 $spitshell <<EOT >config.sh
22863 $startsh
22864 #
22865 # This file was produced by running the Configure script. It holds all the
22866 # definitions figured out by Configure. Should you modify one of these values,
22867 # do not forget to propagate your changes by running "Configure -der". You may
22868 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22869 #
22870
22871 # Package name      : $package
22872 # Source directory  : $src
22873 # Configuration time: $cf_time
22874 # Configured by     : $cf_by
22875 # Target system     : $myuname
22876
22877 EOT
22878 : Add in command line options if available
22879 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22880
22881 $spitshell <<EOT >>config.sh
22882
22883 Author='$Author'
22884 Date='$Date'
22885 Header='$Header'
22886 Id='$Id'
22887 Locker='$Locker'
22888 Log='$Log'
22889 RCSfile='$RCSfile'
22890 Revision='$Revision'
22891 Source='$Source'
22892 State='$State'
22893 _a='$_a'
22894 _exe='$_exe'
22895 _o='$_o'
22896 afs='$afs'
22897 afsroot='$afsroot'
22898 alignbytes='$alignbytes'
22899 ansi2knr='$ansi2knr'
22900 aphostname='$aphostname'
22901 api_revision='$api_revision'
22902 api_subversion='$api_subversion'
22903 api_version='$api_version'
22904 api_versionstring='$api_versionstring'
22905 ar='$ar'
22906 archlib='$archlib'
22907 archlibexp='$archlibexp'
22908 archname64='$archname64'
22909 archname='$archname'
22910 archobjs='$archobjs'
22911 asctime_r_proto='$asctime_r_proto'
22912 awk='$awk'
22913 baserev='$baserev'
22914 bash='$bash'
22915 bin='$bin'
22916 bin_ELF='$bin_ELF'
22917 binexp='$binexp'
22918 bison='$bison'
22919 bootstrap_charset='$bootstrap_charset'
22920 byacc='$byacc'
22921 byteorder='$byteorder'
22922 c='$c'
22923 castflags='$castflags'
22924 cat='$cat'
22925 cc='$cc'
22926 cccdlflags='$cccdlflags'
22927 ccdlflags='$ccdlflags'
22928 ccflags='$ccflags'
22929 ccflags_uselargefiles='$ccflags_uselargefiles'
22930 ccname='$ccname'
22931 ccsymbols='$ccsymbols'
22932 ccversion='$ccversion'
22933 cf_by='$cf_by'
22934 cf_email='$cf_email'
22935 cf_time='$cf_time'
22936 charbits='$charbits'
22937 charsize='$charsize'
22938 chgrp='$chgrp'
22939 chmod='$chmod'
22940 chown='$chown'
22941 clocktype='$clocktype'
22942 comm='$comm'
22943 compress='$compress'
22944 contains='$contains'
22945 cp='$cp'
22946 cpio='$cpio'
22947 cpp='$cpp'
22948 cpp_stuff='$cpp_stuff'
22949 cppccsymbols='$cppccsymbols'
22950 cppflags='$cppflags'
22951 cpplast='$cpplast'
22952 cppminus='$cppminus'
22953 cpprun='$cpprun'
22954 cppstdin='$cppstdin'
22955 cppsymbols='$cppsymbols'
22956 crypt_r_proto='$crypt_r_proto'
22957 cryptlib='$cryptlib'
22958 csh='$csh'
22959 ctermid_r_proto='$ctermid_r_proto'
22960 ctime_r_proto='$ctime_r_proto'
22961 d_Gconvert='$d_Gconvert'
22962 d_PRIEUldbl='$d_PRIEUldbl'
22963 d_PRIFUldbl='$d_PRIFUldbl'
22964 d_PRIGUldbl='$d_PRIGUldbl'
22965 d_PRIXU64='$d_PRIXU64'
22966 d_PRId64='$d_PRId64'
22967 d_PRIeldbl='$d_PRIeldbl'
22968 d_PRIfldbl='$d_PRIfldbl'
22969 d_PRIgldbl='$d_PRIgldbl'
22970 d_PRIi64='$d_PRIi64'
22971 d_PRIo64='$d_PRIo64'
22972 d_PRIu64='$d_PRIu64'
22973 d_PRIx64='$d_PRIx64'
22974 d_SCNfldbl='$d_SCNfldbl'
22975 d__fwalk='$d__fwalk'
22976 d_access='$d_access'
22977 d_accessx='$d_accessx'
22978 d_aintl='$d_aintl'
22979 d_alarm='$d_alarm'
22980 d_archlib='$d_archlib'
22981 d_asctime64='$d_asctime64'
22982 d_asctime_r='$d_asctime_r'
22983 d_atolf='$d_atolf'
22984 d_atoll='$d_atoll'
22985 d_attribute_deprecated='$d_attribute_deprecated'
22986 d_attribute_format='$d_attribute_format'
22987 d_attribute_malloc='$d_attribute_malloc'
22988 d_attribute_nonnull='$d_attribute_nonnull'
22989 d_attribute_noreturn='$d_attribute_noreturn'
22990 d_attribute_pure='$d_attribute_pure'
22991 d_attribute_unused='$d_attribute_unused'
22992 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22993 d_bcmp='$d_bcmp'
22994 d_bcopy='$d_bcopy'
22995 d_bsd='$d_bsd'
22996 d_bsdgetpgrp='$d_bsdgetpgrp'
22997 d_bsdsetpgrp='$d_bsdsetpgrp'
22998 d_builtin_choose_expr='$d_builtin_choose_expr'
22999 d_builtin_expect='$d_builtin_expect'
23000 d_bzero='$d_bzero'
23001 d_c99_variadic_macros='$d_c99_variadic_macros'
23002 d_casti32='$d_casti32'
23003 d_castneg='$d_castneg'
23004 d_charvspr='$d_charvspr'
23005 d_chown='$d_chown'
23006 d_chroot='$d_chroot'
23007 d_chsize='$d_chsize'
23008 d_class='$d_class'
23009 d_clearenv='$d_clearenv'
23010 d_closedir='$d_closedir'
23011 d_cmsghdr_s='$d_cmsghdr_s'
23012 d_const='$d_const'
23013 d_copysignl='$d_copysignl'
23014 d_cplusplus='$d_cplusplus'
23015 d_crypt='$d_crypt'
23016 d_crypt_r='$d_crypt_r'
23017 d_csh='$d_csh'
23018 d_ctermid='$d_ctermid'
23019 d_ctermid_r='$d_ctermid_r'
23020 d_ctime64='$d_ctime64'
23021 d_ctime_r='$d_ctime_r'
23022 d_cuserid='$d_cuserid'
23023 d_dbl_dig='$d_dbl_dig'
23024 d_dbminitproto='$d_dbminitproto'
23025 d_difftime64='$d_difftime64'
23026 d_difftime='$d_difftime'
23027 d_dir_dd_fd='$d_dir_dd_fd'
23028 d_dirfd='$d_dirfd'
23029 d_dirnamlen='$d_dirnamlen'
23030 d_dlerror='$d_dlerror'
23031 d_dlopen='$d_dlopen'
23032 d_dlsymun='$d_dlsymun'
23033 d_dosuid='$d_dosuid'
23034 d_drand48_r='$d_drand48_r'
23035 d_drand48proto='$d_drand48proto'
23036 d_dup2='$d_dup2'
23037 d_eaccess='$d_eaccess'
23038 d_endgrent='$d_endgrent'
23039 d_endgrent_r='$d_endgrent_r'
23040 d_endhent='$d_endhent'
23041 d_endhostent_r='$d_endhostent_r'
23042 d_endnent='$d_endnent'
23043 d_endnetent_r='$d_endnetent_r'
23044 d_endpent='$d_endpent'
23045 d_endprotoent_r='$d_endprotoent_r'
23046 d_endpwent='$d_endpwent'
23047 d_endpwent_r='$d_endpwent_r'
23048 d_endsent='$d_endsent'
23049 d_endservent_r='$d_endservent_r'
23050 d_eofnblk='$d_eofnblk'
23051 d_eunice='$d_eunice'
23052 d_faststdio='$d_faststdio'
23053 d_fchdir='$d_fchdir'
23054 d_fchmod='$d_fchmod'
23055 d_fchown='$d_fchown'
23056 d_fcntl='$d_fcntl'
23057 d_fcntl_can_lock='$d_fcntl_can_lock'
23058 d_fd_macros='$d_fd_macros'
23059 d_fd_set='$d_fd_set'
23060 d_fds_bits='$d_fds_bits'
23061 d_fgetpos='$d_fgetpos'
23062 d_finite='$d_finite'
23063 d_finitel='$d_finitel'
23064 d_flexfnam='$d_flexfnam'
23065 d_flock='$d_flock'
23066 d_flockproto='$d_flockproto'
23067 d_fork='$d_fork'
23068 d_fp_class='$d_fp_class'
23069 d_fpathconf='$d_fpathconf'
23070 d_fpclass='$d_fpclass'
23071 d_fpclassify='$d_fpclassify'
23072 d_fpclassl='$d_fpclassl'
23073 d_fpos64_t='$d_fpos64_t'
23074 d_frexpl='$d_frexpl'
23075 d_fs_data_s='$d_fs_data_s'
23076 d_fseeko='$d_fseeko'
23077 d_fsetpos='$d_fsetpos'
23078 d_fstatfs='$d_fstatfs'
23079 d_fstatvfs='$d_fstatvfs'
23080 d_fsync='$d_fsync'
23081 d_ftello='$d_ftello'
23082 d_ftime='$d_ftime'
23083 d_futimes='$d_futimes'
23084 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
23085 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
23086 d_getaddrinfo='$d_getaddrinfo'
23087 d_getcwd='$d_getcwd'
23088 d_getespwnam='$d_getespwnam'
23089 d_getfsstat='$d_getfsstat'
23090 d_getgrent='$d_getgrent'
23091 d_getgrent_r='$d_getgrent_r'
23092 d_getgrgid_r='$d_getgrgid_r'
23093 d_getgrnam_r='$d_getgrnam_r'
23094 d_getgrps='$d_getgrps'
23095 d_gethbyaddr='$d_gethbyaddr'
23096 d_gethbyname='$d_gethbyname'
23097 d_gethent='$d_gethent'
23098 d_gethname='$d_gethname'
23099 d_gethostbyaddr_r='$d_gethostbyaddr_r'
23100 d_gethostbyname_r='$d_gethostbyname_r'
23101 d_gethostent_r='$d_gethostent_r'
23102 d_gethostprotos='$d_gethostprotos'
23103 d_getitimer='$d_getitimer'
23104 d_getlogin='$d_getlogin'
23105 d_getlogin_r='$d_getlogin_r'
23106 d_getmnt='$d_getmnt'
23107 d_getmntent='$d_getmntent'
23108 d_getnameinfo='$d_getnameinfo'
23109 d_getnbyaddr='$d_getnbyaddr'
23110 d_getnbyname='$d_getnbyname'
23111 d_getnent='$d_getnent'
23112 d_getnetbyaddr_r='$d_getnetbyaddr_r'
23113 d_getnetbyname_r='$d_getnetbyname_r'
23114 d_getnetent_r='$d_getnetent_r'
23115 d_getnetprotos='$d_getnetprotos'
23116 d_getpagsz='$d_getpagsz'
23117 d_getpbyname='$d_getpbyname'
23118 d_getpbynumber='$d_getpbynumber'
23119 d_getpent='$d_getpent'
23120 d_getpgid='$d_getpgid'
23121 d_getpgrp2='$d_getpgrp2'
23122 d_getpgrp='$d_getpgrp'
23123 d_getppid='$d_getppid'
23124 d_getprior='$d_getprior'
23125 d_getprotobyname_r='$d_getprotobyname_r'
23126 d_getprotobynumber_r='$d_getprotobynumber_r'
23127 d_getprotoent_r='$d_getprotoent_r'
23128 d_getprotoprotos='$d_getprotoprotos'
23129 d_getprpwnam='$d_getprpwnam'
23130 d_getpwent='$d_getpwent'
23131 d_getpwent_r='$d_getpwent_r'
23132 d_getpwnam_r='$d_getpwnam_r'
23133 d_getpwuid_r='$d_getpwuid_r'
23134 d_getsbyname='$d_getsbyname'
23135 d_getsbyport='$d_getsbyport'
23136 d_getsent='$d_getsent'
23137 d_getservbyname_r='$d_getservbyname_r'
23138 d_getservbyport_r='$d_getservbyport_r'
23139 d_getservent_r='$d_getservent_r'
23140 d_getservprotos='$d_getservprotos'
23141 d_getspnam='$d_getspnam'
23142 d_getspnam_r='$d_getspnam_r'
23143 d_gettimeod='$d_gettimeod'
23144 d_gmtime64='$d_gmtime64'
23145 d_gmtime_r='$d_gmtime_r'
23146 d_gnulibc='$d_gnulibc'
23147 d_grpasswd='$d_grpasswd'
23148 d_hasmntopt='$d_hasmntopt'
23149 d_htonl='$d_htonl'
23150 d_ilogbl='$d_ilogbl'
23151 d_inc_version_list='$d_inc_version_list'
23152 d_index='$d_index'
23153 d_inetaton='$d_inetaton'
23154 d_inetntop='$d_inetntop'
23155 d_inetpton='$d_inetpton'
23156 d_int64_t='$d_int64_t'
23157 d_ip_mreq='$d_ip_mreq'
23158 d_ip_mreq_source='$d_ip_mreq_source'
23159 d_ipv6_mreq='$d_ipv6_mreq'
23160 d_ipv6_mreq_source='$d_ipv6_mreq_source'
23161 d_isascii='$d_isascii'
23162 d_isblank='$d_isblank'
23163 d_isfinite='$d_isfinite'
23164 d_isinf='$d_isinf'
23165 d_isnan='$d_isnan'
23166 d_isnanl='$d_isnanl'
23167 d_killpg='$d_killpg'
23168 d_lchown='$d_lchown'
23169 d_ldbl_dig='$d_ldbl_dig'
23170 d_libm_lib_version='$d_libm_lib_version'
23171 d_link='$d_link'
23172 d_localtime64='$d_localtime64'
23173 d_localtime_r='$d_localtime_r'
23174 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
23175 d_locconv='$d_locconv'
23176 d_lockf='$d_lockf'
23177 d_longdbl='$d_longdbl'
23178 d_longlong='$d_longlong'
23179 d_lseekproto='$d_lseekproto'
23180 d_lstat='$d_lstat'
23181 d_madvise='$d_madvise'
23182 d_malloc_good_size='$d_malloc_good_size'
23183 d_malloc_size='$d_malloc_size'
23184 d_mblen='$d_mblen'
23185 d_mbstowcs='$d_mbstowcs'
23186 d_mbtowc='$d_mbtowc'
23187 d_memchr='$d_memchr'
23188 d_memcmp='$d_memcmp'
23189 d_memcpy='$d_memcpy'
23190 d_memmove='$d_memmove'
23191 d_memset='$d_memset'
23192 d_mkdir='$d_mkdir'
23193 d_mkdtemp='$d_mkdtemp'
23194 d_mkfifo='$d_mkfifo'
23195 d_mkstemp='$d_mkstemp'
23196 d_mkstemps='$d_mkstemps'
23197 d_mktime64='$d_mktime64'
23198 d_mktime='$d_mktime'
23199 d_mmap='$d_mmap'
23200 d_modfl='$d_modfl'
23201 d_modfl_pow32_bug='$d_modfl_pow32_bug'
23202 d_modflproto='$d_modflproto'
23203 d_mprotect='$d_mprotect'
23204 d_msg='$d_msg'
23205 d_msg_ctrunc='$d_msg_ctrunc'
23206 d_msg_dontroute='$d_msg_dontroute'
23207 d_msg_oob='$d_msg_oob'
23208 d_msg_peek='$d_msg_peek'
23209 d_msg_proxy='$d_msg_proxy'
23210 d_msgctl='$d_msgctl'
23211 d_msgget='$d_msgget'
23212 d_msghdr_s='$d_msghdr_s'
23213 d_msgrcv='$d_msgrcv'
23214 d_msgsnd='$d_msgsnd'
23215 d_msync='$d_msync'
23216 d_munmap='$d_munmap'
23217 d_mymalloc='$d_mymalloc'
23218 d_ndbm='$d_ndbm'
23219 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
23220 d_nice='$d_nice'
23221 d_nl_langinfo='$d_nl_langinfo'
23222 d_nv_preserves_uv='$d_nv_preserves_uv'
23223 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
23224 d_off64_t='$d_off64_t'
23225 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
23226 d_oldpthreads='$d_oldpthreads'
23227 d_oldsock='$d_oldsock'
23228 d_open3='$d_open3'
23229 d_pathconf='$d_pathconf'
23230 d_pause='$d_pause'
23231 d_perl_otherlibdirs='$d_perl_otherlibdirs'
23232 d_phostname='$d_phostname'
23233 d_pipe='$d_pipe'
23234 d_poll='$d_poll'
23235 d_portable='$d_portable'
23236 d_prctl='$d_prctl'
23237 d_prctl_set_name='$d_prctl_set_name'
23238 d_printf_format_null='$d_printf_format_null'
23239 d_procselfexe='$d_procselfexe'
23240 d_pseudofork='$d_pseudofork'
23241 d_pthread_atfork='$d_pthread_atfork'
23242 d_pthread_attr_setscope='$d_pthread_attr_setscope'
23243 d_pthread_yield='$d_pthread_yield'
23244 d_pwage='$d_pwage'
23245 d_pwchange='$d_pwchange'
23246 d_pwclass='$d_pwclass'
23247 d_pwcomment='$d_pwcomment'
23248 d_pwexpire='$d_pwexpire'
23249 d_pwgecos='$d_pwgecos'
23250 d_pwpasswd='$d_pwpasswd'
23251 d_pwquota='$d_pwquota'
23252 d_qgcvt='$d_qgcvt'
23253 d_quad='$d_quad'
23254 d_random_r='$d_random_r'
23255 d_readdir64_r='$d_readdir64_r'
23256 d_readdir='$d_readdir'
23257 d_readdir_r='$d_readdir_r'
23258 d_readlink='$d_readlink'
23259 d_readv='$d_readv'
23260 d_recvmsg='$d_recvmsg'
23261 d_rename='$d_rename'
23262 d_rewinddir='$d_rewinddir'
23263 d_rmdir='$d_rmdir'
23264 d_safebcpy='$d_safebcpy'
23265 d_safemcpy='$d_safemcpy'
23266 d_sanemcmp='$d_sanemcmp'
23267 d_sbrkproto='$d_sbrkproto'
23268 d_scalbnl='$d_scalbnl'
23269 d_sched_yield='$d_sched_yield'
23270 d_scm_rights='$d_scm_rights'
23271 d_seekdir='$d_seekdir'
23272 d_select='$d_select'
23273 d_sem='$d_sem'
23274 d_semctl='$d_semctl'
23275 d_semctl_semid_ds='$d_semctl_semid_ds'
23276 d_semctl_semun='$d_semctl_semun'
23277 d_semget='$d_semget'
23278 d_semop='$d_semop'
23279 d_sendmsg='$d_sendmsg'
23280 d_setegid='$d_setegid'
23281 d_seteuid='$d_seteuid'
23282 d_setgrent='$d_setgrent'
23283 d_setgrent_r='$d_setgrent_r'
23284 d_setgrps='$d_setgrps'
23285 d_sethent='$d_sethent'
23286 d_sethostent_r='$d_sethostent_r'
23287 d_setitimer='$d_setitimer'
23288 d_setlinebuf='$d_setlinebuf'
23289 d_setlocale='$d_setlocale'
23290 d_setlocale_r='$d_setlocale_r'
23291 d_setnent='$d_setnent'
23292 d_setnetent_r='$d_setnetent_r'
23293 d_setpent='$d_setpent'
23294 d_setpgid='$d_setpgid'
23295 d_setpgrp2='$d_setpgrp2'
23296 d_setpgrp='$d_setpgrp'
23297 d_setprior='$d_setprior'
23298 d_setproctitle='$d_setproctitle'
23299 d_setprotoent_r='$d_setprotoent_r'
23300 d_setpwent='$d_setpwent'
23301 d_setpwent_r='$d_setpwent_r'
23302 d_setregid='$d_setregid'
23303 d_setresgid='$d_setresgid'
23304 d_setresuid='$d_setresuid'
23305 d_setreuid='$d_setreuid'
23306 d_setrgid='$d_setrgid'
23307 d_setruid='$d_setruid'
23308 d_setsent='$d_setsent'
23309 d_setservent_r='$d_setservent_r'
23310 d_setsid='$d_setsid'
23311 d_setvbuf='$d_setvbuf'
23312 d_sfio='$d_sfio'
23313 d_shm='$d_shm'
23314 d_shmat='$d_shmat'
23315 d_shmatprototype='$d_shmatprototype'
23316 d_shmctl='$d_shmctl'
23317 d_shmdt='$d_shmdt'
23318 d_shmget='$d_shmget'
23319 d_sigaction='$d_sigaction'
23320 d_signbit='$d_signbit'
23321 d_sigprocmask='$d_sigprocmask'
23322 d_sigsetjmp='$d_sigsetjmp'
23323 d_sin6_scope_id='$d_sin6_scope_id'
23324 d_sitearch='$d_sitearch'
23325 d_snprintf='$d_snprintf'
23326 d_sockaddr_in6='$d_sockaddr_in6'
23327 d_sockaddr_sa_len='$d_sockaddr_sa_len'
23328 d_sockatmark='$d_sockatmark'
23329 d_sockatmarkproto='$d_sockatmarkproto'
23330 d_socket='$d_socket'
23331 d_socklen_t='$d_socklen_t'
23332 d_sockpair='$d_sockpair'
23333 d_socks5_init='$d_socks5_init'
23334 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
23335 d_sqrtl='$d_sqrtl'
23336 d_srand48_r='$d_srand48_r'
23337 d_srandom_r='$d_srandom_r'
23338 d_sresgproto='$d_sresgproto'
23339 d_sresuproto='$d_sresuproto'
23340 d_statblks='$d_statblks'
23341 d_statfs_f_flags='$d_statfs_f_flags'
23342 d_statfs_s='$d_statfs_s'
23343 d_static_inline='$d_static_inline'
23344 d_statvfs='$d_statvfs'
23345 d_stdio_cnt_lval='$d_stdio_cnt_lval'
23346 d_stdio_ptr_lval='$d_stdio_ptr_lval'
23347 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
23348 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
23349 d_stdio_stream_array='$d_stdio_stream_array'
23350 d_stdiobase='$d_stdiobase'
23351 d_stdstdio='$d_stdstdio'
23352 d_strchr='$d_strchr'
23353 d_strcoll='$d_strcoll'
23354 d_strctcpy='$d_strctcpy'
23355 d_strerrm='$d_strerrm'
23356 d_strerror='$d_strerror'
23357 d_strerror_r='$d_strerror_r'
23358 d_strftime='$d_strftime'
23359 d_strlcat='$d_strlcat'
23360 d_strlcpy='$d_strlcpy'
23361 d_strtod='$d_strtod'
23362 d_strtol='$d_strtol'
23363 d_strtold='$d_strtold'
23364 d_strtoll='$d_strtoll'
23365 d_strtoq='$d_strtoq'
23366 d_strtoul='$d_strtoul'
23367 d_strtoull='$d_strtoull'
23368 d_strtouq='$d_strtouq'
23369 d_strxfrm='$d_strxfrm'
23370 d_suidsafe='$d_suidsafe'
23371 d_symlink='$d_symlink'
23372 d_syscall='$d_syscall'
23373 d_syscallproto='$d_syscallproto'
23374 d_sysconf='$d_sysconf'
23375 d_sysernlst='$d_sysernlst'
23376 d_syserrlst='$d_syserrlst'
23377 d_system='$d_system'
23378 d_tcgetpgrp='$d_tcgetpgrp'
23379 d_tcsetpgrp='$d_tcsetpgrp'
23380 d_telldir='$d_telldir'
23381 d_telldirproto='$d_telldirproto'
23382 d_time='$d_time'
23383 d_timegm='$d_timegm'
23384 d_times='$d_times'
23385 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
23386 d_tm_tm_zone='$d_tm_tm_zone'
23387 d_tmpnam_r='$d_tmpnam_r'
23388 d_truncate='$d_truncate'
23389 d_ttyname_r='$d_ttyname_r'
23390 d_tzname='$d_tzname'
23391 d_u32align='$d_u32align'
23392 d_ualarm='$d_ualarm'
23393 d_umask='$d_umask'
23394 d_uname='$d_uname'
23395 d_union_semun='$d_union_semun'
23396 d_unordered='$d_unordered'
23397 d_unsetenv='$d_unsetenv'
23398 d_usleep='$d_usleep'
23399 d_usleepproto='$d_usleepproto'
23400 d_ustat='$d_ustat'
23401 d_vendorarch='$d_vendorarch'
23402 d_vendorbin='$d_vendorbin'
23403 d_vendorlib='$d_vendorlib'
23404 d_vendorscript='$d_vendorscript'
23405 d_vfork='$d_vfork'
23406 d_void_closedir='$d_void_closedir'
23407 d_voidsig='$d_voidsig'
23408 d_voidtty='$d_voidtty'
23409 d_volatile='$d_volatile'
23410 d_vprintf='$d_vprintf'
23411 d_vsnprintf='$d_vsnprintf'
23412 d_wait4='$d_wait4'
23413 d_waitpid='$d_waitpid'
23414 d_wcstombs='$d_wcstombs'
23415 d_wctomb='$d_wctomb'
23416 d_writev='$d_writev'
23417 d_xenix='$d_xenix'
23418 date='$date'
23419 db_hashtype='$db_hashtype'
23420 db_prefixtype='$db_prefixtype'
23421 db_version_major='$db_version_major'
23422 db_version_minor='$db_version_minor'
23423 db_version_patch='$db_version_patch'
23424 defvoidused='$defvoidused'
23425 direntrytype='$direntrytype'
23426 dlext='$dlext'
23427 dlsrc='$dlsrc'
23428 doublesize='$doublesize'
23429 drand01='$drand01'
23430 drand48_r_proto='$drand48_r_proto'
23431 dtrace='$dtrace'
23432 dynamic_ext='$dynamic_ext'
23433 eagain='$eagain'
23434 ebcdic='$ebcdic'
23435 echo='$echo'
23436 egrep='$egrep'
23437 emacs='$emacs'
23438 endgrent_r_proto='$endgrent_r_proto'
23439 endhostent_r_proto='$endhostent_r_proto'
23440 endnetent_r_proto='$endnetent_r_proto'
23441 endprotoent_r_proto='$endprotoent_r_proto'
23442 endpwent_r_proto='$endpwent_r_proto'
23443 endservent_r_proto='$endservent_r_proto'
23444 eunicefix='$eunicefix'
23445 exe_ext='$exe_ext'
23446 expr='$expr'
23447 extensions='$extensions'
23448 extern_C='$extern_C'
23449 extras='$extras'
23450 fflushNULL='$fflushNULL'
23451 fflushall='$fflushall'
23452 find='$find'
23453 firstmakefile='$firstmakefile'
23454 flex='$flex'
23455 fpossize='$fpossize'
23456 fpostype='$fpostype'
23457 freetype='$freetype'
23458 from='$from'
23459 full_ar='$full_ar'
23460 full_csh='$full_csh'
23461 full_sed='$full_sed'
23462 gccansipedantic='$gccansipedantic'
23463 gccosandvers='$gccosandvers'
23464 gccversion='$gccversion'
23465 getgrent_r_proto='$getgrent_r_proto'
23466 getgrgid_r_proto='$getgrgid_r_proto'
23467 getgrnam_r_proto='$getgrnam_r_proto'
23468 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
23469 gethostbyname_r_proto='$gethostbyname_r_proto'
23470 gethostent_r_proto='$gethostent_r_proto'
23471 getlogin_r_proto='$getlogin_r_proto'
23472 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
23473 getnetbyname_r_proto='$getnetbyname_r_proto'
23474 getnetent_r_proto='$getnetent_r_proto'
23475 getprotobyname_r_proto='$getprotobyname_r_proto'
23476 getprotobynumber_r_proto='$getprotobynumber_r_proto'
23477 getprotoent_r_proto='$getprotoent_r_proto'
23478 getpwent_r_proto='$getpwent_r_proto'
23479 getpwnam_r_proto='$getpwnam_r_proto'
23480 getpwuid_r_proto='$getpwuid_r_proto'
23481 getservbyname_r_proto='$getservbyname_r_proto'
23482 getservbyport_r_proto='$getservbyport_r_proto'
23483 getservent_r_proto='$getservent_r_proto'
23484 getspnam_r_proto='$getspnam_r_proto'
23485 gidformat='$gidformat'
23486 gidsign='$gidsign'
23487 gidsize='$gidsize'
23488 gidtype='$gidtype'
23489 glibpth='$glibpth'
23490 gmake='$gmake'
23491 gmtime_r_proto='$gmtime_r_proto'
23492 gnulibc_version='$gnulibc_version'
23493 grep='$grep'
23494 groupcat='$groupcat'
23495 groupstype='$groupstype'
23496 gzip='$gzip'
23497 h_fcntl='$h_fcntl'
23498 h_sysfile='$h_sysfile'
23499 hint='$hint'
23500 hostcat='$hostcat'
23501 html1dir='$html1dir'
23502 html1direxp='$html1direxp'
23503 html3dir='$html3dir'
23504 html3direxp='$html3direxp'
23505 i16size='$i16size'
23506 i16type='$i16type'
23507 i32size='$i32size'
23508 i32type='$i32type'
23509 i64size='$i64size'
23510 i64type='$i64type'
23511 i8size='$i8size'
23512 i8type='$i8type'
23513 i_arpainet='$i_arpainet'
23514 i_assert='$i_assert'
23515 i_bsdioctl='$i_bsdioctl'
23516 i_crypt='$i_crypt'
23517 i_db='$i_db'
23518 i_dbm='$i_dbm'
23519 i_dirent='$i_dirent'
23520 i_dld='$i_dld'
23521 i_dlfcn='$i_dlfcn'
23522 i_fcntl='$i_fcntl'
23523 i_float='$i_float'
23524 i_fp='$i_fp'
23525 i_fp_class='$i_fp_class'
23526 i_gdbm='$i_gdbm'
23527 i_gdbm_ndbm='$i_gdbm_ndbm'
23528 i_gdbmndbm='$i_gdbmndbm'
23529 i_grp='$i_grp'
23530 i_ieeefp='$i_ieeefp'
23531 i_inttypes='$i_inttypes'
23532 i_langinfo='$i_langinfo'
23533 i_libutil='$i_libutil'
23534 i_limits='$i_limits'
23535 i_locale='$i_locale'
23536 i_machcthr='$i_machcthr'
23537 i_malloc='$i_malloc'
23538 i_mallocmalloc='$i_mallocmalloc'
23539 i_math='$i_math'
23540 i_memory='$i_memory'
23541 i_mntent='$i_mntent'
23542 i_ndbm='$i_ndbm'
23543 i_netdb='$i_netdb'
23544 i_neterrno='$i_neterrno'
23545 i_netinettcp='$i_netinettcp'
23546 i_niin='$i_niin'
23547 i_poll='$i_poll'
23548 i_prot='$i_prot'
23549 i_pthread='$i_pthread'
23550 i_pwd='$i_pwd'
23551 i_rpcsvcdbm='$i_rpcsvcdbm'
23552 i_sfio='$i_sfio'
23553 i_sgtty='$i_sgtty'
23554 i_shadow='$i_shadow'
23555 i_socks='$i_socks'
23556 i_stdarg='$i_stdarg'
23557 i_stdbool='$i_stdbool'
23558 i_stddef='$i_stddef'
23559 i_stdlib='$i_stdlib'
23560 i_string='$i_string'
23561 i_sunmath='$i_sunmath'
23562 i_sysaccess='$i_sysaccess'
23563 i_sysdir='$i_sysdir'
23564 i_sysfile='$i_sysfile'
23565 i_sysfilio='$i_sysfilio'
23566 i_sysin='$i_sysin'
23567 i_sysioctl='$i_sysioctl'
23568 i_syslog='$i_syslog'
23569 i_sysmman='$i_sysmman'
23570 i_sysmode='$i_sysmode'
23571 i_sysmount='$i_sysmount'
23572 i_sysndir='$i_sysndir'
23573 i_sysparam='$i_sysparam'
23574 i_syspoll='$i_syspoll'
23575 i_sysresrc='$i_sysresrc'
23576 i_syssecrt='$i_syssecrt'
23577 i_sysselct='$i_sysselct'
23578 i_syssockio='$i_syssockio'
23579 i_sysstat='$i_sysstat'
23580 i_sysstatfs='$i_sysstatfs'
23581 i_sysstatvfs='$i_sysstatvfs'
23582 i_systime='$i_systime'
23583 i_systimek='$i_systimek'
23584 i_systimes='$i_systimes'
23585 i_systypes='$i_systypes'
23586 i_sysuio='$i_sysuio'
23587 i_sysun='$i_sysun'
23588 i_sysutsname='$i_sysutsname'
23589 i_sysvfs='$i_sysvfs'
23590 i_syswait='$i_syswait'
23591 i_termio='$i_termio'
23592 i_termios='$i_termios'
23593 i_time='$i_time'
23594 i_unistd='$i_unistd'
23595 i_ustat='$i_ustat'
23596 i_utime='$i_utime'
23597 i_values='$i_values'
23598 i_varargs='$i_varargs'
23599 i_varhdr='$i_varhdr'
23600 i_vfork='$i_vfork'
23601 ignore_versioned_solibs='$ignore_versioned_solibs'
23602 inc_version_list='$inc_version_list'
23603 inc_version_list_init='$inc_version_list_init'
23604 incpath='$incpath'
23605 inews='$inews'
23606 initialinstalllocation='$initialinstalllocation'
23607 installarchlib='$installarchlib'
23608 installbin='$installbin'
23609 installhtml1dir='$installhtml1dir'
23610 installhtml3dir='$installhtml3dir'
23611 installman1dir='$installman1dir'
23612 installman3dir='$installman3dir'
23613 installprefix='$installprefix'
23614 installprefixexp='$installprefixexp'
23615 installprivlib='$installprivlib'
23616 installscript='$installscript'
23617 installsitearch='$installsitearch'
23618 installsitebin='$installsitebin'
23619 installsitehtml1dir='$installsitehtml1dir'
23620 installsitehtml3dir='$installsitehtml3dir'
23621 installsitelib='$installsitelib'
23622 installsiteman1dir='$installsiteman1dir'
23623 installsiteman3dir='$installsiteman3dir'
23624 installsitescript='$installsitescript'
23625 installstyle='$installstyle'
23626 installusrbinperl='$installusrbinperl'
23627 installvendorarch='$installvendorarch'
23628 installvendorbin='$installvendorbin'
23629 installvendorhtml1dir='$installvendorhtml1dir'
23630 installvendorhtml3dir='$installvendorhtml3dir'
23631 installvendorlib='$installvendorlib'
23632 installvendorman1dir='$installvendorman1dir'
23633 installvendorman3dir='$installvendorman3dir'
23634 installvendorscript='$installvendorscript'
23635 intsize='$intsize'
23636 issymlink='$issymlink'
23637 ivdformat='$ivdformat'
23638 ivsize='$ivsize'
23639 ivtype='$ivtype'
23640 known_extensions='$known_extensions'
23641 ksh='$ksh'
23642 ld='$ld'
23643 ld_can_script='$ld_can_script'
23644 lddlflags='$lddlflags'
23645 ldflags='$ldflags'
23646 ldflags_uselargefiles='$ldflags_uselargefiles'
23647 ldlibpthname='$ldlibpthname'
23648 less='$less'
23649 lib_ext='$lib_ext'
23650 libc='$libc'
23651 libperl='$libperl'
23652 libpth='$libpth'
23653 libs='$libs'
23654 libsdirs='$libsdirs'
23655 libsfiles='$libsfiles'
23656 libsfound='$libsfound'
23657 libspath='$libspath'
23658 libswanted='$libswanted'
23659 libswanted_uselargefiles='$libswanted_uselargefiles'
23660 line='$line'
23661 lint='$lint'
23662 lkflags='$lkflags'
23663 ln='$ln'
23664 lns='$lns'
23665 localtime_r_proto='$localtime_r_proto'
23666 locincpth='$locincpth'
23667 loclibpth='$loclibpth'
23668 longdblsize='$longdblsize'
23669 longlongsize='$longlongsize'
23670 longsize='$longsize'
23671 lp='$lp'
23672 lpr='$lpr'
23673 ls='$ls'
23674 lseeksize='$lseeksize'
23675 lseektype='$lseektype'
23676 mad='$mad'
23677 madlyh='$madlyh'
23678 madlyobj='$madlyobj'
23679 madlysrc='$madlysrc'
23680 mail='$mail'
23681 mailx='$mailx'
23682 make='$make'
23683 make_set_make='$make_set_make'
23684 mallocobj='$mallocobj'
23685 mallocsrc='$mallocsrc'
23686 malloctype='$malloctype'
23687 man1dir='$man1dir'
23688 man1direxp='$man1direxp'
23689 man1ext='$man1ext'
23690 man3dir='$man3dir'
23691 man3direxp='$man3direxp'
23692 man3ext='$man3ext'
23693 mips_type='$mips_type'
23694 mistrustnm='$mistrustnm'
23695 mkdir='$mkdir'
23696 mmaptype='$mmaptype'
23697 modetype='$modetype'
23698 more='$more'
23699 multiarch='$multiarch'
23700 mv='$mv'
23701 myarchname='$myarchname'
23702 mydomain='$mydomain'
23703 myhostname='$myhostname'
23704 myuname='$myuname'
23705 n='$n'
23706 need_va_copy='$need_va_copy'
23707 netdb_hlen_type='$netdb_hlen_type'
23708 netdb_host_type='$netdb_host_type'
23709 netdb_name_type='$netdb_name_type'
23710 netdb_net_type='$netdb_net_type'
23711 nm='$nm'
23712 nm_opt='$nm_opt'
23713 nm_so_opt='$nm_so_opt'
23714 nonxs_ext='$nonxs_ext'
23715 nroff='$nroff'
23716 nvEUformat='$nvEUformat'
23717 nvFUformat='$nvFUformat'
23718 nvGUformat='$nvGUformat'
23719 nv_overflows_integers_at='$nv_overflows_integers_at'
23720 nv_preserves_uv_bits='$nv_preserves_uv_bits'
23721 nveformat='$nveformat'
23722 nvfformat='$nvfformat'
23723 nvgformat='$nvgformat'
23724 nvsize='$nvsize'
23725 nvtype='$nvtype'
23726 o_nonblock='$o_nonblock'
23727 obj_ext='$obj_ext'
23728 old_pthread_create_joinable='$old_pthread_create_joinable'
23729 optimize='$optimize'
23730 orderlib='$orderlib'
23731 osname='$osname'
23732 osvers='$osvers'
23733 otherlibdirs='$otherlibdirs'
23734 package='$package'
23735 pager='$pager'
23736 passcat='$passcat'
23737 patchlevel='$patchlevel'
23738 path_sep='$path_sep'
23739 perl5='$perl5'
23740 perl='$perl'
23741 perl_patchlevel='$perl_patchlevel'
23742 perl_static_inline='$perl_static_inline'
23743 perladmin='$perladmin'
23744 perllibs='$perllibs'
23745 perlpath='$perlpath'
23746 pg='$pg'
23747 phostname='$phostname'
23748 pidtype='$pidtype'
23749 plibpth='$plibpth'
23750 pmake='$pmake'
23751 pr='$pr'
23752 prefix='$prefix'
23753 prefixexp='$prefixexp'
23754 privlib='$privlib'
23755 privlibexp='$privlibexp'
23756 procselfexe='$procselfexe'
23757 prototype='$prototype'
23758 ptrsize='$ptrsize'
23759 quadkind='$quadkind'
23760 quadtype='$quadtype'
23761 randbits='$randbits'
23762 randfunc='$randfunc'
23763 random_r_proto='$random_r_proto'
23764 randseedtype='$randseedtype'
23765 ranlib='$ranlib'
23766 rd_nodata='$rd_nodata'
23767 readdir64_r_proto='$readdir64_r_proto'
23768 readdir_r_proto='$readdir_r_proto'
23769 revision='$revision'
23770 rm='$rm'
23771 rm_try='$rm_try'
23772 rmail='$rmail'
23773 run='$run'
23774 runnm='$runnm'
23775 sGMTIME_max='$sGMTIME_max'
23776 sGMTIME_min='$sGMTIME_min'
23777 sLOCALTIME_max='$sLOCALTIME_max'
23778 sLOCALTIME_min='$sLOCALTIME_min'
23779 sPRIEUldbl='$sPRIEUldbl'
23780 sPRIFUldbl='$sPRIFUldbl'
23781 sPRIGUldbl='$sPRIGUldbl'
23782 sPRIXU64='$sPRIXU64'
23783 sPRId64='$sPRId64'
23784 sPRIeldbl='$sPRIeldbl'
23785 sPRIfldbl='$sPRIfldbl'
23786 sPRIgldbl='$sPRIgldbl'
23787 sPRIi64='$sPRIi64'
23788 sPRIo64='$sPRIo64'
23789 sPRIu64='$sPRIu64'
23790 sPRIx64='$sPRIx64'
23791 sSCNfldbl='$sSCNfldbl'
23792 sched_yield='$sched_yield'
23793 scriptdir='$scriptdir'
23794 scriptdirexp='$scriptdirexp'
23795 sed='$sed'
23796 seedfunc='$seedfunc'
23797 selectminbits='$selectminbits'
23798 selecttype='$selecttype'
23799 sendmail='$sendmail'
23800 setgrent_r_proto='$setgrent_r_proto'
23801 sethostent_r_proto='$sethostent_r_proto'
23802 setlocale_r_proto='$setlocale_r_proto'
23803 setnetent_r_proto='$setnetent_r_proto'
23804 setprotoent_r_proto='$setprotoent_r_proto'
23805 setpwent_r_proto='$setpwent_r_proto'
23806 setservent_r_proto='$setservent_r_proto'
23807 sh='$sh'
23808 shar='$shar'
23809 sharpbang='$sharpbang'
23810 shmattype='$shmattype'
23811 shortsize='$shortsize'
23812 shrpenv='$shrpenv'
23813 shsharp='$shsharp'
23814 sig_count='$sig_count'
23815 sig_name='$sig_name'
23816 sig_name_init='$sig_name_init'
23817 sig_num='$sig_num'
23818 sig_num_init='$sig_num_init'
23819 sig_size='$sig_size'
23820 signal_t='$signal_t'
23821 sitearch='$sitearch'
23822 sitearchexp='$sitearchexp'
23823 sitebin='$sitebin'
23824 sitebinexp='$sitebinexp'
23825 sitehtml1dir='$sitehtml1dir'
23826 sitehtml1direxp='$sitehtml1direxp'
23827 sitehtml3dir='$sitehtml3dir'
23828 sitehtml3direxp='$sitehtml3direxp'
23829 sitelib='$sitelib'
23830 sitelib_stem='$sitelib_stem'
23831 sitelibexp='$sitelibexp'
23832 siteman1dir='$siteman1dir'
23833 siteman1direxp='$siteman1direxp'
23834 siteman3dir='$siteman3dir'
23835 siteman3direxp='$siteman3direxp'
23836 siteprefix='$siteprefix'
23837 siteprefixexp='$siteprefixexp'
23838 sitescript='$sitescript'
23839 sitescriptexp='$sitescriptexp'
23840 sizesize='$sizesize'
23841 sizetype='$sizetype'
23842 sleep='$sleep'
23843 smail='$smail'
23844 so='$so'
23845 sockethdr='$sockethdr'
23846 socketlib='$socketlib'
23847 socksizetype='$socksizetype'
23848 sort='$sort'
23849 spackage='$spackage'
23850 spitshell='$spitshell'
23851 srand48_r_proto='$srand48_r_proto'
23852 srandom_r_proto='$srandom_r_proto'
23853 src='$src'
23854 ssizetype='$ssizetype'
23855 st_ino_sign='$st_ino_sign'
23856 st_ino_size='$st_ino_size'
23857 startperl='$startperl'
23858 startsh='$startsh'
23859 static_ext='$static_ext'
23860 stdchar='$stdchar'
23861 stdio_base='$stdio_base'
23862 stdio_bufsiz='$stdio_bufsiz'
23863 stdio_cnt='$stdio_cnt'
23864 stdio_filbuf='$stdio_filbuf'
23865 stdio_ptr='$stdio_ptr'
23866 stdio_stream_array='$stdio_stream_array'
23867 strerror_r_proto='$strerror_r_proto'
23868 strings='$strings'
23869 submit='$submit'
23870 subversion='$subversion'
23871 sysman='$sysman'
23872 tail='$tail'
23873 tar='$tar'
23874 targetarch='$targetarch'
23875 tbl='$tbl'
23876 tee='$tee'
23877 test='$test'
23878 timeincl='$timeincl'
23879 timetype='$timetype'
23880 tmpnam_r_proto='$tmpnam_r_proto'
23881 to='$to'
23882 touch='$touch'
23883 tr='$tr'
23884 trnl='$trnl'
23885 troff='$troff'
23886 ttyname_r_proto='$ttyname_r_proto'
23887 u16size='$u16size'
23888 u16type='$u16type'
23889 u32size='$u32size'
23890 u32type='$u32type'
23891 u64size='$u64size'
23892 u64type='$u64type'
23893 u8size='$u8size'
23894 u8type='$u8type'
23895 uidformat='$uidformat'
23896 uidsign='$uidsign'
23897 uidsize='$uidsize'
23898 uidtype='$uidtype'
23899 uname='$uname'
23900 uniq='$uniq'
23901 uquadtype='$uquadtype'
23902 use5005threads='$use5005threads'
23903 use64bitall='$use64bitall'
23904 use64bitint='$use64bitint'
23905 usecrosscompile='$usecrosscompile'
23906 usedevel='$usedevel'
23907 usedl='$usedl'
23908 usedtrace='$usedtrace'
23909 usefaststdio='$usefaststdio'
23910 useithreads='$useithreads'
23911 usekernprocpathname='$usekernprocpathname'
23912 uselargefiles='$uselargefiles'
23913 uselongdouble='$uselongdouble'
23914 usemallocwrap='$usemallocwrap'
23915 usemorebits='$usemorebits'
23916 usemultiplicity='$usemultiplicity'
23917 usemymalloc='$usemymalloc'
23918 usenm='$usenm'
23919 usensgetexecutablepath='$usensgetexecutablepath'
23920 useopcode='$useopcode'
23921 useperlio='$useperlio'
23922 useposix='$useposix'
23923 usereentrant='$usereentrant'
23924 userelocatableinc='$userelocatableinc'
23925 usesfio='$usesfio'
23926 useshrplib='$useshrplib'
23927 usesitecustomize='$usesitecustomize'
23928 usesocks='$usesocks'
23929 usethreads='$usethreads'
23930 usevendorprefix='$usevendorprefix'
23931 useversionedarchname='$useversionedarchname'
23932 usevfork='$usevfork'
23933 usrinc='$usrinc'
23934 uuname='$uuname'
23935 uvXUformat='$uvXUformat'
23936 uvoformat='$uvoformat'
23937 uvsize='$uvsize'
23938 uvtype='$uvtype'
23939 uvuformat='$uvuformat'
23940 uvxformat='$uvxformat'
23941 vaproto='$vaproto'
23942 vendorarch='$vendorarch'
23943 vendorarchexp='$vendorarchexp'
23944 vendorbin='$vendorbin'
23945 vendorbinexp='$vendorbinexp'
23946 vendorhtml1dir='$vendorhtml1dir'
23947 vendorhtml1direxp='$vendorhtml1direxp'
23948 vendorhtml3dir='$vendorhtml3dir'
23949 vendorhtml3direxp='$vendorhtml3direxp'
23950 vendorlib='$vendorlib'
23951 vendorlib_stem='$vendorlib_stem'
23952 vendorlibexp='$vendorlibexp'
23953 vendorman1dir='$vendorman1dir'
23954 vendorman1direxp='$vendorman1direxp'
23955 vendorman3dir='$vendorman3dir'
23956 vendorman3direxp='$vendorman3direxp'
23957 vendorprefix='$vendorprefix'
23958 vendorprefixexp='$vendorprefixexp'
23959 vendorscript='$vendorscript'
23960 vendorscriptexp='$vendorscriptexp'
23961 version='$version'
23962 version_patchlevel_string='$version_patchlevel_string'
23963 versiononly='$versiononly'
23964 vi='$vi'
23965 voidflags='$voidflags'
23966 xlibpth='$xlibpth'
23967 yacc='$yacc'
23968 yaccflags='$yaccflags'
23969 zcat='$zcat'
23970 zip='$zip'
23971 EOT
23972
23973 : add special variables
23974 $test -f $src/patchlevel.h && \
23975 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23976 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23977 echo "PERL_CONFIG_SH=true" >>config.sh
23978
23979 : propagate old symbols
23980 if $test -f UU/config.sh; then
23981         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23982         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23983                 config.sh config.sh UU/oldconfig.sh |\
23984                 $sort | $uniq -u >UU/oldsyms
23985         set X `$cat UU/oldsyms`
23986         shift
23987         case $# in
23988         0) ;;
23989         *)
23990                 $cat <<EOM
23991 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23992 EOM
23993                 echo ": Variables propagated from previous config.sh file." >>config.sh
23994                 for sym in `$cat UU/oldsyms`; do
23995                         echo "    Propagating $hint variable "'$'"$sym..."
23996                         eval 'tmp="$'"${sym}"'"'
23997                         echo "$tmp" | \
23998                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23999                 done
24000                 ;;
24001         esac
24002 fi
24003
24004 : Finish up by extracting the .SH files
24005 case "$alldone" in
24006 exit)
24007         $rm -rf UU
24008         echo "Extraction done."
24009         exit 0
24010         ;;
24011 cont)
24012         ;;
24013 '')
24014         dflt=''
24015         nostick=true
24016         $cat <<EOM
24017
24018 If you'd like to make any changes to the config.sh file before I begin
24019 to configure things, do it as a shell escape now (e.g. !vi config.sh).
24020
24021 EOM
24022         rp="Press return or use a shell escape to edit config.sh:"
24023         . UU/myread
24024         nostick=''
24025         case "$ans" in
24026         '') ;;
24027         *) : in case they cannot read
24028                 sh 1>&4 -c "$ans";;
24029         esac
24030         ;;
24031 esac
24032
24033 : if this fails, just run all the .SH files by hand
24034 . ./config.sh
24035
24036 echo " "
24037 exec 1>&4
24038 pwd=`pwd`
24039 . ./UU/extract
24040 cd "$pwd"
24041
24042 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
24043         dflt=y
24044         case "$silent" in
24045         true) ;;
24046         *)
24047                 $cat <<EOM
24048
24049 Now you need to generate make dependencies by running "$make depend".
24050 You might prefer to run it in background: "$make depend > makedepend.out &"
24051 It can take a while, so you might not want to run it right now.
24052
24053 EOM
24054                 ;;
24055         esac
24056         rp="Run $make depend now?"
24057         . UU/myread
24058         case "$ans" in
24059         y*)
24060                 $make depend && echo "Now you must run '$make'."
24061                 ;;
24062         *)
24063                 echo "You must run '$make depend' then '$make'."
24064                 ;;
24065         esac
24066 elif test -f [Mm]akefile; then
24067         echo " "
24068         echo "Now you must run a $make."
24069 else
24070         echo "Configure done."
24071 fi
24072
24073 if $test -f Policy.sh; then
24074     $cat <<EOM
24075
24076 If you compile $package on a different machine or from a different object
24077 directory, copy the Policy.sh file from this object directory to the
24078 new one before you run Configure -- this will help you with most of
24079 the policy defaults.
24080
24081 EOM
24082 fi
24083 if $test -f config.msg; then
24084     echo "Hmm.  I also noted the following information while running:"
24085     echo " "
24086     $cat config.msg >&4
24087     $rm -f config.msg
24088 fi
24089 $rm -f kit*isdone ark*isdone
24090 $rm -rf UU
24091
24092 : End of Configure
24093