This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Merge the sfio removal to blead.
[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 Tue Sep 17 10:34:33 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_shm=''
710 d_shmat=''
711 d_shmatprototype=''
712 shmattype=''
713 d_shmctl=''
714 d_shmdt=''
715 d_shmget=''
716 d_sigaction=''
717 d_signbit=''
718 d_sigprocmask=''
719 d_sigsetjmp=''
720 usesitecustomize=''
721 d_snprintf=''
722 d_vsnprintf=''
723 d_sockatmark=''
724 d_sockatmarkproto=''
725 d_ip_mreq=''
726 d_ip_mreq_source=''
727 d_ipv6_mreq=''
728 d_ipv6_mreq_source=''
729 d_msg_ctrunc=''
730 d_msg_dontroute=''
731 d_msg_oob=''
732 d_msg_peek=''
733 d_msg_proxy=''
734 d_oldsock=''
735 d_scm_rights=''
736 d_sin6_scope_id=''
737 d_sockaddr_in6=''
738 d_sockaddr_sa_len=''
739 d_socket=''
740 d_sockpair=''
741 sockethdr=''
742 socketlib=''
743 d_socklen_t=''
744 d_socks5_init=''
745 d_sprintf_returns_strlen=''
746 d_sqrtl=''
747 d_srand48_r=''
748 srand48_r_proto=''
749 d_srandom_r=''
750 srandom_r_proto=''
751 d_sresgproto=''
752 d_sresuproto=''
753 d_statblks=''
754 d_statfs_f_flags=''
755 d_statfs_s=''
756 d_static_inline=''
757 perl_static_inline=''
758 d_fstatvfs=''
759 d_statvfs=''
760 d_stdio_cnt_lval=''
761 d_stdio_ptr_lval=''
762 d_stdio_ptr_lval_nochange_cnt=''
763 d_stdio_ptr_lval_sets_cnt=''
764 d_stdiobase=''
765 d_stdstdio=''
766 stdio_base=''
767 stdio_bufsiz=''
768 stdio_cnt=''
769 stdio_filbuf=''
770 stdio_ptr=''
771 d_index=''
772 d_strchr=''
773 d_strcoll=''
774 d_strctcpy=''
775 d_strerrm=''
776 d_strerror=''
777 d_sysernlst=''
778 d_syserrlst=''
779 d_strerror_r=''
780 strerror_r_proto=''
781 d_strftime=''
782 d_strlcat=''
783 d_strlcpy=''
784 d_strtod=''
785 d_strtol=''
786 d_strtold=''
787 d_strtoll=''
788 d_strtoq=''
789 d_strtoul=''
790 d_strtoull=''
791 d_strtouq=''
792 d_strxfrm=''
793 d_symlink=''
794 d_syscall=''
795 d_syscallproto=''
796 d_sysconf=''
797 d_system=''
798 d_tcgetpgrp=''
799 d_tcsetpgrp=''
800 d_telldirproto=''
801 d_time=''
802 timetype=''
803 d_asctime64=''
804 d_ctime64=''
805 d_difftime64=''
806 d_gmtime64=''
807 d_localtime64=''
808 d_mktime64=''
809 d_timegm=''
810 clocktype=''
811 d_times=''
812 d_tmpnam_r=''
813 tmpnam_r_proto=''
814 d_truncate=''
815 d_ttyname_r=''
816 ttyname_r_proto=''
817 d_tzname=''
818 d_u32align=''
819 d_ualarm=''
820 d_umask=''
821 d_semctl_semid_ds=''
822 d_semctl_semun=''
823 d_union_semun=''
824 d_unordered=''
825 d_unsetenv=''
826 d_usleep=''
827 d_usleepproto=''
828 d_ustat=''
829 d_pseudofork=''
830 d_vfork=''
831 usevfork=''
832 d_voidsig=''
833 signal_t=''
834 d_volatile=''
835 d_charvspr=''
836 d_vprintf=''
837 d_wait4=''
838 d_waitpid=''
839 d_wcstombs=''
840 d_wctomb=''
841 d_writev=''
842 dlext=''
843 bin_ELF=''
844 cccdlflags=''
845 ccdlflags=''
846 dlsrc=''
847 ld=''
848 ld_can_script=''
849 lddlflags=''
850 usedl=''
851 doublesize=''
852 bootstrap_charset=''
853 ebcdic=''
854 fflushNULL=''
855 fflushall=''
856 fpossize=''
857 fpostype=''
858 gccansipedantic=''
859 gccosandvers=''
860 gccversion=''
861 gidformat=''
862 gidsign=''
863 gidsize=''
864 gidtype=''
865 groupstype=''
866 h_fcntl=''
867 h_sysfile=''
868 html1dir=''
869 html1direxp=''
870 installhtml1dir=''
871 html3dir=''
872 html3direxp=''
873 installhtml3dir=''
874 i_arpainet=''
875 i_assert=''
876 i_crypt=''
877 db_hashtype=''
878 db_prefixtype=''
879 db_version_major=''
880 db_version_minor=''
881 db_version_patch=''
882 i_db=''
883 i_dbm=''
884 i_rpcsvcdbm=''
885 d_dirnamlen=''
886 direntrytype=''
887 i_dirent=''
888 i_dlfcn=''
889 i_fcntl=''
890 i_float=''
891 i_fp=''
892 i_fp_class=''
893 i_gdbm=''
894 d_grpasswd=''
895 i_grp=''
896 i_ieeefp=''
897 i_inttypes=''
898 i_langinfo=''
899 i_libutil=''
900 i_limits=''
901 i_locale=''
902 i_machcthr=''
903 i_malloc=''
904 i_mallocmalloc=''
905 i_math=''
906 i_memory=''
907 i_mntent=''
908 d_gdbm_ndbm_h_uses_prototypes=''
909 d_gdbmndbm_h_uses_prototypes=''
910 d_ndbm=''
911 d_ndbm_h_uses_prototypes=''
912 i_gdbm_ndbm=''
913 i_gdbmndbm=''
914 i_ndbm=''
915 i_netdb=''
916 i_neterrno=''
917 i_netinettcp=''
918 i_niin=''
919 i_sysin=''
920 i_poll=''
921 i_prot=''
922 i_pthread=''
923 d_pwage=''
924 d_pwchange=''
925 d_pwclass=''
926 d_pwcomment=''
927 d_pwexpire=''
928 d_pwgecos=''
929 d_pwpasswd=''
930 d_pwquota=''
931 i_pwd=''
932 i_shadow=''
933 i_socks=''
934 i_stdbool=''
935 i_stddef=''
936 i_stdlib=''
937 i_string=''
938 strings=''
939 i_sunmath=''
940 i_sysaccess=''
941 i_sysdir=''
942 i_sysfile=''
943 d_voidtty=''
944 i_bsdioctl=''
945 i_sysfilio=''
946 i_sysioctl=''
947 i_syssockio=''
948 i_syslog=''
949 i_sysmman=''
950 i_sysmode=''
951 i_sysmount=''
952 i_sysndir=''
953 i_sysparam=''
954 i_syspoll=''
955 i_sysresrc=''
956 i_syssecrt=''
957 i_sysselct=''
958 i_sysstat=''
959 i_sysstatfs=''
960 i_sysstatvfs=''
961 i_systimes=''
962 i_systypes=''
963 i_sysuio=''
964 i_sysun=''
965 i_sysutsname=''
966 i_sysvfs=''
967 i_syswait=''
968 i_sgtty=''
969 i_termio=''
970 i_termios=''
971 d_tm_tm_gmtoff=''
972 d_tm_tm_zone=''
973 i_systime=''
974 i_systimek=''
975 i_time=''
976 timeincl=''
977 i_unistd=''
978 i_ustat=''
979 i_utime=''
980 i_values=''
981 i_stdarg=''
982 i_varargs=''
983 i_varhdr=''
984 i_vfork=''
985 d_inc_version_list=''
986 inc_version_list=''
987 inc_version_list_init=''
988 installprefix=''
989 installprefixexp=''
990 installstyle=''
991 installusrbinperl=''
992 intsize=''
993 longsize=''
994 shortsize=''
995 issymlink=''
996 libc=''
997 ldlibpthname=''
998 libperl=''
999 shrpenv=''
1000 useshrplib=''
1001 glibpth=''
1002 libpth=''
1003 loclibpth=''
1004 plibpth=''
1005 xlibpth=''
1006 ignore_versioned_solibs=''
1007 libs=''
1008 libsdirs=''
1009 libsfiles=''
1010 libsfound=''
1011 libspath=''
1012 lns=''
1013 d_PRIEUldbl=''
1014 d_PRIFUldbl=''
1015 d_PRIGUldbl=''
1016 d_PRIeldbl=''
1017 d_PRIfldbl=''
1018 d_PRIgldbl=''
1019 d_SCNfldbl=''
1020 sPRIEUldbl=''
1021 sPRIFUldbl=''
1022 sPRIGUldbl=''
1023 sPRIeldbl=''
1024 sPRIfldbl=''
1025 sPRIgldbl=''
1026 sSCNfldbl=''
1027 lseeksize=''
1028 lseektype=''
1029 mad=''
1030 madlyh=''
1031 madlyobj=''
1032 madlysrc=''
1033 make_set_make=''
1034 d_mymalloc=''
1035 freetype=''
1036 mallocobj=''
1037 mallocsrc=''
1038 malloctype=''
1039 usemallocwrap=''
1040 usemymalloc=''
1041 installman1dir=''
1042 man1dir=''
1043 man1direxp=''
1044 man1ext=''
1045 installman3dir=''
1046 man3dir=''
1047 man3direxp=''
1048 man3ext=''
1049 modetype=''
1050 multiarch=''
1051 mydomain=''
1052 myhostname=''
1053 phostname=''
1054 c=''
1055 n=''
1056 d_eofnblk=''
1057 eagain=''
1058 o_nonblock=''
1059 rd_nodata=''
1060 need_va_copy=''
1061 netdb_hlen_type=''
1062 netdb_host_type=''
1063 netdb_name_type=''
1064 netdb_net_type=''
1065 groupcat=''
1066 hostcat=''
1067 passcat=''
1068 orderlib=''
1069 ranlib=''
1070 d_perl_otherlibdirs=''
1071 otherlibdirs=''
1072 package=''
1073 spackage=''
1074 pager=''
1075 api_revision=''
1076 api_subversion=''
1077 api_version=''
1078 api_versionstring=''
1079 patchlevel=''
1080 perl_patchlevel=''
1081 revision=''
1082 subversion=''
1083 version=''
1084 version_patchlevel_string=''
1085 perl5=''
1086 perladmin=''
1087 perlpath=''
1088 d_nv_preserves_uv=''
1089 d_nv_zero_is_allbits_zero=''
1090 i16size=''
1091 i16type=''
1092 i32size=''
1093 i32type=''
1094 i64size=''
1095 i64type=''
1096 i8size=''
1097 i8type=''
1098 ivsize=''
1099 ivtype=''
1100 nv_overflows_integers_at=''
1101 nv_preserves_uv_bits=''
1102 nvsize=''
1103 nvtype=''
1104 u16size=''
1105 u16type=''
1106 u32size=''
1107 u32type=''
1108 u64size=''
1109 u64type=''
1110 u8size=''
1111 u8type=''
1112 uvsize=''
1113 uvtype=''
1114 ivdformat=''
1115 nvEUformat=''
1116 nvFUformat=''
1117 nvGUformat=''
1118 nveformat=''
1119 nvfformat=''
1120 nvgformat=''
1121 uvXUformat=''
1122 uvoformat=''
1123 uvuformat=''
1124 uvxformat=''
1125 pidtype=''
1126 prefix=''
1127 prefixexp=''
1128 installprivlib=''
1129 privlib=''
1130 privlibexp=''
1131 prototype=''
1132 ptrsize=''
1133 d_PRIXU64=''
1134 d_PRId64=''
1135 d_PRIi64=''
1136 d_PRIo64=''
1137 d_PRIu64=''
1138 d_PRIx64=''
1139 sPRIXU64=''
1140 sPRId64=''
1141 sPRIi64=''
1142 sPRIo64=''
1143 sPRIu64=''
1144 sPRIx64=''
1145 d_quad=''
1146 quadkind=''
1147 quadtype=''
1148 uquadtype=''
1149 drand01=''
1150 randbits=''
1151 randfunc=''
1152 randseedtype=''
1153 seedfunc=''
1154 installscript=''
1155 scriptdir=''
1156 scriptdirexp=''
1157 selectminbits=''
1158 selecttype=''
1159 sh=''
1160 sig_count=''
1161 sig_name=''
1162 sig_name_init=''
1163 sig_num=''
1164 sig_num_init=''
1165 sig_size=''
1166 d_sitearch=''
1167 installsitearch=''
1168 sitearch=''
1169 sitearchexp=''
1170 installsitebin=''
1171 sitebin=''
1172 sitebinexp=''
1173 installsitehtml1dir=''
1174 sitehtml1dir=''
1175 sitehtml1direxp=''
1176 installsitehtml3dir=''
1177 sitehtml3dir=''
1178 sitehtml3direxp=''
1179 installsitelib=''
1180 sitelib=''
1181 sitelib_stem=''
1182 sitelibexp=''
1183 installsiteman1dir=''
1184 siteman1dir=''
1185 siteman1direxp=''
1186 installsiteman3dir=''
1187 siteman3dir=''
1188 siteman3direxp=''
1189 siteprefix=''
1190 siteprefixexp=''
1191 installsitescript=''
1192 sitescript=''
1193 sitescriptexp=''
1194 sizesize=''
1195 sizetype=''
1196 so=''
1197 socksizetype=''
1198 sharpbang=''
1199 shsharp=''
1200 spitshell=''
1201 src=''
1202 ssizetype=''
1203 st_ino_sign=''
1204 st_ino_size=''
1205 startperl=''
1206 startsh=''
1207 stdchar=''
1208 d_stdio_stream_array=''
1209 stdio_stream_array=''
1210 sysman=''
1211 sGMTIME_max=''
1212 sGMTIME_min=''
1213 sLOCALTIME_max=''
1214 sLOCALTIME_min=''
1215 trnl=''
1216 uidformat=''
1217 uidsign=''
1218 uidsize=''
1219 uidtype=''
1220 archname64=''
1221 use64bitall=''
1222 use64bitint=''
1223 dtrace=''
1224 usedtrace=''
1225 usefaststdio=''
1226 usekernprocpathname=''
1227 ccflags_uselargefiles=''
1228 ldflags_uselargefiles=''
1229 libswanted_uselargefiles=''
1230 uselargefiles=''
1231 uselongdouble=''
1232 usemorebits=''
1233 usemultiplicity=''
1234 nm_opt=''
1235 nm_so_opt=''
1236 runnm=''
1237 usenm=''
1238 usensgetexecutablepath=''
1239 useperlio=''
1240 usesocks=''
1241 d_oldpthreads=''
1242 use5005threads=''
1243 useithreads=''
1244 usereentrant=''
1245 usethreads=''
1246 incpath=''
1247 mips_type=''
1248 usrinc=''
1249 vaproto=''
1250 d_vendorarch=''
1251 installvendorarch=''
1252 vendorarch=''
1253 vendorarchexp=''
1254 d_vendorbin=''
1255 installvendorbin=''
1256 vendorbin=''
1257 vendorbinexp=''
1258 installvendorhtml1dir=''
1259 vendorhtml1dir=''
1260 vendorhtml1direxp=''
1261 installvendorhtml3dir=''
1262 vendorhtml3dir=''
1263 vendorhtml3direxp=''
1264 d_vendorlib=''
1265 installvendorlib=''
1266 vendorlib=''
1267 vendorlib_stem=''
1268 vendorlibexp=''
1269 installvendorman1dir=''
1270 vendorman1dir=''
1271 vendorman1direxp=''
1272 installvendorman3dir=''
1273 vendorman3dir=''
1274 vendorman3direxp=''
1275 usevendorprefix=''
1276 vendorprefix=''
1277 vendorprefixexp=''
1278 d_vendorscript=''
1279 installvendorscript=''
1280 vendorscript=''
1281 vendorscriptexp=''
1282 versiononly=''
1283 yacc=''
1284 yaccflags=''
1285 CONFIG=''
1286
1287 : Detect odd OSs
1288 define='define'
1289 undef='undef'
1290 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1291 rmlist=''
1292
1293 : We must find out about Eunice early
1294 eunicefix=':'
1295 if test -f /etc/unixtovms; then
1296         eunicefix=/etc/unixtovms
1297 fi
1298 if test -f /etc/unixtovms.exe; then
1299         eunicefix=/etc/unixtovms.exe
1300 fi
1301
1302 : Set executable suffix now -- needed before hints available
1303 if test -f "/libs/version.library"; then
1304 : Amiga OS
1305     _exe=""
1306 elif test -f "/system/gnu_library/bin/ar.pm"; then
1307 : Stratus VOS
1308     _exe=".pm"
1309 elif test -n "$DJGPP"; then
1310 : DOS DJGPP
1311     _exe=".exe"
1312 elif test -f /kern/cookiejar; then
1313 : MiNT
1314     _exe=""
1315 elif test -d c:/. -o -n "$is_os2" ; then
1316 : OS/2 or cygwin
1317     _exe=".exe"
1318 fi
1319
1320 groupstype=''
1321 i_whoami=''
1322 : Trailing extension.  Override this in a hint file, if needed.
1323 : Extra object files, if any, needed on this platform.
1324 archobjs=''
1325 archname=''
1326 : Possible local include directories to search.
1327 : Set locincpth to "" in a hint file to defeat local include searches.
1328 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1329 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1330 :
1331 : no include file wanted by default
1332 inclwanted=''
1333
1334 : Enable -DEBUGGING and -DDEBUGGING from the command line
1335 EBUGGING=''
1336 DEBUGGING=''
1337
1338 libnames=''
1339 : change the next line if compiling for Xenix/286 on Xenix/386
1340 xlibpth='/usr/lib/386 /lib/386'
1341 : Possible local library directories to search.
1342 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1343 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1344
1345 : general looking path for locating libraries
1346 glibpth="/lib /usr/lib $xlibpth"
1347 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1348 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1349 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1350 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1351
1352 : Private path used by Configure to find libraries.  Its value
1353 : is prepended to libpth. This variable takes care of special
1354 : machines, like the mips.  Usually, it should be empty.
1355 plibpth=''
1356
1357 : default library list
1358 libswanted=''
1359 : some systems want to use only the non-versioned libso:s
1360 ignore_versioned_solibs=''
1361 : set usethreads on the Configure command line to enable threads.
1362 usereentrant='undef'
1363 ccname=''
1364 ccversion=''
1365 perllibs=''
1366 : set useposix=false in your hint file to disable the POSIX extension.
1367 useposix=true
1368 : set useopcode=false in your hint file to disable the Opcode extension.
1369 useopcode=true
1370 archname64=''
1371 ccflags_uselargefiles=''
1372 ldflags_uselargefiles=''
1373 libswanted_uselargefiles=''
1374 : set usemultiplicity on the Configure command line to enable multiplicity.
1375 : set usesocks on the Configure command line to enable socks.
1376 : List of libraries we want.
1377 : If anyone needs extra -lxxx, put those in a hint file.
1378 libswanted="socket bind inet nsl nm ndbm gdbm dbm db malloc dl ld sun"
1379 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1380 : We probably want to search /usr/shlib before most other libraries.
1381 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1382 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1383 glibpth="/usr/shlib $glibpth"
1384 : Do not use vfork unless overridden by a hint file.
1385 usevfork=false
1386
1387 : Find the basic shell for Bourne shell scripts
1388 case "$sh" in
1389 '')
1390         case "$SYSTYPE" in
1391         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1392         *) xxx='/bin/sh';;
1393         esac
1394         if test -f "$xxx"; then
1395                 sh="$xxx"
1396         else
1397                 : Build up a list and do a single loop so we can 'break' out.
1398                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1399                 for xxx in sh bash ksh pdksh ash; do
1400                         for p in $pth; do
1401                                 try="$try ${p}/${xxx}"
1402                         done
1403                 done
1404                 for xxx in $try; do
1405                         if test -f "$xxx"; then
1406                                 sh="$xxx";
1407                                 break
1408                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1409                                 sh="$xxx";
1410                                 break
1411                         elif test -f "$xxx.exe"; then
1412                                 sh="$xxx";
1413                                 break
1414                         fi
1415                 done
1416         fi
1417         ;;
1418 esac
1419
1420 case "$sh" in
1421 '')     cat >&2 <<EOM
1422 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1423
1424 Usually it's in /bin/sh.  How did you even get this far?
1425 Please contact me (Perl Maintainers) at perlbug@perl.org and
1426 we'll try to straighten this all out.
1427 EOM
1428         exit 1
1429         ;;
1430 esac
1431
1432 : see if sh knows # comments
1433 if `$sh -c '#' >/dev/null 2>&1`; then
1434         shsharp=true
1435         spitshell=cat
1436         xcat=/bin/cat
1437         test -f $xcat$_exe || xcat=/usr/bin/cat
1438         if test ! -f $xcat$_exe; then
1439                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1440                         if test -f $p/cat$_exe; then
1441                                 xcat=$p/cat
1442                                 break
1443                         fi
1444                 done
1445                 if test ! -f $xcat$_exe; then
1446                         echo "Can't find cat anywhere!"
1447                         exit 1
1448                 fi
1449         fi
1450         echo "#!$xcat" >sharp
1451         $eunicefix sharp
1452         chmod +x sharp
1453         ./sharp > today 2>/dev/null
1454         if test -s today; then
1455                 sharpbang='#!'
1456         else
1457                 echo "#! $xcat" > sharp
1458                 $eunicefix sharp
1459                 chmod +x sharp
1460                 ./sharp > today 2>/dev/null
1461                 if test -s today; then
1462                         sharpbang='#! '
1463                 else
1464                         sharpbang=': use '
1465                 fi
1466         fi
1467 else
1468         echo " "
1469         echo "Your $sh doesn't grok # comments--I will strip them later on."
1470         shsharp=false
1471         cd ..
1472         echo "exec grep -v '^[  ]*#'" >spitshell
1473         chmod +x spitshell
1474         $eunicefix spitshell
1475         spitshell=`pwd`/spitshell
1476         cd UU
1477         echo "I presume that if # doesn't work, #! won't work either!"
1478         sharpbang=': use '
1479 fi
1480 rm -f sharp today
1481
1482 : figure out how to guarantee sh startup
1483 case "$startsh" in
1484 '') startsh=${sharpbang}${sh} ;;
1485 *)
1486 esac
1487 cat >sharp <<EOSS
1488 $startsh
1489 set abc
1490 test "$?abc" != 1
1491 EOSS
1492
1493 chmod +x sharp
1494 $eunicefix sharp
1495 if ./sharp; then
1496         : echo "Yup, it does."
1497 else
1498         echo "Hmm... '$startsh' does not guarantee sh startup..."
1499         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1500 fi
1501 rm -f sharp
1502
1503 : Save command line options in file UU/cmdline.opt for later use in
1504 : generating config.sh.
1505 cat > cmdline.opt <<EOSH
1506 : Configure command line arguments.
1507 config_arg0='$0'
1508 config_args='$*'
1509 config_argc=$#
1510 EOSH
1511 argn=1
1512 args_exp=''
1513 args_sep=''
1514 for arg in "$@"; do
1515         cat >>cmdline.opt <<EOSH
1516 config_arg$argn='$arg'
1517 EOSH
1518         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1519 $arg
1520 EOC
1521         arg_exp=`cat cmdl.opt`
1522         args_exp="$args_exp$args_sep'$arg_exp'"
1523         argn=`expr $argn + 1`
1524         args_sep=' '
1525 done
1526 rm -f cmdl.opt
1527
1528 : produce awk script to parse command line options
1529 cat >options.awk <<'EOF'
1530 BEGIN {
1531         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1532
1533         len = length(optstr);
1534         for (i = 1; i <= len; i++) {
1535                 c = substr(optstr, i, 1);
1536                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1537                 if (a == ":") {
1538                         arg[c] = 1;
1539                         i++;
1540                 }
1541                 opt[c] = 1;
1542         }
1543 }
1544 {
1545         expect = 0;
1546         str = $0;
1547         if (substr(str, 1, 1) != "-") {
1548                 printf("'%s'\n", str);
1549                 next;
1550         }
1551         len = length($0);
1552         for (i = 2; i <= len; i++) {
1553                 c = substr(str, i, 1);
1554                 if (!opt[c]) {
1555                         printf("-%s\n", substr(str, i));
1556                         next;
1557                 }
1558                 printf("-%s\n", c);
1559                 if (arg[c]) {
1560                         if (i < len)
1561                                 printf("'%s'\n", substr(str, i + 1));
1562                         else
1563                                 expect = 1;
1564                         next;
1565                 }
1566         }
1567 }
1568 END {
1569         if (expect)
1570                 print "?";
1571 }
1572 EOF
1573
1574 : process the command line options
1575 set X `for arg in "$@"; do echo "X$arg"; done |
1576         sed -e s/X// | awk -f options.awk`
1577 eval "set $*"
1578 shift
1579 rm -f options.awk
1580
1581 : set up default values
1582 fastread=''
1583 reuseval=false
1584 config_sh=''
1585 alldone=''
1586 error=''
1587 silent=''
1588 extractsh=''
1589 override=''
1590 knowitall=''
1591 rm -f optdef.sh posthint.sh
1592 cat >optdef.sh <<EOS
1593 $startsh
1594 EOS
1595
1596
1597 : option parsing
1598 while test $# -gt 0; do
1599         case "$1" in
1600         -d) shift; fastread=yes;;
1601         -e) shift; alldone=cont;;
1602         -f)
1603                 shift
1604                 cd ..
1605                 if test -r "$1"; then
1606                         config_sh="$1"
1607                 else
1608                         echo "$me: cannot read config file $1." >&2
1609                         error=true
1610                 fi
1611                 cd UU
1612                 shift;;
1613         --help|\
1614         -h) shift; error=true;;
1615         -r) shift; reuseval=true;;
1616         -s) shift; silent=true; realsilent=true;;
1617         -E) shift; alldone=exit;;
1618         -K) shift; knowitall=true;;
1619         -O) shift; override=true;;
1620         -S) shift; silent=true; extractsh=true;;
1621         -D)
1622                 shift
1623                 case "$1" in
1624                 *=)
1625                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1626                         echo "$me: ignoring -D $1" >&2
1627                         ;;
1628                 *=*) echo "$1" | \
1629                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1630                 *) echo "$1='define'" >> optdef.sh;;
1631                 esac
1632                 shift
1633                 ;;
1634         -U)
1635                 shift
1636                 case "$1" in
1637                 *=) echo "$1" >> optdef.sh;;
1638                 *=*)
1639                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1640                         echo "$me: ignoring -U $1" >&2
1641                         ;;
1642                 *) echo "$1='undef'" >> optdef.sh;;
1643                 esac
1644                 shift
1645                 ;;
1646         -A)
1647             shift
1648             xxx=''
1649             yyy="$1"
1650             zzz=''
1651             uuu=undef
1652             case "$yyy" in
1653             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1654                  case "$zzz" in
1655                  *:*) zzz='' ;;
1656                  *)   xxx=append
1657                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1658                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1659                  esac
1660                  ;;
1661             esac
1662             case "$xxx" in
1663             '')  case "$yyy" in
1664                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1665                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1666                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1667                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1668                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1669                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1670                  esac
1671                  ;;
1672             esac
1673             case "$xxx" in
1674             append)
1675                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1676             clear)
1677                 echo "$yyy=''"                  >> posthint.sh ;;
1678             define)
1679                 case "$zzz" in
1680                 '') zzz=define ;;
1681                 esac
1682                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1683             eval)
1684                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1685             prepend)
1686                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1687             undef)
1688                 case "$zzz" in
1689                 '') zzz="$uuu" ;;
1690                 esac
1691                 echo "$yyy=$zzz"                >> posthint.sh ;;
1692             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1693             esac
1694             shift
1695             ;;
1696         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1697             exit 0;;
1698         --) break;;
1699         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1700         *) break;;
1701         esac
1702 done
1703
1704 case "$error" in
1705 true)
1706         cat >&2 <<EOM
1707 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1708                  [-U symbol] [-U symbol=] [-A command:symbol...]
1709   -d : use defaults for all answers.
1710   -e : go on without questioning past the production of config.sh.
1711   -f : specify an alternate default configuration file.
1712   -h : print this help message and exit (with an error status).
1713   -r : reuse C symbols value if possible (skips costly nm extraction).
1714   -s : silent mode, only echoes questions and essential information.
1715   -D : define symbol to have some value:
1716          -D symbol         symbol gets the value 'define'
1717          -D symbol=value   symbol gets the value 'value'
1718        common used examples (see INSTALL for more info):
1719          -Duse64bitint            use 64bit integers
1720          -Duse64bitall            use 64bit integers and pointers
1721          -Dusethreads             use thread support
1722          -Dinc_version_list=none  do not include older perl trees in @INC
1723          -DEBUGGING=none          DEBUGGING options
1724          -Dcc=gcc                 choose your compiler
1725          -Dprefix=/opt/perl5      choose your destination
1726   -E : stop at the end of questions, after having produced config.sh.
1727   -K : do not use unless you know what you are doing.
1728   -O : let -D and -U override definitions from loaded configuration file.
1729   -S : perform variable substitutions on all .SH files (can mix with -f)
1730   -U : undefine symbol:
1731          -U symbol    symbol gets the value 'undef'
1732          -U symbol=   symbol gets completely empty
1733        e.g.:  -Uversiononly
1734   -A : manipulate symbol after the platform specific hints have been applied:
1735          -A append:symbol=value   append value to symbol
1736          -A symbol=value          like append:, but with a separating space
1737          -A define:symbol=value   define symbol to have value
1738          -A clear:symbol          define symbol to be ''
1739          -A define:symbol         define symbol to be 'define'
1740          -A eval:symbol=value     define symbol to be eval of value
1741          -A prepend:symbol=value  prepend value to symbol
1742          -A undef:symbol          define symbol to be 'undef'
1743          -A undef:symbol=         define symbol to be ''
1744        e.g.:  -A prepend:libswanted='cl pthread '
1745               -A ccflags=-DSOME_MACRO
1746   -V : print version number and exit (with a zero status).
1747 EOM
1748         exit 1
1749         ;;
1750 esac
1751
1752 : Sanity checks
1753 case "$fastread$alldone" in
1754 yescont|yesexit) ;;
1755 *)
1756         case "$extractsh" in
1757         true) ;;
1758         *)
1759                 if test ! -t 0; then
1760                         echo "Say 'sh Configure', not 'sh <Configure'"
1761                         exit 1
1762                 fi
1763                 ;;
1764         esac
1765         ;;
1766 esac
1767
1768 exec 4>&1
1769 case "$silent" in
1770 true) exec 1>/dev/null;;
1771 esac
1772
1773 : run the defines and the undefines, if any, but leave the file out there...
1774 touch optdef.sh
1775 . ./optdef.sh
1776 : create the posthint manipulation script and leave the file out there...
1777 touch posthint.sh
1778
1779 : set package name
1780 package='perl5'
1781 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1782 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1783 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1784 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1785 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1786 esac
1787
1788 : Some greps do not return status, grrr.
1789 echo "grimblepritz" >grimble
1790 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1791         contains=contains
1792 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1793         contains=grep
1794 else
1795         contains=contains
1796 fi
1797 rm -f grimble
1798 : the following should work in any shell
1799 case "$contains" in
1800 contains*)
1801         echo " "
1802         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1803         cat >contains <<'EOSS'
1804 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1805 EOSS
1806 chmod +x contains
1807 esac
1808
1809 : Find the path to the source tree
1810 case "$src" in
1811 '') case "$0" in
1812     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1813          case "$src" in
1814          /*)    ;;
1815          .)     ;;
1816          *)     src=`cd ../$src && pwd` ;;
1817          esac
1818          ;;
1819     *)   src='.';;
1820     esac;;
1821 esac
1822 case "$src" in
1823 '')     src=/
1824         rsrc=/
1825         ;;
1826 /*)     rsrc="$src";;
1827 *)      rsrc="../$src";;
1828 esac
1829 if test -f $rsrc/Configure && \
1830         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1831 then
1832    : found it, so we are ok.
1833 else
1834         rsrc=''
1835         for src in . .. ../.. ../../.. ../../../..; do
1836                 if test -f ../$src/Configure && \
1837                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1838                 then
1839                         rsrc=../$src
1840                         break
1841                 fi
1842         done
1843 fi
1844 case "$rsrc" in
1845 '')
1846         cat <<EOM >&4
1847
1848 Sorry, I can't seem to locate the source dir for $package.  Please start
1849 Configure with an explicit path -- i.e. /some/path/Configure.
1850
1851 EOM
1852         exit 1
1853         ;;
1854 ../.)   rsrc='..';;
1855 *)
1856         echo " "
1857         echo "Sources for $package found in \"$src\"." >&4
1858         ;;
1859 esac
1860
1861 : script used to extract .SH files with variable substitutions
1862 cat >extract <<'EOS'
1863 PERL_CONFIG_SH=true
1864 echo "Doing variable substitutions on .SH files..."
1865 if test -f MANIFEST; then
1866         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1867 else
1868         echo "(Looking for .SH files under the source directory.)"
1869         set x `(cd "$src"; find . -name "*.SH" -print)`
1870 fi
1871 shift
1872 case $# in
1873 0) set x `(cd "$src"; echo *.SH)`; shift;;
1874 esac
1875 if test ! -f "$src/$1"; then
1876         shift
1877 fi
1878 mkdir_p='
1879 name=$1;
1880 create="";
1881 while test $name; do
1882         if test ! -d "$name"; then
1883                 create="$name $create";
1884                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1885                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1886         else
1887                 name="";
1888         fi;
1889 done;
1890 for file in $create; do
1891         mkdir $file;
1892 done
1893 '
1894 for file in $*; do
1895         case "$src" in
1896         ".")
1897                 case "$file" in
1898                 */*)
1899                         dir=`expr X$file : 'X\(.*\)/'`
1900                         file=`expr X$file : 'X.*/\(.*\)'`
1901                         (cd "$dir" && . ./$file)
1902                         ;;
1903                 *)
1904                         . ./$file
1905                         ;;
1906                 esac
1907                 ;;
1908         *)
1909                 case "$file" in
1910                 */*)
1911                         dir=`expr X$file : 'X\(.*\)/'`
1912                         file=`expr X$file : 'X.*/\(.*\)'`
1913                         (set x $dir; shift; eval $mkdir_p)
1914                         sh <"$src/$dir/$file"
1915                         ;;
1916                 *)
1917                         sh <"$src/$file"
1918                         ;;
1919                 esac
1920                 ;;
1921         esac
1922 done
1923 if test -f "$src/config_h.SH"; then
1924         if test ! -f config.h; then
1925         : oops, they left it out of MANIFEST, probably, so do it anyway.
1926         . "$src/config_h.SH"
1927         fi
1928 fi
1929 EOS
1930
1931 : extract files and exit if asked to do so
1932 case "$extractsh" in
1933 true)
1934         case "$realsilent" in
1935         true) ;;
1936         *) exec 1>&4;;
1937         esac
1938         case "$config_sh" in
1939         '') config_sh='config.sh';;
1940         esac
1941         echo " "
1942         echo "Fetching answers from $config_sh..."
1943         cd ..
1944         . $config_sh
1945         test "$override" && . ./optdef.sh
1946         echo " "
1947         . UU/extract
1948         rm -rf UU
1949         echo "Extraction done."
1950         exit 0
1951         ;;
1952 esac
1953
1954 : Eunice requires " " instead of "", can you believe it
1955 echo " "
1956 : Here we go...
1957 echo "Beginning of configuration questions for $package."
1958
1959 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1960
1961 : first determine how to suppress newline on echo command
1962 echo " "
1963 echo "Checking echo to see how to suppress newlines..."
1964 (echo "hi there\c" ; echo " ") >.echotmp
1965 if $contains c .echotmp >/dev/null 2>&1 ; then
1966         echo "...using -n."
1967         n='-n'
1968         c=''
1969 else
1970         cat <<'EOM'
1971 ...using \c
1972 EOM
1973         n=''
1974         c='\c'
1975 fi
1976 echo $n "The star should be here-->$c"
1977 echo '*'
1978 rm -f .echotmp
1979
1980 : Now test for existence of everything in MANIFEST
1981 echo " "
1982 if test -f "$rsrc/MANIFEST"; then
1983         echo "First let's make sure your kit is complete.  Checking..." >&4
1984         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1985                 (split -l 50 2>/dev/null || split -50)
1986         rm -f missing
1987         tmppwd=`pwd`
1988         for filelist in x??; do
1989                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1990                         >/dev/null 2>>"$tmppwd/missing")
1991         done
1992         if test -s missing; then
1993                 cat missing >&4
1994                 cat >&4 <<'EOM'
1995
1996 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1997
1998 You have the option of continuing the configuration process, despite the
1999 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2000 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2001 and contact the author (perlbug@perl.org).
2002
2003 EOM
2004                 echo $n "Continue? [n] $c" >&4
2005                 read ans
2006                 case "$ans" in
2007                 y*)
2008                         echo "Continuing..." >&4
2009                         rm -f missing
2010                         ;;
2011                 *)
2012                         echo "ABORTING..." >&4
2013                         kill $$
2014                         ;;
2015                 esac
2016         else
2017                 echo "Looks good..."
2018         fi
2019 else
2020         echo "There is no MANIFEST file.  I hope your kit is complete !"
2021 fi
2022 rm -f missing x??
2023
2024 : Find the appropriate value for a newline for tr
2025 echo " "
2026 if test -n "$DJGPP"; then
2027        trnl='\012'
2028 fi
2029 if test X"$trnl" = X; then
2030         case "`echo foo|tr '\n' x 2>/dev/null`" in
2031         foox) trnl='\n' ;;
2032         esac
2033 fi
2034 if test X"$trnl" = X; then
2035         case "`echo foo|tr '\012' x 2>/dev/null`" in
2036         foox) trnl='\012' ;;
2037         esac
2038 fi
2039 if test X"$trnl" = X; then
2040        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2041        fooxy) trnl='\n\r' ;;
2042        esac
2043 fi
2044 if test X"$trnl" = X; then
2045         cat <<EOM >&2
2046
2047 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2048
2049 EOM
2050         exit 1
2051 fi
2052
2053 : compute the number of columns on the terminal for proper question formatting
2054 case "$COLUMNS" in
2055 '') COLUMNS='80';;
2056 esac
2057
2058 : set up the echo used in my read
2059 myecho="case \"\$xxxm\" in
2060 '') echo $n \"\$rp $c\" >&4;;
2061 *) case \"\$rp\" in
2062         '') echo $n \"[\$xxxm] $c\";;
2063         *)
2064                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2065                         echo \"\$rp\" >&4
2066                         echo $n \"[\$xxxm] $c\" >&4
2067                 else
2068                         echo $n \"\$rp [\$xxxm] $c\" >&4
2069                 fi
2070                 ;;
2071         esac;;
2072 esac"
2073
2074 : now set up to do reads with possible shell escape and default assignment
2075 cat <<EOSC >myread
2076 $startsh
2077 xxxm=\$dflt
2078 $myecho
2079 ans='!'
2080 case "\$fastread" in
2081 yes) case "\$dflt" in
2082         '') ;;
2083         *) ans='';
2084                 case "\$silent-\$rp" in
2085                 true-) ;;
2086                 *) echo " " >&4;;
2087                 esac;;
2088         esac;;
2089 *) case "\$silent" in
2090         true) case "\$rp" in
2091                 '') ans='';;
2092                 esac;;
2093         esac;;
2094 esac
2095 while expr "X\$ans" : "X!" >/dev/null; do
2096         read answ
2097         set x \$xxxm
2098         shift
2099         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2100         case  "\$answ" in
2101         "!")
2102                 sh 1>&4
2103                 echo " "
2104                 $myecho
2105                 ;;
2106         !*)
2107                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2108                 shift
2109                 sh 1>&4 -c "\$*"
2110                 echo " "
2111                 $myecho
2112                 ;;
2113         "\$ans")
2114                 case "\$ans" in
2115                 \\&*)
2116                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2117                         shift
2118                         case "\$1" in
2119                         -d)
2120                                 fastread=yes
2121                                 echo "(OK, I'll run with -d after this question.)" >&4
2122                                 ;;
2123                         -*)
2124                                 echo "*** Sorry, \$1 not supported yet." >&4
2125                                 ;;
2126                         esac
2127                         $myecho
2128                         ans=!
2129                         ;;
2130                 esac;;
2131         *)
2132                 case "\$aok" in
2133                 y)
2134                         echo "*** Substitution done -- please confirm."
2135                         xxxm="\$ans"
2136                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2137                         xxxm="\$ans"
2138                         ans=!
2139                         ;;
2140                 *)
2141                         echo "*** Error -- try again."
2142                         ans=!
2143                         ;;
2144                 esac
2145                 $myecho
2146                 ;;
2147         esac
2148         case "\$ans\$xxxm\$nostick" in
2149         '')
2150                 ans=!
2151                 $myecho
2152                 ;;
2153         esac
2154 done
2155 case "\$ans" in
2156 '') ans="\$xxxm";;
2157 esac
2158 EOSC
2159
2160 : create .config dir to save info across Configure sessions
2161 test -d ../.config || mkdir ../.config
2162 cat >../.config/README <<EOF
2163 This directory created by Configure to save information that should
2164 persist across sessions for $package.
2165
2166 You may safely delete it if you wish.
2167 EOF
2168
2169 : See if we are using a devel version and want that
2170 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2171 case "$usedevel" in
2172 $define|true|[yY]*)
2173     usedevel="$define" ;;
2174 *) case "$xversion" in
2175    *[13579])
2176         cat >&4 <<EOH
2177 *** WHOA THERE!!! ***
2178
2179     This is an UNSTABLE DEVELOPMENT release.
2180     The version of this $package distribution is $xversion, that is, odd,
2181     (as opposed to even) and that signifies a development release.
2182     If you want a maintenance release, you want an even-numbered version.
2183
2184     Do ***NOT*** install this into production use.
2185     Data corruption and crashes are possible.
2186
2187     It is most seriously suggested that you do not continue any further
2188     unless you want to help in developing and debugging Perl.
2189
2190     If you *still* want to build perl, you can answer 'y' now,
2191     or pass -Dusedevel to Configure.
2192
2193 EOH
2194         rp='Do you really want to continue?'
2195         dflt='n'
2196         . ./myread
2197         case "$ans" in
2198         [yY]) echo >&4 "Okay, continuing."
2199               usedevel="$define" ;;
2200         *) echo >&4 "Okay, bye."
2201            exit 1
2202            ;;
2203         esac
2204         ;;
2205     esac
2206     usedevel="$undef"
2207     ;;
2208 esac
2209 case "$usedevel" in
2210 $define|true|[yY]*)
2211         case "$versiononly" in
2212         '') versiononly="$define" ;;
2213         esac
2214         case "$installusrbinperl" in
2215         '') installusrbinperl="$undef" ;;
2216         esac
2217         ;;
2218 esac
2219
2220 : general instructions
2221 needman=true
2222 firsttime=true
2223 user=`(logname) 2>/dev/null`
2224 case "$user" in
2225 '') user=`whoami 2>&1`;;
2226 esac
2227 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2228         firsttime=false
2229         echo " "
2230         rp='Would you like to see the instructions?'
2231         dflt=n
2232         . ./myread
2233         case "$ans" in
2234         [yY]*) ;;
2235         *) needman=false;;
2236         esac
2237 fi
2238 if $needman; then
2239         cat <<EOH
2240
2241 This installation shell script will examine your system and ask you questions
2242 to determine how the perl5 package should be installed. If you get
2243 stuck on a question, you may use a ! shell escape to start a subshell or
2244 execute a command.  Many of the questions will have default answers in square
2245 brackets; typing carriage return will give you the default.
2246
2247 On some of the questions which ask for file or directory names you are allowed
2248 to use the ~name construct to specify the login directory belonging to "name",
2249 even if you don't have a shell which knows about that.  Questions where this is
2250 allowed will be marked "(~name ok)".
2251
2252 EOH
2253         rp=''
2254         dflt='Type carriage return to continue'
2255         . ./myread
2256         cat <<'EOH'
2257
2258 The prompter used in this script allows you to use shell variables and
2259 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2260 in the default answer, as if the default line was a set of arguments given to a
2261 script shell.  This means you may also use $* to repeat the whole default line,
2262 so you do not have to re-type everything to add something to the default.
2263
2264 Every time there is a substitution, you will have to confirm.  If there is an
2265 error (e.g. an unmatched backtick), the default answer will remain unchanged
2266 and you will be prompted again.
2267
2268 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2269 the questions and use the computed defaults (or the previous answers if there
2270 was already a config.sh file). Type 'Configure -h' for a list of options.
2271 You may also start interactively and then answer '& -d' at any prompt to turn
2272 on the non-interactive behaviour for the remainder of the execution.
2273
2274 EOH
2275         . ./myread
2276         cat <<EOH
2277
2278 Much effort has been expended to ensure that this shell script will run on any
2279 Unix system.  If despite that it blows up on yours, your best bet is to edit
2280 Configure and run it again.  If you can't run Configure for some reason,
2281 you'll have to generate a config.sh file by hand.  Whatever problems you
2282 have, let me (perlbug@perl.org) know how I blew it.
2283
2284 This installation script affects things in two ways:
2285
2286 1) it may do direct variable substitutions on some of the files included
2287    in this kit.
2288 2) it builds a config.h file for inclusion in C programs.  You may edit
2289    any of these files as the need arises after running this script.
2290
2291 If you make a mistake on a question, there is no easy way to back up to it
2292 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2293 files.  Configure will offer to let you do this before it runs the SH files.
2294
2295 EOH
2296         dflt='Type carriage return to continue'
2297         . ./myread
2298         case "$firsttime" in
2299         true) echo $user >>../.config/instruct;;
2300         esac
2301 fi
2302
2303 : find out where common programs are
2304 echo " "
2305 echo "Locating common programs..." >&4
2306 cat <<EOSC >loc
2307 $startsh
2308 case \$# in
2309 0) exit 1;;
2310 esac
2311 thing=\$1
2312 shift
2313 dflt=\$1
2314 shift
2315 for dir in \$*; do
2316         case "\$thing" in
2317         .)
2318         if test -d \$dir/\$thing; then
2319                 echo \$dir
2320                 exit 0
2321         fi
2322         ;;
2323         *)
2324         for thisthing in \$dir/\$thing; do
2325                 : just loop through to pick last item
2326         done
2327         if test -f \$thisthing; then
2328                 echo \$thisthing
2329                 exit 0
2330         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2331                 echo \$thisthing
2332                 exit 0
2333         elif test -f \$dir/\$thing.exe; then
2334                 if test -n "$DJGPP"; then
2335                         echo \$dir/\$thing.exe
2336                 elif test "$eunicefix" != ":"; then
2337                         : on Eunice apparently
2338                         echo \$dir/\$thing
2339                 fi
2340                 exit 0
2341         fi
2342         ;;
2343         esac
2344 done
2345 echo \$dflt
2346 exit 1
2347 EOSC
2348 chmod +x loc
2349 $eunicefix loc
2350 loclist="
2351 awk
2352 cat
2353 chmod
2354 comm
2355 cp
2356 echo
2357 expr
2358 grep
2359 ls
2360 mkdir
2361 rm
2362 sed
2363 sort
2364 touch
2365 tr
2366 uniq
2367 "
2368 trylist="
2369 ar
2370 bison
2371 byacc
2372 cpp
2373 csh
2374 date
2375 egrep
2376 gmake
2377 gzip
2378 less
2379 ln
2380 make
2381 more
2382 nm
2383 nroff
2384 perl
2385 pg
2386 test
2387 uname
2388 zip
2389 "
2390 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2391 pth="$pth /lib /usr/lib"
2392 for file in $loclist; do
2393         eval xxx=\$$file
2394         case "$xxx" in
2395         /*|?:[\\/]*)
2396                 if test -f "$xxx"; then
2397                         : ok
2398                 else
2399                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2400                         xxx=`./loc $file $file $pth`
2401                 fi
2402                 ;;
2403         '') xxx=`./loc $file $file $pth`;;
2404         *) xxx=`./loc $xxx $xxx $pth`;;
2405         esac
2406         eval $file=$xxx$_exe
2407         eval _$file=$xxx
2408         case "$xxx" in
2409         /*)
2410                 echo $file is in $xxx.
2411                 ;;
2412         ?:[\\/]*)
2413                 echo $file is in $xxx.
2414                 ;;
2415         *)
2416                 echo "I don't know where '$file' is, and my life depends on it." >&4
2417                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2418                 exit 1
2419                 ;;
2420         esac
2421 done
2422 echo " "
2423 echo "Don't worry if any of the following aren't found..."
2424 say=offhand
2425 for file in $trylist; do
2426         eval xxx=\$$file
2427         case "$xxx" in
2428         /*|?:[\\/]*)
2429                 if test -f "$xxx"; then
2430                         : ok
2431                 else
2432                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2433                         xxx=`./loc $file $file $pth`
2434                 fi
2435                 ;;
2436         '') xxx=`./loc $file $file $pth`;;
2437         *) xxx=`./loc $xxx $xxx $pth`;;
2438         esac
2439         eval $file=$xxx$_exe
2440         eval _$file=$xxx
2441         case "$xxx" in
2442         /*)
2443                 echo $file is in $xxx.
2444                 ;;
2445         ?:[\\/]*)
2446                 echo $file is in $xxx.
2447                 ;;
2448         *)
2449                 echo "I don't see $file out there, $say."
2450                 say=either
2451                 ;;
2452         esac
2453 done
2454 case "$egrep" in
2455 egrep)
2456         echo "Substituting grep for egrep."
2457         egrep=$grep
2458         _egrep=$grep
2459         ;;
2460 esac
2461 case "$less" in
2462 '')     ;;
2463 *)      if $less -R </dev/null >/dev/null; then
2464                echo "Substituting less -R for less."
2465                less="$less -R"
2466                _less=$less
2467         fi
2468         ;;
2469 esac
2470 case "$ln" in
2471 ln)
2472         echo "Substituting cp for ln."
2473         ln=$cp
2474         _ln=$cp
2475         ;;
2476 esac
2477 case "$make" in
2478 make)
2479         case "$gmake" in
2480         gmake)
2481         echo "I can't find make or gmake, and my life depends on it." >&4
2482         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2483         exit 1
2484         ;;
2485         esac
2486         ;;
2487 esac
2488 case "$gmake" in
2489 gmake)  ;;
2490 *)      # We can't have osname yet.
2491         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2492                 # Assume that gmake, if found, is definitely GNU make
2493                 # and prefer it over the system make.
2494                 echo "Substituting gmake for make."
2495                 make=$gmake
2496                 _make=$gmake
2497         fi
2498         ;;
2499 esac
2500 case "$test" in
2501 test)
2502         echo "Hopefully test is built into your sh."
2503         ;;
2504 *)
2505         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2506                 echo "Using the test built into your sh."
2507                 test=test
2508                 _test=test
2509         fi
2510         ;;
2511 esac
2512 case "$echo" in
2513 echo)
2514         echo "Hopefully echo is built into your sh."
2515         ;;
2516 '') ;;
2517 *)
2518         echo " "
2519 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2520         $echo $n "hi there$c" >foo1
2521         echo $n "hi there$c" >foo2
2522         if cmp foo1 foo2 >/dev/null 2>&1; then
2523                 echo "They are compatible.  In fact, they may be identical."
2524         else
2525                 case "$n" in
2526                 '-n') n='' c='\c';;
2527                 *) n='-n' c='';;
2528                 esac
2529                 cat <<FOO
2530 They are not compatible!  You are probably running ksh on a non-USG system.
2531 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2532 have echo built in and we may have to run some Bourne shell scripts.  That
2533 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2534
2535 FOO
2536                 $echo $n "The star should be here-->$c"
2537                 $echo "*"
2538         fi
2539         $rm -f foo1 foo2
2540         ;;
2541 esac
2542
2543 # This question was auctioned at YAPC::Europe-2007 in Vienna
2544 # I never promised you could answer it. I only auctioned the question.
2545 cat <<FOO
2546 The following message is sponsored by
2547
2548   Dresden.pm<--The stars should be here.
2549
2550 Dear Perl user, system administrator or package
2551 maintainer, the Perl community sends greetings to
2552 you. Do you (emblematical) greet back [Y/n]? n
2553
2554 FOO
2555
2556 : Check what type of C compiler we use
2557 cat <<EOS >trygcc
2558 $startsh
2559 EOS
2560 cat <<'EOSC' >>trygcc
2561 case "$cc" in
2562 '') ;;
2563 *)  $rm -f try try.*
2564     $cat >try.c <<EOM
2565 int main(int argc, char *argv[]) {
2566   return 0;
2567 }
2568 EOM
2569     if $cc -o try $ccflags $ldflags try.c; then
2570        :
2571     else
2572         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2573         despair=yes
2574         trygcc=yes
2575         case "$cc" in
2576         *gcc*) trygcc=no ;;
2577         esac
2578         # Skip this test because it gives a false match on output like:
2579         #    ./trygcc: line 23: cc: command not found
2580         # case "`$cc -v -c try.c 2>&1`" in
2581         # *gcc*) trygcc=no ;;
2582         # esac
2583         if $test X"$trygcc" = Xyes; then
2584             if gcc -o try -c try.c; then
2585                 echo " "
2586                 echo "You seem to have a working gcc, though." >&4
2587                 # Switching compilers may undo the work of hints files.
2588                 # The most common problem is -D_REENTRANT for threads.
2589                 # This heuristic catches that case, but gets false positives
2590                 # if -Dusethreads was not actually specified.  Better to
2591                 # bail out here with a useful message than fail 
2592                 # mysteriously later. Should we perhaps just try to
2593                 # re-invoke Configure -Dcc=gcc config_args ?
2594                 if $test -f usethreads.cbu; then
2595                         $cat >&4 <<EOM 
2596
2597 *** However, any setting of the C compiler flags (e.g. for thread support)
2598 *** will be lost.  It may be necessary for you to restart Configure and
2599 *** add -Dcc=gcc to your Configure command line.
2600
2601 EOM
2602                         rp="Would you like to go ahead and try gcc anyway?"
2603                         dflt=n
2604                 else
2605                         rp="Would you like to use it?"
2606                         dflt=y
2607                 fi
2608                 if $test -f myread; then
2609                     . ./myread
2610                 else
2611                     if $test -f UU/myread; then
2612                         . ./UU/myread
2613                     else
2614                         echo "Cannot find myread, sorry.  Aborting." >&2
2615                         exit 1
2616                     fi
2617                 fi  
2618                 case "$ans" in
2619                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2620                 esac
2621             fi
2622         fi
2623     fi
2624     $rm -f try try.*
2625     ;;
2626 esac
2627 EOSC
2628
2629 cat <<EOS >checkcc
2630 $startsh
2631 EOS
2632 cat <<'EOSC' >>checkcc
2633 case "$cc" in        
2634 '') ;;
2635 *)  $rm -f try try.*              
2636     $cat >try.c <<EOM
2637 int main(int argc, char *argv[]) {
2638   return 0;
2639 }
2640 EOM
2641     if $cc -o try $ccflags $ldflags try.c; then
2642        :
2643     else
2644         if $test X"$despair" = Xyes; then
2645            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2646         fi
2647         $cat >&4 <<EOM         
2648 You need to find a working C compiler.
2649 Either (purchase and) install the C compiler supplied by your OS vendor,
2650 or for a free C compiler try http://gcc.gnu.org/
2651 I cannot continue any further, aborting.
2652 EOM
2653         exit 1
2654     fi
2655     $rm -f try try.*
2656     ;;
2657 esac
2658 EOSC
2659
2660 : determine whether symbolic links are supported
2661 echo " "
2662 $touch blurfl
2663 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2664         echo "Symbolic links are supported." >&4
2665         lns="$ln -s"
2666 else
2667         echo "Symbolic links are NOT supported." >&4
2668         lns="$ln"
2669 fi
2670 $rm -f blurfl sym
2671
2672 : determine whether symbolic links are supported
2673 echo " "
2674 case "$lns" in
2675 *"ln"*" -s")
2676         echo "Checking how to test for symbolic links..." >&4
2677         $lns blurfl sym
2678         if $test "X$issymlink" = X; then
2679                 case "$newsh" in
2680                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2681                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2682                 esac
2683                 if test $? = 0; then
2684                         issymlink="test -h"
2685                 else
2686                         echo "Your builtin 'test -h' may be broken." >&4
2687                         case "$test" in
2688                         /*)     ;;
2689                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2690                                 for p in $pth
2691                                 do
2692                                         if test -f "$p/$test"; then
2693                                                 test="$p/$test"
2694                                                 break
2695                                         fi
2696                                 done
2697                                 ;;
2698                         esac
2699                         case "$test" in
2700                         /*)
2701                                 echo "Trying external '$test -h'." >&4
2702                                 issymlink="$test -h"
2703                                 if $test ! -h sym >/dev/null 2>&1; then
2704                                         echo "External '$test -h' is broken, too." >&4
2705                                         issymlink=''
2706                                 fi
2707                                 ;;
2708                         *)      issymlink='' ;;
2709                         esac
2710                 fi
2711         fi
2712         if $test "X$issymlink" = X; then
2713                 if $test -L sym 2>/dev/null; then
2714                         issymlink="$test -L"
2715                         echo "The builtin '$test -L' worked." >&4
2716                 fi
2717         fi
2718         if $test "X$issymlink" != X; then
2719                 echo "You can test for symbolic links with '$issymlink'." >&4
2720         else
2721                 echo "I do not know how you can test for symbolic links." >&4
2722         fi
2723         $rm -f blurfl sym
2724         ;;
2725 *)      echo "No symbolic links, so not testing for their testing..." >&4
2726         ;;
2727 esac
2728 echo " "
2729
2730 : Make symlinks util
2731 case "$mksymlinks" in
2732 $define|true|[yY]*)
2733         case "$src" in
2734         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2735                 exit 1
2736                 ;;
2737         *)      case "$lns:$issymlink" in
2738                 *"ln"*" -s:"*"test -"?)
2739                         echo "Creating the symbolic links..." >&4
2740                         echo "(First creating the subdirectories...)" >&4
2741                         cd ..
2742                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2743                                 read directory
2744                                 test -z "$directory" && break
2745                                 mkdir -p $directory
2746                         done
2747                         # Sanity check 1.
2748                         if test ! -d t/base; then
2749                                 echo "Failed to create the subdirectories.  Aborting." >&4
2750                                 exit 1
2751                         fi
2752                         echo "(Then creating the symlinks...)" >&4
2753                         awk '{print $1}' $src/MANIFEST | while true; do
2754                                 read filename
2755                                 test -z "$filename" && break
2756                                 if test -f $filename; then
2757                                         if $issymlink $filename; then
2758                                                 rm -f $filename
2759                                         fi
2760                                 fi
2761                                 if test -f $filename; then
2762                                         echo "$filename already exists, not symlinking."
2763                                 else
2764                                         ln -s $src/$filename $filename
2765                                 fi
2766                         done
2767                         # Sanity check 2.
2768                         if test ! -f t/base/lex.t; then
2769                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2770                                 exit 1
2771                         fi
2772                         cd UU
2773                         ;;
2774                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2775                         ;;
2776                 esac
2777                 ;;
2778         esac
2779         ;;
2780 esac
2781
2782 : Check for Cross-Compilation
2783 case "$usecrosscompile" in
2784 $define|true|[yY]*)
2785         $echo "Cross-compiling..."
2786         croak=''
2787         case "$cc" in
2788         *-*-gcc) # A cross-compiling gcc, probably.
2789             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2790             ar=$targetarch-ar
2791             # leave out ld, choosing it is more complex
2792             nm=$targetarch-nm
2793             ranlib=$targetarch-ranlib
2794             $echo 'extern int foo;' > try.c
2795             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2796             shift
2797             if $test $# -gt 0; then
2798                 incpth="$incpth $*"
2799                 incpth="`$echo $incpth|$sed 's/^ //'`"
2800                 echo "Guessing incpth '$incpth'." >&4
2801                 for i in $*; do
2802                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2803                     if $test -d $j; then
2804                         libpth="$libpth $j"
2805                     fi
2806                 done   
2807                 libpth="`$echo $libpth|$sed 's/^ //'`"
2808                 echo "Guessing libpth '$libpth'." >&4
2809             fi
2810             $rm -f try.c
2811             ;;
2812         esac
2813         case "$targetarch" in
2814         '') echo "Targetarch not defined." >&4; croak=y ;;
2815         *)  echo "Using targetarch $targetarch." >&4 ;;
2816         esac
2817         case "$incpth" in
2818         '') echo "Incpth not defined." >&4; croak=y ;;
2819         *)  echo "Using incpth '$incpth'." >&4 ;;
2820         esac
2821         case "$libpth" in
2822         '') echo "Libpth not defined." >&4; croak=y ;;
2823         *)  echo "Using libpth '$libpth'." >&4 ;;
2824         esac
2825         case "$usrinc" in
2826         '') for i in $incpth; do
2827                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2828                     usrinc=$i
2829                     echo "Guessing usrinc $usrinc." >&4
2830                     break
2831                 fi
2832             done
2833             case "$usrinc" in
2834             '') echo "Usrinc not defined." >&4; croak=y ;;
2835             esac
2836             ;;
2837         *)  echo "Using usrinc $usrinc." >&4 ;;
2838         esac
2839         case "$targethost" in
2840         '') echo "Targethost not defined." >&4; croak=y ;;
2841         *)  echo "Using targethost $targethost." >&4
2842         esac
2843         locincpth=' '
2844         loclibpth=' '
2845         case "$croak" in
2846         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2847         esac
2848         case "$src" in
2849         /*) run=$src/Cross/run
2850             targetmkdir=$src/Cross/mkdir
2851             to=$src/Cross/to
2852             from=$src/Cross/from
2853             ;;
2854         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2855             run=$pwd/Cross/run
2856             targetmkdir=$pwd/Cross/mkdir
2857             to=$pwd/Cross/to
2858             from=$pwd/Cross/from
2859             ;;
2860         esac
2861         case "$targetrun" in
2862         '') targetrun=ssh ;;
2863         esac
2864         case "$targetto" in
2865         '') targetto=scp ;;
2866         esac
2867         case "$targetfrom" in
2868         '') targetfrom=scp ;;
2869         esac
2870         run=$run-$targetrun
2871         to=$to-$targetto
2872         from=$from-$targetfrom
2873         case "$targetdir" in
2874         '')  targetdir=/tmp
2875              echo "Guessing targetdir $targetdir." >&4
2876              ;;
2877         esac
2878         case "$targetuser" in
2879         '')  targetuser=root
2880              echo "Guessing targetuser $targetuser." >&4
2881              ;;
2882         esac
2883         case "$targetfrom" in
2884         scp)    q=-q ;;
2885         *)      q='' ;;
2886         esac
2887         case "$targetrun" in
2888         ssh|rsh)
2889             cat >$run <<EOF
2890 #!/bin/sh
2891 case "\$1" in
2892 -cwd)
2893   shift
2894   cwd=\$1
2895   shift
2896   ;;
2897 esac
2898 case "\$cwd" in
2899 '') cwd=$targetdir ;;
2900 esac
2901 exe=\$1
2902 shift
2903 if $test ! -f \$exe.xok; then
2904   $to \$exe
2905   $touch \$exe.xok
2906 fi
2907 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2908 EOF
2909             ;;
2910         *)  echo "Unknown targetrun '$targetrun'" >&4
2911             exit 1
2912             ;;
2913         esac
2914         case "$targetmkdir" in
2915         */Cross/mkdir)
2916             cat >$targetmkdir <<EOF
2917 #!/bin/sh
2918 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2919 EOF
2920             $chmod a+rx $targetmkdir
2921             ;;
2922         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2923             exit 1
2924             ;;
2925         esac
2926         case "$targetto" in
2927         scp|rcp)
2928             cat >$to <<EOF
2929 #!/bin/sh
2930 for f in \$@
2931 do
2932   case "\$f" in
2933   /*)
2934     $targetmkdir \`dirname \$f\`
2935     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2936     ;;
2937   *)
2938     $targetmkdir $targetdir/\`dirname \$f\`
2939     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2940     ;;
2941   esac
2942 done
2943 exit 0
2944 EOF
2945             ;;
2946         cp) cat >$to <<EOF
2947 #!/bin/sh
2948 for f in \$@
2949 do
2950   case "\$f" in
2951   /*)
2952     $mkdir -p $targetdir/\`dirname \$f\`
2953     $cp \$f $targetdir/\$f || exit 1
2954     ;;
2955   *)
2956     $targetmkdir $targetdir/\`dirname \$f\`
2957     $cp \$f $targetdir/\$f || exit 1
2958     ;;
2959   esac
2960 done
2961 exit 0
2962 EOF
2963             ;;
2964         *)  echo "Unknown targetto '$targetto'" >&4
2965             exit 1
2966             ;;
2967         esac
2968         case "$targetfrom" in
2969         scp|rcp)
2970           cat >$from <<EOF
2971 #!/bin/sh
2972 for f in \$@
2973 do
2974   $rm -f \$f
2975   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2976 done
2977 exit 0
2978 EOF
2979             ;;
2980         cp) cat >$from <<EOF
2981 #!/bin/sh
2982 for f in \$@
2983 do
2984   $rm -f \$f
2985   cp $targetdir/\$f . || exit 1
2986 done
2987 exit 0
2988 EOF
2989             ;;
2990         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2991             exit 1
2992             ;;
2993         esac
2994         if $test ! -f $run; then
2995             echo "Target 'run' script '$run' not found." >&4
2996         else
2997             $chmod a+rx $run
2998         fi
2999         if $test ! -f $to; then
3000             echo "Target 'to' script '$to' not found." >&4
3001         else
3002             $chmod a+rx $to
3003         fi
3004         if $test ! -f $from; then
3005             echo "Target 'from' script '$from' not found." >&4
3006         else
3007             $chmod a+rx $from
3008         fi
3009         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3010             exit 1
3011         fi
3012         cat >&4 <<EOF
3013 Using '$run' for remote execution,
3014 and '$from' and '$to'
3015 for remote file transfer.
3016 EOF
3017         ;;
3018 *)      run=''
3019         to=:
3020         from=:
3021         usecrosscompile='undef'
3022         targetarch=''
3023         ;;
3024 esac
3025
3026 : see whether [:lower:] and [:upper:] are supported character classes
3027 echo " "
3028 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3029 ABYZ)
3030         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3031         up='[:upper:]'
3032         low='[:lower:]'
3033         ;;
3034 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3035         # (0xd9 and 0xe2), therefore that is a nice testing point.
3036         if test "X$up" = X -o "X$low" = X; then
3037             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3038             rs) up='[A-Z]'
3039                 low='[a-z]'
3040                 ;;
3041             esac
3042         fi
3043         if test "X$up" = X -o "X$low" = X; then
3044             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3045             rs) up='A-Z'
3046                 low='a-z'
3047                 ;;
3048             esac
3049         fi
3050         if test "X$up" = X -o "X$low" = X; then
3051             case "`echo RS | od -x 2>/dev/null`" in
3052             *D9E2*|*d9e2*)
3053                 echo "Hey, this might be EBCDIC." >&4
3054                 if test "X$up" = X -o "X$low" = X; then
3055                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3056                     rs) up='[A-IJ-RS-Z]'
3057                         low='[a-ij-rs-z]'
3058                         ;;
3059                     esac
3060                 fi
3061                 if test "X$up" = X -o "X$low" = X; then
3062                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3063                     rs) up='A-IJ-RS-Z'
3064                         low='a-ij-rs-z'
3065                         ;;
3066                     esac
3067                 fi
3068                 ;;
3069             esac
3070         fi
3071 esac
3072 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3073 rs)
3074     echo "Using $up and $low to convert case." >&4
3075     ;;
3076 *)
3077     echo "I don't know how to translate letters from upper to lower case." >&4
3078     echo "Your tr is not acting any way I know of." >&4
3079     exit 1
3080     ;;
3081 esac
3082 : set up the translation script tr, must be called with ./tr of course
3083 cat >tr <<EOSC
3084 $startsh
3085 case "\$1\$2" in
3086 '[A-Z][a-z]') exec $tr '$up' '$low';;
3087 '[a-z][A-Z]') exec $tr '$low' '$up';;
3088 esac
3089 exec $tr "\$@"
3090 EOSC
3091 chmod +x tr
3092 $eunicefix tr
3093
3094 : Try to determine whether config.sh was made on this system
3095 case "$config_sh" in
3096 '')
3097 myuname=`$uname -a 2>/dev/null`
3098 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3099 # Downcase everything to avoid ambiguity.
3100 # Remove slashes and single quotes so we can use parts of this in
3101 # directory and file names.
3102 # Remove newlines so myuname is sane to use elsewhere.
3103 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3104 # because the A-Z/a-z are not consecutive.
3105 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3106         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3107 newmyuname="$myuname"
3108 dflt=n
3109 case "$knowitall" in
3110 '')
3111         if test -f ../config.sh; then
3112                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3113                         eval "`grep myuname= ../config.sh`"
3114                 fi
3115                 if test "X$myuname" = "X$newmyuname"; then
3116                         dflt=y
3117                 fi
3118         fi
3119         ;;
3120 *) dflt=y;;
3121 esac
3122
3123 : Get old answers from old config file if Configure was run on the
3124 : same system, otherwise use the hints.
3125 hint=default
3126 cd ..
3127 if test -f config.sh; then
3128         echo " "
3129         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3130         . UU/myread
3131         case "$ans" in
3132         n*|N*) echo "OK, I'll ignore it."
3133                 mv config.sh config.sh.old
3134                 myuname="$newmyuname"
3135                 ;;
3136         *)  echo "Fetching default answers from your old config.sh file..." >&4
3137                 tmp_n="$n"
3138                 tmp_c="$c"
3139                 tmp_sh="$sh"
3140                 . ./config.sh
3141                 cp config.sh UU
3142                 n="$tmp_n"
3143                 c="$tmp_c"
3144                 : Older versions did not always set $sh.  Catch re-use of such
3145                 : an old config.sh.
3146                 case "$sh" in
3147                 '') sh="$tmp_sh" ;;
3148                 esac
3149                 hint=previous
3150                 ;;
3151         esac
3152 fi
3153 . ./UU/checkcc
3154 if test ! -f config.sh; then
3155         $cat <<EOM
3156
3157 First time through, eh?  I have some defaults handy for some systems
3158 that need some extra help getting the Configure answers right:
3159
3160 EOM
3161         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3162         dflt=''
3163         : Half the following guesses are probably wrong... If you have better
3164         : tests or hints, please send them to perlbug@perl.org
3165         : The metaconfig authors would also appreciate a copy...
3166         $test -f /irix && osname=irix
3167         $test -f /xenix && osname=sco_xenix
3168         $test -f /dynix && osname=dynix
3169         $test -f /dnix && osname=dnix
3170         $test -f /lynx.os && osname=lynxos
3171         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3172         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3173         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3174         $test -f /bin/mips && /bin/mips && osname=mips
3175         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3176                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3177         $test -d /usr/apollo/bin && osname=apollo
3178         $test -f /etc/saf/_sactab && osname=svr4
3179         $test -d /usr/include/minix && osname=minix
3180         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3181         if $test -d /MachTen -o -d /MachTen_Folder; then
3182                 osname=machten
3183                 if $test -x /sbin/version; then
3184                         osvers=`/sbin/version | $awk '{print $2}' |
3185                         $sed -e 's/[A-Za-z]$//'`
3186                 elif $test -x /usr/etc/version; then
3187                         osvers=`/usr/etc/version | $awk '{print $2}' |
3188                         $sed -e 's/[A-Za-z]$//'`
3189                 else
3190                         osvers="$2.$3"
3191                 fi
3192         fi
3193
3194         $test -f /sys/posix.dll &&
3195                 $test -f /usr/bin/what &&
3196                 set X `/usr/bin/what /sys/posix.dll` &&
3197                 $test "$3" = UWIN &&
3198                 osname=uwin &&
3199                 osvers="$5"
3200
3201         if $test -f $uname; then
3202                 set X $myuname
3203                 shift
3204
3205                 case "$5" in
3206                 fps*) osname=fps ;;
3207                 mips*)
3208                         case "$4" in
3209                         umips) osname=umips ;;
3210                         *) osname=mips ;;
3211                         esac;;
3212                 [23]100) osname=mips ;;
3213                 next*) osname=next ;;
3214                 i386*)
3215                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3216                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3217                                 osname='sco'
3218                                 osvers=$tmp
3219                         elif $test -f /etc/kconfig; then
3220                                 osname=isc
3221                                 if test "$lns" = "$ln -s"; then
3222                                         osvers=4
3223                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3224                                         osvers=3
3225                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3226                                         osvers=2
3227                                 fi
3228                         fi
3229                         tmp=''
3230                         ;;
3231                 pc*)
3232                         if test -n "$DJGPP"; then
3233                                 osname=dos
3234                                 osvers=djgpp
3235                         fi
3236                         ;;
3237                 esac
3238
3239                 case "$1" in
3240                 aix) osname=aix
3241                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3242                         case "$tmp" in
3243                         # oslevel can fail with:
3244                         # oslevel: Unable to acquire lock.
3245                         *not\ found) osvers="$4"."$3" ;;
3246                         '<3240'|'<>3240') osvers=3.2.0 ;;
3247                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3248                         '=3250'|'>3250') osvers=3.2.5 ;;
3249                         *) osvers=$tmp;;
3250                         esac
3251                         ;;
3252                 bitrig) osname=bitrig
3253                         osvers="$3"
3254                         ;;
3255                 bsd386) osname=bsd386
3256                         osvers=`$uname -r`
3257                         ;;
3258                 cygwin*) osname=cygwin
3259                         osvers="$3"
3260                         ;;
3261                 *dc.osx) osname=dcosx
3262                         osvers="$3"
3263                         ;;
3264                 dnix) osname=dnix
3265                         osvers="$3"
3266                         ;;
3267                 domainos) osname=apollo
3268                         osvers="$3"
3269                         ;;
3270                 dgux)   osname=dgux
3271                         osvers="$3"
3272                         ;;
3273                 dragonfly) osname=dragonfly
3274                         osvers="$3"
3275                         ;;
3276                 dynixptx*) osname=dynixptx
3277                         osvers=`echo "$4"|sed 's/^v//'`
3278                         ;;
3279                 freebsd) osname=freebsd
3280                         osvers="$3" ;;
3281                 genix)  osname=genix ;;
3282                 gnu)    osname=gnu
3283                         osvers="$3" ;;
3284                 hp*)    osname=hpux
3285                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3286                         ;;
3287                 irix*)  osname=irix
3288                         case "$3" in
3289                         4*) osvers=4 ;;
3290                         5*) osvers=5 ;;
3291                         *)      osvers="$3" ;;
3292                         esac
3293                         ;;
3294                 linux)  osname=linux
3295                         case "$3" in
3296                         *)      osvers="$3" ;;
3297                         esac
3298                         ;;
3299                 MiNT)   osname=mint
3300                         ;;
3301                 netbsd*) osname=netbsd
3302                         osvers="$3"
3303                         ;;
3304                 news-os) osvers="$3"
3305                         case "$3" in
3306                         4*) osname=newsos4 ;;
3307                         *) osname=newsos ;;
3308                         esac
3309                         ;;
3310                 next*) osname=next ;;
3311                 nonstop-ux) osname=nonstopux ;;
3312                 openbsd) osname=openbsd
3313                         osvers="$3"
3314                         ;;
3315                 os2)    osname=os2
3316                         osvers="$4"
3317                         ;;
3318                 POSIX-BC | posix-bc ) osname=posix-bc
3319                         osvers="$3"
3320                         ;;
3321                 powerux | power_ux | powermax_os | powermaxos | \
3322                 powerunix | power_unix) osname=powerux
3323                         osvers="$3"
3324                         ;;
3325                 qnx) osname=qnx
3326                         osvers="$4"
3327                         ;;
3328                 solaris) osname=solaris
3329                         case "$3" in
3330                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3331                         *)      osvers="$3" ;;
3332                         esac
3333                         ;;
3334                 sunos) osname=sunos
3335                         case "$3" in
3336                         5*) osname=solaris
3337                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3338                         *)      osvers="$3" ;;
3339                         esac
3340                         ;;
3341                 titanos) osname=titanos
3342                         case "$3" in
3343                         1*) osvers=1 ;;
3344                         2*) osvers=2 ;;
3345                         3*) osvers=3 ;;
3346                         4*) osvers=4 ;;
3347                         *)      osvers="$3" ;;
3348                         esac
3349                         ;;
3350                 ultrix) osname=ultrix
3351                         osvers="$3"
3352                         ;;
3353                 osf1|mls+)      case "$5" in
3354                                 alpha)
3355                                         osname=dec_osf
3356                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3357                                         case "$osvers" in
3358                                         [1-9].[0-9]*) ;;
3359                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3360                                         esac
3361                                         ;;
3362                         hp*)    osname=hp_osf1  ;;
3363                         mips)   osname=mips_osf1 ;;
3364                         esac
3365                         ;;
3366                 # UnixWare 7.1.2 is known as Open UNIX 8
3367                 openunix|unixware) osname=svr5
3368                         osvers="$4"
3369                         ;;
3370                 uts)    osname=uts
3371                         osvers="$3"
3372                         ;;
3373                 vos) osvers="$3"
3374                         ;;
3375                 $2) case "$osname" in
3376                         *isc*) ;;
3377                         *freebsd*) ;;
3378                         svr*)
3379                                 : svr4.x or possibly later
3380                                 case "svr$3" in
3381                                 ${osname}*)
3382                                         osname=svr$3
3383                                         osvers=$4
3384                                         ;;
3385                                 esac
3386                                 case "$osname" in
3387                                 svr4.0)
3388                                         : Check for ESIX
3389                                         if test -f /stand/boot ; then
3390                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3391                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3392                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3393                                                         if test -n "$isesix"; then
3394                                                                 osname=esix4
3395                                                         fi
3396                                                 fi
3397                                         fi
3398                                         ;;
3399                                 esac
3400                                 ;;
3401                         *)      if test -f /etc/systemid; then
3402                                         osname=sco
3403                                         set `echo $3 | $sed 's/\./ /g'` $4
3404                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3405                                                 osvers=$1.$2.$3
3406                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3407                                                 osvers=$1.$2
3408                                         elif $test -f $src/hints/sco_$1.sh; then
3409                                                 osvers=$1
3410                                         fi
3411                                 else
3412                                         case "$osname" in
3413                                         '') : Still unknown.  Probably a generic Sys V.
3414                                                 osname="sysv"
3415                                                 osvers="$3"
3416                                                 ;;
3417                                         esac
3418                                 fi
3419                                 ;;
3420                         esac
3421                         ;;
3422                 *)      case "$osname" in
3423                         '') : Still unknown.  Probably a generic BSD.
3424                                 osname="$1"
3425                                 osvers="$3"
3426                                 ;;
3427                         esac
3428                         ;;
3429                 esac
3430         else
3431                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3432                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3433                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3434                                 osname=news_os
3435                         fi
3436                         $rm -f UU/kernel.what
3437                 elif test -d c:/. -o -n "$is_os2" ; then
3438                         set X $myuname
3439                         osname=os2
3440                         osvers="$5"
3441                 fi
3442         fi
3443
3444         case "$targetarch" in
3445         '') ;;
3446         *)  hostarch=$osname
3447             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3448             osvers=''
3449             ;;
3450         esac
3451
3452         : Now look for a hint file osname_osvers, unless one has been
3453         : specified already.
3454         case "$hintfile" in
3455         ''|' ')
3456                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3457                 : Also try without trailing minor version numbers.
3458                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3459                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3460                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3461                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3462                 case "$file" in
3463                 '') dflt=none ;;
3464                 *)  case "$osvers" in
3465                         '') dflt=$file
3466                                 ;;
3467                         *)  if $test -f $src/hints/$file.sh ; then
3468                                         dflt=$file
3469                                 elif $test -f $src/hints/$xfile.sh ; then
3470                                         dflt=$xfile
3471                                 elif $test -f $src/hints/$xxfile.sh ; then
3472                                         dflt=$xxfile
3473                                 elif $test -f $src/hints/$xxxfile.sh ; then
3474                                         dflt=$xxxfile
3475                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3476                                         dflt=$xxxxfile
3477                                 elif $test -f "$src/hints/${osname}.sh" ; then
3478                                         dflt="${osname}"
3479                                 else
3480                                         dflt=none
3481                                 fi
3482                                 ;;
3483                         esac
3484                         ;;
3485                 esac
3486                 if $test -f Policy.sh ; then
3487                         case "$dflt" in
3488                         *Policy*) ;;
3489                         none) dflt="Policy" ;;
3490                         *) dflt="Policy $dflt" ;;
3491                         esac
3492                 fi
3493                 ;;
3494         *)
3495                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3496                 ;;
3497         esac
3498
3499         if $test -f Policy.sh ; then
3500                 $cat <<EOM
3501
3502 There's also a Policy hint file available, which should make the
3503 site-specific (policy) questions easier to answer.
3504 EOM
3505
3506         fi
3507
3508         $cat <<EOM
3509
3510 You may give one or more space-separated answers, or "none" if appropriate.
3511 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3512 previous run of Configure, you may specify it as well as or instead of
3513 OS-specific hints.  If hints are provided for your OS, you should use them:
3514 although Perl can probably be built without hints on many platforms, using
3515 hints often improve performance and may enable features that Configure can't
3516 set up on its own. If there are no hints that match your OS, specify "none";
3517 DO NOT give a wrong version or a wrong OS.
3518
3519 EOM
3520
3521         rp="Which of these apply, if any?"
3522         . UU/myread
3523         tans=$ans
3524         for file in $tans; do
3525                 if $test X$file = XPolicy -a -f Policy.sh; then
3526                         . Policy.sh
3527                         $cat Policy.sh >> UU/config.sh
3528                 elif $test -f $src/hints/$file.sh; then
3529                         . $src/hints/$file.sh
3530                         $cat $src/hints/$file.sh >> UU/config.sh
3531                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3532                         : nothing
3533                 else
3534                         : Give one chance to correct a possible typo.
3535                         echo "$file.sh does not exist"
3536                         dflt=$file
3537                         rp="hint to use instead?"
3538                         . UU/myread
3539                         for file in $ans; do
3540                                 if $test -f "$src/hints/$file.sh"; then
3541                                         . $src/hints/$file.sh
3542                                         $cat $src/hints/$file.sh >> UU/config.sh
3543                                 elif $test X$ans = X -o X$ans = Xnone ; then
3544                                         : nothing
3545                                 else
3546                                         echo "$file.sh does not exist -- ignored."
3547                                 fi
3548                         done
3549                 fi
3550         done
3551
3552         hint=recommended
3553         : Remember our hint file for later.
3554         if $test -f "$src/hints/$file.sh" ; then
3555                 hintfile="$file"
3556         else
3557                 hintfile=''
3558         fi
3559 fi
3560 cd UU
3561 ;;
3562 *)
3563         echo " "
3564         echo "Fetching default answers from $config_sh..." >&4
3565         tmp_n="$n"
3566         tmp_c="$c"
3567         cd ..
3568         cp $config_sh config.sh 2>/dev/null
3569         chmod +w config.sh
3570         . ./config.sh
3571         cd UU
3572         cp ../config.sh .
3573         n="$tmp_n"
3574         c="$tmp_c"
3575         hint=previous
3576         ;;
3577 esac
3578 test "$override" && . ./optdef.sh
3579
3580 : Restore computed paths
3581 for file in $loclist $trylist; do
3582         eval $file="\$_$file"
3583 done
3584
3585 cat << EOM
3586
3587 Configure uses the operating system name and version to set some defaults.
3588 The default value is probably right if the name rings a bell. Otherwise,
3589 since spelling matters for me, either accept the default or answer "none"
3590 to leave it blank.
3591
3592 EOM
3593 case "$osname" in
3594         ''|' ')
3595                 case "$hintfile" in
3596                 ''|' '|none) dflt=none ;;
3597                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3598                 esac
3599                 ;;
3600         *) dflt="$osname" ;;
3601 esac
3602 rp="Operating system name?"
3603 . ./myread
3604 case "$ans" in
3605 none)  osname='' ;;
3606 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3607 esac
3608 echo " "
3609 case "$osvers" in
3610         ''|' ')
3611                 case "$hintfile" in
3612                 ''|' '|none) dflt=none ;;
3613                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3614                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3615                         case "$dflt" in
3616                         ''|' ') dflt=none ;;
3617                         esac
3618                         ;;
3619                 esac
3620                 ;;
3621         *) dflt="$osvers" ;;
3622 esac
3623 rp="Operating system version?"
3624 . ./myread
3625 case "$ans" in
3626 none)  osvers='' ;;
3627 *) osvers="$ans" ;;
3628 esac
3629
3630
3631 . ./posthint.sh
3632
3633 : who configured the system
3634 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3635 case "$cf_by" in
3636 "")
3637         cf_by=`(logname) 2>/dev/null`
3638         case "$cf_by" in
3639         "")
3640                 cf_by=`(whoami) 2>/dev/null`
3641                 case "$cf_by" in
3642                 "") cf_by=unknown ;;
3643                 esac ;;
3644         esac ;;
3645 esac
3646
3647 : decide how portable to be.  Allow command line overrides.
3648 case "$d_portable" in
3649 "$undef") ;;
3650 *)      d_portable="$define" ;;
3651 esac
3652
3653 : set up shell script to do ~ expansion
3654 cat >filexp <<EOSS
3655 $startsh
3656 : expand filename
3657 case "\$1" in
3658  \~/*|\~)
3659         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3660         ;;
3661  \~*)
3662         if $test -f /bin/csh; then
3663                 /bin/csh -f -c "glob \$1"
3664                 failed=\$?
3665                 echo ""
3666                 exit \$failed
3667         else
3668                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3669                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3670                 if $test ! -d "\$dir"; then
3671                         me=\`basename \$0\`
3672                         echo "\$me: can't locate home directory for: \$name" >&2
3673                         exit 1
3674                 fi
3675                 case "\$1" in
3676                 */*)
3677                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3678                         ;;
3679                 *)
3680                         echo \$dir
3681                         ;;
3682                 esac
3683         fi
3684         ;;
3685 *)
3686         echo \$1
3687         ;;
3688 esac
3689 EOSS
3690 chmod +x filexp
3691 $eunicefix filexp
3692
3693 : now set up to get a file name
3694 cat <<EOS >getfile
3695 $startsh
3696 EOS
3697 cat <<'EOSC' >>getfile
3698 tilde=''
3699 fullpath=''
3700 already=''
3701 skip=''
3702 none_ok=''
3703 exp_file=''
3704 nopath_ok=''
3705 orig_rp="$rp"
3706 orig_dflt="$dflt"
3707 case "$gfpth" in
3708 '') gfpth='.' ;;
3709 esac
3710
3711 case "$fn" in
3712 *\(*)
3713         : getfile will accept an answer from the comma-separated list
3714         : enclosed in parentheses even if it does not meet other criteria.
3715         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3716         fn=`echo $fn | sed 's/(.*)//'`
3717         ;;
3718 esac
3719
3720 case "$fn" in
3721 *:*)
3722         loc_file=`expr $fn : '.*:\(.*\)'`
3723         fn=`expr $fn : '\(.*\):.*'`
3724         ;;
3725 esac
3726
3727 case "$fn" in
3728 *~*) tilde=true;;
3729 esac
3730 case "$fn" in
3731 */*) fullpath=true;;
3732 esac
3733 case "$fn" in
3734 *+*) skip=true;;
3735 esac
3736 case "$fn" in
3737 *n*) none_ok=true;;
3738 esac
3739 case "$fn" in
3740 *e*) exp_file=true;;
3741 esac
3742 case "$fn" in
3743 *p*) nopath_ok=true;;
3744 esac
3745
3746 case "$fn" in
3747 *f*) type='File';;
3748 *d*) type='Directory';;
3749 *l*) type='Locate';;
3750 esac
3751
3752 what="$type"
3753 case "$what" in
3754 Locate) what='File';;
3755 esac
3756
3757 case "$exp_file" in
3758 '')
3759         case "$d_portable" in
3760         "$define") ;;
3761         *) exp_file=true;;
3762         esac
3763         ;;
3764 esac
3765
3766 cd ..
3767 while test "$type"; do
3768         redo=''
3769         rp="$orig_rp"
3770         dflt="$orig_dflt"
3771         case "$tilde" in
3772         true) rp="$rp (~name ok)";;
3773         esac
3774         . UU/myread
3775         if test -f UU/getfile.ok && \
3776                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3777         then
3778                 value="$ans"
3779                 ansexp="$ans"
3780                 break
3781         fi
3782         case "$ans" in
3783         none)
3784                 value=''
3785                 ansexp=''
3786                 case "$none_ok" in
3787                 true) type='';;
3788                 esac
3789                 ;;
3790         *)
3791                 case "$tilde" in
3792                 '') value="$ans"
3793                         ansexp="$ans";;
3794                 *)
3795                         value=`UU/filexp $ans`
3796                         case $? in
3797                         0)
3798                                 if test "$ans" != "$value"; then
3799                                         echo "(That expands to $value on this system.)"
3800                                 fi
3801                                 ;;
3802                         *) value="$ans";;
3803                         esac
3804                         ansexp="$value"
3805                         case "$exp_file" in
3806                         '') value="$ans";;
3807                         esac
3808                         ;;
3809                 esac
3810                 case "$fullpath" in
3811                 true)
3812                         case "$ansexp" in
3813                         /*) value="$ansexp" ;;
3814                         [a-zA-Z]:/*) value="$ansexp" ;;
3815                         *)
3816                                 redo=true
3817                                 case "$already" in
3818                                 true)
3819                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3820                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3821                                         ;;
3822                                 *)
3823                                 echo "Please give a full path name, starting with slash." >&4
3824                                         case "$tilde" in
3825                                         true)
3826                                 echo "Note that using ~name is ok provided it expands well." >&4
3827                                                 already=true
3828                                                 ;;
3829                                         esac
3830                                 esac
3831                                 ;;
3832                         esac
3833                         ;;
3834                 esac
3835                 case "$redo" in
3836                 '')
3837                         case "$type" in
3838                         File)
3839                                 for fp in $gfpth; do
3840                                         if test "X$fp" = X.; then
3841                                             pf="$ansexp"
3842                                         else    
3843                                             pf="$fp/$ansexp"
3844                                         fi
3845                                         if test -f "$pf"; then
3846                                                 type=''
3847                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3848                                         then
3849                                                 echo "($value is not a plain file, but that's ok.)"
3850                                                 type=''
3851                                         fi
3852                                         if test X"$type" = X; then
3853                                             value="$pf"
3854                                             break
3855                                         fi
3856                                 done
3857                                 ;;
3858                         Directory)
3859                                 for fp in $gfpth; do
3860                                         if test "X$fp" = X.; then
3861                                             dir="$ans"
3862                                             direxp="$ansexp"
3863                                         else    
3864                                             dir="$fp/$ansexp"
3865                                             direxp="$fp/$ansexp"
3866                                         fi
3867                                         if test -d "$direxp"; then
3868                                                 type=''
3869                                                 value="$dir"
3870                                                 break
3871                                         fi
3872                                 done
3873                                 ;;
3874                         Locate)
3875                                 if test -d "$ansexp"; then
3876                                         echo "(Looking for $loc_file in directory $value.)"
3877                                         value="$value/$loc_file"
3878                                         ansexp="$ansexp/$loc_file"
3879                                 fi
3880                                 if test -f "$ansexp"; then
3881                                         type=''
3882                                 fi
3883                                 case "$nopath_ok" in
3884                                 true)   case "$value" in
3885                                         */*) ;;
3886                                         *)      echo "Assuming $value will be in people's path."
3887                                                 type=''
3888                                                 ;;
3889                                         esac
3890                                         ;;
3891                                 esac
3892                                 ;;
3893                         esac
3894
3895                         case "$skip" in
3896                         true) type='';
3897                         esac
3898
3899                         case "$type" in
3900                         '') ;;
3901                         *)
3902                                 if test "$fastread" = yes; then
3903                                         dflt=y
3904                                 else
3905                                         dflt=n
3906                                 fi
3907                                 rp="$what $value doesn't exist.  Use that name anyway?"
3908                                 . UU/myread
3909                                 dflt=''
3910                                 case "$ans" in
3911                                 y*) type='';;
3912                                 *) echo " ";;
3913                                 esac
3914                                 ;;
3915                         esac
3916                         ;;
3917                 esac
3918                 ;;
3919         esac
3920 done
3921 cd UU
3922 ans="$value"
3923 rp="$orig_rp"
3924 dflt="$orig_dflt"
3925 rm -f getfile.ok
3926 test "X$gfpthkeep" != Xy && gfpth=""
3927 EOSC
3928
3929 : determine root of directory hierarchy where package will be installed.
3930 case "$prefix" in
3931 '')
3932         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3933         ;;
3934 *?/)
3935         dflt=`echo "$prefix" | sed 's/.$//'`
3936         ;;
3937 *)
3938         dflt="$prefix"
3939         ;;
3940 esac
3941 $cat <<EOM
3942
3943 By default, $package will be installed in $dflt/bin, manual pages
3944 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3945 installation directories. Typically this is something like /usr/local.
3946 If you wish to have binaries under /usr/bin but other parts of the
3947 installation under /usr/local, that's ok: you will be prompted
3948 separately for each of the installation directories, the prefix being
3949 only used to set the defaults.
3950
3951 EOM
3952 fn=d~
3953 rp='Installation prefix to use?'
3954 . ./getfile
3955 oldprefix=''
3956 case "$prefix" in
3957 '') ;;
3958 *)
3959         case "$ans" in
3960         "$prefix") ;;
3961         *) oldprefix="$prefix";;
3962         esac
3963         ;;
3964 esac
3965 prefix="$ans"
3966 prefixexp="$ansexp"
3967
3968 : allow them to override the AFS root
3969 case "$afsroot" in
3970 '')     afsroot=/afs ;;
3971 *)      afsroot=$afsroot ;;
3972 esac
3973
3974 : is AFS running?
3975 echo " "
3976 case "$afs" in
3977 $define|true)   afs=true ;;
3978 $undef|false)   afs=false ;;
3979 *)      if $test -d $afsroot; then
3980                 afs=true
3981         else
3982                 afs=false
3983         fi
3984         ;;
3985 esac
3986 if $afs; then
3987         echo "AFS may be running... I'll be extra cautious then..." >&4
3988 else
3989         echo "AFS does not seem to be running..." >&4
3990 fi
3991
3992 : determine installation prefix for where package is to be installed.
3993 if $afs; then
3994 $cat <<EOM
3995
3996 Since you are running AFS, I need to distinguish the directory in which
3997 files will reside from the directory in which they are installed (and from
3998 which they are presumably copied to the former directory by occult means).
3999
4000 EOM
4001         case "$installprefix" in
4002         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4003         *) dflt="$installprefix";;
4004         esac
4005 else
4006 $cat <<EOM
4007
4008 In some special cases, particularly when building $package for distribution,
4009 it is convenient to distinguish the directory in which files should be
4010 installed from the directory ($prefix) in which they will
4011 eventually reside.  For most users, these two directories are the same.
4012
4013 EOM
4014         case "$installprefix" in
4015         '') dflt=$prefix ;;
4016         *) dflt=$installprefix;;
4017         esac
4018 fi
4019 fn=d~
4020 rp='What installation prefix should I use for installing files?'
4021 . ./getfile
4022 installprefix="$ans"
4023 installprefixexp="$ansexp"
4024
4025 : Perform the prefixexp/installprefixexp correction if necessary
4026 cat <<EOS >installprefix
4027 $startsh
4028 EOS
4029 cat <<'EOSC' >>installprefix
4030 : Change installation prefix, if necessary.
4031 if $test X"$prefix" != X"$installprefix"; then
4032     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4033 else
4034     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4035 fi
4036 EOSC
4037 chmod +x installprefix
4038 $eunicefix installprefix
4039
4040 : Set variables such as privlib and privlibexp from the output of ./getfile
4041 : performing the prefixexp/installprefixexp correction if necessary.
4042 cat <<EOS >setprefixvar
4043 $startsh
4044 EOS
4045 cat <<'EOSC' >>setprefixvar
4046 eval "${prefixvar}=\"\$ans\""
4047 eval "${prefixvar}exp=\"\$ansexp\""
4048 . ./installprefix
4049 EOSC
4050 chmod +x setprefixvar
4051 $eunicefix setprefixvar
4052
4053 : set up the script used to warn in case of inconsistency
4054 cat <<EOS >whoa
4055 $startsh
4056 EOS
4057 cat <<'EOSC' >>whoa
4058 dflt=y
4059 case "$hint" in
4060     recommended)
4061         case "$hintfile" in
4062         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4063                 ;;
4064         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4065                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4066                 ;;
4067         esac
4068         ;;
4069     *)  echo " "
4070         echo "*** WHOA THERE!!! ***" >&4
4071         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4072         ;;
4073 esac
4074 rp="    Keep the $hint value?"
4075 . ./myread
4076 case "$ans" in
4077 y) td=$was; tu=$was;;
4078 esac
4079 EOSC
4080
4081 : function used to set '$1' to '$val'
4082 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4083 case "$val$was" in
4084 $define$undef) . ./whoa; eval "$var=\$td";;
4085 $undef$define) . ./whoa; eval "$var=\$tu";;
4086 *) eval "$var=$val";;
4087 esac'
4088
4089 : get the patchlevel
4090 echo " "
4091 echo "Getting the current patchlevel..." >&4
4092 if $test -r $rsrc/patchlevel.h;then
4093         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4094         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4095         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4096         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4097         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4098         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4099         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4100 else
4101         revision=0
4102         patchlevel=0
4103         subversion=0
4104         api_revision=0
4105         api_version=0
4106         api_subversion=0
4107         perl_patchlevel=0
4108         $echo "(You do not have patchlevel.h.  Eek.)"
4109 fi
4110 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4111 version_patchlevel_string="version $patchlevel subversion $subversion"
4112 case "$perl_patchlevel" in
4113 0|'') ;;
4114 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4115     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4116     ;;
4117 esac
4118
4119 $echo "(You have $package $version_patchlevel_string.)"
4120
4121 case "$osname" in
4122 dos|vms)
4123         : XXX Should be a Configure test for double-dots in filenames.
4124         version=`echo $revision $patchlevel $subversion | \
4125                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4126         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4127                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4128         ;;
4129 *)
4130         version=`echo $revision $patchlevel $subversion | \
4131                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4132         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4133                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4134         ;;
4135 esac
4136 : Special case the 5.005_xx maintenance series, which used 5.005
4137 : without any subversion label as a subdirectory in $sitelib
4138 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4139         api_versionstring='5.005'
4140 fi
4141
4142 : Do we want threads support and if so, what type
4143 case "$usethreads" in
4144 $define|true|[yY]*)     dflt='y';;
4145 *)     # Catch case where user specified ithreads or 5005threads but
4146        # forgot -Dusethreads (A.D. 4/2002)
4147        case "$useithreads$use5005threads" in
4148        *$define*)       dflt='y';;
4149        *)               dflt='n';;
4150        esac
4151        ;;
4152 esac
4153 cat <<EOM
4154
4155 Perl can be built to offer a form of threading support on some systems
4156 To do so, Configure can be run with -Dusethreads.
4157
4158 Note that Perl built with threading support runs slightly slower
4159 and uses slightly more memory than plain Perl.
4160
4161 If this doesn't make any sense to you, just accept the default '$dflt'.
4162 EOM
4163 rp='Build a threading Perl?'
4164 . ./myread
4165 case "$ans" in
4166 y|Y)    val="$define" ;;
4167 *)      val="$undef" ;;
4168 esac
4169 set usethreads
4170 eval $setvar
4171
4172 if $test $patchlevel -lt 9; then
4173     case "$usethreads" in
4174     $define)
4175         : Default to ithreads unless overridden on command line or with
4176         : old config.sh
4177         dflt='y'
4178         case "$use5005threads" in
4179                 $define|true|[yY]*)
4180                         echo "5.005 threads are no longer supported"
4181                         exit 1
4182                 ;;
4183         esac
4184         case "$useithreads" in
4185                 $undef|false|[nN]*) dflt='n';;
4186         esac
4187         rp='Use the newer interpreter-based ithreads?'
4188         . ./myread
4189         case "$ans" in
4190         y|Y)    val="$define" ;;
4191         *)      val="$undef" ;;
4192         esac
4193         set useithreads
4194         eval $setvar
4195         : Now set use5005threads to the opposite value.
4196         case "$useithreads" in
4197         $define) val="$undef" ;;
4198         *) val="$define" ;;
4199         esac
4200         set use5005threads
4201         eval $setvar
4202         ;;
4203     *)
4204         useithreads="$undef"
4205         use5005threads="$undef"
4206         ;;
4207     esac
4208
4209     case "$useithreads$use5005threads" in
4210     "$define$define")
4211         $cat >&4 <<EOM
4212
4213 You cannot have both the ithreads and the 5.005 threads enabled
4214 at the same time.  Disabling the 5.005 threads since they are
4215 much less stable than the ithreads.
4216
4217 EOM
4218         use5005threads="$undef"
4219         ;;
4220     esac
4221
4222 else
4223 : perl-5.9.x and later
4224
4225     if test X"$usethreads" = "X$define"; then
4226         case "$use5005threads" in
4227             $define|true|[yY]*)
4228                 $cat >&4 <<EOM
4229
4230 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4231
4232 EOM
4233             ;;
4234         esac
4235     fi
4236
4237     use5005threads="$undef"
4238     useithreads="$usethreads"
4239 fi
4240
4241 case "$d_oldpthreads" in
4242 '')     : Configure tests would be welcome here.  For now, assume undef.
4243         val="$undef" ;;
4244 *)      val="$d_oldpthreads" ;;
4245 esac
4246 set d_oldpthreads
4247 eval $setvar
4248
4249
4250 : Look for a hint-file generated 'call-back-unit'.  If the
4251 : user has specified that a threading perl is to be built,
4252 : we may need to set or change some other defaults.
4253 if $test -f usethreads.cbu; then
4254     echo "Your platform has some specific hints regarding threaded builds, using them..."
4255     . ./usethreads.cbu
4256 else
4257     case "$usethreads" in
4258         "$define"|true|[yY]*)
4259                 $cat <<EOM
4260 (Your platform does not have any specific hints for threaded builds.
4261  Assuming POSIX threads, then.)
4262 EOM
4263         ;;
4264     esac
4265 fi
4266
4267 : Check if multiplicity is required
4268 cat <<EOM
4269
4270 Perl can be built so that multiple Perl interpreters can coexist
4271 within the same Perl executable.
4272 EOM
4273
4274 case "$useithreads" in
4275 $define)
4276         cat <<EOM
4277 This multiple interpreter support is required for interpreter-based threads.
4278 EOM
4279         val="$define"
4280         ;;
4281 *)      case "$usemultiplicity" in
4282         $define|true|[yY]*)     dflt='y';;
4283         *) dflt='n';;
4284         esac
4285         echo " "
4286         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4287         rp='Build Perl for multiplicity?'
4288         . ./myread
4289         case "$ans" in
4290         y|Y)    val="$define" ;;
4291         *)      val="$undef" ;;
4292         esac
4293         ;;
4294 esac
4295 set usemultiplicity
4296 eval $setvar
4297
4298 : Check if morebits is requested
4299 case "$usemorebits" in
4300 "$define"|true|[yY]*)
4301         use64bitint="$define"
4302         uselongdouble="$define"
4303         usemorebits="$define"
4304         ;;
4305 *)      usemorebits="$undef"
4306         ;;
4307 esac
4308
4309 : Determine the C compiler to be used
4310 echo " "
4311 case "$cc" in
4312 '') dflt=cc;;
4313 *) dflt="$cc";;
4314 esac
4315 rp="Use which C compiler?"
4316 . ./myread
4317 cc="$ans"
4318
4319 : See whether they have no cc but they do have gcc
4320 . ./trygcc
4321 if $test -f cc.cbu; then
4322     . ./cc.cbu
4323 fi
4324 . ./checkcc
4325
4326 : make some quick guesses about what we are up against
4327 echo " "
4328 $echo $n "Hmm...  $c"
4329 echo exit 1 >bsd
4330 echo exit 1 >usg
4331 echo exit 1 >v7
4332 echo exit 1 >osf1
4333 echo exit 1 >eunice
4334 echo exit 1 >xenix
4335 echo exit 1 >venix
4336 echo exit 1 >os2
4337 d_bsd="$undef"
4338 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4339 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4340 then
4341         echo "Looks kind of like an OSF/1 system, but we'll see..."
4342         echo exit 0 >osf1
4343 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4344         xxx=`./loc addbib blurfl $pth`
4345         if $test -f $xxx; then
4346         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4347                 echo exit 0 >bsd
4348                 echo exit 0 >usg
4349         else
4350                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4351                         echo "Looks kind of like an extended USG system, but we'll see..."
4352                 else
4353                         echo "Looks kind of like a USG system, but we'll see..."
4354                 fi
4355                 echo exit 0 >usg
4356         fi
4357 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4358         echo "Looks kind of like a BSD system, but we'll see..."
4359         d_bsd="$define"
4360         echo exit 0 >bsd
4361 else
4362         echo "Looks kind of like a Version 7 system, but we'll see..."
4363         echo exit 0 >v7
4364 fi
4365 case "$eunicefix" in
4366 *unixtovms*)
4367         $cat <<'EOI'
4368 There is, however, a strange, musty smell in the air that reminds me of
4369 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4370 EOI
4371         echo exit 0 >eunice
4372         d_eunice="$define"
4373 : it so happens the Eunice I know will not run shell scripts in Unix format
4374         ;;
4375 *)
4376         echo " "
4377         echo "Congratulations.  You aren't running Eunice."
4378         d_eunice="$undef"
4379         ;;
4380 esac
4381 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4382 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4383 : semicolon as a patch separator
4384 case "$p_" in
4385 :) ;;
4386 *)
4387         $cat <<'EOI'
4388 I have the feeling something is not exactly right, however...don't tell me...
4389 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4390 (Or you may be running DOS with DJGPP.)
4391 EOI
4392         echo exit 0 >os2
4393         ;;
4394 esac
4395 if test -f /xenix; then
4396         echo "Actually, this looks more like a XENIX system..."
4397         echo exit 0 >xenix
4398         d_xenix="$define"
4399 else
4400         echo " "
4401         echo "It's not Xenix..."
4402         d_xenix="$undef"
4403 fi
4404 chmod +x xenix
4405 $eunicefix xenix
4406 if test -f /venix; then
4407         echo "Actually, this looks more like a VENIX system..."
4408         echo exit 0 >venix
4409 else
4410         echo " "
4411         if ./xenix; then
4412                 : null
4413         else
4414                 echo "Nor is it Venix..."
4415         fi
4416 fi
4417 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4418 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4419 $rm -f foo
4420
4421 : Check if we are using GNU gcc and what its version is
4422 echo " "
4423 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4424 $cat >try.c <<EOM
4425 #include <stdio.h>
4426 int main() {
4427 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4428 #ifdef __VERSION__
4429         printf("%s\n", __VERSION__);
4430 #else
4431         printf("%s\n", "1");
4432 #endif
4433 #endif
4434         return(0);
4435 }
4436 EOM
4437 if $cc -o try $ccflags $ldflags try.c; then
4438         gccversion=`$run ./try`
4439         case "$gccversion" in
4440         '') echo "You are not using GNU cc." ;;
4441         *)  echo "You are using GNU cc $gccversion."
4442             ccname=gcc
4443             ;;
4444         esac
4445 else
4446         echo " "
4447         echo "*** WHOA THERE!!! ***" >&4
4448         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4449         case "$knowitall" in
4450         '')
4451         echo "    You'd better start hunting for one and let me know about it." >&4
4452                 exit 1
4453                 ;;
4454         esac
4455 fi
4456 $rm -f try try.*
4457 case "$gccversion" in
4458 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4459 esac
4460 case "$gccversion" in
4461 '') gccosandvers='' ;;
4462 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4463    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4464    gccshortvers=''
4465    case "$gccosandvers" in
4466    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4467    $osname$osvers) ;; # looking good
4468    $osname*) cat <<EOM >&4
4469
4470 *** WHOA THERE!!! ***
4471
4472     Your gcc has not been compiled for the exact release of
4473     your operating system ($gccosandvers versus $osname$osvers).
4474
4475     In general it is a good idea to keep gcc synchronized with
4476     the operating system because otherwise serious problems
4477     may ensue when trying to compile software, like Perl.
4478
4479     I'm trying to be optimistic here, though, and will continue.
4480     If later during the configuration and build icky compilation
4481     problems appear (headerfile conflicts being the most common
4482     manifestation), I suggest reinstalling the gcc to match
4483     your operating system release.
4484
4485 EOM
4486       ;;
4487    *) gccosandvers='' ;; # failed to parse, better be silent
4488    esac
4489    ;;
4490 esac
4491 case "$ccname" in
4492 '') ccname="$cc" ;;
4493 esac
4494
4495 # gcc 3.* complain about adding -Idirectories that they already know about,
4496 # so we will take those off from locincpth.
4497 case "$gccversion" in
4498 3*)
4499     echo "main(){}">try.c
4500     for incdir in $locincpth; do
4501        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4502              grep '^c[cp]p*[01]: warning: changing search order '`
4503        if test "X$warn" != X; then
4504            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4505        fi
4506     done
4507     $rm -f try try.*
4508 esac
4509
4510 : What should the include directory be ?
4511 echo " "
4512 $echo $n "Hmm...  $c"
4513 dflt='/usr/include'
4514 incpath=''
4515 mips_type=''
4516 if $test -f /bin/mips && /bin/mips; then
4517         echo "Looks like a MIPS system..."
4518         $cat >usr.c <<'EOCP'
4519 #ifdef SYSTYPE_BSD43
4520 /bsd43
4521 #endif
4522 EOCP
4523         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4524                 dflt='/bsd43/usr/include'
4525                 incpath='/bsd43'
4526                 mips_type='BSD 4.3'
4527         else
4528                 mips_type='System V'
4529         fi
4530         $rm -f usr.c usr.out
4531         echo "and you're compiling with the $mips_type compiler and libraries."
4532         xxx_prompt=y
4533         echo "exit 0" >mips
4534 else
4535         echo "Doesn't look like a MIPS system."
4536         xxx_prompt=n
4537         echo "exit 1" >mips
4538 fi
4539 chmod +x mips
4540 $eunicefix mips
4541 case "$usrinc" in
4542 '') ;;
4543 *) dflt="$usrinc";;
4544 esac
4545 case "$xxx_prompt" in
4546 y)      fn=d/
4547         echo " "
4548         rp='Where are the include files you want to use?'
4549         . ./getfile
4550         usrinc="$ans"
4551         ;;
4552 *)      usrinc="$dflt"
4553         ;;
4554 esac
4555
4556 : see how we invoke the C preprocessor
4557 echo " "
4558 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4559 cat <<'EOT' >testcpp.c
4560 #define ABC abc
4561 #define XYZ xyz
4562 ABC.XYZ
4563 EOT
4564 cd ..
4565 if test ! -f cppstdin; then
4566         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4567                 # AIX cc -E doesn't show the absolute headerfile
4568                 # locations but we'll cheat by using the -M flag.
4569                 echo 'cat >.$$.c; rm -f .$$.u; '"$cc"' ${1+"$@"} -M -c .$$.c 2>/dev/null; test -s .$$.u && awk '"'"'$2 ~ /\.h$/ { print "# 0 \""$2"\"" }'"'"' .$$.u; rm -f .$$.o .$$.u; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' > cppstdin
4570         else
4571                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4572         fi
4573 else
4574         echo "Keeping your $hint cppstdin wrapper."
4575 fi
4576 chmod 755 cppstdin
4577 wrapper=`pwd`/cppstdin
4578 ok='false'
4579 cd UU
4580
4581 if $test "X$cppstdin" != "X" && \
4582         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4583         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4584 then
4585         echo "You used to use $cppstdin $cppminus so we'll use that again."
4586         case "$cpprun" in
4587         '') echo "But let's see if we can live without a wrapper..." ;;
4588         *)
4589                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4590                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4591                 then
4592                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4593                         ok='true'
4594                 else
4595                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4596                 fi
4597                 ;;
4598         esac
4599 else
4600         case "$cppstdin" in
4601         '') ;;
4602         *)
4603                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4604                 ;;
4605         esac
4606 fi
4607
4608 if $ok; then
4609         : nothing
4610 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4611         $cc -E <testcpp.c >testcpp.out 2>&1; \
4612         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4613         echo "Yup, it does."
4614         x_cpp="$cc -E"
4615         x_minus='';
4616 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4617         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4618         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4619         echo "Yup, it does."
4620         x_cpp="$cc -E"
4621         x_minus='-';
4622 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4623         $cc -P <testcpp.c >testcpp.out 2>&1; \
4624         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4625         echo "Yipee, that works!"
4626         x_cpp="$cc -P"
4627         x_minus='';
4628 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4629         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4630         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4631         echo "At long last!"
4632         x_cpp="$cc -P"
4633         x_minus='-';
4634 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4635         $cpp <testcpp.c >testcpp.out 2>&1; \
4636         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4637         echo "It works!"
4638         x_cpp="$cpp"
4639         x_minus='';
4640 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4641         $cpp - <testcpp.c >testcpp.out 2>&1; \
4642         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4643         echo "Hooray, it works!  I was beginning to wonder."
4644         x_cpp="$cpp"
4645         x_minus='-';
4646 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4647         $wrapper <testcpp.c >testcpp.out 2>&1; \
4648         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4649         x_cpp="$wrapper"
4650         x_minus=''
4651         echo "Eureka!"
4652 else
4653         dflt=''
4654         rp="No dice.  I can't find a C preprocessor.  Name one:"
4655         . ./myread
4656         x_cpp="$ans"
4657         x_minus=''
4658         $x_cpp <testcpp.c >testcpp.out 2>&1
4659         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4660                 echo "OK, that will do." >&4
4661         else
4662 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4663                 exit 1
4664         fi
4665 fi
4666
4667 case "$ok" in
4668 false)
4669         cppstdin="$x_cpp"
4670         cppminus="$x_minus"
4671         cpprun="$x_cpp"
4672         cpplast="$x_minus"
4673         set X $x_cpp
4674         shift
4675         case "$1" in
4676         "$cpp")
4677                 echo "Perhaps can we force $cc -E using a wrapper..."
4678                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4679                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4680                 then
4681                         echo "Yup, we can."
4682                         cppstdin="$wrapper"
4683                         cppminus='';
4684                 else
4685                         echo "Nope, we'll have to live without it..."
4686                 fi
4687                 ;;
4688         esac
4689         case "$cpprun" in
4690         "$wrapper")
4691                 cpprun=''
4692                 cpplast=''
4693                 ;;
4694         esac
4695         ;;
4696 esac
4697
4698 case "$cppstdin" in
4699 "$wrapper"|'cppstdin') ;;
4700 *) $rm -f $wrapper;;
4701 esac
4702 $rm -f testcpp.c testcpp.out
4703
4704 : Set private lib path
4705 case "$plibpth" in
4706 '') if ./mips; then
4707                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4708         fi;;
4709 esac
4710 case "$libpth" in
4711 ' ') dlist='';;
4712 '') dlist="$loclibpth $plibpth $glibpth";;
4713 *) dlist="$libpth";;
4714 esac
4715
4716 : Now check and see which directories actually exist, avoiding duplicates
4717 libpth=''
4718 for xxx in $dlist
4719 do
4720     if $test -d $xxx; then
4721                 case " $libpth " in
4722                 *" $xxx "*) ;;
4723                 *) libpth="$libpth $xxx";;
4724                 esac
4725     fi
4726 done
4727 $cat <<'EOM'
4728
4729 Some systems have incompatible or broken versions of libraries.  Among
4730 the directories listed in the question below, please remove any you
4731 know not to be holding relevant libraries, and add any that are needed.
4732 Say "none" for none.
4733
4734 EOM
4735 case "$libpth" in
4736 '') dflt='none';;
4737 *)
4738         set X $libpth
4739         shift
4740         dflt=${1+"$@"}
4741         ;;
4742 esac
4743 rp="Directories to use for library searches?"
4744 . ./myread
4745 case "$ans" in
4746 none) libpth=' ';;
4747 *) libpth="$ans";;
4748 esac
4749
4750 : compute shared library extension
4751 case "$so" in
4752 '')
4753         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4754                 dflt='sl'
4755         else
4756                 dflt='so'
4757         fi
4758         ;;
4759 *) dflt="$so";;
4760 esac
4761 $cat <<EOM
4762
4763 On some systems, shared libraries may be available.  Answer 'none' if
4764 you want to suppress searching of shared libraries for the remainder
4765 of this configuration.
4766
4767 EOM
4768 rp='What is the file extension used for shared libraries?'
4769 . ./myread
4770 so="$ans"
4771
4772 : Define several unixisms.
4773 : Hints files or command line option can be used to override them.
4774 : The convoluted testing is in case hints files set either the old
4775 : or the new name.
4776 case "$_exe" in
4777 '')     case "$exe_ext" in
4778         '')     ;;
4779         *)      _exe="$exe_ext" ;;
4780         esac
4781         ;;
4782 esac
4783 case "$_a" in
4784 '')     case "$lib_ext" in
4785     '') _a='.a';;
4786         *)      _a="$lib_ext" ;;
4787         esac
4788         ;;
4789 esac
4790 case "$_o" in
4791 '') case "$obj_ext" in
4792         '')     _o='.o';;
4793         *)      _o="$obj_ext";;
4794         esac
4795         ;;
4796 esac
4797 case "$p_" in
4798 '') case "$path_sep" in
4799         '')     p_=':';;
4800         *)      p_="$path_sep";;
4801         esac
4802         ;;
4803 esac
4804 exe_ext=$_exe
4805 lib_ext=$_a
4806 obj_ext=$_o
4807 path_sep=$p_
4808
4809 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4810
4811 : Which makefile gets called first.  This is used by make depend.
4812 case "$firstmakefile" in
4813 '') firstmakefile='makefile';;
4814 esac
4815
4816 : Check is we will use socks
4817 case "$usesocks" in
4818 $define|true|[yY]*)     dflt='y';;
4819 *) dflt='n';;
4820 esac
4821 cat <<EOM
4822
4823 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4824 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4825 to use the PerlIO abstraction layer, this will be implicitly selected.
4826
4827 If this doesn't make any sense to you, just accept the default '$dflt'.
4828 EOM
4829 rp='Build Perl for SOCKS?'
4830 . ./myread
4831 case "$ans" in
4832 y|Y)    val="$define" ;;
4833 *)      val="$undef" ;;
4834 esac
4835 set usesocks
4836 eval $setvar
4837
4838 : Check for uselongdouble support
4839 case "$ccflags" in
4840 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4841 esac
4842
4843 case "$uselongdouble" in
4844 $define|true|[yY]*)     dflt='y';;
4845 *) dflt='n';;
4846 esac
4847 cat <<EOM
4848
4849 Perl can be built to take advantage of long doubles which
4850 (if available) may give more accuracy and range for floating point numbers.
4851
4852 If this doesn't make any sense to you, just accept the default '$dflt'.
4853 EOM
4854 rp='Try to use long doubles if available?'
4855 . ./myread
4856 case "$ans" in
4857 y|Y)    val="$define"   ;;
4858 *)      val="$undef"    ;;
4859 esac
4860 set uselongdouble
4861 eval $setvar
4862
4863 case "$uselongdouble" in
4864 true|[yY]*) uselongdouble="$define" ;;
4865 esac
4866
4867 : Look for a hint-file generated 'call-back-unit'.  If the
4868 : user has specified that long doubles should be used,
4869 : we may need to set or change some other defaults.
4870 if $test -f uselongdouble.cbu; then
4871     echo "Your platform has some specific hints regarding long doubles, using them..."
4872     . ./uselongdouble.cbu
4873 else
4874     case "$uselongdouble" in
4875         $define)
4876                 $cat <<EOM
4877 (Your platform does not have any specific hints for long doubles.)
4878 EOM
4879         ;;
4880     esac
4881 fi
4882
4883 : Looking for optional libraries
4884 echo " "
4885 echo "Checking for optional libraries..." >&4
4886 case "$libs" in
4887 ' '|'') dflt='';;
4888 *) dflt="$libs";;
4889 esac
4890 case "$libswanted" in
4891 '') libswanted='c_s';;
4892 esac
4893 case "$usesocks" in
4894 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4895 esac
4896 libsfound=''
4897 libsfiles=''
4898 libsdirs=''
4899 libspath=''
4900 for thisdir in $libpth $xlibpth; do
4901   test -d $thisdir && libspath="$libspath $thisdir"
4902 done
4903 for thislib in $libswanted; do
4904         for thisdir in $libspath; do
4905             xxx=''
4906             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4907                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4908                 $test -f "$xxx" && eval $libscheck
4909                 $test -f "$xxx" && libstyle=shared
4910             fi
4911             if test ! -f "$xxx"; then
4912                 xxx=$thisdir/lib$thislib.$so
4913                 $test -f "$xxx" && eval $libscheck
4914                 $test -f "$xxx" && libstyle=shared
4915             fi
4916             if test ! -f "$xxx"; then
4917                 xxx=$thisdir/lib$thislib$_a
4918                 $test -f "$xxx" && eval $libscheck
4919                 $test -f "$xxx" && libstyle=static
4920             fi
4921             if test ! -f "$xxx"; then
4922                 xxx=$thisdir/$thislib$_a
4923                 $test -f "$xxx" && eval $libscheck
4924                 $test -f "$xxx" && libstyle=static
4925             fi
4926             if test ! -f "$xxx"; then
4927                 xxx=$thisdir/lib${thislib}_s$_a
4928                 $test -f "$xxx" && eval $libscheck
4929                 $test -f "$xxx" && libstyle=static
4930                 $test -f "$xxx" && thislib=${thislib}_s
4931             fi
4932             if test ! -f "$xxx"; then
4933                 xxx=$thisdir/Slib$thislib$_a
4934                 $test -f "$xxx" && eval $libscheck
4935                 $test -f "$xxx" && libstyle=static
4936             fi
4937             if $test -f "$xxx"; then
4938                 case "$libstyle" in
4939                 shared) echo "Found -l$thislib (shared)." ;;
4940                 static) echo "Found -l$thislib." ;;
4941                 *)      echo "Found -l$thislib ($libstyle)." ;;
4942                 esac
4943                 case " $dflt " in
4944                 *"-l$thislib "*);;
4945                 *) dflt="$dflt -l$thislib"
4946                    libsfound="$libsfound $xxx"
4947                    yyy=`basename $xxx`
4948                    libsfiles="$libsfiles $yyy"
4949                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4950                    case " $libsdirs " in
4951                    *" $yyy "*) ;;
4952                    *) libsdirs="$libsdirs $yyy" ;;
4953                    esac
4954                    ;;
4955                 esac
4956                 break
4957             fi
4958         done
4959         if $test ! -f "$xxx"; then
4960             echo "No -l$thislib."
4961         fi
4962 done
4963 set X $dflt
4964 shift
4965 dflt="$*"
4966 case "$libs" in
4967 '') dflt="$dflt";;
4968 *) dflt="$libs";;
4969 esac
4970 case "$dflt" in
4971 ' '|'') dflt='none';;
4972 esac
4973
4974 $cat <<EOM
4975
4976 In order to compile $package on your machine, a number of libraries
4977 are usually needed.  Include any other special libraries here as well.
4978 Say "none" for none.  The default list is almost always right.
4979 EOM
4980
4981 echo " "
4982 rp="What libraries to use?"
4983 . ./myread
4984 case "$ans" in
4985 none) libs=' ';;
4986 *) libs="$ans";;
4987 esac
4988
4989 : determine optimization, if desired, or use for debug flag also
4990 case "$optimize" in
4991 ' '|$undef) dflt='none';;
4992 '') dflt='-O';;
4993 *) dflt="$optimize";;
4994 esac
4995 $cat <<EOH
4996
4997 By default, $package compiles with the -O flag to use the optimizer.
4998 Alternately, you might want to use the symbolic debugger, which uses
4999 the -g flag (on traditional Unix systems).  Either flag can be
5000 specified here.  To use neither flag, specify the word "none".
5001
5002 EOH
5003 rp="What optimizer/debugger flag should be used?"
5004 . ./myread
5005 optimize="$ans"
5006 case "$optimize" in
5007 'none') optimize=" ";;
5008 esac
5009
5010 : Check what DEBUGGING is required from the command line
5011 : -DEBUGGING      or -DDEBUGGING or
5012 : -DEBUGGING=both                       = -g + -DDEBUGGING
5013 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5014 : -DEBUGGING=none or -UDEBUGGING        =
5015 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5016 case "$EBUGGING" in
5017 '')     ;;
5018 *)      DEBUGGING=$EBUGGING ;;
5019 esac
5020
5021 case "$DEBUGGING" in
5022 -g|both|$define)
5023     case "$optimize" in
5024         *-g*) ;;
5025         *)    optimize="$optimize -g" ;;
5026     esac ;;
5027 none|$undef)
5028     case "$optimize" in
5029         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5030                 shift
5031                 optimize="$*"
5032                 ;;
5033     esac ;;
5034 esac
5035
5036 dflt=''
5037 case "$DEBUGGING" in
5038 both|$define) dflt='-DDEBUGGING'
5039 esac
5040
5041 : argument order is deliberate, as the flag will start with - which set could
5042 : think is an option
5043 checkccflag='check=$1; flag=$2; callback=$3;
5044 echo " ";
5045 echo "Checking if your compiler accepts $flag" 2>&1;
5046 echo "int main(void) { return 0; }" > gcctest.c;
5047 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5048     echo "Yes, it does." 2>&1;
5049     if $test -s gcctest.out ; then
5050         echo "But your platform does not like it:";
5051         cat gcctest.out;
5052     else
5053         case "$ccflags" in
5054         *$check*)
5055             echo "Leaving current flags $ccflags alone." 2>&1
5056             ;;
5057         *) dflt="$dflt $flag";
5058             eval $callback
5059             ;;
5060         esac
5061     fi
5062 else
5063     echo "Nope, it does not, but that is ok." 2>&1;
5064 fi
5065 '
5066
5067 : We will not override a previous value, but we might want to
5068 : augment a hint file
5069 case "$hint" in
5070 default|recommended)
5071         case "$gccversion" in
5072         1*) dflt="$dflt -fpcc-struct-return" ;;
5073         esac
5074         case "$optimize:$DEBUGGING" in
5075         *-g*:old) dflt="$dflt -DDEBUGGING";;
5076         esac
5077         case "$gccversion" in
5078         2*) if $test -d /etc/conf/kconfig.d &&
5079                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5080                 then
5081                         # Interactive Systems (ISC) POSIX mode.
5082                         dflt="$dflt -posix"
5083                 fi
5084                 ;;
5085         esac
5086         case "$gccversion" in
5087         1*) ;;
5088         2.[0-8]*) ;;
5089         ?*)     set strict-aliasing -fno-strict-aliasing
5090                 eval $checkccflag
5091                 ;;
5092         esac
5093         # For gcc, adding -pipe speeds up compilations for some, but apparently
5094         # some assemblers can't read from stdin.  (It also slows down compilations
5095         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5096         case "$gccversion" in
5097         ?*)     set pipe -pipe
5098                 eval $checkccflag
5099                 ;;
5100         esac
5101
5102         # on x86_64 (at least) we require an extra library (libssp) in the
5103         # link command line. This library is not named, so I infer that it is
5104         # an implementation detail that may change. Hence the safest approach
5105         # is to add the flag to the flags passed to the compiler at link time,
5106         # as that way the compiler can do the right implementation dependant
5107         # thing. (NWC)
5108         case "$gccversion" in
5109         ?*)     set stack-protector -fstack-protector
5110                 eval $checkccflag
5111                 ;;
5112         esac
5113         ;;
5114 esac
5115
5116 case "$mips_type" in
5117 *BSD*|'') inclwanted="$locincpth $usrinc";;
5118 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5119 esac
5120 for thisincl in $inclwanted; do
5121         if $test -d $thisincl; then
5122                 if $test x$thisincl != x$usrinc; then
5123                         case "$dflt" in
5124                         *" -I$thisincl "*);;
5125                         *) dflt="$dflt -I$thisincl ";;
5126                         esac
5127                 fi
5128         fi
5129 done
5130
5131 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5132         xxx=true;
5133 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5134         xxx=true;
5135 else
5136         xxx=false;
5137 fi;
5138 if $xxx; then
5139         case "$dflt" in
5140         *$2*);;
5141         *) dflt="$dflt -D$2";;
5142         esac;
5143 fi'
5144
5145 set signal.h LANGUAGE_C; eval $inctest
5146
5147 case "$usesocks" in
5148 $define)
5149         ccflags="$ccflags -DSOCKS"
5150         ;;
5151 esac
5152
5153 case "$hint" in
5154 default|recommended) dflt="$ccflags $dflt" ;;
5155 *) dflt="$ccflags";;
5156 esac
5157
5158 case "$dflt" in
5159 ''|' ') dflt=none;;
5160 esac
5161
5162 $cat <<EOH
5163
5164 Your C compiler may want other flags.  For this question you should include
5165 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5166 but you should NOT include libraries or ld flags like -lwhatever.  If you
5167 want $package to honor its debug switch, you should include -DDEBUGGING here.
5168 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5169
5170 To use no flags, specify the word "none".
5171
5172 EOH
5173 set X $dflt
5174 shift
5175 dflt=${1+"$@"}
5176 rp="Any additional cc flags?"
5177 . ./myread
5178 case "$ans" in
5179 none) ccflags='';;
5180 *) ccflags="$ans";;
5181 esac
5182
5183 : the following weeds options from ccflags that are of no interest to cpp
5184 case "$cppflags" in
5185 '') cppflags="$ccflags" ;;
5186 *)  cppflags="$cppflags $ccflags" ;;
5187 esac
5188 case "$gccversion" in
5189 1*) cppflags="$cppflags -D__GNUC__"
5190 esac
5191 case "$mips_type" in
5192 '');;
5193 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5194 esac
5195 case "$cppflags" in
5196 '');;
5197 *)
5198         echo " "
5199         echo "Let me guess what the preprocessor flags are..." >&4
5200         set X $cppflags
5201         shift
5202         cppflags=''
5203         $cat >cpp.c <<'EOM'
5204 #define BLURFL foo
5205
5206 BLURFL xx LFRULB
5207 EOM
5208         previous=''
5209         for flag in $*
5210         do
5211                 case "$flag" in
5212                 -*) ftry="$flag";;
5213                 *) ftry="$previous $flag";;
5214                 esac
5215                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5216                         >cpp1.out 2>/dev/null && \
5217                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5218                         >cpp2.out 2>/dev/null && \
5219                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5220                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5221                 then
5222                         cppflags="$cppflags $ftry"
5223                         previous=''
5224                 else
5225                         previous="$flag"
5226                 fi
5227         done
5228         set X $cppflags
5229         shift
5230         cppflags=${1+"$@"}
5231         case "$cppflags" in
5232         *-*)  echo "They appear to be: $cppflags";;
5233         esac
5234         $rm -f cpp.c cpp?.out
5235         ;;
5236 esac
5237
5238 : flags used in final linking phase
5239 case "$ldflags" in
5240 '') if ./venix; then
5241                 dflt='-i -z'
5242         else
5243                 dflt=''
5244         fi
5245         case "$ccflags" in
5246         *-posix*) dflt="$dflt -posix" ;;
5247         esac
5248         ;;
5249 *) dflt="$ldflags";;
5250 esac
5251 # See note above about -fstack-protector
5252 case "$ccflags" in
5253 *-fstack-protector*)
5254         case "$dflt" in
5255         *-fstack-protector*) ;; # Don't add it again
5256         *) dflt="$dflt -fstack-protector" ;;
5257         esac
5258         ;;
5259 esac
5260
5261 : Try to guess additional flags to pick up local libraries.
5262 for thislibdir in $libpth; do
5263         case " $loclibpth " in
5264         *" $thislibdir "*)
5265                 case "$dflt " in
5266                 *"-L$thislibdir "*) ;;
5267                 *)  dflt="$dflt -L$thislibdir" ;;
5268                 esac
5269                 ;;
5270         esac
5271 done
5272
5273 case "$dflt" in
5274 '') dflt='none' ;;
5275 esac
5276
5277 $cat <<EOH
5278
5279 Your C linker may need flags.  For this question you should
5280 include -L/whatever and any other flags used by the C linker, but you
5281 should NOT include libraries like -lwhatever.
5282
5283 Make sure you include the appropriate -L/path flags if your C linker
5284 does not normally search all of the directories you specified above,
5285 namely
5286         $libpth
5287 To use no flags, specify the word "none".
5288
5289 EOH
5290
5291 rp="Any additional ld flags (NOT including libraries)?"
5292 . ./myread
5293 case "$ans" in
5294 none) ldflags='';;
5295 *) ldflags="$ans";;
5296 esac
5297 rmlist="$rmlist pdp11"
5298
5299 : coherency check
5300 echo " "
5301 echo "Checking your choice of C compiler and flags for coherency..." >&4
5302 $cat > try.c <<'EOF'
5303 #include <stdio.h>
5304 int main() { printf("Ok\n"); return(0); }
5305 EOF
5306 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5307 shift
5308 $cat >try.msg <<'EOM'
5309 I've tried to compile and run the following simple program:
5310
5311 EOM
5312 $cat try.c >> try.msg
5313
5314 $cat >> try.msg <<EOM
5315
5316 I used the command:
5317
5318         $*
5319         $run ./try
5320
5321 and I got the following output:
5322
5323 EOM
5324 dflt=y
5325 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5326         if $sh -c "$run ./try " >>try.msg 2>&1; then
5327                 xxx=`$run ./try`
5328                 case "$xxx" in
5329                 "Ok") dflt=n ;;
5330                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5331                 esac
5332         else
5333                 echo "The program compiled OK, but exited with status $?." >>try.msg
5334                 rp="You have a problem.  Shall I abort Configure"
5335                 dflt=y
5336         fi
5337 else
5338         echo "I can't compile the test program." >>try.msg
5339         rp="You have a BIG problem.  Shall I abort Configure"
5340         dflt=y
5341 fi
5342 case "$dflt" in
5343 y)
5344         $cat try.msg >&4
5345         case "$knowitall" in
5346         '')
5347                 echo "(The supplied flags or libraries might be incorrect.)"
5348                 ;;
5349         *) dflt=n;;
5350         esac
5351         echo " "
5352         . ./myread
5353         case "$ans" in
5354         n*|N*) ;;
5355         *)      echo "Ok.  Stopping Configure." >&4
5356                 exit 1
5357                 ;;
5358         esac
5359         ;;
5360 n) echo "OK, that should do.";;
5361 esac
5362 $rm_try gcctest gcctest.out
5363
5364 : define a shorthand compile call
5365 compile='
5366 mc_file=$1;
5367 shift;
5368 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5369 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5370 exit 1;
5371 fi;
5372 esac;
5373 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5374 : define a shorthand compile call for compilations that should be ok.
5375 compile_ok='
5376 mc_file=$1;
5377 shift;
5378 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5379
5380 : determine filename position in cpp output
5381 echo " "
5382 echo "Computing filename position in cpp output for #include directives..." >&4
5383 case "$osname" in
5384 vos) testaccess=-e ;;
5385 *)   testaccess=-r ;;
5386 esac
5387 echo '#include <stdio.h>' > foo.c
5388 $cat >fieldn <<EOF
5389 $startsh
5390 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5391 $grep '^[       ]*#.*stdio\.h' | \
5392 while read cline; do
5393         pos=1
5394         set \$cline
5395         while $test \$# -gt 0; do
5396                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5397                         echo "\$pos"
5398                         exit 0
5399                 fi
5400                 shift
5401                 pos=\`expr \$pos + 1\`
5402         done
5403 done
5404 EOF
5405 chmod +x fieldn
5406 fieldn=`./fieldn`
5407 $rm -f foo.c fieldn
5408 case $fieldn in
5409 '') pos='???';;
5410 1) pos=first;;
5411 2) pos=second;;
5412 3) pos=third;;
5413 *) pos="${fieldn}th";;
5414 esac
5415 echo "Your cpp writes the filename in the $pos field of the line."
5416
5417 case "$osname" in
5418 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5419 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5420 *)   cppfilter='' ;;
5421 esac
5422 : locate header file
5423 $cat >findhdr <<EOF
5424 $startsh
5425 wanted=\$1
5426 name=''
5427 for usrincdir in $usrinc
5428 do
5429         if test -f \$usrincdir/\$wanted; then
5430                 echo "\$usrincdir/\$wanted"
5431                 exit 0
5432         fi
5433 done
5434 awkprg='{ print \$$fieldn }'
5435 echo "#include <\$wanted>" > foo\$\$.c
5436 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5437 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5438 while read cline; do
5439         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5440         case "\$name" in
5441         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5442         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5443         *) exit 2;;
5444         esac;
5445 done;
5446 #
5447 # status = 0: grep returned 0 lines, case statement not executed
5448 # status = 1: headerfile found
5449 # status = 2: while loop executed, no headerfile found
5450 #
5451 status=\$?
5452 $rm -f foo\$\$.c;
5453 if test \$status -eq 1; then
5454         exit 0;
5455 fi
5456 exit 1
5457 EOF
5458 chmod +x findhdr
5459
5460 : define an alternate in-header-list? function
5461 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5462 cont=true; xxf="echo \"<\$1> found.\" >&4";
5463 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5464 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5465 esac;
5466 case $# in 4) instead=instead;; *) instead="at last";; esac;
5467 while $test "$cont"; do
5468         xxx=`./findhdr $1`
5469         var=$2; eval "was=\$$2";
5470         if $test "$xxx" && $test -r "$xxx";
5471         then eval $xxf;
5472         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5473                 cont="";
5474         else eval $xxnf;
5475         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5476         set $yyy; shift; shift; yyy=$@;
5477         case $# in 0) cont="";;
5478         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5479                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5480         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5481                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5482         esac;
5483 done;
5484 while $test "$yyy";
5485 do set $yyy; var=$2; eval "was=\$$2";
5486         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5487         set $yyy; shift; shift; yyy=$@;
5488 done'
5489
5490 : see if stdlib is available
5491 set stdlib.h i_stdlib
5492 eval $inhdr
5493
5494 : check for lengths of integral types
5495 echo " "
5496 case "$intsize" in
5497 '')
5498         echo "Checking to see how big your integers are..." >&4
5499         $cat >try.c <<EOCP
5500 #include <stdio.h>
5501 #$i_stdlib I_STDLIB
5502 #ifdef I_STDLIB
5503 #include <stdlib.h>
5504 #endif
5505 int main()
5506 {
5507         printf("intsize=%d;\n", (int)sizeof(int));
5508         printf("longsize=%d;\n", (int)sizeof(long));
5509         printf("shortsize=%d;\n", (int)sizeof(short));
5510         exit(0);
5511 }
5512 EOCP
5513         set try
5514         if eval $compile_ok && $run ./try > /dev/null; then
5515                 eval `$run ./try`
5516                 echo "Your integers are $intsize bytes long."
5517                 echo "Your long integers are $longsize bytes long."
5518                 echo "Your short integers are $shortsize bytes long."
5519         else
5520                 $cat >&4 <<EOM
5521 !
5522 Help! I can't compile and run the intsize test program: please enlighten me!
5523 (This is probably a misconfiguration in your system or libraries, and
5524 you really ought to fix it.  Still, I'll try anyway.)
5525 !
5526 EOM
5527                 dflt=4
5528                 rp="What is the size of an integer (in bytes)?"
5529                 . ./myread
5530                 intsize="$ans"
5531                 dflt=$intsize
5532                 rp="What is the size of a long integer (in bytes)?"
5533                 . ./myread
5534                 longsize="$ans"
5535                 dflt=2
5536                 rp="What is the size of a short integer (in bytes)?"
5537                 . ./myread
5538                 shortsize="$ans"
5539         fi
5540         ;;
5541 esac
5542 $rm_try
5543
5544 : check for long long
5545 echo " "
5546 echo "Checking to see if you have long long..." >&4
5547 echo 'int main() { long long x = 7; return 0; }' > try.c
5548 set try
5549 if eval $compile; then
5550         val="$define"
5551         echo "You have long long."
5552 else
5553         val="$undef"
5554         echo "You do not have long long."
5555 fi
5556 $rm_try
5557 set d_longlong
5558 eval $setvar
5559
5560 : check for length of long long
5561 case "${d_longlong}${longlongsize}" in
5562 $define)
5563         echo " "
5564         echo "Checking to see how big your long longs are..." >&4
5565         $cat >try.c <<'EOCP'
5566 #include <stdio.h>
5567 int main()
5568 {
5569     printf("%d\n", (int)sizeof(long long));
5570     return(0);
5571 }
5572 EOCP
5573         set try
5574         if eval $compile_ok; then
5575                 longlongsize=`$run ./try`
5576                 echo "Your long longs are $longlongsize bytes long."
5577         else
5578                 dflt='8'
5579                 echo " "
5580                 echo "(I can't seem to compile the test program.  Guessing...)"
5581                 rp="What is the size of a long long (in bytes)?"
5582                 . ./myread
5583                 longlongsize="$ans"
5584         fi
5585         if $test "X$longsize" = "X$longlongsize"; then
5586                 echo "(That isn't any different from an ordinary long.)"
5587         fi
5588         ;;
5589 esac
5590 $rm_try
5591
5592 : see if inttypes.h is available
5593 : we want a real compile instead of Inhdr because some systems
5594 : have an inttypes.h which includes non-existent headers
5595 echo " "
5596 $cat >try.c <<EOCP
5597 #include <inttypes.h>
5598 int main() {
5599         static int32_t foo32 = 0x12345678;
5600 }
5601 EOCP
5602 set try
5603 if eval $compile; then
5604         echo "<inttypes.h> found." >&4
5605         val="$define"
5606 else
5607         echo "<inttypes.h> NOT found." >&4
5608         val="$undef"
5609 fi
5610 $rm_try
5611 set i_inttypes
5612 eval $setvar
5613
5614 : check for int64_t
5615 echo " "
5616 echo "Checking to see if you have int64_t..." >&4
5617 $cat >try.c <<EOCP
5618 #include <sys/types.h>
5619 #$i_inttypes I_INTTYPES
5620 #ifdef I_INTTYPES
5621 #include <inttypes.h>
5622 #endif
5623 int main() { int64_t x = 7; }
5624 EOCP
5625 set try
5626 if eval $compile; then
5627         val="$define"
5628         echo "You have int64_t."
5629 else
5630         val="$undef"
5631         echo "You do not have int64_t."
5632 fi
5633 $rm_try
5634 set d_int64_t
5635 eval $setvar
5636
5637 : Check if 64bit ints have a quad type
5638 echo " "
5639 echo "Checking which 64-bit integer type we could use..." >&4
5640
5641 case "$intsize" in
5642 8) val=int
5643    set quadtype
5644    eval $setvar
5645    val='"unsigned int"'
5646    set uquadtype
5647    eval $setvar
5648    quadkind=1
5649    ;;
5650 *) case "$longsize" in
5651    8) val=long
5652       set quadtype
5653       eval $setvar
5654       val='"unsigned long"'
5655       set uquadtype
5656       eval $setvar
5657       quadkind=2
5658       ;;
5659    *) case "$d_longlong:$longlongsize" in
5660       define:8)
5661         val='"long long"'
5662         set quadtype
5663         eval $setvar
5664         val='"unsigned long long"'
5665         set uquadtype
5666         eval $setvar
5667         quadkind=3
5668         ;;
5669       *) case "$d_int64_t" in
5670          define)
5671            val=int64_t
5672            set quadtype
5673            eval $setvar
5674            val=uint64_t
5675            set uquadtype
5676            eval $setvar
5677            quadkind=4
5678            ;;
5679          esac
5680          ;;
5681       esac
5682       ;;
5683    esac
5684    ;;
5685 esac
5686
5687 case "$quadtype" in
5688 '')     echo "Alas, no 64-bit integer types in sight." >&4
5689         d_quad="$undef"
5690         ;;
5691 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5692         d_quad="$define"
5693         ;;
5694 esac
5695
5696 : Do we want 64bit support
5697 case "$uselonglong" in
5698 "$define"|true|[yY]*)
5699         cat <<EOM >&4
5700
5701 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5702 EOM
5703         use64bitint="$define"
5704         ;;
5705 esac
5706 case "$use64bits" in
5707 "$define"|true|[yY]*)
5708         cat <<EOM >&4
5709
5710 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5711 EOM
5712         use64bitint="$define"
5713         ;;
5714 esac
5715 case "$use64bitints" in
5716 "$define"|true|[yY]*)
5717         cat <<EOM >&4
5718
5719 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5720 EOM
5721         use64bitint="$define"
5722         ;;
5723 esac
5724 case "$use64bitsint" in
5725 "$define"|true|[yY]*)
5726         cat <<EOM >&4
5727
5728 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5729 EOM
5730         use64bitint="$define"
5731         ;;
5732 esac
5733 case "$uselonglongs" in
5734 "$define"|true|[yY]*)
5735         cat <<EOM >&4
5736
5737 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5738 EOM
5739         use64bitint="$define"
5740         ;;
5741 esac
5742 case "$use64bitsall" in
5743 "$define"|true|[yY]*)
5744         cat <<EOM >&4
5745
5746 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5747 EOM
5748         use64bitall="$define"
5749         ;;
5750 esac
5751
5752 case "$ccflags" in
5753 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5754 esac
5755 case "$use64bitall" in
5756 "$define"|true|[yY]*) use64bitint="$define" ;;
5757 esac
5758
5759 case "$longsize" in
5760 8) cat <<EOM
5761
5762 You have natively 64-bit long integers.
5763 EOM
5764    val="$define"
5765    ;;
5766 *) case "$use64bitint" in
5767    "$define"|true|[yY]*) dflt='y';;
5768    *) dflt='n';;
5769    esac
5770    case "$d_quad" in
5771    "$define") ;;
5772    *) dflt='n' ;;
5773    esac
5774    cat <<EOM
5775
5776 Perl can be built to take advantage of 64-bit integer types
5777 on some systems.  To do so, Configure can be run with -Duse64bitint.
5778 Choosing this option will most probably introduce binary incompatibilities.
5779
5780 If this doesn't make any sense to you, just accept the default '$dflt'.
5781 (The default has been chosen based on your configuration.)
5782 EOM
5783    rp='Try to use 64-bit integers, if available?'
5784    . ./myread
5785    case "$ans" in
5786    [yY]*) val="$define" ;;
5787    *)     val="$undef"  ;;
5788    esac
5789    ;;
5790 esac
5791 set use64bitint
5792 eval $setvar
5793
5794 case "$use64bitall" in
5795 "$define"|true|[yY]*) dflt='y' ;;
5796 *) case "$longsize" in
5797    8) dflt='y' ;;
5798    *) dflt='n' ;;
5799    esac
5800    ;;
5801 esac
5802 cat <<EOM
5803
5804 You may also choose to try maximal 64-bitness.  It means using as much
5805 64-bitness as possible on the platform.  This in turn means even more
5806 binary incompatibilities.  On the other hand, your platform may not
5807 have any more 64-bitness available than what you already have chosen.
5808
5809 If this doesn't make any sense to you, just accept the default '$dflt'.
5810 (The default has been chosen based on your configuration.)
5811 EOM
5812 rp='Try to use maximal 64-bit support, if available?'
5813 . ./myread
5814 case "$ans" in
5815 [yY]*) val="$define" ;;
5816 *)     val="$undef"  ;;
5817 esac
5818 set use64bitall
5819 eval $setvar
5820 case "$use64bitall" in
5821 "$define")
5822         case "$use64bitint" in
5823         "$undef")
5824                 cat <<EOM
5825
5826 Since you have chosen a maximally 64-bit build, I'm also turning on
5827 the use of 64-bit integers.
5828 EOM
5829                 use64bitint="$define" ;;
5830         esac
5831         ;;
5832 esac
5833
5834 : Look for a hint-file generated 'call-back-unit'.  If the
5835 : user has specified that a 64-bit perl is to be built,
5836 : we may need to set or change some other defaults.
5837 if $test -f use64bitint.cbu; then
5838         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5839         . ./use64bitint.cbu
5840 fi
5841 case "$use64bitint" in
5842 "$define"|true|[yY]*)
5843         : This test was common to all the OpenBSD forks, and seems harmless for
5844         : other platforms:
5845         echo " "
5846         echo "Checking if your C library has broken 64-bit functions..." >&4
5847         cat >try.c <<EOCP
5848 #include <stdio.h>
5849 typedef $uquadtype myULL;
5850 int main (void)
5851 {
5852     struct {
5853         double d;
5854         myULL  u;
5855     } *p, test[] = {
5856         {4294967303.15, 4294967303ULL},
5857         {4294967294.2,  4294967294ULL},
5858         {4294967295.7,  4294967295ULL},
5859         {0.0, 0ULL}
5860     };
5861     for (p = test; p->u; p++) {
5862         myULL x = (myULL)p->d;
5863         if (x != p->u) {
5864             printf("buggy\n");
5865             return 0;
5866         }
5867     }
5868     printf("ok\n");
5869     return 0;
5870 }
5871 EOCP
5872         set try
5873         if eval $compile_ok; then
5874             libcquad=`./try`
5875             echo "Your C library's 64-bit functions are $libcquad."
5876         else
5877             echo "(I can't seem to compile the test program.)"
5878             echo "Assuming that your C library's 64-bit functions are ok."
5879             libcquad="ok"
5880         fi
5881         $rm_try
5882
5883         case "$libcquad" in
5884             buggy*)
5885                 cat >&4 <<EOM
5886
5887 *** You have a C library with broken 64-bit functions.
5888 *** 64-bit support does not work reliably in this configuration.
5889 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5890 *** Cannot continue, aborting.
5891
5892 EOM
5893                 exit 1
5894                 ;;
5895         esac
5896         case "$longsize" in
5897         4) case "$archname64" in
5898            '') archname64=64int ;;
5899            esac
5900            ;;
5901         esac
5902         ;;
5903 esac
5904
5905 : Look for a hint-file generated 'call-back-unit'.  If the
5906 : user has specified that a maximally 64-bit perl is to be built,
5907 : we may need to set or change some other defaults.
5908 if $test -f use64bitall.cbu; then
5909         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5910         . ./use64bitall.cbu
5911 fi
5912 case "$use64bitall" in
5913 "$define"|true|[yY]*)
5914         case "$longsize" in
5915         4) case "$archname64" in
5916            ''|64int) archname64=64all ;;
5917            esac
5918            ;;
5919         esac
5920         ;;
5921 esac
5922
5923 case "$d_quad:$use64bitint" in
5924 $undef:$define)
5925         cat >&4 <<EOF
5926
5927 *** You have chosen to use 64-bit integers,
5928 *** but none can be found.
5929 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5930 *** Cannot continue, aborting.
5931
5932 EOF
5933         exit 1
5934         ;;
5935 esac
5936
5937 : check for length of double
5938 echo " "
5939 case "$doublesize" in
5940 '')
5941         echo "Checking to see how big your double precision numbers are..." >&4
5942         $cat >try.c <<EOCP
5943 #include <stdio.h>
5944 #$i_stdlib I_STDLIB
5945 #ifdef I_STDLIB
5946 #include <stdlib.h>
5947 #endif
5948 int main()
5949 {
5950     printf("%d\n", (int)sizeof(double));
5951     exit(0);
5952 }
5953 EOCP
5954         set try
5955         if eval $compile_ok; then
5956                 doublesize=`$run ./try`
5957                 echo "Your double is $doublesize bytes long."
5958         else
5959                 dflt='8'
5960                 echo "(I can't seem to compile the test program.  Guessing...)"
5961                 rp="What is the size of a double precision number (in bytes)?"
5962                 . ./myread
5963                 doublesize="$ans"
5964         fi
5965         ;;
5966 esac
5967 $rm_try
5968
5969 : check for long doubles
5970 echo " "
5971 echo "Checking to see if you have long double..." >&4
5972 echo 'int main() { long double x = 7.0; }' > try.c
5973 set try
5974 if eval $compile; then
5975         val="$define"
5976         echo "You have long double."
5977 else
5978         val="$undef"
5979         echo "You do not have long double."
5980 fi
5981 $rm_try
5982 set d_longdbl
5983 eval $setvar
5984
5985 : check for length of long double
5986 case "${d_longdbl}${longdblsize}" in
5987 $define)
5988         echo " "
5989         echo "Checking to see how big your long doubles are..." >&4
5990         $cat >try.c <<'EOCP'
5991 #include <stdio.h>
5992 int main()
5993 {
5994         printf("%d\n", sizeof(long double));
5995 }
5996 EOCP
5997         set try
5998         set try
5999         if eval $compile; then
6000                 longdblsize=`$run ./try`
6001                 echo "Your long doubles are $longdblsize bytes long."
6002         else
6003                 dflt='8'
6004                 echo " "
6005                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6006                 rp="What is the size of a long double (in bytes)?"
6007                 . ./myread
6008                 longdblsize="$ans"
6009         fi
6010         if $test "X$doublesize" = "X$longdblsize"; then
6011                 echo "That isn't any different from an ordinary double."
6012                 echo "I'll keep your setting anyway, but you may see some"
6013                 echo "harmless compilation warnings."
6014         fi
6015         ;;
6016 esac
6017 $rm_try
6018
6019 : determine the architecture name
6020 echo " "
6021 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6022         tarch=`arch`"-$osname"
6023 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6024         if uname -m > tmparch 2>&1 ; then
6025                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6026                         -e 's/$/'"-$osname/" tmparch`
6027         else
6028                 tarch="$osname"
6029         fi
6030         $rm -f tmparch
6031 else
6032         tarch="$osname"
6033 fi
6034 case "$myarchname" in
6035 ''|"$tarch") ;;
6036 *)
6037         echo "(Your architecture name used to be $myarchname.)"
6038         archname=''
6039         ;;
6040 esac
6041 case "$targetarch" in
6042 '') ;;
6043 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6044 esac
6045 myarchname="$tarch"
6046 case "$archname" in
6047 '') dflt="$tarch";;
6048 *) dflt="$archname";;
6049 esac
6050 rp='What is your architecture name'
6051 . ./myread
6052 archname="$ans"
6053
6054 : optionally add API version to the architecture for versioned archlibs
6055 case "$useversionedarchname" in
6056 $define|true|[yY]*) dflt='y';;
6057 *)                  dflt='n';;
6058 esac
6059 rp='Add the Perl API version to your archname?'
6060 . ./myread
6061 case "$ans" in
6062 y|Y)    useversionedarchname="$define" ;;
6063 *)      useversionedarchname="$undef" ;;
6064 esac
6065 case "$useversionedarchname" in
6066 $define)
6067         case "$archname" in
6068         *-$api_versionstring)
6069                 echo "...and architecture name already has -$api_versionstring" >&4
6070                 ;;
6071         *)
6072                 archname="$archname-$api_versionstring"
6073                 echo "...setting architecture name to $archname." >&4
6074                 ;;
6075         esac
6076         ;;
6077 esac
6078
6079 case "$usethreads" in
6080 $define)
6081         echo "Threads selected." >&4
6082         case "$archname" in
6083         *-thread*) echo "...and architecture name already has -thread." >&4
6084                 ;;
6085         *)      archname="$archname-thread"
6086                 echo "...setting architecture name to $archname." >&4
6087                 ;;
6088         esac
6089         ;;
6090 esac
6091 case "$usemultiplicity" in
6092 $define)
6093         echo "Multiplicity selected." >&4
6094         case "$archname" in
6095         *-multi*) echo "...and architecture name already has -multi." >&4
6096                 ;;
6097         *)      archname="$archname-multi"
6098                 echo "...setting architecture name to $archname." >&4
6099                 ;;
6100         esac
6101         ;;
6102 esac
6103 case "$use64bitint$use64bitall" in
6104 *"$define"*)
6105         case "$archname64" in
6106         '')
6107                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6108                 ;;
6109         *)
6110                 case "$use64bitint" in
6111                 "$define") echo "64 bit integers selected." >&4 ;;
6112                 esac
6113                 case "$use64bitall" in
6114                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6115                 esac
6116                 case "$archname" in
6117                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6118                         ;;
6119                 *)      archname="$archname-$archname64"
6120                         echo "...setting architecture name to $archname." >&4
6121                         ;;
6122                 esac
6123                 ;;
6124         esac
6125 esac
6126 case "$uselongdouble" in
6127 $define)
6128         echo "Long doubles selected." >&4
6129         case "$longdblsize" in
6130         $doublesize)
6131                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6132                 ;;
6133         *)
6134                 case "$archname" in
6135                 *-ld*) echo "...and architecture name already has -ld." >&4
6136                         ;;
6137                 *)      archname="$archname-ld"
6138                         echo "...setting architecture name to $archname." >&4
6139                         ;;
6140                 esac
6141                 ;;
6142         esac
6143         ;;
6144 esac
6145 if $test -f archname.cbu; then
6146         echo "Your platform has some specific hints for architecture name, using them..."
6147         . ./archname.cbu
6148 fi
6149
6150 : set the prefixit variable, to compute a suitable default value
6151 prefixit='case "$3" in
6152 ""|none)
6153         case "$oldprefix" in
6154         "") eval "$1=\"\$$2\"";;
6155         *)
6156                 case "$3" in
6157                 "") eval "$1=";;
6158                 none)
6159                         eval "tp=\"\$$2\"";
6160                         case "$tp" in
6161                         ""|" ") eval "$1=\"\$$2\"";;
6162                         *) eval "$1=";;
6163                         esac;;
6164                 esac;;
6165         esac;;
6166 *)
6167         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6168         case "$tp" in
6169         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6170         /*-$oldprefix/*|\~*-$oldprefix/*)
6171                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6172         *) eval "$1=\"\$$2\"";;
6173         esac;;
6174 esac'
6175
6176 : determine installation style
6177 : For now, try to deduce it from prefix unless it is already set.
6178 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6179 case "$installstyle" in
6180 '')     case "$prefix" in
6181                 *perl*) dflt='lib';;
6182                 *) dflt='lib/perl5' ;;
6183         esac
6184         ;;
6185 *)      dflt="$installstyle" ;;
6186 esac
6187 : Probably not worth prompting for this since we prompt for all
6188 : the directories individually, and the prompt would be too long and
6189 : confusing anyway.
6190 installstyle=$dflt
6191
6192 : determine where public executables go
6193 echo " "
6194 set dflt bin bin
6195 eval $prefixit
6196 fn=d~
6197 rp='Pathname where the public executables will reside?'
6198 . ./getfile
6199 if $test "X$ansexp" != "X$binexp"; then
6200         installbin=''
6201 fi
6202 prefixvar=bin
6203 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6204 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6205 :     this via initialinstalllocation
6206 . ./setprefixvar
6207
6208 case "$userelocatableinc" in
6209 $define|true|[yY]*)     dflt='y' ;;
6210 *)                      dflt='n' ;;
6211 esac
6212 cat <<EOM
6213
6214 Would you like to build Perl so that the installation is relocatable, so that
6215 library paths in @INC are determined relative to the path of the perl binary?
6216 This is not advised for system Perl installs, or if you need to run setid
6217 scripts or scripts under taint mode.
6218
6219 If this doesn't make any sense to you, just accept the default '$dflt'.
6220 EOM
6221 rp='Use relocatable @INC?'
6222 . ./myread
6223 case "$ans" in
6224 y|Y)    val="$define" ;;
6225 *)      val="$undef"  ;;
6226 esac
6227 set userelocatableinc
6228 eval $setvar
6229
6230 initialinstalllocation="$binexp"
6231 : Default prefix is now "up one level from where the binaries are"
6232 case "$userelocatableinc" in
6233 $define|true|[yY]*)
6234     bin=".../"
6235     binexp=".../"
6236     prefix=".../.."
6237     prefixexp=".../.."
6238     installprefixexp=".../.."
6239     ;;
6240 esac
6241
6242 : determine where private library files go
6243 : Usual default is /usr/local/lib/perl5/$version.
6244 : Also allow things like /opt/perl/lib/$version, since
6245 : /opt/perl/lib/perl5... would be redundant.
6246 : The default "style" setting is made in installstyle.U
6247 case "$installstyle" in
6248 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6249 *)       set dflt privlib lib/$version ;;
6250 esac
6251 eval $prefixit
6252 $cat <<EOM
6253
6254 There are some auxiliary files for $package that need to be put into a
6255 private library directory that is accessible by everyone.
6256
6257 EOM
6258 fn=$binexp
6259 fn=d~+
6260 rp='Pathname where the private library files will reside?'
6261 . ./getfile
6262 prefixvar=privlib
6263 . ./setprefixvar
6264
6265 : set the prefixup variable, to restore leading tilda escape
6266 prefixup='case "$prefixexp" in
6267 "$prefix") ;;
6268 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6269 esac'
6270
6271 : determine where public architecture dependent libraries go
6272 set archlib archlib
6273 eval $prefixit
6274 : privlib default is /usr/local/lib/$package/$version
6275 : archlib default is /usr/local/lib/$package/$version/$archname
6276 : privlib may have an optional trailing /share.
6277 tdflt=`echo $privlib | $sed 's,/share$,,'`
6278 tdflt=$tdflt/$archname
6279 case "$archlib" in
6280 '')     dflt=$tdflt
6281         ;;
6282 *)      dflt="$archlib"
6283     ;;
6284 esac
6285 $cat <<EOM
6286
6287 $spackage contains architecture-dependent library files.  If you are
6288 sharing libraries in a heterogeneous environment, you might store
6289 these files in a separate location.  Otherwise, you can just include
6290 them with the rest of the public library files.
6291
6292 EOM
6293 fn=$binexp
6294 fn=d+~
6295 rp='Where do you want to put the public architecture-dependent libraries?'
6296 . ./getfile
6297 prefixvar=archlib
6298 . ./setprefixvar
6299 if $test X"$archlib" = X"$privlib"; then
6300         d_archlib="$undef"
6301 else
6302         d_archlib="$define"
6303 fi
6304
6305 : see if setuid scripts can be secure
6306 $cat <<EOM
6307
6308 Some kernels have a bug that prevents setuid #! scripts from being
6309 secure.  Some sites have disabled setuid #! scripts because of this.
6310
6311 First let's decide if your kernel supports secure setuid #! scripts.
6312 (If setuid #! scripts would be secure but have been disabled anyway,
6313 don't say that they are secure if asked.)
6314
6315 EOM
6316
6317 val="$undef"
6318 if $test -d /dev/fd; then
6319         echo "#!$ls" >reflect
6320         chmod +x,u+s reflect
6321         ./reflect >flect 2>&1
6322         if $contains "/dev/fd" flect >/dev/null; then
6323                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6324                 val="$define"
6325         else
6326                 $cat <<EOM
6327 If you are not sure if they are secure, I can check but I'll need a
6328 username and password different from the one you are using right now.
6329 If you don't have such a username or don't want me to test, simply
6330 enter 'none'.
6331
6332 EOM
6333                 rp='Other username to test security of setuid scripts with?'
6334                 dflt='none'
6335                 . ./myread
6336                 case "$ans" in
6337                 n|none)
6338                         case "$d_suidsafe" in
6339                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6340                                 dflt=n;;
6341                         "$undef")
6342                                 echo "Well, the $hint value is *not* secure." >&4
6343                                 dflt=n;;
6344                         *)      echo "Well, the $hint value *is* secure." >&4
6345                                 dflt=y;;
6346                         esac
6347                         ;;
6348                 *)
6349                         $rm -f reflect flect
6350                         echo "#!$ls" >reflect
6351                         chmod +x,u+s reflect
6352                         echo >flect
6353                         chmod a+w flect
6354                         echo '"su" will (probably) prompt you for '"$ans's password."
6355                         su $ans -c './reflect >flect'
6356                         if $contains "/dev/fd" flect >/dev/null; then
6357                                 echo "Okay, it looks like setuid scripts are secure." >&4
6358                                 dflt=y
6359                         else
6360                                 echo "I don't think setuid scripts are secure." >&4
6361                                 dflt=n
6362                         fi
6363                         ;;
6364                 esac
6365                 rp='Does your kernel have *secure* setuid scripts?'
6366                 . ./myread
6367                 case "$ans" in
6368                 [yY]*)  val="$define";;
6369                 *)      val="$undef";;
6370                 esac
6371         fi
6372 else
6373         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6374         echo "(That's for file descriptors, not floppy disks.)"
6375         val="$undef"
6376 fi
6377 set d_suidsafe
6378 eval $setvar
6379
6380 $rm -f reflect flect
6381
6382 : now see if they want to do setuid emulation
6383 if $test $patchlevel -lt 11; then
6384 echo " "
6385 val="$undef"
6386 case "$d_suidsafe" in
6387 "$define")
6388         val="$undef"
6389         echo "No need to emulate SUID scripts since they are secure here." >&4
6390         ;;
6391 *)
6392         $cat <<EOM
6393 Some systems have disabled setuid scripts, especially systems where
6394 setuid scripts cannot be secure.  On systems where setuid scripts have
6395 been disabled, the setuid/setgid bits on scripts are currently
6396 useless.  It is possible for $package to detect those bits and emulate
6397 setuid/setgid in a secure fashion.  This emulation will only work if
6398 setuid scripts have been disabled in your kernel.
6399
6400 EOM
6401         case "$d_dosuid" in
6402         "$define") dflt=y ;;
6403         *) dflt=n ;;
6404         esac
6405         rp="Do you want to do setuid/setgid emulation?"
6406         . ./myread
6407         case "$ans" in
6408         [yY]*)  val="$define";;
6409         *)      val="$undef";;
6410         esac
6411         ;;
6412 esac
6413 set d_dosuid
6414 eval $setvar
6415 else
6416     case "$d_dosuid" in
6417         "$define")
6418         cat >&4 <<EOH
6419
6420 SUID emulation has been removed for 5.12
6421 Please re-run Configure without -Dd_dosuid
6422
6423 EOH
6424         exit 1;
6425         ;;
6426     esac
6427     d_dosuid=undef
6428 fi
6429
6430 : Find perl5.005 or later.
6431 echo "Looking for a previously installed perl5.005 or later... "
6432 case "$perl5" in
6433 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6434                 : Check if this perl is recent and can load a simple module
6435                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6436                         perl5=$tdir/perl
6437                         break;
6438                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6439                         perl5=$tdir/perl5
6440                         break;
6441                 fi
6442         done
6443         ;;
6444 *)      perl5="$perl5"
6445         ;;
6446 esac
6447 case "$perl5" in
6448 '')     echo "None found.  That's ok.";;
6449 *)      echo "Using $perl5." ;;
6450 esac
6451
6452 : Set the siteprefix variables
6453 $cat <<EOM
6454
6455 After $package is installed, you may wish to install various
6456 add-on modules and utilities.  Typically, these add-ons will
6457 be installed under $prefix with the rest
6458 of this package.  However, you may wish to install such add-ons
6459 elsewhere under a different prefix.
6460
6461 If you do not wish to put everything under a single prefix, that's
6462 ok.  You will be prompted for the individual locations; this siteprefix
6463 is only used to suggest the defaults.
6464
6465 The default should be fine for most people.
6466
6467 EOM
6468 fn=d~+
6469 rp='Installation prefix to use for add-on modules and utilities?'
6470 : XXX Here might be another good place for an installstyle setting.
6471 case "$siteprefix" in
6472 '') dflt=$prefix ;;
6473 *)  dflt=$siteprefix ;;
6474 esac
6475 . ./getfile
6476 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6477 oldsiteprefix=''
6478 case "$siteprefix" in
6479 '') ;;
6480 *)      case "$ans" in
6481         "$prefix") ;;
6482         *) oldsiteprefix="$prefix";;
6483         esac
6484         ;;
6485 esac
6486 siteprefix="$ans"
6487 siteprefixexp="$ansexp"
6488
6489 : determine where site specific libraries go.
6490 : Usual default is /usr/local/lib/perl5/site_perl/$version
6491 : The default "style" setting is made in installstyle.U
6492 : XXX No longer works with Prefixit stuff.
6493 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6494 case "$sitelib" in
6495 '') case "$installstyle" in
6496         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6497         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6498         esac
6499         ;;
6500 *)      dflt="$sitelib"
6501         ;;
6502 esac
6503 $cat <<EOM
6504
6505 The installation process will create a directory for
6506 site-specific extensions and modules.  Most users find it convenient
6507 to place all site-specific files in this directory rather than in the
6508 main distribution directory.
6509
6510 EOM
6511 fn=d~+
6512 rp='Pathname for the site-specific library files?'
6513 . ./getfile
6514 prefixvar=sitelib
6515 . ./setprefixvar
6516 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6517
6518 : Determine list of previous versions to include in @INC
6519 $cat > getverlist <<EOPL
6520 #!$perl5 -w
6521 use File::Basename;
6522 \$api_versionstring = "$api_versionstring";
6523 \$version = "$version";
6524 \$stem = "$sitelib_stem";
6525 \$archname = "$archname";
6526 EOPL
6527         $cat >> getverlist <<'EOPL'
6528 # The list found is store twice for each entry: the original name, and
6529 # the binary broken down version as pack "sss", so sorting is easy and
6530 # unambiguous. This will work for all versions that have a maximum of
6531 # three digit groups, separate by '.'s or '_'s. Names are extended with
6532 # ".0.0" to ensure at least three elements for the pack.
6533 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6534
6535 # Can't have leading @ because metaconfig interprets it as a command!
6536 ;@inc_version_list=();
6537 # XXX Redo to do opendir/readdir?
6538 if (-d $stem) {
6539     chdir($stem);
6540     ;@candidates = map {
6541         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6542     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6543 }
6544 else {
6545     ;@candidates = ();
6546 }
6547
6548 ($pversion, $aversion, $vsn5005) = map {
6549     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6550 foreach $d (@candidates) {
6551     if ($d->[1] lt $pversion) {
6552         if ($d->[1] ge $aversion) {
6553             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6554         }
6555         elsif ($d->[1] ge $vsn5005) {
6556             unshift(@inc_version_list, grep { -d } $d->[0]);
6557         }
6558     }
6559     else {
6560         # Skip newer version.  I.e. don't look in
6561         # 5.7.0 if we're installing 5.6.1.
6562     }
6563 }
6564
6565 if (@inc_version_list) {
6566     print join(' ', @inc_version_list);
6567 }
6568 else {
6569     # Blank space to preserve value for next Configure run.
6570     print " ";
6571 }
6572 EOPL
6573 chmod +x getverlist
6574 case "$inc_version_list" in
6575 '')     if test -x "$perl5$exe_ext"; then
6576                 dflt=`$perl5 getverlist`
6577         else
6578                 dflt='none'
6579         fi
6580         ;;
6581 $undef) dflt='none' ;;
6582 *)  eval dflt=\"$inc_version_list\" ;;
6583 esac
6584 case "$dflt" in
6585 ''|' ') dflt=none ;;
6586 esac
6587 case "$dflt" in
6588 5.005) dflt=none ;;
6589 esac
6590 $cat <<EOM
6591
6592 In order to ease the process of upgrading, this version of perl
6593 can be configured to use modules built and installed with earlier
6594 versions of perl that were installed under $prefix.  Specify here
6595 the list of earlier versions that this version of perl should check.
6596 If Configure detected no earlier versions of perl installed under
6597 $prefix, then the list will be empty.  Answer 'none' to tell perl
6598 to not search earlier versions.
6599
6600 The default should almost always be sensible, so if you're not sure,
6601 just accept the default.
6602 EOM
6603
6604 rp='List of earlier versions to include in @INC?'
6605 . ./myread
6606 case "$ans" in
6607 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6608 *) inc_version_list="$ans" ;;
6609 esac
6610 case "$inc_version_list" in
6611 ''|' ')
6612         inc_version_list_init='0'
6613         d_inc_version_list="$undef"
6614         ;;
6615 *)      inc_version_list_init=`echo $inc_version_list |
6616                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6617         d_inc_version_list="$define"
6618         ;;
6619 esac
6620 $rm -f getverlist
6621
6622 : see if malloc/malloc.h has to be included
6623 set malloc/malloc.h i_mallocmalloc
6624 eval $inhdr
6625
6626 : see if this is a malloc.h system
6627 : we want a real compile instead of Inhdr because some systems have a
6628 : malloc.h that just gives a compile error saying to use stdlib.h instead
6629 echo " "
6630 $cat >try.c <<EOCP
6631 #include <stdlib.h>
6632 #include <malloc.h>
6633 #$i_mallocmalloc I_MALLOCMALLOC
6634 #ifdef I_MALLOCMALLOC
6635 # include <malloc/malloc.h>
6636 #endif
6637
6638 int main () { return 0; }
6639 EOCP
6640 set try
6641 if eval $compile; then
6642     echo "<malloc.h> found." >&4
6643     val="$define"
6644 else
6645     echo "<malloc.h> NOT found." >&4
6646     val="$undef"
6647 fi
6648 $rm_try
6649 set i_malloc
6650 eval $setvar
6651
6652 : check for length of pointer
6653 echo " "
6654 case "$ptrsize" in
6655 '')
6656         echo "Checking to see how big your pointers are..." >&4
6657         $cat >>try.c <<EOCP
6658 #include <stdio.h>
6659 #$i_stdlib I_STDLIB
6660 #ifdef I_STDLIB
6661 #include <stdlib.h>
6662 #endif
6663 int main()
6664 {
6665     printf("%d\n", (int)sizeof(void *));
6666     exit(0);
6667 }
6668 EOCP
6669         set try
6670         if eval $compile_ok; then
6671                 ptrsize=`$run ./try`
6672                 echo "Your pointers are $ptrsize bytes long."
6673         else
6674                 dflt='4'
6675                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6676                 rp="What is the size of a pointer (in bytes)?"
6677                 . ./myread
6678                 ptrsize="$ans"
6679         fi
6680         ;;
6681 esac
6682 $rm_try
6683 case "$use64bitall" in
6684 "$define"|true|[yY]*)
6685         case "$ptrsize" in
6686         4)      cat <<EOM >&4
6687
6688 *** You have chosen a maximally 64-bit build,
6689 *** but your pointers are only 4 bytes wide.
6690 *** Please rerun Configure without -Duse64bitall.
6691 EOM
6692                 case "$d_quad" in
6693                 define)
6694                         cat <<EOM >&4
6695 *** Since you have quads, you could possibly try with -Duse64bitint.
6696 EOM
6697                         ;;
6698                 esac
6699                 cat <<EOM >&4
6700 *** Cannot continue, aborting.
6701
6702 EOM
6703
6704                 exit 1
6705                 ;;
6706         esac
6707         ;;
6708 esac
6709
6710
6711 : determine whether to use malloc wrapping
6712 echo " "
6713 case "$usemallocwrap" in
6714 [yY]*|true|$define)     dflt='y' ;;
6715 [nN]*|false|$undef)     dflt='n' ;;
6716 *)      case "$usedevel" in
6717         [yY]*|true|$define)     dflt='y' ;;
6718         *) dflt='n' ;;
6719         esac
6720         ;;
6721 esac
6722 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6723 . ./myread
6724 usemallocwrap="$ans"
6725 case "$ans" in
6726 y*|true)
6727         usemallocwrap="$define" ;;
6728 *)
6729         usemallocwrap="$undef" ;;
6730 esac
6731
6732 : determine which malloc to compile in
6733 echo " "
6734 case "$usemymalloc" in
6735 [yY]*|true|$define)     dflt='y' ;;
6736 [nN]*|false|$undef)     dflt='n' ;;
6737 *)      case "$ptrsize" in
6738         4) dflt='y' ;;
6739         *) dflt='n' ;;
6740         esac
6741         if test "$useithreads" = "$define"; then dflt='n'; fi
6742         ;;
6743 esac
6744 rp="Do you wish to attempt to use the malloc that comes with $package?"
6745 . ./myread
6746 usemymalloc="$ans"
6747 case "$ans" in
6748 y*|true)
6749         usemymalloc='y'
6750         mallocsrc='malloc.c'
6751         mallocobj="malloc$_o"
6752         d_mymalloc="$define"
6753         case "$libs" in
6754         *-lmalloc*)
6755                 : Remove malloc from list of libraries to use
6756                 echo "Removing unneeded -lmalloc from library list" >&4
6757                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6758                 shift
6759                 libs="$*"
6760                 echo "libs = $libs" >&4
6761                 ;;
6762         esac
6763         ;;
6764 *)
6765         usemymalloc='n'
6766         mallocsrc=''
6767         mallocobj=''
6768         d_mymalloc="$undef"
6769         ;;
6770 esac
6771
6772 : compute the return types of malloc and free
6773 echo " "
6774 $cat >malloc.c <<END
6775 #$i_malloc I_MALLOC
6776 #$i_stdlib I_STDLIB
6777 #include <stdio.h>
6778 #include <sys/types.h>
6779 #ifdef I_MALLOC
6780 #include <malloc.h>
6781 #endif
6782 #ifdef I_STDLIB
6783 #include <stdlib.h>
6784 #endif
6785 #ifdef TRY_MALLOC
6786 void *malloc();
6787 #endif
6788 #ifdef TRY_FREE
6789 void free();
6790 #endif
6791 END
6792 case "$malloctype" in
6793 '')
6794         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6795                 malloctype='void *'
6796         else
6797                 malloctype='char *'
6798         fi
6799         ;;
6800 esac
6801 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6802
6803 case "$freetype" in
6804 '')
6805         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6806                 freetype='void'
6807         else
6808                 freetype='int'
6809         fi
6810         ;;
6811 esac
6812 echo "Your system uses $freetype free(), it would seem." >&4
6813 $rm -f malloc.[co]
6814 : determine where site specific architecture-dependent libraries go.
6815 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6816 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6817 : sitelib may have an optional trailing /share.
6818 case "$sitearch" in
6819 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6820         dflt="$dflt/$archname"
6821         ;;
6822 *)      dflt="$sitearch"
6823         ;;
6824 esac
6825 set sitearch sitearch none
6826 eval $prefixit
6827 $cat <<EOM
6828
6829 The installation process will also create a directory for
6830 architecture-dependent site-specific extensions and modules.
6831
6832 EOM
6833 fn=d~+
6834 rp='Pathname for the site-specific architecture-dependent library files?'
6835 . ./getfile
6836 prefixvar=sitearch
6837 . ./setprefixvar
6838 if $test X"$sitearch" = X"$sitelib"; then
6839         d_sitearch="$undef"
6840 else
6841         d_sitearch="$define"
6842 fi
6843
6844 : Set the vendorprefix variables
6845 $cat <<EOM
6846
6847 The installation process will also create a directory for
6848 vendor-supplied add-ons.  Vendors who supply perl with their system
6849 may find it convenient to place all vendor-supplied files in this
6850 directory rather than in the main distribution directory.  This will
6851 ease upgrades between binary-compatible maintenance versions of perl.
6852
6853 Of course you may also use these directories in whatever way you see
6854 fit.  For example, you might use them to access modules shared over a
6855 company-wide network.
6856
6857 The default answer should be fine for most people.
6858 This causes further questions about vendor add-ons to be skipped
6859 and no vendor-specific directories will be configured for perl.
6860
6861 EOM
6862 rp='Do you want to configure vendor-specific add-on directories?'
6863 case "$usevendorprefix" in
6864 define|true|[yY]*) dflt=y ;;
6865 *)      : User may have set vendorprefix directly on Configure command line.
6866         case "$vendorprefix" in
6867         ''|' ') dflt=n ;;
6868         *)      dflt=y ;;
6869         esac
6870         ;;
6871 esac
6872 . ./myread
6873 case "$ans" in
6874 [yY]*)  fn=d~+
6875         rp='Installation prefix to use for vendor-supplied add-ons?'
6876         case "$vendorprefix" in
6877         '') dflt="$prefix" ;;
6878         *)  dflt=$vendorprefix ;;
6879         esac
6880         . ./getfile
6881         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6882         oldvendorprefix=''
6883         case "$vendorprefix" in
6884         '') ;;
6885         *)      case "$ans" in
6886                 "$prefix") ;;
6887                 *) oldvendorprefix="$prefix";;
6888                 esac
6889                 ;;
6890         esac
6891         usevendorprefix="$define"
6892         vendorprefix="$ans"
6893         vendorprefixexp="$ansexp"
6894         ;;
6895 *)      usevendorprefix="$undef"
6896         vendorprefix=''
6897         vendorprefixexp=''
6898         ;;
6899 esac
6900
6901 : Set the vendorlib variables
6902 case "$vendorprefix" in
6903 '')     d_vendorlib="$undef"
6904         vendorlib=''
6905         vendorlibexp=''
6906         ;;
6907 *)      d_vendorlib="$define"
6908         : determine where vendor-supplied modules go.
6909         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6910         case "$vendorlib" in
6911         '')
6912                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6913                 case "$installstyle" in
6914                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6915                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6916                 esac
6917                 ;;
6918         *)      dflt="$vendorlib"
6919                 ;;
6920         esac
6921         fn=d~+
6922         rp='Pathname for the vendor-supplied library files?'
6923         . ./getfile
6924         vendorlib="$ans"
6925         vendorlibexp="$ansexp"
6926         ;;
6927 esac
6928 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6929 prefixvar=vendorlib
6930 . ./installprefix
6931
6932 : Set the vendorarch variables
6933 case "$vendorprefix" in
6934 '')     d_vendorarch="$undef"
6935         vendorarch=''
6936         vendorarchexp=''
6937         ;;
6938 *)      d_vendorarch="$define"
6939         : determine where vendor-supplied architecture-dependent libraries go.
6940         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6941         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6942         : vendorlib may have an optional trailing /share.
6943         case "$vendorarch" in
6944         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6945                 dflt="$dflt/$archname"
6946                 ;;
6947         *)      dflt="$vendorarch" ;;
6948         esac
6949         fn=d~+
6950         rp='Pathname for vendor-supplied architecture-dependent files?'
6951         . ./getfile
6952         vendorarch="$ans"
6953         vendorarchexp="$ansexp"
6954         ;;
6955 esac
6956 prefixvar=vendorarch
6957 . ./installprefix
6958 if $test X"$vendorarch" = X"$vendorlib"; then
6959         d_vendorarch="$undef"
6960 else
6961         d_vendorarch="$define"
6962 fi
6963
6964 : Final catch-all directories to search
6965 $cat <<EOM
6966
6967 Lastly, you can have perl look in other directories for extensions and
6968 modules in addition to those already specified.
6969 These directories will be searched after
6970         $sitearch
6971         $sitelib
6972 EOM
6973 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6974 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6975 echo ' '
6976 case "$otherlibdirs" in
6977 ''|' ') dflt='none' ;;
6978 *)      dflt="$otherlibdirs" ;;
6979 esac
6980 $cat <<EOM
6981 Enter a colon-separated set of extra paths to include in perl's @INC
6982 search path, or enter 'none' for no extra paths.
6983
6984 EOM
6985
6986 rp='Colon-separated list of additional directories for perl to search?'
6987 . ./myread
6988 case "$ans" in
6989 ' '|''|none)    otherlibdirs=' ' ;;
6990 *)      otherlibdirs="$ans" ;;
6991 esac
6992 case "$otherlibdirs" in
6993 ' ') val=$undef ;;
6994 *)      val=$define ;;
6995 esac
6996 set d_perl_otherlibdirs
6997 eval $setvar
6998
6999 : Cruising for prototypes
7000 echo " "
7001 echo "Checking out function prototypes..." >&4
7002 $cat >prototype.c <<EOCP
7003 #$i_stdlib I_STDLIB
7004 #ifdef I_STDLIB
7005 #include <stdlib.h>
7006 #endif
7007 int main(int argc, char *argv[]) {
7008         exit(0);}
7009 EOCP
7010 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7011         echo "Your C compiler appears to support function prototypes."
7012         val="$define"
7013 else
7014         echo "Your C compiler doesn't seem to understand function prototypes."
7015         val="$undef"
7016 fi
7017 set prototype
7018 eval $setvar
7019 $rm -f prototype*
7020
7021 : Check if ansi2knr is required
7022 case "$prototype" in
7023 "$define") ;;
7024 *)      ansi2knr='ansi2knr'
7025         echo " "
7026         cat <<EOM >&4
7027
7028 $me:  FATAL ERROR:
7029 This version of $package can only be compiled by a compiler that 
7030 understands function prototypes.  Unfortunately, your C compiler 
7031         $cc $ccflags
7032 doesn't seem to understand them.  Sorry about that.
7033
7034 If GNU cc is available for your system, perhaps you could try that instead.  
7035
7036 Eventually, we hope to support building Perl with pre-ANSI compilers.
7037 If you would like to help in that effort, please contact <perlbug@perl.org>.
7038
7039 Aborting Configure now.
7040 EOM
7041         exit 2
7042         ;;
7043 esac
7044
7045 : DTrace support
7046 dflt_dtrace='/usr/sbin/dtrace'
7047 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7048
7049 cat <<EOM
7050
7051 Perl can be built to support DTrace on platforms that support it.
7052 DTrace is a diagnosis and performance analysis tool from Sun.
7053
7054 If this doesn't make any sense to you, just accept the default '$dflt'.
7055 EOM
7056
7057 while $test 1 ; do
7058         case "$usedtrace" in
7059         $define|true|[yY]*)
7060                 dflt='y'
7061                 ;;
7062         ?*)
7063                 dflt='y'
7064                 dflt_dtrace=$usedtrace
7065                 ;;
7066         *)
7067                 dflt='n'
7068                 ;;
7069         esac
7070
7071         rp='Support DTrace if available?'
7072         . ./myread
7073         case "$ans" in
7074         y|Y)    val="$define" ;;
7075         *)      val="$undef" ;;
7076         esac
7077         set usedtrace
7078         eval $setvar
7079
7080         test "X$usedtrace" != "X$define" && break
7081
7082         echo " "
7083         rp='Where is the dtrace executable?'
7084         dflt=$dflt_dtrace
7085         . ./getfile
7086         val="$ans"
7087         set dtrace
7088         eval $setvar
7089
7090         if $test -f $dtrace
7091         then
7092                 if $dtrace -h -s ../perldtrace.d \
7093                         -o perldtrace.tmp >/dev/null 2>&1 \
7094                         && rm -f perldtrace.tmp
7095                 then
7096                         echo " "
7097                         echo "Good: your $dtrace knows about the -h flag."
7098                 else
7099                         cat >&2 <<EOM
7100
7101 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7102 ***
7103 *** Your installed dtrace doesn't support the -h switch to compile a D
7104 *** program into a C header. Can't continue.
7105
7106 EOM
7107                         exit 1
7108                 fi
7109                 break;
7110         fi
7111
7112         case "$fastread" in
7113         yes)
7114                 cat >&2 <<EOM
7115
7116 *** $me:  Fatal Error:  $dtrace not found.
7117 *** Can't continue.
7118
7119 EOM
7120                 exit 1
7121                 ;;
7122         *)
7123                 echo "*** $dtrace was not found."
7124                 echo " "
7125                 ;;
7126         esac
7127 done
7128
7129 : See if we want extra modules installed
7130 echo " "
7131 case "$extras" in
7132 '') dflt='n';;
7133 *) dflt='y';;
7134 esac
7135 cat <<EOM
7136 Perl can be built with extra modules or bundles of modules which
7137 will be fetched from the CPAN and installed alongside Perl.
7138
7139 Notice that you will need access to the CPAN; either via the Internet,
7140 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7141 be asked later to configure the CPAN.pm module which will in turn do
7142 the installation of the rest of the extra modules or bundles.)
7143
7144 Notice also that if the modules require any external software such as
7145 libraries and headers (the libz library and the zlib.h header for the
7146 Compress::Zlib module, for example) you MUST have any such software
7147 already installed, this configuration process will NOT install such
7148 things for you.
7149
7150 If this doesn't make any sense to you, just accept the default '$dflt'.
7151 EOM
7152 rp='Install any extra modules (y or n)?'
7153 . ./myread
7154 case "$ans" in
7155 y|Y)
7156         cat <<EOM
7157
7158 Please list any extra modules or bundles to be installed from CPAN,
7159 with spaces between the names.  The names can be in any format the
7160 'install' command of CPAN.pm will understand.  (Answer 'none',
7161 without the quotes, to install no extra modules or bundles.)
7162 EOM
7163         rp='Extras?'
7164         dflt="$extras"
7165         . ./myread
7166         extras="$ans"
7167 esac
7168 case "$extras" in
7169 ''|'none')
7170         val=''
7171         $rm -f ../extras.lst
7172         ;;
7173 *)      echo "(Saving the list of extras for later...)"
7174         echo "$extras" > ../extras.lst
7175         val="'$extras'"
7176         ;;
7177 esac
7178 set extras
7179 eval $setvar
7180 echo " "
7181
7182 : determine where html pages for programs go
7183 set html1dir html1dir none
7184 eval $prefixit
7185 $cat <<EOM
7186
7187 If you wish to install html files for programs in $spackage, indicate
7188 the appropriate directory here.  To skip installing html files,
7189 answer "none".
7190 EOM
7191 case "$html1dir" in
7192 ''|none|$undef|' ') dflt=none ;;
7193 *) dflt=$html1dir ;;
7194 esac
7195 fn=dn+~
7196 rp="Directory for the main $spackage html pages?"
7197 . ./getfile
7198 prefixvar=html1dir
7199 . ./setprefixvar
7200 : Use ' ' for none so value is preserved next time through Configure
7201 $test X"$html1dir" = "X" && html1dir=' '
7202
7203 : determine where html pages for libraries and modules go
7204 set html3dir html3dir none
7205 eval $prefixit
7206 $cat <<EOM
7207
7208 If you wish to install html files for modules associated with $spackage,
7209 indicate the appropriate directory here.  To skip installing html files,
7210 answer "none".
7211 EOM
7212 : There is no obvious default.  If they have specified html1dir, then
7213 : try to key off that, possibly changing .../html1 into .../html3.
7214 case "$html3dir" in
7215 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7216 *) dflt=$html3dir ;;
7217 esac
7218 fn=dn+~
7219 rp="Directory for the $spackage module html pages?"
7220 . ./getfile
7221 prefixvar=html3dir
7222 . ./setprefixvar
7223 : Use ' ' for none so value is preserved next time through Configure
7224 $test X"$html3dir" = "X" && html3dir=' '
7225
7226 : determine whether to install perl also as /usr/bin/perl
7227
7228 echo " "
7229 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7230         $cat <<EOM
7231 Many scripts expect perl to be installed as /usr/bin/perl.
7232
7233 If you want to, I can install the perl you are about to compile
7234 as /usr/bin/perl (in addition to $bin/perl).
7235 EOM
7236         if test -f /usr/bin/perl; then
7237             $cat <<EOM
7238
7239 However, please note that because you already have a /usr/bin/perl,
7240 overwriting that with a new Perl would very probably cause problems.
7241 Therefore I'm assuming you don't want to do that (unless you insist).
7242
7243 EOM
7244             case "$installusrbinperl" in
7245             "$define"|[yY]*)    dflt='y';;
7246             *)                  dflt='n';;
7247             esac
7248         else
7249             $cat <<EOM
7250
7251 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7252
7253 EOM
7254             case "$installusrbinperl" in
7255             "$undef"|[nN]*)     dflt='n';;
7256             *)                  dflt='y';;
7257             esac
7258         fi
7259         rp="Do you want to install perl as /usr/bin/perl?"
7260         . ./myread
7261         case "$ans" in
7262         [yY]*)  val="$define";;
7263         *)      val="$undef" ;;
7264         esac
7265 else
7266         val="$undef"
7267 fi
7268 set installusrbinperl
7269 eval $setvar
7270
7271 : Check if we are using the GNU C library
7272 echo " "
7273 echo "Checking for GNU C Library..." >&4
7274 cat >try.c <<'EOCP'
7275 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7276    alone are insufficient to distinguish different versions, such as
7277    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7278    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7279 */
7280 #include <stdio.h>
7281 int main(void)
7282 {
7283 #ifdef __GLIBC__
7284 #   ifdef __GLIBC_MINOR__
7285 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7286 #           include <gnu/libc-version.h>
7287             printf("%s\n",  gnu_get_libc_version());
7288 #       else
7289             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7290 #       endif
7291 #   else
7292         printf("%d\n",  __GLIBC__);
7293 #   endif
7294     return 0;
7295 #else
7296     return 1;
7297 #endif
7298 }
7299 EOCP
7300 set try
7301 if eval $compile_ok && $run ./try > glibc.ver; then
7302         val="$define"
7303         gnulibc_version=`$cat glibc.ver`
7304         echo "You are using the GNU C Library version $gnulibc_version"
7305 else
7306         val="$undef"
7307         gnulibc_version=''
7308         echo "You are not using the GNU C Library"
7309 fi
7310 $rm_try glibc.ver
7311 set d_gnulibc
7312 eval $setvar
7313
7314 : see if nm is to be used to determine whether a symbol is defined or not
7315 case "$usenm" in
7316 '')
7317         dflt=''
7318         case "$d_gnulibc" in
7319         "$define")
7320                 echo " "
7321                 echo "nm probably won't work on the GNU C Library." >&4
7322                 dflt=n
7323                 ;;
7324         esac
7325         case "$dflt" in
7326         '')
7327                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7328                         echo " "
7329                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7330                         echo "'nm' won't be sufficient on this system." >&4
7331                         dflt=n
7332                 fi
7333                 ;;
7334         esac
7335         case "$dflt" in
7336         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7337                 if $test $dflt -gt 20; then
7338                         dflt=y
7339                 else
7340                         dflt=n
7341                 fi
7342                 ;;
7343         esac
7344         ;;
7345 *)
7346         case "$usenm" in
7347         true|$define) dflt=y;;
7348         *) dflt=n;;
7349         esac
7350         ;;
7351 esac
7352 $cat <<EOM
7353
7354 I can use $nm to extract the symbols from your C libraries. This
7355 is a time consuming task which may generate huge output on the disk (up
7356 to 3 megabytes) but that should make the symbols extraction faster. The
7357 alternative is to skip the 'nm' extraction part and to compile a small
7358 test program instead to determine whether each symbol is present. If
7359 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7360 this may be the best solution.
7361
7362 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7363
7364 EOM
7365 rp="Shall I use $nm to extract C symbols from the libraries?"
7366 . ./myread
7367 case "$ans" in
7368 [Nn]*) usenm=false;;
7369 *) usenm=true;;
7370 esac
7371
7372 runnm=$usenm
7373 case "$reuseval" in
7374 true) runnm=false;;
7375 esac
7376
7377 : nm options which may be necessary
7378 case "$nm_opt" in
7379 '') if $test -f /mach_boot; then
7380                 nm_opt=''       # Mach
7381         elif $test -d /usr/ccs/lib; then
7382                 nm_opt='-p'     # Solaris (and SunOS?)
7383         elif $test -f /dgux; then
7384                 nm_opt='-p'     # DG-UX
7385         elif $test -f /lib64/rld; then
7386                 nm_opt='-p'     # 64-bit Irix
7387         else
7388                 nm_opt=''
7389         fi;;
7390 esac
7391
7392 : nm options which may be necessary for shared libraries but illegal
7393 : for archive libraries.  Thank you, Linux.
7394 case "$nm_so_opt" in
7395 '')     case "$myuname" in
7396         *linux*|gnu*)
7397                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7398                         nm_so_opt='--dynamic'
7399                 fi
7400                 ;;
7401         esac
7402         ;;
7403 esac
7404
7405 : Figure out where the libc is located
7406 case "$runnm" in
7407 true)
7408 : get list of predefined functions in a handy place
7409 echo " "
7410 case "$libc" in
7411 '') libc=unknown
7412         case "$libs" in
7413         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7414         esac
7415         ;;
7416 esac
7417 case "$libs" in
7418 '') ;;
7419 *)  for thislib in $libs; do
7420         case "$thislib" in
7421         -lc|-lc_s)
7422                 : Handle C library specially below.
7423                 ;;
7424         -l*)
7425                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7426                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7427                         :
7428                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7429                         :
7430                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7431                         :
7432                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7433                         :
7434                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7435                         :
7436                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7437                         :
7438                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7439                         :
7440                 else
7441                         try=''
7442                 fi
7443                 libnames="$libnames $try"
7444                 ;;
7445         *) libnames="$libnames $thislib" ;;
7446         esac
7447         done
7448         ;;
7449 esac
7450 xxx=normal
7451 case "$libc" in
7452 unknown)
7453         set /lib/libc.$so
7454         for xxx in $libpth; do
7455                 $test -r $1 || set $xxx/libc.$so
7456                 : The messy sed command sorts on library version numbers.
7457                 $test -r $1 || \
7458                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7459                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7460                                 h
7461                                 s/[0-9][0-9]*/0000&/g
7462                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7463                                 G
7464                                 s/\n/ /' | \
7465                          $sort | $sed -e 's/^.* //'`
7466                 eval set \$$#
7467         done
7468         $test -r $1 || set /usr/ccs/lib/libc.$so
7469         $test -r $1 || set /lib/libsys_s$_a
7470         ;;
7471 *)
7472         set blurfl
7473         ;;
7474 esac
7475 if $test -r "$1"; then
7476         echo "Your (shared) C library seems to be in $1."
7477         libc="$1"
7478 elif $test -r /lib/libc && $test -r /lib/clib; then
7479         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7480         xxx=apollo
7481         libc='/lib/clib /lib/libc'
7482         if $test -r /lib/syslib; then
7483                 echo "(Your math library is in /lib/syslib.)"
7484                 libc="$libc /lib/syslib"
7485         fi
7486 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7487         echo "Your C library seems to be in $libc, as you said before."
7488 elif $test -r $incpath/usr/lib/libc$_a; then
7489         libc=$incpath/usr/lib/libc$_a;
7490         echo "Your C library seems to be in $libc.  That's fine."
7491 elif $test -r /lib/libc$_a; then
7492         libc=/lib/libc$_a;
7493         echo "Your C library seems to be in $libc.  You're normal."
7494 else
7495         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7496                 :
7497         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7498                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7499         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7500                 :
7501         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7502                 :
7503         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7504                 :
7505         else
7506                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7507         fi
7508         if $test -r "$tans"; then
7509                 echo "Your C library seems to be in $tans, of all places."
7510                 libc=$tans
7511         else
7512                 libc='blurfl'
7513         fi
7514 fi
7515 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7516         dflt="$libc"
7517         cat <<EOM
7518
7519 If the guess above is wrong (which it might be if you're using a strange
7520 compiler, or your machine supports multiple models), you can override it here.
7521
7522 EOM
7523 else
7524         dflt=''
7525         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7526         cat >&4 <<EOM
7527 I can't seem to find your C library.  I've looked in the following places:
7528
7529 EOM
7530         $sed 's/^/      /' libpath
7531         cat <<EOM
7532
7533 None of these seems to contain your C library. I need to get its name...
7534
7535 EOM
7536 fi
7537 fn=f
7538 rp='Where is your C library?'
7539 . ./getfile
7540 libc="$ans"
7541
7542 echo " "
7543 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7544 set X `cat libnames`
7545 shift
7546 xxx=files
7547 case $# in 1) xxx=file; esac
7548 echo "Extracting names from the following $xxx for later perusal:" >&4
7549 echo " "
7550 $sed 's/^/      /' libnames >&4
7551 echo " "
7552 $echo $n "This may take a while...$c" >&4
7553
7554 for file in $*; do
7555         case $file in
7556         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7557         *) $nm $nm_opt $file 2>/dev/null;;
7558         esac
7559 done >libc.tmp
7560
7561 $echo $n ".$c"
7562 $grep fprintf libc.tmp > libc.ptf
7563 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7564 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7565 xxx='[ADTSIWi]'
7566 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7567         eval $xscan;\
7568         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7569                 eval $xrun
7570 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7571         eval $xscan;\
7572         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7573                 eval $xrun
7574 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7575         eval $xscan;\
7576         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7577                 eval $xrun
7578 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7579         eval $xscan;\
7580         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7581                 eval $xrun
7582 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7583         eval $xscan;\
7584         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7585                 eval $xrun
7586 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7587         eval $xscan;\
7588         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7589                 eval $xrun
7590 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7591                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7592         eval $xscan;\
7593         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7594                 eval $xrun
7595 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7596         eval $xscan;\
7597         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7598                 eval $xrun
7599 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7600         eval $xscan;\
7601         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7602                 eval $xrun
7603 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7604         eval $xscan;\
7605         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7606                 eval $xrun
7607 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7608         eval $xscan;\
7609         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7610                 eval $xrun
7611 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7612         eval $xscan;\
7613         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7614                 eval $xrun
7615 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7616         eval $xscan;\
7617         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7618                 eval $xrun
7619 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7620         eval $xscan;\
7621         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7622                 eval $xrun
7623 else
7624         $nm -p $* 2>/dev/null >libc.tmp
7625         $grep fprintf libc.tmp > libc.ptf
7626         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7627                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7628         then
7629                 nm_opt='-p'
7630                 eval $xrun
7631         else
7632                 echo " "
7633                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7634                 com=''
7635                 if $ar t $libc > libc.tmp && \
7636                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7637                 then
7638                         for thisname in $libnames $libc; do
7639                                 $ar t $thisname >>libc.tmp
7640                         done
7641                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7642                         echo "Ok." >&4
7643                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7644                         for thisname in $libnames $libc; do
7645                                 $ar tv $thisname >>libc.tmp
7646                                 emximp -o tmp.imp $thisname \
7647                                     2>/dev/null && \
7648                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7649                                     < tmp.imp >>libc.tmp
7650                                 $rm -f tmp.imp
7651                         done
7652                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7653                         echo "Ok." >&4
7654                 else
7655                         echo "$ar didn't seem to work right." >&4
7656                         echo "Maybe this is a Cray...trying bld instead..." >&4
7657                         if  bld t $libc | \
7658                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7659                                 $test -s libc.list
7660                         then
7661                                 for thisname in $libnames; do
7662                                         bld t $libnames | \
7663                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7664                                         $ar t $thisname >>libc.tmp
7665                                 done
7666                                 echo "Ok." >&4
7667                         else
7668                                 echo "That didn't work either.  Giving up." >&4
7669                                 exit 1
7670                         fi
7671                 fi
7672         fi
7673 fi
7674 nm_extract="$com"
7675 case "$PASE" in
7676 define)
7677     echo " "
7678     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7679     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7680     ;;
7681 *)  if $test -f /lib/syscalls.exp; then
7682         echo " "
7683         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7684         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7685                 /lib/syscalls.exp >>libc.list
7686     fi
7687     ;;
7688 esac
7689 ;;
7690 esac
7691 $rm -f libnames libpath
7692
7693 : Check if we are using C++
7694 echo " "
7695 echo "Checking for C++..." >&4
7696 $cat >try.c <<'EOCP'
7697 #include <stdio.h>
7698 int main(void)
7699 {
7700 #ifdef __cplusplus
7701     return 0;
7702 #else
7703     return 1;
7704 #endif
7705 }
7706 EOCP
7707 set try
7708 if eval $compile_ok && $run ./try; then
7709         val="$define"
7710         echo "You are using a C++ compiler."
7711 else
7712         val="$undef"
7713         echo "You are not using a C++ compiler."
7714 fi
7715 $rm_try cplusplus$$
7716 set d_cplusplus
7717 eval $setvar
7718
7719 : is a C symbol defined?
7720 csym='tlook=$1;
7721 case "$3" in
7722 -v) tf=libc.tmp; tdc="";;
7723 -a) tf=libc.tmp; tdc="[]";;
7724 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7725 esac;
7726 case "$d_cplusplus" in
7727     $define)    extern_C="extern \"C\"" ;;
7728     *)          extern_C="extern"       ;;
7729 esac;
7730 tx=yes;
7731 case "$reuseval-$4" in
7732 true-) ;;
7733 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7734 esac;
7735 case "$tx" in
7736 yes)
7737         tval=false;
7738         if $test "$runnm" = true; then
7739                 if $contains $tlook $tf >/dev/null 2>&1; then
7740                         tval=true;
7741                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7742                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7743                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7744                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7745                         $rm_try;
7746                 fi;
7747         else
7748                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7749                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7750                 $rm_try;
7751         fi;
7752         ;;
7753 *)
7754         case "$tval" in
7755         $define) tval=true;;
7756         *) tval=false;;
7757         esac;
7758         ;;
7759 esac;
7760 eval "$2=$tval"'
7761
7762 : define an is-in-libc? function
7763 inlibc='echo " "; td=$define; tu=$undef;
7764 sym=$1; var=$2; eval "was=\$$2";
7765 tx=yes;
7766 case "$reuseval$was" in
7767 true) ;;
7768 true*) tx=no;;
7769 esac;
7770 case "$tx" in
7771 yes)
7772         set $sym tres -f;
7773         eval $csym;
7774         case "$tres" in
7775         true)
7776                 echo "$sym() found." >&4;
7777                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7778         *)
7779                 echo "$sym() NOT found." >&4;
7780                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7781         esac;;
7782 *)
7783         case "$was" in
7784         $define) echo "$sym() found." >&4;;
7785         *) echo "$sym() NOT found." >&4;;
7786         esac;;
7787 esac'
7788
7789 : see if dlopen exists
7790 xxx_runnm="$runnm"
7791 xxx_ccflags="$ccflags"
7792 runnm=false
7793 : with g++ one needs -shared to get is-in-libc to work for dlopen
7794 case "$gccversion" in
7795 '')     ;;
7796 *)      case "$d_cplusplus" in
7797         "$define") ccflags="$ccflags -shared" ;;
7798         esac
7799         ;;
7800 esac
7801 set dlopen d_dlopen
7802 eval $inlibc
7803 runnm="$xxx_runnm"
7804 ccflags="$xxx_ccflags"
7805
7806 : see if this is a unistd.h system
7807 set unistd.h i_unistd
7808 eval $inhdr
7809
7810 : determine which dynamic loading, if any, to compile in
7811 echo " "
7812 dldir="ext/DynaLoader"
7813 case "$usedl" in
7814 $define|y|true)
7815         dflt='y'
7816         usedl="$define"
7817         ;;
7818 $undef|n|false)
7819         dflt='n'
7820         usedl="$undef"
7821         ;;
7822 *)
7823         dflt='n'
7824         case "$d_dlopen" in
7825             $define) dflt='y' ;;
7826         esac
7827         : Does a dl_xxx.xs file exist for this operating system
7828         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7829         ;;
7830 esac
7831 rp="Do you wish to use dynamic loading?"
7832 . ./myread
7833 usedl="$ans"
7834 bin_ELF="$undef"
7835 case "$ans" in
7836 y*) usedl="$define"
7837         case "$dlsrc" in
7838         '')
7839                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7840                         dflt="$dldir/dl_${osname}.xs"
7841                 elif $test "$d_dlopen" = "$define" ; then
7842                         dflt="$dldir/dl_dlopen.xs"
7843                 else
7844                         dflt=''
7845                 fi
7846                 ;;
7847         *)      dflt="$dldir/$dlsrc"
7848                 ;;
7849         esac
7850     echo "The following dynamic loading files are available:"
7851         : Can not go over to $dldir because getfile has path hard-coded in.
7852         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7853         rp="Source file to use for dynamic loading"
7854         fn="fne"
7855         gfpth="$src"
7856         . ./getfile
7857         usedl="$define"
7858         : emulate basename
7859         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7860
7861         $cat << EOM
7862
7863 Some systems may require passing special flags to $cc -c to
7864 compile modules that will be used to create a shared library.
7865 To use no flags, say "none".
7866
7867 EOM
7868     case "$cccdlflags" in
7869     '') case "$gccversion" in
7870                 '') case "$osname" in
7871                         hpux)   dflt='+z' ;;
7872                         next)   dflt='none' ;;
7873                         irix*)  dflt='-KPIC' ;;
7874                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7875                         sunos)  dflt='-pic' ;;
7876                         *)      dflt='none' ;;
7877                     esac
7878                         ;;
7879                 *)  case "$osname" in
7880                         darwin) dflt='none' ;;
7881                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7882                         *)      dflt='-fpic' ;;
7883                     esac ;;
7884             esac ;;
7885         ' ') dflt='none' ;;
7886     *)  dflt="$cccdlflags" ;;
7887     esac
7888     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7889     . ./myread
7890     case "$ans" in
7891     none) cccdlflags=' ' ;;
7892     *) cccdlflags="$ans" ;;
7893     esac
7894
7895     cat << EOM
7896
7897 Some systems use ld to create libraries that can be dynamically loaded,
7898 while other systems (such as those using ELF) use $cc.
7899
7900 EOM
7901
7902 : Determine if this is ELF
7903         $cat >try.c <<EOM
7904 /* Test for whether ELF binaries are produced */
7905 #include <fcntl.h>
7906 #$i_stdlib I_STDLIB
7907 #ifdef I_STDLIB
7908 #include <stdlib.h>
7909 #endif
7910 #$i_unistd I_UNISTD
7911 #ifdef I_UNISTD
7912 #include <unistd.h>
7913 #endif
7914 int main() {
7915         char b[4];
7916         int i = open("a.out",O_RDONLY);
7917         if(i == -1)
7918                 exit(1); /* fail */
7919         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7920                 exit(0); /* succeed (yes, it is ELF) */
7921         else
7922                 exit(1); /* fail */
7923 }
7924 EOM
7925         if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7926                 bin_ELF="$define"
7927         fi
7928         $rm_try
7929
7930         case "$ld" in
7931         '')     if $test $bin_ELF = "$define"; then
7932                         cat <<EOM
7933 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7934 EOM
7935                         dflt="$cc"
7936                 else
7937                         echo "I'll use ld to build dynamic libraries."
7938                         dflt='ld'
7939                 fi
7940                 ;;
7941         *)      dflt="$ld"
7942                 ;;
7943         esac
7944
7945     rp="What command should be used to create dynamic libraries?"
7946     . ./myread
7947         ld="$ans"
7948
7949     cat << EOM
7950
7951 Some systems may require passing special flags to $ld to create a
7952 library that can be dynamically loaded.  If your ld flags include
7953 -L/other/path options to locate libraries outside your loader's normal
7954 search path, you may need to specify those -L options here as well.  To
7955 use no flags, say "none".
7956
7957 EOM
7958     case "$lddlflags" in
7959     '') case "$osname" in
7960                         haiku) dflt='-shared' ;;
7961                         hpux) dflt='-b';
7962                               case "$gccversion" in
7963                               '') dflt="$dflt +vnocompatwarnings" ;;
7964                               esac
7965                               ;;
7966                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
7967                         next)  dflt='none' ;;
7968                         solaris) # See [perl #66604].
7969                                 # On Solaris 11, gcc -m64 on amd64 
7970                                 # appears not to understand -G.  gcc versions at
7971                                 # least as old as 3.4.3 support -shared, so just
7972                                 # use that with Solaris 11 and later, but keep
7973                                 # the old behavior for older Solaris versions.
7974                                 case "$gccversion" in
7975                                         '') dflt='-G' ;;
7976                                         *)      case "$osvers" in
7977                                                         2.?|2.10) dflt='-G' ;;
7978                                                         *) dflt='-shared' ;;
7979                                                 esac
7980                                                 ;;
7981                                 esac
7982                                 ;;
7983                         sunos) dflt='-assert nodefinitions' ;;
7984                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7985                 *)     dflt='none' ;;
7986                         esac
7987                         ;;
7988     *) dflt="$lddlflags" ;;
7989     esac
7990
7991         : Try to guess additional flags to pick up local libraries.
7992         : Be careful not to append to a plain 'none'
7993         case "$dflt" in
7994         none) dflt='' ;;
7995         esac
7996         for thisflag in $ldflags; do
7997                 case "$thisflag" in
7998                 -L*|-R*|-Wl,-R*)
7999                         case " $dflt " in
8000                         *" $thisflag "*) ;;
8001                         *) dflt="$dflt $thisflag" ;;
8002                         esac
8003                         ;;
8004                 esac
8005         done
8006
8007         case "$dflt" in
8008         ''|' ') dflt='none' ;;
8009         esac
8010
8011         case "$ldflags" in
8012         *-fstack-protector*)
8013             case "$dflt" in
8014                         *-fstack-protector*) ;; # Don't add it again
8015                         *) dflt="$dflt -fstack-protector" ;; 
8016                 esac
8017                 ;;
8018         esac
8019
8020
8021     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8022     . ./myread
8023     case "$ans" in
8024     none) lddlflags=' ' ;;
8025     *) lddlflags="$ans" ;;
8026     esac
8027
8028         cat <<EOM
8029
8030 Some systems may require passing special flags to $cc to indicate that
8031 the resulting executable will use dynamic linking.  To use no flags,
8032 say "none".
8033
8034 EOM
8035     case "$ccdlflags" in
8036     '') case "$osname" in
8037             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8038             next|sunos) dflt='none' ;;
8039             *)          dflt='none' ;;
8040             esac ;;
8041     ' ')  dflt='none' ;;
8042     *)  dflt="$ccdlflags" ;;
8043     esac
8044     rp="Any special flags to pass to $cc to use dynamic linking?"
8045     . ./myread
8046     case "$ans" in
8047     none) ccdlflags=' ' ;;
8048     *) ccdlflags="$ans" ;;
8049     esac
8050     ;;
8051 *)  usedl="$undef"
8052         ld='ld'
8053     dlsrc='dl_none.xs'
8054     lddlflags=''
8055     ccdlflags=''
8056     ;;
8057 esac
8058
8059 ld_can_script="$undef"
8060 case "$bin_ELF$usedl" in
8061 $define$define)
8062     # Abuse try.h and a.out names for neat cleanup
8063     $cat >try.c <<EOM
8064 void foo() {}
8065 void bar() {}
8066 EOM
8067     $cat >try.h <<EOM
8068 LIBTEST_42 {
8069  global:
8070   foo;
8071  local: *;
8072  };
8073 EOM
8074     if $cc $cccdlflags $ccdlflags $ccflags \
8075            $ldflags $lddlflags -o a.out try.c \
8076            -Wl,--version-script=try.h >/dev/null 2>&1 \
8077        &&  $test -s a.out ; then
8078         echo "ld supports scripting" >&4
8079         ld_can_script="$define"
8080     else
8081         echo "ld does not support scripting" >&4
8082     fi
8083     $rm_try
8084     ;;
8085 esac
8086
8087 : Do we want a shared libperl?
8088 also=''
8089 case "$usedl" in
8090 $undef)
8091         # No dynamic loading being used, so don't bother even to prompt.
8092         useshrplib='false'
8093         ;;
8094 *)      case "$useshrplib" in
8095         '')     case "$osname" in
8096                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8097                         dflt=y
8098                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8099                         ;;
8100                 next*)
8101                         case "$osvers" in
8102                         4*)     dflt=y
8103                                 also='Building a shared libperl is needed for MAB support.'
8104                                 ;;
8105                         *)      dflt=n
8106                                 ;;
8107                         esac
8108                         ;;
8109                 *)      dflt=n
8110                         ;;
8111                 esac
8112                 ;;
8113         $define|true|[Yy]*)
8114                 dflt=y
8115                 ;;
8116         *)      dflt=n
8117                 ;;
8118         esac
8119         $cat << EOM
8120
8121 The perl executable is normally obtained by linking perlmain.c with
8122 libperl${_a}, any static extensions (usually just DynaLoader), and
8123 any other libraries needed on this system (such as -lm, etc.).  Since
8124 your system supports dynamic loading, it is probably possible to build
8125 a shared libperl.$so.  If you will have more than one executable linked
8126 to libperl.$so, this will significantly reduce the size of each
8127 executable, but it may have a noticeable effect on performance.  The
8128 default is probably sensible for your system.
8129 $also
8130
8131 EOM
8132         rp="Build a shared libperl.$so (y/n)"
8133         . ./myread
8134         case "$ans" in
8135         true|$define|[Yy]*)
8136                 useshrplib='true'  ;;
8137         *)      useshrplib='false' ;;
8138         esac
8139         ;;
8140 esac
8141
8142 case "$useshrplib" in
8143 true)
8144         case "$userelocatableinc" in
8145         true|define)
8146                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8147                 echo "See INSTALL for an explanation why that won't work." >&4
8148                 exit 4
8149                 ;;
8150         esac
8151         case "$libperl" in
8152         '')
8153                 # Figure out a good name for libperl.so.  Since it gets stored in
8154                 # a version-specific architecture-dependent library, the version
8155                 # number isn't really that important, except for making cc/ld happy.
8156                 #
8157                 # A name such as libperl.so.10.1
8158                 majmin="libperl.$so.$patchlevel.$subversion"
8159                 # A name such as libperl.so.100
8160                 majonly=`echo $patchlevel $subversion |
8161                         $awk '{printf "%d%02d", $1, $2}'`
8162                 majonly=libperl.$so.$majonly
8163                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8164                 # rely on figuring it out from the naming of libc.
8165                 case "${osname}${osvers}" in
8166                 next4*)
8167                         dflt=libperl.5.$so
8168                         # XXX How handle the --version stuff for MAB?
8169                         ;;
8170                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8171                         dflt=libperl.$so
8172                         ;;
8173                 cygwin*) # ld links now against the dll directly
8174                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8175                         majonly=`echo $patchlevel $subversion |
8176                                 $awk '{printf "%03d%03d", $1, $2}'`
8177                         majonly=cygperl5.$majonly.$so
8178                         dflt=$majmin
8179                         ;;
8180                 *)      # Try to guess based on whether libc has major.minor.
8181                         case "$libc" in
8182                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8183                         *libc.$so.[0-9]*) dflt=$majonly ;;
8184                         *)      dflt=libperl.$so ;;
8185                         esac
8186                         ;;
8187                 esac
8188                 ;;
8189         *)      dflt=$libperl
8190                 ;;
8191         esac
8192         cat << EOM
8193
8194 I need to select a good name for the shared libperl.  If your system uses
8195 library names with major and minor numbers, then you might want something
8196 like $majmin.  Alternatively, if your system uses a single version
8197 number for shared libraries, then you might want to use $majonly.
8198 Or, your system might be quite happy with a simple libperl.$so.
8199
8200 Since the shared libperl will get installed into a version-specific
8201 architecture-dependent directory, the version number of the shared perl
8202 library probably isn't important, so the default should be o.k.
8203
8204 EOM
8205         rp='What name do you want to give to the shared libperl?'
8206         . ./myread
8207         libperl=$ans
8208         echo "Ok, I'll use $libperl"
8209         ;;
8210 *)
8211         libperl="libperl${_a}"
8212         ;;
8213 esac
8214
8215 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8216 case "$shrpdir" in
8217 '') ;;
8218 *)      $cat >&4 <<EOM
8219 WARNING:  Use of the shrpdir variable for the installation location of
8220 the shared $libperl is not supported.  It was never documented and
8221 will not work in this version.  Let me (perlbug@perl.org)
8222 know of any problems this may cause.
8223
8224 EOM
8225         case "$shrpdir" in
8226         "$archlibexp/CORE")
8227                 $cat >&4 <<EOM
8228 But your current setting of $shrpdir is
8229 the default anyway, so it's harmless.
8230 EOM
8231                 ;;
8232         *)
8233                 $cat >&4 <<EOM
8234 Further, your current attempted setting of $shrpdir
8235 conflicts with the value of $archlibexp/CORE
8236 that installperl will use.
8237 EOM
8238                 ;;
8239         esac
8240         ;;
8241 esac
8242
8243 # How will the perl executable find the installed shared $libperl?
8244 # Add $xxx to ccdlflags.
8245 # If we can't figure out a command-line option, use $shrpenv to
8246 # set env LD_RUN_PATH.  The main perl makefile uses this.
8247 shrpdir=$archlibexp/CORE
8248 xxx=''
8249 tmp_shrpenv=''
8250 if "$useshrplib"; then
8251     case "$osname" in
8252         aix)
8253                 # We'll set it in Makefile.SH...
8254                 ;;
8255         solaris)
8256                 xxx="-R $shrpdir"
8257                 ;;
8258         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8259                 xxx="-Wl,-R$shrpdir"
8260                 ;;
8261         bsdos|linux|irix*|dec_osf|gnu*)
8262                 xxx="-Wl,-rpath,$shrpdir"
8263                 ;;
8264         next)
8265                 # next doesn't like the default...
8266                 ;;
8267         haiku)
8268                 # Haiku doesn't like the default, either.
8269                 ;;
8270         hpux*)
8271                 # hpux doesn't like the default, either.
8272                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8273                 ;;
8274         cygwin)
8275                 # cygwin needs only ldlibpth
8276                 ;;
8277         *)
8278                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8279                 ;;
8280         esac
8281         case "$xxx" in
8282         '') ;;
8283         *)
8284                 # Only add $xxx if it isn't already in ccdlflags.
8285                 case " $ccdlflags " in
8286                 *" $xxx "*)     ;;
8287                 *)      ccdlflags="$ccdlflags $xxx"
8288                         cat <<EOM >&4
8289
8290 Adding $xxx to the flags
8291 passed to $ld so that the perl executable will find the
8292 installed shared $libperl.
8293
8294 EOM
8295                         ;;
8296                 esac
8297                 ;;
8298         esac
8299 fi
8300 # Fix ccdlflags in AIX for building external extensions.
8301 # (For building Perl itself bare -bE:perl.exp is needed,
8302 #  Makefile.SH takes care of this.)
8303 case "$osname" in
8304 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8305 esac
8306 # Respect a hint or command-line value.
8307 case "$shrpenv" in
8308 '') shrpenv="$tmp_shrpenv" ;;
8309 esac
8310 case "$ldlibpthname" in
8311 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8312 none)   ldlibpthname='' ;;
8313 esac
8314
8315 : determine where manual pages are on this system
8316 echo " "
8317 case "$sysman" in
8318 '')
8319         syspath='/usr/share/man/man1 /usr/man/man1'
8320         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8321         syspath="$syspath /usr/man/u_man/man1"
8322         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8323         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8324         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8325         sysman=`./loc . /usr/man/man1 $syspath`
8326         ;;
8327 esac
8328 if $test -d "$sysman"; then
8329         echo "System manual is in $sysman." >&4
8330 else
8331         echo "Could not find manual pages in source form." >&4
8332 fi
8333
8334 : determine where manual pages go
8335 set man1dir man1dir none
8336 eval $prefixit
8337 $cat <<EOM
8338
8339 $spackage has manual pages available in source form.
8340 EOM
8341 case "$nroff" in
8342 nroff)
8343         echo "However, you don't have nroff, so they're probably useless to you."
8344         case "$man1dir" in
8345         '') man1dir="none";;
8346         esac;;
8347 esac
8348 echo "If you don't want the manual sources installed, answer 'none'."
8349 case "$man1dir" in
8350 ' ') dflt=none
8351         ;;
8352 '')
8353         lookpath="$prefixexp/share/man/man1"
8354         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8355         lookpath="$lookpath $prefixexp/man/p_man/man1"
8356         lookpath="$lookpath $prefixexp/man/u_man/man1"
8357         lookpath="$lookpath $prefixexp/man/man.1"
8358         case "$sysman" in
8359         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8360         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8361         esac
8362         set dflt
8363         eval $prefixup
8364         ;;
8365 *)  dflt="$man1dir"
8366         ;;
8367 esac
8368 echo " "
8369 fn=dn+~
8370 rp="Where do the main $spackage manual pages (source) go?"
8371 . ./getfile
8372 if $test "X$man1direxp" != "X$ansexp"; then
8373         installman1dir=''
8374 fi
8375 prefixvar=man1dir
8376 . ./setprefixvar
8377
8378 case "$man1dir" in
8379 '')     man1dir=' '
8380         installman1dir='';;
8381 esac
8382
8383 : What suffix to use on installed man pages
8384
8385 case "$man1dir" in
8386 ' ')
8387         man1ext='0'
8388         ;;
8389 *)
8390         rp="What suffix should be used for the main $spackage man pages?"
8391         case "$man1ext" in
8392         '')     case "$man1dir" in
8393                 *1)  dflt=1 ;;
8394                 *1p) dflt=1p ;;
8395                 *1pm) dflt=1pm ;;
8396                 *l) dflt=l;;
8397                 *n) dflt=n;;
8398                 *o) dflt=o;;
8399                 *p) dflt=p;;
8400                 *C) dflt=C;;
8401                 *L) dflt=L;;
8402                 *L1) dflt=L1;;
8403                 *) dflt=1;;
8404                 esac
8405                 ;;
8406         *)      dflt="$man1ext";;
8407         esac
8408         . ./myread
8409         man1ext="$ans"
8410         ;;
8411 esac
8412
8413 : see if we can have long filenames
8414 echo " "
8415 first=123456789abcdef
8416 $rm -f $first
8417 if (echo hi >$first) 2>/dev/null; then
8418         if $test -f 123456789abcde; then
8419                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8420                 val="$undef"
8421         else
8422                 echo 'You can have filenames longer than 14 characters.'>&4
8423                 val="$define"
8424         fi
8425 else
8426         $cat <<'EOM'
8427 You can't have filenames longer than 14 chars.
8428 You can't even think about them!
8429 EOM
8430         val="$undef"
8431 fi
8432 set d_flexfnam
8433 eval $setvar
8434 $rm -rf 123456789abcde*
8435
8436 : determine where library module manual pages go
8437 set man3dir man3dir none
8438 eval $prefixit
8439 $cat <<EOM
8440
8441 $spackage has manual pages for many of the library modules.
8442 EOM
8443
8444 case "$nroff" in
8445 nroff)
8446         $cat <<'EOM'
8447 However, you don't have nroff, so they're probably useless to you.
8448 EOM
8449         case "$man3dir" in
8450         '') man3dir="none";;
8451         esac;;
8452 esac
8453
8454 case "$d_flexfnam" in
8455 undef)
8456         $cat <<'EOM'
8457 However, your system can't handle the long file names like File::Basename.3.
8458 EOM
8459         case "$man3dir" in
8460         '') man3dir="none";;
8461         esac;;
8462 esac
8463
8464 echo "If you don't want the manual sources installed, answer 'none'."
8465 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8466 case "$man3dir" in
8467 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8468         if $test -d "$privlib/man/man3"; then
8469                 cat <<EOM >&4
8470
8471 WARNING:  Previous versions of perl installed man3 pages into
8472 $privlib/man/man3.  This version will suggest a
8473 new default of $dflt.
8474 EOM
8475                 tdflt=$dflt
8476                 dflt='n'
8477                 rp='Do you wish to preserve the old behavior?(y/n)'
8478                 . ./myread
8479                 case "$ans" in
8480                 y*) dflt="$privlib/man/man3" ;;
8481                 *)  dflt=$tdflt ;;
8482                 esac
8483     fi
8484         ;;
8485 *)      dflt="$man3dir" ;;
8486 esac
8487 case "$dflt" in
8488 ' ') dflt=none ;;
8489 esac
8490 echo " "
8491 fn=dn+~
8492 rp="Where do the $package library man pages (source) go?"
8493 . ./getfile
8494 prefixvar=man3dir
8495 . ./setprefixvar
8496
8497 case "$man3dir" in
8498 '')     man3dir=' '
8499         installman3dir='';;
8500 esac
8501
8502 : What suffix to use on installed man pages
8503 case "$man3dir" in
8504 ' ')
8505         man3ext='0'
8506         ;;
8507 *)
8508         rp="What suffix should be used for the $package library man pages?"
8509         case "$man3ext" in
8510         '')     case "$man3dir" in
8511                 *3)  dflt=3 ;;
8512                 *3p) dflt=3p ;;
8513                 *3pm) dflt=3pm ;;
8514                 *l) dflt=l;;
8515                 *n) dflt=n;;
8516                 *o) dflt=o;;
8517                 *p) dflt=p;;
8518                 *C) dflt=C;;
8519                 *L) dflt=L;;
8520                 *L3) dflt=L3;;
8521                 *) dflt=3;;
8522                 esac
8523                 ;;
8524         *)      dflt="$man3ext";;
8525         esac
8526         . ./myread
8527         man3ext="$ans"
8528         ;;
8529 esac
8530
8531 : see if we have to deal with yellow pages, now NIS.
8532 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8533         if $test -f /usr/etc/nibindd; then
8534                 echo " "
8535                 echo "I'm fairly confident you're on a NeXT."
8536                 echo " "
8537                 rp='Do you get the hosts file via NetInfo?'
8538                 dflt=y
8539                 case "$hostcat" in
8540                 nidump*) ;;
8541                 '') ;;
8542                 *) dflt=n;;
8543                 esac
8544                 . ./myread
8545                 case "$ans" in
8546                 y*) hostcat='nidump hosts .';;
8547                 *)      case "$hostcat" in
8548                         nidump*) hostcat='';;
8549                         esac
8550                         ;;
8551                 esac
8552         fi
8553         case "$hostcat" in
8554         nidump*) ;;
8555         *)
8556                 case "$hostcat" in
8557                 *ypcat*) dflt=y;;
8558                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8559                                 dflt=y
8560                         else
8561                                 dflt=n
8562                         fi;;
8563                 *) dflt=n;;
8564                 esac
8565                 echo " "
8566                 rp='Are you getting the hosts file via yellow pages?'
8567                 . ./myread
8568                 case "$ans" in
8569                 y*) hostcat='ypcat hosts';;
8570                 *) hostcat='cat /etc/hosts';;
8571                 esac
8572                 ;;
8573         esac
8574 fi
8575 case "$hostcat" in
8576 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8577 esac
8578 case "$groupcat" in
8579 '') test -f /etc/group && groupcat='cat /etc/group';;
8580 esac
8581 case "$passcat" in
8582 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8583 esac
8584
8585 : now get the host name
8586 echo " "
8587 echo "Figuring out host name..." >&4
8588 case "$myhostname" in
8589 '') cont=true
8590         echo 'Maybe "hostname" will work...'
8591         if tans=`sh -c hostname 2>&1` ; then
8592                 myhostname=$tans
8593                 phostname=hostname
8594                 cont=''
8595         fi
8596         ;;
8597 *) cont='';;
8598 esac
8599 if $test "$cont"; then
8600         if ./xenix; then
8601                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8602                 if tans=`cat /etc/systemid 2>&1` ; then
8603                         myhostname=$tans
8604                         phostname='cat /etc/systemid'
8605                         echo "Whadyaknow.  Xenix always was a bit strange..."
8606                         cont=''
8607                 fi
8608         elif $test -r /etc/systemid; then
8609                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8610         fi
8611 fi
8612 if $test "$cont"; then
8613         echo 'No, maybe "uuname -l" will work...'
8614         if tans=`sh -c 'uuname -l' 2>&1` ; then
8615                 myhostname=$tans
8616                 phostname='uuname -l'
8617         else
8618                 echo 'Strange.  Maybe "uname -n" will work...'
8619                 if tans=`sh -c 'uname -n' 2>&1` ; then
8620                         myhostname=$tans
8621                         phostname='uname -n'
8622                 else
8623                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8624                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8625                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8626                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8627                         else
8628                                 case "$myhostname" in
8629                                 '') echo "Does this machine have an identity crisis or something?"
8630                                         phostname='';;
8631                                 *)
8632                                         echo "Well, you said $myhostname before..."
8633                                         phostname='echo $myhostname';;
8634                                 esac
8635                         fi
8636                 fi
8637         fi
8638 fi
8639 case "$myhostname" in
8640 '') myhostname=noname ;;
8641 esac
8642 : you do not want to know about this
8643 set $myhostname
8644 myhostname=$1
8645
8646 : verify guess
8647 if $test "$myhostname" ; then
8648         dflt=y
8649         rp='Your host name appears to be "'$myhostname'".'" Right?"
8650         . ./myread
8651         case "$ans" in
8652         y*) ;;
8653         *) myhostname='';;
8654         esac
8655 fi
8656
8657 : bad guess or no guess
8658 while $test "X$myhostname" = X ; do
8659         dflt=''
8660         rp="Please type the (one word) name of your host:"
8661         . ./myread
8662         myhostname="$ans"
8663 done
8664
8665 : translate upper to lower if necessary
8666 case "$myhostname" in
8667 *[A-Z]*)
8668         echo "(Normalizing case in your host name)"
8669         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8670         ;;
8671 esac
8672
8673 case "$myhostname" in
8674 *.*)
8675         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8676         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8677         echo "(Trimming domain name from host name--host name is now $myhostname)"
8678         ;;
8679 *) case "$mydomain" in
8680         '')
8681                 {
8682                         test "X$hostcat" = "Xypcat hosts" &&
8683                         ypmatch "$myhostname" hosts 2>/dev/null |\
8684                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8685                         $test -s hosts
8686                 } || {
8687                         test "X$hostcat" != "X" &&
8688                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8689                                         /[       ]$myhostname[  . ]/p" > hosts
8690                 }
8691                 tmp_re="[       . ]"
8692                 if $test -f hosts; then
8693                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8694                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8695                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8696                                 hosts | $sort | $uniq | \
8697                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8698                         case `$echo X$dflt` in
8699                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8700                                 dflt=.
8701                                 ;;
8702                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8703                                 ;;
8704                         esac
8705                 else
8706                         echo "(I cannot locate a hosts database anywhere)"
8707                         dflt=.
8708                 fi
8709                 case "$dflt" in
8710                 .)
8711                         tans=`./loc resolv.conf X /etc /usr/etc`
8712                         if $test -f "$tans"; then
8713                                 echo "(Attempting domain name extraction from $tans)"
8714                                 dflt=.`$sed -n -e 's/   / /g' \
8715                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8716                                   -e 1q 2>/dev/null`
8717                                 case "$dflt" in
8718                                 .) dflt=.`$sed -n -e 's/        / /g' \
8719                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8720                                      -e 1q 2>/dev/null`
8721                                         ;;
8722                                 esac
8723                         fi
8724                         ;;
8725                 esac
8726                 case "$dflt" in
8727                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8728                         dflt=.`sh -c domainname 2>/dev/null`
8729                         case "$dflt" in
8730                         '') dflt='.';;
8731                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8732                         esac
8733                         ;;
8734                 esac
8735                 case "$dflt$osname" in
8736                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8737                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8738                         ;;
8739                 esac
8740                 case "$dflt" in
8741                 .) echo "(Lost all hope -- silly guess then)"
8742                         dflt='.nonet'
8743                         ;;
8744                 esac
8745                 $rm -f hosts
8746                 ;;
8747         *) dflt="$mydomain";;
8748         esac;;
8749 esac
8750 echo " "
8751 rp="What is your domain name?"
8752 . ./myread
8753 tans="$ans"
8754 case "$ans" in
8755 '') ;;
8756 .*) ;;
8757 *) tans=".$tans";;
8758 esac
8759 mydomain="$tans"
8760
8761 : translate upper to lower if necessary
8762 case "$mydomain" in
8763 *[A-Z]*)
8764         echo "(Normalizing case in your domain name)"
8765         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8766         ;;
8767 esac
8768
8769 : a little sanity check here
8770 case "$phostname" in
8771 '') ;;
8772 *)
8773         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8774         $myhostname$mydomain|$myhostname) ;;
8775         *)
8776                 case "$phostname" in
8777                 sed*)
8778                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8779                         ;;
8780                 *)
8781                         echo "(That doesn't agree with your $phostname command, by the way.)"
8782                         ;;
8783                 esac
8784         ;;
8785         esac
8786         ;;
8787 esac
8788
8789 : determine the e-mail address of the user who is running us
8790 $cat <<EOM
8791
8792 I need to get your e-mail address in Internet format if possible, i.e.
8793 something like user@host.domain. Please answer accurately since I have
8794 no easy means to double check it. The default value provided below
8795 is most probably close to reality but may not be valid from outside
8796 your organization...
8797
8798 EOM
8799 cont=x
8800 while test "$cont"; do
8801         case "$MAILDOMAIN" in
8802         '')
8803                 if $test -s /etc/mailname; then
8804                         maildomain=`$cat /etc/mailname`
8805                 else
8806                         maildomain="$myhostname$mydomain"
8807                 fi
8808                 ;;
8809         *)  maildomain="$MAILDOMAIN";;
8810         esac
8811         case "$cf_email" in
8812         '') dflt="$cf_by@$maildomain";;
8813         *)  dflt="$cf_email";;
8814         esac
8815         rp='What is your e-mail address?'
8816         . ./myread
8817         cf_email="$ans"
8818         case "$cf_email" in
8819         *@*.*) cont='' ;;
8820         *)
8821                 rp='Address does not look like an Internet one.  Use it anyway?'
8822                 case "$fastread" in
8823                 yes) dflt=y ;;
8824                 *) dflt=n ;;
8825                 esac
8826                 . ./myread
8827                 case "$ans" in
8828                 y*) cont='' ;;
8829                 *) echo " " ;;
8830                 esac
8831                 ;;
8832         esac
8833 done
8834
8835 : Ask e-mail of administrator
8836 $cat <<EOM
8837
8838 If you or somebody else will be maintaining perl at your site, please
8839 fill in the correct e-mail address here so that they may be contacted
8840 if necessary. Currently, the "perlbug" program included with perl
8841 will send mail to this address in addition to perlbug@perl.org. You may
8842 enter "none" for no administrator.
8843
8844 EOM
8845 case "$perladmin" in
8846 '') dflt="$cf_email";;
8847 *) dflt="$perladmin";;
8848 esac
8849 rp='Perl administrator e-mail address'
8850 . ./myread
8851 perladmin="$ans"
8852
8853 : determine whether to only install version-specific parts.
8854 echo " "
8855 $cat <<EOM
8856 Do you want to install only the version-specific parts of the perl
8857 distribution?  Usually you do *not* want to do this.
8858 EOM
8859 case "$versiononly" in
8860 "$define"|[Yy]*|true) dflt='y' ;;
8861 *) dflt='n';
8862 esac
8863 rp="Do you want to install only the version-specific parts of perl?"
8864 . ./myread
8865 case "$ans" in
8866 [yY]*)  val="$define";;
8867 *)      val="$undef" ;;
8868 esac
8869 set versiononly
8870 eval $setvar
8871
8872 case "$versiononly" in
8873 "$define") inc_version_list=''
8874            inc_version_list_init=0
8875            ;;
8876 esac
8877
8878 : figure out how to guarantee perl startup
8879 : XXX Note that this currently takes advantage of the bug that binexp ignores
8880 :     the Configure -Dinstallprefix setting, which in turn means that under
8881 :     relocatable @INC, initialinstalllocation is what binexp started as.
8882 case "$startperl" in
8883 '')
8884         case "$sharpbang" in
8885         *!)
8886                 $cat <<EOH
8887
8888 I can use the #! construct to start perl on your system. This will
8889 make startup of perl scripts faster, but may cause problems if you
8890 want to share those scripts and perl is not in a standard place
8891 ($initialinstalllocation/perl) on all your platforms. The alternative
8892 is to force a shell by starting the script with a single ':' character.
8893
8894 EOH
8895                 case "$versiononly" in
8896                 "$define")      dflt="$initialinstalllocation/perl$version";;
8897                 *)              dflt="$initialinstalllocation/perl";;
8898                 esac
8899                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8900                 . ./myread
8901                 case "$ans" in
8902                 none)   startperl=": # use perl";;
8903                 *)      startperl="#!$ans"
8904                         if $test 30 -lt `echo "$ans" | wc -c`; then
8905                                 $cat >&4 <<EOM
8906
8907 WARNING:  Some systems limit the #! command to 32 characters.
8908 If you experience difficulty running Perl scripts with #!, try
8909 installing Perl in a directory with a shorter pathname.
8910
8911 EOM
8912                         fi ;;
8913                 esac
8914                 ;;
8915         *) startperl=": # use perl"
8916                 ;;
8917         esac
8918         ;;
8919 esac
8920 echo "I'll use $startperl to start perl scripts."
8921
8922 : figure best path for perl in scripts
8923 case "$perlpath" in
8924 '')
8925         case "$versiononly" in
8926         "$define")      perlpath="$initialinstalllocation/perl$version";;
8927         *)              perlpath="$initialinstalllocation/perl";;
8928         esac
8929         case "$startperl" in
8930         *!*) ;;
8931         *)
8932                 $cat <<EOH
8933
8934 I will use the "eval 'exec'" idiom to start Perl on your system.
8935 I can use the full path of your Perl binary for this purpose, but
8936 doing so may cause problems if you want to share those scripts and
8937 Perl is not always in a standard place ($initialinstalllocation/perl).
8938
8939 EOH
8940                 dflt="$initialinstalllocation/perl"
8941                 rp="What path shall I use in \"eval 'exec'\"?"
8942                 . ./myread
8943                 perlpath="$ans"
8944                 ;;
8945         esac
8946         ;;
8947 esac
8948 case "$startperl" in
8949 *!*)    ;;
8950 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8951 esac
8952
8953 : determine where public executable scripts go
8954 set scriptdir scriptdir
8955 eval $prefixit
8956 case "$scriptdir" in
8957 '')
8958         dflt="$bin"
8959         : guess some guesses
8960         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8961         $test -d /usr/share/bin     && dflt=/usr/share/bin
8962         $test -d /usr/local/script  && dflt=/usr/local/script
8963         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8964         $test -d $prefixexp/script  && dflt=$prefixexp/script
8965         set dflt
8966         eval $prefixup
8967         ;;
8968 *)  dflt="$scriptdir"
8969         ;;
8970 esac
8971 $cat <<EOM
8972
8973 Some installations have a separate directory just for executable scripts so
8974 that they can mount it across multiple architectures but keep the scripts in
8975 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8976 Or you might just lump your scripts in with all your other executables.
8977
8978 EOM
8979 fn=d~
8980 rp='Where do you keep publicly executable scripts?'
8981 . ./getfile
8982 if $test "X$ansexp" != "X$scriptdirexp"; then
8983         installscript=''
8984 fi
8985 installscriptdir=''
8986 prefixvar=scriptdir
8987 . ./setprefixvar
8988 : A little fix up for an irregularly named variable.
8989 installscript="$installscriptdir"
8990
8991 : determine where add-on public executables go
8992 case "$sitebin" in
8993 '')     dflt=$siteprefix/bin ;;
8994 *)      dflt=$sitebin ;;
8995 esac
8996 fn=d~
8997 rp='Pathname where the add-on public executables should be installed?'
8998 . ./getfile
8999 prefixvar=sitebin
9000 . ./setprefixvar
9001
9002 : determine where add-on html pages go
9003 : There is no standard location, so try to copy the previously-selected
9004 : directory structure for the core html pages.
9005 case "$sitehtml1dir" in
9006 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9007 *)     dflt=$sitehtml1dir ;;
9008 esac
9009 case "$dflt" in
9010 ''|' ') dflt=none ;;
9011 esac
9012 fn=dn+~
9013 rp='Pathname where the site-specific html pages should be installed?'
9014 . ./getfile
9015 prefixvar=sitehtml1dir
9016 . ./setprefixvar
9017
9018 : determine where add-on library html pages go
9019 : There is no standard location, so try to copy the previously-selected
9020 : directory structure for the core html pages.
9021 case "$sitehtml3dir" in
9022 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9023 *)     dflt=$sitehtml3dir ;;
9024 esac
9025 case "$dflt" in
9026 ''|' ') dflt=none ;;
9027 esac
9028 fn=dn+~
9029 rp='Pathname where the site-specific library html pages should be installed?'
9030 . ./getfile
9031 prefixvar=sitehtml3dir
9032 . ./setprefixvar
9033
9034 : determine where add-on manual pages go
9035 case "$siteman1dir" in
9036 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9037 *)      dflt=$siteman1dir ;;
9038 esac
9039 case "$dflt" in
9040 ''|' ') dflt=none ;;
9041 esac
9042 fn=dn+~
9043 rp='Pathname where the site-specific manual pages should be installed?'
9044 . ./getfile
9045 prefixvar=siteman1dir
9046 . ./setprefixvar
9047
9048 : determine where add-on library man pages go
9049 case "$siteman3dir" in
9050 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9051 *)      dflt=$siteman3dir ;;
9052 esac
9053 case "$dflt" in
9054 ''|' ') dflt=none ;;
9055 esac
9056 fn=dn+~
9057 rp='Pathname where the site-specific library manual pages should be installed?'
9058 . ./getfile
9059 prefixvar=siteman3dir
9060 . ./setprefixvar
9061
9062 : determine where add-on public executable scripts go
9063 case "$sitescript" in
9064 '')     dflt=$siteprefix/script
9065         $test -d $dflt || dflt=$sitebin ;;
9066 *)  dflt="$sitescript" ;;
9067 esac
9068 fn=d~+
9069 rp='Pathname where add-on public executable scripts should be installed?'
9070 . ./getfile
9071 prefixvar=sitescript
9072 . ./setprefixvar
9073
9074 : Check if faststdio is requested and available
9075 case "$usefaststdio" in
9076 $define|true|[yY]*|'')
9077         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9078         case "$xversion" in
9079         [68])   dflt='y' ;;
9080         *)      dflt='n' ;;
9081         esac
9082         ;;
9083 *) dflt='n';;
9084 esac
9085 cat <<EOM
9086
9087 Perl can be built to use 'fast stdio', which means using the stdio
9088 library but also directly manipulating the stdio buffers to enable
9089 faster I/O.  Using stdio is better for backward compatibility (especially
9090 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9091 interface has been preferred instead of stdio.
9092
9093 If this doesn't make any sense to you, just accept the default '$dflt'.
9094 EOM
9095 rp='Use the "fast stdio" if available?'
9096 . ./myread
9097 case "$ans" in
9098 y|Y)    val="$define" ;;
9099 *)      val="$undef" ;;
9100 esac
9101 set usefaststdio
9102 eval $setvar
9103
9104
9105 : define an is-a-typedef? function
9106 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9107 case "$inclist" in
9108 "") inclist="sys/types.h";;
9109 esac;
9110 eval "varval=\$$var";
9111 case "$varval" in
9112 "")
9113         $rm -f temp.c;
9114         for inc in $inclist; do
9115                 echo "#include <$inc>" >>temp.c;
9116         done;
9117         echo "#ifdef $type" >> temp.c;
9118         echo "printf(\"We have $type\");" >> temp.c;
9119         echo "#endif" >> temp.c;
9120         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9121         if $contains $type temp.E >/dev/null 2>&1; then
9122                 eval "$var=\$type";
9123         else
9124                 eval "$var=\$def";
9125         fi;
9126         $rm -f temp.?;;
9127 *) eval "$var=\$varval";;
9128 esac'
9129
9130 : define an is-a-typedef? function that prompts if the type is not available.
9131 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9132 case "$inclist" in
9133 "") inclist="sys/types.h";;
9134 esac;
9135 eval "varval=\$$var";
9136 case "$varval" in
9137 "")
9138         $rm -f temp.c;
9139         for inc in $inclist; do
9140                 echo "#include <$inc>" >>temp.c;
9141         done;
9142         echo "#ifdef $type" >> temp.c;
9143         echo "printf(\"We have $type\");" >> temp.c;
9144         echo "#endif" >> temp.c;
9145         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9146         echo " " ;
9147         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9148         if $contains $type temp.E >/dev/null 2>&1; then
9149                 echo "$type found." >&4;
9150                 eval "$var=\$type";
9151         else
9152                 echo "$type NOT found." >&4;
9153                 dflt="$def";
9154                 . ./myread ;
9155                 eval "$var=\$ans";
9156         fi;
9157         $rm -f temp.?;;
9158 *) eval "$var=\$varval";;
9159 esac'
9160
9161 : see what type lseek is declared as in the kernel
9162 rp="What is the type used for lseek's offset on this system?"
9163 set off_t lseektype long stdio.h sys/types.h
9164 eval $typedef_ask
9165
9166 echo " "
9167 echo "Checking to see how big your file offsets are..." >&4
9168 $cat >try.c <<EOCP
9169 #include <sys/types.h>
9170 #include <stdio.h>
9171 int main()
9172 {
9173     printf("%d\n", (int)sizeof($lseektype));
9174     return(0);
9175 }
9176 EOCP
9177 set try
9178 if eval $compile_ok; then
9179         lseeksize=`$run ./try`
9180         echo "Your file offsets are $lseeksize bytes long."
9181 else
9182         dflt=$longsize
9183         echo " "
9184         echo "(I can't seem to compile the test program.  Guessing...)"
9185         rp="What is the size of your file offsets (in bytes)?"
9186         . ./myread
9187         lseeksize="$ans"
9188 fi
9189 $rm_try
9190
9191 : see what type file positions are declared as in the library
9192 rp="What is the type for file position used by fsetpos()?"
9193 set fpos_t fpostype long stdio.h sys/types.h
9194 eval $typedef_ask
9195
9196 : Check size for Fpos_t
9197 echo " "
9198 case "$fpostype" in
9199 *_t) zzz="$fpostype"    ;;
9200 *)   zzz="fpos_t"       ;;
9201 esac
9202 echo "Checking the size of $zzz..." >&4
9203 cat > try.c <<EOCP
9204 #include <sys/types.h>
9205 #include <stdio.h>
9206 #$i_stdlib I_STDLIB
9207 #ifdef I_STDLIB
9208 #include <stdlib.h>
9209 #endif
9210 int main() {
9211     printf("%d\n", (int)sizeof($fpostype));
9212     exit(0);
9213 }
9214 EOCP
9215 set try
9216 if eval $compile_ok; then
9217         yyy=`$run ./try`
9218         case "$yyy" in
9219         '')     fpossize=4
9220                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9221                 ;;
9222         *)      fpossize=$yyy
9223                 echo "Your $zzz is $fpossize bytes long."
9224                 ;;
9225         esac
9226 else
9227         dflt="$longsize"
9228         echo " " >&4
9229         echo "(I can't compile the test program.  Guessing...)" >&4
9230         rp="What is the size of your file positions (in bytes)?"
9231         . ./myread
9232         fpossize="$ans"
9233 fi
9234
9235 : Check for large file support
9236 # Backward compatibility (uselfs is deprecated).
9237 case "$uselfs" in
9238 "$define"|true|[yY]*)
9239         cat <<EOM >&4
9240
9241 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9242 EOM
9243         uselargefiles="$define"
9244         ;;
9245 esac
9246
9247 case "$lseeksize:$fpossize" in
9248 8:8) cat <<EOM
9249
9250 You can have files larger than 2 gigabytes.
9251 EOM
9252    val="$define" ;;
9253 *)    case "$uselargefiles" in
9254    "$undef"|false|[nN]*) dflt='n' ;;
9255    *)   dflt='y' ;;
9256    esac
9257    cat <<EOM
9258
9259 Perl can be built to understand large files (files larger than 2 gigabytes)
9260 on some systems.  To do so, Configure can be run with -Duselargefiles.
9261
9262 If this doesn't make any sense to you, just accept the default '$dflt'.
9263 EOM
9264    rp='Try to understand large files, if available?'
9265    . ./myread
9266    case "$ans" in
9267    y|Y)         val="$define" ;;
9268    *)           val="$undef"  ;;
9269    esac
9270    ;;
9271 esac
9272 set uselargefiles
9273 eval $setvar
9274 : Look for a hint-file generated 'call-back-unit'.  If the
9275 : user has specified that a large files perl is to be built,
9276 : we may need to set or change some other defaults.
9277 if $test -f uselargefiles.cbu; then
9278         echo "Your platform has some specific hints regarding large file builds, using them..."
9279         . ./uselargefiles.cbu
9280 fi
9281 case "$uselargefiles" in
9282 "$define")
9283         if $test -f uselargefiles.cbu; then
9284                 echo " "
9285                 echo "Rechecking to see how big your file offsets are..." >&4
9286                 $cat >try.c <<EOCP
9287 #include <sys/types.h>
9288 #include <stdio.h>
9289 int main()
9290 {
9291     printf("%d\n", (int)sizeof($lseektype));
9292     return(0);
9293 }
9294 EOCP
9295                 set try
9296                 if eval $compile_ok; then
9297                         lseeksize=`$run ./try`
9298                         $echo "Your file offsets are now $lseeksize bytes long."
9299                 else
9300                         dflt="$lseeksize"
9301                         echo " "
9302                         echo "(I can't seem to compile the test program.  Guessing...)"
9303                         rp="What is the size of your file offsets (in bytes)?"
9304                         . ./myread
9305                         lseeksize="$ans"
9306                 fi
9307                 case "$fpostype" in
9308                 *_t) zzz="$fpostype"    ;;
9309                 *)   zzz="fpos_t"       ;;
9310                 esac
9311                 $echo $n "Rechecking the size of $zzz...$c" >&4
9312                 $cat > try.c <<EOCP
9313 #include <sys/types.h>
9314 #include <stdio.h>
9315 #$i_stdlib I_STDLIB
9316 #ifdef I_STDLIB
9317 #include <stdlib.h>
9318 #endif
9319 int main() {
9320     printf("%d\n", (int)sizeof($fpostype));
9321     return(0);
9322 }
9323 EOCP
9324                 set try
9325                 if eval $compile_ok; then
9326                         yyy=`$run ./try`
9327                         dflt="$lseeksize"
9328                         case "$yyy" in
9329                         '')     echo " "
9330                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9331                                 ;;
9332                         *)      fpossize=$yyy
9333                                 echo " $fpossize bytes." >&4
9334                                 ;;
9335                         esac
9336                 else
9337                         dflt="$fpossize"
9338                         echo " "
9339                         echo "(I can't compile the test program.  Guessing...)" >&4
9340                         rp="What is the size of your file positions (in bytes)?"
9341                         . ./myread
9342                         fpossize="$ans"
9343                 fi
9344                 $rm_try
9345         fi
9346         ;;
9347 esac
9348
9349 : Check if we want perlio
9350 useperlio="$define"
9351
9352 : Set the vendorbin variables
9353 case "$vendorprefix" in
9354 '')     d_vendorbin="$undef"
9355         vendorbin=''
9356         vendorbinexp=''
9357         ;;
9358 *)      d_vendorbin="$define"
9359         : determine where vendor-supplied executables go.
9360         case "$vendorbin" in
9361         '') dflt=$vendorprefix/bin ;;
9362         *)      dflt="$vendorbin" ;;
9363         esac
9364         fn=d~+
9365         rp='Pathname for the vendor-supplied executables directory?'
9366         . ./getfile
9367         vendorbin="$ans"
9368         vendorbinexp="$ansexp"
9369         ;;
9370 esac
9371 prefixvar=vendorbin
9372 . ./installprefix
9373
9374 : Set the vendorhtml1dir variables
9375 case "$vendorprefix" in
9376 '')     vendorhtml1dir=''
9377         vendorhtml1direxp=''
9378         ;;
9379 *)      : determine where vendor-supplied html pages go.
9380         : There is no standard location, so try to copy the previously-selected
9381         : directory structure for the core html pages.
9382         : XXX Better default suggestions would be welcome.
9383         case "$vendorhtml1dir" in
9384         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9385         *)      dflt=$vendorhtml1dir ;;
9386         esac
9387         case "$dflt" in
9388         ''|' ') dflt=none ;;
9389         esac
9390         fn=dn+~
9391         rp='Pathname for the vendor-supplied html pages?'
9392         . ./getfile
9393         vendorhtml1dir="$ans"
9394         vendorhtml1direxp="$ansexp"
9395         ;;
9396 esac
9397 : Use ' ' for none so value is preserved next time through Configure
9398 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9399 prefixvar=vendorhtml1dir
9400 . ./installprefix
9401
9402 : Set the vendorhtml3dir variables
9403 case "$vendorprefix" in
9404 '')     vendorhtml3dir=''
9405         vendorhtml3direxp=''
9406         ;;
9407 *)      : determine where vendor-supplied module html pages go.
9408         : There is no standard location, so try to copy the previously-selected
9409         : directory structure for the core html pages.
9410         : XXX Better default suggestions would be welcome.
9411         case "$vendorhtml3dir" in
9412         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9413         *)      dflt=$vendorhtml3dir ;;
9414         esac
9415         case "$dflt" in
9416         ''|' ') dflt=none ;;
9417         esac
9418         fn=dn+~
9419         rp='Pathname for the vendor-supplied html pages?'
9420         . ./getfile
9421         vendorhtml3dir="$ans"
9422         vendorhtml3direxp="$ansexp"
9423         ;;
9424 esac
9425 : Use ' ' for none so value is preserved next time through Configure
9426 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9427 prefixvar=vendorhtml3dir
9428 . ./installprefix
9429
9430 : Set the vendorman1dir variables
9431 case "$vendorprefix" in
9432 '')     vendorman1dir=''
9433         vendorman1direxp=''
9434         ;;
9435 *)      : determine where vendor-supplied manual pages go.
9436         case "$vendorman1dir" in
9437         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9438         *)      dflt=$vendorman1dir ;;
9439         esac
9440         case "$dflt" in
9441         ''|' ') dflt=none ;;
9442         esac
9443         fn=nd~+
9444         rp='Pathname for the vendor-supplied manual section 1 pages?'
9445         . ./getfile
9446         vendorman1dir="$ans"
9447         vendorman1direxp="$ansexp"
9448         ;;
9449 esac
9450 : Use ' ' for none so value is preserved next time through Configure
9451 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9452 prefixvar=vendorman1dir
9453 . ./installprefix
9454
9455 : Set the vendorman3dir variables
9456 case "$vendorprefix" in
9457 '')     vendorman3dir=''
9458         vendorman3direxp=''
9459         ;;
9460 *)      : determine where vendor-supplied module manual pages go.
9461         case "$vendorman3dir" in
9462         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9463         *)      dflt=$vendorman3dir ;;
9464         esac
9465         case "$dflt" in
9466         ''|' ') dflt=none ;;
9467         esac
9468         fn=nd~+
9469         rp='Pathname for the vendor-supplied manual section 3 pages?'
9470         . ./getfile
9471         vendorman3dir="$ans"
9472         vendorman3direxp="$ansexp"
9473         ;;
9474 esac
9475 : Use ' ' for none so value is preserved next time through Configure
9476 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9477 prefixvar=vendorman3dir
9478 . ./installprefix
9479
9480 : Set the vendorscript variables
9481 case "$vendorprefix" in
9482 '')     d_vendorscript="$undef"
9483         vendorscript=''
9484         vendorscriptexp=''
9485         ;;
9486 *)      d_vendorscript="$define"
9487         : determine where vendor-supplied scripts go.
9488         case "$vendorscript" in
9489         '')     dflt=$vendorprefix/script
9490                 $test -d $dflt || dflt=$vendorbin ;;
9491         *)  dflt="$vendorscript" ;;
9492         esac
9493         $cat <<EOM
9494
9495 The installation process will create a directory for
9496 vendor-supplied scripts.
9497
9498 EOM
9499         fn=d~+
9500         rp='Pathname for the vendor-supplied scripts directory?'
9501         . ./getfile
9502         vendorscript="$ans"
9503         vendorscriptexp="$ansexp"
9504         ;;
9505 esac
9506 prefixvar=vendorscript
9507 . ./installprefix
9508
9509 : script used to emit important warnings
9510 cat >warn <<EOS
9511 $startsh
9512 if test \$# -gt 0; then
9513         echo "\$@" >msg
9514 else
9515         cat >msg
9516 fi
9517 echo "*** WARNING:" >&4
9518 sed -e 's/^/*** /' <msg >&4
9519 echo "*** " >&4
9520 cat msg >>config.msg
9521 echo " " >>config.msg
9522 rm -f msg
9523 EOS
9524 chmod +x warn
9525 $eunicefix warn
9526
9527 : see which of string.h or strings.h is needed
9528 echo " "
9529 strings=`./findhdr string.h`
9530 if $test "$strings" && $test -r "$strings"; then
9531         echo "Using <string.h> instead of <strings.h>." >&4
9532         val="$define"
9533 else
9534         val="$undef"
9535         strings=`./findhdr strings.h`
9536         if $test "$strings" && $test -r "$strings"; then
9537                 echo "Using <strings.h> instead of <string.h>." >&4
9538         else
9539                 ./warn "No string header found -- You'll surely have problems."
9540         fi
9541 fi
9542 set i_string
9543 eval $setvar
9544 case "$i_string" in
9545 "$undef") strings=`./findhdr strings.h`;;
9546 *)        strings=`./findhdr string.h`;;
9547 esac
9548
9549 : see if qgcvt exists
9550 set qgcvt d_qgcvt
9551 eval $inlibc
9552
9553 : Check print/scan long double stuff
9554 echo " "
9555
9556 if $test X"$d_longdbl" = X"$define"; then
9557
9558 echo "Checking how to print long doubles..." >&4
9559
9560 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9561         $cat >try.c <<'EOCP'
9562 #include <sys/types.h>
9563 #include <stdio.h>
9564 int main() {
9565   double d = 123.456;
9566   printf("%.3f\n", d);
9567 }
9568 EOCP
9569         set try
9570         if eval $compile; then
9571                 yyy=`$run ./try`
9572                 case "$yyy" in
9573                 123.456)
9574                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9575                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9576                         echo "We will use %f."
9577                         ;;
9578                 esac
9579         fi
9580 fi
9581
9582 if $test X"$sPRIfldbl" = X; then
9583         $cat >try.c <<'EOCP'
9584 #include <sys/types.h>
9585 #include <stdio.h>
9586 int main() {
9587   long double d = 123.456;
9588   printf("%.3Lf\n", d);
9589 }
9590 EOCP
9591         set try
9592         if eval $compile; then
9593                 yyy=`$run ./try`
9594                 case "$yyy" in
9595                 123.456)
9596                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9597                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9598                         echo "We will use %Lf."
9599                         ;;
9600                 esac
9601         fi
9602 fi
9603
9604 if $test X"$sPRIfldbl" = X; then
9605         $cat >try.c <<'EOCP'
9606 #include <sys/types.h>
9607 #include <stdio.h>
9608 int main() {
9609   long double d = 123.456;
9610   printf("%.3llf\n", d);
9611 }
9612 EOCP
9613         set try
9614         if eval $compile; then
9615                 yyy=`$run ./try`
9616                 case "$yyy" in
9617                 123.456)
9618                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9619                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9620                         echo "We will use %llf."
9621                         ;;
9622                 esac
9623         fi
9624 fi
9625
9626 if $test X"$sPRIfldbl" = X; then
9627         $cat >try.c <<'EOCP'
9628 #include <sys/types.h>
9629 #include <stdio.h>
9630 int main() {
9631   long double d = 123.456;
9632   printf("%.3lf\n", d);
9633 }
9634 EOCP
9635         set try
9636         if eval $compile; then
9637                 yyy=`$run ./try`
9638                 case "$yyy" in
9639                 123.456)
9640                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9641                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9642                         echo "We will use %lf."
9643                         ;;
9644                 esac
9645         fi
9646 fi
9647
9648 if $test X"$sPRIfldbl" = X; then
9649         echo "Cannot figure out how to print long doubles." >&4
9650 else
9651         sSCNfldbl=$sPRIfldbl    # expect consistency
9652 fi
9653
9654 $rm_try
9655
9656 fi # d_longdbl
9657
9658 case "$sPRIfldbl" in
9659 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9660         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9661         d_SCNfldbl="$undef";
9662         ;;
9663 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9664         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9665         d_SCNfldbl="$define";
9666         ;;
9667 esac
9668
9669 : Check how to convert floats to strings.
9670
9671 if test "X$d_Gconvert" = X; then
9672
9673 echo " "
9674 echo "Checking for an efficient way to convert floats to strings."
9675 echo " " > try.c
9676 case "$uselongdouble" in
9677 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9678 esac
9679 case "$d_longdbl" in
9680 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9681 esac
9682 case "$d_PRIgldbl" in
9683 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9684 esac
9685 $cat >>try.c <<EOP
9686 #ifdef TRY_gconvert
9687 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9688 char *myname = "gconvert";
9689 #endif
9690 #ifdef TRY_gcvt
9691 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9692 char *myname = "gcvt";
9693 #endif
9694 #ifdef TRY_qgcvt
9695 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9696 char *myname = "qgcvt";
9697 #define DOUBLETYPE long double
9698 #endif
9699 #ifdef TRY_sprintf
9700 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9701 #ifdef HAS_PRIgldbl
9702 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9703 #else
9704 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9705 #endif
9706 #else
9707 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9708 #endif
9709 char *myname = "sprintf";
9710 #endif
9711
9712 #ifndef DOUBLETYPE
9713 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9714 #define DOUBLETYPE long double
9715 #else
9716 #define DOUBLETYPE double
9717 #endif
9718 #endif
9719
9720 #include <stdio.h>
9721
9722 #$i_stdlib I_STDLIB
9723 #ifdef I_STDLIB
9724 #include <stdlib.h>
9725 #endif
9726 #$i_string I_STRING
9727 #ifdef I_STRING
9728 #  include <string.h>
9729 #else
9730 #  include <strings.h>
9731 #endif
9732
9733 int checkit(char *expect, char *got)
9734 {
9735     if (strcmp(expect, got)) {
9736                 printf("%s oddity:  Expected %s, got %s\n",
9737                         myname, expect, got);
9738                 exit(1);
9739         }
9740 }
9741
9742 int main()
9743 {
9744         char buf[64];
9745         buf[63] = '\0';
9746
9747         /* This must be 1st test on (which?) platform */
9748         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9749         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9750         checkit("0.1", buf);
9751
9752         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9753         checkit("0.01", buf);
9754
9755         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9756         checkit("0.001", buf);
9757
9758         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9759         checkit("0.0001", buf);
9760
9761         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9762         if (strlen(buf) > 5)
9763             checkit("9e-005", buf); /* for Microsoft ?? */
9764         else
9765             checkit("9e-05", buf);
9766
9767         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9768         checkit("1", buf);
9769
9770         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9771         checkit("1.1", buf);
9772
9773         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9774         checkit("1.01", buf);
9775
9776         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9777         checkit("1.001", buf);
9778
9779         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9780         checkit("1.0001", buf);
9781
9782         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9783         checkit("1.00001", buf);
9784
9785         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9786         checkit("1.000001", buf);
9787
9788         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9789         checkit("0", buf);
9790
9791         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9792         checkit("-1", buf);
9793
9794         /* Some Linux gcvt's give 1.e+5 here. */
9795         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9796         checkit("100000", buf);
9797
9798         /* Some Linux gcvt's give -1.e+5 here. */
9799         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9800         checkit("-100000", buf);
9801
9802         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9803         checkit("123.456", buf);
9804
9805         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9806         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9807         /* 34 should be enough to scare even long double
9808          * places into using the e notation. */
9809         if (strlen(buf) > 5)
9810             checkit("1e+034", buf); /* for Microsoft */
9811         else
9812             checkit("1e+34", buf);
9813
9814         /* For Perl, if you add additional tests here, also add them to
9815          * t/base/num.t for benefit of platforms not using Configure or
9816          * overriding d_Gconvert */
9817
9818         exit(0);
9819 }
9820 EOP
9821 : first add preferred functions to our list
9822 xxx_list=""
9823 for xxx_convert in $gconvert_preference; do
9824     case $xxx_convert in
9825     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9826     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9827     esac
9828 done
9829 : then add any others
9830 for xxx_convert in gconvert gcvt sprintf; do
9831     case "$xxx_list" in
9832     *$xxx_convert*) ;;
9833     *) xxx_list="$xxx_list $xxx_convert" ;;
9834     esac
9835 done
9836
9837 case "$d_longdbl$uselongdouble" in
9838 "$define$define")
9839     : again, add preferred functions to our list first
9840     xxx_ld_list=""
9841     for xxx_convert in $gconvert_ld_preference; do
9842         case $xxx_convert in
9843         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9844         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9845         esac
9846     done
9847     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9848     for xxx_convert in qgcvt sprintf $xxx_list; do
9849         case "$xxx_ld_list" in
9850         $xxx_convert*|*" $xxx_convert"*) ;;
9851         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9852         esac
9853     done
9854     : if sprintf cannot do long doubles, move it to the end
9855     if test "$d_PRIgldbl" != "$define"; then
9856         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9857     fi
9858     : if no qgcvt, remove it
9859     if test "$d_qgcvt" != "$define"; then
9860         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9861     fi
9862     : use the ld_list
9863     xxx_list="$xxx_ld_list"
9864     ;;
9865 esac
9866
9867 for xxx_convert in $xxx_list; do
9868         echo "Trying $xxx_convert..."
9869         $rm -f try try$_o core
9870         set try -DTRY_$xxx_convert
9871         if eval $compile; then
9872                 echo "$xxx_convert() found." >&4
9873                 if $run ./try; then
9874                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9875                         break;
9876                 else
9877                         echo "...But $xxx_convert didn't work as I expected."
9878                         xxx_convert=''
9879                 fi
9880         else
9881                 echo "$xxx_convert NOT found." >&4
9882         fi
9883 done
9884
9885 if test X$xxx_convert = X; then
9886     echo "*** WHOA THERE!!! ***" >&4
9887     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9888     xxx_convert=sprintf
9889 fi
9890
9891 case "$xxx_convert" in
9892 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9893 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9894 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9895 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9896    "$define$define$define")
9897       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9898    "$define$define$undef")
9899       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9900    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9901    esac
9902    ;;
9903 esac
9904
9905 fi
9906 $rm_try
9907
9908 : see if _fwalk exists
9909 set fwalk d__fwalk
9910 eval $inlibc
9911
9912 : Initialize h_fcntl
9913 h_fcntl=false
9914
9915 : Initialize h_sysfile
9916 h_sysfile=false
9917
9918 : access call always available on UNIX
9919 set access d_access
9920 eval $inlibc
9921
9922 : locate the flags for 'access()'
9923 case "$d_access" in
9924 "$define")
9925         echo " "
9926         $cat >access.c <<EOCP
9927 #include <sys/types.h>
9928 #ifdef I_FCNTL
9929 #include <fcntl.h>
9930 #endif
9931 #ifdef I_SYS_FILE
9932 #include <sys/file.h>
9933 #endif
9934 #ifdef I_UNISTD
9935 #include <unistd.h>
9936 #endif
9937 #$i_stdlib I_STDLIB
9938 #ifdef I_STDLIB
9939 #include <stdlib.h>
9940 #endif
9941 int main() {
9942         exit(R_OK);
9943 }
9944 EOCP
9945         : check sys/file.h first, no particular reason here
9946         if $test `./findhdr sys/file.h` && \
9947                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9948                 h_sysfile=true;
9949                 echo "<sys/file.h> defines the *_OK access constants." >&4
9950         elif $test `./findhdr fcntl.h` && \
9951                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9952                 h_fcntl=true;
9953                 echo "<fcntl.h> defines the *_OK access constants." >&4
9954         elif $test `./findhdr unistd.h` && \
9955                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9956                 echo "<unistd.h> defines the *_OK access constants." >&4
9957         else
9958                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9959         fi
9960         ;;
9961 esac
9962 $rm -f access*
9963
9964 : see if accessx exists
9965 set accessx d_accessx
9966 eval $inlibc
9967
9968 : see if aintl exists
9969 set aintl d_aintl
9970 eval $inlibc
9971
9972 : see if alarm exists
9973 set alarm d_alarm
9974 eval $inlibc
9975
9976 : see if 64bit time functions exists
9977
9978 set ctime64 d_ctime64
9979 eval $inlibc
9980
9981 set localtime64 d_localtime64
9982 eval $inlibc
9983
9984 set gmtime64 d_gmtime64
9985 eval $inlibc
9986
9987 set mktime64 d_mktime64
9988 eval $inlibc
9989
9990 set difftime64 d_difftime64
9991 eval $inlibc
9992
9993 set asctime64 d_asctime64
9994 eval $inlibc
9995
9996 : see if POSIX threads are available
9997 set pthread.h i_pthread
9998 eval $inhdr
9999
10000 : define a function to check prototypes
10001 $cat > protochk <<EOSH
10002 $startsh
10003 cc="$cc"
10004 optimize="$optimize"
10005 ccflags="$ccflags"
10006 prototype="$prototype"
10007 define="$define"
10008 rm_try="$rm_try"
10009 usethreads=$usethreads
10010 i_pthread=$i_pthread
10011 pthread_h_first=$pthread_h_first
10012 EOSH
10013
10014 $cat >> protochk <<'EOSH'
10015
10016 $rm_try
10017 foo="$1"
10018 shift
10019 while test $# -ge 2; do
10020         case "$1" in
10021                 $define) echo "#include <$2>" >> try.c ;;
10022                 literal) echo "$2" >> try.c ;;
10023         esac
10024     # Extra magic for the benefit of systems that need pthread.h
10025     # to be included early to correctly detect threadsafe functions.
10026     # Such functions must guarantee themselves, though, that the usethreads
10027     # and i_pthread have been defined, before calling protochk.
10028     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10029         echo "#include <pthread.h>" >> try.c
10030         pthread_h_done=yes
10031     fi
10032     shift 2
10033 done
10034 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10035 cat >> try.c <<'EOCP'
10036 #ifdef CAN_PROTOTYPE
10037 #define _(args) args
10038 #else
10039 #define _(args) ()
10040 #endif
10041 EOCP
10042 echo "$foo" >> try.c
10043 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10044 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10045 status=$?
10046 $rm_try
10047 exit $status
10048 EOSH
10049 chmod +x protochk
10050 $eunicefix protochk
10051
10052 : Define hasproto macro for Configure internal use
10053 hasproto='varname=$1; func=$2; shift; shift;
10054 while $test $# -ge 2; do
10055         case "$1" in
10056         $define) echo "#include <$2>";;
10057         esac ;
10058     shift 2;
10059 done > try.c;
10060 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10061 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10062         echo "$func() prototype found.";
10063         val="$define";
10064 else
10065         echo "$func() prototype NOT found.";
10066         val="$undef";
10067 fi;
10068 set $varname;
10069 eval $setvar;
10070 $rm_try tryout.c'
10071
10072 : see if sys/types.h has to be included
10073 set sys/types.h i_systypes
10074 eval $inhdr
10075
10076 : see if sys/select.h has to be included
10077 set sys/select.h i_sysselct
10078 eval $inhdr
10079
10080 : Define hasfield macro for Configure internal use
10081 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10082 while $test $# -ge 2; do
10083         case "$1" in
10084         $define) echo "#include <$2>";;
10085         esac ;
10086     shift 2;
10087 done > try.c;
10088 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10089 set try;
10090 if eval $compile; then
10091         val="$define";
10092 else
10093         val="$undef";
10094 fi;
10095 set $varname;
10096 eval $setvar;
10097 $rm_try'
10098
10099 : see if we should include time.h, sys/time.h, or both
10100 echo " "
10101 if test "X$timeincl" = X; then
10102         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10103         $echo $n "I'm now running the test program...$c"
10104         $cat >try.c <<EOCP
10105 #include <sys/types.h>
10106 #ifdef I_TIME
10107 #include <time.h>
10108 #endif
10109 #ifdef I_SYSTIME
10110 #ifdef SYSTIMEKERNEL
10111 #define KERNEL
10112 #endif
10113 #include <sys/time.h>
10114 #endif
10115 #ifdef I_SYSSELECT
10116 #include <sys/select.h>
10117 #endif
10118 #$i_stdlib I_STDLIB
10119 #ifdef I_STDLIB
10120 #include <stdlib.h>
10121 #endif
10122 int main()
10123 {
10124         struct tm foo;
10125 #ifdef S_TIMEVAL
10126         struct timeval bar;
10127 #endif
10128 #ifdef S_TIMEZONE
10129         struct timezone tzp;
10130 #endif
10131         if (foo.tm_sec == foo.tm_sec)
10132                 exit(0);
10133 #ifdef S_TIMEVAL
10134         if (bar.tv_sec == bar.tv_sec)
10135                 exit(0);
10136 #endif
10137         exit(1);
10138 }
10139 EOCP
10140         flags=''
10141         for s_timezone in '-DS_TIMEZONE' ''; do
10142         sysselect=''
10143         for s_timeval in '-DS_TIMEVAL' ''; do
10144         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10145         for i_time in '' '-DI_TIME'; do
10146         for i_systime in '-DI_SYSTIME' ''; do
10147                 case "$flags" in
10148                 '') $echo $n ".$c"
10149                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10150                         if eval $compile; then
10151                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10152                                 shift
10153                                 flags="$*"
10154                                 echo " "
10155                                 $echo $n "Succeeded with $flags$c"
10156                         fi
10157                         ;;
10158                 esac
10159         done
10160         done
10161         done
10162         done
10163         done
10164         timeincl=''
10165         echo " "
10166         case "$flags" in
10167         *SYSTIMEKERNEL*) i_systimek="$define"
10168                 timeincl=`./findhdr sys/time.h`
10169                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10170         *) i_systimek="$undef";;
10171         esac
10172         case "$flags" in
10173         *I_TIME*) i_time="$define"
10174                 timeincl=`./findhdr time.h`" $timeincl"
10175                 echo "We'll include <time.h>." >&4;;
10176         *) i_time="$undef";;
10177         esac
10178         case "$flags" in
10179         *I_SYSTIME*) i_systime="$define"
10180                 timeincl=`./findhdr sys/time.h`" $timeincl"
10181                 echo "We'll include <sys/time.h>." >&4;;
10182         *) i_systime="$undef";;
10183         esac
10184         $rm_try
10185 fi
10186 : see if struct tm knows about tm_zone
10187 case "$i_systime$i_time" in
10188 *$define*)
10189         echo " "
10190         echo "Checking to see if your struct tm has tm_zone field..." >&4
10191         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10192         eval $hasfield
10193         ;;
10194 *)      val="$undef"
10195         set d_tm_tm_zone
10196         eval $setvar
10197         ;;
10198 esac
10199 case "$d_tm_tm_zone" in
10200 "$define")      echo "Yes, it does."   ;;
10201 *)              echo "No, it doesn't." ;;
10202 esac
10203 : see if struct tm knows about tm_gmtoff
10204 case "$i_systime$i_time" in
10205 *$define*)
10206         echo " "
10207         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10208         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10209         eval $hasfield
10210         ;;
10211 *)      val="$undef"
10212         set d_tm_tm_gmtoff
10213         eval $setvar
10214         ;;
10215 esac
10216 case "$d_tm_tm_gmtoff" in
10217 "$define")      echo "Yes, it does."   ;;
10218 *)              echo "No, it doesn't." ;;
10219 esac
10220
10221 : see if asctime_r exists
10222 set asctime_r d_asctime_r
10223 eval $inlibc
10224 case "$d_asctime_r" in
10225 "$define")
10226         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10227         case "$d_asctime_r_proto:$usethreads" in
10228         ":define")      d_asctime_r_proto=define
10229                 set d_asctime_r_proto asctime_r $hdrs
10230                 eval $hasproto ;;
10231         *)      ;;
10232         esac
10233         case "$d_asctime_r_proto" in
10234         define)
10235         case "$asctime_r_proto" in
10236         ''|0) try='char* asctime_r(const struct tm*, char*);'
10237         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10238         esac
10239         case "$asctime_r_proto" in
10240         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10241         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10242         esac
10243         case "$asctime_r_proto" in
10244         ''|0) try='int asctime_r(const struct tm*, char*);'
10245         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10246         esac
10247         case "$asctime_r_proto" in
10248         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10249         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10250         esac
10251         case "$asctime_r_proto" in
10252         ''|0)   d_asctime_r=undef
10253                 asctime_r_proto=0
10254                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10255         * )     case "$asctime_r_proto" in
10256                 REENTRANT_PROTO*) ;;
10257                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10258                 esac
10259                 echo "Prototype: $try" ;;
10260         esac
10261         ;;
10262         *)      case "$usethreads" in
10263                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10264                 esac
10265                 d_asctime_r=undef
10266                 asctime_r_proto=0
10267                 ;;
10268         esac
10269         ;;
10270 *)      asctime_r_proto=0
10271         ;;
10272 esac
10273
10274 : see if atolf exists
10275 set atolf d_atolf
10276 eval $inlibc
10277
10278 : see if atoll exists
10279 set atoll d_atoll
10280 eval $inlibc
10281
10282 : Look for GCC-style attribute format
10283 case "$d_attribute_format" in
10284 '')
10285 echo " "
10286 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10287 $cat >attrib.c <<'EOCP'
10288 #include <stdio.h>
10289 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10290 EOCP
10291 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10292         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10293                 echo "Your C compiler doesn't support __attribute__((format))."
10294                 val="$undef"
10295         else
10296                 echo "Your C compiler supports __attribute__((format))."
10297                 val="$define"
10298         fi
10299 else
10300         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10301         val="$undef"
10302 fi
10303 ;;
10304 *) val="$d_attribute_format" ;;
10305 esac
10306 set d_attribute_format
10307 eval $setvar
10308 $rm -f attrib*
10309
10310 : Look for GCC-style attribute format with null format allowed
10311 case "$d_printf_format_null" in
10312 '') case "$d_attribute_format" in
10313     $define)
10314         echo " "
10315         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10316 $cat >attrib.c <<EOCP
10317 #include <stdio.h>
10318 #$i_stdlib I_STDLIB
10319 #ifdef I_STDLIB
10320 #include <stdlib.h>
10321 #endif
10322 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10323 int null_printf (char* pat,...) { return (int)pat; }
10324 int main () { exit(null_printf(NULL)); }
10325 EOCP
10326         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10327             : run the executable in case it produces a run-time warning
10328             if $run ./attrib >>attrib.out 2>&1; then
10329                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10330                     echo "Your C compiler doesn't allow __printf__ format to be null."
10331                     val="$undef"
10332                 else
10333                     echo "Your C compiler allows __printf__ format to be null."
10334                     val="$define"
10335                 fi
10336             else
10337             echo "Your C compiler executable failed with __printf__ format null."
10338             val="$undef"
10339         fi
10340     else
10341         echo "Your C compiler fails with __printf__ format null."
10342         val="$undef"
10343     fi
10344     ;;
10345     *)  val="$undef" ;;
10346     esac
10347 ;;
10348 *)  val="$d_printf_format_null" ;;
10349 esac
10350 set d_printf_format_null
10351 eval $setvar
10352 $rm -f attrib*
10353
10354 : Look for GCC-style attribute malloc
10355 case "$d_attribute_malloc" in
10356 '')
10357 echo " "
10358 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10359 $cat >attrib.c <<'EOCP'
10360 #include <stdio.h>
10361 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10362 EOCP
10363 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10364         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10365                 echo "Your C compiler doesn't support __attribute__((malloc))."
10366                 val="$undef"
10367         else
10368                 echo "Your C compiler supports __attribute__((malloc))."
10369                 val="$define"
10370         fi
10371 else
10372         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10373         val="$undef"
10374 fi
10375 ;;
10376 *) val="$d_attribute_malloc" ;;
10377 esac
10378 set d_attribute_malloc
10379 eval $setvar
10380 $rm -f attrib*
10381
10382 : Look for GCC-style attribute nonnull
10383 case "$d_attribute_nonnull" in
10384 '')
10385 echo " "
10386 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10387 $cat >attrib.c <<'EOCP'
10388 #include <stdio.h>
10389 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10390 EOCP
10391 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10392         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10393                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10394                 val="$undef"
10395         else
10396                 echo "Your C compiler supports __attribute__((nonnull))."
10397                 val="$define"
10398         fi
10399 else
10400         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10401         val="$undef"
10402 fi
10403 ;;
10404 *) val="$d_attribute_nonnull" ;;
10405 esac
10406 set d_attribute_nonnull
10407 eval $setvar
10408 $rm -f attrib*
10409
10410 : Look for GCC-style attribute noreturn
10411 case "$d_attribute_noreturn" in
10412 '')
10413 echo " "
10414 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10415 $cat >attrib.c <<'EOCP'
10416 #include <stdio.h>
10417 void fall_over_dead( void ) __attribute__((noreturn));
10418 EOCP
10419 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10420         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10421                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10422                 val="$undef"
10423         else
10424                 echo "Your C compiler supports __attribute__((noreturn))."
10425                 val="$define"
10426         fi
10427 else
10428         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10429         val="$undef"
10430 fi
10431 ;;
10432 *) val="$d_attribute_noreturn" ;;
10433 esac
10434 set d_attribute_noreturn
10435 eval $setvar
10436 $rm -f attrib*
10437
10438 : Look for GCC-style attribute pure
10439 case "$d_attribute_pure" in
10440 '')
10441 echo " "
10442 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10443 $cat >attrib.c <<'EOCP'
10444 #include <stdio.h>
10445 int square( int n ) __attribute__((pure));
10446 EOCP
10447 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10448         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10449                 echo "Your C compiler doesn't support __attribute__((pure))."
10450                 val="$undef"
10451         else
10452                 echo "Your C compiler supports __attribute__((pure))."
10453                 val="$define"
10454         fi
10455 else
10456         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10457         val="$undef"
10458 fi
10459 ;;
10460 *) val="$d_attribute_pure" ;;
10461 esac
10462 set d_attribute_pure
10463 eval $setvar
10464 $rm -f attrib*
10465
10466 : Look for GCC-style attribute unused
10467 case "$d_attribute_unused" in
10468 '')
10469 echo " "
10470 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10471 $cat >attrib.c <<'EOCP'
10472 #include <stdio.h>
10473 int do_something( int dummy __attribute__((unused)), int n );
10474 EOCP
10475 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10476         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10477                 echo "Your C compiler doesn't support __attribute__((unused))."
10478                 val="$undef"
10479         else
10480                 echo "Your C compiler supports __attribute__((unused))."
10481                 val="$define"
10482         fi
10483 else
10484         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10485         val="$undef"
10486 fi
10487 ;;
10488 *) val="$d_attribute_unused" ;;
10489 esac
10490 set d_attribute_unused
10491 eval $setvar
10492 $rm -f attrib*
10493
10494 : Look for GCC-style attribute deprecated
10495 case "$d_attribute_deprecated" in
10496 '')
10497 echo " "
10498 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10499 $cat >attrib.c <<'EOCP'
10500 #include <stdio.h>
10501 int I_am_deprecated(void) __attribute__((deprecated));
10502 EOCP
10503 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10504         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10505                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10506                 val="$undef"
10507         else
10508                 echo "Your C compiler supports __attribute__((deprecated))."
10509                 val="$define"
10510         fi
10511 else
10512         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10513         val="$undef"
10514 fi
10515 ;;
10516 *) val="$d_attribute_deprecated" ;;
10517 esac
10518 set d_attribute_deprecated
10519 eval $setvar
10520 $rm -f attrib*
10521
10522 : Look for GCC-style attribute warn_unused_result
10523 case "$d_attribute_warn_unused_result" in
10524 '')
10525 echo " "
10526 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10527 $cat >attrib.c <<'EOCP'
10528 #include <stdio.h>
10529 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10530 EOCP
10531 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10532         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10533                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10534                 val="$undef"
10535         else
10536                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10537                 val="$define"
10538         fi
10539 else
10540         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10541         val="$undef"
10542 fi
10543 ;;
10544 *) val="$d_attribute_warn_unused_result" ;;
10545 esac
10546 set d_attribute_warn_unused_result
10547 eval $setvar
10548 $rm -f attrib*
10549
10550 : see if bcmp exists
10551 set bcmp d_bcmp
10552 eval $inlibc
10553
10554 : see if bcopy exists
10555 set bcopy d_bcopy
10556 eval $inlibc
10557
10558 : see if getpgrp exists
10559 set getpgrp d_getpgrp
10560 eval $inlibc
10561
10562 case "$d_getpgrp" in
10563 "$define")
10564         echo " "
10565         echo "Checking to see which flavor of getpgrp is in use..."
10566         $cat >try.c <<EOP
10567 #$i_unistd I_UNISTD
10568 #include <sys/types.h>
10569 #ifdef I_UNISTD
10570 #  include <unistd.h>
10571 #endif
10572 #$i_stdlib I_STDLIB
10573 #ifdef I_STDLIB
10574 #include <stdlib.h>
10575 #endif
10576 int main()
10577 {
10578         if (getuid() == 0) {
10579                 printf("(I see you are running Configure as super-user...)\n");
10580                 setuid(1);
10581         }
10582 #ifdef TRY_BSD_PGRP
10583         if (getpgrp(1) == 0)
10584                 exit(0);
10585 #else
10586         if (getpgrp() > 0)
10587                 exit(0);
10588 #endif
10589         exit(1);
10590 }
10591 EOP
10592         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10593                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10594                 val="$define"
10595         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10596                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10597                 val="$undef"
10598         else
10599                 echo "I can't seem to compile and run the test program."
10600                 if ./usg; then
10601                         xxx="a USG one, i.e. you use getpgrp()."
10602                 else
10603                         # SVR4 systems can appear rather BSD-ish.
10604                         case "$i_unistd" in
10605                         $undef)
10606                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10607                                 val="$define"
10608                                 ;;
10609                         $define)
10610                                 xxx="probably a USG one, i.e. you use getpgrp()."
10611                                 val="$undef"
10612                                 ;;
10613                         esac
10614                 fi
10615                 echo "Assuming your getpgrp is $xxx" >&4
10616         fi
10617         ;;
10618 *) val="$undef";;
10619 esac
10620 set d_bsdgetpgrp
10621 eval $setvar
10622 $rm_try
10623
10624 : see if setpgrp exists
10625 set setpgrp d_setpgrp
10626 eval $inlibc
10627
10628 case "$d_setpgrp" in
10629 "$define")
10630         echo " "
10631         echo "Checking to see which flavor of setpgrp is in use..."
10632         $cat >try.c <<EOP
10633 #$i_unistd I_UNISTD
10634 #include <sys/types.h>
10635 #ifdef I_UNISTD
10636 #  include <unistd.h>
10637 #endif
10638 #$i_stdlib I_STDLIB
10639 #ifdef I_STDLIB
10640 #include <stdlib.h>
10641 #endif
10642 int main()
10643 {
10644         if (getuid() == 0) {
10645                 printf("(I see you are running Configure as super-user...)\n");
10646                 setuid(1);
10647         }
10648 #ifdef TRY_BSD_PGRP
10649         if (-1 == setpgrp(1, 1))
10650                 exit(0);
10651 #else
10652         if (setpgrp() != -1)
10653                 exit(0);
10654 #endif
10655         exit(1);
10656 }
10657 EOP
10658         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10659                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10660                 val="$define"
10661         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10662                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10663                 val="$undef"
10664         else
10665                 echo "(I can't seem to compile and run the test program.)"
10666                 if ./usg; then
10667                         xxx="a USG one, i.e. you use setpgrp()."
10668                 else
10669                         # SVR4 systems can appear rather BSD-ish.
10670                         case "$i_unistd" in
10671                         $undef)
10672                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10673                                 val="$define"
10674                                 ;;
10675                         $define)
10676                                 xxx="probably a USG one, i.e. you use setpgrp()."
10677                                 val="$undef"
10678                                 ;;
10679                         esac
10680                 fi
10681                 echo "Assuming your setpgrp is $xxx" >&4
10682         fi
10683         ;;
10684 *) val="$undef";;
10685 esac
10686 set d_bsdsetpgrp
10687 eval $setvar
10688 $rm_try
10689
10690 : Look for GCC-style __builtin_choose_expr
10691 case "$d_builtin_choose_expr" in
10692 '')
10693     echo " "
10694     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10695     $cat >try.c <<'EOCP'
10696 #include <assert.h>
10697 #include <stdlib.h>
10698 #include <stdio.h>
10699
10700 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10701
10702 int main(void) {
10703     assert( SYRINX(1) == 2112 );
10704     assert( SYRINX(1) != 5150 );
10705     assert( SYRINX(0) == 5150 );
10706     assert( SYRINX(0) != 2112 );
10707     puts( "All good!" );
10708     exit(0);
10709 }
10710
10711 EOCP
10712     set try
10713     if eval $compile && $run ./try; then
10714         echo "Your C compiler supports __builtin_choose_expr."
10715         val="$define"
10716     else
10717         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10718         val="$undef"
10719     fi
10720 ;;
10721 *) val="$d_builtin_choose_expr" ;;
10722 esac
10723
10724 set d_builtin_choose_expr
10725 eval $setvar
10726 $rm_try
10727
10728 : Look for GCC-style __builtin_expect
10729 case "$d_builtin_expect" in
10730 '')
10731     echo " "
10732     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10733     $cat >try.c <<'EOCP'
10734 int main(void) {
10735     int n = 50;
10736     if ( __builtin_expect(n, 0) ) n = 1;
10737     /* Remember shell exit code truth is 0, C truth is non-zero */
10738     return !(n == 1);
10739 }
10740 EOCP
10741     set try
10742     if eval $compile && $run ./try; then
10743         echo "Your C compiler supports __builtin_expect."
10744         val="$define"
10745     else
10746         echo "Your C compiler doesn't seem to understand __builtin_expect."
10747         val="$undef"
10748     fi
10749     ;;
10750 *) val="$d_builtin_expect" ;;
10751 esac
10752
10753 set d_builtin_expect
10754 eval $setvar
10755 $rm_try
10756
10757 : see if bzero exists
10758 set bzero d_bzero
10759 eval $inlibc
10760
10761 : see if stdarg is available
10762 echo " "
10763 if $test `./findhdr stdarg.h`; then
10764         echo "<stdarg.h> found." >&4
10765         valstd="$define"
10766 else
10767         echo "<stdarg.h> NOT found." >&4
10768         valstd="$undef"
10769 fi
10770
10771 : see if varargs is available
10772 echo " "
10773 if $test `./findhdr varargs.h`; then
10774         echo "<varargs.h> found." >&4
10775 else
10776         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10777 fi
10778
10779 : set up the varargs testing programs
10780 $cat > varargs.c <<EOP
10781 #ifdef I_STDARG
10782 #include <stdarg.h>
10783 #endif
10784 #ifdef I_VARARGS
10785 #include <varargs.h>
10786 #endif
10787
10788 #ifdef I_STDARG
10789 int f(char *p, ...)
10790 #else
10791 int f(va_alist)
10792 va_dcl
10793 #endif
10794 {
10795         va_list ap;
10796 #ifndef I_STDARG
10797         char *p;
10798 #endif
10799 #ifdef I_STDARG
10800         va_start(ap,p);
10801 #else
10802         va_start(ap);
10803         p = va_arg(ap, char *);
10804 #endif
10805         va_end(ap);
10806         return 0;
10807 }
10808 EOP
10809 $cat > varargs <<EOP
10810 $startsh
10811 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10812         echo "true"
10813 else
10814         echo "false"
10815 fi
10816 $rm -f varargs$_o
10817 EOP
10818 chmod +x varargs
10819
10820 : now check which varargs header should be included
10821 echo " "
10822 i_varhdr=''
10823 val=''
10824 case "$valstd" in
10825 "$define")
10826         if `./varargs I_STDARG`; then
10827                 val='stdarg.h'
10828         elif `./varargs I_VARARGS`; then
10829                 val='varargs.h'
10830         fi
10831         ;;
10832 *)
10833         if `./varargs I_VARARGS`; then
10834                 val='varargs.h'
10835         fi
10836         ;;
10837 esac
10838 case "$val" in
10839 '')
10840         echo " "
10841         echo "*** WHOA THERE!!! ***" >&4
10842         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
10843         case "$knowitall" in
10844         '')
10845         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
10846                 exit 1
10847                 ;;
10848         esac
10849 echo "I could not find the definition for va_dcl... You have problems..." >&4
10850         val="$undef"; set i_stdarg; eval $setvar
10851         val="$undef"; set i_varargs; eval $setvar
10852         ;;
10853 *)
10854         set i_varhdr
10855         eval $setvar
10856         case "$i_varhdr" in
10857         stdarg.h)
10858                 val="$define"; set i_stdarg; eval $setvar
10859                 val="$undef"; set i_varargs; eval $setvar
10860                 ;;
10861         varargs.h)
10862                 val="$undef"; set i_stdarg; eval $setvar
10863                 val="$define"; set i_varargs; eval $setvar
10864                 ;;
10865         esac
10866         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10867 esac
10868 $rm -f varargs*
10869
10870 : see if the Compiler supports C99 variadic macros
10871 case "$i_stdarg$i_stdlib" in
10872     "$define$define")
10873     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10874     $cat >try.c <<EOCP
10875 #include <stdio.h>
10876 #include <stdarg.h>
10877
10878 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10879
10880 int main() {
10881   char buf[20];
10882   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10883   puts(buf);
10884   return 0;
10885 }
10886 EOCP
10887     set try
10888     if eval $compile && $run ./try 2>&1 >/dev/null; then
10889         case "`$run ./try`" in
10890             "123 456 789")
10891             echo "You have C99 variadic macros." >&4
10892             d_c99_variadic_macros="$define"
10893             ;;
10894             *)
10895             echo "You don't have functional C99 variadic macros." >&4
10896             d_c99_variadic_macros="$undef"
10897             ;;
10898         esac
10899     else
10900         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10901         d_c99_variadic_macros="$undef"
10902     fi
10903     $rm_try
10904     ;;
10905     *)
10906     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10907     d_c99_variadic_macros="$undef"
10908     ;;
10909 esac
10910
10911 : see if signal is declared as pointer to function returning int or void
10912 echo " "
10913 xxx=`./findhdr signal.h`
10914 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10915 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10916         echo "You have int (*signal())() instead of void." >&4
10917         val="$undef"
10918 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10919         echo "You have void (*signal())()." >&4
10920         val="$define"
10921 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10922         echo "You have int (*signal())() instead of void." >&4
10923         val="$undef"
10924 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10925         echo "You have void (*signal())()." >&4
10926         val="$define"
10927 else
10928         case "$d_voidsig" in
10929         '')
10930         echo "I can't determine whether signal handler returns void or int..." >&4
10931                 dflt=void
10932                 rp="What type does your signal handler return?"
10933                 . ./myread
10934                 case "$ans" in
10935                 v*) val="$define";;
10936                 *) val="$undef";;
10937                 esac;;
10938         "$define")
10939                 echo "As you already told me, signal handler returns void." >&4
10940                 val="$define"
10941                 ;;
10942         *)      echo "As you already told me, signal handler returns int." >&4
10943                 val="$undef"
10944                 ;;
10945         esac
10946 fi
10947 set d_voidsig
10948 eval $setvar
10949 case "$d_voidsig" in
10950 "$define") signal_t="void";;
10951 *) signal_t="int";;
10952 esac
10953 $rm -f $$.tmp
10954
10955 : check for ability to cast large floats to 32-bit ints.
10956 echo " "
10957 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10958 if $test "$intsize" -ge 4; then
10959         xxx=int
10960 else
10961         xxx=long
10962 fi
10963 $cat >try.c <<EOCP
10964 #include <stdio.h>
10965 #$i_stdlib I_STDLIB
10966 #ifdef I_STDLIB
10967 #include <stdlib.h>
10968 #endif
10969 #include <sys/types.h>
10970 #include <signal.h>
10971 $signal_t blech(int s) { exit(3); }
10972 int main()
10973 {
10974         $xxx i32;
10975         double f, g;
10976         int result = 0;
10977         char str[16];
10978         signal(SIGFPE, blech);
10979
10980         /* Don't let compiler optimize the test away.  Store the number
10981            in a writable string for gcc to pass to sscanf under HP-UX.
10982         */
10983         sprintf(str, "2147483647");
10984         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10985         g = 10 * f;
10986         i32  = ($xxx) g;
10987
10988         /* x86 processors will probably give 0x8000 0000, which is a
10989            sign change.  We don't want that.  We want to mimic SPARC
10990            behavior here, which is to preserve the sign and give
10991            back 0x7fff ffff.
10992         */
10993         if (i32 != ($xxx) f)
10994                 result |= 1;
10995         exit(result);
10996 }
10997 EOCP
10998 set try
10999 if eval $compile_ok; then
11000         $run ./try
11001         yyy=$?
11002 else
11003         echo "(I can't seem to compile the test program--assuming it can't)"
11004         yyy=1
11005 fi
11006 case "$yyy" in
11007 0)      val="$define"
11008         echo "Yup, it can."
11009         ;;
11010 *)      val="$undef"
11011         echo "Nope, it can't."
11012         ;;
11013 esac
11014 set d_casti32
11015 eval $setvar
11016 $rm_try
11017
11018 : check for ability to cast negative floats to unsigned
11019 echo " "
11020 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11021 $cat >try.c <<EOCP
11022 #include <stdio.h>
11023 #$i_stdlib I_STDLIB
11024 #ifdef I_STDLIB
11025 #include <stdlib.h>
11026 #endif
11027 #include <sys/types.h>
11028 #include <signal.h>
11029 $signal_t blech(int s) { exit(7); }
11030 $signal_t blech_in_list(int s) { exit(4); }
11031 unsigned long dummy_long(unsigned long p) { return p; }
11032 unsigned int dummy_int(unsigned int p) { return p; }
11033 unsigned short dummy_short(unsigned short p) { return p; }
11034 int main()
11035 {
11036         double f;
11037         unsigned long along;
11038         unsigned int aint;
11039         unsigned short ashort;
11040         int result = 0;
11041         char str[16];
11042
11043         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11044            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11045            optimized the whole file away
11046         */
11047         /* Store the number in a writable string for gcc to pass to
11048            sscanf under HP-UX.
11049         */
11050         sprintf(str, "-123");
11051         sscanf(str, "%lf", &f);  /* f = -123.; */
11052
11053         signal(SIGFPE, blech);
11054         along = (unsigned long)f;
11055         aint = (unsigned int)f;
11056         ashort = (unsigned short)f;
11057         if (along != (unsigned long)-123)
11058                 result |= 1;
11059         if (aint != (unsigned int)-123)
11060                 result |= 1;
11061         if (ashort != (unsigned short)-123)
11062                 result |= 1;
11063         sprintf(str, "1073741824.");
11064         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11065         f = f + f;
11066         along = 0;
11067         along = (unsigned long)f;
11068         if (along != 0x80000000)
11069                 result |= 2;
11070         f -= 1.;
11071         along = 0;
11072         along = (unsigned long)f;
11073         if (along != 0x7fffffff)
11074                 result |= 1;
11075         f += 2.;
11076         along = 0;
11077         along = (unsigned long)f;
11078         if (along != 0x80000001)
11079                 result |= 2;
11080         if (result)
11081                 exit(result);
11082         signal(SIGFPE, blech_in_list);
11083         sprintf(str, "123.");
11084         sscanf(str, "%lf", &f);  /* f = 123.; */
11085         along = dummy_long((unsigned long)f);
11086         aint = dummy_int((unsigned int)f);
11087         ashort = dummy_short((unsigned short)f);
11088         if (along != (unsigned long)123)
11089                 result |= 4;
11090         if (aint != (unsigned int)123)
11091                 result |= 4;
11092         if (ashort != (unsigned short)123)
11093                 result |= 4;
11094         exit(result);
11095
11096 }
11097 EOCP
11098 set try
11099 if eval $compile_ok; then
11100         $run ./try
11101         castflags=$?
11102 else
11103         echo "(I can't seem to compile the test program--assuming it can't)"
11104         castflags=7
11105 fi
11106 case "$castflags" in
11107 0)      val="$define"
11108         echo "Yup, it can."
11109         ;;
11110 *)      val="$undef"
11111         echo "Nope, it can't."
11112         ;;
11113 esac
11114 set d_castneg
11115 eval $setvar
11116 $rm_try
11117
11118 : see if vprintf exists
11119 echo " "
11120 if set vprintf val -f d_vprintf; eval $csym; $val; then
11121         echo 'vprintf() found.' >&4
11122         val="$define"
11123         $cat >try.c <<EOF
11124 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11125 #$i_varargs I_VARARGS
11126
11127 #$i_stdlib I_STDLIB
11128 #$i_unistd I_UNISTD
11129
11130 #ifdef I_STDARG
11131 #  include <stdarg.h>
11132 #else /* I_VARARGS */
11133 #  include <varargs.h>
11134 #endif
11135
11136 #ifdef I_UNISTD
11137 #  include <unistd.h>
11138 #endif
11139
11140 #ifdef I_STDLIB
11141 #  include <stdlib.h>
11142 #endif
11143
11144 #include <stdio.h> /* vsprintf prototype */
11145
11146 #ifdef I_STDARG
11147 void xxx(int n, ...)
11148 {
11149     va_list args;
11150     char buf[10];
11151     va_start(args, n);
11152     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11153 }
11154 int main() { xxx(1, "foo"); }
11155
11156 #else /* I_VARARGS */
11157
11158 xxx(va_alist)
11159 va_dcl
11160 {
11161     va_list args;
11162     char buf[10];
11163     va_start(args);
11164     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11165 }
11166 int main() { xxx("foo"); }
11167
11168 #endif
11169
11170 EOF
11171         set try
11172         if eval $compile_ok; then
11173                 if $run ./try; then
11174                         echo "Your vsprintf() returns (int)." >&4
11175                         val2="$undef"
11176                 else
11177                         echo "Your vsprintf() returns (char*)." >&4
11178                         val2="$define"
11179                 fi
11180         else
11181                 echo 'I am unable to compile the vsprintf() test program.' >&4
11182                 # We shouldn't get here.  If we do, assume the standard signature,
11183                 # not the old BSD one.
11184                 echo 'Guessing that vsprintf() returns (int).' >&4
11185                 val2="$undef"
11186         fi
11187 else
11188         echo 'vprintf() NOT found.' >&4
11189         val="$undef"
11190         val2="$undef"
11191 fi
11192 $rm_try
11193 set d_vprintf
11194 eval $setvar
11195 val=$val2
11196 set d_charvspr
11197 eval $setvar
11198
11199 : see if chown exists
11200 set chown d_chown
11201 eval $inlibc
11202
11203 : see if chroot exists
11204 set chroot d_chroot
11205 eval $inlibc
11206
11207 : see if chsize exists
11208 set chsize d_chsize
11209 eval $inlibc
11210
11211 : see if class exists
11212 set class d_class
11213 eval $inlibc
11214
11215 : see if clearenv exists
11216 set clearenv d_clearenv
11217 eval $inlibc
11218
11219 : Define hasstruct macro for Configure internal use
11220 hasstruct='varname=$1; struct=$2; shift; shift;
11221 while $test $# -ge 2; do
11222         case "$1" in
11223         $define) echo "#include <$2>";;
11224         esac ;
11225     shift 2;
11226 done > try.c;
11227 echo "int main () { struct $struct foo; }" >> try.c;
11228 set try;
11229 if eval $compile; then
11230         val="$define";
11231 else
11232         val="$undef";
11233 fi;
11234 set $varname;
11235 eval $setvar;
11236 $rm_try'
11237
11238 : see whether socket exists
11239 socketlib=''
11240 sockethdr=''
11241 echo " "
11242 $echo $n "Hmm... $c" >&4
11243 if set socket val -f d_socket; eval $csym; $val; then
11244         echo "Looks like you have Berkeley networking support." >&4
11245         d_socket="$define"
11246         if set setsockopt val -f; eval $csym; $val; then
11247                 d_oldsock="$undef"
11248         else
11249                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11250                 d_oldsock="$define"
11251         fi
11252 else
11253         if $contains socklib libc.list >/dev/null 2>&1; then
11254                 echo "Looks like you have Berkeley networking support." >&4
11255                 d_socket="$define"
11256                 : we will have to assume that it supports the 4.2 BSD interface
11257                 d_oldsock="$undef"
11258         else
11259                 echo "You don't have Berkeley networking in libc$_a..." >&4
11260                 if test "X$d_socket" = "X$define"; then
11261                    echo "...but you seem to believe that you have sockets." >&4
11262                 else
11263                         for net in net socket
11264                         do
11265                                 if test -f /usr/lib/lib$net$_a; then
11266                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11267                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11268                                         if $contains socket libc.list >/dev/null 2>&1; then
11269                                                 d_socket="$define"
11270                                                 socketlib="-l$net"
11271                                                 case "$net" in
11272                                                 net)
11273                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11274                                                         sockethdr="-I/usr/netinclude"
11275                                                         ;;
11276                                                 esac
11277                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11278                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11279                                                         d_oldsock="$undef"
11280                                                 else
11281                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11282                                                         d_oldsock="$define"
11283                                                 fi
11284                                                 break
11285                                         fi
11286                                 fi
11287                         done
11288                         if test "X$d_socket" != "X$define"; then
11289                            echo "or anywhere else I see." >&4
11290                            d_socket="$undef"
11291                            d_oldsock="$undef"
11292                         fi
11293                 fi
11294         fi
11295 fi
11296
11297 : see if socketpair exists
11298 set socketpair d_sockpair
11299 eval $inlibc
11300
11301
11302 echo " "
11303 echo "Checking the availability sa_len in the sock struct ..." >&4
11304 $cat >try.c <<EOF
11305 #include <sys/types.h>
11306 #include <sys/socket.h>
11307 int main() {
11308 struct sockaddr sa;
11309 return (sa.sa_len);
11310 }
11311 EOF
11312 val="$undef"
11313 set try; if eval $compile; then
11314         val="$define"
11315 fi
11316 set d_sockaddr_sa_len; eval $setvar
11317 $rm_try
11318
11319 echo " "
11320 echo "Checking the availability struct sockaddr_in6 ..." >&4
11321 $cat >try.c <<EOF
11322 #include <sys/types.h>
11323 #include <sys/socket.h>
11324 #include <netinet/in.h>
11325 int main() {
11326 struct sockaddr_in6 sin6;
11327 return (sin6.sin6_family);
11328 }
11329 EOF
11330 val="$undef"
11331 set try; if eval $compile; then
11332         val="$define"
11333 fi
11334 set d_sockaddr_in6; eval $setvar
11335 $rm_try
11336
11337 echo " "
11338 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11339 $cat >try.c <<EOF
11340 #include <sys/types.h>
11341 #include <sys/socket.h>
11342 #include <netinet/in.h>
11343 int main() {
11344 struct sockaddr_in6 sin6;
11345 return (sin6.sin6_scope_id);
11346 }
11347 EOF
11348 val="$undef"
11349 set try; if eval $compile; then
11350         val="$define"
11351 fi
11352 set d_sin6_scope_id; eval $setvar
11353 $rm_try
11354
11355 echo " "
11356 echo "Checking the availability struct ip_mreq ..." >&4
11357 $cat >try.c <<EOF
11358 #include <sys/types.h>
11359 #include <sys/socket.h>
11360 #include <netinet/in.h>
11361 int main() {
11362 struct ip_mreq mreq;
11363 return (mreq.imr_multiaddr.s_addr);
11364 }
11365 EOF
11366 val="$undef"
11367 set try; if eval $compile; then
11368        val="$define"
11369 fi
11370 set d_ip_mreq; eval $setvar
11371 $rm_try
11372
11373 echo " "
11374 echo "Checking the availability struct ip_mreq_source ..." >&4
11375 $cat >try.c <<EOF
11376 #include <sys/types.h>
11377 #include <sys/socket.h>
11378 #include <netinet/in.h>
11379 int main() {
11380 struct ip_mreq_source mreq;
11381 return (mreq.imr_multiaddr.s_addr);
11382 }
11383 EOF
11384 val="$undef"
11385 set try; if eval $compile; then
11386        val="$define"
11387 fi
11388 set d_ip_mreq_source; eval $setvar
11389 $rm_try
11390
11391 echo " "
11392 echo "Checking the availability struct ipv6_mreq ..." >&4
11393 $cat >try.c <<EOF
11394 #include <sys/types.h>
11395 #include <sys/socket.h>
11396 #include <netinet/in.h>
11397 int main() {
11398 struct ipv6_mreq mreq;
11399 return (mreq.ipv6mr_interface);
11400 }
11401 EOF
11402 val="$undef"
11403 set try; if eval $compile; then
11404         val="$define"
11405 fi
11406 set d_ipv6_mreq; eval $setvar
11407 $rm_try
11408
11409 echo " "
11410 echo "Checking the availability struct ipv6_mreq_source ..." >&4
11411 $cat >try.c <<EOF
11412 #include <sys/types.h>
11413 #include <sys/socket.h>
11414 #include <netinet/in.h>
11415 int main() {
11416 struct ipv6_mreq_source mreq;
11417 return (mreq.imr_multiaddr.s_addr);
11418 }
11419 EOF
11420 val="$undef"
11421 set try; if eval $compile; then
11422        val="$define"
11423 fi
11424 set d_ipv6_mreq_source; eval $setvar
11425 $rm_try
11426
11427 echo " "
11428 echo "Checking the availability of certain socket constants..." >&4
11429 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11430         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11431         $cat >try.c <<EOF
11432 #include <sys/types.h>
11433 #include <sys/socket.h>
11434 int main() {
11435     int i = $ENUM;
11436 }
11437 EOF
11438         val="$undef"
11439         set try; if eval $compile; then
11440                 val="$define"
11441         fi
11442         set d_${enum}; eval $setvar
11443         $rm_try
11444 done
11445
11446 : see if this is a sys/uio.h system
11447 set sys/uio.h i_sysuio
11448 eval $inhdr
11449
11450 : Check for cmsghdr support
11451 echo " "
11452 echo "Checking to see if your system supports struct cmsghdr..." >&4
11453 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11454 eval $hasstruct
11455 case "$d_cmsghdr_s" in
11456 "$define")      echo "Yes, it does."   ;;
11457 *)              echo "No, it doesn't." ;;
11458 esac
11459
11460
11461 : check for const keyword
11462 echo " "
11463 echo 'Checking to see if your C compiler knows about "const"...' >&4
11464 $cat >const.c <<'EOCP'
11465 typedef struct spug { int drokk; } spug;
11466 int main()
11467 {
11468         const char *foo;
11469         const spug y = { 0 };
11470 }
11471 EOCP
11472 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11473         val="$define"
11474         echo "Yup, it does."
11475 else
11476         val="$undef"
11477         echo "Nope, it doesn't."
11478 fi
11479 set d_const
11480 eval $setvar
11481
11482 : see if copysignl exists
11483 set copysignl d_copysignl
11484 eval $inlibc
11485
11486 : see if crypt exists
11487 echo " "
11488 set crypt d_crypt
11489 eval $inlibc
11490 case "$d_crypt" in
11491 $define) cryptlib='' ;;
11492 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11493                 echo 'crypt() found.' >&4
11494                 val="$define"
11495                 cryptlib=''
11496         else
11497                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11498                 if $test -z "$cryptlib"; then
11499                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11500                 else
11501                         cryptlib=-lcrypt
11502                 fi
11503                 if $test -z "$cryptlib"; then
11504                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11505                 else
11506                         cryptlib=-lcrypt
11507                 fi
11508                 if $test -z "$cryptlib"; then
11509                         cryptlib=`./loc libcrypt$_a "" $libpth`
11510                 else
11511                         cryptlib=-lcrypt
11512                 fi
11513                 if $test -z "$cryptlib"; then
11514                         echo 'crypt() NOT found.' >&4
11515                         val="$undef"
11516                 else
11517                         val="$define"
11518                 fi
11519         fi
11520         set d_crypt
11521         eval $setvar
11522         ;;
11523 esac
11524
11525 : see if this is a crypt.h system
11526 set crypt.h i_crypt
11527 eval $inhdr
11528
11529 : see if crypt_r exists
11530 set crypt_r d_crypt_r
11531 eval $inlibc
11532 case "$d_crypt_r" in
11533 "$define")
11534         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11535         case "$d_crypt_r_proto:$usethreads" in
11536         ":define")      d_crypt_r_proto=define
11537                 set d_crypt_r_proto crypt_r $hdrs
11538                 eval $hasproto ;;
11539         *)      ;;
11540         esac
11541         case "$d_crypt_r_proto" in
11542         define)
11543         case "$crypt_r_proto" in
11544         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11545         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11546         esac
11547         case "$crypt_r_proto" in
11548         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11549         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11550         esac
11551         case "$crypt_r_proto" in
11552         ''|0)   d_crypt_r=undef
11553                 crypt_r_proto=0
11554                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11555         * )     case "$crypt_r_proto" in
11556                 REENTRANT_PROTO*) ;;
11557                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11558                 esac
11559                 echo "Prototype: $try" ;;
11560         esac
11561         ;;
11562         *)      case "$usethreads" in
11563                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11564                 esac
11565                 d_crypt_r=undef
11566                 crypt_r_proto=0
11567                 ;;
11568         esac
11569         ;;
11570 *)      crypt_r_proto=0
11571         ;;
11572 esac
11573
11574 : get csh whereabouts
11575 case "$csh" in
11576 'csh') val="$undef" ;;
11577 *) val="$define" ;;
11578 esac
11579 set d_csh
11580 eval $setvar
11581 : Respect a hint or command line value for full_csh.
11582 case "$full_csh" in
11583 '') full_csh=$csh ;;
11584 esac
11585
11586 : see if ctermid exists
11587 set ctermid d_ctermid
11588 eval $inlibc
11589
11590 : see if ctermid_r exists
11591 set ctermid_r d_ctermid_r
11592 eval $inlibc
11593 case "$d_ctermid_r" in
11594 "$define")
11595         hdrs="$i_systypes sys/types.h define stdio.h "
11596         case "$d_ctermid_r_proto:$usethreads" in
11597         ":define")      d_ctermid_r_proto=define
11598                 set d_ctermid_r_proto ctermid_r $hdrs
11599                 eval $hasproto ;;
11600         *)      ;;
11601         esac
11602         case "$d_ctermid_r_proto" in
11603         define)
11604         case "$ctermid_r_proto" in
11605         ''|0) try='char* ctermid_r(char*);'
11606         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11607         esac
11608         case "$ctermid_r_proto" in
11609         ''|0)   d_ctermid_r=undef
11610                 ctermid_r_proto=0
11611                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11612         * )     case "$ctermid_r_proto" in
11613                 REENTRANT_PROTO*) ;;
11614                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11615                 esac
11616                 echo "Prototype: $try" ;;
11617         esac
11618         ;;
11619         *)      case "$usethreads" in
11620                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11621                 esac
11622                 d_ctermid_r=undef
11623                 ctermid_r_proto=0
11624                 ;;
11625         esac
11626         ;;
11627 *)      ctermid_r_proto=0
11628         ;;
11629 esac
11630
11631 : see if ctime_r exists
11632 set ctime_r d_ctime_r
11633 eval $inlibc
11634 case "$d_ctime_r" in
11635 "$define")
11636         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11637         case "$d_ctime_r_proto:$usethreads" in
11638         ":define")      d_ctime_r_proto=define
11639                 set d_ctime_r_proto ctime_r $hdrs
11640                 eval $hasproto ;;
11641         *)      ;;
11642         esac
11643         case "$d_ctime_r_proto" in
11644         define)
11645         case "$ctime_r_proto" in
11646         ''|0) try='char* ctime_r(const time_t*, char*);'
11647         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11648         esac
11649         case "$ctime_r_proto" in
11650         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11651         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11652         esac
11653         case "$ctime_r_proto" in
11654         ''|0) try='int ctime_r(const time_t*, char*);'
11655         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11656         esac
11657         case "$ctime_r_proto" in
11658         ''|0) try='int ctime_r(const time_t*, char*, int);'
11659         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11660         esac
11661         case "$ctime_r_proto" in
11662         ''|0)   d_ctime_r=undef
11663                 ctime_r_proto=0
11664                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11665         * )     case "$ctime_r_proto" in
11666                 REENTRANT_PROTO*) ;;
11667                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11668                 esac
11669                 echo "Prototype: $try" ;;
11670         esac
11671         ;;
11672         *)      case "$usethreads" in
11673                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11674                 esac
11675                 d_ctime_r=undef
11676                 ctime_r_proto=0
11677                 ;;
11678         esac
11679         ;;
11680 *)      ctime_r_proto=0
11681         ;;
11682 esac
11683
11684 : see if cuserid exists
11685 set cuserid d_cuserid
11686 eval $inlibc
11687
11688 : see if this is a limits.h system
11689 set limits.h i_limits
11690 eval $inhdr
11691
11692 : see if this is a float.h system
11693 set float.h i_float
11694 eval $inhdr
11695
11696 : See if number of significant digits in a double precision number is known
11697 echo " "
11698 $cat >dbl_dig.c <<EOM
11699 #$i_limits I_LIMITS
11700 #$i_float I_FLOAT
11701 #ifdef I_LIMITS
11702 #include <limits.h>
11703 #endif
11704 #ifdef I_FLOAT
11705 #include <float.h>
11706 #endif
11707 #ifdef DBL_DIG
11708 printf("Contains DBL_DIG");
11709 #endif
11710 EOM
11711 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11712 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11713         echo "DBL_DIG found." >&4
11714         val="$define"
11715 else
11716         echo "DBL_DIG NOT found." >&4
11717         val="$undef"
11718 fi
11719 $rm -f dbl_dig.?
11720 set d_dbl_dig
11721 eval $setvar
11722
11723 : see if dbm.h is available
11724 : see if dbmclose exists
11725 set dbmclose d_dbmclose
11726 eval $inlibc
11727
11728 case "$d_dbmclose" in
11729 $define)
11730         set dbm.h i_dbm
11731         eval $inhdr
11732         case "$i_dbm" in
11733         $define)
11734                 val="$undef"
11735                 set i_rpcsvcdbm
11736                 eval $setvar
11737                 ;;
11738         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11739                 eval $inhdr
11740                 ;;
11741         esac
11742         ;;
11743 *)      echo "We won't be including <dbm.h>"
11744         val="$undef"
11745         set i_dbm
11746         eval $setvar
11747         val="$undef"
11748         set i_rpcsvcdbm
11749         eval $setvar
11750         ;;
11751 esac
11752
11753 : see if prototype for dbminit is available
11754 echo " "
11755 set d_dbminitproto dbminit $i_dbm dbm.h
11756 eval $hasproto
11757
11758 : see if difftime exists
11759 set difftime d_difftime
11760 eval $inlibc
11761
11762 : see if this is a dirent system
11763 echo " "
11764 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11765         val="$define"
11766         echo "<dirent.h> found." >&4
11767 else
11768         val="$undef"
11769         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11770                 echo "<sys/dir.h> found." >&4
11771                 echo " "
11772         else
11773                 xinc=`./findhdr sys/ndir.h`
11774         fi
11775         echo "<dirent.h> NOT found." >&4
11776 fi
11777 set i_dirent
11778 eval $setvar
11779
11780 : Look for type of directory structure.
11781 echo " "
11782 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11783
11784 case "$direntrytype" in
11785 ''|' ')
11786         case "$i_dirent" in
11787         $define) guess1='struct dirent' ;;
11788         *) guess1='struct direct'  ;;
11789         esac
11790         ;;
11791 *)      guess1="$direntrytype"
11792         ;;
11793 esac
11794
11795 case "$guess1" in
11796 'struct dirent') guess2='struct direct' ;;
11797 *) guess2='struct dirent' ;;
11798 esac
11799
11800 if $contains "$guess1" try.c >/dev/null 2>&1; then
11801         direntrytype="$guess1"
11802         echo "Your directory entries are $direntrytype." >&4
11803 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11804         direntrytype="$guess2"
11805         echo "Your directory entries seem to be $direntrytype." >&4
11806 else
11807         echo "I don't recognize your system's directory entries." >&4
11808         rp="What type is used for directory entries on this system?"
11809         dflt="$guess1"
11810         . ./myread
11811         direntrytype="$ans"
11812 fi
11813 $rm_try
11814
11815 : see if the directory entry stores field length
11816 echo " "
11817 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11818 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11819         echo "Good, your directory entry keeps length information in d_namlen." >&4
11820         val="$define"
11821 else
11822         echo "Your directory entry does not know about the d_namlen field." >&4
11823         val="$undef"
11824 fi
11825 set d_dirnamlen
11826 eval $setvar
11827 $rm_try
11828
11829 : Look for DIR.dd_fd
11830 case "$i_dirent" in
11831 "$define")
11832     echo "Checking to see if DIR has a dd_fd member variable" >&4
11833     $cat >try.c <<EOCP
11834 #$i_stdlib I_STDLIB
11835 #ifdef I_STDLIB
11836 #include <stdlib.h>
11837 #endif
11838 #include <dirent.h>
11839
11840 int main() {
11841     DIR dir;
11842     dir.dd_fd = 1;
11843     return 0;
11844 }
11845 EOCP
11846     val=$undef
11847     set try
11848     if eval $compile; then
11849         echo "Yes, it does."
11850         val="$define"
11851     else
11852         echo "No, it does not."
11853         val="$undef"
11854     fi
11855     ;;
11856 *)
11857     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11858     val="$undef"
11859     ;;
11860 esac
11861 set d_dir_dd_fd
11862 eval $setvar
11863 $rm_try
11864
11865 : see if this is an sysdir system
11866 set sys/dir.h i_sysdir
11867 eval $inhdr
11868
11869 : see if this is an sysndir system
11870 set sys/ndir.h i_sysndir
11871 eval $inhdr
11872
11873 : Look for dirfd
11874 echo " "
11875 $cat >dirfd.c <<EOM
11876 #include <stdio.h>
11877 #$i_stdlib I_STDLIB
11878 #ifdef I_STDLIB
11879 #include <stdlib.h>
11880 #endif
11881 #$i_dirent I_DIRENT             /**/
11882 #$i_sysdir I_SYS_DIR            /**/
11883 #$i_sysndir I_SYS_NDIR          /**/
11884 #$i_systypes I_SYS_TYPES        /**/
11885 #if defined(I_SYS_TYPES)
11886 #include <sys/types.h>
11887 #endif
11888 #if defined(I_DIRENT)
11889 #include <dirent.h>
11890 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11891 #include <sys/dir.h>
11892 #endif
11893 #else
11894 #ifdef I_SYS_NDIR
11895 #include <sys/ndir.h>
11896 #else
11897 #ifdef I_SYS_DIR
11898 #ifdef hp9000s500
11899 #include <ndir.h>       /* may be wrong in the future */
11900 #else
11901 #include <sys/dir.h>
11902 #endif
11903 #endif
11904 #endif
11905 #endif
11906 int main() {
11907         DIR *dirp = opendir(".");
11908         if (dirfd(dirp) >= 0)
11909                 exit(0);
11910         else
11911                 exit(1);
11912 }
11913 EOM
11914 val=$undef
11915 set dirfd
11916 if eval $compile; then
11917         val="$define"
11918 fi
11919 case "$val" in
11920 $define)        echo "dirfd() found." >&4       ;;
11921 *)              echo "dirfd() NOT found." >&4   ;;
11922 esac
11923 set d_dirfd
11924 eval $setvar
11925 $rm -f dirfd*
11926
11927 : see if dlerror exists
11928 xxx_runnm="$runnm"
11929 runnm=false
11930 set dlerror d_dlerror
11931 eval $inlibc
11932 runnm="$xxx_runnm"
11933
11934 : see if dlfcn is available
11935 set dlfcn.h i_dlfcn
11936 eval $inhdr
11937
11938 : Check what extension to use for shared libs
11939 case "$usedl" in
11940 $define|y|true)
11941         $cat << EOM
11942
11943 On a few systems, the dynamically loaded modules that perl generates and uses
11944 will need a different extension than shared libs. The default will probably
11945 be appropriate.
11946
11947 EOM
11948         case "$dlext" in
11949         '')     dflt="$so" ;;
11950         *)      dflt="$dlext" ;;
11951         esac
11952         rp='What is the extension of dynamically loaded modules'
11953         . ./myread
11954         dlext="$ans"
11955         ;;
11956 *)
11957         dlext="none"
11958         ;;
11959 esac
11960
11961 : Check if dlsym need a leading underscore
11962 echo " "
11963 val="$undef"
11964
11965 case "$dlsrc" in
11966 dl_dlopen.xs)
11967         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11968         $cat >dyna.c <<'EOM'
11969 fred () { }
11970 EOM
11971
11972 $cat >fred.c<<EOM
11973
11974 #include <stdio.h>
11975 #$i_stdlib I_STDLIB
11976 #ifdef I_STDLIB
11977 #include <stdlib.h>
11978 #endif
11979 #$i_dlfcn I_DLFCN
11980 #ifdef I_DLFCN
11981 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11982 #else
11983 #include <sys/types.h>
11984 #include <nlist.h>
11985 #include <link.h>
11986 #endif
11987
11988 extern int fred() ;
11989
11990 int main()
11991 {
11992     void * handle ;
11993     void * symbol ;
11994 #ifndef RTLD_LAZY
11995     int mode = 1 ;
11996 #else
11997     int mode = RTLD_LAZY ;
11998 #endif
11999     handle = dlopen("./dyna.$dlext", mode) ;
12000     if (handle == NULL) {
12001         printf ("1\n") ;
12002         fflush (stdout) ;
12003         exit(0);
12004     }
12005     symbol = dlsym(handle, "fred") ;
12006     if (symbol == NULL) {
12007         /* try putting a leading underscore */
12008         symbol = dlsym(handle, "_fred") ;
12009         if (symbol == NULL) {
12010             printf ("2\n") ;
12011             fflush (stdout) ;
12012             exit(0);
12013         }
12014         printf ("3\n") ;
12015     }
12016     else
12017         printf ("4\n") ;
12018     fflush (stdout) ;
12019     exit(0);
12020 }
12021 EOM
12022         : Call the object file tmp-dyna.o in case dlext=o.
12023         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12024                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12025                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12026                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12027                 xxx=`$run ./fred`
12028                 case $xxx in
12029                 1)      echo "Test program failed using dlopen." >&4
12030                         echo "Perhaps you should not use dynamic loading." >&4;;
12031                 2)      echo "Test program failed using dlsym." >&4
12032                         echo "Perhaps you should not use dynamic loading." >&4;;
12033                 3)      echo "dlsym needs a leading underscore" >&4
12034                         val="$define" ;;
12035                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12036                 esac
12037         else
12038                 echo "I can't compile and run the test program." >&4
12039                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12040         fi
12041         ;;
12042 esac
12043
12044 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12045
12046 set d_dlsymun
12047 eval $setvar
12048
12049 : see if drand48_r exists
12050 set drand48_r d_drand48_r
12051 eval $inlibc
12052 case "$d_drand48_r" in
12053 "$define")
12054         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12055         case "$d_drand48_r_proto:$usethreads" in
12056         ":define")      d_drand48_r_proto=define
12057                 set d_drand48_r_proto drand48_r $hdrs
12058                 eval $hasproto ;;
12059         *)      ;;
12060         esac
12061         case "$d_drand48_r_proto" in
12062         define)
12063         case "$drand48_r_proto" in
12064         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12065         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12066         esac
12067         case "$drand48_r_proto" in
12068         ''|0)   d_drand48_r=undef
12069                 drand48_r_proto=0
12070                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12071         * )     case "$drand48_r_proto" in
12072                 REENTRANT_PROTO*) ;;
12073                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12074                 esac
12075                 echo "Prototype: $try" ;;
12076         esac
12077         ;;
12078         *)      case "$usethreads" in
12079                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12080                 esac
12081                 d_drand48_r=undef
12082                 drand48_r_proto=0
12083                 ;;
12084         esac
12085         ;;
12086 *)      drand48_r_proto=0
12087         ;;
12088 esac
12089
12090 : see if prototype for drand48 is available
12091 echo " "
12092 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12093 eval $hasproto
12094
12095 : see if dup2 exists
12096 set dup2 d_dup2
12097 eval $inlibc
12098
12099 : see if eaccess exists
12100 set eaccess d_eaccess
12101 eval $inlibc
12102
12103 : see if endgrent exists
12104 set endgrent d_endgrent
12105 eval $inlibc
12106
12107 : see if this is an grp system
12108 set grp.h i_grp
12109 eval $inhdr
12110
12111 case "$i_grp" in
12112 $define)
12113         xxx=`./findhdr grp.h`
12114         $cppstdin $cppflags $cppminus < $xxx >$$.h
12115
12116         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12117                 val="$define"
12118         else
12119                 val="$undef"
12120         fi
12121         set d_grpasswd
12122         eval $setvar
12123
12124         $rm -f $$.h
12125         ;;
12126 *)
12127         val="$undef";
12128         set d_grpasswd; eval $setvar
12129         ;;
12130 esac
12131
12132 : see if endgrent_r exists
12133 set endgrent_r d_endgrent_r
12134 eval $inlibc
12135 case "$d_endgrent_r" in
12136 "$define")
12137         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12138         case "$d_endgrent_r_proto:$usethreads" in
12139         ":define")      d_endgrent_r_proto=define
12140                 set d_endgrent_r_proto endgrent_r $hdrs
12141                 eval $hasproto ;;
12142         *)      ;;
12143         esac
12144         case "$d_endgrent_r_proto" in
12145         define)
12146         case "$endgrent_r_proto" in
12147         ''|0) try='int endgrent_r(FILE**);'
12148         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12149         esac
12150         case "$endgrent_r_proto" in
12151         ''|0) try='void endgrent_r(FILE**);'
12152         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12153         esac
12154         case "$endgrent_r_proto" in
12155         ''|0)   d_endgrent_r=undef
12156                 endgrent_r_proto=0
12157                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12158         * )     case "$endgrent_r_proto" in
12159                 REENTRANT_PROTO*) ;;
12160                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12161                 esac
12162                 echo "Prototype: $try" ;;
12163         esac
12164         ;;
12165         *)      case "$usethreads" in
12166                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12167                 esac
12168                 d_endgrent_r=undef
12169                 endgrent_r_proto=0
12170                 ;;
12171         esac
12172         ;;
12173 *)      endgrent_r_proto=0
12174         ;;
12175 esac
12176
12177 : see if endhostent exists
12178 set endhostent d_endhent
12179 eval $inlibc
12180
12181 : see if this is a netdb.h system
12182 set netdb.h i_netdb
12183 eval $inhdr
12184
12185 : see if endhostent_r exists
12186 set endhostent_r d_endhostent_r
12187 eval $inlibc
12188 case "$d_endhostent_r" in
12189 "$define")
12190         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12191         case "$d_endhostent_r_proto:$usethreads" in
12192         ":define")      d_endhostent_r_proto=define
12193                 set d_endhostent_r_proto endhostent_r $hdrs
12194                 eval $hasproto ;;
12195         *)      ;;
12196         esac
12197         case "$d_endhostent_r_proto" in
12198         define)
12199         case "$endhostent_r_proto" in
12200         ''|0) try='int endhostent_r(struct hostent_data*);'
12201         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12202         esac
12203         case "$endhostent_r_proto" in
12204         ''|0) try='void endhostent_r(struct hostent_data*);'
12205         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12206         esac
12207         case "$endhostent_r_proto" in
12208         ''|0)   d_endhostent_r=undef
12209                 endhostent_r_proto=0
12210                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12211         * )     case "$endhostent_r_proto" in
12212                 REENTRANT_PROTO*) ;;
12213                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12214                 esac
12215                 echo "Prototype: $try" ;;
12216         esac
12217         ;;
12218         *)      case "$usethreads" in
12219                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12220                 esac
12221                 d_endhostent_r=undef
12222                 endhostent_r_proto=0
12223                 ;;
12224         esac
12225         ;;
12226 *)      endhostent_r_proto=0
12227         ;;
12228 esac
12229
12230 : see if endnetent exists
12231 set endnetent d_endnent
12232 eval $inlibc
12233
12234 : see if endnetent_r exists
12235 set endnetent_r d_endnetent_r
12236 eval $inlibc
12237 case "$d_endnetent_r" in
12238 "$define")
12239         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12240         case "$d_endnetent_r_proto:$usethreads" in
12241         ":define")      d_endnetent_r_proto=define
12242                 set d_endnetent_r_proto endnetent_r $hdrs
12243                 eval $hasproto ;;
12244         *)      ;;
12245         esac
12246         case "$d_endnetent_r_proto" in
12247         define)
12248         case "$endnetent_r_proto" in
12249         ''|0) try='int endnetent_r(struct netent_data*);'
12250         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12251         esac
12252         case "$endnetent_r_proto" in
12253         ''|0) try='void endnetent_r(struct netent_data*);'
12254         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12255         esac
12256         case "$endnetent_r_proto" in
12257         ''|0)   d_endnetent_r=undef
12258                 endnetent_r_proto=0
12259                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12260         * )     case "$endnetent_r_proto" in
12261                 REENTRANT_PROTO*) ;;
12262                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12263                 esac
12264                 echo "Prototype: $try" ;;
12265         esac
12266         ;;
12267         *)      case "$usethreads" in
12268                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12269                 esac
12270                 d_endnetent_r=undef
12271                 endnetent_r_proto=0
12272                 ;;
12273         esac
12274         ;;
12275 *)      endnetent_r_proto=0
12276         ;;
12277 esac
12278
12279 : see if endprotoent exists
12280 set endprotoent d_endpent
12281 eval $inlibc
12282
12283 : see if endprotoent_r exists
12284 set endprotoent_r d_endprotoent_r
12285 eval $inlibc
12286 case "$d_endprotoent_r" in
12287 "$define")
12288         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12289         case "$d_endprotoent_r_proto:$usethreads" in
12290         ":define")      d_endprotoent_r_proto=define
12291                 set d_endprotoent_r_proto endprotoent_r $hdrs
12292                 eval $hasproto ;;
12293         *)      ;;
12294         esac
12295         case "$d_endprotoent_r_proto" in
12296         define)
12297         case "$endprotoent_r_proto" in
12298         ''|0) try='int endprotoent_r(struct protoent_data*);'
12299         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12300         esac
12301         case "$endprotoent_r_proto" in
12302         ''|0) try='void endprotoent_r(struct protoent_data*);'
12303         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12304         esac
12305         case "$endprotoent_r_proto" in
12306         ''|0)   d_endprotoent_r=undef
12307                 endprotoent_r_proto=0
12308                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12309         * )     case "$endprotoent_r_proto" in
12310                 REENTRANT_PROTO*) ;;
12311                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12312                 esac
12313                 echo "Prototype: $try" ;;
12314         esac
12315         ;;
12316         *)      case "$usethreads" in
12317                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12318                 esac
12319                 d_endprotoent_r=undef
12320                 endprotoent_r_proto=0
12321                 ;;
12322         esac
12323         ;;
12324 *)      endprotoent_r_proto=0
12325         ;;
12326 esac
12327
12328 : see if endpwent exists
12329 set endpwent d_endpwent
12330 eval $inlibc
12331
12332 : see if this is a pwd.h system
12333 set pwd.h i_pwd
12334 eval $inhdr
12335
12336 case "$i_pwd" in
12337 $define)
12338         xxx=`./findhdr pwd.h`
12339         $cppstdin $cppflags $cppminus < $xxx >$$.h
12340
12341         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12342                 val="$define"
12343         else
12344                 val="$undef"
12345         fi
12346         set d_pwquota
12347         eval $setvar
12348
12349         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12350                 val="$define"
12351         else
12352                 val="$undef"
12353         fi
12354         set d_pwage
12355         eval $setvar
12356
12357         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12358                 val="$define"
12359         else
12360                 val="$undef"
12361         fi
12362         set d_pwchange
12363         eval $setvar
12364
12365         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12366                 val="$define"
12367         else
12368                 val="$undef"
12369         fi
12370         set d_pwclass
12371         eval $setvar
12372
12373         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12374                 val="$define"
12375         else
12376                 val="$undef"
12377         fi
12378         set d_pwexpire
12379         eval $setvar
12380
12381         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12382                 val="$define"
12383         else
12384                 val="$undef"
12385         fi
12386         set d_pwcomment
12387         eval $setvar
12388
12389         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12390                 val="$define"
12391         else
12392                 val="$undef"
12393         fi
12394         set d_pwgecos
12395         eval $setvar
12396
12397         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12398                 val="$define"
12399         else
12400                 val="$undef"
12401         fi
12402         set d_pwpasswd
12403         eval $setvar
12404
12405         $rm -f $$.h
12406         ;;
12407 *)
12408         val="$undef";
12409         set d_pwquota; eval $setvar
12410         set d_pwage; eval $setvar
12411         set d_pwchange; eval $setvar
12412         set d_pwclass; eval $setvar
12413         set d_pwexpire; eval $setvar
12414         set d_pwcomment; eval $setvar
12415         set d_pwgecos; eval $setvar
12416         set d_pwpasswd; eval $setvar
12417         ;;
12418 esac
12419
12420 : see if endpwent_r exists
12421 set endpwent_r d_endpwent_r
12422 eval $inlibc
12423 case "$d_endpwent_r" in
12424 "$define")
12425         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12426         case "$d_endpwent_r_proto:$usethreads" in
12427         ":define")      d_endpwent_r_proto=define
12428                 set d_endpwent_r_proto endpwent_r $hdrs
12429                 eval $hasproto ;;
12430         *)      ;;
12431         esac
12432         case "$d_endpwent_r_proto" in
12433         define)
12434         case "$endpwent_r_proto" in
12435         ''|0) try='int endpwent_r(FILE**);'
12436         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12437         esac
12438         case "$endpwent_r_proto" in
12439         ''|0) try='void endpwent_r(FILE**);'
12440         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12441         esac
12442         case "$endpwent_r_proto" in
12443         ''|0)   d_endpwent_r=undef
12444                 endpwent_r_proto=0
12445                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12446         * )     case "$endpwent_r_proto" in
12447                 REENTRANT_PROTO*) ;;
12448                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12449                 esac
12450                 echo "Prototype: $try" ;;
12451         esac
12452         ;;
12453         *)      case "$usethreads" in
12454                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12455                 esac
12456                 d_endpwent_r=undef
12457                 endpwent_r_proto=0
12458                 ;;
12459         esac
12460         ;;
12461 *)      endpwent_r_proto=0
12462         ;;
12463 esac
12464
12465 : see if endservent exists
12466 set endservent d_endsent
12467 eval $inlibc
12468
12469 : see if endservent_r exists
12470 set endservent_r d_endservent_r
12471 eval $inlibc
12472 case "$d_endservent_r" in
12473 "$define")
12474         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12475         case "$d_endservent_r_proto:$usethreads" in
12476         ":define")      d_endservent_r_proto=define
12477                 set d_endservent_r_proto endservent_r $hdrs
12478                 eval $hasproto ;;
12479         *)      ;;
12480         esac
12481         case "$d_endservent_r_proto" in
12482         define)
12483         case "$endservent_r_proto" in
12484         ''|0) try='int endservent_r(struct servent_data*);'
12485         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12486         esac
12487         case "$endservent_r_proto" in
12488         ''|0) try='void endservent_r(struct servent_data*);'
12489         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12490         esac
12491         case "$endservent_r_proto" in
12492         ''|0)   d_endservent_r=undef
12493                 endservent_r_proto=0
12494                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12495         * )     case "$endservent_r_proto" in
12496                 REENTRANT_PROTO*) ;;
12497                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12498                 esac
12499                 echo "Prototype: $try" ;;
12500         esac
12501         ;;
12502         *)      case "$usethreads" in
12503                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12504                 esac
12505                 d_endservent_r=undef
12506                 endservent_r_proto=0
12507                 ;;
12508         esac
12509         ;;
12510 *)      endservent_r_proto=0
12511         ;;
12512 esac
12513
12514 : Locate the flags for 'open()'
12515 echo " "
12516 $cat >try.c <<EOCP
12517 #include <sys/types.h>
12518 #ifdef I_FCNTL
12519 #include <fcntl.h>
12520 #endif
12521 #ifdef I_SYS_FILE
12522 #include <sys/file.h>
12523 #endif
12524 #$i_stdlib I_STDLIB
12525 #ifdef I_STDLIB
12526 #include <stdlib.h>
12527 #endif
12528 int main() {
12529         if(O_RDONLY);
12530 #ifdef O_TRUNC
12531         exit(0);
12532 #else
12533         exit(1);
12534 #endif
12535 }
12536 EOCP
12537 : check sys/file.h first to get FREAD on Sun
12538 if $test `./findhdr sys/file.h` && \
12539                 set try -DI_SYS_FILE && eval $compile; then
12540         h_sysfile=true;
12541         echo "<sys/file.h> defines the O_* constants..." >&4
12542         if $run ./try; then
12543                 echo "and you have the 3 argument form of open()." >&4
12544                 val="$define"
12545         else
12546                 echo "but not the 3 argument form of open().  Oh, well." >&4
12547                 val="$undef"
12548         fi
12549 elif $test `./findhdr fcntl.h` && \
12550                 set try -DI_FCNTL && eval $compile; then
12551         h_fcntl=true;
12552         echo "<fcntl.h> defines the O_* constants..." >&4
12553         if $run ./try; then
12554                 echo "and you have the 3 argument form of open()." >&4
12555                 val="$define"
12556         else
12557                 echo "but not the 3 argument form of open().  Oh, well." >&4
12558                 val="$undef"
12559         fi
12560 else
12561         val="$undef"
12562         echo "I can't find the O_* constant definitions!  You got problems." >&4
12563 fi
12564 set d_open3
12565 eval $setvar
12566 $rm_try
12567
12568 : see if this is a sys/file.h system
12569 val=''
12570 set sys/file.h val
12571 eval $inhdr
12572
12573 : do we need to include sys/file.h ?
12574 case "$val" in
12575 "$define")
12576         echo " "
12577         if $h_sysfile; then
12578                 val="$define"
12579                 echo "We'll be including <sys/file.h>." >&4
12580         else
12581                 val="$undef"
12582                 echo "We won't be including <sys/file.h>." >&4
12583         fi
12584         ;;
12585 *)
12586         h_sysfile=false
12587         ;;
12588 esac
12589 set i_sysfile
12590 eval $setvar
12591
12592 : see if fcntl.h is there
12593 val=''
12594 set fcntl.h val
12595 eval $inhdr
12596
12597 : see if we can include fcntl.h
12598 case "$val" in
12599 "$define")
12600         echo " "
12601         if $h_fcntl; then
12602                 val="$define"
12603                 echo "We'll be including <fcntl.h>." >&4
12604         else
12605                 val="$undef"
12606                 if $h_sysfile; then
12607         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12608                 else
12609                         echo "We won't be including <fcntl.h>." >&4
12610                 fi
12611         fi
12612         ;;
12613 *)
12614         h_fcntl=false
12615         val="$undef"
12616         ;;
12617 esac
12618 set i_fcntl
12619 eval $setvar
12620
12621 : see if fork exists
12622 set fork d_fork
12623 eval $inlibc
12624
12625 : see if pipe exists
12626 set pipe d_pipe
12627 eval $inlibc
12628
12629 : check for non-blocking I/O stuff
12630 case "$h_sysfile" in
12631 true) echo "#include <sys/file.h>" > head.c;;
12632 *)
12633        case "$h_fcntl" in
12634        true) echo "#include <fcntl.h>" > head.c;;
12635        *) echo "#include <sys/fcntl.h>" > head.c;;
12636        esac
12637        ;;
12638 esac
12639 echo " "
12640 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12641 case "$o_nonblock" in
12642 '')
12643         $cat head.c > try.c
12644         $cat >>try.c <<EOCP
12645 #include <stdio.h>
12646 #$i_stdlib I_STDLIB
12647 #ifdef I_STDLIB
12648 #include <stdlib.h>
12649 #endif
12650 #$i_fcntl I_FCNTL
12651 #ifdef I_FCNTL
12652 #include <fcntl.h>
12653 #endif
12654 int main() {
12655 #ifdef O_NONBLOCK
12656         printf("O_NONBLOCK\n");
12657         exit(0);
12658 #endif
12659 #ifdef O_NDELAY
12660         printf("O_NDELAY\n");
12661         exit(0);
12662 #endif
12663 #ifdef FNDELAY
12664         printf("FNDELAY\n");
12665         exit(0);
12666 #endif
12667         exit(0);
12668 }
12669 EOCP
12670         set try
12671         if eval $compile_ok; then
12672                 o_nonblock=`$run ./try`
12673                 case "$o_nonblock" in
12674                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12675                 *) echo "Seems like we can use $o_nonblock.";;
12676                 esac
12677         else
12678                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12679         fi
12680         ;;
12681 *) echo "Using $hint value $o_nonblock.";;
12682 esac
12683 $rm_try
12684
12685 echo " "
12686 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12687 case "$eagain" in
12688 '')
12689         case "$d_fork:$d_pipe" in
12690         define:define)
12691         $cat head.c > try.c
12692         $cat >>try.c <<EOCP
12693 #include <errno.h>
12694 #include <sys/types.h>
12695 #include <signal.h>
12696 #include <stdio.h>
12697 #$i_stdlib I_STDLIB
12698 #ifdef I_STDLIB
12699 #include <stdlib.h>
12700 #endif
12701 #$i_fcntl I_FCNTL
12702 #ifdef I_FCNTL
12703 #include <fcntl.h>
12704 #endif
12705 #define MY_O_NONBLOCK $o_nonblock
12706 #ifndef errno  /* XXX need better Configure test */
12707 extern int errno;
12708 #endif
12709 #$i_unistd I_UNISTD
12710 #ifdef I_UNISTD
12711 #include <unistd.h>
12712 #endif
12713 #$i_string I_STRING
12714 #ifdef I_STRING
12715 #include <string.h>
12716 #else
12717 #include <strings.h>
12718 #endif
12719 $signal_t blech(int x) { exit(3); }
12720 EOCP
12721         $cat >> try.c <<'EOCP'
12722 int main()
12723 {
12724         int pd[2];
12725         int pu[2];
12726         char buf[1];
12727         char string[100];
12728
12729         pipe(pd);       /* Down: child -> parent */
12730         pipe(pu);       /* Up: parent -> child */
12731         if (0 != fork()) {
12732                 int ret;
12733                 close(pd[1]);   /* Parent reads from pd[0] */
12734                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12735 #ifdef F_SETFL
12736                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12737                         exit(1);
12738 #else
12739                 exit(4);
12740 #endif
12741                 signal(SIGALRM, blech);
12742                 alarm(5);
12743                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12744                         exit(2);
12745                 sprintf(string, "%d\n", ret);
12746                 write(2, string, strlen(string));
12747                 alarm(0);
12748 #ifdef EAGAIN
12749                 if (errno == EAGAIN) {
12750                         printf("EAGAIN\n");
12751                         goto ok;
12752                 }
12753 #endif
12754 #ifdef EWOULDBLOCK
12755                 if (errno == EWOULDBLOCK)
12756                         printf("EWOULDBLOCK\n");
12757 #endif
12758         ok:
12759                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12760                 sleep(2);                               /* Give it time to close our pipe */
12761                 alarm(5);
12762                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12763                 alarm(0);
12764                 sprintf(string, "%d\n", ret);
12765                 write(4, string, strlen(string));
12766                 exit(0);
12767         }
12768
12769         close(pd[0]);                   /* We write to pd[1] */
12770         close(pu[1]);                   /* We read from pu[0] */
12771         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12772         close(pd[1]);                   /* Pipe pd is now fully closed! */
12773         exit(0);                                /* Bye bye, thank you for playing! */
12774 }
12775 EOCP
12776         set try
12777         if eval $compile_ok; then
12778                 echo "$startsh" >mtry
12779                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12780                 chmod +x mtry
12781                 ./mtry >/dev/null 2>&1
12782                 case $? in
12783                 0) eagain=`$cat try.out`;;
12784                 1) echo "Could not perform non-blocking setting!";;
12785                 2) echo "I did a successful read() for something that was not there!";;
12786                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12787                 4) echo "Could not find F_SETFL!";;
12788                 *) echo "Something terribly wrong happened during testing.";;
12789                 esac
12790                 rd_nodata=`$cat try.ret`
12791                 echo "A read() system call with no data present returns $rd_nodata."
12792                 case "$rd_nodata" in
12793                 0|-1) ;;
12794                 *)
12795                         echo "(That's peculiar, fixing that to be -1.)"
12796                         rd_nodata=-1
12797                         ;;
12798                 esac
12799                 case "$eagain" in
12800                 '')
12801                         echo "Forcing errno EAGAIN on read() with no data available."
12802                         eagain=EAGAIN
12803                         ;;
12804                 *)
12805                         echo "Your read() sets errno to $eagain when no data is available."
12806                         ;;
12807                 esac
12808                 status=`$cat try.err`
12809                 case "$status" in
12810                 0) echo "And it correctly returns 0 to signal EOF.";;
12811                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12812                 *) echo "However, your read() returns '$status' on EOF??";;
12813                 esac
12814                 val="$define"
12815                 if test "$status" = "$rd_nodata"; then
12816                         echo "WARNING: you can't distinguish between EOF and no data!"
12817                         val="$undef"
12818                 fi
12819         else
12820                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12821                 eagain=EAGAIN
12822         fi
12823         ;;
12824         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12825                 eagain=EAGAIN
12826                 val="$define"
12827                 ;;
12828         esac
12829         set d_eofnblk
12830         eval $setvar
12831         ;;
12832 *)
12833         echo "Using $hint value $eagain."
12834         echo "Your read() returns $rd_nodata when no data is present."
12835         case "$d_eofnblk" in
12836         "$define") echo "And you can see EOF because read() returns 0.";;
12837         "$undef") echo "But you can't see EOF status from read() returned value.";;
12838         *)
12839                 echo "(Assuming you can't see EOF status from read anyway.)"
12840                 d_eofnblk=$undef
12841                 ;;
12842         esac
12843         ;;
12844 esac
12845 $rm_try head.c mtry
12846
12847 : see if _ptr and _cnt from stdio act std
12848 echo " "
12849
12850 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12851         echo "(Looks like you have stdio.h from BSD.)"
12852         case "$stdio_ptr" in
12853         '') stdio_ptr='((fp)->_p)'
12854                 ptr_lval=$define
12855                 ;;
12856         *)      ptr_lval=$d_stdio_ptr_lval;;
12857         esac
12858         case "$stdio_cnt" in
12859         '') stdio_cnt='((fp)->_r)'
12860                 cnt_lval=$define
12861                 ;;
12862         *)      cnt_lval=$d_stdio_cnt_lval;;
12863         esac
12864         case "$stdio_base" in
12865         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12866         esac
12867         case "$stdio_bufsiz" in
12868         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12869         esac
12870 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12871         echo "(Looks like you have stdio.h from Linux.)"
12872         case "$stdio_ptr" in
12873         '') stdio_ptr='((fp)->_IO_read_ptr)'
12874                 ptr_lval=$define
12875                 ;;
12876         *)      ptr_lval=$d_stdio_ptr_lval;;
12877         esac
12878         case "$stdio_cnt" in
12879         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12880                 cnt_lval=$undef
12881                 ;;
12882         *)      cnt_lval=$d_stdio_cnt_lval;;
12883         esac
12884         case "$stdio_base" in
12885         '') stdio_base='((fp)->_IO_read_base)';;
12886         esac
12887         case "$stdio_bufsiz" in
12888         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12889         esac
12890 else
12891         case "$stdio_ptr" in
12892         '') stdio_ptr='((fp)->_ptr)'
12893                 ptr_lval=$define
12894                 ;;
12895         *)      ptr_lval=$d_stdio_ptr_lval;;
12896         esac
12897         case "$stdio_cnt" in
12898         '') stdio_cnt='((fp)->_cnt)'
12899                 cnt_lval=$define
12900                 ;;
12901         *)      cnt_lval=$d_stdio_cnt_lval;;
12902         esac
12903         case "$stdio_base" in
12904         '') stdio_base='((fp)->_base)';;
12905         esac
12906         case "$stdio_bufsiz" in
12907         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12908         esac
12909 fi
12910
12911 : test whether _ptr and _cnt really work
12912 echo "Checking how std your stdio is..." >&4
12913 $cat >try.c <<EOP
12914 #include <stdio.h>
12915 #$i_stdlib I_STDLIB
12916 #ifdef I_STDLIB
12917 #include <stdlib.h>
12918 #endif
12919 #define FILE_ptr(fp)    $stdio_ptr
12920 #define FILE_cnt(fp)    $stdio_cnt
12921 int main() {
12922         FILE *fp = fopen("try.c", "r");
12923         char c = getc(fp);
12924         if (
12925                 18 <= FILE_cnt(fp) &&
12926                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12927         )
12928                 exit(0);
12929         exit(1);
12930 }
12931 EOP
12932 val="$undef"
12933 set try
12934 if eval $compile && $to try.c; then
12935         if $run ./try; then
12936                 echo "Your stdio acts pretty std."
12937                 val="$define"
12938         else
12939                 echo "Your stdio isn't very std."
12940         fi
12941 else
12942         echo "Your stdio doesn't appear very std."
12943 fi
12944 $rm_try
12945
12946 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12947 # direct buffer manipulation no longer works.  The Configure tests
12948 # should be changed to correctly detect this, but until then,
12949 # the following check should at least let perl compile and run.
12950 # (This quick fix should be updated before 5.8.1.)
12951 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12952 # A. Dougherty, June 3, 2002.
12953 case "$d_gnulibc" in
12954 $define)
12955         case "$gnulibc_version" in
12956         2.[01]*)  ;;
12957         2.2) ;;
12958         2.2.[0-9]) ;;
12959         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12960                 val="$undef"
12961                 ;;
12962         esac
12963         ;;
12964 esac
12965 set d_stdstdio
12966 eval $setvar
12967
12968 : Can _ptr be used as an lvalue?
12969 case "$d_stdstdio$ptr_lval" in
12970 $define$define) val=$define ;;
12971 *) val=$undef ;;
12972 esac
12973 set d_stdio_ptr_lval
12974 eval $setvar
12975
12976 : Can _cnt be used as an lvalue?
12977 case "$d_stdstdio$cnt_lval" in
12978 $define$define) val=$define ;;
12979 *) val=$undef ;;
12980 esac
12981 set d_stdio_cnt_lval
12982 eval $setvar
12983
12984
12985 : test whether setting _ptr sets _cnt as a side effect
12986 d_stdio_ptr_lval_sets_cnt="$undef"
12987 d_stdio_ptr_lval_nochange_cnt="$undef"
12988 case "$d_stdio_ptr_lval$d_stdstdio" in
12989 $define$define)
12990         echo "Checking to see what happens if we set the stdio ptr..." >&4
12991 $cat >try.c <<EOP
12992 #include <stdio.h>
12993 /* Can we scream? */
12994 /* Eat dust sed :-) */
12995 /* In the buffer space, no one can hear you scream. */
12996 #$i_stdlib I_STDLIB
12997 #ifdef I_STDLIB
12998 #include <stdlib.h>
12999 #endif
13000 #define FILE_ptr(fp)    $stdio_ptr
13001 #define FILE_cnt(fp)    $stdio_cnt
13002 #include <sys/types.h>
13003 int main() {
13004         FILE *fp = fopen("try.c", "r");
13005         int c;
13006         char *ptr;
13007         size_t cnt;
13008         if (!fp) {
13009             puts("Fail even to read");
13010             exit(1);
13011         }
13012         c = getc(fp); /* Read away the first # */
13013         if (c == EOF) {
13014             puts("Fail even to read");
13015             exit(1);
13016         }
13017         if (!(
13018                 18 <= FILE_cnt(fp) &&
13019                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13020         )) {
13021                 puts("Fail even to read");
13022                 exit (1);
13023         }
13024         ptr = (char*) FILE_ptr(fp);
13025         cnt = (size_t)FILE_cnt(fp);
13026
13027         FILE_ptr(fp) += 42;
13028
13029         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13030                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13031                 exit (1);
13032         }
13033         if (FILE_cnt(fp) <= 20) {
13034                 printf ("Fail (<20 chars to test)");
13035                 exit (1);
13036         }
13037         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13038                 puts("Fail compare");
13039                 exit (1);
13040         }
13041         if (cnt == FILE_cnt(fp)) {
13042                 puts("Pass_unchanged");
13043                 exit (0);
13044         }
13045         if (FILE_cnt(fp) == (cnt - 42)) {
13046                 puts("Pass_changed");
13047                 exit (0);
13048         }
13049         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13050         return 1;
13051
13052 }
13053 EOP
13054         set try
13055         if eval $compile && $to try.c; then
13056                 case `$run ./try` in
13057                 Pass_changed)
13058                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13059                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13060                 Pass_unchanged)
13061                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13062                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13063                 Fail*)
13064                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13065                 *)
13066                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13067         esac
13068         else
13069                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13070         fi
13071         $rm_try
13072         ;;
13073 esac
13074
13075 : see if _base is also standard
13076 val="$undef"
13077 case "$d_stdstdio" in
13078 $define)
13079         $cat >try.c <<EOP
13080 #include <stdio.h>
13081 #$i_stdlib I_STDLIB
13082 #ifdef I_STDLIB
13083 #include <stdlib.h>
13084 #endif
13085 #define FILE_base(fp)   $stdio_base
13086 #define FILE_bufsiz(fp) $stdio_bufsiz
13087 int main() {
13088         FILE *fp = fopen("try.c", "r");
13089         char c = getc(fp);
13090         if (
13091                 19 <= FILE_bufsiz(fp) &&
13092                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13093         )
13094                 exit(0);
13095         exit(1);
13096 }
13097 EOP
13098         set try
13099         if eval $compile && $to try.c; then
13100                 if $run ./try; then
13101                         echo "And its _base field acts std."
13102                         val="$define"
13103                 else
13104                         echo "But its _base field isn't std."
13105                 fi
13106         else
13107                 echo "However, it seems to be lacking the _base field."
13108         fi
13109         $rm_try
13110         ;;
13111 esac
13112 set d_stdiobase
13113 eval $setvar
13114
13115 : see if fast_stdio exists
13116 val="$undef"
13117 case "$d_stdstdio:$d_stdio_ptr_lval" in
13118 "$define:$define")
13119         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13120         *$define*)
13121                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13122                 val="$define"
13123                 ;;
13124         esac
13125         ;;
13126 esac
13127 set d_faststdio
13128 eval $setvar
13129
13130
13131
13132 : see if fchdir exists
13133 set fchdir d_fchdir
13134 eval $inlibc
13135
13136 : see if fchmod exists
13137 set fchmod d_fchmod
13138 eval $inlibc
13139
13140 : see if fchown exists
13141 set fchown d_fchown
13142 eval $inlibc
13143
13144 : see if this is an fcntl system
13145 set fcntl d_fcntl
13146 eval $inlibc
13147
13148 : See if fcntl-based locking works.
13149 echo " "
13150 $cat >try.c <<EOCP
13151 #$i_stdlib I_STDLIB
13152 #ifdef I_STDLIB
13153 #include <stdlib.h>
13154 #endif
13155 #include <unistd.h>
13156 #include <fcntl.h>
13157 #include <signal.h>
13158 $signal_t blech(int x) { exit(3); }
13159 int main() {
13160 #if defined(F_SETLK) && defined(F_SETLKW)
13161      struct flock flock;
13162      int retval, fd;
13163      fd = open("try.c", O_RDONLY);
13164      flock.l_type = F_RDLCK;
13165      flock.l_whence = SEEK_SET;
13166      flock.l_start = flock.l_len = 0;
13167      signal(SIGALRM, blech);
13168      alarm(10);
13169      retval = fcntl(fd, F_SETLK, &flock);
13170      close(fd);
13171      (retval < 0 ? exit(2) : exit(0));
13172 #else
13173      exit(2);
13174 #endif
13175 }
13176 EOCP
13177 echo "Checking if fcntl-based file locking works... "
13178 case "$d_fcntl" in
13179 "$define")
13180         set try
13181         if eval $compile_ok; then
13182                 if $run ./try; then
13183                         echo "Yes, it seems to work."
13184                         val="$define"
13185                 else
13186                         echo "Nope, it didn't work."
13187                         val="$undef"
13188                         case "$?" in
13189                         3) $cat >&4 <<EOM
13190 ***
13191 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13192 *** This is (almost) impossible.
13193 *** If your NFS lock daemons are not feeling well, something like
13194 *** this may happen, please investigate.  Cannot continue, aborting.
13195 ***
13196 EOM
13197                                 exit 1
13198                                 ;;
13199                         esac
13200                 fi
13201         else
13202                 echo "I'm unable to compile the test program, so I'll assume not."
13203                 val="$undef"
13204         fi
13205         ;;
13206 *) val="$undef";
13207         echo "Nope, since you don't even have fcntl()."
13208         ;;
13209 esac
13210 set d_fcntl_can_lock
13211 eval $setvar
13212 $rm_try
13213
13214 : check for fd_set items
13215 $cat <<EOM
13216
13217 Checking to see how well your C compiler handles fd_set and friends ...
13218 EOM
13219 $cat >try.c <<EOCP
13220 #$i_stdlib I_STDLIB
13221 #ifdef I_STDLIB
13222 #include <stdlib.h>
13223 #endif
13224 #$i_systime I_SYS_TIME
13225 #$i_sysselct I_SYS_SELECT
13226 #$d_socket HAS_SOCKET
13227 #include <sys/types.h>
13228 #ifdef HAS_SOCKET
13229 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13230 #endif
13231 #ifdef I_SYS_TIME
13232 #include <sys/time.h>
13233 #endif
13234 #ifdef I_SYS_SELECT
13235 #include <sys/select.h>
13236 #endif
13237 int main() {
13238         fd_set fds;
13239
13240 #ifdef TRYBITS
13241         if(fds.fds_bits);
13242 #endif
13243
13244 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13245         exit(0);
13246 #else
13247         exit(1);
13248 #endif
13249 }
13250 EOCP
13251 set try -DTRYBITS
13252 if eval $compile; then
13253         d_fds_bits="$define"
13254         d_fd_set="$define"
13255         echo "Well, your system knows about the normal fd_set typedef..." >&4
13256         if $run ./try; then
13257                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13258                 d_fd_macros="$define"
13259         else
13260                 $cat >&4 <<'EOM'
13261 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13262 EOM
13263                 d_fd_macros="$undef"
13264         fi
13265 else
13266         $cat <<'EOM'
13267 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13268 EOM
13269         set try
13270         if eval $compile; then
13271                 d_fds_bits="$undef"
13272                 d_fd_set="$define"
13273                 echo "Well, your system has some sort of fd_set available..." >&4
13274                 if $run ./try; then
13275                         echo "and you have the normal fd_set macros." >&4
13276                         d_fd_macros="$define"
13277                 else
13278                         $cat <<'EOM'
13279 but not the normal fd_set macros!  Gross!  More work for me...
13280 EOM
13281                         d_fd_macros="$undef"
13282                 fi
13283         else
13284         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13285                 d_fd_set="$undef"
13286                 d_fds_bits="$undef"
13287                 d_fd_macros="$undef"
13288         fi
13289 fi
13290 $rm_try
13291
13292 : see if fgetpos exists
13293 set fgetpos d_fgetpos
13294 eval $inlibc
13295
13296 : see if finite exists
13297 set finite d_finite
13298 eval $inlibc
13299
13300 : see if finitel exists
13301 set finitel d_finitel
13302 eval $inlibc
13303
13304 : see if flock exists
13305 set flock d_flock
13306 eval $inlibc
13307
13308 : see if prototype for flock is available
13309 echo " "
13310 set d_flockproto flock $i_sysfile sys/file.h
13311 eval $hasproto
13312
13313 : see if fp_class exists
13314 set fp_class d_fp_class
13315 eval $inlibc
13316
13317 : see if pathconf exists
13318 set pathconf d_pathconf
13319 eval $inlibc
13320
13321 : see if fpathconf exists
13322 set fpathconf d_fpathconf
13323 eval $inlibc
13324
13325 : see if fpclass exists
13326 set fpclass d_fpclass
13327 eval $inlibc
13328
13329 : see if fpclassify exists
13330 set fpclassify d_fpclassify
13331 eval $inlibc
13332
13333 : see if fpclassl exists
13334 set fpclassl d_fpclassl
13335 eval $inlibc
13336
13337 : check for fpos64_t
13338 echo " "
13339 echo "Checking to see if you have fpos64_t..." >&4
13340 $cat >try.c <<EOCP
13341 #include <stdio.h>
13342 int main() { fpos64_t x = 7; }
13343 EOCP
13344 set try
13345 if eval $compile; then
13346         val="$define"
13347         echo "You have fpos64_t."
13348 else
13349         val="$undef"
13350         echo "You do not have fpos64_t."
13351         case "$fpossize" in
13352         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13353         esac
13354 fi
13355 $rm_try
13356 set d_fpos64_t
13357 eval $setvar
13358
13359 : see if frexpl exists
13360 set frexpl d_frexpl
13361 eval $inlibc
13362
13363 : see if this is a sys/param system
13364 set sys/param.h i_sysparam
13365 eval $inhdr
13366
13367 : see if this is a sys/mount.h system
13368 set sys/mount.h i_sysmount
13369 eval $inhdr
13370
13371 : Check for fs_data_s
13372 echo " "
13373 echo "Checking to see if your system supports struct fs_data..." >&4
13374 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13375 eval $hasstruct
13376 case "$d_fs_data_s" in
13377 "$define")      echo "Yes, it does."   ;;
13378 *)              echo "No, it doesn't." ;;
13379 esac
13380
13381 : see if fseeko exists
13382 set fseeko d_fseeko
13383 eval $inlibc
13384 case "$longsize" in
13385 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13386 esac
13387
13388 : see if fsetpos exists
13389 set fsetpos d_fsetpos
13390 eval $inlibc
13391
13392 : see if fstatfs exists
13393 set fstatfs d_fstatfs
13394 eval $inlibc
13395
13396 : see if statvfs exists
13397 set statvfs d_statvfs
13398 eval $inlibc
13399
13400 : see if fstatvfs exists
13401 set fstatvfs d_fstatvfs
13402 eval $inlibc
13403
13404
13405 : see if fsync exists
13406 set fsync d_fsync
13407 eval $inlibc
13408
13409 : see if ftello exists
13410 set ftello d_ftello
13411 eval $inlibc
13412 case "$longsize" in
13413 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13414 esac
13415
13416 : check for a working futimes
13417 d_futimes="$undef"
13418 echo " "
13419 echo "Checking if you have a working futimes()" >&4
13420 $cat >try.c <<EOCP
13421 #include <stdio.h>
13422 #include <sys/time.h>
13423 #include <errno.h>
13424 #include <fcntl.h>
13425
13426 int main ()
13427 {
13428     int fd, rv;
13429     fd = open ("try.c", O_RDWR);
13430     if (-1 == fd) exit (1);
13431     rv = futimes (fd, NULL);
13432     exit (rv == -1 ? errno : 0);
13433 }
13434 EOCP
13435 set try
13436 if eval $compile; then
13437     `$run ./try`
13438     rc=$?
13439     case "$rc" in
13440         0)  echo "Yes, you have" >&4
13441             d_futimes="$define"
13442             ;;
13443         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13444             ;;
13445     esac
13446 else
13447     echo "No, it does not (probably harmless)" >&4
13448 fi
13449 $rm_try
13450
13451 : see if ndbm.h is available
13452 set ndbm.h i_ndbm
13453 eval $inhdr
13454 : Compatibility location for RedHat 7.1
13455 set gdbm/ndbm.h i_gdbmndbm
13456 eval $inhdr
13457 : Compatibility location for Debian 4.0
13458 set gdbm-ndbm.h i_gdbm_ndbm
13459 eval $inhdr
13460
13461 val="$undef"
13462 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13463         : see if dbm_open exists
13464         set dbm_open d_dbm_open
13465         eval $inlibc
13466         case "$d_dbm_open" in
13467         $undef)
13468                 i_ndbm="$undef"
13469                 i_gdbmndbm="$undef"
13470                 i_gdbm_ndbm="$undef"
13471                 echo "We won't be including <ndbm.h>"
13472                 val="$undef"
13473                 ;;
13474         *) val="$define"
13475            ;;
13476         esac
13477 fi
13478 set d_ndbm
13479 eval $setvar
13480
13481 ndbm_hdr_protochk='name=$1; hdr=$2;
13482 eval "ihdr=\$""i_$name";
13483 val="$undef";
13484 if $test "$ihdr" = "$define"; then
13485         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13486         case "$d_cplusplus" in
13487         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13488         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13489         esac;
13490         case "$val" in
13491         $define) $echo "Your <$hdr> seems to have prototypes";;
13492         *) $echo "Your <$hdr> does not seem to have prototypes";;
13493         esac;
13494 fi;
13495 set "d_${name}_h_uses_prototypes";
13496 eval $setvar'
13497
13498 set ndbm ndbm.h
13499 eval $ndbm_hdr_protochk
13500 set gdbmndbm gdbm/ndbm.h
13501 eval $ndbm_hdr_protochk
13502 set gdbm_ndbm gdbm-ndbm.h
13503 eval $ndbm_hdr_protochk
13504
13505 : see if getaddrinfo exists
13506 set getaddrinfo d_getaddrinfo
13507 eval $inlibc
13508
13509 : see if getcwd exists
13510 set getcwd d_getcwd
13511 eval $inlibc
13512
13513 : see if getespwnam exists
13514 set getespwnam d_getespwnam
13515 eval $inlibc
13516
13517 : see if getfsstat exists
13518 set getfsstat d_getfsstat
13519 eval $inlibc
13520
13521 : see if getgrent exists
13522 set getgrent d_getgrent
13523 eval $inlibc
13524
13525 : see if getgrent_r exists
13526 set getgrent_r d_getgrent_r
13527 eval $inlibc
13528 case "$d_getgrent_r" in
13529 "$define")
13530         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13531         case "$d_getgrent_r_proto:$usethreads" in
13532         ":define")      d_getgrent_r_proto=define
13533                 set d_getgrent_r_proto getgrent_r $hdrs
13534                 eval $hasproto ;;
13535         *)      ;;
13536         esac
13537         case "$d_getgrent_r_proto" in
13538         define)
13539         case "$getgrent_r_proto" in
13540         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13541         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13542         esac
13543         case "$getgrent_r_proto" in
13544         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13545         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13546         esac
13547         case "$getgrent_r_proto" in
13548         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13549         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13550         esac
13551         case "$getgrent_r_proto" in
13552         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13553         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13554         esac
13555         case "$getgrent_r_proto" in
13556         ''|0) try='int getgrent_r(struct group*, char*, int);'
13557         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13558         esac
13559         case "$getgrent_r_proto" in
13560         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13561         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13562         esac
13563         case "$getgrent_r_proto" in
13564         ''|0)   d_getgrent_r=undef
13565                 getgrent_r_proto=0
13566                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13567         * )     case "$getgrent_r_proto" in
13568                 REENTRANT_PROTO*) ;;
13569                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13570                 esac
13571                 echo "Prototype: $try" ;;
13572         esac
13573         ;;
13574         *)      case "$usethreads" in
13575                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13576                 esac
13577                 d_getgrent_r=undef
13578                 getgrent_r_proto=0
13579                 ;;
13580         esac
13581         ;;
13582 *)      getgrent_r_proto=0
13583         ;;
13584 esac
13585
13586 : see if getgrgid_r exists
13587 set getgrgid_r d_getgrgid_r
13588 eval $inlibc
13589 case "$d_getgrgid_r" in
13590 "$define")
13591         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13592         case "$d_getgrgid_r_proto:$usethreads" in
13593         ":define")      d_getgrgid_r_proto=define
13594                 set d_getgrgid_r_proto getgrgid_r $hdrs
13595                 eval $hasproto ;;
13596         *)      ;;
13597         esac
13598         case "$d_getgrgid_r_proto" in
13599         define)
13600         case "$getgrgid_r_proto" in
13601         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13602         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13603         esac
13604         case "$getgrgid_r_proto" in
13605         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13606         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13607         esac
13608         case "$getgrgid_r_proto" in
13609         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13610         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13611         esac
13612         case "$getgrgid_r_proto" in
13613         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13614         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13615         esac
13616         case "$getgrgid_r_proto" in
13617         ''|0)   d_getgrgid_r=undef
13618                 getgrgid_r_proto=0
13619                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13620         * )     case "$getgrgid_r_proto" in
13621                 REENTRANT_PROTO*) ;;
13622                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13623                 esac
13624                 echo "Prototype: $try" ;;
13625         esac
13626         ;;
13627         *)      case "$usethreads" in
13628                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13629                 esac
13630                 d_getgrgid_r=undef
13631                 getgrgid_r_proto=0
13632                 ;;
13633         esac
13634         ;;
13635 *)      getgrgid_r_proto=0
13636         ;;
13637 esac
13638
13639 : see if getgrnam_r exists
13640 set getgrnam_r d_getgrnam_r
13641 eval $inlibc
13642 case "$d_getgrnam_r" in
13643 "$define")
13644         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13645         case "$d_getgrnam_r_proto:$usethreads" in
13646         ":define")      d_getgrnam_r_proto=define
13647                 set d_getgrnam_r_proto getgrnam_r $hdrs
13648                 eval $hasproto ;;
13649         *)      ;;
13650         esac
13651         case "$d_getgrnam_r_proto" in
13652         define)
13653         case "$getgrnam_r_proto" in
13654         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13655         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13656         esac
13657         case "$getgrnam_r_proto" in
13658         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13659         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13660         esac
13661         case "$getgrnam_r_proto" in
13662         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13663         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13664         esac
13665         case "$getgrnam_r_proto" in
13666         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13667         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13668         esac
13669         case "$getgrnam_r_proto" in
13670         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13671         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13672         esac
13673         case "$getgrnam_r_proto" in
13674         ''|0)   d_getgrnam_r=undef
13675                 getgrnam_r_proto=0
13676                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13677         * )     case "$getgrnam_r_proto" in
13678                 REENTRANT_PROTO*) ;;
13679                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13680                 esac
13681                 echo "Prototype: $try" ;;
13682         esac
13683         ;;
13684         *)      case "$usethreads" in
13685                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13686                 esac
13687                 d_getgrnam_r=undef
13688                 getgrnam_r_proto=0
13689                 ;;
13690         esac
13691         ;;
13692 *)      getgrnam_r_proto=0
13693         ;;
13694 esac
13695
13696 : see if gethostbyaddr exists
13697 set gethostbyaddr d_gethbyaddr
13698 eval $inlibc
13699
13700 : see if gethostbyname exists
13701 set gethostbyname d_gethbyname
13702 eval $inlibc
13703
13704 : see if gethostent exists
13705 set gethostent d_gethent
13706 eval $inlibc
13707
13708 : see how we will look up host name
13709 echo " "
13710 call=''
13711 if set gethostname val -f d_gethname; eval $csym; $val; then
13712         echo 'gethostname() found.' >&4
13713         d_gethname="$define"
13714         call=gethostname
13715 fi
13716 if set uname val -f d_uname; eval $csym; $val; then
13717         if ./xenix; then
13718                 $cat <<'EOM'
13719 uname() was found, but you're running xenix, and older versions of xenix
13720 have a broken uname(). If you don't really know whether your xenix is old
13721 enough to have a broken system call, use the default answer.
13722
13723 EOM
13724                 dflt=y
13725                 case "$d_uname" in
13726                 "$define") dflt=n;;
13727                 esac
13728                 rp='Is your uname() broken?'
13729                 . ./myread
13730                 case "$ans" in
13731                 n*) d_uname="$define"; call=uname;;
13732                 esac
13733         else
13734                 echo 'uname() found.' >&4
13735                 d_uname="$define"
13736                 case "$call" in
13737                 '') call=uname ;;
13738                 esac
13739         fi
13740 fi
13741 case "$d_gethname" in
13742 '') d_gethname="$undef";;
13743 esac
13744 case "$d_uname" in
13745 '') d_uname="$undef";;
13746 esac
13747 case "$d_uname$d_gethname" in
13748 *define*)
13749         dflt=n
13750         cat <<EOM
13751
13752 Every now and then someone has a $call() that lies about the hostname
13753 but can't be fixed for political or economic reasons.  If you wish, I can
13754 pretend $call() isn't there and maybe compute hostname at run-time
13755 thanks to the '$phostname' command.
13756
13757 EOM
13758         rp="Shall I ignore $call() from now on?"
13759         . ./myread
13760         case "$ans" in
13761         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13762         esac;;
13763 esac
13764 case "$phostname" in
13765 '') aphostname='';;
13766 *) case "$aphostname" in
13767         /*) ;;
13768         *) set X $phostname
13769                 shift
13770                 file=$1
13771                 shift
13772                 file=`./loc $file $file $pth`
13773                 aphostname=`echo $file $*`
13774                 ;;
13775         esac
13776         ;;
13777 esac
13778 case "$d_uname$d_gethname" in
13779 *define*) ;;
13780 *)
13781         case "$phostname" in
13782         '')
13783                 echo "There will be no way for $package to get your hostname." >&4;;
13784         *)
13785         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13786                 ;;
13787         esac;;
13788 esac
13789 case "$d_phostname" in
13790 '') d_phostname="$undef";;
13791 esac
13792
13793 : see if gethostbyaddr_r exists
13794 set gethostbyaddr_r d_gethostbyaddr_r
13795 eval $inlibc
13796 case "$d_gethostbyaddr_r" in
13797 "$define")
13798         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13799         case "$d_gethostbyaddr_r_proto:$usethreads" in
13800         ":define")      d_gethostbyaddr_r_proto=define
13801                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13802                 eval $hasproto ;;
13803         *)      ;;
13804         esac
13805         case "$d_gethostbyaddr_r_proto" in
13806         define)
13807         case "$gethostbyaddr_r_proto" in
13808         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13809         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13810         esac
13811         case "$gethostbyaddr_r_proto" in
13812         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13813         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13814         esac
13815         case "$gethostbyaddr_r_proto" in
13816         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13817         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13818         esac
13819         case "$gethostbyaddr_r_proto" in
13820         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13821         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13822         esac
13823         case "$gethostbyaddr_r_proto" in
13824         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13825         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13826         esac
13827         case "$gethostbyaddr_r_proto" in
13828         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13829         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13830         esac
13831         case "$gethostbyaddr_r_proto" in
13832         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13833         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13834         esac
13835         case "$gethostbyaddr_r_proto" in
13836         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13837         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13838         esac
13839         case "$gethostbyaddr_r_proto" in
13840         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13841         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13842         esac
13843         case "$gethostbyaddr_r_proto" in
13844         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13845         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13846         esac
13847         case "$gethostbyaddr_r_proto" in
13848         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13849         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13850         esac
13851         case "$gethostbyaddr_r_proto" in
13852         ''|0)   d_gethostbyaddr_r=undef
13853                 gethostbyaddr_r_proto=0
13854                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13855         * )     case "$gethostbyaddr_r_proto" in
13856                 REENTRANT_PROTO*) ;;
13857                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13858                 esac
13859                 echo "Prototype: $try" ;;
13860         esac
13861         ;;
13862         *)      case "$usethreads" in
13863                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13864                 esac
13865                 d_gethostbyaddr_r=undef
13866                 gethostbyaddr_r_proto=0
13867                 ;;
13868         esac
13869         ;;
13870 *)      gethostbyaddr_r_proto=0
13871         ;;
13872 esac
13873
13874 : see if gethostbyname_r exists
13875 set gethostbyname_r d_gethostbyname_r
13876 eval $inlibc
13877 case "$d_gethostbyname_r" in
13878 "$define")
13879         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13880         case "$d_gethostbyname_r_proto:$usethreads" in
13881         ":define")      d_gethostbyname_r_proto=define
13882                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13883                 eval $hasproto ;;
13884         *)      ;;
13885         esac
13886         case "$d_gethostbyname_r_proto" in
13887         define)
13888         case "$gethostbyname_r_proto" in
13889         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13890         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13891         esac
13892         case "$gethostbyname_r_proto" in
13893         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13894         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13895         esac
13896         case "$gethostbyname_r_proto" in
13897         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13898         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13899         esac
13900         case "$gethostbyname_r_proto" in
13901         ''|0)   d_gethostbyname_r=undef
13902                 gethostbyname_r_proto=0
13903                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13904         * )     case "$gethostbyname_r_proto" in
13905                 REENTRANT_PROTO*) ;;
13906                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13907                 esac
13908                 echo "Prototype: $try" ;;
13909         esac
13910         ;;
13911         *)      case "$usethreads" in
13912                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13913                 esac
13914                 d_gethostbyname_r=undef
13915                 gethostbyname_r_proto=0
13916                 ;;
13917         esac
13918         ;;
13919 *)      gethostbyname_r_proto=0
13920         ;;
13921 esac
13922
13923 : see if gethostent_r exists
13924 set gethostent_r d_gethostent_r
13925 eval $inlibc
13926 case "$d_gethostent_r" in
13927 "$define")
13928         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13929         case "$d_gethostent_r_proto:$usethreads" in
13930         ":define")      d_gethostent_r_proto=define
13931                 set d_gethostent_r_proto gethostent_r $hdrs
13932                 eval $hasproto ;;
13933         *)      ;;
13934         esac
13935         case "$d_gethostent_r_proto" in
13936         define)
13937         case "$gethostent_r_proto" in
13938         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13939         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13940         esac
13941         case "$gethostent_r_proto" in
13942         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13943         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13944         esac
13945         case "$gethostent_r_proto" in
13946         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13947         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13948         esac
13949         case "$gethostent_r_proto" in
13950         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13951         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
13952         esac
13953         case "$gethostent_r_proto" in
13954         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13955         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
13956         esac
13957         case "$gethostent_r_proto" in
13958         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13959         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
13960         esac
13961         case "$gethostent_r_proto" in
13962         ''|0)   d_gethostent_r=undef
13963                 gethostent_r_proto=0
13964                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13965         * )     case "$gethostent_r_proto" in
13966                 REENTRANT_PROTO*) ;;
13967                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13968                 esac
13969                 echo "Prototype: $try" ;;
13970         esac
13971         ;;
13972         *)      case "$usethreads" in
13973                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13974                 esac
13975                 d_gethostent_r=undef
13976                 gethostent_r_proto=0
13977                 ;;
13978         esac
13979         ;;
13980 *)      gethostent_r_proto=0
13981         ;;
13982 esac
13983
13984 : see if prototypes for various gethostxxx netdb.h functions are available
13985 echo " "
13986 set d_gethostprotos gethostent $i_netdb netdb.h
13987 eval $hasproto
13988
13989 : see if getitimer exists
13990 set getitimer d_getitimer
13991 eval $inlibc
13992
13993 : see if getlogin exists
13994 set getlogin d_getlogin
13995 eval $inlibc
13996
13997 : see if getlogin_r exists
13998 set getlogin_r d_getlogin_r
13999 eval $inlibc
14000 case "$d_getlogin_r" in
14001 "$define")
14002         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14003         case "$d_getlogin_r_proto:$usethreads" in
14004         ":define")      d_getlogin_r_proto=define
14005                 set d_getlogin_r_proto getlogin_r $hdrs
14006                 eval $hasproto ;;
14007         *)      ;;
14008         esac
14009         case "$d_getlogin_r_proto" in
14010         define)
14011         case "$getlogin_r_proto" in
14012         ''|0) try='int getlogin_r(char*, size_t);'
14013         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14014         esac
14015         case "$getlogin_r_proto" in
14016         ''|0) try='int getlogin_r(char*, int);'
14017         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14018         esac
14019         case "$getlogin_r_proto" in
14020         ''|0) try='char* getlogin_r(char*, size_t);'
14021         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14022         esac
14023         case "$getlogin_r_proto" in
14024         ''|0) try='char* getlogin_r(char*, int);'
14025         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14026         esac
14027         case "$getlogin_r_proto" in
14028         ''|0)   d_getlogin_r=undef
14029                 getlogin_r_proto=0
14030                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14031         * )     case "$getlogin_r_proto" in
14032                 REENTRANT_PROTO*) ;;
14033                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14034                 esac
14035                 echo "Prototype: $try" ;;
14036         esac
14037         ;;
14038         *)      case "$usethreads" in
14039                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14040                 esac
14041                 d_getlogin_r=undef
14042                 getlogin_r_proto=0
14043                 ;;
14044         esac
14045         ;;
14046 *)      getlogin_r_proto=0
14047         ;;
14048 esac
14049
14050 : see if getmnt exists
14051 set getmnt d_getmnt
14052 eval $inlibc
14053
14054 : see if getmntent exists
14055 set getmntent d_getmntent
14056 eval $inlibc
14057
14058 : see if getnameinfo exists
14059 set getnameinfo d_getnameinfo
14060 eval $inlibc
14061
14062 : see if getnetbyaddr exists
14063 set getnetbyaddr d_getnbyaddr
14064 eval $inlibc
14065
14066 : see if getnetbyname exists
14067 set getnetbyname d_getnbyname
14068 eval $inlibc
14069
14070 : see if getnetent exists
14071 set getnetent d_getnent
14072 eval $inlibc
14073
14074 : see if getnetbyaddr_r exists
14075 set getnetbyaddr_r d_getnetbyaddr_r
14076 eval $inlibc
14077 case "$d_getnetbyaddr_r" in
14078 "$define")
14079         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14080         case "$d_getnetbyaddr_r_proto:$usethreads" in
14081         ":define")      d_getnetbyaddr_r_proto=define
14082                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14083                 eval $hasproto ;;
14084         *)      ;;
14085         esac
14086         case "$d_getnetbyaddr_r_proto" in
14087         define)
14088         case "$getnetbyaddr_r_proto" in
14089         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14090         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14091         esac
14092         case "$getnetbyaddr_r_proto" in
14093         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14094         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14095         esac
14096         case "$getnetbyaddr_r_proto" in
14097         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14098         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14099         esac
14100         case "$getnetbyaddr_r_proto" in
14101         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14102         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14103         esac
14104         case "$getnetbyaddr_r_proto" in
14105         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14106         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14107         esac
14108         case "$getnetbyaddr_r_proto" in
14109         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14110         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14111         esac
14112         case "$getnetbyaddr_r_proto" in
14113         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14114         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14115         esac
14116         case "$getnetbyaddr_r_proto" in
14117         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14118         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14119         esac
14120         case "$getnetbyaddr_r_proto" in
14121         ''|0)   d_getnetbyaddr_r=undef
14122                 getnetbyaddr_r_proto=0
14123                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14124         * )     case "$getnetbyaddr_r_proto" in
14125                 REENTRANT_PROTO*) ;;
14126                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14127                 esac
14128                 echo "Prototype: $try" ;;
14129         esac
14130         ;;
14131         *)      case "$usethreads" in
14132                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14133                 esac
14134                 d_getnetbyaddr_r=undef
14135                 getnetbyaddr_r_proto=0
14136                 ;;
14137         esac
14138         ;;
14139 *)      getnetbyaddr_r_proto=0
14140         ;;
14141 esac
14142
14143 : see if getnetbyname_r exists
14144 set getnetbyname_r d_getnetbyname_r
14145 eval $inlibc
14146 case "$d_getnetbyname_r" in
14147 "$define")
14148         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14149         case "$d_getnetbyname_r_proto:$usethreads" in
14150         ":define")      d_getnetbyname_r_proto=define
14151                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14152                 eval $hasproto ;;
14153         *)      ;;
14154         esac
14155         case "$d_getnetbyname_r_proto" in
14156         define)
14157         case "$getnetbyname_r_proto" in
14158         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14159         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14160         esac
14161         case "$getnetbyname_r_proto" in
14162         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14163         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14164         esac
14165         case "$getnetbyname_r_proto" in
14166         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14167         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14168         esac
14169         case "$getnetbyname_r_proto" in
14170         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14171         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14172         esac
14173         case "$getnetbyname_r_proto" in
14174         ''|0)   d_getnetbyname_r=undef
14175                 getnetbyname_r_proto=0
14176                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14177         * )     case "$getnetbyname_r_proto" in
14178                 REENTRANT_PROTO*) ;;
14179                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14180                 esac
14181                 echo "Prototype: $try" ;;
14182         esac
14183         ;;
14184         *)      case "$usethreads" in
14185                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14186                 esac
14187                 d_getnetbyname_r=undef
14188                 getnetbyname_r_proto=0
14189                 ;;
14190         esac
14191         ;;
14192 *)      getnetbyname_r_proto=0
14193         ;;
14194 esac
14195
14196 : see if getnetent_r exists
14197 set getnetent_r d_getnetent_r
14198 eval $inlibc
14199 case "$d_getnetent_r" in
14200 "$define")
14201         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14202         case "$d_getnetent_r_proto:$usethreads" in
14203         ":define")      d_getnetent_r_proto=define
14204                 set d_getnetent_r_proto getnetent_r $hdrs
14205                 eval $hasproto ;;
14206         *)      ;;
14207         esac
14208         case "$d_getnetent_r_proto" in
14209         define)
14210         case "$getnetent_r_proto" in
14211         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14212         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14213         esac
14214         case "$getnetent_r_proto" in
14215         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14216         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14217         esac
14218         case "$getnetent_r_proto" in
14219         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14220         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14221         esac
14222         case "$getnetent_r_proto" in
14223         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14224         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14225         esac
14226         case "$getnetent_r_proto" in
14227         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14228         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14229         esac
14230         case "$getnetent_r_proto" in
14231         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14232         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14233         esac
14234         case "$getnetent_r_proto" in
14235         ''|0)   d_getnetent_r=undef
14236                 getnetent_r_proto=0
14237                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14238         * )     case "$getnetent_r_proto" in
14239                 REENTRANT_PROTO*) ;;
14240                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14241                 esac
14242                 echo "Prototype: $try" ;;
14243         esac
14244         ;;
14245         *)      case "$usethreads" in
14246                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14247                 esac
14248                 d_getnetent_r=undef
14249                 getnetent_r_proto=0
14250                 ;;
14251         esac
14252         ;;
14253 *)      getnetent_r_proto=0
14254         ;;
14255 esac
14256
14257 : see if prototypes for various getnetxxx netdb.h functions are available
14258 echo " "
14259 set d_getnetprotos getnetent $i_netdb netdb.h
14260 eval $hasproto
14261
14262 : see if getpagesize exists
14263 set getpagesize d_getpagsz
14264 eval $inlibc
14265
14266 : Optional checks for getprotobyname and getprotobynumber
14267
14268 : see if getprotobyname exists
14269 set getprotobyname d_getpbyname
14270 eval $inlibc
14271
14272 : see if getprotobynumber exists
14273 set getprotobynumber d_getpbynumber
14274 eval $inlibc
14275
14276 : see if getprotoent exists
14277 set getprotoent d_getpent
14278 eval $inlibc
14279
14280 : see if getpgid exists
14281 set getpgid d_getpgid
14282 eval $inlibc
14283
14284 : see if getpgrp2 exists
14285 set getpgrp2 d_getpgrp2
14286 eval $inlibc
14287
14288 : see if getppid exists
14289 set getppid d_getppid
14290 eval $inlibc
14291
14292 : see if getpriority exists
14293 set getpriority d_getprior
14294 eval $inlibc
14295
14296 : see if getprotobyname_r exists
14297 set getprotobyname_r d_getprotobyname_r
14298 eval $inlibc
14299 case "$d_getprotobyname_r" in
14300 "$define")
14301         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14302         case "$d_getprotobyname_r_proto:$usethreads" in
14303         ":define")      d_getprotobyname_r_proto=define
14304                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14305                 eval $hasproto ;;
14306         *)      ;;
14307         esac
14308         case "$d_getprotobyname_r_proto" in
14309         define)
14310         case "$getprotobyname_r_proto" in
14311         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14312         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14313         esac
14314         case "$getprotobyname_r_proto" in
14315         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14316         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14317         esac
14318         case "$getprotobyname_r_proto" in
14319         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14320         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14321         esac
14322         case "$getprotobyname_r_proto" in
14323         ''|0)   d_getprotobyname_r=undef
14324                 getprotobyname_r_proto=0
14325                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14326         * )     case "$getprotobyname_r_proto" in
14327                 REENTRANT_PROTO*) ;;
14328                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14329                 esac
14330                 echo "Prototype: $try" ;;
14331         esac
14332         ;;
14333         *)      case "$usethreads" in
14334                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14335                 esac
14336                 d_getprotobyname_r=undef
14337                 getprotobyname_r_proto=0
14338                 ;;
14339         esac
14340         ;;
14341 *)      getprotobyname_r_proto=0
14342         ;;
14343 esac
14344
14345 : see if getprotobynumber_r exists
14346 set getprotobynumber_r d_getprotobynumber_r
14347 eval $inlibc
14348 case "$d_getprotobynumber_r" in
14349 "$define")
14350         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14351         case "$d_getprotobynumber_r_proto:$usethreads" in
14352         ":define")      d_getprotobynumber_r_proto=define
14353                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14354                 eval $hasproto ;;
14355         *)      ;;
14356         esac
14357         case "$d_getprotobynumber_r_proto" in
14358         define)
14359         case "$getprotobynumber_r_proto" in
14360         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14361         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14362         esac
14363         case "$getprotobynumber_r_proto" in
14364         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14365         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14366         esac
14367         case "$getprotobynumber_r_proto" in
14368         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14369         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14370         esac
14371         case "$getprotobynumber_r_proto" in
14372         ''|0)   d_getprotobynumber_r=undef
14373                 getprotobynumber_r_proto=0
14374                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14375         * )     case "$getprotobynumber_r_proto" in
14376                 REENTRANT_PROTO*) ;;
14377                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14378                 esac
14379                 echo "Prototype: $try" ;;
14380         esac
14381         ;;
14382         *)      case "$usethreads" in
14383                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14384                 esac
14385                 d_getprotobynumber_r=undef
14386                 getprotobynumber_r_proto=0
14387                 ;;
14388         esac
14389         ;;
14390 *)      getprotobynumber_r_proto=0
14391         ;;
14392 esac
14393
14394 : see if getprotoent_r exists
14395 set getprotoent_r d_getprotoent_r
14396 eval $inlibc
14397 case "$d_getprotoent_r" in
14398 "$define")
14399         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14400         case "$d_getprotoent_r_proto:$usethreads" in
14401         ":define")      d_getprotoent_r_proto=define
14402                 set d_getprotoent_r_proto getprotoent_r $hdrs
14403                 eval $hasproto ;;
14404         *)      ;;
14405         esac
14406         case "$d_getprotoent_r_proto" in
14407         define)
14408         case "$getprotoent_r_proto" in
14409         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14410         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14411         esac
14412         case "$getprotoent_r_proto" in
14413         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14414         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14415         esac
14416         case "$getprotoent_r_proto" in
14417         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14418         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14419         esac
14420         case "$getprotoent_r_proto" in
14421         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14422         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14423         esac
14424         case "$getprotoent_r_proto" in
14425         ''|0)   d_getprotoent_r=undef
14426                 getprotoent_r_proto=0
14427                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14428         * )     case "$getprotoent_r_proto" in
14429                 REENTRANT_PROTO*) ;;
14430                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14431                 esac
14432                 echo "Prototype: $try" ;;
14433         esac
14434         ;;
14435         *)      case "$usethreads" in
14436                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14437                 esac
14438                 d_getprotoent_r=undef
14439                 getprotoent_r_proto=0
14440                 ;;
14441         esac
14442         ;;
14443 *)      getprotoent_r_proto=0
14444         ;;
14445 esac
14446
14447 : see if prototypes for various getprotoxxx netdb.h functions are available
14448 echo " "
14449 set d_getprotoprotos getprotoent $i_netdb netdb.h
14450 eval $hasproto
14451
14452 : see if getprpwnam exists
14453 set getprpwnam d_getprpwnam
14454 eval $inlibc
14455
14456 : see if getpwent exists
14457 set getpwent d_getpwent
14458 eval $inlibc
14459
14460 : see if getpwent_r exists
14461 set getpwent_r d_getpwent_r
14462 eval $inlibc
14463 case "$d_getpwent_r" in
14464 "$define")
14465         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14466         case "$d_getpwent_r_proto:$usethreads" in
14467         ":define")      d_getpwent_r_proto=define
14468                 set d_getpwent_r_proto getpwent_r $hdrs
14469                 eval $hasproto ;;
14470         *)      ;;
14471         esac
14472         case "$d_getpwent_r_proto" in
14473         define)
14474         case "$getpwent_r_proto" in
14475         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14476         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14477         esac
14478         case "$getpwent_r_proto" in
14479         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14480         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14481         esac
14482         case "$getpwent_r_proto" in
14483         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14484         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14485         esac
14486         case "$getpwent_r_proto" in
14487         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14488         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14489         esac
14490         case "$getpwent_r_proto" in
14491         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14492         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14493         esac
14494         case "$getpwent_r_proto" in
14495         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14496         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14497         esac
14498         case "$getpwent_r_proto" in
14499         ''|0)   d_getpwent_r=undef
14500                 getpwent_r_proto=0
14501                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14502         * )     case "$getpwent_r_proto" in
14503                 REENTRANT_PROTO*) ;;
14504                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14505                 esac
14506                 echo "Prototype: $try" ;;
14507         esac
14508         ;;
14509         *)      case "$usethreads" in
14510                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14511                 esac
14512                 d_getpwent_r=undef
14513                 getpwent_r_proto=0
14514                 ;;
14515         esac
14516         ;;
14517 *)      getpwent_r_proto=0
14518         ;;
14519 esac
14520
14521 : see if getpwnam_r exists
14522 set getpwnam_r d_getpwnam_r
14523 eval $inlibc
14524 case "$d_getpwnam_r" in
14525 "$define")
14526         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14527         case "$d_getpwnam_r_proto:$usethreads" in
14528         ":define")      d_getpwnam_r_proto=define
14529                 set d_getpwnam_r_proto getpwnam_r $hdrs
14530                 eval $hasproto ;;
14531         *)      ;;
14532         esac
14533         case "$d_getpwnam_r_proto" in
14534         define)
14535         case "$getpwnam_r_proto" in
14536         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14537         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14538         esac
14539         case "$getpwnam_r_proto" in
14540         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14541         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14542         esac
14543         case "$getpwnam_r_proto" in
14544         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14545         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14546         esac
14547         case "$getpwnam_r_proto" in
14548         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14549         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14550         esac
14551         case "$getpwnam_r_proto" in
14552         ''|0)   d_getpwnam_r=undef
14553                 getpwnam_r_proto=0
14554                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14555         * )     case "$getpwnam_r_proto" in
14556                 REENTRANT_PROTO*) ;;
14557                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14558                 esac
14559                 echo "Prototype: $try" ;;
14560         esac
14561         ;;
14562         *)      case "$usethreads" in
14563                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14564                 esac
14565                 d_getpwnam_r=undef
14566                 getpwnam_r_proto=0
14567                 ;;
14568         esac
14569         ;;
14570 *)      getpwnam_r_proto=0
14571         ;;
14572 esac
14573
14574 : see if getpwuid_r exists
14575 set getpwuid_r d_getpwuid_r
14576 eval $inlibc
14577 case "$d_getpwuid_r" in
14578 "$define")
14579         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14580         case "$d_getpwuid_r_proto:$usethreads" in
14581         ":define")      d_getpwuid_r_proto=define
14582                 set d_getpwuid_r_proto getpwuid_r $hdrs
14583                 eval $hasproto ;;
14584         *)      ;;
14585         esac
14586         case "$d_getpwuid_r_proto" in
14587         define)
14588         case "$getpwuid_r_proto" in
14589         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14590         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14591         esac
14592         case "$getpwuid_r_proto" in
14593         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14594         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14595         esac
14596         case "$getpwuid_r_proto" in
14597         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14598         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14599         esac
14600         case "$getpwuid_r_proto" in
14601         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14602         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14603         esac
14604         case "$getpwuid_r_proto" in
14605         ''|0)   d_getpwuid_r=undef
14606                 getpwuid_r_proto=0
14607                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14608         * )     case "$getpwuid_r_proto" in
14609                 REENTRANT_PROTO*) ;;
14610                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14611                 esac
14612                 echo "Prototype: $try" ;;
14613         esac
14614         ;;
14615         *)      case "$usethreads" in
14616                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14617                 esac
14618                 d_getpwuid_r=undef
14619                 getpwuid_r_proto=0
14620                 ;;
14621         esac
14622         ;;
14623 *)      getpwuid_r_proto=0
14624         ;;
14625 esac
14626
14627 : Optional checks for getsbyname and getsbyport
14628
14629 : see if getservbyname exists
14630 set getservbyname d_getsbyname
14631 eval $inlibc
14632
14633 : see if getservbyport exists
14634 set getservbyport d_getsbyport
14635 eval $inlibc
14636
14637 : see if getservent exists
14638 set getservent d_getsent
14639 eval $inlibc
14640
14641 : see if getservbyname_r exists
14642 set getservbyname_r d_getservbyname_r
14643 eval $inlibc
14644 case "$d_getservbyname_r" in
14645 "$define")
14646         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14647         case "$d_getservbyname_r_proto:$usethreads" in
14648         ":define")      d_getservbyname_r_proto=define
14649                 set d_getservbyname_r_proto getservbyname_r $hdrs
14650                 eval $hasproto ;;
14651         *)      ;;
14652         esac
14653         case "$d_getservbyname_r_proto" in
14654         define)
14655         case "$getservbyname_r_proto" in
14656         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14657         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14658         esac
14659         case "$getservbyname_r_proto" in
14660         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14661         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14662         esac
14663         case "$getservbyname_r_proto" in
14664         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14665         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14666         esac
14667         case "$getservbyname_r_proto" in
14668         ''|0)   d_getservbyname_r=undef
14669                 getservbyname_r_proto=0
14670                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14671         * )     case "$getservbyname_r_proto" in
14672                 REENTRANT_PROTO*) ;;
14673                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14674                 esac
14675                 echo "Prototype: $try" ;;
14676         esac
14677         ;;
14678         *)      case "$usethreads" in
14679                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14680                 esac
14681                 d_getservbyname_r=undef
14682                 getservbyname_r_proto=0
14683                 ;;
14684         esac
14685         ;;
14686 *)      getservbyname_r_proto=0
14687         ;;
14688 esac
14689
14690 : see if getservbyport_r exists
14691 set getservbyport_r d_getservbyport_r
14692 eval $inlibc
14693 case "$d_getservbyport_r" in
14694 "$define")
14695         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14696         case "$d_getservbyport_r_proto:$usethreads" in
14697         ":define")      d_getservbyport_r_proto=define
14698                 set d_getservbyport_r_proto getservbyport_r $hdrs
14699                 eval $hasproto ;;
14700         *)      ;;
14701         esac
14702         case "$d_getservbyport_r_proto" in
14703         define)
14704         case "$getservbyport_r_proto" in
14705         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14706         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14707         esac
14708         case "$getservbyport_r_proto" in
14709         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14710         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14711         esac
14712         case "$getservbyport_r_proto" in
14713         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14714         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14715         esac
14716         case "$getservbyport_r_proto" in
14717         ''|0)   d_getservbyport_r=undef
14718                 getservbyport_r_proto=0
14719                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14720         * )     case "$getservbyport_r_proto" in
14721                 REENTRANT_PROTO*) ;;
14722                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14723                 esac
14724                 echo "Prototype: $try" ;;
14725         esac
14726         ;;
14727         *)      case "$usethreads" in
14728                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14729                 esac
14730                 d_getservbyport_r=undef
14731                 getservbyport_r_proto=0
14732                 ;;
14733         esac
14734         ;;
14735 *)      getservbyport_r_proto=0
14736         ;;
14737 esac
14738
14739 : see if getservent_r exists
14740 set getservent_r d_getservent_r
14741 eval $inlibc
14742 case "$d_getservent_r" in
14743 "$define")
14744         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14745         case "$d_getservent_r_proto:$usethreads" in
14746         ":define")      d_getservent_r_proto=define
14747                 set d_getservent_r_proto getservent_r $hdrs
14748                 eval $hasproto ;;
14749         *)      ;;
14750         esac
14751         case "$d_getservent_r_proto" in
14752         define)
14753         case "$getservent_r_proto" in
14754         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14755         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14756         esac
14757         case "$getservent_r_proto" in
14758         ''|0) try='int getservent_r(struct servent*, char*, int);'
14759         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14760         esac
14761         case "$getservent_r_proto" in
14762         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14763         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14764         esac
14765         case "$getservent_r_proto" in
14766         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14767         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14768         esac
14769         case "$getservent_r_proto" in
14770         ''|0)   d_getservent_r=undef
14771                 getservent_r_proto=0
14772                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14773         * )     case "$getservent_r_proto" in
14774                 REENTRANT_PROTO*) ;;
14775                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14776                 esac
14777                 echo "Prototype: $try" ;;
14778         esac
14779         ;;
14780         *)      case "$usethreads" in
14781                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14782                 esac
14783                 d_getservent_r=undef
14784                 getservent_r_proto=0
14785                 ;;
14786         esac
14787         ;;
14788 *)      getservent_r_proto=0
14789         ;;
14790 esac
14791
14792 : see if prototypes for various getservxxx netdb.h functions are available
14793 echo " "
14794 set d_getservprotos getservent $i_netdb netdb.h
14795 eval $hasproto
14796
14797 : see if getspnam exists
14798 set getspnam d_getspnam
14799 eval $inlibc
14800
14801 : see if this is a shadow.h system
14802 set shadow.h i_shadow
14803 eval $inhdr
14804
14805 : see if getspnam_r exists
14806 set getspnam_r d_getspnam_r
14807 eval $inlibc
14808 case "$d_getspnam_r" in
14809 "$define")
14810         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14811         case "$d_getspnam_r_proto:$usethreads" in
14812         ":define")      d_getspnam_r_proto=define
14813                 set d_getspnam_r_proto getspnam_r $hdrs
14814                 eval $hasproto ;;
14815         *)      ;;
14816         esac
14817         case "$d_getspnam_r_proto" in
14818         define)
14819         case "$getspnam_r_proto" in
14820         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14821         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14822         esac
14823         case "$getspnam_r_proto" in
14824         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14825         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14826         esac
14827         case "$getspnam_r_proto" in
14828         ''|0)   d_getspnam_r=undef
14829                 getspnam_r_proto=0
14830                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14831         * )     case "$getspnam_r_proto" in
14832                 REENTRANT_PROTO*) ;;
14833                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14834                 esac
14835                 echo "Prototype: $try" ;;
14836         esac
14837         ;;
14838         *)      case "$usethreads" in
14839                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14840                 esac
14841                 d_getspnam_r=undef
14842                 getspnam_r_proto=0
14843                 ;;
14844         esac
14845         ;;
14846 *)      getspnam_r_proto=0
14847         ;;
14848 esac
14849
14850 : see if gettimeofday or ftime exists
14851 set gettimeofday d_gettimeod
14852 eval $inlibc
14853 case "$d_gettimeod" in
14854 "$undef")
14855         set ftime d_ftime 
14856         eval $inlibc
14857         ;;
14858 *)
14859         val="$undef"; set d_ftime; eval $setvar
14860         ;;
14861 esac
14862 case "$d_gettimeod$d_ftime" in
14863 "$undef$undef")
14864         echo " "
14865         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14866         ;;
14867 esac
14868
14869 : see if gmtime_r exists
14870 set gmtime_r d_gmtime_r
14871 eval $inlibc
14872 case "$d_gmtime_r" in
14873 "$define")
14874         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14875         case "$d_gmtime_r_proto:$usethreads" in
14876         ":define")      d_gmtime_r_proto=define
14877                 set d_gmtime_r_proto gmtime_r $hdrs
14878                 eval $hasproto ;;
14879         *)      ;;
14880         esac
14881         case "$d_gmtime_r_proto" in
14882         define)
14883         case "$gmtime_r_proto" in
14884         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14885         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14886         esac
14887         case "$gmtime_r_proto" in
14888         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14889         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14890         esac
14891         case "$gmtime_r_proto" in
14892         ''|0)   d_gmtime_r=undef
14893                 gmtime_r_proto=0
14894                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14895         * )     case "$gmtime_r_proto" in
14896                 REENTRANT_PROTO*) ;;
14897                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14898                 esac
14899                 echo "Prototype: $try" ;;
14900         esac
14901         ;;
14902         *)      case "$usethreads" in
14903                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14904                 esac
14905                 d_gmtime_r=undef
14906                 gmtime_r_proto=0
14907                 ;;
14908         esac
14909         ;;
14910 *)      gmtime_r_proto=0
14911         ;;
14912 esac
14913
14914 : see if hasmntopt exists
14915 set hasmntopt d_hasmntopt
14916 eval $inlibc
14917
14918 : see if this is a netinet/in.h or sys/in.h system
14919 set netinet/in.h i_niin sys/in.h i_sysin
14920 eval $inhdr
14921
14922 : see if arpa/inet.h has to be included
14923 set arpa/inet.h i_arpainet
14924 eval $inhdr
14925
14926 : see if htonl --and friends-- exists
14927 val=''
14928 set htonl val
14929 eval $inlibc
14930
14931 : Maybe they are macros.
14932 case "$val" in
14933 $undef)
14934         $cat >htonl.c <<EOM
14935 #include <stdio.h>
14936 #include <sys/types.h>
14937 #$i_niin I_NETINET_IN
14938 #$i_sysin I_SYS_IN
14939 #$i_arpainet I_ARPA_INET
14940 #ifdef I_NETINET_IN
14941 #include <netinet/in.h>
14942 #endif
14943 #ifdef I_SYS_IN
14944 #include <sys/in.h>
14945 #endif
14946 #ifdef I_ARPA_INET
14947 #include <arpa/inet.h>
14948 #endif
14949 #ifdef htonl
14950 printf("Defined as a macro.");
14951 #endif
14952 EOM
14953         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14954         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14955                 val="$define"
14956                 echo "But it seems to be defined as a macro." >&4
14957         fi
14958         $rm -f htonl.?
14959         ;;
14960 esac
14961 set d_htonl
14962 eval $setvar
14963
14964 : see if ilogbl exists
14965 set ilogbl d_ilogbl
14966 eval $inlibc
14967
14968 : index or strchr
14969 echo " "
14970 if set index val -f; eval $csym; $val; then
14971         if set strchr val -f d_strchr; eval $csym; $val; then
14972                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14973                         val="$define"
14974                         vali="$undef"
14975                         echo "strchr() found." >&4
14976                 else
14977                         val="$undef"
14978                         vali="$define"
14979                         echo "index() found." >&4
14980                 fi
14981         else
14982                 val="$undef"
14983                 vali="$define"
14984                 echo "index() found." >&4
14985         fi
14986 else
14987         if set strchr val -f d_strchr; eval $csym; $val; then
14988                 val="$define"
14989                 vali="$undef"
14990                 echo "strchr() found." >&4
14991         else
14992                 echo "No index() or strchr() found!" >&4
14993                 val="$undef"
14994                 vali="$undef"
14995         fi
14996 fi
14997 set d_strchr; eval $setvar
14998 val="$vali"
14999 set d_index; eval $setvar
15000
15001 : check whether inet_aton exists
15002 set inet_aton d_inetaton
15003 eval $inlibc
15004
15005 : see if inet_ntop exists
15006 set inet_ntop d_inetntop
15007 eval $inlibc
15008
15009 : see if inet_pton exists
15010 set inet_pton d_inetpton
15011 eval $inlibc
15012
15013 : Look for isascii
15014 echo " "
15015 $cat >isascii.c <<EOCP
15016 #include <stdio.h>
15017 #include <ctype.h>
15018 #$i_stdlib I_STDLIB
15019 #ifdef I_STDLIB
15020 #include <stdlib.h>
15021 #endif
15022 int main() {
15023         int c = 'A';
15024         if (isascii(c))
15025                 exit(0);
15026         else
15027                 exit(1);
15028 }
15029 EOCP
15030 set isascii
15031 if eval $compile; then
15032         echo "isascii() found." >&4
15033         val="$define"
15034 else
15035         echo "isascii() NOT found." >&4
15036         val="$undef"
15037 fi
15038 set d_isascii
15039 eval $setvar
15040 $rm -f isascii*
15041
15042 : Look for isblank
15043 echo " "
15044 $cat >isblank.c <<'EOCP'
15045 #include <stdio.h>
15046 #include <ctype.h>
15047 int main() {
15048         int c = ' ';
15049         if (isblank(c))
15050                 return 0 ;
15051         else
15052                 return 1 ;
15053 }
15054 EOCP
15055 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15056         echo "isblank() found." >&4
15057         val="$define"
15058 else
15059         echo "isblank() NOT found." >&4
15060         val="$undef"
15061 fi
15062 set d_isblank
15063 eval $setvar
15064 $rm -f isblank*
15065
15066 : see if isfinite exists
15067 set isfinite d_isfinite
15068 eval $inlibc
15069
15070 : see if isinf exists
15071 set isinf d_isinf
15072 eval $inlibc
15073
15074 : see if isnan exists
15075 set isnan d_isnan
15076 eval $inlibc
15077
15078 : see if isnanl exists
15079 set isnanl d_isnanl
15080 eval $inlibc
15081
15082 : see if killpg exists
15083 set killpg d_killpg
15084 eval $inlibc
15085
15086 : see if lchown exists
15087 echo " "
15088 $cat > try.c <<'EOCP'
15089 /* System header to define __stub macros and hopefully few prototypes,
15090     which can conflict with char lchown(); below.  */
15091 #include <assert.h>
15092 /* Override any gcc2 internal prototype to avoid an error.  */
15093 /* We use char because int might match the return type of a gcc2
15094    builtin and then its argument prototype would still apply.  */
15095 char lchown();
15096 int main() {
15097     /*  The GNU C library defines this for functions which it implements
15098         to always fail with ENOSYS.  Some functions are actually named
15099         something starting with __ and the normal name is an alias.  */
15100 #if defined (__stub_lchown) || defined (__stub___lchown)
15101 choke me
15102 #else
15103 lchown();
15104 #endif
15105 ; return 0; }
15106 EOCP
15107 set try
15108 if eval $compile; then
15109     $echo "lchown() found." >&4
15110     val="$define"
15111 else
15112     $echo "lchown() NOT found." >&4
15113     val="$undef"
15114 fi
15115 set d_lchown
15116 eval $setvar
15117
15118 : See if number of significant digits in a double precision number is known
15119 echo " "
15120 $cat >ldbl_dig.c <<EOM
15121 #$i_limits I_LIMITS
15122 #$i_float I_FLOAT
15123 #ifdef I_LIMITS
15124 #include <limits.h>
15125 #endif
15126 #ifdef I_FLOAT
15127 #include <float.h>
15128 #endif
15129 #ifdef LDBL_DIG
15130 printf("Contains LDBL_DIG");
15131 #endif
15132 EOM
15133 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15134 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15135         echo "LDBL_DIG found." >&4
15136         val="$define"
15137 else
15138         echo "LDBL_DIG NOT found." >&4
15139         val="$undef"
15140 fi
15141 $rm -f ldbl_dig.?
15142 set d_ldbl_dig
15143 eval $setvar
15144
15145 : see if this is a math.h system
15146 set math.h i_math
15147 eval $inhdr
15148
15149 : check to see if math.h defines _LIB_VERSION
15150 d_libm_lib_version="$undef"
15151 case $i_math in
15152     $define)
15153         echo " "
15154         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15155         $cat >try.c <<EOCP
15156 #include <unistd.h>
15157 #include <math.h>
15158 int main (int argc, char *argv[])
15159 {
15160     printf ("%d\n", _LIB_VERSION);
15161     return (0);
15162     } /* main */
15163 EOCP
15164         set try
15165         if eval $compile; then
15166             foo=`$run ./try`
15167             echo "Yes, it does ($foo)" >&4
15168             d_libm_lib_version="$define"
15169         else
15170             echo "No, it does not (probably harmless)" >&4
15171             fi
15172         $rm_try
15173         ;;
15174
15175     esac
15176
15177 : see if link exists
15178 set link d_link
15179 eval $inlibc
15180
15181 : see if localtime_r exists
15182 set localtime_r d_localtime_r
15183 eval $inlibc
15184 case "$d_localtime_r" in
15185 "$define")
15186         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15187         case "$d_localtime_r_proto:$usethreads" in
15188         ":define")      d_localtime_r_proto=define
15189                 set d_localtime_r_proto localtime_r $hdrs
15190                 eval $hasproto ;;
15191         *)      ;;
15192         esac
15193         case "$d_localtime_r_proto" in
15194         define)
15195         case "$localtime_r_proto" in
15196         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15197         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15198         esac
15199         case "$localtime_r_proto" in
15200         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15201         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15202         esac
15203         case "$localtime_r_proto" in
15204         ''|0)   d_localtime_r=undef
15205                 localtime_r_proto=0
15206                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15207         * )     case "$localtime_r_proto" in
15208                 REENTRANT_PROTO*) ;;
15209                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15210                 esac
15211                 echo "Prototype: $try" ;;
15212         esac
15213         ;;
15214         *)      case "$usethreads" in
15215                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15216                 esac
15217                 d_localtime_r=undef
15218                 localtime_r_proto=0
15219                 ;;
15220         esac
15221         ;;
15222 *)      localtime_r_proto=0
15223         ;;
15224 esac
15225
15226 : see if localtime_r calls tzset
15227 case "$localtime_r_proto" in
15228 REENTRANT_PROTO*)
15229         $cat >try.c <<EOCP
15230 /*  Does our libc's localtime_r call tzset ?
15231  *  return 0 if so, 1 otherwise.
15232  */
15233 #$i_systypes    I_SYS_TYPES
15234 #$i_unistd      I_UNISTD
15235 #$i_time        I_TIME
15236 #$i_stdlib      I_STDLIB
15237 #$i_string      I_STRING
15238 #$i_malloc      I_MALLOC
15239 #ifdef I_SYS_TYPES
15240 #  include <sys/types.h>
15241 #endif
15242 #ifdef I_UNISTD
15243 #  include <unistd.h>
15244 #endif
15245 #ifdef I_TIME
15246 #  include <time.h>
15247 #endif
15248 #ifdef I_STDLIB
15249 #include <stdlib.h>
15250 #endif
15251 #ifdef I_STRING
15252 #  include <string.h>
15253 #else
15254 #  include <strings.h>
15255 #endif
15256 #ifdef I_MALLOC
15257 #  include <malloc.h>
15258 #endif
15259 int main()
15260 {
15261     time_t t = time(0L);
15262     char w_tz[]="TZ" "=GMT+5",
15263          e_tz[]="TZ" "=GMT-5",
15264         *tz_e = (char*)malloc(16),
15265         *tz_w = (char*)malloc(16);
15266     struct tm tm_e, tm_w;
15267     memset(&tm_e,'\0',sizeof(struct tm));
15268     memset(&tm_w,'\0',sizeof(struct tm));
15269     strcpy(tz_e,e_tz);
15270     strcpy(tz_w,w_tz);
15271
15272     putenv(tz_e);
15273     localtime_r(&t, &tm_e);
15274
15275     putenv(tz_w);
15276     localtime_r(&t, &tm_w);
15277
15278     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15279         return 1;
15280     return 0;
15281 }
15282 EOCP
15283         set try
15284         if eval $compile; then
15285             if $run ./try; then
15286                 d_localtime_r_needs_tzset=undef;
15287             else
15288                 d_localtime_r_needs_tzset=define;
15289             fi;
15290         else
15291             d_localtime_r_needs_tzset=undef;
15292         fi;
15293      ;;
15294   *)
15295      d_localtime_r_needs_tzset=undef;
15296      ;;
15297 esac
15298 $rm_try
15299
15300 : see if localeconv exists
15301 set localeconv d_locconv
15302 eval $inlibc
15303
15304 : see if lockf exists
15305 set lockf d_lockf
15306 eval $inlibc
15307
15308 : see if prototype for lseek is available
15309 echo " "
15310 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15311 eval $hasproto
15312
15313 : see if lstat exists
15314 set lstat d_lstat
15315 eval $inlibc
15316
15317 : see if madvise exists
15318 set madvise d_madvise
15319 eval $inlibc
15320
15321 : see if malloc_size exists
15322 set malloc_size d_malloc_size
15323 eval $inlibc
15324
15325 : see if malloc_size_good exists
15326 set malloc_good_size d_malloc_good_size
15327 eval $inlibc
15328
15329 : see if mblen exists
15330 set mblen d_mblen
15331 eval $inlibc
15332
15333 : see if mbstowcs exists
15334 set mbstowcs d_mbstowcs
15335 eval $inlibc
15336
15337 : see if mbtowc exists
15338 set mbtowc d_mbtowc
15339 eval $inlibc
15340
15341 : see if memchr exists
15342 set memchr d_memchr
15343 eval $inlibc
15344
15345 : see if memcmp exists
15346 set memcmp d_memcmp
15347 eval $inlibc
15348
15349 : see if memcpy exists
15350 set memcpy d_memcpy
15351 eval $inlibc
15352
15353 : see if memmove exists
15354 set memmove d_memmove
15355 eval $inlibc
15356
15357 : see if memset exists
15358 set memset d_memset
15359 eval $inlibc
15360
15361 : see if mkdir exists
15362 set mkdir d_mkdir
15363 eval $inlibc
15364
15365 : see if mkdtemp exists
15366 set mkdtemp d_mkdtemp
15367 eval $inlibc
15368
15369 : see if mkfifo exists
15370 set mkfifo d_mkfifo
15371 eval $inlibc
15372
15373 : see if mkstemp exists
15374 set mkstemp d_mkstemp
15375 eval $inlibc
15376
15377 : see if mkstemps exists
15378 set mkstemps d_mkstemps
15379 eval $inlibc
15380
15381 : see if mktime exists
15382 set mktime d_mktime
15383 eval $inlibc
15384
15385 : see if this is a sys/mman.h system
15386 set sys/mman.h i_sysmman
15387 eval $inhdr
15388
15389 : see if mmap exists
15390 set mmap d_mmap
15391 eval $inlibc
15392 : see what shmat returns
15393 : default to something harmless
15394 mmaptype='void *'
15395 case "$i_sysmman$d_mmap" in
15396 "$define$define")
15397         $cat >mmap.c <<'END'
15398 #include <sys/mman.h>
15399 void *mmap();
15400 END
15401         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15402                 mmaptype='void *'
15403         else
15404                 mmaptype='caddr_t'
15405         fi
15406         echo "and it returns ($mmaptype)." >&4
15407         ;;
15408 esac
15409
15410
15411
15412 : see if sqrtl exists
15413 set sqrtl d_sqrtl
15414 eval $inlibc
15415
15416 : see if scalbnl exists
15417 set scalbnl d_scalbnl
15418 eval $inlibc
15419
15420 : see if modfl exists
15421 set modfl d_modfl
15422 eval $inlibc
15423
15424 : see if prototype for modfl is available
15425 echo " "
15426 set d_modflproto modfl $i_math math.h
15427 eval $hasproto
15428
15429 d_modfl_pow32_bug="$undef"
15430
15431 case "$d_longdbl$d_modfl" in
15432 $define$define)
15433         $cat <<EOM
15434 Checking to see whether your modfl() is okay for large values...
15435 EOM
15436 $cat >try.c <<EOCP
15437 #include <math.h>
15438 #include <stdio.h>
15439 EOCP
15440 if $test "X$d_modflproto" != "X$define"; then
15441         $cat >>try.c <<EOCP
15442 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15443 long double modfl (long double, long double *);
15444 EOCP
15445 fi
15446 $cat >>try.c <<EOCP
15447 int main() {
15448     long double nv = 4294967303.15;
15449     long double v, w;
15450     v = modfl(nv, &w);
15451 #ifdef __GLIBC__
15452     printf("glibc");
15453 #endif
15454     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15455     return 0;
15456 }
15457 EOCP
15458         case "$osname:$gccversion" in
15459         aix:)   saveccflags="$ccflags"
15460                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15461         esac
15462         set try
15463         if eval $compile; then
15464                 foo=`$run ./try`
15465                 case "$foo" in
15466                 *" 4294967303.150000 1.150000 4294967302.000000")
15467                         echo >&4 "Your modfl() is broken for large values."
15468                         d_modfl_pow32_bug="$define"
15469                         case "$foo" in
15470                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15471                         ;;
15472                         esac
15473                         ;;
15474                 *" 4294967303.150000 0.150000 4294967303.000000")
15475                         echo >&4 "Your modfl() seems okay for large values."
15476                         ;;
15477                 *)      echo >&4 "I don't understand your modfl() at all."
15478                         d_modfl="$undef"
15479                         ;;
15480                 esac
15481                 $rm_try
15482         else
15483                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15484                 d_modfl="$undef"
15485         fi
15486         case "$osname:$gccversion" in
15487         aix:)   ccflags="$saveccflags" ;; # restore
15488         esac
15489         ;;
15490 esac
15491
15492 if $test "$uselongdouble" = "$define"; then
15493     message=""
15494     if $test "$d_sqrtl" != "$define"; then
15495         message="$message sqrtl"
15496     fi
15497     if $test "$d_modfl" != "$define"; then
15498         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15499             echo "You have both aintl and copysignl, so I can emulate modfl."
15500         else
15501             message="$message modfl"
15502         fi
15503     fi
15504     if $test "$d_frexpl" != "$define"; then
15505         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15506             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15507         else
15508             message="$message frexpl"
15509         fi
15510     fi
15511
15512     if $test "$message" != ""; then
15513         $cat <<EOM >&4
15514
15515 *** You requested the use of long doubles but you do not seem to have
15516 *** the following mathematical functions needed for long double support:
15517 ***    $message
15518 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15519 *** Cannot continue, aborting.
15520
15521 EOM
15522
15523         exit 1
15524     fi
15525 fi
15526
15527 : see if mprotect exists
15528 set mprotect d_mprotect
15529 eval $inlibc
15530
15531 : see if msgctl exists
15532 set msgctl d_msgctl
15533 eval $inlibc
15534
15535 : see if msgget exists
15536 set msgget d_msgget
15537 eval $inlibc
15538
15539 : see if msgsnd exists
15540 set msgsnd d_msgsnd
15541 eval $inlibc
15542
15543 : see if msgrcv exists
15544 set msgrcv d_msgrcv
15545 eval $inlibc
15546
15547 : see how much of the 'msg*(2)' library is present.
15548 h_msg=true
15549 echo " "
15550 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15551 *"$undef"*) h_msg=false;;
15552 esac
15553 case "$osname" in
15554 freebsd)
15555     case "`ipcs 2>&1`" in
15556     "SVID messages"*"not configured"*)
15557         echo "Your $osname does not have the msg*(2) configured." >&4
15558         h_msg=false
15559         val="$undef"
15560         set msgctl d_msgctl
15561         eval $setvar
15562         set msgget d_msgget
15563         eval $setvar
15564         set msgsnd d_msgsnd
15565         eval $setvar
15566         set msgrcv d_msgrcv
15567         eval $setvar
15568         ;;
15569     esac
15570     ;;
15571 esac
15572 : we could also check for sys/ipc.h ...
15573 if $h_msg && $test `./findhdr sys/msg.h`; then
15574         echo "You have the full msg*(2) library." >&4
15575         val="$define"
15576 else
15577         echo "You don't have the full msg*(2) library." >&4
15578         val="$undef"
15579 fi
15580 set d_msg
15581 eval $setvar
15582
15583 : Check for msghdr_s
15584 echo " "
15585 echo "Checking to see if your system supports struct msghdr..." >&4
15586 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15587 eval $hasstruct
15588 case "$d_msghdr_s" in
15589 "$define")      echo "Yes, it does."   ;;
15590 *)              echo "No, it doesn't." ;;
15591 esac
15592
15593
15594 : see if msync exists
15595 set msync d_msync
15596 eval $inlibc
15597
15598 : see if munmap exists
15599 set munmap d_munmap
15600 eval $inlibc
15601
15602 : see if nice exists
15603 set nice d_nice
15604 eval $inlibc
15605
15606 : see if this is a langinfo.h system
15607 set langinfo.h i_langinfo
15608 eval $inhdr
15609
15610 : see if nl_langinfo exists
15611 set nl_langinfo d_nl_langinfo
15612 eval $inlibc
15613
15614 : check for volatile keyword
15615 echo " "
15616 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15617 $cat >try.c <<'EOCP'
15618 int main()
15619 {
15620         typedef struct _goo_struct goo_struct;
15621         goo_struct * volatile goo = ((goo_struct *)0);
15622         struct _goo_struct {
15623                 long long_int;
15624                 int reg_int;
15625                 char char_var;
15626         };
15627         typedef unsigned short foo_t;
15628         char *volatile foo;
15629         volatile int bar;
15630         volatile foo_t blech;
15631         foo = foo;
15632 }
15633 EOCP
15634 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15635         val="$define"
15636         echo "Yup, it does."
15637 else
15638         val="$undef"
15639         echo "Nope, it doesn't."
15640 fi
15641 set d_volatile
15642 eval $setvar
15643 $rm_try
15644
15645 : Check basic sizes
15646 echo " "
15647 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15648
15649 case "$use64bitint:$d_quad:$quadtype" in
15650 define:define:?*)
15651         ivtype="$quadtype"
15652         uvtype="$uquadtype"
15653         ivsize=8
15654         uvsize=8
15655         ;;
15656 *)      ivtype="long"
15657         uvtype="unsigned long"
15658         ivsize=$longsize
15659         uvsize=$longsize
15660         ;;
15661 esac
15662
15663 case "$uselongdouble:$d_longdbl" in
15664 define:define)
15665         nvtype="long double"
15666         nvsize=$longdblsize
15667         ;;
15668 *)      nvtype=double
15669         nvsize=$doublesize
15670         ;;
15671 esac
15672
15673 $echo "(IV will be "$ivtype", $ivsize bytes)"
15674 $echo "(UV will be "$uvtype", $uvsize bytes)"
15675 $echo "(NV will be "$nvtype", $nvsize bytes)"
15676
15677 $cat >try.c <<EOCP
15678 #$i_inttypes I_INTTYPES
15679 #ifdef I_INTTYPES
15680 #include <inttypes.h>
15681 #endif
15682 #include <stdio.h>
15683 int main() {
15684 #ifdef INT8
15685    int8_t i =  INT8_MAX;
15686   uint8_t u = UINT8_MAX;
15687   printf("int8_t\n");
15688 #endif
15689 #ifdef INT16
15690    int16_t i =  INT16_MAX;
15691   uint16_t u = UINT16_MAX;
15692   printf("int16_t\n");
15693 #endif
15694 #ifdef INT32
15695    int32_t i =  INT32_MAX;
15696   uint32_t u = UINT32_MAX;
15697   printf("int32_t\n");
15698 #endif
15699 }
15700 EOCP
15701
15702 i8type="signed char"
15703 u8type="unsigned char"
15704 i8size=1
15705 u8size=1
15706
15707 case "$i16type" in
15708 '')     case "$shortsize" in
15709         2)      i16type=short
15710                 u16type="unsigned short"
15711                 i16size=$shortsize
15712                 u16size=$shortsize
15713                 ;;
15714         esac
15715         ;;
15716 esac
15717 case "$i16type" in
15718 '')     set try -DINT16
15719         if eval $compile; then
15720                 case "`$run ./try`" in
15721                 int16_t)
15722                         i16type=int16_t
15723                         u16type=uint16_t
15724                         i16size=2
15725                         u16size=2
15726                         ;;
15727                 esac
15728         fi
15729         ;;
15730 esac
15731 case "$i16type" in
15732 '')     if $test $shortsize -ge 2; then
15733                 i16type=short
15734                 u16type="unsigned short"
15735                 i16size=$shortsize
15736                 u16size=$shortsize
15737         fi
15738         ;;
15739 esac
15740
15741 case "$i32type" in
15742 '')     case "$longsize" in
15743         4)      i32type=long
15744                 u32type="unsigned long"
15745                 i32size=$longsize
15746                 u32size=$longsize
15747                 ;;
15748         *)      case "$intsize" in
15749                 4)      i32type=int
15750                         u32type="unsigned int"
15751                         i32size=$intsize
15752                         u32size=$intsize
15753                         ;;
15754                 esac
15755                 ;;
15756         esac
15757         ;;
15758 esac
15759 case "$i32type" in
15760 '')     set try -DINT32
15761         if eval $compile; then
15762                 case "`$run ./try`" in
15763                 int32_t)
15764                         i32type=int32_t
15765                         u32type=uint32_t
15766                         i32size=4
15767                         u32size=4
15768                         ;;
15769                 esac
15770         fi
15771         ;;
15772 esac
15773 case "$i32type" in
15774 '')     if $test $intsize -ge 4; then
15775                 i32type=int
15776                 u32type="unsigned int"
15777                 i32size=$intsize
15778                 u32size=$intsize
15779         fi
15780         ;;
15781 esac
15782
15783 case "$i64type" in
15784 '')     case "$d_quad:$quadtype" in
15785         define:?*)
15786                 i64type="$quadtype"
15787                 u64type="$uquadtype"
15788                 i64size=8
15789                 u64size=8
15790                 ;;
15791         esac
15792         ;;
15793 esac
15794
15795 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15796 : volatile so that the compiler has to store it out to memory.
15797 if test X"$d_volatile" = X"$define"; then
15798         volatile=volatile
15799 fi
15800 $cat <<EOP >try.c
15801 #include <stdio.h>
15802 #$i_stdlib I_STDLIB
15803 #ifdef I_STDLIB
15804 #include <stdlib.h>
15805 #endif
15806 #include <sys/types.h>
15807 #include <signal.h>
15808 #ifdef SIGFPE
15809 $volatile int bletched = 0;
15810 $signal_t blech(int s) { bletched = 1; }
15811 #endif
15812 int main() {
15813     $uvtype u = 0;
15814     $nvtype d;
15815     int     n = 8 * $uvsize;
15816     int     i;
15817 #ifdef SIGFPE
15818     signal(SIGFPE, blech);
15819 #endif
15820
15821     for (i = 0; i < n; i++) {
15822       u = u << 1 | ($uvtype)1;
15823       d = ($nvtype)u;
15824       if (($uvtype)d != u)
15825         break;
15826       if (d <= 0)
15827         break;
15828       d = ($nvtype)(u - 1);
15829       if (($uvtype)d != (u - 1))
15830         break;
15831 #ifdef SIGFPE
15832       if (bletched)
15833         break;
15834 #endif
15835     }
15836     printf("%d\n", ((i == n) ? -n : i));
15837     exit(0);
15838 }
15839 EOP
15840 set try
15841
15842 d_nv_preserves_uv="$undef"
15843 if eval $compile; then
15844         nv_preserves_uv_bits="`$run ./try`"
15845 fi
15846 case "$nv_preserves_uv_bits" in
15847 \-[1-9]*)
15848         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15849         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15850         d_nv_preserves_uv="$define"
15851         ;;
15852 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15853         d_nv_preserves_uv="$undef" ;;
15854 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15855         nv_preserves_uv_bits="0" ;;
15856 esac
15857 $rm_try
15858
15859 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15860 : volatile so that the compiler has to store it out to memory.
15861 if test X"$d_volatile" = X"$define"; then
15862         volatile=volatile
15863 fi
15864 $cat <<EOP >try.c
15865 #include <stdio.h>
15866
15867 typedef $nvtype NV;
15868
15869 int
15870 main() {
15871   NV value = 2;
15872   int count = 1;
15873
15874   while(count < 256) {
15875     $volatile NV up = value + 1.0;
15876     $volatile NV negated = -value;
15877     $volatile NV down = negated - 1.0;
15878     $volatile NV got_up = up - value;
15879     int up_good = got_up == 1.0;
15880     int got_down = down - negated;
15881     int down_good = got_down == -1.0;
15882
15883     if (down_good != up_good) {
15884       fprintf(stderr,
15885               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15886               up_good, (double) got_up, down_good, (double) got_down,
15887               count, (double) value);
15888       return 1;
15889     }
15890     if (!up_good) {
15891       while (1) {
15892         if (count > 8) {
15893           count -= 8;
15894           fputs("256.0", stdout);
15895         } else {
15896           count--;
15897           fputs("2.0", stdout);
15898         }
15899         if (!count) {
15900           puts("");
15901           return 0;
15902         }
15903         fputs("*", stdout);
15904       }
15905     }
15906     value *= 2;
15907     ++count;
15908   }
15909   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15910           count, (double) value);
15911   return 1;
15912 }
15913 EOP
15914 set try
15915
15916 nv_overflows_integers_at='0'
15917 if eval $compile; then
15918     xxx="`$run ./try`"
15919     case "$?" in
15920         0)
15921             case "$xxx" in
15922                 2*)  cat >&4 <<EOM
15923 The largest integer your NVs can preserve is equal to $xxx
15924 EOM
15925                     nv_overflows_integers_at="$xxx"
15926                     ;;
15927                 *)  cat >&4 <<EOM
15928 Cannot determine the largest integer value your NVs can hold, unexpected output
15929 '$xxx'
15930 EOM
15931                     ;;
15932             esac
15933             ;;
15934         *)  cat >&4 <<EOM
15935 Cannot determine the largest integer value your NVs can hold
15936 EOM
15937             ;;
15938     esac
15939 fi
15940 $rm_try
15941
15942 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&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 #$i_stdlib I_STDLIB
15950 #ifdef I_STDLIB
15951 #include <stdlib.h>
15952 #endif
15953 #$i_string I_STRING
15954 #ifdef I_STRING
15955 #  include <string.h>
15956 #else
15957 #  include <strings.h>
15958 #endif
15959 #include <sys/types.h>
15960 #include <signal.h>
15961 #ifdef SIGFPE
15962 $volatile int bletched = 0;
15963 $signal_t blech(int s) { bletched = 1; }
15964 #endif
15965
15966 int checkit($nvtype d, char *where) {
15967     unsigned char *p = (char *)&d;
15968     unsigned char *end = p + sizeof(d);
15969     int fail = 0;
15970
15971     while (p < end)
15972         fail += *p++;
15973
15974     if (!fail)
15975         return 0;
15976
15977     p = (char *)&d;
15978     printf("No - %s: 0x", where);
15979     while (p < end)
15980         printf ("%02X", *p++);
15981     printf("\n");
15982     return 1;
15983 }
15984
15985 int main(int argc, char **argv) {
15986     $nvtype d = 0.0;
15987     int fail = 0;
15988     fail += checkit(d, "0.0");
15989
15990     /* The compiler shouldn't be assuming that bletched is 0  */
15991     d = bletched;
15992
15993     fail += checkit(d, "bleched");
15994
15995 #ifdef SIGFPE
15996     signal(SIGFPE, blech);
15997 #endif
15998
15999     /* Paranoia - the compiler should have no way of knowing that ANSI says
16000        that argv[argc] will always be NULL.  Actually, if it did assume this it
16001        would be buggy, as this is C and main() can be called from elsewhere in
16002        the program.  */
16003     d = argv[argc] ? 1 : 0;
16004
16005     if (d) {
16006         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16007     }
16008
16009     fail += checkit(d, "ternary");
16010
16011     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16012
16013     if (d != 0.0) {
16014         printf("No - memset doesn't give 0.0\n");
16015         /* This might just blow up:  */
16016         printf("(gives %g)\n", d);
16017         return 1;
16018     }
16019
16020 #ifdef SIGFPE
16021     if (bletched) {
16022         printf("No - something bleched\n");
16023         return 1;
16024     }
16025 #endif
16026     if (fail) {
16027       printf("No - %d fail(s)\n", fail);
16028       return 1;
16029     }
16030     printf("Yes\n");
16031     return 0;
16032 }
16033 EOP
16034 set try
16035
16036 d_nv_zero_is_allbits_zero="$undef"
16037 if eval $compile; then
16038     xxx="`$run ./try`"
16039     case "$?" in
16040         0)
16041             case "$xxx" in
16042                 Yes)  cat >&4 <<EOM
16043 0.0 is represented as all bits zero in memory
16044 EOM
16045                     d_nv_zero_is_allbits_zero="$define"
16046                     ;;
16047                 *)  cat >&4 <<EOM
16048 0.0 is not represented as all bits zero in memory
16049 EOM
16050                     d_nv_zero_is_allbits_zero="$undef"
16051                     ;;
16052             esac
16053             ;;
16054         *)  cat >&4 <<EOM
16055 0.0 is not represented as all bits zero in memory
16056 EOM
16057             d_nv_zero_is_allbits_zero="$undef"
16058             ;;
16059     esac
16060 fi
16061 $rm_try
16062
16063 : check for off64_t
16064 echo " "
16065 echo "Checking to see if you have off64_t..." >&4
16066 $cat >try.c <<EOCP
16067 #include <sys/types.h>
16068 #include <unistd.h>
16069 int main() { off64_t x = 7; }
16070 EOCP
16071 set try
16072 if eval $compile; then
16073         val="$define"
16074         echo "You have off64_t."
16075 else
16076         val="$undef"
16077         echo "You do not have off64_t."
16078         case "$lseeksize" in
16079         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16080         esac
16081 fi
16082 $rm_try
16083 set d_off64_t
16084 eval $setvar
16085
16086 : how to create joinable pthreads
16087 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16088         echo " "
16089         echo "Checking what constant to use for creating joinable pthreads..." >&4
16090         $cat >try.c <<'EOCP'
16091 #include <pthread.h>
16092 int main() {
16093     int detachstate = JOINABLE;
16094 }
16095 EOCP
16096         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16097         if eval $compile; then
16098                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16099                 val="$undef" # Yes, undef.
16100                 set d_old_pthread_create_joinable
16101                 eval $setvar
16102                 val=""
16103                 set old_pthread_create_joinable
16104                 eval $setvar
16105         else
16106                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16107                 if eval $compile; then
16108                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16109                         val="$define"
16110                         set d_old_pthread_create_joinable
16111                         eval $setvar
16112                         val=PTHREAD_CREATE_UNDETACHED
16113                         set old_pthread_create_joinable
16114                         eval $setvar
16115                 else
16116                         set try -DJOINABLE=__UNDETACHED
16117                         if eval $compile; then
16118                                 echo "You seem to use __UNDETACHED." >&4
16119                                 val="$define"
16120                                 set d_old_pthread_create_joinable
16121                                 eval $setvar
16122                                 val=__UNDETACHED
16123                                 set old_pthread_create_joinable
16124                                 eval $setvar
16125                         else
16126                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16127                                 val="$define"
16128                                 set d_old_pthread_create_joinable
16129                                 eval $setvar
16130                                 val=0
16131                                 set old_pthread_create_joinable
16132                                 eval $setvar
16133                         fi
16134                 fi
16135         fi
16136         $rm_try
16137 else
16138     d_old_pthread_create_joinable="$undef"
16139     old_pthread_create_joinable=""
16140 fi
16141
16142 : see if pause exists
16143 set pause d_pause
16144 eval $inlibc
16145
16146 : see if poll exists
16147 set poll d_poll
16148 eval $inlibc
16149
16150 : see if prctl exists
16151 set prctl d_prctl
16152 eval $inlibc
16153
16154 : see if prctl supports PR_SET_NAME
16155 d_prctl_set_name=$undef
16156 case $d_prctl in
16157     $define)
16158         $cat >try.c <<EOM
16159 #include <sys/prctl.h>
16160
16161 int main (int argc, char *argv[])
16162 {
16163     return (prctl (PR_SET_NAME, "Test"));
16164     } /* main */
16165 EOM
16166         set try
16167         if eval $compile_ok && $run ./try; then
16168             echo "Your prctl (PR_SET_NAME, ...) works"
16169             d_prctl_set_name=$define
16170             fi
16171         $rm_try
16172         ;;
16173     esac
16174
16175 : see if readlink exists
16176 set readlink d_readlink
16177 eval $inlibc
16178
16179 : Check if exe is symlink to abs path of executing program
16180 echo " "
16181 procselfexe=''
16182 val="$undef"
16183 case "$d_readlink" in
16184     "$define")
16185         : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
16186         : more tidy to avoid an extra level of symlink
16187         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
16188         while test $# -gt 0; do
16189             type=$1; try=$2
16190             shift; shift
16191             if $issymlink $try; then
16192                 $ls -l $try > reflect
16193                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16194                     echo "You have $type-like $try."
16195                     procselfexe='"'$try'"'
16196                     val="$define"
16197                     : This will break out of the loop
16198                     set X; shift
16199                 fi
16200             fi
16201         done
16202         ;;
16203 esac
16204 $rm -f reflect
16205 set d_procselfexe
16206 eval $setvar
16207
16208 : backward compatibility for d_hvfork
16209 if test X$d_hvfork != X; then
16210         d_vfork="$d_hvfork"
16211         d_hvfork=''
16212 fi
16213 : see if there is a vfork
16214 val=''
16215 set vfork val
16216 eval $inlibc
16217
16218 d_pseudofork=$undef
16219
16220 : Ok, but do we want to use it. vfork is reportedly unreliable in
16221 : perl on Solaris 2.x, and probably elsewhere.
16222 case "$val" in
16223 $define)
16224         echo " "
16225         case "$usevfork" in
16226         false) dflt='n';;
16227         *) dflt='y';;
16228         esac
16229         cat <<'EOM'
16230
16231 Perl can only use a vfork() that doesn't suffer from strict
16232 restrictions on calling functions or modifying global data in
16233 the child.  For example, glibc-2.1 contains such a vfork()
16234 that is unsuitable.  If your system provides a proper fork()
16235 call, chances are that you do NOT want perl to use vfork().
16236
16237 EOM
16238         rp="Do you still want to use vfork()?"
16239         . ./myread
16240         case "$ans" in
16241         y|Y) ;;
16242         *)
16243                 echo "Ok, we won't use vfork()."
16244                 val="$undef"
16245                 ;;
16246         esac
16247         ;;
16248 esac
16249 set d_vfork
16250 eval $setvar
16251 case "$d_vfork" in
16252 $define) usevfork='true';;
16253 *) usevfork='false';;
16254 esac
16255
16256 : see whether the pthread_atfork exists
16257 $cat >try.c <<EOP
16258 #include <pthread.h>
16259 #include <stdio.h>
16260 int main() {
16261 #ifdef  PTHREAD_ATFORK
16262         pthread_atfork(NULL,NULL,NULL);
16263 #endif
16264 }
16265 EOP
16266
16267 : see if pthread_atfork exists
16268 set try -DPTHREAD_ATFORK
16269 if eval $compile; then
16270     val="$define"
16271 else
16272     val="$undef"
16273 fi
16274 case "$usethreads" in
16275 $define)
16276         case "$val" in
16277         $define) echo 'pthread_atfork found.' >&4        ;;
16278         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16279         esac
16280 esac
16281 set d_pthread_atfork
16282 eval $setvar
16283
16284 : see if pthread_attr_setscope exists
16285 set pthread_attr_setscope d_pthread_attr_setscope
16286 eval $inlibc
16287
16288 : see whether the various POSIXish _yields exist
16289 $cat >try.c <<EOP
16290 #include <pthread.h>
16291 #include <stdio.h>
16292 int main() {
16293 #ifdef SCHED_YIELD
16294         sched_yield();
16295 #else
16296 #ifdef PTHREAD_YIELD
16297         pthread_yield();
16298 #else
16299 #ifdef PTHREAD_YIELD_NULL
16300         pthread_yield(NULL);
16301 #endif
16302 #endif
16303 #endif
16304 }
16305 EOP
16306 : see if sched_yield exists
16307 set try -DSCHED_YIELD
16308 if eval $compile; then
16309     val="$define"
16310     sched_yield='sched_yield()'
16311 else
16312     val="$undef"
16313 fi
16314 case "$usethreads" in
16315 $define)
16316         case "$val" in
16317         $define) echo 'sched_yield() found.' >&4        ;;
16318         *)       echo 'sched_yield() NOT found.' >&4    ;;
16319         esac
16320 esac
16321 set d_sched_yield
16322 eval $setvar
16323
16324 : see if pthread_yield exists
16325 set try -DPTHREAD_YIELD
16326 if eval $compile; then
16327     val="$define"
16328     case "$sched_yield" in
16329     '') sched_yield='pthread_yield()' ;;
16330     esac
16331 else
16332     set try -DPTHREAD_YIELD_NULL
16333     if eval $compile; then
16334         val="$define"
16335         case "$sched_yield" in
16336         '') sched_yield='pthread_yield(NULL)' ;;
16337         esac
16338     else
16339         val="$undef"
16340     fi
16341 fi
16342 case "$usethreads" in
16343 $define)
16344         case "$val" in
16345         $define) echo 'pthread_yield() found.' >&4      ;;
16346         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16347         esac
16348         ;;
16349 esac
16350 set d_pthread_yield
16351 eval $setvar
16352 case "$sched_yield" in
16353 '') sched_yield=undef ;;
16354 esac
16355 $rm_try
16356
16357 : see if random_r exists
16358 set random_r d_random_r
16359 eval $inlibc
16360 case "$d_random_r" in
16361 "$define")
16362         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16363         case "$d_random_r_proto:$usethreads" in
16364         ":define")      d_random_r_proto=define
16365                 set d_random_r_proto random_r $hdrs
16366                 eval $hasproto ;;
16367         *)      ;;
16368         esac
16369         case "$d_random_r_proto" in
16370         define)
16371         case "$random_r_proto" in
16372         ''|0) try='int random_r(int*, struct random_data*);'
16373         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16374         esac
16375         case "$random_r_proto" in
16376         ''|0) try='int random_r(long*, struct random_data*);'
16377         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16378         esac
16379         case "$random_r_proto" in
16380         ''|0) try='int random_r(struct random_data*, int32_t*);'
16381         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16382         esac
16383         case "$random_r_proto" in
16384         ''|0)   d_random_r=undef
16385                 random_r_proto=0
16386                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16387         * )     case "$random_r_proto" in
16388                 REENTRANT_PROTO*) ;;
16389                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16390                 esac
16391                 echo "Prototype: $try" ;;
16392         esac
16393         ;;
16394         *)      case "$usethreads" in
16395                 define) echo "random_r has no prototype, not using it." >&4 ;;
16396                 esac
16397                 d_random_r=undef
16398                 random_r_proto=0
16399                 ;;
16400         esac
16401         ;;
16402 *)      random_r_proto=0
16403         ;;
16404 esac
16405
16406 : see if readdir and friends exist
16407 set readdir d_readdir
16408 eval $inlibc
16409 set seekdir d_seekdir
16410 eval $inlibc
16411 set telldir d_telldir
16412 eval $inlibc
16413 set rewinddir d_rewinddir
16414 eval $inlibc
16415
16416 : see if readdir64_r exists
16417 set readdir64_r d_readdir64_r
16418 eval $inlibc
16419 case "$d_readdir64_r" in
16420 "$define")
16421         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16422         case "$d_readdir64_r_proto:$usethreads" in
16423         ":define")      d_readdir64_r_proto=define
16424                 set d_readdir64_r_proto readdir64_r $hdrs
16425                 eval $hasproto ;;
16426         *)      ;;
16427         esac
16428         case "$d_readdir64_r_proto" in
16429         define)
16430         case "$readdir64_r_proto" in
16431         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16432         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16433         esac
16434         case "$readdir64_r_proto" in
16435         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16436         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16437         esac
16438         case "$readdir64_r_proto" in
16439         ''|0)   d_readdir64_r=undef
16440                 readdir64_r_proto=0
16441                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16442         * )     case "$readdir64_r_proto" in
16443                 REENTRANT_PROTO*) ;;
16444                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16445                 esac
16446                 echo "Prototype: $try" ;;
16447         esac
16448         ;;
16449         *)      case "$usethreads" in
16450                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16451                 esac
16452                 d_readdir64_r=undef
16453                 readdir64_r_proto=0
16454                 ;;
16455         esac
16456         ;;
16457 *)      readdir64_r_proto=0
16458         ;;
16459 esac
16460
16461 : see if readdir_r exists
16462 set readdir_r d_readdir_r
16463 eval $inlibc
16464 case "$d_readdir_r" in
16465 "$define")
16466         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16467         case "$d_readdir_r_proto:$usethreads" in
16468         ":define")      d_readdir_r_proto=define
16469                 set d_readdir_r_proto readdir_r $hdrs
16470                 eval $hasproto ;;
16471         *)      ;;
16472         esac
16473         case "$d_readdir_r_proto" in
16474         define)
16475         case "$readdir_r_proto" in
16476         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16477         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16478         esac
16479         case "$readdir_r_proto" in
16480         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16481         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16482         esac
16483         case "$readdir_r_proto" in
16484         ''|0)   d_readdir_r=undef
16485                 readdir_r_proto=0
16486                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16487         * )     case "$readdir_r_proto" in
16488                 REENTRANT_PROTO*) ;;
16489                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16490                 esac
16491                 echo "Prototype: $try" ;;
16492         esac
16493         ;;
16494         *)      case "$usethreads" in
16495                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16496                 esac
16497                 d_readdir_r=undef
16498                 readdir_r_proto=0
16499                 ;;
16500         esac
16501         ;;
16502 *)      readdir_r_proto=0
16503         ;;
16504 esac
16505
16506 : see if readv exists
16507 set readv d_readv
16508 eval $inlibc
16509
16510 : see if recvmsg exists
16511 set recvmsg d_recvmsg
16512 eval $inlibc
16513
16514 : see if rename exists
16515 set rename d_rename
16516 eval $inlibc
16517
16518 : see if rmdir exists
16519 set rmdir d_rmdir
16520 eval $inlibc
16521
16522 : see if memory.h is available.
16523 val=''
16524 set memory.h val
16525 eval $inhdr
16526
16527 : See if it conflicts with string.h
16528 case "$val" in
16529 $define)
16530         case "$strings" in
16531         '') ;;
16532         *)
16533                 $cppstdin $cppflags $cppminus < $strings > mem.h
16534                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16535                         echo " "
16536                         echo "We won't be including <memory.h>."
16537                         val="$undef"
16538                 fi
16539                 $rm -f mem.h
16540                 ;;
16541         esac
16542 esac
16543 set i_memory
16544 eval $setvar
16545
16546 : can bcopy handle overlapping blocks?
16547 echo " "
16548 val="$undef"
16549 case "$d_memmove" in
16550 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16551 *)      case "$d_bcopy" in
16552         "$define")
16553                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16554                 $cat >try.c <<EOCP
16555 #$i_memory I_MEMORY
16556 #$i_stdlib I_STDLIB
16557 #$i_string I_STRING
16558 #$i_unistd I_UNISTD
16559 EOCP
16560         $cat >>try.c <<'EOCP'
16561 #include <stdio.h>
16562 #ifdef I_MEMORY
16563 #  include <memory.h>
16564 #endif
16565 #ifdef I_STDLIB
16566 #  include <stdlib.h>
16567 #endif
16568 #ifdef I_STRING
16569 #  include <string.h>
16570 #else
16571 #  include <strings.h>
16572 #endif
16573 #ifdef I_UNISTD
16574 #  include <unistd.h>  /* Needed for NetBSD */
16575 #endif
16576 int main()
16577 {
16578 char buf[128], abc[128];
16579 char *b;
16580 int len;
16581 int off;
16582 int align;
16583
16584 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16585    try to store the string in read-only memory. */
16586 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16587
16588 for (align = 7; align >= 0; align--) {
16589         for (len = 36; len; len--) {
16590                 b = buf+align;
16591                 bcopy(abc, b, len);
16592                 for (off = 1; off <= len; off++) {
16593                         bcopy(b, b+off, len);
16594                         bcopy(b+off, b, len);
16595                         if (bcmp(b, abc, len))
16596                                 exit(1);
16597                 }
16598         }
16599 }
16600 exit(0);
16601 }
16602 EOCP
16603                 set try
16604                 if eval $compile_ok; then
16605                         if $run ./try 2>/dev/null; then
16606                                 echo "Yes, it can."
16607                                 val="$define"
16608                         else
16609                                 echo "It can't, sorry."
16610                         fi
16611                 else
16612                         echo "(I can't compile the test program, so we'll assume not...)"
16613                 fi
16614                 ;;
16615         esac
16616         $rm_try
16617         ;;
16618 esac
16619 set d_safebcpy
16620 eval $setvar
16621
16622 : can memcpy handle overlapping blocks?
16623 echo " "
16624 val="$undef"
16625 case "$d_memmove" in
16626 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16627 *)      case "$d_memcpy" in
16628         "$define")
16629                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16630                 $cat >try.c <<EOCP
16631 #$i_memory I_MEMORY
16632 #$i_stdlib I_STDLIB
16633 #$i_string I_STRING
16634 #$i_unistd I_UNISTD
16635 EOCP
16636         $cat >>try.c <<'EOCP'
16637 #include <stdio.h>
16638 #ifdef I_MEMORY
16639 #  include <memory.h>
16640 #endif
16641 #ifdef I_STDLIB
16642 #  include <stdlib.h>
16643 #endif
16644 #ifdef I_STRING
16645 #  include <string.h>
16646 #else
16647 #  include <strings.h>
16648 #endif
16649 #ifdef I_UNISTD
16650 #  include <unistd.h>  /* Needed for NetBSD */
16651 #endif
16652 int main()
16653 {
16654 char buf[128], abc[128];
16655 char *b;
16656 int len;
16657 int off;
16658 int align;
16659
16660 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16661    try to store the string in read-only memory. */
16662 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16663
16664 for (align = 7; align >= 0; align--) {
16665         for (len = 36; len; len--) {
16666                 b = buf+align;
16667                 memcpy(b, abc, len);
16668                 for (off = 1; off <= len; off++) {
16669                         memcpy(b+off, b, len);
16670                         memcpy(b, b+off, len);
16671                         if (memcmp(b, abc, len))
16672                                 exit(1);
16673                 }
16674         }
16675 }
16676 exit(0);
16677 }
16678 EOCP
16679                 set try
16680                 if eval $compile_ok; then
16681                         if $run ./try 2>/dev/null; then
16682                                 echo "Yes, it can."
16683                                 val="$define"
16684                         else
16685                                 echo "It can't, sorry."
16686                         fi
16687                 else
16688                         echo "(I can't compile the test program, so we'll assume not...)"
16689                 fi
16690                 ;;
16691         esac
16692         $rm_try
16693         ;;
16694 esac
16695 set d_safemcpy
16696 eval $setvar
16697
16698 : can memcmp be trusted to compare relative magnitude?
16699 val="$undef"
16700 case "$d_memcmp" in
16701 "$define")
16702         echo " "
16703         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16704         $cat >try.c <<EOCP
16705 #$i_memory I_MEMORY
16706 #$i_stdlib I_STDLIB
16707 #$i_string I_STRING
16708 #$i_unistd I_UNISTD
16709 EOCP
16710         $cat >>try.c <<'EOCP'
16711 #include <stdio.h>
16712 #ifdef I_MEMORY
16713 #  include <memory.h>
16714 #endif
16715 #ifdef I_STDLIB
16716 #  include <stdlib.h>
16717 #endif
16718 #ifdef I_STRING
16719 #  include <string.h>
16720 #else
16721 #  include <strings.h>
16722 #endif
16723 #ifdef I_UNISTD
16724 #  include <unistd.h>  /* Needed for NetBSD */
16725 #endif
16726 int main()
16727 {
16728 char a = -1;
16729 char b = 0;
16730 if ((a < b) && memcmp(&a, &b, 1) < 0)
16731         exit(1);
16732 exit(0);
16733 }
16734 EOCP
16735         set try
16736         if eval $compile_ok; then
16737                 if $run ./try 2>/dev/null; then
16738                         echo "Yes, it can."
16739                         val="$define"
16740                 else
16741                         echo "No, it can't (it uses signed chars)."
16742                 fi
16743         else
16744                 echo "(I can't compile the test program, so we'll assume not...)"
16745         fi
16746         ;;
16747 esac
16748 $rm_try
16749 set d_sanemcmp
16750 eval $setvar
16751
16752 : see if prototype for sbrk is available
16753 echo " "
16754 set d_sbrkproto sbrk $i_unistd unistd.h
16755 eval $hasproto
16756
16757 : see if select exists
16758 set select d_select
16759 eval $inlibc
16760
16761 : see if semctl exists
16762 set semctl d_semctl
16763 eval $inlibc
16764
16765 : see if semget exists
16766 set semget d_semget
16767 eval $inlibc
16768
16769 : see if semop exists
16770 set semop d_semop
16771 eval $inlibc
16772
16773 : see how much of the 'sem*(2)' library is present.
16774 h_sem=true
16775 echo " "
16776 case "$d_semctl$d_semget$d_semop" in
16777 *"$undef"*) h_sem=false;;
16778 esac
16779 case "$osname" in
16780 freebsd)
16781     case "`ipcs 2>&1`" in
16782     "SVID messages"*"not configured"*)
16783         echo "Your $osname does not have the sem*(2) configured." >&4
16784         h_sem=false
16785         val="$undef"
16786         set semctl d_semctl
16787         eval $setvar
16788         set semget d_semget
16789         eval $setvar
16790         set semop d_semop
16791         eval $setvar
16792         ;;
16793     esac
16794     ;;
16795 esac
16796 : we could also check for sys/ipc.h ...
16797 if $h_sem && $test `./findhdr sys/sem.h`; then
16798         echo "You have the full sem*(2) library." >&4
16799         val="$define"
16800 else
16801         echo "You don't have the full sem*(2) library." >&4
16802         val="$undef"
16803 fi
16804 set d_sem
16805 eval $setvar
16806
16807 : see whether sys/sem.h defines union semun
16808 echo " "
16809 $cat > try.c <<'END'
16810 #include <sys/types.h>
16811 #include <sys/ipc.h>
16812 #include <sys/sem.h>
16813 int main () { union semun semun; semun.buf = 0; }
16814 END
16815 set try
16816 if eval $compile; then
16817     echo "You have union semun in <sys/sem.h>." >&4
16818     val="$define"
16819 else
16820     echo "You do not have union semun in <sys/sem.h>." >&4
16821     val="$undef"
16822 fi
16823 $rm_try
16824 set d_union_semun
16825 eval $setvar
16826
16827 : see how to do semctl IPC_STAT
16828 case "$d_sem" in
16829 $define)
16830     echo " "
16831     $cat > tryh.h <<END
16832 #ifndef S_IRUSR
16833 #   ifdef S_IREAD
16834 #       define S_IRUSR S_IREAD
16835 #       define S_IWUSR S_IWRITE
16836 #       define S_IXUSR S_IEXEC
16837 #   else
16838 #       define S_IRUSR 0400
16839 #       define S_IWUSR 0200
16840 #       define S_IXUSR 0100
16841 #   endif
16842 #   define S_IRGRP (S_IRUSR>>3)
16843 #   define S_IWGRP (S_IWUSR>>3)
16844 #   define S_IXGRP (S_IXUSR>>3)
16845 #   define S_IROTH (S_IRUSR>>6)
16846 #   define S_IWOTH (S_IWUSR>>6)
16847 #   define S_IXOTH (S_IXUSR>>6)
16848 #endif
16849 #ifndef S_IRWXU
16850 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16851 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16852 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16853 #endif
16854 END
16855     : see whether semctl IPC_STAT can use union semun
16856     case "$d_semctl_semun" in
16857     '')
16858       val="$undef"
16859       $cat > try.c <<END
16860 #include <sys/types.h>
16861 #include <sys/ipc.h>
16862 #include <sys/sem.h>
16863 #include <sys/stat.h>
16864 #include <stdio.h>
16865 #include <errno.h>
16866 #include "tryh.h"
16867 #ifndef errno
16868 extern int errno;
16869 #endif
16870 #$d_union_semun HAS_UNION_SEMUN
16871 int main() {
16872     union semun
16873 #ifndef HAS_UNION_SEMUN
16874     {
16875         int val;
16876         struct semid_ds *buf;
16877         unsigned short *array;
16878     }
16879 #endif
16880     arg;
16881     int sem, st;
16882
16883 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16884     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16885     if (sem > -1) {
16886         struct semid_ds argbuf;
16887         arg.buf = &argbuf;
16888 #       ifdef IPC_STAT
16889         st = semctl(sem, 0, IPC_STAT, arg);
16890         if (st == 0)
16891             printf("semun\n");
16892         else
16893 #       endif /* IPC_STAT */
16894             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16895 #       ifdef IPC_RMID
16896         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16897 #       endif /* IPC_RMID */
16898             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16899     } else
16900 #endif /* IPC_PRIVATE && ... */
16901         printf("semget failed: errno = %d\n", errno);
16902   return 0;
16903 }
16904 END
16905       set try
16906       if eval $compile; then
16907           xxx=`$run ./try`
16908           case "$xxx" in
16909           semun) val="$define" ;;
16910           esac
16911       fi
16912       $rm_try
16913       set d_semctl_semun
16914       eval $setvar
16915       ;;
16916     esac
16917     case "$d_semctl_semun" in
16918     $define)
16919         echo "You can use union semun for semctl IPC_STAT." >&4
16920         also='also'
16921         ;;
16922     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16923         also=''
16924         ;;
16925     esac
16926
16927     : see whether semctl IPC_STAT can use struct semid_ds pointer
16928     case "$d_semctl_semid_ds" in
16929     '')
16930       val="$undef"
16931       $cat > try.c <<'END'
16932 #include <sys/types.h>
16933 #include <sys/ipc.h>
16934 #include <sys/sem.h>
16935 #include <sys/stat.h>
16936 #include "tryh.h"
16937 #include <stdio.h>
16938 #include <errno.h>
16939 #ifndef errno
16940 extern int errno;
16941 #endif
16942 int main() {
16943     struct semid_ds arg;
16944     int sem, st;
16945
16946 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16947     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16948     if (sem > -1) {
16949 #       ifdef IPC_STAT
16950         st = semctl(sem, 0, IPC_STAT, &arg);
16951         if (st == 0)
16952             printf("semid_ds\n");
16953         else
16954 #       endif /* IPC_STAT */
16955             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16956 #       ifdef IPC_RMID
16957         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16958 #       endif /* IPC_RMID */
16959             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16960     } else
16961 #endif /* IPC_PRIVATE && ... */
16962         printf("semget failed: errno = %d\n", errno);
16963
16964     return 0;
16965 }
16966 END
16967       set try
16968       if eval $compile; then
16969           xxx=`$run ./try`
16970           case "$xxx" in
16971           semid_ds) val="$define" ;;
16972           esac
16973       fi
16974       $rm_try
16975       set d_semctl_semid_ds
16976       eval $setvar
16977       ;;
16978     esac
16979     case "$d_semctl_semid_ds" in
16980     $define)
16981         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16982         ;;
16983     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16984         ;;
16985     esac
16986     ;;
16987 *)  val="$undef"
16988
16989     # We do not have the full sem*(2) library, so assume we can not
16990     # use either.
16991
16992     set d_semctl_semun
16993     eval $setvar
16994
16995     set d_semctl_semid_ds
16996     eval $setvar
16997     ;;
16998 esac
16999 $rm_try tryh.h
17000
17001 : see if sendmsg exists
17002 set sendmsg d_sendmsg
17003 eval $inlibc
17004
17005 : see if setegid exists
17006 set setegid d_setegid
17007 eval $inlibc
17008
17009 : see if seteuid exists
17010 set seteuid d_seteuid
17011 eval $inlibc
17012
17013 : see if setgrent exists
17014 set setgrent d_setgrent
17015 eval $inlibc
17016
17017 : see if setgrent_r exists
17018 set setgrent_r d_setgrent_r
17019 eval $inlibc
17020 case "$d_setgrent_r" in
17021 "$define")
17022         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17023         case "$d_setgrent_r_proto:$usethreads" in
17024         ":define")      d_setgrent_r_proto=define
17025                 set d_setgrent_r_proto setgrent_r $hdrs
17026                 eval $hasproto ;;
17027         *)      ;;
17028         esac
17029         case "$d_setgrent_r_proto" in
17030         define)
17031         case "$setgrent_r_proto" in
17032         ''|0) try='int setgrent_r(FILE**);'
17033         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17034         esac
17035         case "$setgrent_r_proto" in
17036         ''|0) try='void setgrent_r(FILE**);'
17037         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17038         esac
17039         case "$setgrent_r_proto" in
17040         ''|0)   d_setgrent_r=undef
17041                 setgrent_r_proto=0
17042                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17043         * )     case "$setgrent_r_proto" in
17044                 REENTRANT_PROTO*) ;;
17045                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17046                 esac
17047                 echo "Prototype: $try" ;;
17048         esac
17049         ;;
17050         *)      case "$usethreads" in
17051                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17052                 esac
17053                 d_setgrent_r=undef
17054                 setgrent_r_proto=0
17055                 ;;
17056         esac
17057         ;;
17058 *)      setgrent_r_proto=0
17059         ;;
17060 esac
17061
17062 : see if sethostent exists
17063 set sethostent d_sethent
17064 eval $inlibc
17065
17066 : see if sethostent_r exists
17067 set sethostent_r d_sethostent_r
17068 eval $inlibc
17069 case "$d_sethostent_r" in
17070 "$define")
17071         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17072         case "$d_sethostent_r_proto:$usethreads" in
17073         ":define")      d_sethostent_r_proto=define
17074                 set d_sethostent_r_proto sethostent_r $hdrs
17075                 eval $hasproto ;;
17076         *)      ;;
17077         esac
17078         case "$d_sethostent_r_proto" in
17079         define)
17080         case "$sethostent_r_proto" in
17081         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17082         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17083         esac
17084         case "$sethostent_r_proto" in
17085         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17086         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17087         esac
17088         case "$sethostent_r_proto" in
17089         ''|0)   d_sethostent_r=undef
17090                 sethostent_r_proto=0
17091                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17092         * )     case "$sethostent_r_proto" in
17093                 REENTRANT_PROTO*) ;;
17094                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17095                 esac
17096                 echo "Prototype: $try" ;;
17097         esac
17098         ;;
17099         *)      case "$usethreads" in
17100                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17101                 esac
17102                 d_sethostent_r=undef
17103                 sethostent_r_proto=0
17104                 ;;
17105         esac
17106         ;;
17107 *)      sethostent_r_proto=0
17108         ;;
17109 esac
17110
17111 : see if setitimer exists
17112 set setitimer d_setitimer
17113 eval $inlibc
17114
17115 : see if setlinebuf exists
17116 set setlinebuf d_setlinebuf
17117 eval $inlibc
17118
17119 : see if setlocale exists
17120 set setlocale d_setlocale
17121 eval $inlibc
17122
17123 : see if locale.h is available
17124 set locale.h i_locale
17125 eval $inhdr
17126
17127 : see if setlocale_r exists
17128 set setlocale_r d_setlocale_r
17129 eval $inlibc
17130 case "$d_setlocale_r" in
17131 "$define")
17132         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17133         case "$d_setlocale_r_proto:$usethreads" in
17134         ":define")      d_setlocale_r_proto=define
17135                 set d_setlocale_r_proto setlocale_r $hdrs
17136                 eval $hasproto ;;
17137         *)      ;;
17138         esac
17139         case "$d_setlocale_r_proto" in
17140         define)
17141         case "$setlocale_r_proto" in
17142         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17143         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17144         esac
17145         case "$setlocale_r_proto" in
17146         ''|0)   d_setlocale_r=undef
17147                 setlocale_r_proto=0
17148                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17149         * )     case "$setlocale_r_proto" in
17150                 REENTRANT_PROTO*) ;;
17151                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17152                 esac
17153                 echo "Prototype: $try" ;;
17154         esac
17155         ;;
17156         *)      case "$usethreads" in
17157                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17158                 esac
17159                 d_setlocale_r=undef
17160                 setlocale_r_proto=0
17161                 ;;
17162         esac
17163         ;;
17164 *)      setlocale_r_proto=0
17165         ;;
17166 esac
17167
17168 : see if setnetent exists
17169 set setnetent d_setnent
17170 eval $inlibc
17171
17172 : see if setnetent_r exists
17173 set setnetent_r d_setnetent_r
17174 eval $inlibc
17175 case "$d_setnetent_r" in
17176 "$define")
17177         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17178         case "$d_setnetent_r_proto:$usethreads" in
17179         ":define")      d_setnetent_r_proto=define
17180                 set d_setnetent_r_proto setnetent_r $hdrs
17181                 eval $hasproto ;;
17182         *)      ;;
17183         esac
17184         case "$d_setnetent_r_proto" in
17185         define)
17186         case "$setnetent_r_proto" in
17187         ''|0) try='int setnetent_r(int, struct netent_data*);'
17188         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17189         esac
17190         case "$setnetent_r_proto" in
17191         ''|0) try='void setnetent_r(int, struct netent_data*);'
17192         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17193         esac
17194         case "$setnetent_r_proto" in
17195         ''|0)   d_setnetent_r=undef
17196                 setnetent_r_proto=0
17197                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17198         * )     case "$setnetent_r_proto" in
17199                 REENTRANT_PROTO*) ;;
17200                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17201                 esac
17202                 echo "Prototype: $try" ;;
17203         esac
17204         ;;
17205         *)      case "$usethreads" in
17206                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17207                 esac
17208                 d_setnetent_r=undef
17209                 setnetent_r_proto=0
17210                 ;;
17211         esac
17212         ;;
17213 *)      setnetent_r_proto=0
17214         ;;
17215 esac
17216
17217 : see if setprotoent exists
17218 set setprotoent d_setpent
17219 eval $inlibc
17220
17221 : see if setpgid exists
17222 set setpgid d_setpgid
17223 eval $inlibc
17224
17225 : see if setpgrp2 exists
17226 set setpgrp2 d_setpgrp2
17227 eval $inlibc
17228
17229 : see if setpriority exists
17230 set setpriority d_setprior
17231 eval $inlibc
17232
17233 : see if setproctitle exists
17234 set setproctitle d_setproctitle
17235 eval $inlibc
17236
17237 : see if setprotoent_r exists
17238 set setprotoent_r d_setprotoent_r
17239 eval $inlibc
17240 case "$d_setprotoent_r" in
17241 "$define")
17242         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17243         case "$d_setprotoent_r_proto:$usethreads" in
17244         ":define")      d_setprotoent_r_proto=define
17245                 set d_setprotoent_r_proto setprotoent_r $hdrs
17246                 eval $hasproto ;;
17247         *)      ;;
17248         esac
17249         case "$d_setprotoent_r_proto" in
17250         define)
17251         case "$setprotoent_r_proto" in
17252         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17253         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17254         esac
17255         case "$setprotoent_r_proto" in
17256         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17257         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17258         esac
17259         case "$setprotoent_r_proto" in
17260         ''|0)   d_setprotoent_r=undef
17261                 setprotoent_r_proto=0
17262                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17263         * )     case "$setprotoent_r_proto" in
17264                 REENTRANT_PROTO*) ;;
17265                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17266                 esac
17267                 echo "Prototype: $try" ;;
17268         esac
17269         ;;
17270         *)      case "$usethreads" in
17271                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17272                 esac
17273                 d_setprotoent_r=undef
17274                 setprotoent_r_proto=0
17275                 ;;
17276         esac
17277         ;;
17278 *)      setprotoent_r_proto=0
17279         ;;
17280 esac
17281
17282 : see if setpwent exists
17283 set setpwent d_setpwent
17284 eval $inlibc
17285
17286 : see if setpwent_r exists
17287 set setpwent_r d_setpwent_r
17288 eval $inlibc
17289 case "$d_setpwent_r" in
17290 "$define")
17291         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17292         case "$d_setpwent_r_proto:$usethreads" in
17293         ":define")      d_setpwent_r_proto=define
17294                 set d_setpwent_r_proto setpwent_r $hdrs
17295                 eval $hasproto ;;
17296         *)      ;;
17297         esac
17298         case "$d_setpwent_r_proto" in
17299         define)
17300         case "$setpwent_r_proto" in
17301         ''|0) try='int setpwent_r(FILE**);'
17302         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17303         esac
17304         case "$setpwent_r_proto" in
17305         ''|0) try='void setpwent_r(FILE**);'
17306         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17307         esac
17308         case "$setpwent_r_proto" in
17309         ''|0)   d_setpwent_r=undef
17310                 setpwent_r_proto=0
17311                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17312         * )     case "$setpwent_r_proto" in
17313                 REENTRANT_PROTO*) ;;
17314                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17315                 esac
17316                 echo "Prototype: $try" ;;
17317         esac
17318         ;;
17319         *)      case "$usethreads" in
17320                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17321                 esac
17322                 d_setpwent_r=undef
17323                 setpwent_r_proto=0
17324                 ;;
17325         esac
17326         ;;
17327 *)      setpwent_r_proto=0
17328         ;;
17329 esac
17330
17331 : see if setregid exists
17332 set setregid d_setregid
17333 eval $inlibc
17334 set setresgid d_setresgid
17335 eval $inlibc
17336
17337 : see if setreuid exists
17338 set setreuid d_setreuid
17339 eval $inlibc
17340 set setresuid d_setresuid
17341 eval $inlibc
17342
17343 : see if setrgid exists
17344 set setrgid d_setrgid
17345 eval $inlibc
17346
17347 : see if setruid exists
17348 set setruid d_setruid
17349 eval $inlibc
17350
17351 : see if setservent exists
17352 set setservent d_setsent
17353 eval $inlibc
17354
17355 : see if setservent_r exists
17356 set setservent_r d_setservent_r
17357 eval $inlibc
17358 case "$d_setservent_r" in
17359 "$define")
17360         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17361         case "$d_setservent_r_proto:$usethreads" in
17362         ":define")      d_setservent_r_proto=define
17363                 set d_setservent_r_proto setservent_r $hdrs
17364                 eval $hasproto ;;
17365         *)      ;;
17366         esac
17367         case "$d_setservent_r_proto" in
17368         define)
17369         case "$setservent_r_proto" in
17370         ''|0) try='int setservent_r(int, struct servent_data*);'
17371         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17372         esac
17373         case "$setservent_r_proto" in
17374         ''|0) try='void setservent_r(int, struct servent_data*);'
17375         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17376         esac
17377         case "$setservent_r_proto" in
17378         ''|0)   d_setservent_r=undef
17379                 setservent_r_proto=0
17380                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17381         * )     case "$setservent_r_proto" in
17382                 REENTRANT_PROTO*) ;;
17383                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17384                 esac
17385                 echo "Prototype: $try" ;;
17386         esac
17387         ;;
17388         *)      case "$usethreads" in
17389                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17390                 esac
17391                 d_setservent_r=undef
17392                 setservent_r_proto=0
17393                 ;;
17394         esac
17395         ;;
17396 *)      setservent_r_proto=0
17397         ;;
17398 esac
17399
17400 : see if setsid exists
17401 set setsid d_setsid
17402 eval $inlibc
17403
17404 : see if setvbuf exists
17405 set setvbuf d_setvbuf
17406 eval $inlibc
17407
17408
17409
17410 : see if shmctl exists
17411 set shmctl d_shmctl
17412 eval $inlibc
17413
17414 : see if shmget exists
17415 set shmget d_shmget
17416 eval $inlibc
17417
17418 : see if shmat exists
17419 set shmat d_shmat
17420 eval $inlibc
17421 : see what shmat returns
17422 case "$d_shmat" in
17423 "$define")
17424         $cat >shmat.c <<'END'
17425 #include <sys/shm.h>
17426 void *shmat();
17427 END
17428         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17429                 shmattype='void *'
17430         else
17431                 shmattype='char *'
17432         fi
17433         echo "and it returns ($shmattype)." >&4
17434         : see if a prototype for shmat is available
17435         xxx=`./findhdr sys/shm.h`
17436         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17437         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17438                 val="$define"
17439         else
17440                 val="$undef"
17441         fi
17442         $rm -f shmat.[co]
17443         ;;
17444 *)
17445         val="$undef"
17446         ;;
17447 esac
17448 set d_shmatprototype
17449 eval $setvar
17450
17451 : see if shmdt exists
17452 set shmdt d_shmdt
17453 eval $inlibc
17454
17455 : see how much of the 'shm*(2)' library is present.
17456 h_shm=true
17457 echo " "
17458 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17459 *"$undef"*) h_shm=false;;
17460 esac
17461 case "$osname" in
17462 freebsd)
17463     case "`ipcs 2>&1`" in
17464     "SVID shared memory"*"not configured"*)
17465         echo "Your $osname does not have the shm*(2) configured." >&4
17466         h_shm=false
17467         val="$undef"
17468         set shmctl d_shmctl
17469         evat $setvar
17470         set shmget d_shmget
17471         evat $setvar
17472         set shmat d_shmat
17473         evat $setvar
17474         set shmdt d_shmdt
17475         evat $setvar
17476         ;;
17477     esac
17478     ;;
17479 esac
17480 : we could also check for sys/ipc.h ...
17481 if $h_shm && $test `./findhdr sys/shm.h`; then
17482         echo "You have the full shm*(2) library." >&4
17483         val="$define"
17484 else
17485         echo "You don't have the full shm*(2) library." >&4
17486         val="$undef"
17487 fi
17488 set d_shm
17489 eval $setvar
17490
17491 : see if we have sigaction
17492 echo " "
17493 if set sigaction val -f d_sigaction; eval $csym; $val; then
17494         echo 'sigaction() found.' >&4
17495         $cat > try.c <<EOP
17496 #include <stdio.h>
17497 #include <sys/types.h>
17498 #include <signal.h>
17499 #$i_stdlib I_STDLIB
17500 #ifdef I_STDLIB
17501 #include <stdlib.h>
17502 #endif
17503 int main()
17504 {
17505     struct sigaction act, oact;
17506     act.sa_flags = 0;
17507     oact.sa_handler = 0;
17508     /* so that act and oact are used */
17509     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17510 }
17511 EOP
17512         set try
17513         if eval $compile_ok; then
17514                 val="$define"
17515         else
17516                 echo "But you don't seem to have a usable struct sigaction." >&4
17517                 val="$undef"
17518         fi
17519 else
17520         echo 'sigaction NOT found.' >&4
17521         val="$undef"
17522 fi
17523 set d_sigaction; eval $setvar
17524 $rm_try
17525
17526 : see if this is a sunmath.h system
17527 set sunmath.h i_sunmath
17528 eval $inhdr
17529
17530 : see if signbit exists
17531 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17532 $cat >try.c <<EOCP
17533 #$i_math I_MATH
17534 #$i_sunmath I_SUNMATH
17535 #ifdef I_MATH
17536 #  include <math.h>
17537 #endif
17538 #ifdef I_SUNMATH  /* Solaris special math library */
17539 #  include <sunmath.h>
17540 #endif
17541 #define NV $nvtype
17542 int main(int argc, char **argv)
17543 {
17544     NV x = 0.0;
17545     NV y = -0.0;
17546     if ((signbit(x) == 0) && (signbit(y) != 0))
17547         return 0;
17548     else
17549         return 1;
17550 }
17551 EOCP
17552 val="$undef"
17553 set try
17554 if eval $compile; then
17555     if $run ./try; then
17556         $echo "Yes." >&4
17557         val="$define"
17558     else
17559         $echo "Signbit seems to be available, but doesn't work as I expected."
17560         $echo "I won't use it." >&4
17561         val="$undef"
17562     fi
17563 else
17564     $echo "Nope." >&4
17565     dflt="$undef"
17566 fi
17567 set d_signbit
17568 eval $setvar
17569 $rm_try
17570
17571 : see if sigprocmask exists
17572 set sigprocmask d_sigprocmask
17573 eval $inlibc
17574
17575 : see if sigsetjmp exists
17576 echo " "
17577 case "$d_sigsetjmp" in
17578 '')
17579         $cat >try.c <<EOP
17580 #include <setjmp.h>
17581 #$i_stdlib I_STDLIB
17582 #ifdef I_STDLIB
17583 #include <stdlib.h>
17584 #endif
17585 sigjmp_buf env;
17586 int set = 1;
17587 int main()
17588 {
17589         if (sigsetjmp(env,1))
17590                 exit(set);
17591         set = 0;
17592         siglongjmp(env, 1);
17593         exit(1);
17594 }
17595 EOP
17596         set try
17597         if eval $compile; then
17598                 if $run ./try >/dev/null 2>&1; then
17599                         echo "POSIX sigsetjmp found." >&4
17600                         val="$define"
17601                 else
17602                         $cat >&4 <<EOM
17603 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17604 I'll ignore them.
17605 EOM
17606                         val="$undef"
17607                 fi
17608         else
17609                 echo "sigsetjmp not found." >&4
17610                 val="$undef"
17611         fi
17612         ;;
17613 *) val="$d_sigsetjmp"
17614         case "$d_sigsetjmp" in
17615         $define) echo "POSIX sigsetjmp found." >&4;;
17616         $undef) echo "sigsetjmp not found." >&4;;
17617         esac
17618         ;;
17619 esac
17620 set d_sigsetjmp
17621 eval $setvar
17622 $rm_try
17623
17624 : see if snprintf exists
17625 set snprintf d_snprintf
17626 eval $inlibc
17627
17628 : see if vsnprintf exists
17629 set vsnprintf d_vsnprintf
17630 eval $inlibc
17631
17632 case "$d_snprintf-$d_vsnprintf" in
17633 "$define-$define")
17634     $cat <<EOM
17635 Checking whether your snprintf() and vsnprintf() work okay...
17636 EOM
17637     $cat >try.c <<'EOCP'
17638 /* v?snprintf testing logic courtesy of Russ Allbery.
17639  * According to C99:
17640  * - if the buffer is too short it still must be \0-terminated
17641  * - if the buffer is too short the potentially required length
17642  *   must be returned and not -1
17643  * - if the buffer is NULL the potentially required length
17644  *   must be returned and not -1 or core dump
17645  */
17646 #include <stdio.h>
17647 #include <stdarg.h>
17648
17649 char buf[2];
17650
17651 int test (char *format, ...)
17652 {
17653     va_list args;
17654     int count;
17655
17656     va_start (args, format);
17657     count = vsnprintf (buf, sizeof buf, format, args);
17658     va_end (args);
17659     return count;
17660 }
17661
17662 int main ()
17663 {
17664     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17665              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17666 }
17667 EOCP
17668     set try
17669     if eval $compile; then
17670         `$run ./try`
17671         case "$?" in
17672         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17673         *) cat <<EOM >&4
17674 Your snprintf() and snprintf() don't seem to be working okay.
17675 EOM
17676            d_snprintf="$undef"
17677            d_vsnprintf="$undef"
17678            ;;
17679         esac
17680     else
17681         echo "(I can't seem to compile the test program--assuming they don't)"
17682         d_snprintf="$undef"
17683         d_vsnprintf="$undef"
17684     fi
17685     $rm_try
17686     ;;
17687 esac
17688
17689 : see if sockatmark exists
17690 set sockatmark d_sockatmark
17691 eval $inlibc
17692
17693 : see if prototype for sockatmark is available
17694 echo " "
17695 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17696 eval $hasproto
17697
17698 : see if socks5_init exists
17699 set socks5_init d_socks5_init
17700 eval $inlibc
17701
17702 : see if sprintf returns the length of the string in the buffer as per ANSI
17703 $echo "Checking whether sprintf returns the length of the string..." >&4
17704 $cat <<EOP >try.c
17705 #include <stdio.h>
17706 #$i_stdlib I_STDLIB
17707 #ifdef I_STDLIB
17708 #include <stdlib.h>
17709 #endif
17710 #$i_string I_STRING
17711 #ifdef I_STRING
17712 #  include <string.h>
17713 #else
17714 #  include <strings.h>
17715 #endif
17716 #$i_math I_MATH
17717 #ifdef I_MATH
17718 #include <math.h>
17719 #endif
17720
17721 char buffer[256];
17722
17723 int check (size_t expect, int test) {
17724   size_t got = strlen(buffer);
17725   if (expect == got)
17726     return 0;
17727
17728   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17729        test, buffer);
17730   exit (test);
17731 }
17732
17733 int main(int argc, char **argv) {
17734   int test = 0;
17735
17736   check(sprintf(buffer, ""), ++test);
17737   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17738   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17739
17740   return 0;
17741 }
17742 EOP
17743 set try
17744
17745 if eval $compile; then
17746     xxx="`$run ./try`"
17747     case "$?" in
17748         0) cat >&4 <<EOM
17749 sprintf returns the length of the string (as ANSI says it should)
17750 EOM
17751         d_sprintf_returns_strlen="$define"
17752         ;;
17753         *) cat >&4 <<EOM
17754 sprintf does not return the length of the string (how old is this system?)
17755 EOM
17756         d_sprintf_returns_strlen="$undef"
17757         ;;
17758     esac
17759 else
17760     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17761     d_sprintf_returns_strlen="$undef"
17762 fi
17763 $rm_try
17764
17765 : see if srand48_r exists
17766 set srand48_r d_srand48_r
17767 eval $inlibc
17768 case "$d_srand48_r" in
17769 "$define")
17770         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17771         case "$d_srand48_r_proto:$usethreads" in
17772         ":define")      d_srand48_r_proto=define
17773                 set d_srand48_r_proto srand48_r $hdrs
17774                 eval $hasproto ;;
17775         *)      ;;
17776         esac
17777         case "$d_srand48_r_proto" in
17778         define)
17779         case "$srand48_r_proto" in
17780         ''|0) try='int srand48_r(long, struct drand48_data*);'
17781         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17782         esac
17783         case "$srand48_r_proto" in
17784         ''|0)   d_srand48_r=undef
17785                 srand48_r_proto=0
17786                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17787         * )     case "$srand48_r_proto" in
17788                 REENTRANT_PROTO*) ;;
17789                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17790                 esac
17791                 echo "Prototype: $try" ;;
17792         esac
17793         ;;
17794         *)      case "$usethreads" in
17795                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17796                 esac
17797                 d_srand48_r=undef
17798                 srand48_r_proto=0
17799                 ;;
17800         esac
17801         ;;
17802 *)      srand48_r_proto=0
17803         ;;
17804 esac
17805
17806 : see if srandom_r exists
17807 set srandom_r d_srandom_r
17808 eval $inlibc
17809 case "$d_srandom_r" in
17810 "$define")
17811         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17812         case "$d_srandom_r_proto:$usethreads" in
17813         ":define")      d_srandom_r_proto=define
17814                 set d_srandom_r_proto srandom_r $hdrs
17815                 eval $hasproto ;;
17816         *)      ;;
17817         esac
17818         case "$d_srandom_r_proto" in
17819         define)
17820         case "$srandom_r_proto" in
17821         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17822         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17823         esac
17824         case "$srandom_r_proto" in
17825         ''|0)   d_srandom_r=undef
17826                 srandom_r_proto=0
17827                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17828         * )     case "$srandom_r_proto" in
17829                 REENTRANT_PROTO*) ;;
17830                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17831                 esac
17832                 echo "Prototype: $try" ;;
17833         esac
17834         ;;
17835         *)      case "$usethreads" in
17836                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17837                 esac
17838                 d_srandom_r=undef
17839                 srandom_r_proto=0
17840                 ;;
17841         esac
17842         ;;
17843 *)      srandom_r_proto=0
17844         ;;
17845 esac
17846
17847 : see if prototype for setresgid is available
17848 echo " "
17849 set d_sresgproto setresgid $i_unistd unistd.h
17850 eval $hasproto
17851
17852 : see if prototype for setresuid is available
17853 echo " "
17854 set d_sresuproto setresuid $i_unistd unistd.h
17855 eval $hasproto
17856
17857 : see if sys/stat.h is available
17858 set sys/stat.h i_sysstat
17859 eval $inhdr
17860
17861 : see if stat knows about block sizes
17862 echo " "
17863 echo "Checking to see if your struct stat has st_blocks field..." >&4
17864 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17865 eval $hasfield
17866
17867 : see if this is a sys/vfs.h system
17868 set sys/vfs.h i_sysvfs
17869 eval $inhdr
17870
17871 : see if this is a sys/statfs.h system
17872 set sys/statfs.h i_sysstatfs
17873 eval $inhdr
17874
17875 : Check for statfs_s
17876 echo " "
17877 echo "Checking to see if your system supports struct statfs..." >&4
17878 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
17879 eval $hasstruct
17880 case "$d_statfs_s" in
17881 "$define")      echo "Yes, it does."   ;;
17882 *)              echo "No, it doesn't." ;;
17883 esac
17884
17885
17886 : see if struct statfs knows about f_flags
17887 case "$d_statfs_s" in
17888 define)
17889         echo " "
17890         echo "Checking to see if your struct statfs has f_flags field..." >&4
17891         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
17892         eval $hasfield
17893         ;;
17894 *)      val="$undef"
17895         set d_statfs_f_flags
17896         eval $setvar
17897         ;;
17898 esac
17899 case "$d_statfs_f_flags" in
17900 "$define")      echo "Yes, it does."   ;;
17901 *)              echo "No, it doesn't." ;;
17902 esac
17903
17904 : see what flavor, if any, of static inline is supported
17905 echo " "
17906 echo "Checking to see if your system supports static inline..."
17907 $cat > try.c <<'EOCP'
17908 #include <stdlib.h>
17909 extern int f_via_a(int x);
17910 extern int f_via_b(int x);
17911 int main(int argc, char **argv)
17912 {
17913     int y;
17914
17915     y = f_via_a(0);
17916 #ifdef USE_B
17917     y = f_via_b(0);
17918 #endif
17919     if (y == 42) {
17920         return EXIT_SUCCESS;
17921     }
17922     else {
17923         return EXIT_FAILURE;
17924     }
17925 }
17926 EOCP
17927 $cat > a.c <<'EOCP'
17928 static INLINE int f(int x) {
17929     int y;
17930     y = x + 42;
17931     return y;
17932 }
17933
17934 int f_via_a(int x)
17935 {
17936     return f(x);
17937 }
17938 EOCP
17939 $cat > b.c <<'EOCP'
17940 extern int f(int x);
17941
17942 int f_via_b(int x)
17943 {
17944     return f(x);
17945 }
17946 EOCP
17947
17948 # Respect a hint (or previous) value for perl_static_inline, if there is one.
17949 case "$perl_static_inline" in
17950 '')     # Check the various possibilities, and break out on success.
17951         # For gcc, prefer __inline__, which will still permit
17952         # cflags.SH to add in -ansi.
17953         case "$gccversion" in
17954                 '') xxx="inline __inline__ __inline _inline";;
17955                 *)  xxx="__inline__ inline __inline _inline";;
17956         esac
17957         for inline in $xxx; do
17958                 set try -DINLINE=$inline a.c
17959                 if eval $compile && $run ./try; then
17960                         # Now make sure there is no external linkage of static
17961                         # functions
17962                         set try -DINLINE=$inline -DUSE_B a.c b.c
17963                         if eval $compile && $run ./try; then
17964                                 $echo "Your compiler supports static $inline, " >&4
17965                                 $echo "but it also creates an external definition," >&4
17966                                 $echo "so I won't use it." >&4
17967                                 val=$undef
17968                         else
17969                                 $echo "Your compiler supports static $inline." >&4
17970                                 val=$define
17971                                 perl_static_inline="static $inline";
17972                                 break;
17973                         fi
17974                 else
17975                         $echo "Your compiler does NOT support static $inline." >&4
17976                         val="$undef"
17977                 fi
17978         done
17979         ;;
17980 *inline*) # Some variant of inline exists.
17981         echo "Keeping your $hint value of $perl_static_inline."
17982         val=$define
17983         ;;
17984 static)  # No inline capabilities
17985         echo "Keeping your $hint value of $perl_static_inline."
17986         val=$undef
17987         ;;
17988 *)  # Unrecognized previous value -- blindly trust the supplied
17989         # value and hope it makes sense.  Use old value for
17990         # d_static_inline, if there is one.
17991         echo "Keeping your $hint value of $perl_static_inline."
17992         case "$d_static_inline" in
17993                 '') val=$define ;;
17994                 *)  val=$d_static_inline ;;
17995         esac
17996         ;;
17997 esac
17998 # Fallback to plain 'static' if nothing worked.
17999 case "$perl_static_inline" in
18000 '')
18001         perl_static_inline="static"
18002         val=$undef
18003         ;;
18004 esac
18005 set d_static_inline
18006 eval $setvar
18007 $rm -f a.[co] b.[co]
18008 $rm_try
18009
18010 : Check stream access
18011 $cat >&4 <<EOM
18012 Checking how to access stdio streams by file descriptor number...
18013 EOM
18014 case "$stdio_stream_array" in
18015 '')     $cat >try.c <<EOCP
18016 #include <stdio.h>
18017 int main() {
18018   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18019     printf("yes\n");
18020 }
18021 EOCP
18022         for s in _iob __iob __sF
18023         do
18024                 set try -DSTDIO_STREAM_ARRAY=$s
18025                 if eval $compile; then
18026                         case "`$run ./try`" in
18027                         yes)    stdio_stream_array=$s; break ;;
18028                         esac
18029                 fi
18030         done
18031         $rm_try
18032 esac
18033 case "$stdio_stream_array" in
18034 '')     $cat >&4 <<EOM
18035 I can't figure out how to access stdio streams by file descriptor number.
18036 EOM
18037         d_stdio_stream_array="$undef"
18038         ;;
18039 *)      $cat >&4 <<EOM
18040 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18041 EOM
18042         d_stdio_stream_array="$define"
18043         ;;
18044 esac
18045
18046 : see if strcoll exists
18047 set strcoll d_strcoll
18048 eval $inlibc
18049
18050 : check for structure copying
18051 echo " "
18052 echo "Checking to see if your C compiler can copy structs..." >&4
18053 $cat >try.c <<'EOCP'
18054 int main()
18055 {
18056         struct blurfl {
18057                 int dyick;
18058         } foo, bar;
18059
18060         foo = bar;
18061 }
18062 EOCP
18063 if $cc -c try.c >/dev/null 2>&1 ; then
18064         val="$define"
18065         echo "Yup, it can."
18066 else
18067         val="$undef"
18068         echo "Nope, it can't."
18069 fi
18070 set d_strctcpy
18071 eval $setvar
18072 $rm_try
18073
18074 : see if strerror and/or sys_errlist[] exist
18075 echo " "
18076 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18077     if set strerror val -f d_strerror; eval $csym; $val; then
18078                 echo 'strerror() found.' >&4
18079                 d_strerror="$define"
18080                 d_strerrm='strerror(e)'
18081                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18082                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
18083                         d_syserrlst="$define"
18084                 else
18085                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
18086                         d_syserrlst="$undef"
18087                 fi
18088     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18089                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18090                 echo 'strerror() found in string header.' >&4
18091                 d_strerror="$define"
18092                 d_strerrm='strerror(e)'
18093                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18094                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18095                                 d_syserrlst="$define"
18096                 else
18097                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
18098                         d_syserrlst="$undef"
18099                 fi
18100     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18101                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18102                 d_strerror="$undef"
18103                 d_syserrlst="$define"
18104                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18105     else
18106                 echo 'strerror() and sys_errlist[] NOT found.' >&4
18107                 d_strerror="$undef"
18108                 d_syserrlst="$undef"
18109                 d_strerrm='"unknown"'
18110     fi
18111 fi
18112
18113 : see if strerror_r exists
18114 set strerror_r d_strerror_r
18115 eval $inlibc
18116 case "$d_strerror_r" in
18117 "$define")
18118         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18119         case "$d_strerror_r_proto:$usethreads" in
18120         ":define")      d_strerror_r_proto=define
18121                 set d_strerror_r_proto strerror_r $hdrs
18122                 eval $hasproto ;;
18123         *)      ;;
18124         esac
18125         case "$d_strerror_r_proto" in
18126         define)
18127         case "$strerror_r_proto" in
18128         ''|0) try='int strerror_r(int, char*, size_t);'
18129         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18130         esac
18131         case "$strerror_r_proto" in
18132         ''|0) try='int strerror_r(int, char*, int);'
18133         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18134         esac
18135         case "$strerror_r_proto" in
18136         ''|0) try='char* strerror_r(int, char*, size_t);'
18137         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18138         esac
18139         case "$strerror_r_proto" in
18140         ''|0)   d_strerror_r=undef
18141                 strerror_r_proto=0
18142                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18143         * )     case "$strerror_r_proto" in
18144                 REENTRANT_PROTO*) ;;
18145                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18146                 esac
18147                 echo "Prototype: $try" ;;
18148         esac
18149         ;;
18150         *)      case "$usethreads" in
18151                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18152                 esac
18153                 d_strerror_r=undef
18154                 strerror_r_proto=0
18155                 ;;
18156         esac
18157         ;;
18158 *)      strerror_r_proto=0
18159         ;;
18160 esac
18161
18162 : see if strftime exists
18163 set strftime d_strftime
18164 eval $inlibc
18165
18166 : see if strlcat exists
18167 set strlcat d_strlcat
18168 eval $inlibc
18169
18170 : see if strlcpy exists
18171 set strlcpy d_strlcpy
18172 eval $inlibc
18173
18174 : see if strtod exists
18175 set strtod d_strtod
18176 eval $inlibc
18177
18178 : see if strtol exists
18179 set strtol d_strtol
18180 eval $inlibc
18181
18182 : see if strtold exists
18183 set strtold d_strtold
18184 eval $inlibc
18185
18186 : see if strtoll exists
18187 set strtoll d_strtoll
18188 eval $inlibc
18189
18190 case "$d_longlong-$d_strtoll" in
18191 "$define-$define")
18192         $cat <<EOM
18193 Checking whether your strtoll() works okay...
18194 EOM
18195         $cat >try.c <<'EOCP'
18196 #include <errno.h>
18197 #ifdef __hpux
18198 #define strtoll __strtoll
18199 #endif
18200 #ifdef __EMX__
18201 #define strtoll _strtoll
18202 #endif
18203 #include <stdio.h>
18204 extern long long int strtoll(char *s, char **, int);
18205 static int bad = 0;
18206 int check(char *s, long long ell, int een) {
18207         long long gll;
18208         errno = 0;
18209         gll = strtoll(s, 0, 10);
18210         if (!((gll == ell) && (errno == een)))
18211                 bad++;
18212 }
18213 int main() {
18214         check(" 1",                                      1LL, 0);
18215         check(" 0",                                      0LL, 0);
18216         check("-1",                                     -1LL, 0);
18217         check("-9223372036854775808", -9223372036854775808LL, 0);
18218         check("-9223372036854775808", -9223372036854775808LL, 0);
18219         check(" 9223372036854775807",  9223372036854775807LL, 0);
18220         check("-9223372036854775808", -9223372036854775808LL, 0);
18221         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18222         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18223         if (!bad)
18224                 printf("ok\n");
18225 }
18226 EOCP
18227         set try
18228         if eval $compile; then
18229                 yyy=`$run ./try`
18230                 case "$yyy" in
18231                 ok) echo "Your strtoll() seems to be working okay." ;;
18232                 *) cat <<EOM >&4
18233 Your strtoll() doesn't seem to be working okay.
18234 EOM
18235                    d_strtoll="$undef"
18236                    ;;
18237                 esac
18238         else
18239                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18240                 d_strtoll="$undef"
18241         fi
18242         ;;
18243 esac
18244
18245 : see if strtoq exists
18246 set strtoq d_strtoq
18247 eval $inlibc
18248
18249 : see if strtoul exists
18250 set strtoul d_strtoul
18251 eval $inlibc
18252
18253 case "$d_strtoul" in
18254 "$define")
18255         $cat <<EOM
18256 Checking whether your strtoul() works okay...
18257 EOM
18258         $cat >try.c <<'EOCP'
18259 #include <errno.h>
18260 #include <stdio.h>
18261 extern unsigned long int strtoul(char *s, char **, int);
18262 static int bad = 0;
18263 void check(char *s, unsigned long eul, int een) {
18264         unsigned long gul;
18265         errno = 0;
18266         gul = strtoul(s, 0, 10);
18267         if (!((gul == eul) && (errno == een)))
18268                 bad++;
18269 }
18270 int main() {
18271         check(" 1", 1L, 0);
18272         check(" 0", 0L, 0);
18273 EOCP
18274         case "$longsize" in
18275         8)
18276             $cat >>try.c <<'EOCP'
18277         check("18446744073709551615", 18446744073709551615UL, 0);
18278         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18279 #if 0 /* strtoul() for /^-/ strings is undefined. */
18280         check("-1", 18446744073709551615UL, 0);
18281         check("-18446744073709551614", 2, 0);
18282         check("-18446744073709551615", 1, 0);
18283         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18284         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18285 #endif
18286 EOCP
18287                 ;;
18288         4)
18289                     $cat >>try.c <<'EOCP'
18290         check("4294967295", 4294967295UL, 0);
18291         check("4294967296", 4294967295UL, ERANGE);
18292 #if 0 /* strtoul() for /^-/ strings is undefined. */
18293         check("-1", 4294967295UL, 0);
18294         check("-4294967294", 2, 0);
18295         check("-4294967295", 1, 0);
18296         check("-4294967296", 4294967295UL, ERANGE);
18297         check("-4294967297", 4294967295UL, ERANGE);
18298 #endif
18299 EOCP
18300                 ;;
18301         *)
18302 : Should we write these tests to be more portable by sprintf-ing
18303 : ~0 and then manipulating that char string as input for strtol?
18304                 ;;
18305         esac
18306         $cat >>try.c <<'EOCP'
18307         if (!bad)
18308                 printf("ok\n");
18309         return 0;
18310 }
18311 EOCP
18312         set try
18313         if eval $compile; then
18314                 case "`$run ./try`" in
18315                 ok) echo "Your strtoul() seems to be working okay." ;;
18316                 *) cat <<EOM >&4
18317 Your strtoul() doesn't seem to be working okay.
18318 EOM
18319                    d_strtoul="$undef"
18320                    ;;
18321                 esac
18322         else
18323                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18324                 d_strtoul="$undef"
18325         fi
18326         ;;
18327 esac
18328
18329 : see if strtoull exists
18330 set strtoull d_strtoull
18331 eval $inlibc
18332
18333 case "$d_longlong-$d_strtoull" in
18334 "$define-$define")
18335         $cat <<EOM
18336 Checking whether your strtoull() works okay...
18337 EOM
18338         $cat >try.c <<'EOCP'
18339 #include <errno.h>
18340 #ifdef __hpux
18341 #define strtoull __strtoull
18342 #endif
18343 #include <stdio.h>
18344 extern unsigned long long int strtoull(char *s, char **, int);
18345 static int bad = 0;
18346 int check(char *s, long long eull, int een) {
18347         long long gull;
18348         errno = 0;
18349         gull = strtoull(s, 0, 10);
18350         if (!((gull == eull) && (errno == een)))
18351                 bad++;
18352 }
18353 int main() {
18354         check(" 1",                                        1LL, 0);
18355         check(" 0",                                        0LL, 0);
18356         check("18446744073709551615",  18446744073709551615ULL, 0);
18357         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18358 #if 0 /* strtoull() for /^-/ strings is undefined. */
18359         check("-1",                    18446744073709551615ULL, 0);
18360         check("-18446744073709551614",                     2LL, 0);
18361         check("-18446744073709551615",                     1LL, 0);
18362         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18363         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18364 #endif
18365         if (!bad)
18366                 printf("ok\n");
18367 }
18368 EOCP
18369         set try
18370         if eval $compile; then
18371                 case "`$run ./try`" in
18372                 ok) echo "Your strtoull() seems to be working okay." ;;
18373                 *) cat <<EOM >&4
18374 Your strtoull() doesn't seem to be working okay.
18375 EOM
18376                    d_strtoull="$undef"
18377                    ;;
18378                 esac
18379         else
18380                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18381                 d_strtoull="$undef"
18382         fi
18383         ;;
18384 esac
18385
18386 : see if strtouq exists
18387 set strtouq d_strtouq
18388 eval $inlibc
18389
18390 case "$d_strtouq" in
18391 "$define")
18392         $cat <<EOM
18393 Checking whether your strtouq() works okay...
18394 EOM
18395         $cat >try.c <<'EOCP'
18396 #include <errno.h>
18397 #include <stdio.h>
18398 extern unsigned long long int strtouq(char *s, char **, int);
18399 static int bad = 0;
18400 void check(char *s, unsigned long long eull, int een) {
18401         unsigned long long gull;
18402         errno = 0;
18403         gull = strtouq(s, 0, 10);
18404         if (!((gull == eull) && (errno == een)))
18405                 bad++;
18406 }
18407 int main() {
18408         check(" 1",                                        1LL, 0);
18409         check(" 0",                                        0LL, 0);
18410         check("18446744073709551615",  18446744073709551615ULL, 0);
18411         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18412 #if 0 /* strtouq() for /^-/ strings is undefined. */
18413         check("-1",                    18446744073709551615ULL, 0);
18414         check("-18446744073709551614",                     2LL, 0);
18415         check("-18446744073709551615",                     1LL, 0);
18416         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18417         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18418 #endif
18419         if (!bad)
18420                 printf("ok\n");
18421         return 0;
18422 }
18423 EOCP
18424         set try
18425         if eval $compile; then
18426                 case "`$run ./try`" in
18427                 ok) echo "Your strtouq() seems to be working okay." ;;
18428                 *) cat <<EOM >&4
18429 Your strtouq() doesn't seem to be working okay.
18430 EOM
18431                    d_strtouq="$undef"
18432                    ;;
18433                 esac
18434         else
18435                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18436                 d_strtouq="$undef"
18437         fi
18438         ;;
18439 esac
18440
18441 : see if strxfrm exists
18442 set strxfrm d_strxfrm
18443 eval $inlibc
18444
18445 : see if symlink exists
18446 set symlink d_symlink
18447 eval $inlibc
18448
18449 : see if syscall exists
18450 set syscall d_syscall
18451 eval $inlibc
18452
18453 : see if prototype for syscall is available
18454 echo " "
18455 set d_syscallproto syscall $i_unistd unistd.h
18456 eval $hasproto
18457
18458 : see if sysconf exists
18459 set sysconf d_sysconf
18460 eval $inlibc
18461
18462 : see if system exists
18463 set system d_system
18464 eval $inlibc
18465
18466 : see if tcgetpgrp exists
18467 set tcgetpgrp d_tcgetpgrp
18468 eval $inlibc
18469
18470 : see if tcsetpgrp exists
18471 set tcsetpgrp d_tcsetpgrp
18472 eval $inlibc
18473
18474 : see if prototype for telldir is available
18475 echo " "
18476 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18477 eval $hasproto
18478
18479 : see if time exists
18480 echo " "
18481 if test "X$d_time" = X -o X"$timetype" = X; then
18482     if set time val -f d_time; eval $csym; $val; then
18483                 echo 'time() found.' >&4
18484                 val="$define"
18485                 rp="What is the type returned by time() on this system?"
18486                 set time_t timetype long stdio.h sys/types.h
18487                 eval $typedef_ask
18488     else
18489                 echo 'time() not found, hope that will do.' >&4
18490                 val="$undef"
18491                 timetype='int';
18492     fi
18493     set d_time
18494     eval $setvar
18495 fi
18496
18497 : see if timegm exists
18498 set timegm d_timegm
18499 eval $inlibc
18500
18501 : see if this is a sys/times.h system
18502 set sys/times.h i_systimes
18503 eval $inhdr
18504
18505 : see if times exists
18506 echo " "
18507 if set times val -f d_times; eval $csym; $val; then
18508         echo 'times() found.' >&4
18509         d_times="$define"
18510         inc=''
18511         case "$i_systimes" in
18512         "$define") inc='sys/times.h';;
18513         esac
18514         rp="What is the type returned by times() on this system?"
18515         set clock_t clocktype long stdio.h sys/types.h $inc
18516         eval $typedef_ask
18517 else
18518         echo 'times() NOT found, hope that will do.' >&4
18519         d_times="$undef"
18520         clocktype='int'
18521 fi
18522
18523 : see if tmpnam_r exists
18524 set tmpnam_r d_tmpnam_r
18525 eval $inlibc
18526 case "$d_tmpnam_r" in
18527 "$define")
18528         hdrs="$i_systypes sys/types.h define stdio.h "
18529         case "$d_tmpnam_r_proto:$usethreads" in
18530         ":define")      d_tmpnam_r_proto=define
18531                 set d_tmpnam_r_proto tmpnam_r $hdrs
18532                 eval $hasproto ;;
18533         *)      ;;
18534         esac
18535         case "$d_tmpnam_r_proto" in
18536         define)
18537         case "$tmpnam_r_proto" in
18538         ''|0) try='char* tmpnam_r(char*);'
18539         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18540         esac
18541         case "$tmpnam_r_proto" in
18542         ''|0)   d_tmpnam_r=undef
18543                 tmpnam_r_proto=0
18544                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18545         * )     case "$tmpnam_r_proto" in
18546                 REENTRANT_PROTO*) ;;
18547                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18548                 esac
18549                 echo "Prototype: $try" ;;
18550         esac
18551         ;;
18552         *)      case "$usethreads" in
18553                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18554                 esac
18555                 d_tmpnam_r=undef
18556                 tmpnam_r_proto=0
18557                 ;;
18558         esac
18559         ;;
18560 *)      tmpnam_r_proto=0
18561         ;;
18562 esac
18563
18564 : see if truncate exists
18565 set truncate d_truncate
18566 eval $inlibc
18567
18568 : see if ttyname_r exists
18569 set ttyname_r d_ttyname_r
18570 eval $inlibc
18571 case "$d_ttyname_r" in
18572 "$define")
18573         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18574         case "$d_ttyname_r_proto:$usethreads" in
18575         ":define")      d_ttyname_r_proto=define
18576                 set d_ttyname_r_proto ttyname_r $hdrs
18577                 eval $hasproto ;;
18578         *)      ;;
18579         esac
18580         case "$d_ttyname_r_proto" in
18581         define)
18582         case "$ttyname_r_proto" in
18583         ''|0) try='int ttyname_r(int, char*, size_t);'
18584         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18585         esac
18586         case "$ttyname_r_proto" in
18587         ''|0) try='int ttyname_r(int, char*, int);'
18588         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18589         esac
18590         case "$ttyname_r_proto" in
18591         ''|0) try='char* ttyname_r(int, char*, int);'
18592         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18593         esac
18594         case "$ttyname_r_proto" in
18595         ''|0)   d_ttyname_r=undef
18596                 ttyname_r_proto=0
18597                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18598         * )     case "$ttyname_r_proto" in
18599                 REENTRANT_PROTO*) ;;
18600                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18601                 esac
18602                 echo "Prototype: $try" ;;
18603         esac
18604         ;;
18605         *)      case "$usethreads" in
18606                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18607                 esac
18608                 d_ttyname_r=undef
18609                 ttyname_r_proto=0
18610                 ;;
18611         esac
18612         ;;
18613 *)      ttyname_r_proto=0
18614         ;;
18615 esac
18616
18617 : see if tzname[] exists
18618 echo " "
18619 if set tzname val -a d_tzname; eval $csym; $val; then
18620         val="$define"
18621         echo 'tzname[] found.' >&4
18622 else
18623         val="$undef"
18624         echo 'tzname[] NOT found.' >&4
18625 fi
18626 set d_tzname
18627 eval $setvar
18628
18629 : Check if is a multiplatform env
18630 case "$osname" in
18631 next|darwin) multiarch="$define" ;;
18632 esac
18633 case "$multiarch" in
18634 ''|[nN]*) multiarch="$undef" ;;
18635 esac
18636
18637 : check for ordering of bytes in a UV
18638 echo " "
18639 case "$usecrosscompile$multiarch" in
18640 *$define*)
18641         $cat <<EOM
18642 You seem to be either cross-compiling or doing a multiarchitecture build,
18643 skipping the byteorder check.
18644
18645 EOM
18646         byteorder='ffff'
18647         ;;
18648 *)
18649         case "$byteorder" in
18650         '')
18651                 $cat <<'EOM'
18652 In the following, larger digits indicate more significance.  A big-endian
18653 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18654 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18655 machines may have weird orders like 3412.  A Cray will report 87654321,
18656 an Alpha will report 12345678. If the test program works the default is
18657 probably right.
18658 I'm now running the test program...
18659 EOM
18660                 $cat >try.c <<EOCP
18661 #include <stdio.h>
18662 #$i_stdlib I_STDLIB
18663 #ifdef I_STDLIB
18664 #include <stdlib.h>
18665 #endif
18666 #include <sys/types.h>
18667 typedef $uvtype UV;
18668 int main()
18669 {
18670         int i;
18671         union {
18672                 UV l;
18673                 char c[$uvsize];
18674         } u;
18675
18676         if ($uvsize > 4)
18677                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18678         else
18679                 u.l = (UV)0x04030201;
18680         for (i = 0; i < $uvsize; i++)
18681                 printf("%c", u.c[i]+'0');
18682         printf("\n");
18683         exit(0);
18684 }
18685 EOCP
18686                 xxx_prompt=y
18687                 set try
18688                 if eval $compile && $run ./try > /dev/null; then
18689                         dflt=`$run ./try`
18690                         case "$dflt" in
18691                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18692                                 echo "(The test program ran ok.)"
18693                                 echo "byteorder=$dflt"
18694                                 xxx_prompt=n
18695                         ;;
18696                         ????|????????) echo "(The test program ran ok.)" ;;
18697                         *) echo "(The test program didn't run right for some reason.)" ;;
18698                         esac
18699                 else
18700                         dflt='4321'
18701                         cat <<'EOM'
18702 (I can't seem to compile the test program.  Guessing big-endian...)
18703 EOM
18704                 fi
18705                 case "$xxx_prompt" in
18706                 y)
18707                         rp="What is the order of bytes in $uvtype?"
18708                         . ./myread
18709                         byteorder="$ans"
18710                         ;;
18711                 *)      byteorder=$dflt
18712                         ;;
18713                 esac
18714                 ;;
18715         esac
18716         $rm_try
18717         ;;
18718 esac
18719
18720 : Checking 32bit alignedness
18721 $cat <<EOM
18722
18723 Checking to see whether you can access character data unalignedly...
18724 EOM
18725 case "$d_u32align" in
18726 '')   $cat >try.c <<EOCP
18727 #include <stdio.h>
18728 #$i_stdlib I_STDLIB
18729 #ifdef I_STDLIB
18730 #include <stdlib.h>
18731 #endif
18732 #define U32 $u32type
18733 #define BYTEORDER 0x$byteorder
18734 #define U8 $u8type
18735 #include <signal.h>
18736 #ifdef SIGBUS
18737 $signal_t bletch(int s) { exit(4); }
18738 #endif
18739 int main() {
18740 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18741     volatile U8 buf[8];
18742     volatile U32 *up;
18743     int i;
18744
18745     if (sizeof(U32) != 4) {
18746         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18747         exit(1);
18748     }
18749
18750     fflush(stdout);
18751
18752 #ifdef SIGBUS
18753     signal(SIGBUS, bletch);
18754 #endif
18755
18756     buf[0] = 0;
18757     buf[1] = 0;
18758     buf[2] = 0;
18759     buf[3] = 1;
18760     buf[4] = 0;
18761     buf[5] = 0;
18762     buf[6] = 0;
18763     buf[7] = 1;
18764
18765     for (i = 0; i < 4; i++) {
18766         up = (U32*)(buf + i);
18767         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18768                (*up == 1 << (8*(3-i)))  /* little-endian */
18769               )
18770            )
18771         {
18772             printf("read failed (%x)\n", *up);
18773             exit(2);
18774         }
18775     }
18776
18777     /* write test */
18778     for (i = 0; i < 4; i++) {
18779         up = (U32*)(buf + i);
18780         *up = 0xBeef;
18781         if (*up != 0xBeef) {
18782             printf("write failed (%x)\n", *up);
18783             exit(3);
18784         }
18785     }
18786
18787     exit(0);
18788 #else
18789     printf("1\n");
18790     exit(1);
18791 #endif
18792     return 0;
18793 }
18794 EOCP
18795 set try
18796 if eval $compile_ok; then
18797         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18798         $run ./try 2>&1 >/dev/null
18799         case "$?" in
18800         0)      cat >&4 <<EOM
18801 You can access character data pretty unalignedly.
18802 EOM
18803                 d_u32align="$undef"
18804                 ;;
18805         *)      cat >&4 <<EOM
18806 It seems that you must access character data in an aligned manner.
18807 EOM
18808                 d_u32align="$define"
18809                 ;;
18810         esac
18811 else
18812         rp='Can you access character data at unaligned addresses?'
18813         dflt='n'
18814         . ./myread
18815         case "$ans" in
18816         [yY]*)  d_u32align="$undef"  ;;
18817         *)      d_u32align="$define" ;;
18818         esac
18819 fi
18820 $rm_try
18821 ;;
18822 esac
18823
18824 : see if ualarm exists
18825 set ualarm d_ualarm
18826 eval $inlibc
18827
18828 : see if umask exists
18829 set umask d_umask
18830 eval $inlibc
18831
18832 : see if unordered exists
18833 set unordered d_unordered
18834 eval $inlibc
18835
18836 : see if unsetenv exists
18837 set unsetenv d_unsetenv
18838 eval $inlibc
18839
18840 : see if usleep exists
18841 set usleep d_usleep
18842 eval $inlibc
18843
18844 : see if prototype for usleep is available
18845 echo " "
18846 set d_usleepproto usleep $i_unistd unistd.h
18847 eval $hasproto
18848
18849 : see if ustat exists
18850 set ustat d_ustat
18851 eval $inlibc
18852
18853 : see if closedir exists
18854 set closedir d_closedir
18855 eval $inlibc
18856
18857 case "$d_closedir" in
18858 "$define")
18859         echo " "
18860         echo "Checking whether closedir() returns a status..." >&4
18861         cat > try.c <<EOM
18862 #$i_dirent I_DIRENT             /**/
18863 #$i_sysdir I_SYS_DIR            /**/
18864 #$i_sysndir I_SYS_NDIR          /**/
18865 #$i_systypes I_SYS_TYPES        /**/
18866
18867 #if defined(I_SYS_TYPES)
18868 #include <sys/types.h>
18869 #endif
18870 #if defined(I_DIRENT)
18871 #include <dirent.h>
18872 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18873 #include <sys/dir.h>
18874 #endif
18875 #else
18876 #ifdef I_SYS_NDIR
18877 #include <sys/ndir.h>
18878 #else
18879 #ifdef I_SYS_DIR
18880 #ifdef hp9000s500
18881 #include <ndir.h>       /* may be wrong in the future */
18882 #else
18883 #include <sys/dir.h>
18884 #endif
18885 #endif
18886 #endif
18887 #endif
18888 int main() { return closedir(opendir(".")); }
18889 EOM
18890         set try
18891         if eval $compile_ok; then
18892                 if $run ./try > /dev/null 2>&1 ; then
18893                         echo "Yes, it does."
18894                         val="$undef"
18895                 else
18896                         echo "No, it doesn't."
18897                         val="$define"
18898                 fi
18899         else
18900                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18901                 val="$define"
18902         fi
18903         ;;
18904 *)
18905         val="$undef";
18906         ;;
18907 esac
18908 set d_void_closedir
18909 eval $setvar
18910 $rm_try
18911
18912 : see if there is a wait4
18913 set wait4 d_wait4
18914 eval $inlibc
18915
18916 : see if waitpid exists
18917 set waitpid d_waitpid
18918 eval $inlibc
18919
18920 : see if wcstombs exists
18921 set wcstombs d_wcstombs
18922 eval $inlibc
18923
18924 : see if wctomb exists
18925 set wctomb d_wctomb
18926 eval $inlibc
18927
18928 : see if writev exists
18929 set writev d_writev
18930 eval $inlibc
18931
18932 : preserve RCS keywords in files with variable substitution, grrr
18933 Date='$Date'
18934 Id='$Id'
18935 Log='$Log'
18936 RCSfile='$RCSfile'
18937 Revision='$Revision'
18938
18939 : check for alignment requirements
18940 echo " "
18941 case "$usecrosscompile" in
18942 *$define*)
18943         $cat <<EOM
18944 You seem to be cross-compiling.  Skipping the memory alignment check.
18945
18946 EOM
18947         case "$alignbytes" in
18948         '') alignbytes=8 ;;
18949         esac
18950         ;;
18951 *)
18952         case "$alignbytes" in
18953         '') echo "Checking alignment constraints..." >&4
18954                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18955                         $cat >try.c <<'EOCP'
18956 typedef long double NV;
18957 EOCP
18958                 else
18959                         $cat >try.c <<'EOCP'
18960 typedef double NV;
18961 EOCP
18962                 fi
18963                 $cat >>try.c <<'EOCP'
18964 #include <stdio.h>
18965 struct foobar {
18966         char foo;
18967         NV bar;
18968 } try_algn;
18969 int main()
18970 {
18971     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18972     return(0);
18973 }
18974 EOCP
18975                 set try
18976                 if eval $compile_ok; then
18977                         dflt=`$run ./try`
18978                 else
18979                         dflt='8'
18980                         echo "(I can't seem to compile the test program...)"
18981                 fi
18982                 case "$multiarch" in
18983                 *$define*)
18984                         : The usual safe value is 8, but Darwin with -Duselongdouble
18985                         : needs 16.  Hence, we will take 8 as a minimum, but allow
18986                         : Configure to pick a larger value if needed.
18987                         if $test "$dflt" -lt 8; then
18988                             dflt='8'
18989                                 echo "Setting alignment to 8 for multiarch support.">&4
18990                         fi
18991                         ;;
18992                 esac
18993                 ;;
18994         *) dflt="$alignbytes"
18995                 ;;
18996         esac
18997         rp="Doubles must be aligned on a how-many-byte boundary?"
18998         . ./myread
18999         alignbytes="$ans"
19000         $rm_try
19001         ;;
19002 esac
19003
19004
19005 : set the base revision
19006 baserev=5.0
19007
19008 : Determine if this is an EBCDIC system
19009 echo " "
19010 echo "Determining whether or not we are on an EBCDIC system..." >&4
19011 $cat >try.c <<'EOM'
19012 int main()
19013 {
19014   if ('M'==0xd4) return 0;
19015   return 1;
19016 }
19017 EOM
19018
19019 case "$BOOTSTRAP_CHARSET" in
19020     Y|y|define) bootstrap_charset=$define       ;;
19021     *)          bootstrap_charset=$undef        ;;
19022 esac
19023
19024 val=$undef
19025 set try
19026 if eval $compile_ok; then
19027         if $run ./try; then
19028                 echo "You seem to speak EBCDIC." >&4
19029                 val="$define"
19030         else
19031                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19032         fi
19033 else
19034         echo "I'm unable to compile the test program." >&4
19035         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19036 fi
19037 $rm_try
19038 set ebcdic
19039 eval $setvar
19040
19041 : length of character in bytes. Is always 1, otherwise it is not C
19042 : This used to be a test using sizeof
19043 charsize=1
19044
19045 : Check for the number of bits in a character
19046 case "$charbits" in
19047 '')     echo "Checking how long a character is (in bits)..." >&4
19048         $cat >try.c <<EOCP
19049 #include <stdio.h>
19050 int main ()
19051 {
19052     int n;
19053     unsigned char c;
19054     for (c = 1, n = 0; c; c <<= 1, n++) ;
19055     printf ("%d\n", n);
19056     return (0);
19057     }
19058 EOCP
19059         set try
19060         if eval $compile_ok; then
19061                 dflt=`$run ./try`
19062         else
19063                 dflt='8'
19064                 echo "(I can't seem to compile the test program.  Guessing...)"
19065         fi
19066         ;;
19067 *)
19068         dflt="$charbits"
19069         ;;
19070 esac
19071 rp="What is the length of a character (in bits)?"
19072 . ./myread
19073 charbits="$ans"
19074 $rm_try
19075 case "$charbits" in
19076 8)      ;;
19077 *)      cat >&4 << EOM
19078 Your system has an unsigned character size of $charbits bits, which
19079 is rather unusual (normally it is 8 bits).  Perl likely will not work
19080 correctly on your system, with subtle bugs in various places.
19081 EOM
19082         rp='Do you really want to continue?'
19083         dflt='n'
19084         . ./myread
19085         case "$ans" in
19086                 [yY])   echo >&4 "Okay, continuing."    ;;
19087                 *)      exit 1                          ;;
19088         esac
19089 esac
19090
19091 : how do we concatenate cpp tokens here?
19092 echo " "
19093 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19094 $cat >cpp_stuff.c <<'EOCP'
19095 #define RCAT(a,b)a/**/b
19096 #define ACAT(a,b)a ## b
19097 RCAT(Rei,ser)
19098 ACAT(Cir,cus)
19099 EOCP
19100 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19101 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19102         echo "Oh!  Smells like ANSI's been here." >&4
19103         echo "We can catify or stringify, separately or together!"
19104         cpp_stuff=42
19105 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19106         echo "Ah, yes!  The good old days!" >&4
19107         echo "However, in the good old days we don't know how to stringify and"
19108         echo "catify at the same time."
19109         cpp_stuff=1
19110 else
19111         $cat >&4 <<EOM
19112 Hmm, I don't seem to be able to concatenate tokens with your cpp.
19113 You're going to have to edit the values of CAT[2-5] in config.h...
19114 EOM
19115         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19116 fi
19117 $rm -f cpp_stuff.*
19118
19119 : see if this is a db.h system
19120 set db.h i_db
19121 eval $inhdr
19122
19123 case "$i_db" in
19124 $define)
19125         : Check db version.
19126         echo " "
19127         echo "Checking Berkeley DB version ..." >&4
19128         $cat >try.c <<EOCP
19129 #$d_const HASCONST
19130 #ifndef HASCONST
19131 #define const
19132 #endif
19133 #include <sys/types.h>
19134 #include <stdio.h>
19135 #$i_stdlib I_STDLIB
19136 #ifdef I_STDLIB
19137 #include <stdlib.h>
19138 #endif
19139 #include <db.h>
19140 int main(int argc, char *argv[])
19141 {
19142 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19143     int Major, Minor, Patch ;
19144     unsigned long Version ;
19145     (void)db_version(&Major, &Minor, &Patch) ;
19146     if (argc == 2) {
19147         printf("%d %d %d %d %d %d\n",
19148                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19149                Major, Minor, Patch);
19150         exit(0);
19151     }
19152     printf("You have Berkeley DB Version 2 or greater.\n");
19153
19154     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19155                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19156     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19157                 Major, Minor, Patch) ;
19158
19159     /* check that db.h & libdb are compatible */
19160     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19161         printf("db.h and libdb are incompatible.\n") ;
19162         exit(3);
19163     }
19164
19165     printf("db.h and libdb are compatible.\n") ;
19166
19167     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19168                 + DB_VERSION_PATCH ;
19169
19170     /* needs to be >= 2.3.4 */
19171     if (Version < 2003004) {
19172     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19173         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19174         exit(2);
19175     }
19176
19177     exit(0);
19178 #else
19179 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19180     if (argc == 2) {
19181         printf("1 0 0\n");
19182         exit(0);
19183     }
19184     printf("You have Berkeley DB Version 1.\n");
19185     exit(0);    /* DB version < 2: the coast is clear. */
19186 #else
19187     exit(1);    /* <db.h> not Berkeley DB? */
19188 #endif
19189 #endif
19190 }
19191 EOCP
19192         set try
19193         if eval $compile_ok && $run ./try; then
19194                 echo 'Looks OK.' >&4
19195                 set `$run ./try 1`
19196                 db_version_major=$1
19197                 db_version_minor=$2
19198                 db_version_patch=$3
19199         else
19200                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19201                 i_db=$undef
19202                 case " $libs " in
19203                 *"-ldb "*)
19204                         : Remove db from list of libraries to use
19205                         echo "Removing unusable -ldb from library list" >&4
19206                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19207                         shift
19208                         libs="$*"
19209                         echo "libs = $libs" >&4
19210                         ;;
19211                 esac
19212         fi
19213         $rm_try
19214         ;;
19215 esac
19216
19217 case "$i_db" in
19218 define)
19219         : Check the return type needed for hash
19220         echo " "
19221         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19222         $cat >try.c <<EOCP
19223 #$d_const HASCONST
19224 #ifndef HASCONST
19225 #define const
19226 #endif
19227 #include <sys/types.h>
19228 #include <db.h>
19229
19230 #ifndef DB_VERSION_MAJOR
19231 u_int32_t hash_cb (ptr, size)
19232 const void *ptr;
19233 size_t size;
19234 {
19235 }
19236 HASHINFO info;
19237 int main()
19238 {
19239         info.hash = hash_cb;
19240 }
19241 #endif
19242 EOCP
19243         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19244                 if $contains warning try.out >>/dev/null 2>&1 ; then
19245                         db_hashtype='int'
19246                 else
19247                         db_hashtype='u_int32_t'
19248                 fi
19249         else
19250                 : XXX Maybe we should just give up here.
19251                 db_hashtype=u_int32_t
19252                 $cat try.out >&4
19253                 echo "Help:  I can't seem to compile the db test program." >&4
19254                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19255         fi
19256         $rm_try
19257         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19258         ;;
19259 *)      db_hashtype=u_int32_t
19260         ;;
19261 esac
19262 case "$i_db" in
19263 define)
19264         : Check the return type needed for prefix
19265         echo " "
19266         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19267         cat >try.c <<EOCP
19268 #$d_const HASCONST
19269 #ifndef HASCONST
19270 #define const
19271 #endif
19272 #include <sys/types.h>
19273 #include <db.h>
19274
19275 #ifndef DB_VERSION_MAJOR
19276 size_t prefix_cb (key1, key2)
19277 const DBT *key1;
19278 const DBT *key2;
19279 {
19280 }
19281 BTREEINFO info;
19282 int main()
19283 {
19284         info.prefix = prefix_cb;
19285 }
19286 #endif
19287 EOCP
19288         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19289                 if $contains warning try.out >>/dev/null 2>&1 ; then
19290                         db_prefixtype='int'
19291                 else
19292                         db_prefixtype='size_t'
19293                 fi
19294         else
19295                 db_prefixtype='size_t'
19296                 : XXX Maybe we should just give up here.
19297                 $cat try.out >&4
19298                 echo "Help:  I can't seem to compile the db test program." >&4
19299                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19300         fi
19301         $rm_try
19302         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19303         ;;
19304 *)      db_prefixtype='size_t'
19305         ;;
19306 esac
19307
19308 : How can we generate normalized random numbers ?
19309 echo " "
19310 echo "Using our internal random number implementation..." >&4
19311
19312 case "$ccflags" in
19313 *-Dmy_rand=*|*-Dmy_srand=*)
19314         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19315         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19316         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19317         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19318         ;;
19319 esac
19320
19321 randfunc=Perl_drand48
19322 drand01="Perl_drand48()"
19323 seedfunc="Perl_drand48_init"
19324 randbits=48
19325 randseedtype=U32
19326
19327 : Check how to flush
19328 echo " "
19329 $cat >&4 <<EOM
19330 Checking how to flush all pending stdio output...
19331 EOM
19332 # I only know how to find the first 32 possibly open files on SunOS.
19333 # See also hints/sunos_4_1.sh and util.c  --AD
19334 case "$osname" in
19335 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19336 esac
19337 $cat >>try.c <<EOCP
19338 #include <stdio.h>
19339 #$i_stdlib I_STDLIB
19340 #ifdef I_STDLIB
19341 #include <stdlib.h>
19342 #endif
19343 #$i_unistd I_UNISTD
19344 #ifdef I_UNISTD
19345 # include <unistd.h>
19346 #endif
19347 #$d_sysconf HAS_SYSCONF
19348 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19349 #ifdef HAS_STDIO_STREAM_ARRAY
19350 # define STDIO_STREAM_ARRAY $stdio_stream_array
19351 #endif
19352 int main() {
19353   FILE* p;
19354   unlink("try.out");
19355   p = fopen("try.out", "w");
19356 #ifdef TRY_FPUTC
19357   fputc('x', p);
19358 #else
19359 # ifdef TRY_FPRINTF
19360   fprintf(p, "x");
19361 # endif
19362 #endif
19363 #ifdef TRY_FFLUSH_NULL
19364   fflush(NULL);
19365 #endif
19366 #ifdef TRY_FFLUSH_ALL
19367   {
19368     long open_max = -1;
19369 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19370     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19371 # else
19372 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19373     open_max = sysconf(_SC_OPEN_MAX);
19374 #  else
19375 #   ifdef FOPEN_MAX
19376     open_max = FOPEN_MAX;
19377 #   else
19378 #    ifdef OPEN_MAX
19379     open_max = OPEN_MAX;
19380 #    else
19381 #     ifdef _NFILE
19382     open_max = _NFILE;
19383 #     endif
19384 #    endif
19385 #   endif
19386 #  endif
19387 # endif
19388 # ifdef HAS_STDIO_STREAM_ARRAY
19389     if (open_max > 0) {
19390       long i;
19391       for (i = 0; i < open_max; i++)
19392             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19393                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19394                 STDIO_STREAM_ARRAY[i]._flag)
19395                 fflush(&STDIO_STREAM_ARRAY[i]);
19396     }
19397   }
19398 # endif
19399 #endif
19400   _exit(42);
19401 }
19402 EOCP
19403 : first we have to find out how _not_ to flush
19404 $to try.c
19405 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19406     output=''
19407     set try -DTRY_FPUTC
19408     if eval $compile; then
19409             $run ./try 2>/dev/null
19410             code="$?"
19411             $from try.out
19412             if $test ! -s try.out -a "X$code" = X42; then
19413                 output=-DTRY_FPUTC
19414             fi
19415     fi
19416     case "$output" in
19417     '')
19418             set try -DTRY_FPRINTF
19419             if eval $compile; then
19420                     $run ./try 2>/dev/null
19421                     code="$?"
19422                     $from try.out
19423                     if $test ! -s try.out -a "X$code" = X42; then
19424                         output=-DTRY_FPRINTF
19425                     fi
19426             fi
19427         ;;
19428     esac
19429 fi
19430 : check for fflush NULL behavior
19431 case "$fflushNULL" in
19432 '')     set try -DTRY_FFLUSH_NULL $output
19433         if eval $compile; then
19434                 $run ./try 2>/dev/null
19435                 code="$?"
19436                 $from try.out
19437                 if $test -s try.out -a "X$code" = X42; then
19438                         fflushNULL="`$cat try.out`"
19439                 else
19440                         if $test "X$code" != X42; then
19441                                 $cat >&4 <<EOM
19442 (If this test failed, don't worry, we'll try another method shortly.)
19443 EOM
19444                         fi
19445                 fi
19446         fi
19447         $rm -f core try.core core.try.*
19448         case "$fflushNULL" in
19449         x)      $cat >&4 <<EOM
19450 Your fflush(NULL) works okay for output streams.
19451 Let's see if it clobbers input pipes...
19452 EOM
19453 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19454 # bug that improperly flushes the input end of pipes.  So we avoid the
19455 # autoflush on fork/system/exec support for now. :-(
19456 $cat >tryp.c <<EOCP
19457 #include <stdio.h>
19458 int
19459 main(int argc, char **argv)
19460 {
19461     char buf[1024];
19462     int i;
19463     char *bp = buf;
19464     while (1) {
19465         while ((i = getc(stdin)) != -1
19466                && (*bp++ = i) != '\n'
19467                && bp < &buf[1024])
19468         /* DO NOTHING */ ;
19469         *bp = '\0';
19470         fprintf(stdout, "%s", buf);
19471         fflush(NULL);
19472         if (i == -1)
19473             return 0;
19474         bp = buf;
19475     }
19476 }
19477 EOCP
19478                 fflushNULL="$define"
19479                 set tryp
19480                 if eval $compile; then
19481                     $rm -f tryp.out
19482                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19483                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19484                        $cat >&4 <<EOM
19485 fflush(NULL) seems to behave okay with input streams.
19486 EOM
19487                         fflushNULL="$define"
19488                     else
19489                         $cat >&4 <<EOM
19490 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19491 EOM
19492                         fflushNULL="$undef"
19493                     fi
19494                 fi
19495                 $rm -f core tryp.c tryp.core core.tryp.*
19496                 ;;
19497         '')     $cat >&4 <<EOM
19498 Your fflush(NULL) isn't working (contrary to ANSI C).
19499 EOM
19500                 fflushNULL="$undef"
19501                 ;;
19502         *)      $cat >&4 <<EOM
19503 Cannot figure out whether your fflush(NULL) works or not.
19504 I'm assuming it doesn't (contrary to ANSI C).
19505 EOM
19506                 fflushNULL="$undef"
19507                 ;;
19508         esac
19509         ;;
19510 $define|true|[yY]*)
19511         fflushNULL="$define"
19512         ;;
19513 *)
19514         fflushNULL="$undef"
19515         ;;
19516 esac
19517 : check explicit looping only if NULL did not work, and if the pipe
19518 : bug does not show up on an explicit flush too
19519 case "$fflushNULL" in
19520 "$undef")
19521         $cat >tryp.c <<EOCP
19522 #include <stdio.h>
19523 int
19524 main(int argc, char **argv)
19525 {
19526     char buf[1024];
19527     int i;
19528     char *bp = buf;
19529     while (1) {
19530         while ((i = getc(stdin)) != -1
19531                && (*bp++ = i) != '\n'
19532                && bp < &buf[1024])
19533         /* DO NOTHING */ ;
19534         *bp = '\0';
19535         fprintf(stdout, "%s", buf);
19536         fflush(stdin);
19537         if (i == -1)
19538             return 0;
19539         bp = buf;
19540     }
19541 }
19542 EOCP
19543         set tryp
19544         if eval $compile; then
19545             $rm -f tryp.out
19546             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19547             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19548                $cat >&4 <<EOM
19549 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19550 EOM
19551                 : now check for fflushall behaviour
19552                 case "$fflushall" in
19553                 '')     set try -DTRY_FFLUSH_ALL $output
19554                         if eval $compile; then
19555                                 $cat >&4 <<EOM
19556 (Now testing the other method--but note that this also may fail.)
19557 EOM
19558                                 $run ./try 2>/dev/null
19559                                 code=$?
19560                                 $from try.out
19561                                 if $test -s try.out -a "X$code" = X42; then
19562                                         fflushall="`$cat try.out`"
19563                                 fi
19564                         fi
19565                         $rm_try
19566                         case "$fflushall" in
19567                         x)      $cat >&4 <<EOM
19568 Whew. Flushing explicitly all the stdio streams works.
19569 EOM
19570                                 fflushall="$define"
19571                                 ;;
19572                         '')     $cat >&4 <<EOM
19573 Sigh. Flushing explicitly all the stdio streams doesn't work.
19574 EOM
19575                                 fflushall="$undef"
19576                                 ;;
19577                         *)      $cat >&4 <<EOM
19578 Cannot figure out whether flushing stdio streams explicitly works or not.
19579 I'm assuming it doesn't.
19580 EOM
19581                                 fflushall="$undef"
19582                                 ;;
19583                         esac
19584                         ;;
19585                 "$define"|true|[yY]*)
19586                         fflushall="$define"
19587                         ;;
19588                 *)
19589                         fflushall="$undef"
19590                         ;;
19591                 esac
19592             else
19593                 $cat >&4 <<EOM
19594 All is futile.  Even fflush(stdin) clobbers input pipes!
19595 EOM
19596                 fflushall="$undef"
19597             fi
19598         else
19599             fflushall="$undef"
19600         fi
19601         $rm -f core tryp.c tryp.core core.tryp.*
19602         ;;
19603 *)      fflushall="$undef"
19604         ;;
19605 esac
19606
19607 case "$fflushNULL$fflushall" in
19608 undefundef)
19609         $cat <<EOM
19610 OK, I give up.  I cannot figure out how to flush pending stdio output.
19611 We won't be flushing handles at all before fork/exec/popen.
19612 EOM
19613         ;;
19614 esac
19615 $rm_try tryp
19616
19617 : Store the full pathname to the ar program for use in the C program
19618 : Respect a hint or command line value for full_ar.
19619 case "$full_ar" in
19620 '') full_ar=$ar ;;
19621 esac
19622
19623 : Store the full pathname to the sed program for use in the C program
19624 full_sed=$sed
19625
19626 : see what type gids are declared as in the kernel
19627 echo " "
19628 echo "Looking for the type for group ids returned by getgid()."
19629 set gid_t gidtype xxx stdio.h sys/types.h
19630 eval $typedef
19631 case "$gidtype" in
19632 xxx)
19633         xxx=`./findhdr sys/user.h`
19634         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19635         case $1 in
19636         unsigned) dflt="$1 $2" ;;
19637         *) dflt="$1" ;;
19638         esac
19639         ;;
19640 *) dflt="$gidtype";;
19641 esac
19642 case "$gidtype" in
19643 gid_t) echo "gid_t found." ;;
19644 *)      rp="What is the type for group ids returned by getgid()?"
19645         . ./myread
19646         gidtype="$ans"
19647         ;;
19648 esac
19649
19650 : Check the size of GID
19651 echo " "
19652 case "$gidtype" in
19653 *_t) zzz="$gidtype"     ;;
19654 *)   zzz="gid"          ;;
19655 esac
19656 echo "Checking the size of $zzz..." >&4
19657 cat > try.c <<EOCP
19658 #include <sys/types.h>
19659 #include <stdio.h>
19660 #$i_stdlib I_STDLIB
19661 #ifdef I_STDLIB
19662 #include <stdlib.h>
19663 #endif
19664 int main() {
19665     printf("%d\n", (int)sizeof($gidtype));
19666     exit(0);
19667 }
19668 EOCP
19669 set try
19670 if eval $compile_ok; then
19671         yyy=`$run ./try`
19672         case "$yyy" in
19673         '')     gidsize=4
19674                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19675                 ;;
19676         *)      gidsize=$yyy
19677                 echo "Your $zzz is $gidsize bytes long."
19678                 ;;
19679         esac
19680 else
19681         gidsize=4
19682         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19683 fi
19684
19685
19686 : Check if GID is signed
19687 echo " "
19688 case "$gidtype" in
19689 *_t) zzz="$gidtype"     ;;
19690 *)   zzz="gid"          ;;
19691 esac
19692 echo "Checking the sign of $zzz..." >&4
19693 cat > try.c <<EOCP
19694 #include <sys/types.h>
19695 #include <stdio.h>
19696 int main() {
19697         $gidtype foo = -1;
19698         if (foo < 0)
19699                 printf("-1\n");
19700         else
19701                 printf("1\n");
19702 }
19703 EOCP
19704 set try
19705 if eval $compile; then
19706         yyy=`$run ./try`
19707         case "$yyy" in
19708         '')     gidsign=1
19709                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19710                 ;;
19711         *)      gidsign=$yyy
19712                 case "$gidsign" in
19713                  1) echo "Your $zzz is unsigned." ;;
19714                 -1) echo "Your $zzz is signed."   ;;
19715                 esac
19716                 ;;
19717         esac
19718 else
19719         gidsign=1
19720         echo "(I can't compile the test program--guessing unsigned.)" >&4
19721 fi
19722
19723
19724 : Check 64bit sizes
19725 echo " "
19726
19727 if $test X"$quadtype" != X; then
19728
19729 echo "Checking how to print 64-bit integers..." >&4
19730
19731 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19732         $cat >try.c <<'EOCP'
19733 #include <sys/types.h>
19734 #include <stdio.h>
19735 int main() {
19736   int q = 12345678901;
19737   printf("%ld\n", q);
19738 }
19739 EOCP
19740         set try
19741         if eval $compile; then
19742                 yyy=`$run ./try`
19743                 case "$yyy" in
19744                 12345678901)
19745                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19746                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19747                         echo "We will use %d."
19748                         ;;
19749                 esac
19750         fi
19751 fi
19752
19753 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19754         $cat >try.c <<'EOCP'
19755 #include <sys/types.h>
19756 #include <stdio.h>
19757 int main() {
19758   long q = 12345678901;
19759   printf("%ld\n", q);
19760 }
19761 EOCP
19762         set try
19763         if eval $compile; then
19764                 yyy=`$run ./try`
19765                 case "$yyy" in
19766                 12345678901)
19767                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19768                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19769                         echo "We will use %ld."
19770                         ;;
19771                 esac
19772         fi
19773 fi
19774
19775 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19776         $cat >try.c <<'EOCP'
19777 #include <sys/types.h>
19778 #include <inttypes.h>
19779 #include <stdio.h>
19780 int main() {
19781   int64_t q = 12345678901;
19782   printf("%" PRId64 "\n", q);
19783 }
19784 EOCP
19785         set try
19786         if eval $compile; then
19787                 yyy=`$run ./try`
19788                 case "$yyy" in
19789                 12345678901)
19790                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19791                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19792                         echo "We will use the C9X style."
19793                         ;;
19794                 esac
19795         fi
19796 fi
19797
19798 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19799         $cat >try.c <<EOCP
19800 #include <sys/types.h>
19801 #include <stdio.h>
19802 int main() {
19803   $quadtype q = 12345678901;
19804   printf("%Ld\n", q);
19805 }
19806 EOCP
19807         set try
19808         if eval $compile; then
19809                 yyy=`$run ./try`
19810                 case "$yyy" in
19811                 12345678901)
19812                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19813                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19814                         echo "We will use %Ld."
19815                         ;;
19816                 esac
19817         fi
19818 fi
19819
19820 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19821         $cat >try.c <<'EOCP'
19822 #include <sys/types.h>
19823 #include <stdio.h>
19824 int main() {
19825   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19826   printf("%lld\n", q);
19827 }
19828 EOCP
19829         set try
19830         if eval $compile; then
19831                 yyy=`$run ./try`
19832                 case "$yyy" in
19833                 12345678901)
19834                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19835                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19836                         echo "We will use the %lld style."
19837                         ;;
19838                 esac
19839         fi
19840 fi
19841
19842 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19843         $cat >try.c <<EOCP
19844 #include <sys/types.h>
19845 #include <stdio.h>
19846 int main() {
19847   $quadtype q = 12345678901;
19848   printf("%qd\n", q);
19849 }
19850 EOCP
19851         set try
19852         if eval $compile; then
19853                 yyy=`$run ./try`
19854                 case "$yyy" in
19855                 12345678901)
19856                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19857                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19858                         echo "We will use %qd."
19859                         ;;
19860                 esac
19861         fi
19862 fi
19863
19864 if $test X"$sPRId64" = X; then
19865         echo "Cannot figure out how to print 64-bit integers." >&4
19866 fi
19867 $rm_try
19868
19869 fi
19870
19871 case "$sPRId64" in
19872 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19873         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19874         ;;
19875 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19876         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19877         ;;
19878 esac
19879
19880 : Check format strings for internal types
19881 echo " "
19882 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19883
19884 if $test X"$ivsize" = X8; then
19885         ivdformat="$sPRId64"
19886         uvuformat="$sPRIu64"
19887         uvoformat="$sPRIo64"
19888         uvxformat="$sPRIx64"
19889         uvXUformat="$sPRIXU64"
19890 else
19891         if $test X"$ivsize" = X"$longsize"; then
19892                 ivdformat='"ld"'
19893                 uvuformat='"lu"'
19894                 uvoformat='"lo"'
19895                 uvxformat='"lx"'
19896                 uvXUformat='"lX"'
19897         else
19898                 if $test X"$ivsize" = X"$intsize"; then
19899                         ivdformat='"d"'
19900                         uvuformat='"u"'
19901                         uvoformat='"o"'
19902                         uvxformat='"x"'
19903                         uvXUformat='"X"'
19904                 else
19905                         : far out
19906                         if $test X"$ivsize" = X"$shortsize"; then
19907                                 ivdformat='"hd"'
19908                                 uvuformat='"hu"'
19909                                 uvoformat='"ho"'
19910                                 uvxformat='"hx"'
19911                                 uvXUformat='"hX"'
19912                         fi
19913                 fi
19914         fi
19915 fi
19916
19917 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19918         nveformat="$sPRIeldbl"
19919         nvfformat="$sPRIfldbl"
19920         nvgformat="$sPRIgldbl"
19921         nvEUformat="$sPRIEUldbl"
19922         nvFUformat="$sPRIFUldbl"
19923         nvGUformat="$sPRIGUldbl"
19924 else
19925         nveformat='"e"'
19926         nvfformat='"f"'
19927         nvgformat='"g"'
19928         nvEUformat='"E"'
19929         nvFUformat='"F"'
19930         nvGUformat='"G"'
19931 fi
19932
19933 case "$ivdformat" in
19934 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19935     exit 1
19936     ;;
19937 esac
19938
19939 : Check format string for GID
19940
19941 echo " "
19942 $echo "Checking the format string to be used for gids..." >&4
19943
19944 case "$gidsign" in
19945 -1)     if $test X"$gidsize" = X"$ivsize"; then
19946                 gidformat="$ivdformat"
19947         else
19948                 if $test X"$gidsize" = X"$longsize"; then
19949                         gidformat='"ld"'
19950                 else
19951                         if $test X"$gidsize" = X"$intsize"; then
19952                                 gidformat='"d"'
19953                         else
19954                                 if $test X"$gidsize" = X"$shortsize"; then
19955                                         gidformat='"hd"'
19956                                 fi
19957                         fi
19958                 fi
19959         fi
19960         ;;
19961 *)      if $test X"$gidsize" = X"$uvsize"; then
19962                 gidformat="$uvuformat"
19963         else
19964                 if $test X"$gidsize" = X"$longsize"; then
19965                         gidformat='"lu"'
19966                 else
19967                         if $test X"$gidsize" = X"$intsize"; then
19968                                 gidformat='"u"'
19969                         else
19970                                 if $test X"$gidsize" = X"$shortsize"; then
19971                                         gidformat='"hu"'
19972                                 fi
19973                         fi
19974                 fi
19975         fi
19976         ;;
19977 esac
19978
19979 : see if getgroups exists
19980 set getgroups d_getgrps
19981 eval $inlibc
19982
19983 : see if setgroups exists
19984 set setgroups d_setgrps
19985 eval $inlibc
19986
19987 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19988 echo " "
19989 case "$d_getgrps$d_setgrps" in
19990 *define*)
19991         case "$groupstype" in
19992         '') dflt="$gidtype" ;;
19993         *)  dflt="$groupstype" ;;
19994         esac
19995         $cat <<EOM
19996 What type of pointer is the second argument to getgroups() and setgroups()?
19997 Usually this is the same as group ids, $gidtype, but not always.
19998
19999 EOM
20000         rp='What type pointer is the second argument to getgroups() and setgroups()?'
20001         . ./myread
20002         groupstype="$ans"
20003         ;;
20004 *)  groupstype="$gidtype";;
20005 esac
20006
20007 : MAD = Misc Attribute Definition
20008
20009 if $test $patchlevel -lt 9; then
20010 : MAD is not available in 5.8.x or earlier.
20011     ans=n;
20012 else
20013     case "$mad" in
20014     $define|true|[yY]*) dflt='y' ;;
20015     *)                  dflt='n' ;;
20016     esac
20017     cat <<EOM
20018
20019 Would you like to build with Misc Attribute Decoration? This is development
20020 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20021 overhead on the interpreter.
20022
20023 If this doesn't make any sense to you, just accept the default '$dflt'.
20024 EOM
20025     rp='Build Perl with MAD?'
20026     . ./myread
20027 fi
20028 case "$ans" in
20029 y|Y)    val="$define"
20030         madlyh='madly.h madly.act madly.tab'
20031         madlysrc='madly.c'
20032         madlyobj="madly$_o" ;;
20033 *)      val="$undef"
20034         madlyh=''
20035         madlysrc=''
20036         madlyobj='' ;;
20037 esac
20038 set mad
20039 eval $setvar
20040
20041 : check whether make sets MAKE
20042 echo " "
20043 echo "Checking if your $make program sets \$(MAKE)..." >&4
20044 case "$make_set_make" in
20045 '')
20046         $sed 's/^X //' > testmake.mak << 'EOF'
20047 Xall:
20048 X       @echo 'maketemp="$(MAKE)"'
20049 EOF
20050         case "`$make -f testmake.mak 2>/dev/null`" in
20051         *maketemp=*) make_set_make='#' ;;
20052         *)      make_set_make="MAKE=$make" ;;
20053         esac
20054         $rm -f testmake.mak
20055         ;;
20056 esac
20057 case "$make_set_make" in
20058 '#') echo "Yup, it does.";;
20059 *) echo "Nope, it doesn't.";;
20060 esac
20061
20062 : see what type is used for mode_t
20063 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20064 set mode_t modetype int stdio.h sys/types.h
20065 eval $typedef_ask
20066
20067 : see if we need va_copy
20068 echo " "
20069 case "$i_stdarg" in
20070 "$define")
20071         $cat >try.c <<EOCP
20072 #include <stdarg.h>
20073 #include <stdio.h>
20074 #$i_stdlib I_STDLIB
20075 #ifdef I_STDLIB
20076 #include <stdlib.h>
20077 #endif
20078 #include <signal.h>
20079
20080 int
20081 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20082 {
20083   return vfprintf(f, fmt, *valp);
20084 }
20085
20086 int
20087 myvfprintf(FILE *f, const  char *fmt, va_list val)
20088 {
20089   return ivfprintf(f, fmt, &val);
20090 }
20091
20092 int
20093 myprintf(char *fmt, ...)
20094 {
20095   va_list val;
20096   va_start(val, fmt);
20097   return myvfprintf(stdout, fmt, val);
20098 }
20099
20100 int
20101 main(int ac, char **av)
20102 {
20103   signal(SIGSEGV, exit);
20104
20105   myprintf("%s%cs all right, then\n", "that", '\'');
20106   exit(0);
20107 }
20108 EOCP
20109         set try
20110         if eval $compile && $run ./try 2>&1 >/dev/null; then
20111                 case "`$run ./try`" in
20112                 "that's all right, then")
20113                         okay=yes
20114                         ;;
20115                 esac
20116         fi
20117         case "$okay" in
20118         yes)    echo "It seems that you don't need va_copy()." >&4
20119                 need_va_copy="$undef"
20120                 ;;
20121         *)      echo "It seems that va_copy() or similar will be needed." >&4
20122                 need_va_copy="$define"
20123                 ;;
20124         esac
20125         $rm_try
20126         ;;
20127 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20128         need_va_copy="$undef"
20129         ;;
20130 esac
20131
20132 : see what type is used for size_t
20133 rp="What is the type used for the length parameter for string functions?"
20134 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20135 eval $typedef_ask
20136
20137 : check for type of arguments to gethostbyaddr. 
20138 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20139         case "$d_gethbyaddr" in
20140         $define)
20141                 $cat <<EOM
20142
20143 Checking to see what type of arguments are accepted by gethostbyaddr().
20144 EOM
20145                 hdrs="$define sys/types.h
20146                         $d_socket sys/socket.h 
20147                         $i_niin netinet/in.h 
20148                         $i_netdb netdb.h
20149                         $i_unistd unistd.h"
20150                 : The first arg can 'char *' or 'void *'
20151                 : The second arg is some of integral type
20152                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20153                         for yyy in size_t long int; do
20154                                 case "$netdb_host_type" in
20155                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20156                                         if ./protochk "$try" $hdrs; then
20157                                                 echo "Your system accepts $xxx for the first arg."
20158                                                 echo "...and $yyy for the second arg."
20159                                                 netdb_host_type="$xxx"
20160                                                 netdb_hlen_type="$yyy"
20161                                         fi
20162                                         ;;
20163                                 esac
20164                         done
20165                 done
20166                 : In case none of those worked, prompt the user.
20167                 case "$netdb_host_type" in
20168                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20169                         dflt='char *'
20170                         . ./myread
20171                         netdb_host_type=$ans
20172                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20173                         dflt="$sizetype"
20174                         . ./myread
20175                         netdb_hlen_type=$ans
20176                         ;;
20177                 esac
20178                 ;;
20179         *)      : no gethostbyaddr, so pick harmless defaults
20180                 netdb_host_type='char *'
20181                 netdb_hlen_type="$sizetype"
20182                 ;;
20183         esac
20184         # Remove the "const" if needed. -- but then we'll have a 
20185         # prototype clash!
20186         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20187 fi
20188
20189 : check for type of argument to gethostbyname. 
20190 if test "X$netdb_name_type" = X ; then
20191         case "$d_gethbyname" in
20192         $define)
20193                 $cat <<EOM
20194
20195 Checking to see what type of argument is accepted by gethostbyname().
20196 EOM
20197                 hdrs="$define sys/types.h
20198                         $d_socket sys/socket.h 
20199                         $i_niin netinet/in.h 
20200                         $i_netdb netdb.h
20201                         $i_unistd unistd.h"
20202                 for xxx in "const char *" "char *"; do
20203                         case "$netdb_name_type" in
20204                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20205                                 if ./protochk "$try" $hdrs; then
20206                                         echo "Your system accepts $xxx."
20207                                         netdb_name_type="$xxx"
20208                                 fi
20209                                 ;;
20210                         esac
20211                 done
20212                 : In case none of those worked, prompt the user.
20213                 case "$netdb_name_type" in
20214                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20215                         dflt='char *'
20216                         . ./myread
20217                         netdb_name_type=$ans
20218                         ;;
20219                 esac
20220                 ;;
20221         *)      : no gethostbyname, so pick harmless default
20222                 netdb_name_type='char *'
20223                 ;;
20224         esac
20225 fi
20226
20227 : check for type of 1st argument to getnetbyaddr. 
20228 if test "X$netdb_net_type" = X ; then
20229         case "$d_getnbyaddr" in
20230         $define)
20231                 $cat <<EOM
20232
20233 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20234 EOM
20235                 hdrs="$define sys/types.h
20236                         $d_socket sys/socket.h 
20237                         $i_niin netinet/in.h 
20238                         $i_netdb netdb.h
20239                         $i_unistd unistd.h"
20240                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20241                         case "$netdb_net_type" in
20242                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20243                                 if ./protochk "$try" $hdrs; then
20244                                         echo "Your system accepts $xxx."
20245                                         netdb_net_type="$xxx"
20246                                 fi
20247                                 ;;
20248                         esac
20249                 done
20250                 : In case none of those worked, prompt the user.
20251                 case "$netdb_net_type" in
20252                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20253                         dflt='long'
20254                         . ./myread
20255                         netdb_net_type=$ans
20256                         ;;
20257                 esac
20258                 ;;
20259         *)      : no getnetbyaddr, so pick harmless default
20260                 netdb_net_type='long'
20261                 ;;
20262         esac
20263 fi
20264 : locate the preferred pager for this system
20265 fn=f/
20266 case "$pager" in
20267 '')
20268         dflt=''
20269         case "$pg" in
20270         /*) dflt=$pg;;
20271         [a-zA-Z]:/*) dflt=$pg;;
20272         esac
20273         case "$more" in
20274         /*) dflt=$more;;
20275         [a-zA-Z]:/*) dflt=$more;;
20276         esac
20277         case "$less" in
20278         /*) dflt=$less;;
20279         [a-zA-Z]:/*) dflt=$less;;
20280         esac
20281         case "$dflt" in
20282         '') dflt=/usr/ucb/more;;
20283         esac
20284         ;;
20285 *)      dflt="$pager"
20286         ;;
20287 esac
20288 fn="f/($dflt)"
20289 echo " "
20290 rp='What pager is used on your system?'
20291 . ./getfile
20292 pager="$ans"
20293
20294 : see what type pids are declared as in the kernel
20295 rp="What is the type of process ids on this system?"
20296 set pid_t pidtype int stdio.h sys/types.h
20297 eval $typedef_ask
20298
20299 : see if ar generates random libraries by itself
20300 echo " "
20301 echo "Checking how to generate random libraries on your machine..." >&4
20302 echo 'int bar1() { return bar2(); }' > bar1.c
20303 echo 'int bar2() { return 2; }' > bar2.c
20304 $cat > foo.c <<EOP
20305 #$i_stdlib I_STDLIB
20306 #ifdef I_STDLIB
20307 #include <stdlib.h>
20308 #endif
20309 int main() { printf("%d\n", bar1()); exit(0); }
20310 EOP
20311 $cc $ccflags -c bar1.c >/dev/null 2>&1
20312 $cc $ccflags -c bar2.c >/dev/null 2>&1
20313 $cc $ccflags -c foo.c >/dev/null 2>&1
20314 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20315 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20316         $run ./foobar >/dev/null 2>&1; then
20317         echo "$ar appears to generate random libraries itself."
20318         orderlib=false
20319         if [ "X$ranlib" = "X" ]; then
20320             ranlib=":"
20321         fi
20322 elif $ar s bar$_a >/dev/null 2>&1 &&
20323         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20324         $run ./foobar >/dev/null 2>&1; then
20325                 echo "a table of contents needs to be added with '$ar s'."
20326                 orderlib=false
20327                 ranlib="$ar s"
20328 elif $ar ts bar$_a >/dev/null 2>&1 &&
20329         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20330         $run ./foobar >/dev/null 2>&1; then
20331                 echo "a table of contents needs to be added with '$ar ts'."
20332                 orderlib=false
20333                 ranlib="$ar ts"
20334 else
20335         case "$ranlib" in
20336         :) ranlib='';;
20337         '')
20338                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20339                 $test -f $ranlib || ranlib=''
20340                 ;;
20341         esac
20342         if $test -n "$ranlib"; then
20343                 echo "your system has '$ranlib'; we'll use that."
20344                 orderlib=false
20345         else
20346                 echo "your system doesn't seem to support random libraries"
20347                 echo "so we'll use lorder and tsort to order the libraries."
20348                 orderlib=true
20349                 ranlib=":"
20350         fi
20351 fi
20352 $rm -f foo* bar*
20353
20354 : see if this is a values.h system
20355 set values.h i_values
20356 eval $inhdr
20357
20358 : Check the max offset that gmtime and localtime accept
20359 echo "Checking max offsets that gmtime () accepts"
20360
20361 case $i_values in
20362     define) yyy="#include <values.h>" ;;
20363     *)      yyy="" ;;
20364     esac
20365
20366 case "$sGMTIME_min/$sGMTIME_max" in
20367     0/0|/)
20368         $cat >try.c <<EOCP
20369 #include <sys/types.h>
20370 #include <stdio.h>
20371 #include <time.h>
20372 $yyy
20373
20374 int i;
20375 struct tm *tmp;
20376 time_t pt;
20377
20378 void gm_check (time_t t, int min_year, int max_year)
20379 {
20380     tmp = gmtime (&t);
20381     if ( tmp == NULL ||
20382         /* Check tm_year overflow */
20383          tmp->tm_year < min_year || tmp->tm_year > max_year)
20384         tmp = NULL;
20385     else
20386         pt = t;
20387     } /* gm_check */
20388
20389 int check_max ()
20390 {
20391     tmp = NULL;
20392     pt  = 0;
20393 #ifdef MAXLONG
20394     gm_check (MAXLONG, 69, 0x7fffffff);
20395 #endif
20396     if (tmp == NULL || tmp->tm_year < 0) {
20397         for (i = 63; i >= 0; i--) {
20398             time_t x = pt | ((time_t)1 << i);
20399             if (x < 0 || x < pt) continue;
20400             gm_check (x, 69, 0x7fffffff);
20401             }
20402         }
20403     printf ("sGMTIME_max=%ld\n", pt);
20404     return (0);
20405     } /* check_max */
20406
20407 int check_min ()
20408 {
20409     tmp = NULL;
20410     pt  = 0;
20411 #ifdef MINLONG
20412     gm_check (MINLONG, -1900, 70);
20413 #endif
20414     if (tmp == NULL) {
20415         for (i = 36; i >= 0; i--) {
20416             time_t x = pt - ((time_t)1 << i);
20417             if (x > 0) continue;
20418             gm_check (x, -1900, 70);
20419             }
20420         }
20421     printf ("sGMTIME_min=%ld\n", pt);
20422     return (0);
20423     } /* check_min */
20424
20425 int main (int argc, char *argv[])
20426 {
20427     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20428     check_max ();
20429     check_min ();
20430     return (0);
20431     } /* main */
20432 EOCP
20433         set try
20434         if eval $compile; then
20435             eval `$run ./try`
20436         else
20437             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20438             fi
20439         $rm_try
20440         ;;
20441     esac
20442
20443 echo "Checking max offsets that localtime () accepts"
20444
20445 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20446     0/0|/)
20447         $cat >try.c <<EOCP
20448 #include <sys/types.h>
20449 #include <stdio.h>
20450 #include <time.h>
20451 $yyy
20452
20453 int i;
20454 struct tm *tmp;
20455 time_t pt;
20456
20457 void local_check (time_t t, int min_year, int max_year)
20458 {
20459     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20460         tmp = NULL;
20461     else
20462         tmp = localtime (&t);
20463     if ( tmp == NULL ||
20464         /* Check tm_year overflow */
20465          tmp->tm_year < min_year || tmp->tm_year > max_year)
20466         tmp = NULL;
20467     else
20468         pt = t;
20469     } /* local_check */
20470
20471 int check_max ()
20472 {
20473     tmp = NULL;
20474     pt  = 0;
20475 #ifdef MAXLONG
20476     local_check (MAXLONG, 69, 0x7fffffff);
20477 #endif
20478     if (tmp == NULL || tmp->tm_year < 0) {
20479         for (i = 63; i >= 0; i--) {
20480             time_t x = pt | ((time_t)1 << i);
20481             if (x < 0 || x < pt) continue;
20482             local_check (x, 69, 0x7fffffff);
20483             }
20484         }
20485     printf ("sLOCALTIME_max=%ld\n", pt);
20486     return (0);
20487    } /* check_max */
20488
20489 int check_min ()
20490 {
20491     tmp = NULL;
20492     pt  = 0;
20493 #ifdef MINLONG
20494     local_check (MINLONG, -1900, 70);
20495 #endif
20496     if (tmp == NULL) {
20497         for (i = 36; i >= 0; i--) {
20498             time_t x = pt - ((time_t)1 << i);
20499             if (x > 0) continue;
20500             local_check (x, -1900, 70);
20501             }
20502         }
20503     printf ("sLOCALTIME_min=%ld\n", pt);
20504     return (0);
20505     } /* check_min */
20506
20507 int main (int argc, char *argv[])
20508 {
20509     check_max ();
20510     check_min ();
20511     return (0);
20512     } /* main */
20513 EOCP
20514         set try
20515         if eval $compile; then
20516             eval `$run ./try`
20517         else
20518             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20519             fi
20520         $rm_try
20521         ;;
20522     esac
20523
20524 : check for type of arguments to select.
20525 case "$selecttype" in
20526 '') case "$d_select" in
20527         $define)
20528                 echo " "
20529                 $cat <<EOM
20530 Checking to see what type of arguments are accepted by select().
20531 EOM
20532                 hdrs="$define sys/types.h
20533                         $i_systime sys/time.h
20534                         $i_sysselct sys/select.h
20535                         $d_socket sys/socket.h"
20536                 : The first arg can be int, unsigned, or size_t
20537                 : The last arg may or may not be 'const'
20538                 val=''
20539                 : void pointer has been seen but using that
20540                 : breaks the selectminbits test
20541                 for xxx in 'fd_set *' 'int *'; do
20542                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20543                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20544                                         case "$val" in
20545                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20546                                                 if ./protochk "$try" $hdrs; then
20547                                                         echo "Your system accepts $xxx."
20548                                                         val="$xxx"
20549                                                 fi
20550                                                 ;;
20551                                         esac
20552                                 done
20553                         done
20554                 done
20555                 case "$val" in
20556                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20557                         case "$d_fd_set" in
20558                                 $define) dflt="fd_set *" ;;
20559                                 *)              dflt="int *" ;;
20560                         esac
20561                         . ./myread
20562                         val=$ans
20563                         ;;
20564                 esac
20565                 selecttype="$val"
20566                 ;;
20567         *)      : no select, so pick a harmless default
20568                 selecttype='int *'
20569                 ;;
20570         esac
20571         ;;
20572 esac
20573
20574 : check for the select 'width'
20575 case "$selectminbits" in
20576 '') safebits=`expr $ptrsize \* 8`
20577     case "$d_select" in
20578         $define)
20579                 $cat <<EOM
20580
20581 Checking to see on how many bits at a time your select() operates...
20582 EOM
20583                 $cat >try.c <<EOCP
20584 #include <sys/types.h>
20585 #$i_time I_TIME
20586 #$i_systime I_SYS_TIME
20587 #$i_systimek I_SYS_TIME_KERNEL
20588 #ifdef I_TIME
20589 #   include <time.h>
20590 #endif
20591 #ifdef I_SYS_TIME
20592 #   ifdef I_SYS_TIME_KERNEL
20593 #       define KERNEL
20594 #   endif
20595 #   include <sys/time.h>
20596 #   ifdef I_SYS_TIME_KERNEL
20597 #       undef KERNEL
20598 #   endif
20599 #endif
20600 #$i_sysselct I_SYS_SELECT
20601 #ifdef I_SYS_SELECT
20602 #include <sys/select.h>
20603 #endif
20604 #$d_socket HAS_SOCKET
20605 #ifdef HAS_SOCKET
20606 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20607 #endif
20608 #include <stdio.h>
20609 #$i_stdlib I_STDLIB
20610 #ifdef I_STDLIB
20611 #include <stdlib.h>
20612 #endif
20613 $selecttype b;
20614 #define S sizeof(*(b))
20615 #define MINBITS 64
20616 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20617 #define NBITS  (NBYTES * 8)
20618 int main() {
20619     char *s = (char *)malloc(NBYTES);
20620     struct timeval t;
20621     int i;
20622     FILE* fp;
20623     int fd;
20624
20625     if (!s)
20626         exit(1);
20627     fclose(stdin);
20628     fp = fopen("try.c", "r");
20629     if (fp == 0)
20630       exit(2);
20631     fd = fileno(fp);
20632     if (fd < 0)
20633       exit(3);
20634     b = ($selecttype)s;
20635     for (i = 0; i < NBITS; i++)
20636         FD_SET(i, b);
20637     t.tv_sec  = 0;
20638     t.tv_usec = 0;
20639     select(fd + 1, b, 0, 0, &t);
20640     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20641     free(s);
20642     printf("%d\n", i + 1);
20643     return 0;
20644 }
20645 EOCP
20646                 set try
20647                 if eval $compile_ok; then
20648                         selectminbits=`$run ./try`
20649                         case "$selectminbits" in
20650                         '')     cat >&4 <<EOM
20651 Cannot figure out on how many bits at a time your select() operates.
20652 I'll play safe and guess it is $safebits bits.
20653 EOM
20654                                 selectminbits=$safebits
20655                                 bits="$safebits bits"
20656                                 ;;
20657                         1)      bits="1 bit" ;;
20658                         *)      bits="$selectminbits bits" ;;
20659                         esac
20660                         echo "Your select() operates on $bits at a time." >&4
20661                 else
20662                         rp='What is the minimum number of bits your select() operates on?'
20663                         case "$byteorder" in
20664                         12345678)       dflt=64 ;;
20665                         1234)           dflt=32 ;;
20666                         *)              dflt=1  ;;
20667                         esac
20668                         . ./myread
20669                         val=$ans
20670                         selectminbits="$val"
20671                 fi
20672                 $rm_try
20673                 ;;
20674         *)      : no select, so pick a harmless default
20675                 selectminbits=$safebits
20676                 ;;
20677         esac
20678         ;;
20679 esac
20680
20681 : Trace out the files included by signal.h, then look for SIGxxx names.
20682 if [ "X$fieldn" = X ]; then
20683         : Just make some guesses.  We check them later.
20684         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20685 else
20686         xxx=`echo '#include <signal.h>' |
20687         $cppstdin $cppminus $cppflags 2>/dev/null |
20688         $grep '^[       ]*#.*include' |
20689         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20690                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20691 fi
20692 xxxfiles=''
20693 for xx in $xxx /dev/null ; do
20694         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20695 done
20696 case "$xxxfiles" in
20697 '')     xxxfiles=`./findhdr signal.h` ;;
20698 esac
20699 xxx=`awk '
20700 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20701         print substr($2, 4, 20)
20702 }
20703 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20704         print substr($3, 4, 20)
20705 }' $xxxfiles`
20706 : Append some common names just in case the awk scan failed.
20707 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20708 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20709 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20710 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20711 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20712
20713 : generate a few handy files for later
20714 $cat > signal.c <<EOCP
20715 #include <sys/types.h>
20716 #include <signal.h>
20717 #$i_stdlib I_STDLIB
20718 #ifdef I_STDLIB
20719 #include <stdlib.h>
20720 #endif
20721 #include <stdio.h>
20722 int main() {
20723
20724 /* Strange style to avoid deeply-nested #if/#else/#endif */
20725 #ifndef NSIG
20726 #  ifdef _NSIG
20727 #    define NSIG (_NSIG)
20728 #  endif
20729 #endif
20730
20731 #ifndef NSIG
20732 #  ifdef SIGMAX
20733 #    define NSIG (SIGMAX+1)
20734 #  endif
20735 #endif
20736
20737 #ifndef NSIG
20738 #  ifdef SIG_MAX
20739 #    define NSIG (SIG_MAX+1)
20740 #  endif
20741 #endif
20742
20743 #ifndef NSIG
20744 #  ifdef _SIG_MAX
20745 #    define NSIG (_SIG_MAX+1)
20746 #  endif
20747 #endif
20748
20749 #ifndef NSIG
20750 #  ifdef MAXSIG
20751 #    define NSIG (MAXSIG+1)
20752 #  endif
20753 #endif
20754
20755 #ifndef NSIG
20756 #  ifdef MAX_SIG
20757 #    define NSIG (MAX_SIG+1)
20758 #  endif
20759 #endif
20760
20761 #ifndef NSIG
20762 #  ifdef SIGARRAYSIZE
20763 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20764 #  endif
20765 #endif
20766
20767 #ifndef NSIG
20768 #  ifdef _sys_nsig
20769 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20770 #  endif
20771 #endif
20772
20773 /* Default to some arbitrary number that's big enough to get most
20774    of the common signals.
20775 */
20776 #ifndef NSIG
20777 #    define NSIG 50
20778 #endif
20779
20780 printf("NSIG %d\n", NSIG);
20781
20782 #ifndef JUST_NSIG
20783
20784 EOCP
20785
20786 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20787 {
20788         printf "#ifdef SIG"; printf $1; printf "\n"
20789         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20790         printf $1; printf ");\n"
20791         printf "#endif\n"
20792 }
20793 END {
20794         printf "#endif /* JUST_NSIG */\n";
20795         printf "exit(0);\n}\n";
20796 }
20797 ' >>signal.c
20798 $cat >signal.awk <<'EOP'
20799 BEGIN { ndups = 0 }
20800 $1 ~ /^NSIG$/ { nsig = $2 }
20801 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20802     if ($2 > maxsig) { maxsig = $2 }
20803     if (sig_name[$2]) {
20804         dup_name[ndups] = $1
20805         dup_num[ndups] = $2
20806         ndups++
20807     }
20808     else {
20809         sig_name[$2] = $1
20810         sig_num[$2] = $2
20811     }
20812 }
20813 END {
20814     if (nsig == 0) {
20815         nsig = maxsig + 1
20816     }
20817     printf("NSIG %d\n", nsig);
20818     for (n = 1; n < nsig; n++) {
20819         if (sig_name[n]) {
20820             printf("%s %d\n", sig_name[n], sig_num[n])
20821         }
20822         else {
20823             printf("NUM%d %d\n", n, n)
20824         }
20825     }
20826     for (n = 0; n < ndups; n++) {
20827         printf("%s %d\n", dup_name[n], dup_num[n])
20828     }
20829 }
20830 EOP
20831 $cat >signal_cmd <<EOS
20832 $startsh
20833 if $test -s signal.lst; then
20834     echo "Using your existing signal.lst file"
20835         exit 0
20836 fi
20837 xxx="$xxx"
20838 EOS
20839 $cat >>signal_cmd <<'EOS'
20840
20841 set signal
20842 if eval $compile_ok; then
20843         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20844                 $uniq | $awk -f signal.awk >signal.lst
20845 else
20846         echo "(I can't seem be able to compile the whole test program)" >&4
20847         echo "(I'll try it in little pieces.)" >&4
20848         set signal -DJUST_NSIG
20849         if eval $compile_ok; then
20850                 $run ./signal$_exe > signal.nsg
20851                 $cat signal.nsg
20852         else
20853                 echo "I can't seem to figure out how many signals you have." >&4
20854                 echo "Guessing 50." >&4
20855                 echo 'NSIG 50' > signal.nsg
20856         fi
20857         : Now look at all the signal names, one at a time.
20858         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20859                 $cat > signal.c <<EOCP
20860 #include <sys/types.h>
20861 #include <signal.h>
20862 #include <stdio.h>
20863 int main() {
20864 printf("$xx %d\n", SIG${xx});
20865 return 0;
20866 }
20867 EOCP
20868                 set signal
20869                 if eval $compile; then
20870                         echo "SIG${xx} found."
20871                         $run ./signal$_exe  >> signal.ls1
20872                 else
20873                         echo "SIG${xx} NOT found."
20874                 fi
20875         done
20876         if $test -s signal.ls1; then
20877                 $cat signal.nsg signal.ls1 |
20878                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20879         fi
20880
20881 fi
20882 if $test -s signal.lst; then
20883         :
20884 else
20885         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20886         echo 'kill -l' >signal
20887         set X `csh -f <signal`
20888         $rm -f signal
20889         shift
20890         case $# in
20891         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20892         esac
20893         echo $@ | $tr ' ' $trnl | \
20894             $awk '{ printf "%s %d\n", $1, ++s; }
20895                   END { printf "NSIG %d\n", ++s }' >signal.lst
20896 fi
20897 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20898 EOS
20899 chmod a+x signal_cmd
20900 $eunicefix signal_cmd
20901
20902 : generate list of signal names
20903 echo " "
20904 case "$sig_name_init" in
20905 '') doinit=yes ;;
20906 *)  case "$sig_num_init" in
20907     ''|*,*) doinit=yes ;;
20908     esac ;;
20909 esac
20910 case "$doinit" in
20911 yes)
20912         echo "Generating a list of signal names and numbers..." >&4
20913         . ./signal_cmd
20914         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20915         sig_name=`$awk 'BEGIN { printf "ZERO " }
20916                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20917         sig_num=`$awk  'BEGIN { printf "0 " }
20918                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20919         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20920                              !/^NSIG/   { printf "\"%s\", ", $1 }
20921                              END        { printf "0\n" }' signal.lst`
20922         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20923                              !/^NSIG/   { printf "%d, ", $2}
20924                              END        { printf "0\n"}' signal.lst`
20925         ;;
20926 esac
20927 echo "The following $sig_count signals are available:"
20928 echo " "
20929 echo $sig_name | $awk \
20930 'BEGIN { linelen = 0 }
20931 {
20932         for (i = 1; i <= NF; i++) {
20933                 name = "SIG" $i " "
20934                 linelen = linelen + length(name)
20935                 if (linelen > 70) {
20936                         printf "\n"
20937                         linelen = length(name)
20938                 }
20939                 printf "%s", name
20940         }
20941         printf "\n"
20942 }'
20943 sig_size=`echo $sig_name | awk '{print NF}'`
20944 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20945
20946 : Check size of size
20947 echo " "
20948 case "$sizetype" in
20949 *_t) zzz="$sizetype"    ;;
20950 *)   zzz="filesize"     ;;
20951 esac
20952 echo "Checking the size of $zzz..." >&4
20953 cat > try.c <<EOCP
20954 #include <sys/types.h>
20955 #include <stdio.h>
20956 #$i_stdlib I_STDLIB
20957 #ifdef I_STDLIB
20958 #include <stdlib.h>
20959 #endif
20960 int main() {
20961     printf("%d\n", (int)sizeof($sizetype));
20962     exit(0);
20963 }
20964 EOCP
20965 set try
20966 if eval $compile_ok; then
20967         yyy=`$run ./try`
20968         case "$yyy" in
20969         '')     sizesize=4
20970                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20971                 ;;
20972         *)      sizesize=$yyy
20973                 echo "Your $zzz size is $sizesize bytes."
20974                 ;;
20975         esac
20976 else
20977         sizesize=4
20978         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20979 fi
20980
20981
20982 : check for socklen_t
20983 echo " "
20984 echo "Checking to see if you have socklen_t..." >&4
20985 $cat >try.c <<EOCP
20986 #include <sys/types.h>
20987 #$d_socket HAS_SOCKET
20988 #ifdef HAS_SOCKET
20989 #include <sys/socket.h>
20990 #endif
20991 int main() { socklen_t x = 16; }
20992 EOCP
20993 set try
20994 if eval $compile; then
20995         val="$define"
20996         echo "You have socklen_t."
20997 else
20998         val="$undef"
20999         echo "You do not have socklen_t."
21000         case "$sizetype" in
21001         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21002         esac
21003 fi
21004 $rm_try
21005 set d_socklen_t
21006 eval $setvar
21007
21008 : see if this is a socks.h system
21009 set socks.h i_socks
21010 eval $inhdr
21011
21012 : check for type of the size argument to socket calls
21013 case "$d_socket" in
21014 "$define")
21015         $cat <<EOM
21016
21017 Checking to see what type is the last argument of accept().
21018 EOM
21019         yyy=''
21020         case "$d_socklen_t" in
21021         "$define") yyy="$yyy socklen_t"
21022         esac
21023         yyy="$yyy $sizetype int long unsigned"
21024         for xxx in $yyy; do
21025                 case "$socksizetype" in
21026                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21027                         case "$usesocks" in
21028                         "$define")
21029                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21030                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21031                                         socksizetype="$xxx"
21032                                 fi
21033                                 ;;
21034                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21035                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21036                                         socksizetype="$xxx"
21037                                 fi
21038                                 ;;
21039                         esac
21040                         ;;
21041                 esac
21042         done
21043 : In case none of those worked, prompt the user.
21044         case "$socksizetype" in
21045         '')     rp='What is the type for socket address structure sizes?'
21046                 dflt='int'
21047                 . ./myread
21048                 socksizetype=$ans
21049                 ;;
21050         esac
21051         ;;
21052 *)      : no sockets, so pick relatively harmless default
21053         socksizetype='int'
21054         ;;
21055 esac
21056
21057 : see what type is used for signed size_t
21058 set ssize_t ssizetype int stdio.h sys/types.h
21059 eval $typedef
21060 dflt="$ssizetype"
21061 $cat > try.c <<EOM
21062 #include <stdio.h>
21063 #$i_stdlib I_STDLIB
21064 #ifdef I_STDLIB
21065 #include <stdlib.h>
21066 #endif
21067 #include <sys/types.h>
21068 #define Size_t $sizetype
21069 #define SSize_t $dflt
21070 int main()
21071 {
21072         if (sizeof(Size_t) == sizeof(SSize_t))
21073                 printf("$dflt\n");
21074         else if (sizeof(Size_t) == sizeof(int))
21075                 printf("int\n");
21076         else
21077                 printf("long\n");
21078         exit(0);
21079 }
21080 EOM
21081 echo " "
21082 set try
21083 if eval $compile_ok && $run ./try > /dev/null; then
21084         ssizetype=`$run ./try`
21085         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21086 else
21087         $cat >&4 <<EOM
21088 Help! I can't compile and run the ssize_t test program: please enlighten me!
21089 (This is probably a misconfiguration in your system or libraries, and
21090 you really ought to fix it.  Still, I'll try anyway.)
21091
21092 I need a type that is the same size as $sizetype, but is guaranteed to
21093 be signed.  Common values are ssize_t, int and long.
21094
21095 EOM
21096         rp="What signed type is the same size as $sizetype?"
21097         . ./myread
21098         ssizetype="$ans"
21099 fi
21100 $rm_try
21101
21102 : Check the size of st_ino
21103 $echo " "
21104 $echo "Checking the size of st_ino..." >&4
21105 $cat > try.c <<EOCP
21106 #include <sys/stat.h>
21107 #include <stdio.h>
21108 #$i_stdlib I_STDLIB
21109 #ifdef I_STDLIB
21110 #include <stdlib.h>
21111 #endif
21112 int main() {
21113     struct stat st;
21114     printf("%d\n", (int)sizeof(st.st_ino));
21115     exit(0);
21116 }
21117 EOCP
21118 set try
21119 if eval $compile_ok; then
21120         val=`$run ./try`
21121         case "$val" in
21122         '')     st_ino_size=4
21123                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21124                 ;;
21125         *)      st_ino_size=$val
21126                 $echo "Your st_ino is $st_ino_size bytes long."
21127                 ;;
21128         esac
21129 else
21130         st_ino_size=4
21131         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21132 fi
21133 $rm_try
21134
21135 : Check if st_ino is signed
21136 $echo " "
21137 $echo "Checking the sign of st_ino..." >&4
21138 $cat > try.c <<EOCP
21139 #include <sys/stat.h>
21140 #include <stdio.h>
21141 int main() {
21142         struct stat foo;
21143         foo.st_ino = -1;
21144         if (foo.st_ino < 0)
21145                 printf("-1\n");
21146         else
21147                 printf("1\n");
21148 }
21149 EOCP
21150 set try
21151 if eval $compile; then
21152         val=`$run ./try`
21153         case "$val" in
21154         '')     st_ino_sign=1
21155                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
21156                 ;;
21157         *)      st_ino_sign=$val
21158                 case "$st_ino_sign" in
21159                  1) $echo "Your st_ino is unsigned." ;;
21160                 -1) $echo "Your st_ino is signed."   ;;
21161                 esac
21162                 ;;
21163         esac
21164 else
21165         st_ino_sign=1
21166         $echo "(I can't compile the test program--guessing unsigned.)" >&4
21167 fi
21168 $rm_try
21169
21170 : see what type of char stdio uses.
21171 echo " "
21172 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21173 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21174         echo "Your stdio uses unsigned chars." >&4
21175         stdchar="unsigned char"
21176 else
21177         echo "Your stdio uses signed chars." >&4
21178         stdchar="char"
21179 fi
21180 $rm -f stdioh
21181
21182 : see what type uids are declared as in the kernel
21183 echo " "
21184 echo "Looking for the type for user ids returned by getuid()."
21185 set uid_t uidtype xxx stdio.h sys/types.h
21186 eval $typedef
21187 case "$uidtype" in
21188 xxx)
21189         xxx=`./findhdr sys/user.h`
21190         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21191         case $1 in
21192         unsigned) dflt="$1 $2" ;;
21193         *) dflt="$1" ;;
21194         esac
21195         ;;
21196 *) dflt="$uidtype";;
21197 esac
21198 case "$uidtype" in
21199 uid_t)  echo "uid_t found." ;;
21200 *)      rp="What is the type for user ids returned by getuid()?"
21201         . ./myread
21202         uidtype="$ans"
21203         ;;
21204 esac
21205
21206 : Check size of UID
21207 echo " "
21208 case "$uidtype" in
21209 *_t) zzz="$uidtype"     ;;
21210 *)   zzz="uid"          ;;
21211 esac
21212 echo "Checking the size of $zzz..." >&4
21213 cat > try.c <<EOCP
21214 #include <sys/types.h>
21215 #include <stdio.h>
21216 #$i_stdlib I_STDLIB
21217 #ifdef I_STDLIB
21218 #include <stdlib.h>
21219 #endif
21220 int main() {
21221     printf("%d\n", (int)sizeof($uidtype));
21222     exit(0);
21223 }
21224 EOCP
21225 set try
21226 if eval $compile_ok; then
21227         yyy=`$run ./try`
21228         case "$yyy" in
21229         '')     uidsize=4
21230                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21231                 ;;
21232         *)      uidsize=$yyy
21233                 echo "Your $zzz is $uidsize bytes long."
21234                 ;;
21235         esac
21236 else
21237         uidsize=4
21238         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21239 fi
21240
21241 : Check if UID is signed
21242 echo " "
21243 case "$uidtype" in
21244 *_t) zzz="$uidtype"     ;;
21245 *)   zzz="uid"          ;;
21246 esac
21247 echo "Checking the sign of $zzz..." >&4
21248 cat > try.c <<EOCP
21249 #include <sys/types.h>
21250 #include <stdio.h>
21251 int main() {
21252         $uidtype foo = -1;
21253         if (foo < 0)
21254                 printf("-1\n");
21255         else
21256                 printf("1\n");
21257 }
21258 EOCP
21259 set try
21260 if eval $compile; then
21261         yyy=`$run ./try`
21262         case "$yyy" in
21263         '')     uidsign=1
21264                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21265                 ;;
21266         *)      uidsign=$yyy
21267                 case "$uidsign" in
21268                  1) echo "Your $zzz is unsigned." ;;
21269                 -1) echo "Your $zzz is signed."   ;;
21270                 esac
21271                 ;;
21272         esac
21273 else
21274         uidsign=1
21275         echo "(I can't compile the test program--guessing unsigned.)" >&4
21276 fi
21277
21278
21279 : Check format string for UID
21280 echo " "
21281 $echo "Checking the format string to be used for uids..." >&4
21282
21283 case "$uidsign" in
21284 -1)     if $test X"$uidsize" = X"$ivsize"; then
21285                 uidformat="$ivdformat"
21286         else
21287                 if $test X"$uidsize" = X"$longsize"; then
21288                         uidformat='"ld"'
21289                 else
21290                         if $test X"$uidsize" = X"$intsize"; then
21291                                 uidformat='"d"'
21292                         else
21293                                 if $test X"$uidsize" = X"$shortsize"; then
21294                                         uidformat='"hd"'
21295                                 fi
21296                         fi
21297                 fi
21298         fi
21299         ;;
21300 *)      if $test X"$uidsize" = X"$uvsize"; then
21301                 uidformat="$uvuformat"
21302         else
21303                 if $test X"$uidsize" = X"$longsize"; then
21304                         uidformat='"lu"'
21305                 else
21306                         if $test X"$uidsize" = X"$intsize"; then
21307                                 uidformat='"u"'
21308                         else
21309                                 if $test X"$uidsize" = X"$shortsize"; then
21310                                         uidformat='"hu"'
21311                                 fi
21312                         fi
21313                 fi
21314         fi
21315         ;;
21316 esac
21317
21318 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
21319 echo " "
21320 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
21321 $cat >try.c <<'EOM'
21322 /* Intentionally a long probe as I'd like to sanity check that the exact
21323    approach is going to work, as thinking it will work, but only having it
21324    part working at runtime is worse than not having it.  */
21325
21326 #include <sys/types.h>
21327 #include <sys/sysctl.h>
21328 #include <sys/param.h>
21329 #include <stdio.h>
21330 #include <string.h>
21331 #include <stdlib.h>
21332 #include <unistd.h>
21333
21334 int
21335 main(int argc, char **argv) {
21336     char *buffer;
21337     char *argv_leaf = strrchr(argv[0], '/');
21338     char *buffer_leaf;
21339     size_t size = 0;
21340     int mib[4];
21341
21342     mib[0] = CTL_KERN;
21343     mib[1] = KERN_PROC;
21344     mib[2] = KERN_PROC_PATHNAME;
21345     mib[3] = -1;
21346
21347     if (!argv_leaf) {
21348         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21349         return 1;
21350     }
21351
21352     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
21353         perror("sysctl");
21354         return 2;
21355     }
21356
21357     if (size < strlen(argv_leaf) + 1) {
21358         fprintf(stderr, "size %lu is too short for a path\n",
21359                 (unsigned long) size);
21360         return 3;
21361     }
21362
21363     if (size > MAXPATHLEN * MAXPATHLEN) {
21364         fprintf(stderr, "size %lu is too long for a path\n",
21365                 (unsigned long) size);
21366         return 4;
21367     }
21368
21369     buffer = malloc(size);
21370     if (!buffer) {
21371         perror("malloc");
21372         return 5;
21373     }
21374
21375     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
21376         perror("sysctl");
21377         return 6;
21378     }
21379
21380     if (strlen(buffer) + 1 != size) {
21381         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
21382                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
21383         return 7;
21384     }
21385
21386
21387     if (*buffer != '/') {
21388         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
21389         return 8;
21390     }
21391
21392     if (strstr(buffer, "/./")) {
21393         fprintf(stderr, "Contains /./: '%s'\n", buffer);
21394         return 9;
21395     }
21396
21397     if (strstr(buffer, "/../")) {
21398         fprintf(stderr, "Contains /../: '%s'\n", buffer);
21399         return 10;
21400     }
21401
21402     buffer_leaf = strrchr(buffer, '/');
21403     if (strcmp(buffer_leaf, argv_leaf) != 0) {
21404         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
21405         return 11;
21406     }
21407
21408     free(buffer);
21409
21410     return 0;
21411 }
21412 EOM
21413
21414 val=$undef
21415 set try
21416 if eval $compile; then
21417         if $run ./try; then
21418                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
21419                 val="$define"
21420         else
21421                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
21422                 val="$undef"
21423         fi
21424 else
21425         echo "I'm unable to compile the test program." >&4
21426         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
21427         val="$undef"
21428 fi
21429 $rm_try
21430 set usekernprocpathname
21431 eval $setvar
21432
21433 : Determine if we can use _NSGetExecutablePath to find executing program
21434 echo " "
21435 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
21436 $cat >try.c <<'EOM'
21437 /* Intentionally a long probe as I'd like to sanity check that the exact
21438    approach is going to work, as thinking it will work, but only having it
21439    part working at runtime is worse than not having it.  */
21440 #include <mach-o/dyld.h>
21441 #include <stdio.h>
21442 #include <stdlib.h>
21443 #include <sys/param.h>
21444 #include <string.h>
21445
21446 int
21447 main(int argc, char **argv) {
21448     char buf[1];
21449     uint32_t size = sizeof(buf);
21450     int result;
21451     char *buffer;
21452     char *tidied;
21453     char *argv_leaf = strrchr(argv[0], '/');
21454     char *tidied_leaf;
21455
21456     if (!argv_leaf) {
21457         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21458         return 1;
21459     }
21460
21461     _NSGetExecutablePath(buf, &size);
21462     if (size > MAXPATHLEN * MAXPATHLEN) {
21463         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
21464                 (unsigned int) size);
21465         return 2;
21466     }
21467
21468     buffer = malloc(size);
21469     if (!buffer) {
21470         perror("malloc");
21471         return 3;
21472     }
21473
21474     result = _NSGetExecutablePath(buffer, &size);
21475     if (result != 0) {
21476         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
21477                 result, (unsigned int) size);
21478         return 4;
21479     }
21480
21481     tidied = realpath(buffer, NULL);
21482     if (!tidied) {
21483         perror("realpath");
21484         return 5;
21485     }
21486
21487     free(buffer);
21488
21489     if (*tidied != '/') {
21490         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
21491         return 6;
21492     }
21493
21494     if (strstr(tidied, "/./")) {
21495         fprintf(stderr, "Contains /./: '%s'\n", tidied);
21496         return 7;
21497     }
21498
21499     if (strstr(tidied, "/../")) {
21500         fprintf(stderr, "Contains /../: '%s'\n", tidied);
21501         return 8;
21502     }
21503
21504     tidied_leaf = strrchr(tidied, '/');
21505     if (strcmp(tidied_leaf, argv_leaf) != 0) {
21506         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
21507         return 9;
21508     }
21509
21510     free(tidied);
21511
21512     return 0;
21513 }
21514 EOM
21515
21516 val=$undef
21517 set try
21518 if eval $compile; then
21519         if $run ./try; then
21520                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
21521                 val="$define"
21522         else
21523                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
21524         fi
21525 else
21526         echo "I'm unable to compile the test program." >&4
21527         echo "I'll assume no _NSGetExecutablePath here." >&4
21528 fi
21529 $rm_try
21530 set usensgetexecutablepath
21531 eval $setvar
21532
21533 : Check if site customization support was requested
21534 case "$usesitecustomize" in
21535     $define|true|[Yy]*)
21536         usesitecustomize="$define"
21537         ;;
21538     *)
21539         usesitecustomize="$undef"
21540         ;;
21541     esac
21542
21543 : see if prototypes support variable argument declarations
21544 echo " "
21545 case "$prototype$i_stdarg" in
21546 $define$define)
21547         echo "It appears we'll be able to prototype varargs functions." >&4
21548         val="$define"
21549         ;;
21550 *)
21551         echo "Too bad... We won't be using prototyped varargs functions..." >&4
21552         val="$undef"
21553         ;;
21554 esac
21555 set vaproto
21556 eval $setvar
21557
21558 : determine compiler compiler
21559 case "$yacc" in
21560 '')
21561         dflt=yacc;;
21562 *)
21563         dflt="$yacc";;
21564 esac
21565 echo " "
21566 comp='yacc'
21567 if $test -f "$byacc$_exe"; then
21568         dflt="$byacc"
21569         comp="byacc or $comp"
21570 fi
21571 if $test -f "$bison$_exe"; then
21572         comp="$comp or bison -y"
21573 fi
21574 rp="Which compiler compiler ($comp) shall I use?"
21575 . ./myread
21576 yacc="$ans"
21577 case "$yacc" in
21578 *bis*)
21579         case "$yacc" in
21580         *-y*) ;;
21581         *)
21582                 yacc="$yacc -y"
21583                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
21584                 ;;
21585         esac
21586         ;;
21587 esac
21588
21589 : see if this is a assert.h system
21590 set assert.h i_assert
21591 eval $inhdr
21592
21593 : see if this is a fp.h system
21594 set fp.h i_fp
21595 eval $inhdr
21596
21597 : see if this is a fp_class.h system
21598 set fp_class.h i_fp_class
21599 eval $inhdr
21600
21601 : see if gdbm.h is available
21602 set gdbm.h t_gdbm
21603 eval $inhdr
21604 case "$t_gdbm" in
21605 $define)
21606         : see if gdbm_open exists
21607         set gdbm_open d_gdbm_open
21608         eval $inlibc
21609         case "$d_gdbm_open" in
21610         $undef)
21611                 t_gdbm="$undef"
21612                 echo "We won't be including <gdbm.h>"
21613                 ;;
21614         esac
21615         ;;
21616 esac
21617 val="$t_gdbm"
21618 set i_gdbm
21619 eval $setvar
21620
21621 : see if this is a ieeefp.h system
21622 case "$i_ieeefp" in
21623 '' ) set ieeefp.h i_ieeefp
21624      eval $inhdr
21625      ;;
21626 esac
21627
21628 : see if this is a libutil.h system
21629 set libutil.h i_libutil
21630 eval $inhdr
21631
21632 : see if mach cthreads are available
21633 if test "X$usethreads" = "X$define"; then
21634         set mach/cthreads.h i_machcthr
21635         eval $inhdr
21636 else
21637         i_machcthr="$undef"
21638 fi
21639
21640 : see if this is a mntent.h system
21641 set mntent.h i_mntent
21642 eval $inhdr
21643
21644 : see if net/errno.h is available
21645 val=''
21646 set net/errno.h val
21647 eval $inhdr
21648
21649 : Unfortunately, it causes problems on some systems.  Arrgh.
21650 case "$val" in
21651 $define)
21652         cat > try.c <<'EOM'
21653 #include <stdio.h>
21654 #include <errno.h>
21655 #include <net/errno.h>
21656 int func()
21657 {
21658         return ENOTSOCK;
21659 }
21660 EOM
21661         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21662                 echo "We'll be including <net/errno.h>." >&4
21663         else
21664                 echo "We won't be including <net/errno.h>." >&4
21665                 val="$undef"
21666         fi
21667         $rm_try
21668         ;;
21669 esac
21670 set i_neterrno
21671 eval $setvar
21672
21673 : see if netinet/tcp.h is available
21674 set netinet/tcp.h i_netinettcp
21675 eval $inhdr
21676
21677 : see if this is a poll.h system
21678 set poll.h i_poll
21679 eval $inhdr
21680
21681 : see if this is a prot.h system
21682 set prot.h i_prot
21683 eval $inhdr
21684
21685 : Preprocessor symbols
21686 echo " "
21687 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21688 $cat <<'EOSH' > Cppsym.know
21689 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21690 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21691 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21692 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21693 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21694 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21695 bull c cadmus clipper CMU COFF COMPILER_VERSION
21696 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21697 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21698 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21699 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21700 GLIBC GLIBC_MINOR
21701 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21702 H3050R H3050RX hbullx20 hcx host_mips
21703 hp200 hp300 hp700 HP700 hp800 hp9000
21704 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21705 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21706 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21707 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21708 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21709 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21710 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21711 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21712 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21713 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21714 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21715 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21716 MATH_HAS_NO_SIDE_EFFECTS
21717 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21718 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21719 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21720 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21721 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21722 NetBSD news1500 news1700 news1800 news1900 news3700
21723 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21724 ns32016 ns32332 ns32k nsc32000
21725 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21726 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21727 pc532 pdp11 PGC PIC plexus PORTAR posix
21728 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21729 POSIX_C_SOURCE POSIX_SOURCE POWER
21730 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21731 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21732 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21733 sony sony_news sonyrisc sparc sparclite spectrum
21734 stardent stdc STDC_EXT stratos sun sun3 sun386
21735 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21736 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21737 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21738 sysV68 sysV88 Tek4132 Tek4300 titan
21739 TM3200 TM5400 TM5600
21740 tower tower32 tower32_200 tower32_600 tower32_700
21741 tower32_800 tower32_850 tss
21742 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21743 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21744 unix UNIX95 UNIX99 unixpc unos
21745 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21746 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21747 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21748 USGr4 USGr4_2
21749 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21750 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21751 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21752 z8000
21753 EOSH
21754 # Maybe put other stuff here too.
21755 cat <<EOSH >>Cppsym.know
21756 $osname
21757 EOSH
21758 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21759 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21760 $cat Cppsym.know > Cppsym.c
21761 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21762 $rm -f Cppsym.a Cppsym.b Cppsym.c
21763 cat <<EOSH > Cppsym
21764 $startsh
21765 if $test \$# -gt 0; then
21766     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21767     if $test -s Cppsym.got; then
21768         $rm -f Cppsym.got
21769         exit 0
21770     fi
21771     $rm -f Cppsym.got
21772     exit 1
21773 else
21774     $tr " " "$trnl" | ./Cppsym.try
21775     exit 0
21776 fi
21777 EOSH
21778 chmod +x Cppsym
21779 $eunicefix Cppsym
21780 cat <<EOSH > Cppsym.try
21781 $startsh
21782 cat <<'EOCP' > try.c
21783 #include <stdio.h>
21784 #if cpp_stuff == 1
21785 #define STRINGIFY(a)    "a"
21786 #endif
21787 #if cpp_stuff == 42
21788 #define StGiFy(a)  #a
21789 #define STRINGIFY(a)    StGiFy(a)
21790 #endif
21791 #if $cpp_stuff != 1 && $cpp_stuff != 42
21792 #   include "Bletch: How does this C preprocessor stringify macros?"
21793 #endif
21794 int main() {
21795 EOCP
21796 $awk \\
21797 EOSH
21798 cat <<'EOSH' >> Cppsym.try
21799 'length($1) > 0 {
21800     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21801     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21802     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21803     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21804 }'       >> try.c
21805 echo 'return 0;}' >> try.c
21806 EOSH
21807 cat <<EOSH >> Cppsym.try
21808 ccflags="$ccflags"
21809 case "$osname-$gccversion" in
21810 irix-) ccflags="\$ccflags -woff 1178" ;;
21811 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21812 esac
21813 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21814 EOSH
21815 chmod +x Cppsym.try
21816 $eunicefix Cppsym.try
21817 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
21818 : Add in any Linux cpp "predefined macros":
21819 case "$osname::$gccversion" in
21820   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
21821     tHdrH=_tmpHdr
21822     rm -f $tHdrH'.h' $tHdrH
21823     touch $tHdrH'.h'
21824     # Filter out macro arguments, such as Linux's __INT8_C(c)
21825     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21826        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21827        if [ -s $tHdrH'_cppsym.real' ]; then
21828           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21829        fi
21830     fi
21831     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21832   ;;
21833 esac
21834 : now check the C compiler for additional symbols
21835 postprocess_cc_v=''
21836 case "$osname" in
21837 aix) postprocess_cc_v="|$tr , ' '" ;;
21838 esac
21839 $cat >ccsym <<EOS
21840 $startsh
21841 $cat >tmp.c <<EOF
21842 extern int foo;
21843 EOF
21844 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21845 do
21846         case "\$i" in
21847         -D*) echo "\$i" | $sed 's/^-D//';;
21848         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21849         esac
21850 done
21851 $rm_try
21852 EOS
21853 postprocess_cc_v=''
21854 chmod +x ccsym
21855 $eunicefix ccsym
21856 ./ccsym > ccsym1.raw
21857 if $test -s ccsym1.raw; then
21858        $sort ccsym1.raw | $uniq >ccsym.raw
21859 else
21860        mv ccsym1.raw ccsym.raw
21861 fi
21862
21863 $awk '/\=/ { print $0; next }
21864         { print $0"=1" }' ccsym.raw >ccsym.list
21865 $comm -13 Cppsym.true ccsym.list >ccsym.own
21866 $comm -12 Cppsym.true ccsym.list >ccsym.com
21867 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21868 also=''
21869 if $test -z ccsym.raw; then
21870         echo "Your C compiler doesn't seem to define any symbols!" >&4
21871         echo " "
21872         echo "However, your C preprocessor defines the following symbols:"
21873         $cat Cppsym.true
21874         ccsymbols=''
21875         cppsymbols=`$cat Cppsym.true`
21876         cppsymbols=`echo $cppsymbols`
21877         cppccsymbols="$cppsymbols"
21878 else
21879         if $test -s ccsym.com; then
21880                 echo "Your C compiler and pre-processor define these symbols:"
21881                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21882                 also='also '
21883                 symbols='ones'
21884                 cppccsymbols=`$cat ccsym.com`
21885                 cppccsymbols=`echo $cppccsymbols`
21886                 $test "$silent" || sleep 1
21887         fi
21888         if $test -s ccsym.cpp; then
21889                 $test "$also" && echo " "
21890                 echo "Your C pre-processor ${also}defines the following symbols:"
21891                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21892                 also='further '
21893                 cppsymbols=`$cat ccsym.cpp`
21894                 cppsymbols=`echo $cppsymbols`
21895                 $test "$silent" || sleep 1
21896         fi
21897         if $test -s ccsym.own; then
21898                 $test "$also" && echo " "
21899                 echo "Your C compiler ${also}defines the following cpp symbols:"
21900                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21901                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21902                 ccsymbols=`$cat ccsym.own`
21903                 ccsymbols=`echo $ccsymbols`
21904                 $test "$silent" || sleep 1
21905         fi
21906 fi
21907
21908 : see if this is a termio system
21909 val="$undef"
21910 val2="$undef"
21911 val3="$undef"
21912 if $test `./findhdr termios.h`; then
21913         set tcsetattr i_termios
21914         eval $inlibc
21915         val3="$i_termios"
21916 fi
21917 echo " "
21918 case "$val3" in
21919 "$define") echo "You have POSIX termios.h... good!" >&4;;
21920 *) if ./Cppsym pyr; then
21921                 case "`/bin/universe`" in
21922                 ucb) if $test `./findhdr sgtty.h`; then
21923                                 val2="$define"
21924                                 echo "<sgtty.h> found." >&4
21925                         else
21926                                 echo "System is pyramid with BSD universe."
21927                                 ./warn "<sgtty.h> not found--you could have problems."
21928                         fi;;
21929                 *) if $test `./findhdr termio.h`; then
21930                                 val="$define"
21931                                 echo "<termio.h> found." >&4
21932                         else
21933                                 echo "System is pyramid with USG universe."
21934                                 ./warn "<termio.h> not found--you could have problems."
21935                         fi;;
21936                 esac
21937         elif ./usg; then
21938                 if $test `./findhdr termio.h`; then
21939                         echo "<termio.h> found." >&4
21940                         val="$define"
21941                 elif $test `./findhdr sgtty.h`; then
21942                         echo "<sgtty.h> found." >&4
21943                         val2="$define"
21944                 else
21945                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21946                 fi
21947         else
21948                 if $test `./findhdr sgtty.h`; then
21949                         echo "<sgtty.h> found." >&4
21950                         val2="$define"
21951                 elif $test `./findhdr termio.h`; then
21952                         echo "<termio.h> found." >&4
21953                         val="$define"
21954                 else
21955                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
21956                 fi
21957         fi;;
21958 esac
21959 set i_termio; eval $setvar
21960 val=$val2; set i_sgtty; eval $setvar
21961 val=$val3; set i_termios; eval $setvar
21962
21963 : see if stdbool is available
21964 : we want a real compile instead of Inhdr because some Solaris systems
21965 : have stdbool.h, but it can only be used if the compiler indicates it
21966 : is sufficiently c99-compliant.
21967 echo " "
21968 $cat >try.c <<EOCP
21969 #include <stdio.h>
21970 #include <stdbool.h>
21971 int func(bool x)
21972 {
21973     return x ? 1 : 0;
21974 }
21975 int main(int argc, char **argv)
21976 {
21977     return func(0);
21978 }
21979 EOCP
21980 set try
21981 if eval $compile; then
21982         echo "<stdbool.h> found." >&4
21983         val="$define"
21984 else
21985         echo "<stdbool.h> NOT found." >&4
21986         val="$undef"
21987 fi
21988 $rm_try
21989 set i_stdbool
21990 eval $setvar
21991
21992 : see if stddef is available
21993 set stddef.h i_stddef
21994 eval $inhdr
21995
21996 : see if sys/access.h is available
21997 set sys/access.h i_sysaccess
21998 eval $inhdr
21999
22000 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
22001 set sys/filio.h i_sysfilio
22002 eval $inhdr
22003 echo " "
22004 if $test `./findhdr sys/ioctl.h`; then
22005         val="$define"
22006         echo '<sys/ioctl.h> found.' >&4
22007 else
22008         val="$undef"
22009         if $test $i_sysfilio = "$define"; then
22010             echo '<sys/ioctl.h> NOT found.' >&4
22011         else
22012                 $test $i_sgtty = "$define" && xxx="sgtty.h"
22013                 $test $i_termio = "$define" && xxx="termio.h"
22014                 $test $i_termios = "$define" && xxx="termios.h"
22015 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
22016         fi
22017 fi
22018 set i_sysioctl
22019 eval $setvar
22020
22021 : see if socket ioctl defs are in sys/sockio.h
22022 echo " "
22023 xxx=`./findhdr sys/sockio.h`
22024 if $test "$xxx"; then
22025         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
22026                 val="$define"
22027                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
22028         else
22029                 val="$undef"
22030                 echo "No socket ioctls found in <sys/sockio.h>." >&4
22031         fi
22032 else
22033         val="$undef"
22034         $cat <<EOM
22035 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
22036 EOM
22037 fi
22038 set i_syssockio
22039 eval $setvar
22040
22041 : see if this is a syslog.h system
22042 set syslog.h i_syslog
22043 eval $inhdr
22044
22045 : see if this is a sys/mode.h system
22046 set sys/mode.h i_sysmode
22047 eval $inhdr
22048
22049 : see if there is a sys/poll.h file
22050 set sys/poll.h i_syspoll
22051 eval $inhdr
22052
22053 : see if sys/resource.h has to be included
22054 set sys/resource.h i_sysresrc
22055 eval $inhdr
22056
22057 : see if sys/security.h is available
22058 set sys/security.h i_syssecrt
22059 eval $inhdr
22060
22061 : see if this is a sys/statvfs.h system
22062 set sys/statvfs.h i_sysstatvfs
22063 eval $inhdr
22064
22065 : see if this is a sys/un.h system
22066 set sys/un.h i_sysun
22067 eval $inhdr
22068
22069 : see if this is a sys/utsname.h system
22070 set sys/utsname.h i_sysutsname
22071 eval $inhdr
22072
22073 : see if this is a syswait system
22074 set sys/wait.h i_syswait
22075 eval $inhdr
22076
22077 : see if this is a ustat.h system
22078 set ustat.h i_ustat
22079 eval $inhdr
22080
22081 : see if this is an utime system
22082 set utime.h i_utime
22083 eval $inhdr
22084
22085 : see if this is a vfork system
22086 case "$d_vfork" in
22087 "$define")
22088         set vfork.h i_vfork
22089         eval $inhdr
22090         ;;
22091 *)
22092         i_vfork="$undef"
22093         ;;
22094 esac
22095
22096 : Check extensions
22097 echo " "
22098 echo "Looking for extensions..." >&4
22099 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
22100 : contain old or inaccurate or duplicate values.
22101 nonxs_extensions=''
22102 xs_extensions=''
22103 : We do not use find because it might not be available.
22104 : We do not just use MANIFEST because the user may have dropped
22105 : some additional extensions into the source tree and expect them
22106 : to be built.
22107
22108 : Function to recursively find available extensions, ignoring DynaLoader
22109 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
22110 : In 5.10.1 and later, extensions are stored in directories
22111 : like File-Glob instead of the older File/Glob/.
22112 find_extensions='
22113     for xxx in *; do
22114         case "$xxx" in
22115             DynaLoader|dynaload) ;;
22116             *)
22117             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
22118             case "$this_ext" in
22119                 Scalar/List/Utils) this_ext="List/Util";;
22120                 PathTools)         this_ext="Cwd";;
22121             esac;
22122             echo " $xs_extensions $nonxs_extensions" > $$.tmp;
22123             if $contains " $this_ext " $$.tmp; then
22124                 echo >&4;
22125                 echo "Duplicate directories detected for extension $xxx" >&4;
22126                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
22127                 case "$knowitall" in
22128                 "") dflt=y;;
22129                 *) dflt=n;;
22130                 esac;
22131                 . ../UU/myread;
22132                 case "$ans" in
22133                 n*|N*) ;;
22134                 *) echo >&4;
22135                     echo "Ok.  Stopping Configure." >&4;
22136                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
22137                     exit 1;;
22138                 esac;
22139                 echo "Ok.  You will need to correct config.sh before running make." >&4;
22140             fi;
22141             $ls -1 $xxx > $$.tmp;
22142             if   $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
22143                 xs_extensions="$xs_extensions $this_ext";
22144             elif $contains "\.c$"  $$.tmp > /dev/null 2>&1; then
22145                 xs_extensions="$xs_extensions $this_ext";
22146             elif $test -d $xxx; then
22147                 nonxs_extensions="$nonxs_extensions $this_ext";
22148             fi;
22149             $rm -f $$.tmp;
22150             ;;
22151         esac;
22152     done'
22153 tdir=`pwd`
22154 cd "$rsrc/cpan"
22155 set X
22156 shift
22157 eval $find_extensions
22158 cd "$rsrc/dist"
22159 set X
22160 shift
22161 eval $find_extensions
22162 cd "$rsrc/ext"
22163 set X
22164 shift
22165 eval $find_extensions
22166 set X $xs_extensions
22167 shift
22168 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22169 set X $nonxs_extensions
22170 shift
22171 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22172 cd "$tdir"
22173 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
22174
22175 : Now see which are supported on this system.
22176 avail_ext=''
22177 for xxx in $xs_extensions ; do
22178         case "$xxx" in
22179         DB_File|db_file)
22180                 case "$i_db" in
22181                 $define) avail_ext="$avail_ext $xxx" ;;
22182                 esac
22183                 ;;
22184         GDBM_File|gdbm_fil)
22185                 case "$i_gdbm" in
22186                 $define) avail_ext="$avail_ext $xxx" ;;
22187                 esac
22188                 ;;
22189         I18N/Langinfo|i18n_lan)
22190                 case "$i_langinfo$d_nl_langinfo" in
22191                 $define$define) avail_ext="$avail_ext $xxx" ;;
22192                 esac
22193                 ;;
22194         IPC/SysV|ipc/sysv)
22195                 : XXX Do we need a useipcsysv variable here
22196                 case "${d_msg}${d_sem}${d_shm}" in
22197                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
22198                 esac
22199                 ;;
22200         NDBM_File|ndbm_fil)
22201                 case "$d_ndbm" in
22202                 $define)
22203                     case "$osname-$use64bitint" in
22204                     hpux-define)
22205                         case "$libs" in
22206                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
22207                         esac
22208                         ;;
22209                     *) avail_ext="$avail_ext $xxx" ;;
22210                     esac
22211                     ;;
22212                 esac
22213                 ;;
22214         ODBM_File|odbm_fil)
22215                 case "${i_dbm}${i_rpcsvcdbm}" in
22216                 *"${define}"*)
22217                     case "$d_cplusplus" in
22218                     define) ;; # delete as a function name will not work
22219                     *)  case "$osname-$use64bitint" in
22220                         hpux-define)
22221                             case "$libs" in
22222                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22223                             esac
22224                             ;;
22225                         *) avail_ext="$avail_ext $xxx" ;;
22226                         esac
22227                         ;;
22228                     esac
22229                     ;;
22230                 esac
22231                 ;;
22232         Opcode|opcode)
22233                 case "$useopcode" in
22234                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22235                 esac
22236                 ;;
22237         POSIX|posix)
22238                 case "$useposix" in
22239                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22240                 esac
22241                 ;;
22242         Socket|socket)
22243                 case "$d_socket" in
22244                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22245                 esac
22246                 ;;
22247         Sys/Syslog|sys/syslog)
22248                 : XXX syslog requires socket
22249                 case "$d_socket" in
22250                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22251                 esac
22252                 ;;
22253         Thread|thread)
22254                 case "$usethreads" in
22255                 true|$define|y)
22256                         case "$use5005threads" in
22257                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
22258                         esac
22259                 esac
22260                 ;;
22261         threads|threads/shared)
22262                 # threads and threads::shared are special cases.
22263                 # To stop people from asking "Perl 5.8.0 was supposed
22264                 # to have this new fancy threads implementation but my
22265                 # perl doesn't have it" and from people trying to
22266                 # (re)install the threads module using CPAN.pm and
22267                 # CPAN.pm then offering to reinstall Perl 5.8.0,
22268                 # the threads.pm and threads/shared.pm will always be
22269                 # there, croaking informatively ("you need to rebuild
22270                 # all of Perl with threads, sorry") when threads haven't
22271                 # been compiled in.
22272                 # --jhi
22273                 avail_ext="$avail_ext $xxx"
22274                 ;;
22275         VMS*)
22276                 ;;
22277         Win32*)
22278                 case "$osname" in
22279                 cygwin) avail_ext="$avail_ext $xxx" ;;
22280                 esac
22281                 ;;
22282         XS/APItest|xs/apitest)
22283                 # This is just for testing.  Skip it unless we have dynamic loading.
22284
22285                 case "$usedl" in
22286                 $define) avail_ext="$avail_ext $xxx" ;;
22287                 esac
22288                 ;;
22289         XS/Typemap|xs/typemap)
22290                 # This is just for testing.  Skip it unless we have dynamic loading.
22291                 case "$usedl" in
22292                 $define) avail_ext="$avail_ext $xxx" ;;
22293                 esac
22294                 ;;
22295         *)      avail_ext="$avail_ext $xxx"
22296                 ;;
22297         esac
22298 done
22299
22300 set X $avail_ext
22301 shift
22302 avail_ext="$*"
22303
22304 case "$onlyextensions" in
22305 '') ;;
22306 *)  keepextensions=''
22307     echo "You have requested that only certain extensions be included..." >&4
22308     for i in $onlyextensions; do
22309         case " $avail_ext " in
22310         *" $i "*)
22311             echo "Keeping extension $i."
22312             keepextensions="$keepextensions $i"
22313             ;;
22314         *) echo "Ignoring extension $i." ;;
22315         esac
22316     done
22317     avail_ext="$keepextensions"
22318     ;;
22319 esac
22320
22321 case "$noextensions" in
22322 '') ;;
22323 *)  keepextensions=''
22324     echo "You have requested that certain extensions be ignored..." >&4
22325     for i in $avail_ext; do
22326         case " $noextensions " in
22327         *" $i "*) echo "Ignoring extension $i." ;;
22328         *) echo "Keeping extension $i.";
22329            keepextensions="$keepextensions $i"
22330            ;;
22331         esac
22332     done
22333     avail_ext="$keepextensions"
22334     ;;
22335 esac
22336
22337 : Now see which nonxs extensions are supported on this system.
22338 : For now assume all are.
22339 nonxs_ext=''
22340 for xxx in $nonxs_extensions ; do
22341         case "$xxx" in
22342         VMS*)
22343                 ;;
22344         *)      nonxs_ext="$nonxs_ext $xxx"
22345                 ;;
22346         esac
22347 done
22348
22349 set X $nonxs_ext
22350 shift
22351 nonxs_ext="$*"
22352
22353 case $usedl in
22354 $define)
22355         $cat <<EOM
22356 A number of extensions are supplied with $package.  You may choose to
22357 compile these extensions for dynamic loading (the default), compile
22358 them into the $package executable (static loading), or not include
22359 them at all.  Answer "none" to include no extensions.
22360 Note that DynaLoader is always built and need not be mentioned here.
22361
22362 EOM
22363         case "$dynamic_ext" in
22364         '')
22365                 : Exclude those listed in static_ext
22366                 dflt=''
22367                 for xxx in $avail_ext; do
22368                         case " $static_ext " in
22369                         *" $xxx "*) ;;
22370                         *) dflt="$dflt $xxx" ;;
22371                         esac
22372                 done
22373                 set X $dflt
22374                 shift
22375                 dflt="$*"
22376                 ;;
22377         *)      dflt="$dynamic_ext"
22378                 # Perhaps we are reusing an old out-of-date config.sh.
22379                 case "$hint" in
22380                 previous)
22381                         if test X"$dynamic_ext" != X"$avail_ext"; then
22382                                 $cat <<EOM
22383 NOTICE:  Your previous config.sh list may be incorrect.
22384 The extensions now available to you are
22385         ${avail_ext}
22386 but the default list from your previous config.sh is
22387         ${dynamic_ext}
22388
22389 EOM
22390                         fi
22391                         ;;
22392                 esac
22393                 ;;
22394         esac
22395         case "$dflt" in
22396         '')     dflt=none;;
22397         esac
22398         rp="What extensions do you wish to load dynamically?"
22399         . ./myread
22400         case "$ans" in
22401         none) dynamic_ext=' ' ;;
22402         *) dynamic_ext="$ans" ;;
22403         esac
22404
22405         case "$static_ext" in
22406         '')
22407                 : Exclude those already listed in dynamic linking
22408                 dflt=''
22409                 for xxx in $avail_ext; do
22410                         case " $dynamic_ext " in
22411                         *" $xxx "*) ;;
22412                         *) dflt="$dflt $xxx" ;;
22413                         esac
22414                 done
22415                 set X $dflt
22416                 shift
22417                 dflt="$*"
22418                 ;;
22419         *)  dflt="$static_ext"
22420                 ;;
22421         esac
22422
22423         case "$dflt" in
22424         '')     dflt=none;;
22425         esac
22426         rp="What extensions do you wish to load statically?"
22427         . ./myread
22428         case "$ans" in
22429         none) static_ext=' ' ;;
22430         *) static_ext="$ans" ;;
22431         esac
22432         ;;
22433 *)
22434         $cat <<EOM
22435 A number of extensions are supplied with $package.  Answer "none"
22436 to include no extensions.
22437 Note that DynaLoader is always built and need not be mentioned here.
22438
22439 EOM
22440         case "$static_ext" in
22441         '') dflt="$avail_ext" ;;
22442         *)      dflt="$static_ext"
22443                 # Perhaps we are reusing an old out-of-date config.sh.
22444                 case "$hint" in
22445                 previous)
22446                         if test X"$static_ext" != X"$avail_ext"; then
22447                                 $cat <<EOM
22448 NOTICE:  Your previous config.sh list may be incorrect.
22449 The extensions now available to you are
22450         ${avail_ext}
22451 but the default list from your previous config.sh is
22452         ${static_ext}
22453
22454 EOM
22455                         fi
22456                         ;;
22457                 esac
22458                 ;;
22459         esac
22460         : Exclude those that are not xs extensions
22461         case "$dflt" in
22462         '')     dflt=none;;
22463         esac
22464         rp="What extensions do you wish to include?"
22465         . ./myread
22466         case "$ans" in
22467         none) static_ext=' ' ;;
22468         *) static_ext="$ans" ;;
22469         esac
22470         ;;
22471 esac
22472 #
22473 # Encode is a special case.  If we are building Encode as a static
22474 # extension, we need to explicitly list its subextensions as well.
22475 # For other nested extensions, this is handled automatically by
22476 # the appropriate Makefile.PL.
22477 case " $static_ext " in
22478         *" Encode "*) # Add the subextensions of Encode
22479         cd "$rsrc/cpan"
22480         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22481                 static_ext="$static_ext Encode/$xxx"
22482                 known_extensions="$known_extensions Encode/$xxx"
22483         done
22484         cd "$tdir"
22485         ;;
22486 esac
22487
22488 set X $dynamic_ext $static_ext $nonxs_ext
22489 shift
22490 extensions="$*"
22491
22492 # Sanity check:  We require an extension suitable for use with
22493 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22494 # should show up as failures in the test suite, but it's helpful to
22495 # catch them now.) The 'extensions' list is normally sorted
22496 # alphabetically, so we need to accept either
22497 #    DB_File ... Fcntl ... IO  ....
22498 # or something like
22499 #    Fcntl ... NDBM_File ... IO  ....
22500 case " $extensions"  in
22501 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22502 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22503 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22504 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22505    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22506    ;;
22507 esac
22508
22509 : Remove libraries needed only for extensions
22510 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22511 : The exception is SunOS 4.x, which needs them.
22512 case "${osname}X${osvers}" in
22513 sunos*X4*)
22514     perllibs="$libs"
22515     ;;
22516 *) case "$usedl" in
22517     $define|true|[yY]*)
22518             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
22519             shift
22520             perllibs="$*"
22521             ;;
22522     *)  perllibs="$libs"
22523             ;;
22524     esac
22525     ;;
22526 esac
22527
22528 : Remove build directory name from cppstdin so it can be used from
22529 : either the present location or the final installed location.
22530 echo " "
22531 : Get out of the UU directory to get correct path name.
22532 cd ..
22533 case "$cppstdin" in
22534 `pwd`/cppstdin)
22535         echo "Stripping down cppstdin path name"
22536         cppstdin=cppstdin
22537         ;;
22538 esac
22539 cd UU
22540
22541 : end of configuration questions
22542 echo " "
22543 echo "End of configuration questions."
22544 echo " "
22545
22546 : back to where it started
22547 if test -d ../UU; then
22548         cd ..
22549 fi
22550
22551 : configuration may be unconditionally patched via a 'config.arch' file
22552 if $test -f config.arch; then
22553         echo "I see a config.arch file, loading it." >&4
22554         . ./config.arch
22555 fi
22556
22557 : configuration may be patched via a 'config.over' file
22558 if $test -f config.over; then
22559         echo " "
22560         dflt=y
22561         rp='I see a config.over file.  Do you wish to load it?'
22562         . UU/myread
22563         case "$ans" in
22564         n*) echo "OK, I'll ignore it.";;
22565         *)      . ./config.over
22566                 echo "Configuration override changes have been loaded."
22567                 ;;
22568         esac
22569 fi
22570
22571 : in case they want portability, strip down executable paths
22572 case "$d_portable" in
22573 "$define")
22574         echo " "
22575         echo "Stripping down executable paths..." >&4
22576         for file in $loclist $trylist; do
22577                 eval temp=\$$file
22578                 eval $file=`basename $temp`
22579         done
22580         ;;
22581 esac
22582
22583 : create config.sh file
22584 echo " "
22585 echo "Creating config.sh..." >&4
22586 $spitshell <<EOT >config.sh
22587 $startsh
22588 #
22589 # This file was produced by running the Configure script. It holds all the
22590 # definitions figured out by Configure. Should you modify one of these values,
22591 # do not forget to propagate your changes by running "Configure -der". You may
22592 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22593 #
22594
22595 # Package name      : $package
22596 # Source directory  : $src
22597 # Configuration time: $cf_time
22598 # Configured by     : $cf_by
22599 # Target system     : $myuname
22600
22601 EOT
22602 : Add in command line options if available
22603 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22604
22605 $spitshell <<EOT >>config.sh
22606
22607 Author='$Author'
22608 Date='$Date'
22609 Header='$Header'
22610 Id='$Id'
22611 Locker='$Locker'
22612 Log='$Log'
22613 RCSfile='$RCSfile'
22614 Revision='$Revision'
22615 Source='$Source'
22616 State='$State'
22617 _a='$_a'
22618 _exe='$_exe'
22619 _o='$_o'
22620 afs='$afs'
22621 afsroot='$afsroot'
22622 alignbytes='$alignbytes'
22623 ansi2knr='$ansi2knr'
22624 aphostname='$aphostname'
22625 api_revision='$api_revision'
22626 api_subversion='$api_subversion'
22627 api_version='$api_version'
22628 api_versionstring='$api_versionstring'
22629 ar='$ar'
22630 archlib='$archlib'
22631 archlibexp='$archlibexp'
22632 archname64='$archname64'
22633 archname='$archname'
22634 archobjs='$archobjs'
22635 asctime_r_proto='$asctime_r_proto'
22636 awk='$awk'
22637 baserev='$baserev'
22638 bash='$bash'
22639 bin='$bin'
22640 bin_ELF='$bin_ELF'
22641 binexp='$binexp'
22642 bison='$bison'
22643 bootstrap_charset='$bootstrap_charset'
22644 byacc='$byacc'
22645 byteorder='$byteorder'
22646 c='$c'
22647 castflags='$castflags'
22648 cat='$cat'
22649 cc='$cc'
22650 cccdlflags='$cccdlflags'
22651 ccdlflags='$ccdlflags'
22652 ccflags='$ccflags'
22653 ccflags_uselargefiles='$ccflags_uselargefiles'
22654 ccname='$ccname'
22655 ccsymbols='$ccsymbols'
22656 ccversion='$ccversion'
22657 cf_by='$cf_by'
22658 cf_email='$cf_email'
22659 cf_time='$cf_time'
22660 charbits='$charbits'
22661 charsize='$charsize'
22662 chgrp='$chgrp'
22663 chmod='$chmod'
22664 chown='$chown'
22665 clocktype='$clocktype'
22666 comm='$comm'
22667 compress='$compress'
22668 contains='$contains'
22669 cp='$cp'
22670 cpio='$cpio'
22671 cpp='$cpp'
22672 cpp_stuff='$cpp_stuff'
22673 cppccsymbols='$cppccsymbols'
22674 cppflags='$cppflags'
22675 cpplast='$cpplast'
22676 cppminus='$cppminus'
22677 cpprun='$cpprun'
22678 cppstdin='$cppstdin'
22679 cppsymbols='$cppsymbols'
22680 crypt_r_proto='$crypt_r_proto'
22681 cryptlib='$cryptlib'
22682 csh='$csh'
22683 ctermid_r_proto='$ctermid_r_proto'
22684 ctime_r_proto='$ctime_r_proto'
22685 d_Gconvert='$d_Gconvert'
22686 d_PRIEUldbl='$d_PRIEUldbl'
22687 d_PRIFUldbl='$d_PRIFUldbl'
22688 d_PRIGUldbl='$d_PRIGUldbl'
22689 d_PRIXU64='$d_PRIXU64'
22690 d_PRId64='$d_PRId64'
22691 d_PRIeldbl='$d_PRIeldbl'
22692 d_PRIfldbl='$d_PRIfldbl'
22693 d_PRIgldbl='$d_PRIgldbl'
22694 d_PRIi64='$d_PRIi64'
22695 d_PRIo64='$d_PRIo64'
22696 d_PRIu64='$d_PRIu64'
22697 d_PRIx64='$d_PRIx64'
22698 d_SCNfldbl='$d_SCNfldbl'
22699 d__fwalk='$d__fwalk'
22700 d_access='$d_access'
22701 d_accessx='$d_accessx'
22702 d_aintl='$d_aintl'
22703 d_alarm='$d_alarm'
22704 d_archlib='$d_archlib'
22705 d_asctime64='$d_asctime64'
22706 d_asctime_r='$d_asctime_r'
22707 d_atolf='$d_atolf'
22708 d_atoll='$d_atoll'
22709 d_attribute_deprecated='$d_attribute_deprecated'
22710 d_attribute_format='$d_attribute_format'
22711 d_attribute_malloc='$d_attribute_malloc'
22712 d_attribute_nonnull='$d_attribute_nonnull'
22713 d_attribute_noreturn='$d_attribute_noreturn'
22714 d_attribute_pure='$d_attribute_pure'
22715 d_attribute_unused='$d_attribute_unused'
22716 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22717 d_bcmp='$d_bcmp'
22718 d_bcopy='$d_bcopy'
22719 d_bsd='$d_bsd'
22720 d_bsdgetpgrp='$d_bsdgetpgrp'
22721 d_bsdsetpgrp='$d_bsdsetpgrp'
22722 d_builtin_choose_expr='$d_builtin_choose_expr'
22723 d_builtin_expect='$d_builtin_expect'
22724 d_bzero='$d_bzero'
22725 d_c99_variadic_macros='$d_c99_variadic_macros'
22726 d_casti32='$d_casti32'
22727 d_castneg='$d_castneg'
22728 d_charvspr='$d_charvspr'
22729 d_chown='$d_chown'
22730 d_chroot='$d_chroot'
22731 d_chsize='$d_chsize'
22732 d_class='$d_class'
22733 d_clearenv='$d_clearenv'
22734 d_closedir='$d_closedir'
22735 d_cmsghdr_s='$d_cmsghdr_s'
22736 d_const='$d_const'
22737 d_copysignl='$d_copysignl'
22738 d_cplusplus='$d_cplusplus'
22739 d_crypt='$d_crypt'
22740 d_crypt_r='$d_crypt_r'
22741 d_csh='$d_csh'
22742 d_ctermid='$d_ctermid'
22743 d_ctermid_r='$d_ctermid_r'
22744 d_ctime64='$d_ctime64'
22745 d_ctime_r='$d_ctime_r'
22746 d_cuserid='$d_cuserid'
22747 d_dbl_dig='$d_dbl_dig'
22748 d_dbminitproto='$d_dbminitproto'
22749 d_difftime64='$d_difftime64'
22750 d_difftime='$d_difftime'
22751 d_dir_dd_fd='$d_dir_dd_fd'
22752 d_dirfd='$d_dirfd'
22753 d_dirnamlen='$d_dirnamlen'
22754 d_dlerror='$d_dlerror'
22755 d_dlopen='$d_dlopen'
22756 d_dlsymun='$d_dlsymun'
22757 d_dosuid='$d_dosuid'
22758 d_drand48_r='$d_drand48_r'
22759 d_drand48proto='$d_drand48proto'
22760 d_dup2='$d_dup2'
22761 d_eaccess='$d_eaccess'
22762 d_endgrent='$d_endgrent'
22763 d_endgrent_r='$d_endgrent_r'
22764 d_endhent='$d_endhent'
22765 d_endhostent_r='$d_endhostent_r'
22766 d_endnent='$d_endnent'
22767 d_endnetent_r='$d_endnetent_r'
22768 d_endpent='$d_endpent'
22769 d_endprotoent_r='$d_endprotoent_r'
22770 d_endpwent='$d_endpwent'
22771 d_endpwent_r='$d_endpwent_r'
22772 d_endsent='$d_endsent'
22773 d_endservent_r='$d_endservent_r'
22774 d_eofnblk='$d_eofnblk'
22775 d_eunice='$d_eunice'
22776 d_faststdio='$d_faststdio'
22777 d_fchdir='$d_fchdir'
22778 d_fchmod='$d_fchmod'
22779 d_fchown='$d_fchown'
22780 d_fcntl='$d_fcntl'
22781 d_fcntl_can_lock='$d_fcntl_can_lock'
22782 d_fd_macros='$d_fd_macros'
22783 d_fd_set='$d_fd_set'
22784 d_fds_bits='$d_fds_bits'
22785 d_fgetpos='$d_fgetpos'
22786 d_finite='$d_finite'
22787 d_finitel='$d_finitel'
22788 d_flexfnam='$d_flexfnam'
22789 d_flock='$d_flock'
22790 d_flockproto='$d_flockproto'
22791 d_fork='$d_fork'
22792 d_fp_class='$d_fp_class'
22793 d_fpathconf='$d_fpathconf'
22794 d_fpclass='$d_fpclass'
22795 d_fpclassify='$d_fpclassify'
22796 d_fpclassl='$d_fpclassl'
22797 d_fpos64_t='$d_fpos64_t'
22798 d_frexpl='$d_frexpl'
22799 d_fs_data_s='$d_fs_data_s'
22800 d_fseeko='$d_fseeko'
22801 d_fsetpos='$d_fsetpos'
22802 d_fstatfs='$d_fstatfs'
22803 d_fstatvfs='$d_fstatvfs'
22804 d_fsync='$d_fsync'
22805 d_ftello='$d_ftello'
22806 d_ftime='$d_ftime'
22807 d_futimes='$d_futimes'
22808 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22809 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
22810 d_getaddrinfo='$d_getaddrinfo'
22811 d_getcwd='$d_getcwd'
22812 d_getespwnam='$d_getespwnam'
22813 d_getfsstat='$d_getfsstat'
22814 d_getgrent='$d_getgrent'
22815 d_getgrent_r='$d_getgrent_r'
22816 d_getgrgid_r='$d_getgrgid_r'
22817 d_getgrnam_r='$d_getgrnam_r'
22818 d_getgrps='$d_getgrps'
22819 d_gethbyaddr='$d_gethbyaddr'
22820 d_gethbyname='$d_gethbyname'
22821 d_gethent='$d_gethent'
22822 d_gethname='$d_gethname'
22823 d_gethostbyaddr_r='$d_gethostbyaddr_r'
22824 d_gethostbyname_r='$d_gethostbyname_r'
22825 d_gethostent_r='$d_gethostent_r'
22826 d_gethostprotos='$d_gethostprotos'
22827 d_getitimer='$d_getitimer'
22828 d_getlogin='$d_getlogin'
22829 d_getlogin_r='$d_getlogin_r'
22830 d_getmnt='$d_getmnt'
22831 d_getmntent='$d_getmntent'
22832 d_getnameinfo='$d_getnameinfo'
22833 d_getnbyaddr='$d_getnbyaddr'
22834 d_getnbyname='$d_getnbyname'
22835 d_getnent='$d_getnent'
22836 d_getnetbyaddr_r='$d_getnetbyaddr_r'
22837 d_getnetbyname_r='$d_getnetbyname_r'
22838 d_getnetent_r='$d_getnetent_r'
22839 d_getnetprotos='$d_getnetprotos'
22840 d_getpagsz='$d_getpagsz'
22841 d_getpbyname='$d_getpbyname'
22842 d_getpbynumber='$d_getpbynumber'
22843 d_getpent='$d_getpent'
22844 d_getpgid='$d_getpgid'
22845 d_getpgrp2='$d_getpgrp2'
22846 d_getpgrp='$d_getpgrp'
22847 d_getppid='$d_getppid'
22848 d_getprior='$d_getprior'
22849 d_getprotobyname_r='$d_getprotobyname_r'
22850 d_getprotobynumber_r='$d_getprotobynumber_r'
22851 d_getprotoent_r='$d_getprotoent_r'
22852 d_getprotoprotos='$d_getprotoprotos'
22853 d_getprpwnam='$d_getprpwnam'
22854 d_getpwent='$d_getpwent'
22855 d_getpwent_r='$d_getpwent_r'
22856 d_getpwnam_r='$d_getpwnam_r'
22857 d_getpwuid_r='$d_getpwuid_r'
22858 d_getsbyname='$d_getsbyname'
22859 d_getsbyport='$d_getsbyport'
22860 d_getsent='$d_getsent'
22861 d_getservbyname_r='$d_getservbyname_r'
22862 d_getservbyport_r='$d_getservbyport_r'
22863 d_getservent_r='$d_getservent_r'
22864 d_getservprotos='$d_getservprotos'
22865 d_getspnam='$d_getspnam'
22866 d_getspnam_r='$d_getspnam_r'
22867 d_gettimeod='$d_gettimeod'
22868 d_gmtime64='$d_gmtime64'
22869 d_gmtime_r='$d_gmtime_r'
22870 d_gnulibc='$d_gnulibc'
22871 d_grpasswd='$d_grpasswd'
22872 d_hasmntopt='$d_hasmntopt'
22873 d_htonl='$d_htonl'
22874 d_ilogbl='$d_ilogbl'
22875 d_inc_version_list='$d_inc_version_list'
22876 d_index='$d_index'
22877 d_inetaton='$d_inetaton'
22878 d_inetntop='$d_inetntop'
22879 d_inetpton='$d_inetpton'
22880 d_int64_t='$d_int64_t'
22881 d_ip_mreq='$d_ip_mreq'
22882 d_ip_mreq_source='$d_ip_mreq_source'
22883 d_ipv6_mreq='$d_ipv6_mreq'
22884 d_ipv6_mreq_source='$d_ipv6_mreq_source'
22885 d_isascii='$d_isascii'
22886 d_isblank='$d_isblank'
22887 d_isfinite='$d_isfinite'
22888 d_isinf='$d_isinf'
22889 d_isnan='$d_isnan'
22890 d_isnanl='$d_isnanl'
22891 d_killpg='$d_killpg'
22892 d_lchown='$d_lchown'
22893 d_ldbl_dig='$d_ldbl_dig'
22894 d_libm_lib_version='$d_libm_lib_version'
22895 d_link='$d_link'
22896 d_localtime64='$d_localtime64'
22897 d_localtime_r='$d_localtime_r'
22898 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22899 d_locconv='$d_locconv'
22900 d_lockf='$d_lockf'
22901 d_longdbl='$d_longdbl'
22902 d_longlong='$d_longlong'
22903 d_lseekproto='$d_lseekproto'
22904 d_lstat='$d_lstat'
22905 d_madvise='$d_madvise'
22906 d_malloc_good_size='$d_malloc_good_size'
22907 d_malloc_size='$d_malloc_size'
22908 d_mblen='$d_mblen'
22909 d_mbstowcs='$d_mbstowcs'
22910 d_mbtowc='$d_mbtowc'
22911 d_memchr='$d_memchr'
22912 d_memcmp='$d_memcmp'
22913 d_memcpy='$d_memcpy'
22914 d_memmove='$d_memmove'
22915 d_memset='$d_memset'
22916 d_mkdir='$d_mkdir'
22917 d_mkdtemp='$d_mkdtemp'
22918 d_mkfifo='$d_mkfifo'
22919 d_mkstemp='$d_mkstemp'
22920 d_mkstemps='$d_mkstemps'
22921 d_mktime64='$d_mktime64'
22922 d_mktime='$d_mktime'
22923 d_mmap='$d_mmap'
22924 d_modfl='$d_modfl'
22925 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22926 d_modflproto='$d_modflproto'
22927 d_mprotect='$d_mprotect'
22928 d_msg='$d_msg'
22929 d_msg_ctrunc='$d_msg_ctrunc'
22930 d_msg_dontroute='$d_msg_dontroute'
22931 d_msg_oob='$d_msg_oob'
22932 d_msg_peek='$d_msg_peek'
22933 d_msg_proxy='$d_msg_proxy'
22934 d_msgctl='$d_msgctl'
22935 d_msgget='$d_msgget'
22936 d_msghdr_s='$d_msghdr_s'
22937 d_msgrcv='$d_msgrcv'
22938 d_msgsnd='$d_msgsnd'
22939 d_msync='$d_msync'
22940 d_munmap='$d_munmap'
22941 d_mymalloc='$d_mymalloc'
22942 d_ndbm='$d_ndbm'
22943 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
22944 d_nice='$d_nice'
22945 d_nl_langinfo='$d_nl_langinfo'
22946 d_nv_preserves_uv='$d_nv_preserves_uv'
22947 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22948 d_off64_t='$d_off64_t'
22949 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22950 d_oldpthreads='$d_oldpthreads'
22951 d_oldsock='$d_oldsock'
22952 d_open3='$d_open3'
22953 d_pathconf='$d_pathconf'
22954 d_pause='$d_pause'
22955 d_perl_otherlibdirs='$d_perl_otherlibdirs'
22956 d_phostname='$d_phostname'
22957 d_pipe='$d_pipe'
22958 d_poll='$d_poll'
22959 d_portable='$d_portable'
22960 d_prctl='$d_prctl'
22961 d_prctl_set_name='$d_prctl_set_name'
22962 d_printf_format_null='$d_printf_format_null'
22963 d_procselfexe='$d_procselfexe'
22964 d_pseudofork='$d_pseudofork'
22965 d_pthread_atfork='$d_pthread_atfork'
22966 d_pthread_attr_setscope='$d_pthread_attr_setscope'
22967 d_pthread_yield='$d_pthread_yield'
22968 d_pwage='$d_pwage'
22969 d_pwchange='$d_pwchange'
22970 d_pwclass='$d_pwclass'
22971 d_pwcomment='$d_pwcomment'
22972 d_pwexpire='$d_pwexpire'
22973 d_pwgecos='$d_pwgecos'
22974 d_pwpasswd='$d_pwpasswd'
22975 d_pwquota='$d_pwquota'
22976 d_qgcvt='$d_qgcvt'
22977 d_quad='$d_quad'
22978 d_random_r='$d_random_r'
22979 d_readdir64_r='$d_readdir64_r'
22980 d_readdir='$d_readdir'
22981 d_readdir_r='$d_readdir_r'
22982 d_readlink='$d_readlink'
22983 d_readv='$d_readv'
22984 d_recvmsg='$d_recvmsg'
22985 d_rename='$d_rename'
22986 d_rewinddir='$d_rewinddir'
22987 d_rmdir='$d_rmdir'
22988 d_safebcpy='$d_safebcpy'
22989 d_safemcpy='$d_safemcpy'
22990 d_sanemcmp='$d_sanemcmp'
22991 d_sbrkproto='$d_sbrkproto'
22992 d_scalbnl='$d_scalbnl'
22993 d_sched_yield='$d_sched_yield'
22994 d_scm_rights='$d_scm_rights'
22995 d_seekdir='$d_seekdir'
22996 d_select='$d_select'
22997 d_sem='$d_sem'
22998 d_semctl='$d_semctl'
22999 d_semctl_semid_ds='$d_semctl_semid_ds'
23000 d_semctl_semun='$d_semctl_semun'
23001 d_semget='$d_semget'
23002 d_semop='$d_semop'
23003 d_sendmsg='$d_sendmsg'
23004 d_setegid='$d_setegid'
23005 d_seteuid='$d_seteuid'
23006 d_setgrent='$d_setgrent'
23007 d_setgrent_r='$d_setgrent_r'
23008 d_setgrps='$d_setgrps'
23009 d_sethent='$d_sethent'
23010 d_sethostent_r='$d_sethostent_r'
23011 d_setitimer='$d_setitimer'
23012 d_setlinebuf='$d_setlinebuf'
23013 d_setlocale='$d_setlocale'
23014 d_setlocale_r='$d_setlocale_r'
23015 d_setnent='$d_setnent'
23016 d_setnetent_r='$d_setnetent_r'
23017 d_setpent='$d_setpent'
23018 d_setpgid='$d_setpgid'
23019 d_setpgrp2='$d_setpgrp2'
23020 d_setpgrp='$d_setpgrp'
23021 d_setprior='$d_setprior'
23022 d_setproctitle='$d_setproctitle'
23023 d_setprotoent_r='$d_setprotoent_r'
23024 d_setpwent='$d_setpwent'
23025 d_setpwent_r='$d_setpwent_r'
23026 d_setregid='$d_setregid'
23027 d_setresgid='$d_setresgid'
23028 d_setresuid='$d_setresuid'
23029 d_setreuid='$d_setreuid'
23030 d_setrgid='$d_setrgid'
23031 d_setruid='$d_setruid'
23032 d_setsent='$d_setsent'
23033 d_setservent_r='$d_setservent_r'
23034 d_setsid='$d_setsid'
23035 d_setvbuf='$d_setvbuf'
23036 d_shm='$d_shm'
23037 d_shmat='$d_shmat'
23038 d_shmatprototype='$d_shmatprototype'
23039 d_shmctl='$d_shmctl'
23040 d_shmdt='$d_shmdt'
23041 d_shmget='$d_shmget'
23042 d_sigaction='$d_sigaction'
23043 d_signbit='$d_signbit'
23044 d_sigprocmask='$d_sigprocmask'
23045 d_sigsetjmp='$d_sigsetjmp'
23046 d_sin6_scope_id='$d_sin6_scope_id'
23047 d_sitearch='$d_sitearch'
23048 d_snprintf='$d_snprintf'
23049 d_sockaddr_in6='$d_sockaddr_in6'
23050 d_sockaddr_sa_len='$d_sockaddr_sa_len'
23051 d_sockatmark='$d_sockatmark'
23052 d_sockatmarkproto='$d_sockatmarkproto'
23053 d_socket='$d_socket'
23054 d_socklen_t='$d_socklen_t'
23055 d_sockpair='$d_sockpair'
23056 d_socks5_init='$d_socks5_init'
23057 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
23058 d_sqrtl='$d_sqrtl'
23059 d_srand48_r='$d_srand48_r'
23060 d_srandom_r='$d_srandom_r'
23061 d_sresgproto='$d_sresgproto'
23062 d_sresuproto='$d_sresuproto'
23063 d_statblks='$d_statblks'
23064 d_statfs_f_flags='$d_statfs_f_flags'
23065 d_statfs_s='$d_statfs_s'
23066 d_static_inline='$d_static_inline'
23067 d_statvfs='$d_statvfs'
23068 d_stdio_cnt_lval='$d_stdio_cnt_lval'
23069 d_stdio_ptr_lval='$d_stdio_ptr_lval'
23070 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
23071 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
23072 d_stdio_stream_array='$d_stdio_stream_array'
23073 d_stdiobase='$d_stdiobase'
23074 d_stdstdio='$d_stdstdio'
23075 d_strchr='$d_strchr'
23076 d_strcoll='$d_strcoll'
23077 d_strctcpy='$d_strctcpy'
23078 d_strerrm='$d_strerrm'
23079 d_strerror='$d_strerror'
23080 d_strerror_r='$d_strerror_r'
23081 d_strftime='$d_strftime'
23082 d_strlcat='$d_strlcat'
23083 d_strlcpy='$d_strlcpy'
23084 d_strtod='$d_strtod'
23085 d_strtol='$d_strtol'
23086 d_strtold='$d_strtold'
23087 d_strtoll='$d_strtoll'
23088 d_strtoq='$d_strtoq'
23089 d_strtoul='$d_strtoul'
23090 d_strtoull='$d_strtoull'
23091 d_strtouq='$d_strtouq'
23092 d_strxfrm='$d_strxfrm'
23093 d_suidsafe='$d_suidsafe'
23094 d_symlink='$d_symlink'
23095 d_syscall='$d_syscall'
23096 d_syscallproto='$d_syscallproto'
23097 d_sysconf='$d_sysconf'
23098 d_sysernlst='$d_sysernlst'
23099 d_syserrlst='$d_syserrlst'
23100 d_system='$d_system'
23101 d_tcgetpgrp='$d_tcgetpgrp'
23102 d_tcsetpgrp='$d_tcsetpgrp'
23103 d_telldir='$d_telldir'
23104 d_telldirproto='$d_telldirproto'
23105 d_time='$d_time'
23106 d_timegm='$d_timegm'
23107 d_times='$d_times'
23108 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
23109 d_tm_tm_zone='$d_tm_tm_zone'
23110 d_tmpnam_r='$d_tmpnam_r'
23111 d_truncate='$d_truncate'
23112 d_ttyname_r='$d_ttyname_r'
23113 d_tzname='$d_tzname'
23114 d_u32align='$d_u32align'
23115 d_ualarm='$d_ualarm'
23116 d_umask='$d_umask'
23117 d_uname='$d_uname'
23118 d_union_semun='$d_union_semun'
23119 d_unordered='$d_unordered'
23120 d_unsetenv='$d_unsetenv'
23121 d_usleep='$d_usleep'
23122 d_usleepproto='$d_usleepproto'
23123 d_ustat='$d_ustat'
23124 d_vendorarch='$d_vendorarch'
23125 d_vendorbin='$d_vendorbin'
23126 d_vendorlib='$d_vendorlib'
23127 d_vendorscript='$d_vendorscript'
23128 d_vfork='$d_vfork'
23129 d_void_closedir='$d_void_closedir'
23130 d_voidsig='$d_voidsig'
23131 d_voidtty='$d_voidtty'
23132 d_volatile='$d_volatile'
23133 d_vprintf='$d_vprintf'
23134 d_vsnprintf='$d_vsnprintf'
23135 d_wait4='$d_wait4'
23136 d_waitpid='$d_waitpid'
23137 d_wcstombs='$d_wcstombs'
23138 d_wctomb='$d_wctomb'
23139 d_writev='$d_writev'
23140 d_xenix='$d_xenix'
23141 date='$date'
23142 db_hashtype='$db_hashtype'
23143 db_prefixtype='$db_prefixtype'
23144 db_version_major='$db_version_major'
23145 db_version_minor='$db_version_minor'
23146 db_version_patch='$db_version_patch'
23147 direntrytype='$direntrytype'
23148 dlext='$dlext'
23149 dlsrc='$dlsrc'
23150 doublesize='$doublesize'
23151 drand01='$drand01'
23152 drand48_r_proto='$drand48_r_proto'
23153 dtrace='$dtrace'
23154 dynamic_ext='$dynamic_ext'
23155 eagain='$eagain'
23156 ebcdic='$ebcdic'
23157 echo='$echo'
23158 egrep='$egrep'
23159 emacs='$emacs'
23160 endgrent_r_proto='$endgrent_r_proto'
23161 endhostent_r_proto='$endhostent_r_proto'
23162 endnetent_r_proto='$endnetent_r_proto'
23163 endprotoent_r_proto='$endprotoent_r_proto'
23164 endpwent_r_proto='$endpwent_r_proto'
23165 endservent_r_proto='$endservent_r_proto'
23166 eunicefix='$eunicefix'
23167 exe_ext='$exe_ext'
23168 expr='$expr'
23169 extensions='$extensions'
23170 extern_C='$extern_C'
23171 extras='$extras'
23172 fflushNULL='$fflushNULL'
23173 fflushall='$fflushall'
23174 find='$find'
23175 firstmakefile='$firstmakefile'
23176 flex='$flex'
23177 fpossize='$fpossize'
23178 fpostype='$fpostype'
23179 freetype='$freetype'
23180 from='$from'
23181 full_ar='$full_ar'
23182 full_csh='$full_csh'
23183 full_sed='$full_sed'
23184 gccansipedantic='$gccansipedantic'
23185 gccosandvers='$gccosandvers'
23186 gccversion='$gccversion'
23187 getgrent_r_proto='$getgrent_r_proto'
23188 getgrgid_r_proto='$getgrgid_r_proto'
23189 getgrnam_r_proto='$getgrnam_r_proto'
23190 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
23191 gethostbyname_r_proto='$gethostbyname_r_proto'
23192 gethostent_r_proto='$gethostent_r_proto'
23193 getlogin_r_proto='$getlogin_r_proto'
23194 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
23195 getnetbyname_r_proto='$getnetbyname_r_proto'
23196 getnetent_r_proto='$getnetent_r_proto'
23197 getprotobyname_r_proto='$getprotobyname_r_proto'
23198 getprotobynumber_r_proto='$getprotobynumber_r_proto'
23199 getprotoent_r_proto='$getprotoent_r_proto'
23200 getpwent_r_proto='$getpwent_r_proto'
23201 getpwnam_r_proto='$getpwnam_r_proto'
23202 getpwuid_r_proto='$getpwuid_r_proto'
23203 getservbyname_r_proto='$getservbyname_r_proto'
23204 getservbyport_r_proto='$getservbyport_r_proto'
23205 getservent_r_proto='$getservent_r_proto'
23206 getspnam_r_proto='$getspnam_r_proto'
23207 gidformat='$gidformat'
23208 gidsign='$gidsign'
23209 gidsize='$gidsize'
23210 gidtype='$gidtype'
23211 glibpth='$glibpth'
23212 gmake='$gmake'
23213 gmtime_r_proto='$gmtime_r_proto'
23214 gnulibc_version='$gnulibc_version'
23215 grep='$grep'
23216 groupcat='$groupcat'
23217 groupstype='$groupstype'
23218 gzip='$gzip'
23219 h_fcntl='$h_fcntl'
23220 h_sysfile='$h_sysfile'
23221 hint='$hint'
23222 hostcat='$hostcat'
23223 html1dir='$html1dir'
23224 html1direxp='$html1direxp'
23225 html3dir='$html3dir'
23226 html3direxp='$html3direxp'
23227 i16size='$i16size'
23228 i16type='$i16type'
23229 i32size='$i32size'
23230 i32type='$i32type'
23231 i64size='$i64size'
23232 i64type='$i64type'
23233 i8size='$i8size'
23234 i8type='$i8type'
23235 i_arpainet='$i_arpainet'
23236 i_assert='$i_assert'
23237 i_bsdioctl='$i_bsdioctl'
23238 i_crypt='$i_crypt'
23239 i_db='$i_db'
23240 i_dbm='$i_dbm'
23241 i_dirent='$i_dirent'
23242 i_dlfcn='$i_dlfcn'
23243 i_fcntl='$i_fcntl'
23244 i_float='$i_float'
23245 i_fp='$i_fp'
23246 i_fp_class='$i_fp_class'
23247 i_gdbm='$i_gdbm'
23248 i_gdbm_ndbm='$i_gdbm_ndbm'
23249 i_gdbmndbm='$i_gdbmndbm'
23250 i_grp='$i_grp'
23251 i_ieeefp='$i_ieeefp'
23252 i_inttypes='$i_inttypes'
23253 i_langinfo='$i_langinfo'
23254 i_libutil='$i_libutil'
23255 i_limits='$i_limits'
23256 i_locale='$i_locale'
23257 i_machcthr='$i_machcthr'
23258 i_malloc='$i_malloc'
23259 i_mallocmalloc='$i_mallocmalloc'
23260 i_math='$i_math'
23261 i_memory='$i_memory'
23262 i_mntent='$i_mntent'
23263 i_ndbm='$i_ndbm'
23264 i_netdb='$i_netdb'
23265 i_neterrno='$i_neterrno'
23266 i_netinettcp='$i_netinettcp'
23267 i_niin='$i_niin'
23268 i_poll='$i_poll'
23269 i_prot='$i_prot'
23270 i_pthread='$i_pthread'
23271 i_pwd='$i_pwd'
23272 i_rpcsvcdbm='$i_rpcsvcdbm'
23273 i_sgtty='$i_sgtty'
23274 i_shadow='$i_shadow'
23275 i_socks='$i_socks'
23276 i_stdarg='$i_stdarg'
23277 i_stdbool='$i_stdbool'
23278 i_stddef='$i_stddef'
23279 i_stdlib='$i_stdlib'
23280 i_string='$i_string'
23281 i_sunmath='$i_sunmath'
23282 i_sysaccess='$i_sysaccess'
23283 i_sysdir='$i_sysdir'
23284 i_sysfile='$i_sysfile'
23285 i_sysfilio='$i_sysfilio'
23286 i_sysin='$i_sysin'
23287 i_sysioctl='$i_sysioctl'
23288 i_syslog='$i_syslog'
23289 i_sysmman='$i_sysmman'
23290 i_sysmode='$i_sysmode'
23291 i_sysmount='$i_sysmount'
23292 i_sysndir='$i_sysndir'
23293 i_sysparam='$i_sysparam'
23294 i_syspoll='$i_syspoll'
23295 i_sysresrc='$i_sysresrc'
23296 i_syssecrt='$i_syssecrt'
23297 i_sysselct='$i_sysselct'
23298 i_syssockio='$i_syssockio'
23299 i_sysstat='$i_sysstat'
23300 i_sysstatfs='$i_sysstatfs'
23301 i_sysstatvfs='$i_sysstatvfs'
23302 i_systime='$i_systime'
23303 i_systimek='$i_systimek'
23304 i_systimes='$i_systimes'
23305 i_systypes='$i_systypes'
23306 i_sysuio='$i_sysuio'
23307 i_sysun='$i_sysun'
23308 i_sysutsname='$i_sysutsname'
23309 i_sysvfs='$i_sysvfs'
23310 i_syswait='$i_syswait'
23311 i_termio='$i_termio'
23312 i_termios='$i_termios'
23313 i_time='$i_time'
23314 i_unistd='$i_unistd'
23315 i_ustat='$i_ustat'
23316 i_utime='$i_utime'
23317 i_values='$i_values'
23318 i_varargs='$i_varargs'
23319 i_varhdr='$i_varhdr'
23320 i_vfork='$i_vfork'
23321 ignore_versioned_solibs='$ignore_versioned_solibs'
23322 inc_version_list='$inc_version_list'
23323 inc_version_list_init='$inc_version_list_init'
23324 incpath='$incpath'
23325 inews='$inews'
23326 initialinstalllocation='$initialinstalllocation'
23327 installarchlib='$installarchlib'
23328 installbin='$installbin'
23329 installhtml1dir='$installhtml1dir'
23330 installhtml3dir='$installhtml3dir'
23331 installman1dir='$installman1dir'
23332 installman3dir='$installman3dir'
23333 installprefix='$installprefix'
23334 installprefixexp='$installprefixexp'
23335 installprivlib='$installprivlib'
23336 installscript='$installscript'
23337 installsitearch='$installsitearch'
23338 installsitebin='$installsitebin'
23339 installsitehtml1dir='$installsitehtml1dir'
23340 installsitehtml3dir='$installsitehtml3dir'
23341 installsitelib='$installsitelib'
23342 installsiteman1dir='$installsiteman1dir'
23343 installsiteman3dir='$installsiteman3dir'
23344 installsitescript='$installsitescript'
23345 installstyle='$installstyle'
23346 installusrbinperl='$installusrbinperl'
23347 installvendorarch='$installvendorarch'
23348 installvendorbin='$installvendorbin'
23349 installvendorhtml1dir='$installvendorhtml1dir'
23350 installvendorhtml3dir='$installvendorhtml3dir'
23351 installvendorlib='$installvendorlib'
23352 installvendorman1dir='$installvendorman1dir'
23353 installvendorman3dir='$installvendorman3dir'
23354 installvendorscript='$installvendorscript'
23355 intsize='$intsize'
23356 issymlink='$issymlink'
23357 ivdformat='$ivdformat'
23358 ivsize='$ivsize'
23359 ivtype='$ivtype'
23360 known_extensions='$known_extensions'
23361 ksh='$ksh'
23362 ld='$ld'
23363 ld_can_script='$ld_can_script'
23364 lddlflags='$lddlflags'
23365 ldflags='$ldflags'
23366 ldflags_uselargefiles='$ldflags_uselargefiles'
23367 ldlibpthname='$ldlibpthname'
23368 less='$less'
23369 lib_ext='$lib_ext'
23370 libc='$libc'
23371 libperl='$libperl'
23372 libpth='$libpth'
23373 libs='$libs'
23374 libsdirs='$libsdirs'
23375 libsfiles='$libsfiles'
23376 libsfound='$libsfound'
23377 libspath='$libspath'
23378 libswanted='$libswanted'
23379 libswanted_uselargefiles='$libswanted_uselargefiles'
23380 line='$line'
23381 lint='$lint'
23382 lkflags='$lkflags'
23383 ln='$ln'
23384 lns='$lns'
23385 localtime_r_proto='$localtime_r_proto'
23386 locincpth='$locincpth'
23387 loclibpth='$loclibpth'
23388 longdblsize='$longdblsize'
23389 longlongsize='$longlongsize'
23390 longsize='$longsize'
23391 lp='$lp'
23392 lpr='$lpr'
23393 ls='$ls'
23394 lseeksize='$lseeksize'
23395 lseektype='$lseektype'
23396 mad='$mad'
23397 madlyh='$madlyh'
23398 madlyobj='$madlyobj'
23399 madlysrc='$madlysrc'
23400 mail='$mail'
23401 mailx='$mailx'
23402 make='$make'
23403 make_set_make='$make_set_make'
23404 mallocobj='$mallocobj'
23405 mallocsrc='$mallocsrc'
23406 malloctype='$malloctype'
23407 man1dir='$man1dir'
23408 man1direxp='$man1direxp'
23409 man1ext='$man1ext'
23410 man3dir='$man3dir'
23411 man3direxp='$man3direxp'
23412 man3ext='$man3ext'
23413 mips_type='$mips_type'
23414 mistrustnm='$mistrustnm'
23415 mkdir='$mkdir'
23416 mmaptype='$mmaptype'
23417 modetype='$modetype'
23418 more='$more'
23419 multiarch='$multiarch'
23420 mv='$mv'
23421 myarchname='$myarchname'
23422 mydomain='$mydomain'
23423 myhostname='$myhostname'
23424 myuname='$myuname'
23425 n='$n'
23426 need_va_copy='$need_va_copy'
23427 netdb_hlen_type='$netdb_hlen_type'
23428 netdb_host_type='$netdb_host_type'
23429 netdb_name_type='$netdb_name_type'
23430 netdb_net_type='$netdb_net_type'
23431 nm='$nm'
23432 nm_opt='$nm_opt'
23433 nm_so_opt='$nm_so_opt'
23434 nonxs_ext='$nonxs_ext'
23435 nroff='$nroff'
23436 nvEUformat='$nvEUformat'
23437 nvFUformat='$nvFUformat'
23438 nvGUformat='$nvGUformat'
23439 nv_overflows_integers_at='$nv_overflows_integers_at'
23440 nv_preserves_uv_bits='$nv_preserves_uv_bits'
23441 nveformat='$nveformat'
23442 nvfformat='$nvfformat'
23443 nvgformat='$nvgformat'
23444 nvsize='$nvsize'
23445 nvtype='$nvtype'
23446 o_nonblock='$o_nonblock'
23447 obj_ext='$obj_ext'
23448 old_pthread_create_joinable='$old_pthread_create_joinable'
23449 optimize='$optimize'
23450 orderlib='$orderlib'
23451 osname='$osname'
23452 osvers='$osvers'
23453 otherlibdirs='$otherlibdirs'
23454 package='$package'
23455 pager='$pager'
23456 passcat='$passcat'
23457 patchlevel='$patchlevel'
23458 path_sep='$path_sep'
23459 perl5='$perl5'
23460 perl='$perl'
23461 perl_patchlevel='$perl_patchlevel'
23462 perl_static_inline='$perl_static_inline'
23463 perladmin='$perladmin'
23464 perllibs='$perllibs'
23465 perlpath='$perlpath'
23466 pg='$pg'
23467 phostname='$phostname'
23468 pidtype='$pidtype'
23469 plibpth='$plibpth'
23470 pmake='$pmake'
23471 pr='$pr'
23472 prefix='$prefix'
23473 prefixexp='$prefixexp'
23474 privlib='$privlib'
23475 privlibexp='$privlibexp'
23476 procselfexe='$procselfexe'
23477 prototype='$prototype'
23478 ptrsize='$ptrsize'
23479 quadkind='$quadkind'
23480 quadtype='$quadtype'
23481 randbits='$randbits'
23482 randfunc='$randfunc'
23483 random_r_proto='$random_r_proto'
23484 randseedtype='$randseedtype'
23485 ranlib='$ranlib'
23486 rd_nodata='$rd_nodata'
23487 readdir64_r_proto='$readdir64_r_proto'
23488 readdir_r_proto='$readdir_r_proto'
23489 revision='$revision'
23490 rm='$rm'
23491 rm_try='$rm_try'
23492 rmail='$rmail'
23493 run='$run'
23494 runnm='$runnm'
23495 sGMTIME_max='$sGMTIME_max'
23496 sGMTIME_min='$sGMTIME_min'
23497 sLOCALTIME_max='$sLOCALTIME_max'
23498 sLOCALTIME_min='$sLOCALTIME_min'
23499 sPRIEUldbl='$sPRIEUldbl'
23500 sPRIFUldbl='$sPRIFUldbl'
23501 sPRIGUldbl='$sPRIGUldbl'
23502 sPRIXU64='$sPRIXU64'
23503 sPRId64='$sPRId64'
23504 sPRIeldbl='$sPRIeldbl'
23505 sPRIfldbl='$sPRIfldbl'
23506 sPRIgldbl='$sPRIgldbl'
23507 sPRIi64='$sPRIi64'
23508 sPRIo64='$sPRIo64'
23509 sPRIu64='$sPRIu64'
23510 sPRIx64='$sPRIx64'
23511 sSCNfldbl='$sSCNfldbl'
23512 sched_yield='$sched_yield'
23513 scriptdir='$scriptdir'
23514 scriptdirexp='$scriptdirexp'
23515 sed='$sed'
23516 seedfunc='$seedfunc'
23517 selectminbits='$selectminbits'
23518 selecttype='$selecttype'
23519 sendmail='$sendmail'
23520 setgrent_r_proto='$setgrent_r_proto'
23521 sethostent_r_proto='$sethostent_r_proto'
23522 setlocale_r_proto='$setlocale_r_proto'
23523 setnetent_r_proto='$setnetent_r_proto'
23524 setprotoent_r_proto='$setprotoent_r_proto'
23525 setpwent_r_proto='$setpwent_r_proto'
23526 setservent_r_proto='$setservent_r_proto'
23527 sh='$sh'
23528 shar='$shar'
23529 sharpbang='$sharpbang'
23530 shmattype='$shmattype'
23531 shortsize='$shortsize'
23532 shrpenv='$shrpenv'
23533 shsharp='$shsharp'
23534 sig_count='$sig_count'
23535 sig_name='$sig_name'
23536 sig_name_init='$sig_name_init'
23537 sig_num='$sig_num'
23538 sig_num_init='$sig_num_init'
23539 sig_size='$sig_size'
23540 signal_t='$signal_t'
23541 sitearch='$sitearch'
23542 sitearchexp='$sitearchexp'
23543 sitebin='$sitebin'
23544 sitebinexp='$sitebinexp'
23545 sitehtml1dir='$sitehtml1dir'
23546 sitehtml1direxp='$sitehtml1direxp'
23547 sitehtml3dir='$sitehtml3dir'
23548 sitehtml3direxp='$sitehtml3direxp'
23549 sitelib='$sitelib'
23550 sitelib_stem='$sitelib_stem'
23551 sitelibexp='$sitelibexp'
23552 siteman1dir='$siteman1dir'
23553 siteman1direxp='$siteman1direxp'
23554 siteman3dir='$siteman3dir'
23555 siteman3direxp='$siteman3direxp'
23556 siteprefix='$siteprefix'
23557 siteprefixexp='$siteprefixexp'
23558 sitescript='$sitescript'
23559 sitescriptexp='$sitescriptexp'
23560 sizesize='$sizesize'
23561 sizetype='$sizetype'
23562 sleep='$sleep'
23563 smail='$smail'
23564 so='$so'
23565 sockethdr='$sockethdr'
23566 socketlib='$socketlib'
23567 socksizetype='$socksizetype'
23568 sort='$sort'
23569 spackage='$spackage'
23570 spitshell='$spitshell'
23571 srand48_r_proto='$srand48_r_proto'
23572 srandom_r_proto='$srandom_r_proto'
23573 src='$src'
23574 ssizetype='$ssizetype'
23575 st_ino_sign='$st_ino_sign'
23576 st_ino_size='$st_ino_size'
23577 startperl='$startperl'
23578 startsh='$startsh'
23579 static_ext='$static_ext'
23580 stdchar='$stdchar'
23581 stdio_base='$stdio_base'
23582 stdio_bufsiz='$stdio_bufsiz'
23583 stdio_cnt='$stdio_cnt'
23584 stdio_filbuf='$stdio_filbuf'
23585 stdio_ptr='$stdio_ptr'
23586 stdio_stream_array='$stdio_stream_array'
23587 strerror_r_proto='$strerror_r_proto'
23588 strings='$strings'
23589 submit='$submit'
23590 subversion='$subversion'
23591 sysman='$sysman'
23592 tail='$tail'
23593 tar='$tar'
23594 targetarch='$targetarch'
23595 tbl='$tbl'
23596 tee='$tee'
23597 test='$test'
23598 timeincl='$timeincl'
23599 timetype='$timetype'
23600 tmpnam_r_proto='$tmpnam_r_proto'
23601 to='$to'
23602 touch='$touch'
23603 tr='$tr'
23604 trnl='$trnl'
23605 troff='$troff'
23606 ttyname_r_proto='$ttyname_r_proto'
23607 u16size='$u16size'
23608 u16type='$u16type'
23609 u32size='$u32size'
23610 u32type='$u32type'
23611 u64size='$u64size'
23612 u64type='$u64type'
23613 u8size='$u8size'
23614 u8type='$u8type'
23615 uidformat='$uidformat'
23616 uidsign='$uidsign'
23617 uidsize='$uidsize'
23618 uidtype='$uidtype'
23619 uname='$uname'
23620 uniq='$uniq'
23621 uquadtype='$uquadtype'
23622 use5005threads='$use5005threads'
23623 use64bitall='$use64bitall'
23624 use64bitint='$use64bitint'
23625 usecrosscompile='$usecrosscompile'
23626 usedevel='$usedevel'
23627 usedl='$usedl'
23628 usedtrace='$usedtrace'
23629 usefaststdio='$usefaststdio'
23630 useithreads='$useithreads'
23631 usekernprocpathname='$usekernprocpathname'
23632 uselargefiles='$uselargefiles'
23633 uselongdouble='$uselongdouble'
23634 usemallocwrap='$usemallocwrap'
23635 usemorebits='$usemorebits'
23636 usemultiplicity='$usemultiplicity'
23637 usemymalloc='$usemymalloc'
23638 usenm='$usenm'
23639 usensgetexecutablepath='$usensgetexecutablepath'
23640 useopcode='$useopcode'
23641 useperlio='$useperlio'
23642 useposix='$useposix'
23643 usereentrant='$usereentrant'
23644 userelocatableinc='$userelocatableinc'
23645 useshrplib='$useshrplib'
23646 usesitecustomize='$usesitecustomize'
23647 usesocks='$usesocks'
23648 usethreads='$usethreads'
23649 usevendorprefix='$usevendorprefix'
23650 useversionedarchname='$useversionedarchname'
23651 usevfork='$usevfork'
23652 usrinc='$usrinc'
23653 uuname='$uuname'
23654 uvXUformat='$uvXUformat'
23655 uvoformat='$uvoformat'
23656 uvsize='$uvsize'
23657 uvtype='$uvtype'
23658 uvuformat='$uvuformat'
23659 uvxformat='$uvxformat'
23660 vaproto='$vaproto'
23661 vendorarch='$vendorarch'
23662 vendorarchexp='$vendorarchexp'
23663 vendorbin='$vendorbin'
23664 vendorbinexp='$vendorbinexp'
23665 vendorhtml1dir='$vendorhtml1dir'
23666 vendorhtml1direxp='$vendorhtml1direxp'
23667 vendorhtml3dir='$vendorhtml3dir'
23668 vendorhtml3direxp='$vendorhtml3direxp'
23669 vendorlib='$vendorlib'
23670 vendorlib_stem='$vendorlib_stem'
23671 vendorlibexp='$vendorlibexp'
23672 vendorman1dir='$vendorman1dir'
23673 vendorman1direxp='$vendorman1direxp'
23674 vendorman3dir='$vendorman3dir'
23675 vendorman3direxp='$vendorman3direxp'
23676 vendorprefix='$vendorprefix'
23677 vendorprefixexp='$vendorprefixexp'
23678 vendorscript='$vendorscript'
23679 vendorscriptexp='$vendorscriptexp'
23680 version='$version'
23681 version_patchlevel_string='$version_patchlevel_string'
23682 versiononly='$versiononly'
23683 vi='$vi'
23684 xlibpth='$xlibpth'
23685 yacc='$yacc'
23686 yaccflags='$yaccflags'
23687 zcat='$zcat'
23688 zip='$zip'
23689 EOT
23690
23691 : add special variables
23692 $test -f $src/patchlevel.h && \
23693 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23694 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23695 echo "PERL_CONFIG_SH=true" >>config.sh
23696
23697 : propagate old symbols
23698 if $test -f UU/config.sh; then
23699         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23700         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23701                 config.sh config.sh UU/oldconfig.sh |\
23702                 $sort | $uniq -u >UU/oldsyms
23703         set X `$cat UU/oldsyms`
23704         shift
23705         case $# in
23706         0) ;;
23707         *)
23708                 $cat <<EOM
23709 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23710 EOM
23711                 echo ": Variables propagated from previous config.sh file." >>config.sh
23712                 for sym in `$cat UU/oldsyms`; do
23713                         echo "    Propagating $hint variable "'$'"$sym..."
23714                         eval 'tmp="$'"${sym}"'"'
23715                         echo "$tmp" | \
23716                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23717                 done
23718                 ;;
23719         esac
23720 fi
23721
23722 : Finish up by extracting the .SH files
23723 case "$alldone" in
23724 exit)
23725         $rm -rf UU
23726         echo "Extraction done."
23727         exit 0
23728         ;;
23729 cont)
23730         ;;
23731 '')
23732         dflt=''
23733         nostick=true
23734         $cat <<EOM
23735
23736 If you'd like to make any changes to the config.sh file before I begin
23737 to configure things, do it as a shell escape now (e.g. !vi config.sh).
23738
23739 EOM
23740         rp="Press return or use a shell escape to edit config.sh:"
23741         . UU/myread
23742         nostick=''
23743         case "$ans" in
23744         '') ;;
23745         *) : in case they cannot read
23746                 sh 1>&4 -c "$ans";;
23747         esac
23748         ;;
23749 esac
23750
23751 : if this fails, just run all the .SH files by hand
23752 . ./config.sh
23753
23754 echo " "
23755 exec 1>&4
23756 pwd=`pwd`
23757 . ./UU/extract
23758 cd "$pwd"
23759
23760 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23761         dflt=y
23762         case "$silent" in
23763         true) ;;
23764         *)
23765                 $cat <<EOM
23766
23767 Now you need to generate make dependencies by running "$make depend".
23768 You might prefer to run it in background: "$make depend > makedepend.out &"
23769 It can take a while, so you might not want to run it right now.
23770
23771 EOM
23772                 ;;
23773         esac
23774         rp="Run $make depend now?"
23775         . UU/myread
23776         case "$ans" in
23777         y*)
23778                 $make depend && echo "Now you must run '$make'."
23779                 ;;
23780         *)
23781                 echo "You must run '$make depend' then '$make'."
23782                 ;;
23783         esac
23784 elif test -f [Mm]akefile; then
23785         echo " "
23786         echo "Now you must run a $make."
23787 else
23788         echo "Configure done."
23789 fi
23790
23791 if $test -f Policy.sh; then
23792     $cat <<EOM
23793
23794 If you compile $package on a different machine or from a different object
23795 directory, copy the Policy.sh file from this object directory to the
23796 new one before you run Configure -- this will help you with most of
23797 the policy defaults.
23798
23799 EOM
23800 fi
23801 if $test -f config.msg; then
23802     echo "Hmm.  I also noted the following information while running:"
23803     echo " "
23804     $cat config.msg >&4
23805     $rm -f config.msg
23806 fi
23807 $rm -f kit*isdone ark*isdone
23808 $rm -rf UU
23809
23810 : End of Configure
23811