This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update Module-Load to CPAN version 0.28
[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 Wed Jan  1 18:06:40 CET 2014 [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_libname_unique=''
579 d_link=''
580 d_localtime_r=''
581 d_localtime_r_needs_tzset=''
582 localtime_r_proto=''
583 d_locconv=''
584 d_lockf=''
585 d_longdbl=''
586 longdblsize=''
587 d_longlong=''
588 longlongsize=''
589 d_lseekproto=''
590 d_lstat=''
591 d_madvise=''
592 d_malloc_good_size=''
593 d_malloc_size=''
594 d_mblen=''
595 d_mbstowcs=''
596 d_mbtowc=''
597 d_memchr=''
598 d_memcmp=''
599 d_memcpy=''
600 d_memmove=''
601 d_memset=''
602 d_mkdir=''
603 d_mkdtemp=''
604 d_mkfifo=''
605 d_mkstemp=''
606 d_mkstemps=''
607 d_mktime=''
608 d_mmap=''
609 mmaptype=''
610 d_modfl=''
611 d_modfl_pow32_bug=''
612 d_modflproto=''
613 d_mprotect=''
614 d_msg=''
615 d_msgctl=''
616 d_msgget=''
617 d_msghdr_s=''
618 d_msgrcv=''
619 d_msgsnd=''
620 d_msync=''
621 d_munmap=''
622 d_nice=''
623 d_nl_langinfo=''
624 d_off64_t=''
625 d_open3=''
626 d_fpathconf=''
627 d_pathconf=''
628 d_pause=''
629 d_pipe=''
630 d_poll=''
631 d_portable=''
632 d_prctl=''
633 d_prctl_set_name=''
634 d_procselfexe=''
635 procselfexe=''
636 d_old_pthread_create_joinable=''
637 old_pthread_create_joinable=''
638 d_pthread_atfork=''
639 d_pthread_attr_setscope=''
640 d_pthread_yield=''
641 d_sched_yield=''
642 sched_yield=''
643 d_qgcvt=''
644 d_random_r=''
645 random_r_proto=''
646 d_readdir64_r=''
647 readdir64_r_proto=''
648 d_readdir=''
649 d_rewinddir=''
650 d_seekdir=''
651 d_telldir=''
652 d_readdir_r=''
653 readdir_r_proto=''
654 d_readlink=''
655 d_readv=''
656 d_recvmsg=''
657 d_rename=''
658 d_rmdir=''
659 d_safebcpy=''
660 d_safemcpy=''
661 d_sanemcmp=''
662 d_sbrkproto=''
663 d_scalbnl=''
664 d_select=''
665 d_sem=''
666 d_semctl=''
667 d_semget=''
668 d_semop=''
669 d_sendmsg=''
670 d_setegid=''
671 d_seteuid=''
672 d_setgrent=''
673 d_setgrent_r=''
674 setgrent_r_proto=''
675 d_setgrps=''
676 d_sethent=''
677 d_sethostent_r=''
678 sethostent_r_proto=''
679 d_setitimer=''
680 d_setlinebuf=''
681 d_setlocale=''
682 d_setlocale_r=''
683 setlocale_r_proto=''
684 d_setnent=''
685 d_setnetent_r=''
686 setnetent_r_proto=''
687 d_setpent=''
688 d_setpgid=''
689 d_setpgrp2=''
690 d_bsdsetpgrp=''
691 d_setpgrp=''
692 d_setprior=''
693 d_setproctitle=''
694 d_setprotoent_r=''
695 setprotoent_r_proto=''
696 d_setpwent=''
697 d_setpwent_r=''
698 setpwent_r_proto=''
699 d_setregid=''
700 d_setresgid=''
701 d_setresuid=''
702 d_setreuid=''
703 d_setrgid=''
704 d_setruid=''
705 d_setsent=''
706 d_setservent_r=''
707 setservent_r_proto=''
708 d_setsid=''
709 d_setvbuf=''
710 d_shm=''
711 d_shmat=''
712 d_shmatprototype=''
713 shmattype=''
714 d_shmctl=''
715 d_shmdt=''
716 d_shmget=''
717 d_sigaction=''
718 d_signbit=''
719 d_sigprocmask=''
720 d_sigsetjmp=''
721 usesitecustomize=''
722 d_snprintf=''
723 d_vsnprintf=''
724 d_sockatmark=''
725 d_sockatmarkproto=''
726 d_ip_mreq=''
727 d_ip_mreq_source=''
728 d_ipv6_mreq=''
729 d_ipv6_mreq_source=''
730 d_msg_ctrunc=''
731 d_msg_dontroute=''
732 d_msg_oob=''
733 d_msg_peek=''
734 d_msg_proxy=''
735 d_oldsock=''
736 d_scm_rights=''
737 d_sin6_scope_id=''
738 d_sockaddr_in6=''
739 d_sockaddr_sa_len=''
740 d_socket=''
741 d_sockpair=''
742 sockethdr=''
743 socketlib=''
744 d_socklen_t=''
745 d_socks5_init=''
746 d_sprintf_returns_strlen=''
747 d_sqrtl=''
748 d_srand48_r=''
749 srand48_r_proto=''
750 d_srandom_r=''
751 srandom_r_proto=''
752 d_sresgproto=''
753 d_sresuproto=''
754 d_statblks=''
755 d_statfs_f_flags=''
756 d_statfs_s=''
757 d_static_inline=''
758 perl_static_inline=''
759 d_fstatvfs=''
760 d_statvfs=''
761 d_stdio_cnt_lval=''
762 d_stdio_ptr_lval=''
763 d_stdio_ptr_lval_nochange_cnt=''
764 d_stdio_ptr_lval_sets_cnt=''
765 d_stdiobase=''
766 d_stdstdio=''
767 stdio_base=''
768 stdio_bufsiz=''
769 stdio_cnt=''
770 stdio_filbuf=''
771 stdio_ptr=''
772 d_index=''
773 d_strchr=''
774 d_strcoll=''
775 d_strctcpy=''
776 d_strerrm=''
777 d_strerror=''
778 d_sysernlst=''
779 d_syserrlst=''
780 d_strerror_r=''
781 strerror_r_proto=''
782 d_strftime=''
783 d_strlcat=''
784 d_strlcpy=''
785 d_strtod=''
786 d_strtol=''
787 d_strtold=''
788 d_strtoll=''
789 d_strtoq=''
790 d_strtoul=''
791 d_strtoull=''
792 d_strtouq=''
793 d_strxfrm=''
794 d_symlink=''
795 d_syscall=''
796 d_syscallproto=''
797 d_sysconf=''
798 d_system=''
799 d_tcgetpgrp=''
800 d_tcsetpgrp=''
801 d_telldirproto=''
802 d_time=''
803 timetype=''
804 d_asctime64=''
805 d_ctime64=''
806 d_difftime64=''
807 d_gmtime64=''
808 d_localtime64=''
809 d_mktime64=''
810 d_timegm=''
811 clocktype=''
812 d_times=''
813 d_tmpnam_r=''
814 tmpnam_r_proto=''
815 d_truncate=''
816 d_ttyname_r=''
817 ttyname_r_proto=''
818 d_tzname=''
819 d_u32align=''
820 d_ualarm=''
821 d_umask=''
822 d_semctl_semid_ds=''
823 d_semctl_semun=''
824 d_union_semun=''
825 d_unordered=''
826 d_unsetenv=''
827 d_usleep=''
828 d_usleepproto=''
829 d_ustat=''
830 d_pseudofork=''
831 d_vfork=''
832 usevfork=''
833 d_voidsig=''
834 signal_t=''
835 d_volatile=''
836 d_charvspr=''
837 d_vprintf=''
838 d_wait4=''
839 d_waitpid=''
840 d_wcstombs=''
841 d_wctomb=''
842 d_writev=''
843 dlext=''
844 bin_ELF=''
845 cccdlflags=''
846 ccdlflags=''
847 dlsrc=''
848 ld=''
849 ld_can_script=''
850 lddlflags=''
851 usedl=''
852 doublesize=''
853 bootstrap_charset=''
854 ebcdic=''
855 fflushNULL=''
856 fflushall=''
857 fpossize=''
858 fpostype=''
859 gccansipedantic=''
860 gccosandvers=''
861 gccversion=''
862 gidformat=''
863 gidsign=''
864 gidsize=''
865 gidtype=''
866 groupstype=''
867 h_fcntl=''
868 h_sysfile=''
869 html1dir=''
870 html1direxp=''
871 installhtml1dir=''
872 html3dir=''
873 html3direxp=''
874 installhtml3dir=''
875 i_arpainet=''
876 i_assert=''
877 i_crypt=''
878 db_hashtype=''
879 db_prefixtype=''
880 db_version_major=''
881 db_version_minor=''
882 db_version_patch=''
883 i_db=''
884 i_dbm=''
885 i_rpcsvcdbm=''
886 d_dirnamlen=''
887 direntrytype=''
888 i_dirent=''
889 i_dlfcn=''
890 i_fcntl=''
891 i_float=''
892 i_fp=''
893 i_fp_class=''
894 i_gdbm=''
895 d_grpasswd=''
896 i_grp=''
897 i_ieeefp=''
898 i_inttypes=''
899 i_langinfo=''
900 i_libutil=''
901 i_limits=''
902 i_locale=''
903 i_machcthr=''
904 i_malloc=''
905 i_mallocmalloc=''
906 i_math=''
907 i_memory=''
908 i_mntent=''
909 d_gdbm_ndbm_h_uses_prototypes=''
910 d_gdbmndbm_h_uses_prototypes=''
911 d_ndbm=''
912 d_ndbm_h_uses_prototypes=''
913 i_gdbm_ndbm=''
914 i_gdbmndbm=''
915 i_ndbm=''
916 i_netdb=''
917 i_neterrno=''
918 i_netinettcp=''
919 i_niin=''
920 i_sysin=''
921 i_poll=''
922 i_prot=''
923 i_pthread=''
924 d_pwage=''
925 d_pwchange=''
926 d_pwclass=''
927 d_pwcomment=''
928 d_pwexpire=''
929 d_pwgecos=''
930 d_pwpasswd=''
931 d_pwquota=''
932 i_pwd=''
933 i_shadow=''
934 i_socks=''
935 i_stdbool=''
936 i_stddef=''
937 i_stdlib=''
938 i_string=''
939 strings=''
940 i_sunmath=''
941 i_sysaccess=''
942 i_sysdir=''
943 i_sysfile=''
944 d_voidtty=''
945 i_bsdioctl=''
946 i_sysfilio=''
947 i_sysioctl=''
948 i_syssockio=''
949 i_syslog=''
950 i_sysmman=''
951 i_sysmode=''
952 i_sysmount=''
953 i_sysndir=''
954 i_sysparam=''
955 i_syspoll=''
956 i_sysresrc=''
957 i_syssecrt=''
958 i_sysselct=''
959 i_sysstat=''
960 i_sysstatfs=''
961 i_sysstatvfs=''
962 i_systimes=''
963 i_systypes=''
964 i_sysuio=''
965 i_sysun=''
966 i_sysutsname=''
967 i_sysvfs=''
968 i_syswait=''
969 i_sgtty=''
970 i_termio=''
971 i_termios=''
972 d_tm_tm_gmtoff=''
973 d_tm_tm_zone=''
974 i_systime=''
975 i_systimek=''
976 i_time=''
977 timeincl=''
978 i_unistd=''
979 i_ustat=''
980 i_utime=''
981 i_values=''
982 i_stdarg=''
983 i_varargs=''
984 i_varhdr=''
985 i_vfork=''
986 d_inc_version_list=''
987 inc_version_list=''
988 inc_version_list_init=''
989 installprefix=''
990 installprefixexp=''
991 installstyle=''
992 installusrbinperl=''
993 intsize=''
994 longsize=''
995 shortsize=''
996 issymlink=''
997 libc=''
998 ldlibpthname=''
999 libperl=''
1000 shrpenv=''
1001 useshrplib=''
1002 glibpth=''
1003 libpth=''
1004 loclibpth=''
1005 plibpth=''
1006 xlibpth=''
1007 ignore_versioned_solibs=''
1008 libs=''
1009 libsdirs=''
1010 libsfiles=''
1011 libsfound=''
1012 libspath=''
1013 lns=''
1014 d_PRIEUldbl=''
1015 d_PRIFUldbl=''
1016 d_PRIGUldbl=''
1017 d_PRIeldbl=''
1018 d_PRIfldbl=''
1019 d_PRIgldbl=''
1020 d_SCNfldbl=''
1021 sPRIEUldbl=''
1022 sPRIFUldbl=''
1023 sPRIGUldbl=''
1024 sPRIeldbl=''
1025 sPRIfldbl=''
1026 sPRIgldbl=''
1027 sSCNfldbl=''
1028 lseeksize=''
1029 lseektype=''
1030 mad=''
1031 madlyh=''
1032 madlyobj=''
1033 madlysrc=''
1034 make_set_make=''
1035 d_mymalloc=''
1036 freetype=''
1037 mallocobj=''
1038 mallocsrc=''
1039 malloctype=''
1040 usemallocwrap=''
1041 usemymalloc=''
1042 installman1dir=''
1043 man1dir=''
1044 man1direxp=''
1045 man1ext=''
1046 installman3dir=''
1047 man3dir=''
1048 man3direxp=''
1049 man3ext=''
1050 modetype=''
1051 multiarch=''
1052 mydomain=''
1053 myhostname=''
1054 phostname=''
1055 c=''
1056 n=''
1057 d_eofnblk=''
1058 eagain=''
1059 o_nonblock=''
1060 rd_nodata=''
1061 need_va_copy=''
1062 netdb_hlen_type=''
1063 netdb_host_type=''
1064 netdb_name_type=''
1065 netdb_net_type=''
1066 groupcat=''
1067 hostcat=''
1068 passcat=''
1069 orderlib=''
1070 ranlib=''
1071 d_perl_otherlibdirs=''
1072 otherlibdirs=''
1073 package=''
1074 spackage=''
1075 pager=''
1076 api_revision=''
1077 api_subversion=''
1078 api_version=''
1079 api_versionstring=''
1080 patchlevel=''
1081 perl_patchlevel=''
1082 revision=''
1083 subversion=''
1084 version=''
1085 version_patchlevel_string=''
1086 perl5=''
1087 perladmin=''
1088 perlpath=''
1089 d_nv_preserves_uv=''
1090 d_nv_zero_is_allbits_zero=''
1091 i16size=''
1092 i16type=''
1093 i32size=''
1094 i32type=''
1095 i64size=''
1096 i64type=''
1097 i8size=''
1098 i8type=''
1099 ivsize=''
1100 ivtype=''
1101 nv_overflows_integers_at=''
1102 nv_preserves_uv_bits=''
1103 nvsize=''
1104 nvtype=''
1105 u16size=''
1106 u16type=''
1107 u32size=''
1108 u32type=''
1109 u64size=''
1110 u64type=''
1111 u8size=''
1112 u8type=''
1113 uvsize=''
1114 uvtype=''
1115 ivdformat=''
1116 nvEUformat=''
1117 nvFUformat=''
1118 nvGUformat=''
1119 nveformat=''
1120 nvfformat=''
1121 nvgformat=''
1122 uvXUformat=''
1123 uvoformat=''
1124 uvuformat=''
1125 uvxformat=''
1126 pidtype=''
1127 prefix=''
1128 prefixexp=''
1129 installprivlib=''
1130 privlib=''
1131 privlibexp=''
1132 prototype=''
1133 ptrsize=''
1134 d_PRIXU64=''
1135 d_PRId64=''
1136 d_PRIi64=''
1137 d_PRIo64=''
1138 d_PRIu64=''
1139 d_PRIx64=''
1140 sPRIXU64=''
1141 sPRId64=''
1142 sPRIi64=''
1143 sPRIo64=''
1144 sPRIu64=''
1145 sPRIx64=''
1146 d_quad=''
1147 quadkind=''
1148 quadtype=''
1149 uquadtype=''
1150 drand01=''
1151 randbits=''
1152 randfunc=''
1153 randseedtype=''
1154 seedfunc=''
1155 installscript=''
1156 scriptdir=''
1157 scriptdirexp=''
1158 selectminbits=''
1159 selecttype=''
1160 sh=''
1161 sig_count=''
1162 sig_name=''
1163 sig_name_init=''
1164 sig_num=''
1165 sig_num_init=''
1166 sig_size=''
1167 d_sitearch=''
1168 installsitearch=''
1169 sitearch=''
1170 sitearchexp=''
1171 installsitebin=''
1172 sitebin=''
1173 sitebinexp=''
1174 installsitehtml1dir=''
1175 sitehtml1dir=''
1176 sitehtml1direxp=''
1177 installsitehtml3dir=''
1178 sitehtml3dir=''
1179 sitehtml3direxp=''
1180 installsitelib=''
1181 sitelib=''
1182 sitelib_stem=''
1183 sitelibexp=''
1184 installsiteman1dir=''
1185 siteman1dir=''
1186 siteman1direxp=''
1187 installsiteman3dir=''
1188 siteman3dir=''
1189 siteman3direxp=''
1190 siteprefix=''
1191 siteprefixexp=''
1192 installsitescript=''
1193 sitescript=''
1194 sitescriptexp=''
1195 sizesize=''
1196 sizetype=''
1197 so=''
1198 socksizetype=''
1199 sharpbang=''
1200 shsharp=''
1201 spitshell=''
1202 src=''
1203 ssizetype=''
1204 st_ino_sign=''
1205 st_ino_size=''
1206 startperl=''
1207 startsh=''
1208 stdchar=''
1209 d_stdio_stream_array=''
1210 stdio_stream_array=''
1211 sysman=''
1212 sGMTIME_max=''
1213 sGMTIME_min=''
1214 sLOCALTIME_max=''
1215 sLOCALTIME_min=''
1216 trnl=''
1217 uidformat=''
1218 uidsign=''
1219 uidsize=''
1220 uidtype=''
1221 archname64=''
1222 use64bitall=''
1223 use64bitint=''
1224 dtrace=''
1225 usedtrace=''
1226 usefaststdio=''
1227 usekernprocpathname=''
1228 ccflags_uselargefiles=''
1229 ldflags_uselargefiles=''
1230 libswanted_uselargefiles=''
1231 uselargefiles=''
1232 uselongdouble=''
1233 usemorebits=''
1234 usemultiplicity=''
1235 nm_opt=''
1236 nm_so_opt=''
1237 runnm=''
1238 usenm=''
1239 usensgetexecutablepath=''
1240 useperlio=''
1241 usesocks=''
1242 d_oldpthreads=''
1243 use5005threads=''
1244 useithreads=''
1245 usereentrant=''
1246 usethreads=''
1247 incpath=''
1248 mips_type=''
1249 usrinc=''
1250 vaproto=''
1251 d_vendorarch=''
1252 installvendorarch=''
1253 vendorarch=''
1254 vendorarchexp=''
1255 d_vendorbin=''
1256 installvendorbin=''
1257 vendorbin=''
1258 vendorbinexp=''
1259 installvendorhtml1dir=''
1260 vendorhtml1dir=''
1261 vendorhtml1direxp=''
1262 installvendorhtml3dir=''
1263 vendorhtml3dir=''
1264 vendorhtml3direxp=''
1265 d_vendorlib=''
1266 installvendorlib=''
1267 vendorlib=''
1268 vendorlib_stem=''
1269 vendorlibexp=''
1270 installvendorman1dir=''
1271 vendorman1dir=''
1272 vendorman1direxp=''
1273 installvendorman3dir=''
1274 vendorman3dir=''
1275 vendorman3direxp=''
1276 usevendorprefix=''
1277 vendorprefix=''
1278 vendorprefixexp=''
1279 d_vendorscript=''
1280 installvendorscript=''
1281 vendorscript=''
1282 vendorscriptexp=''
1283 versiononly=''
1284 yacc=''
1285 yaccflags=''
1286 CONFIG=''
1287
1288 : Detect odd OSs
1289 define='define'
1290 undef='undef'
1291 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1292 rmlist=''
1293
1294 : We must find out about Eunice early
1295 eunicefix=':'
1296 if test -f /etc/unixtovms; then
1297         eunicefix=/etc/unixtovms
1298 fi
1299 if test -f /etc/unixtovms.exe; then
1300         eunicefix=/etc/unixtovms.exe
1301 fi
1302
1303 : Set executable suffix now -- needed before hints available
1304 if test -f "/libs/version.library"; then
1305 : Amiga OS
1306     _exe=""
1307 elif test -f "/system/gnu_library/bin/ar.pm"; then
1308 : Stratus VOS
1309     _exe=".pm"
1310 elif test -n "$DJGPP"; then
1311 : DOS DJGPP
1312     _exe=".exe"
1313 elif test -f /kern/cookiejar; then
1314 : MiNT
1315     _exe=""
1316 elif test -d c:/. -o -n "$is_os2" ; then
1317 : OS/2 or cygwin
1318     _exe=".exe"
1319 fi
1320
1321 groupstype=''
1322 i_whoami=''
1323 : Trailing extension.  Override this in a hint file, if needed.
1324 : Extra object files, if any, needed on this platform.
1325 archobjs=''
1326 archname=''
1327 : Possible local include directories to search.
1328 : Set locincpth to "" in a hint file to defeat local include searches.
1329 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1330 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1331 :
1332 : no include file wanted by default
1333 inclwanted=''
1334
1335 : Enable -DEBUGGING and -DDEBUGGING from the command line
1336 EBUGGING=''
1337 DEBUGGING=''
1338
1339 libnames=''
1340 : change the next line if compiling for Xenix/286 on Xenix/386
1341 xlibpth='/usr/lib/386 /lib/386'
1342 : Possible local library directories to search.
1343 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1344 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1345
1346 : general looking path for locating libraries
1347 glibpth="/lib /usr/lib $xlibpth"
1348 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1349 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1350 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1351 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1352
1353 : Private path used by Configure to find libraries.  Its value
1354 : is prepended to libpth. This variable takes care of special
1355 : machines, like the mips.  Usually, it should be empty.
1356 plibpth=''
1357
1358 : default library list
1359 libswanted=''
1360 : some systems want to use only the non-versioned libso:s
1361 ignore_versioned_solibs=''
1362 : set usethreads on the Configure command line to enable threads.
1363 usereentrant='undef'
1364 ccname=''
1365 ccversion=''
1366 perllibs=''
1367 : set useposix=false in your hint file to disable the POSIX extension.
1368 useposix=true
1369 : set useopcode=false in your hint file to disable the Opcode extension.
1370 useopcode=true
1371 archname64=''
1372 ccflags_uselargefiles=''
1373 ldflags_uselargefiles=''
1374 libswanted_uselargefiles=''
1375 : set usemultiplicity on the Configure command line to enable multiplicity.
1376 : set usesocks on the Configure command line to enable socks.
1377 : List of libraries we want.
1378 : If anyone needs extra -lxxx, put those in a hint file.
1379 libswanted="socket bind inet nsl nm ndbm gdbm dbm db malloc dl ld sun"
1380 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1381 : We probably want to search /usr/shlib before most other libraries.
1382 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1383 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1384 glibpth="/usr/shlib $glibpth"
1385 : Do not use vfork unless overridden by a hint file.
1386 usevfork=false
1387
1388 : Find the basic shell for Bourne shell scripts
1389 case "$sh" in
1390 '')
1391         case "$SYSTYPE" in
1392         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1393         *) xxx='/bin/sh';;
1394         esac
1395         if test -f "$xxx"; then
1396                 sh="$xxx"
1397         else
1398                 : Build up a list and do a single loop so we can 'break' out.
1399                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1400                 for xxx in sh bash ksh pdksh ash; do
1401                         for p in $pth; do
1402                                 try="$try ${p}/${xxx}"
1403                         done
1404                 done
1405                 for xxx in $try; do
1406                         if test -f "$xxx"; then
1407                                 sh="$xxx";
1408                                 break
1409                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1410                                 sh="$xxx";
1411                                 break
1412                         elif test -f "$xxx.exe"; then
1413                                 sh="$xxx";
1414                                 break
1415                         fi
1416                 done
1417         fi
1418         ;;
1419 esac
1420
1421 case "$sh" in
1422 '')     cat >&2 <<EOM
1423 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1424
1425 Usually it's in /bin/sh.  How did you even get this far?
1426 Please contact me (Perl Maintainers) at perlbug@perl.org and
1427 we'll try to straighten this all out.
1428 EOM
1429         exit 1
1430         ;;
1431 esac
1432
1433 : see if sh knows # comments
1434 if `$sh -c '#' >/dev/null 2>&1`; then
1435         shsharp=true
1436         spitshell=cat
1437         xcat=/bin/cat
1438         test -f $xcat$_exe || xcat=/usr/bin/cat
1439         if test ! -f $xcat$_exe; then
1440                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1441                         if test -f $p/cat$_exe; then
1442                                 xcat=$p/cat
1443                                 break
1444                         fi
1445                 done
1446                 if test ! -f $xcat$_exe; then
1447                         echo "Can't find cat anywhere!"
1448                         exit 1
1449                 fi
1450         fi
1451         echo "#!$xcat" >sharp
1452         $eunicefix sharp
1453         chmod +x sharp
1454         ./sharp > today 2>/dev/null
1455         if test -s today; then
1456                 sharpbang='#!'
1457         else
1458                 echo "#! $xcat" > sharp
1459                 $eunicefix sharp
1460                 chmod +x sharp
1461                 ./sharp > today 2>/dev/null
1462                 if test -s today; then
1463                         sharpbang='#! '
1464                 else
1465                         sharpbang=': use '
1466                 fi
1467         fi
1468 else
1469         echo " "
1470         echo "Your $sh doesn't grok # comments--I will strip them later on."
1471         shsharp=false
1472         cd ..
1473         echo "exec grep -v '^[  ]*#'" >spitshell
1474         chmod +x spitshell
1475         $eunicefix spitshell
1476         spitshell=`pwd`/spitshell
1477         cd UU
1478         echo "I presume that if # doesn't work, #! won't work either!"
1479         sharpbang=': use '
1480 fi
1481 rm -f sharp today
1482
1483 : figure out how to guarantee sh startup
1484 case "$startsh" in
1485 '') startsh=${sharpbang}${sh} ;;
1486 *)
1487 esac
1488 cat >sharp <<EOSS
1489 $startsh
1490 set abc
1491 test "$?abc" != 1
1492 EOSS
1493
1494 chmod +x sharp
1495 $eunicefix sharp
1496 if ./sharp; then
1497         : echo "Yup, it does."
1498 else
1499         echo "Hmm... '$startsh' does not guarantee sh startup..."
1500         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1501 fi
1502 rm -f sharp
1503
1504 : Save command line options in file UU/cmdline.opt for later use in
1505 : generating config.sh.
1506 cat > cmdline.opt <<EOSH
1507 : Configure command line arguments.
1508 config_arg0='$0'
1509 config_args='$*'
1510 config_argc=$#
1511 EOSH
1512 argn=1
1513 args_exp=''
1514 args_sep=''
1515 for arg in "$@"; do
1516         cat >>cmdline.opt <<EOSH
1517 config_arg$argn='$arg'
1518 EOSH
1519         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1520 $arg
1521 EOC
1522         arg_exp=`cat cmdl.opt`
1523         args_exp="$args_exp$args_sep'$arg_exp'"
1524         argn=`expr $argn + 1`
1525         args_sep=' '
1526 done
1527 rm -f cmdl.opt
1528
1529 : produce awk script to parse command line options
1530 cat >options.awk <<'EOF'
1531 BEGIN {
1532         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1533
1534         len = length(optstr);
1535         for (i = 1; i <= len; i++) {
1536                 c = substr(optstr, i, 1);
1537                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1538                 if (a == ":") {
1539                         arg[c] = 1;
1540                         i++;
1541                 }
1542                 opt[c] = 1;
1543         }
1544 }
1545 {
1546         expect = 0;
1547         str = $0;
1548         if (substr(str, 1, 1) != "-") {
1549                 printf("'%s'\n", str);
1550                 next;
1551         }
1552         len = length($0);
1553         for (i = 2; i <= len; i++) {
1554                 c = substr(str, i, 1);
1555                 if (!opt[c]) {
1556                         printf("-%s\n", substr(str, i));
1557                         next;
1558                 }
1559                 printf("-%s\n", c);
1560                 if (arg[c]) {
1561                         if (i < len)
1562                                 printf("'%s'\n", substr(str, i + 1));
1563                         else
1564                                 expect = 1;
1565                         next;
1566                 }
1567         }
1568 }
1569 END {
1570         if (expect)
1571                 print "?";
1572 }
1573 EOF
1574
1575 : process the command line options
1576 set X `for arg in "$@"; do echo "X$arg"; done |
1577         sed -e s/X// | awk -f options.awk`
1578 eval "set $*"
1579 shift
1580 rm -f options.awk
1581
1582 : set up default values
1583 fastread=''
1584 reuseval=false
1585 config_sh=''
1586 alldone=''
1587 error=''
1588 silent=''
1589 extractsh=''
1590 override=''
1591 knowitall=''
1592 rm -f optdef.sh posthint.sh
1593 cat >optdef.sh <<EOS
1594 $startsh
1595 EOS
1596
1597
1598 : option parsing
1599 while test $# -gt 0; do
1600         case "$1" in
1601         -d) shift; fastread=yes;;
1602         -e) shift; alldone=cont;;
1603         -f)
1604                 shift
1605                 cd ..
1606                 if test -r "$1"; then
1607                         config_sh="$1"
1608                 else
1609                         echo "$me: cannot read config file $1." >&2
1610                         error=true
1611                 fi
1612                 cd UU
1613                 shift;;
1614         --help|\
1615         -h) shift; error=true;;
1616         -r) shift; reuseval=true;;
1617         -s) shift; silent=true; realsilent=true;;
1618         -E) shift; alldone=exit;;
1619         -K) shift; knowitall=true;;
1620         -O) shift; override=true;;
1621         -S) shift; silent=true; extractsh=true;;
1622         -D)
1623                 shift
1624                 case "$1" in
1625                 *=)
1626                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1627                         echo "$me: ignoring -D $1" >&2
1628                         ;;
1629                 *=*) echo "$1" | \
1630                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1631                 *) echo "$1='define'" >> optdef.sh;;
1632                 esac
1633                 shift
1634                 ;;
1635         -U)
1636                 shift
1637                 case "$1" in
1638                 *=) echo "$1" >> optdef.sh;;
1639                 *=*)
1640                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1641                         echo "$me: ignoring -U $1" >&2
1642                         ;;
1643                 *) echo "$1='undef'" >> optdef.sh;;
1644                 esac
1645                 shift
1646                 ;;
1647         -A)
1648             shift
1649             xxx=''
1650             yyy="$1"
1651             zzz=''
1652             uuu=undef
1653             case "$yyy" in
1654             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1655                  case "$zzz" in
1656                  *:*) zzz='' ;;
1657                  *)   xxx=append
1658                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1659                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1660                  esac
1661                  ;;
1662             esac
1663             case "$xxx" in
1664             '')  case "$yyy" in
1665                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1666                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1667                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1668                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1669                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1670                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1671                  esac
1672                  ;;
1673             esac
1674             case "$xxx" in
1675             append)
1676                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1677             clear)
1678                 echo "$yyy=''"                  >> posthint.sh ;;
1679             define)
1680                 case "$zzz" in
1681                 '') zzz=define ;;
1682                 esac
1683                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1684             eval)
1685                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1686             prepend)
1687                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1688             undef)
1689                 case "$zzz" in
1690                 '') zzz="$uuu" ;;
1691                 esac
1692                 echo "$yyy=$zzz"                >> posthint.sh ;;
1693             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1694             esac
1695             shift
1696             ;;
1697         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1698             exit 0;;
1699         --) break;;
1700         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1701         *) break;;
1702         esac
1703 done
1704
1705 case "$error" in
1706 true)
1707         cat >&2 <<EOM
1708 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1709                  [-U symbol] [-U symbol=] [-A command:symbol...]
1710   -d : use defaults for all answers.
1711   -e : go on without questioning past the production of config.sh.
1712   -f : specify an alternate default configuration file.
1713   -h : print this help message and exit (with an error status).
1714   -r : reuse C symbols value if possible (skips costly nm extraction).
1715   -s : silent mode, only echoes questions and essential information.
1716   -D : define symbol to have some value:
1717          -D symbol         symbol gets the value 'define'
1718          -D symbol=value   symbol gets the value 'value'
1719        common used examples (see INSTALL for more info):
1720          -Duse64bitint            use 64bit integers
1721          -Duse64bitall            use 64bit integers and pointers
1722          -Dusethreads             use thread support
1723          -Dinc_version_list=none  do not include older perl trees in @INC
1724          -DEBUGGING=none          DEBUGGING options
1725          -Dcc=gcc                 choose your compiler
1726          -Dprefix=/opt/perl5      choose your destination
1727   -E : stop at the end of questions, after having produced config.sh.
1728   -K : do not use unless you know what you are doing.
1729   -O : let -D and -U override definitions from loaded configuration file.
1730   -S : perform variable substitutions on all .SH files (can mix with -f)
1731   -U : undefine symbol:
1732          -U symbol    symbol gets the value 'undef'
1733          -U symbol=   symbol gets completely empty
1734        e.g.:  -Uversiononly
1735   -A : manipulate symbol after the platform specific hints have been applied:
1736          -A append:symbol=value   append value to symbol
1737          -A symbol=value          like append:, but with a separating space
1738          -A define:symbol=value   define symbol to have value
1739          -A clear:symbol          define symbol to be ''
1740          -A define:symbol         define symbol to be 'define'
1741          -A eval:symbol=value     define symbol to be eval of value
1742          -A prepend:symbol=value  prepend value to symbol
1743          -A undef:symbol          define symbol to be 'undef'
1744          -A undef:symbol=         define symbol to be ''
1745        e.g.:  -A prepend:libswanted='cl pthread '
1746               -A ccflags=-DSOME_MACRO
1747   -V : print version number and exit (with a zero status).
1748 EOM
1749         exit 1
1750         ;;
1751 esac
1752
1753 : Sanity checks
1754 case "$fastread$alldone" in
1755 yescont|yesexit) ;;
1756 *)
1757         case "$extractsh" in
1758         true) ;;
1759         *)
1760                 if test ! -t 0; then
1761                         echo "Say 'sh Configure', not 'sh <Configure'"
1762                         exit 1
1763                 fi
1764                 ;;
1765         esac
1766         ;;
1767 esac
1768
1769 exec 4>&1
1770 case "$silent" in
1771 true) exec 1>/dev/null;;
1772 esac
1773
1774 : run the defines and the undefines, if any, but leave the file out there...
1775 touch optdef.sh
1776 . ./optdef.sh
1777 : create the posthint manipulation script and leave the file out there...
1778 touch posthint.sh
1779
1780 : set package name
1781 package='perl5'
1782 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1783 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1784 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1785 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1786 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1787 esac
1788
1789 : Some greps do not return status, grrr.
1790 echo "grimblepritz" >grimble
1791 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1792         contains=contains
1793 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1794         contains=grep
1795 else
1796         contains=contains
1797 fi
1798 rm -f grimble
1799 : the following should work in any shell
1800 case "$contains" in
1801 contains*)
1802         echo " "
1803         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1804         cat >contains <<'EOSS'
1805 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1806 EOSS
1807 chmod +x contains
1808 esac
1809
1810 : Find the path to the source tree
1811 case "$src" in
1812 '') case "$0" in
1813     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1814          case "$src" in
1815          /*)    ;;
1816          .)     ;;
1817          *)     src=`cd ../$src && pwd` ;;
1818          esac
1819          ;;
1820     *)   src='.';;
1821     esac;;
1822 esac
1823 case "$src" in
1824 '')     src=/
1825         rsrc=/
1826         ;;
1827 /*)     rsrc="$src";;
1828 *)      rsrc="../$src";;
1829 esac
1830 if test -f $rsrc/Configure && \
1831         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1832 then
1833    : found it, so we are ok.
1834 else
1835         rsrc=''
1836         for src in . .. ../.. ../../.. ../../../..; do
1837                 if test -f ../$src/Configure && \
1838                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1839                 then
1840                         rsrc=../$src
1841                         break
1842                 fi
1843         done
1844 fi
1845 case "$rsrc" in
1846 '')
1847         cat <<EOM >&4
1848
1849 Sorry, I can't seem to locate the source dir for $package.  Please start
1850 Configure with an explicit path -- i.e. /some/path/Configure.
1851
1852 EOM
1853         exit 1
1854         ;;
1855 ../.)   rsrc='..';;
1856 *)
1857         echo " "
1858         echo "Sources for $package found in \"$src\"." >&4
1859         ;;
1860 esac
1861
1862 : script used to extract .SH files with variable substitutions
1863 cat >extract <<'EOS'
1864 PERL_CONFIG_SH=true
1865 echo "Doing variable substitutions on .SH files..."
1866 if test -f MANIFEST; then
1867         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1868 else
1869         echo "(Looking for .SH files under the source directory.)"
1870         set x `(cd "$src"; find . -name "*.SH" -print)`
1871 fi
1872 shift
1873 case $# in
1874 0) set x `(cd "$src"; echo *.SH)`; shift;;
1875 esac
1876 if test ! -f "$src/$1"; then
1877         shift
1878 fi
1879 mkdir_p='
1880 name=$1;
1881 create="";
1882 while test $name; do
1883         if test ! -d "$name"; then
1884                 create="$name $create";
1885                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1886                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1887         else
1888                 name="";
1889         fi;
1890 done;
1891 for file in $create; do
1892         mkdir $file;
1893 done
1894 '
1895 for file in $*; do
1896         case "$src" in
1897         ".")
1898                 case "$file" in
1899                 */*)
1900                         dir=`expr X$file : 'X\(.*\)/'`
1901                         file=`expr X$file : 'X.*/\(.*\)'`
1902                         (cd "$dir" && . ./$file)
1903                         ;;
1904                 *)
1905                         . ./$file
1906                         ;;
1907                 esac
1908                 ;;
1909         *)
1910                 case "$file" in
1911                 */*)
1912                         dir=`expr X$file : 'X\(.*\)/'`
1913                         file=`expr X$file : 'X.*/\(.*\)'`
1914                         (set x $dir; shift; eval $mkdir_p)
1915                         sh <"$src/$dir/$file"
1916                         ;;
1917                 *)
1918                         sh <"$src/$file"
1919                         ;;
1920                 esac
1921                 ;;
1922         esac
1923 done
1924 if test -f "$src/config_h.SH"; then
1925         if test ! -f config.h; then
1926         : oops, they left it out of MANIFEST, probably, so do it anyway.
1927         . "$src/config_h.SH"
1928         fi
1929 fi
1930 EOS
1931
1932 : extract files and exit if asked to do so
1933 case "$extractsh" in
1934 true)
1935         case "$realsilent" in
1936         true) ;;
1937         *) exec 1>&4;;
1938         esac
1939         case "$config_sh" in
1940         '') config_sh='config.sh';;
1941         esac
1942         echo " "
1943         echo "Fetching answers from $config_sh..."
1944         cd ..
1945         . $config_sh
1946         test "$override" && . ./optdef.sh
1947         echo " "
1948         . UU/extract
1949         rm -rf UU
1950         echo "Extraction done."
1951         exit 0
1952         ;;
1953 esac
1954
1955 : Eunice requires " " instead of "", can you believe it
1956 echo " "
1957 : Here we go...
1958 echo "Beginning of configuration questions for $package."
1959
1960 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1961
1962 : first determine how to suppress newline on echo command
1963 echo " "
1964 echo "Checking echo to see how to suppress newlines..."
1965 (echo "hi there\c" ; echo " ") >.echotmp
1966 if $contains c .echotmp >/dev/null 2>&1 ; then
1967         echo "...using -n."
1968         n='-n'
1969         c=''
1970 else
1971         cat <<'EOM'
1972 ...using \c
1973 EOM
1974         n=''
1975         c='\c'
1976 fi
1977 echo $n "The star should be here-->$c"
1978 echo '*'
1979 rm -f .echotmp
1980
1981 : Now test for existence of everything in MANIFEST
1982 echo " "
1983 if test -f "$rsrc/MANIFEST"; then
1984         echo "First let's make sure your kit is complete.  Checking..." >&4
1985         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1986                 (split -l 50 2>/dev/null || split -50)
1987         rm -f missing
1988         tmppwd=`pwd`
1989         for filelist in x??; do
1990                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1991                         >/dev/null 2>>"$tmppwd/missing")
1992         done
1993         if test -s missing; then
1994                 cat missing >&4
1995                 cat >&4 <<'EOM'
1996
1997 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1998
1999 You have the option of continuing the configuration process, despite the
2000 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2001 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2002 and contact the author (perlbug@perl.org).
2003
2004 EOM
2005                 echo $n "Continue? [n] $c" >&4
2006                 read ans
2007                 case "$ans" in
2008                 y*)
2009                         echo "Continuing..." >&4
2010                         rm -f missing
2011                         ;;
2012                 *)
2013                         echo "ABORTING..." >&4
2014                         kill $$
2015                         ;;
2016                 esac
2017         else
2018                 echo "Looks good..."
2019         fi
2020 else
2021         echo "There is no MANIFEST file.  I hope your kit is complete !"
2022 fi
2023 rm -f missing x??
2024
2025 : Find the appropriate value for a newline for tr
2026 echo " "
2027 if test -n "$DJGPP"; then
2028        trnl='\012'
2029 fi
2030 if test X"$trnl" = X; then
2031         case "`echo foo|tr '\n' x 2>/dev/null`" in
2032         foox) trnl='\n' ;;
2033         esac
2034 fi
2035 if test X"$trnl" = X; then
2036         case "`echo foo|tr '\012' x 2>/dev/null`" in
2037         foox) trnl='\012' ;;
2038         esac
2039 fi
2040 if test X"$trnl" = X; then
2041        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2042        fooxy) trnl='\n\r' ;;
2043        esac
2044 fi
2045 if test X"$trnl" = X; then
2046         cat <<EOM >&2
2047
2048 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2049
2050 EOM
2051         exit 1
2052 fi
2053
2054 : compute the number of columns on the terminal for proper question formatting
2055 case "$COLUMNS" in
2056 '') COLUMNS='80';;
2057 esac
2058
2059 : set up the echo used in my read
2060 myecho="case \"\$xxxm\" in
2061 '') echo $n \"\$rp $c\" >&4;;
2062 *) case \"\$rp\" in
2063         '') echo $n \"[\$xxxm] $c\";;
2064         *)
2065                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2066                         echo \"\$rp\" >&4
2067                         echo $n \"[\$xxxm] $c\" >&4
2068                 else
2069                         echo $n \"\$rp [\$xxxm] $c\" >&4
2070                 fi
2071                 ;;
2072         esac;;
2073 esac"
2074
2075 : now set up to do reads with possible shell escape and default assignment
2076 cat <<EOSC >myread
2077 $startsh
2078 xxxm=\$dflt
2079 $myecho
2080 ans='!'
2081 case "\$fastread" in
2082 yes) case "\$dflt" in
2083         '') ;;
2084         *) ans='';
2085                 case "\$silent-\$rp" in
2086                 true-) ;;
2087                 *) echo " " >&4;;
2088                 esac;;
2089         esac;;
2090 *) case "\$silent" in
2091         true) case "\$rp" in
2092                 '') ans='';;
2093                 esac;;
2094         esac;;
2095 esac
2096 while expr "X\$ans" : "X!" >/dev/null; do
2097         read answ
2098         set x \$xxxm
2099         shift
2100         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2101         case  "\$answ" in
2102         "!")
2103                 sh 1>&4
2104                 echo " "
2105                 $myecho
2106                 ;;
2107         !*)
2108                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2109                 shift
2110                 sh 1>&4 -c "\$*"
2111                 echo " "
2112                 $myecho
2113                 ;;
2114         "\$ans")
2115                 case "\$ans" in
2116                 \\&*)
2117                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2118                         shift
2119                         case "\$1" in
2120                         -d)
2121                                 fastread=yes
2122                                 echo "(OK, I'll run with -d after this question.)" >&4
2123                                 ;;
2124                         -*)
2125                                 echo "*** Sorry, \$1 not supported yet." >&4
2126                                 ;;
2127                         esac
2128                         $myecho
2129                         ans=!
2130                         ;;
2131                 esac;;
2132         *)
2133                 case "\$aok" in
2134                 y)
2135                         echo "*** Substitution done -- please confirm."
2136                         xxxm="\$ans"
2137                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2138                         xxxm="\$ans"
2139                         ans=!
2140                         ;;
2141                 *)
2142                         echo "*** Error -- try again."
2143                         ans=!
2144                         ;;
2145                 esac
2146                 $myecho
2147                 ;;
2148         esac
2149         case "\$ans\$xxxm\$nostick" in
2150         '')
2151                 ans=!
2152                 $myecho
2153                 ;;
2154         esac
2155 done
2156 case "\$ans" in
2157 '') ans="\$xxxm";;
2158 esac
2159 EOSC
2160
2161 : create .config dir to save info across Configure sessions
2162 test -d ../.config || mkdir ../.config
2163 cat >../.config/README <<EOF
2164 This directory created by Configure to save information that should
2165 persist across sessions for $package.
2166
2167 You may safely delete it if you wish.
2168 EOF
2169
2170 : See if we are using a devel version and want that
2171 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2172 case "$usedevel" in
2173 $define|true|[yY]*)
2174     usedevel="$define" ;;
2175 *) case "$xversion" in
2176    *[13579])
2177         cat >&4 <<EOH
2178 *** WHOA THERE!!! ***
2179
2180     This is an UNSTABLE DEVELOPMENT release.
2181     The version of this $package distribution is $xversion, that is, odd,
2182     (as opposed to even) and that signifies a development release.
2183     If you want a maintenance release, you want an even-numbered version.
2184
2185     Do ***NOT*** install this into production use.
2186     Data corruption and crashes are possible.
2187
2188     It is most seriously suggested that you do not continue any further
2189     unless you want to help in developing and debugging Perl.
2190
2191     If you *still* want to build perl, you can answer 'y' now,
2192     or pass -Dusedevel to Configure.
2193
2194 EOH
2195         rp='Do you really want to continue?'
2196         dflt='n'
2197         . ./myread
2198         case "$ans" in
2199         [yY]) echo >&4 "Okay, continuing."
2200               usedevel="$define" ;;
2201         *) echo >&4 "Okay, bye."
2202            exit 1
2203            ;;
2204         esac
2205         ;;
2206     esac
2207     usedevel="$undef"
2208     ;;
2209 esac
2210 case "$usedevel" in
2211 $define|true|[yY]*)
2212         case "$versiononly" in
2213         '') versiononly="$define" ;;
2214         esac
2215         case "$installusrbinperl" in
2216         '') installusrbinperl="$undef" ;;
2217         esac
2218         ;;
2219 esac
2220
2221 : general instructions
2222 needman=true
2223 firsttime=true
2224 user=`(logname) 2>/dev/null`
2225 case "$user" in
2226 '') user=`whoami 2>&1`;;
2227 esac
2228 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2229         firsttime=false
2230         echo " "
2231         rp='Would you like to see the instructions?'
2232         dflt=n
2233         . ./myread
2234         case "$ans" in
2235         [yY]*) ;;
2236         *) needman=false;;
2237         esac
2238 fi
2239 if $needman; then
2240         cat <<EOH
2241
2242 This installation shell script will examine your system and ask you questions
2243 to determine how the perl5 package should be installed. If you get
2244 stuck on a question, you may use a ! shell escape to start a subshell or
2245 execute a command.  Many of the questions will have default answers in square
2246 brackets; typing carriage return will give you the default.
2247
2248 On some of the questions which ask for file or directory names you are allowed
2249 to use the ~name construct to specify the login directory belonging to "name",
2250 even if you don't have a shell which knows about that.  Questions where this is
2251 allowed will be marked "(~name ok)".
2252
2253 EOH
2254         rp=''
2255         dflt='Type carriage return to continue'
2256         . ./myread
2257         cat <<'EOH'
2258
2259 The prompter used in this script allows you to use shell variables and
2260 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2261 in the default answer, as if the default line was a set of arguments given to a
2262 script shell.  This means you may also use $* to repeat the whole default line,
2263 so you do not have to re-type everything to add something to the default.
2264
2265 Every time there is a substitution, you will have to confirm.  If there is an
2266 error (e.g. an unmatched backtick), the default answer will remain unchanged
2267 and you will be prompted again.
2268
2269 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2270 the questions and use the computed defaults (or the previous answers if there
2271 was already a config.sh file). Type 'Configure -h' for a list of options.
2272 You may also start interactively and then answer '& -d' at any prompt to turn
2273 on the non-interactive behaviour for the remainder of the execution.
2274
2275 EOH
2276         . ./myread
2277         cat <<EOH
2278
2279 Much effort has been expended to ensure that this shell script will run on any
2280 Unix system.  If despite that it blows up on yours, your best bet is to edit
2281 Configure and run it again.  If you can't run Configure for some reason,
2282 you'll have to generate a config.sh file by hand.  Whatever problems you
2283 have, let me (perlbug@perl.org) know how I blew it.
2284
2285 This installation script affects things in two ways:
2286
2287 1) it may do direct variable substitutions on some of the files included
2288    in this kit.
2289 2) it builds a config.h file for inclusion in C programs.  You may edit
2290    any of these files as the need arises after running this script.
2291
2292 If you make a mistake on a question, there is no easy way to back up to it
2293 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2294 files.  Configure will offer to let you do this before it runs the SH files.
2295
2296 EOH
2297         dflt='Type carriage return to continue'
2298         . ./myread
2299         case "$firsttime" in
2300         true) echo $user >>../.config/instruct;;
2301         esac
2302 fi
2303
2304 : find out where common programs are
2305 echo " "
2306 echo "Locating common programs..." >&4
2307 cat <<EOSC >loc
2308 $startsh
2309 case \$# in
2310 0) exit 1;;
2311 esac
2312 thing=\$1
2313 shift
2314 dflt=\$1
2315 shift
2316 for dir in \$*; do
2317         case "\$thing" in
2318         .)
2319         if test -d \$dir/\$thing; then
2320                 echo \$dir
2321                 exit 0
2322         fi
2323         ;;
2324         *)
2325         for thisthing in \$dir/\$thing; do
2326                 : just loop through to pick last item
2327         done
2328         if test -f \$thisthing; then
2329                 echo \$thisthing
2330                 exit 0
2331         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2332                 echo \$thisthing
2333                 exit 0
2334         elif test -f \$dir/\$thing.exe; then
2335                 if test -n "$DJGPP"; then
2336                         echo \$dir/\$thing.exe
2337                 elif test "$eunicefix" != ":"; then
2338                         : on Eunice apparently
2339                         echo \$dir/\$thing
2340                 fi
2341                 exit 0
2342         fi
2343         ;;
2344         esac
2345 done
2346 echo \$dflt
2347 exit 1
2348 EOSC
2349 chmod +x loc
2350 $eunicefix loc
2351 loclist="
2352 awk
2353 cat
2354 chmod
2355 comm
2356 cp
2357 echo
2358 expr
2359 grep
2360 ls
2361 mkdir
2362 rm
2363 sed
2364 sort
2365 touch
2366 tr
2367 uniq
2368 "
2369 trylist="
2370 ar
2371 bison
2372 byacc
2373 cpp
2374 csh
2375 date
2376 egrep
2377 gmake
2378 gzip
2379 less
2380 ln
2381 make
2382 more
2383 nm
2384 nroff
2385 perl
2386 pg
2387 test
2388 uname
2389 zip
2390 "
2391 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2392 pth="$pth /lib /usr/lib"
2393 for file in $loclist; do
2394         eval xxx=\$$file
2395         case "$xxx" in
2396         /*|?:[\\/]*)
2397                 if test -f "$xxx"; then
2398                         : ok
2399                 else
2400                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2401                         xxx=`./loc $file $file $pth`
2402                 fi
2403                 ;;
2404         '') xxx=`./loc $file $file $pth`;;
2405         *) xxx=`./loc $xxx $xxx $pth`;;
2406         esac
2407         eval $file=$xxx$_exe
2408         eval _$file=$xxx
2409         case "$xxx" in
2410         /*)
2411                 echo $file is in $xxx.
2412                 ;;
2413         ?:[\\/]*)
2414                 echo $file is in $xxx.
2415                 ;;
2416         *)
2417                 echo "I don't know where '$file' is, and my life depends on it." >&4
2418                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2419                 exit 1
2420                 ;;
2421         esac
2422 done
2423 echo " "
2424 echo "Don't worry if any of the following aren't found..."
2425 say=offhand
2426 for file in $trylist; do
2427         eval xxx=\$$file
2428         case "$xxx" in
2429         /*|?:[\\/]*)
2430                 if test -f "$xxx"; then
2431                         : ok
2432                 else
2433                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2434                         xxx=`./loc $file $file $pth`
2435                 fi
2436                 ;;
2437         '') xxx=`./loc $file $file $pth`;;
2438         *) xxx=`./loc $xxx $xxx $pth`;;
2439         esac
2440         eval $file=$xxx$_exe
2441         eval _$file=$xxx
2442         case "$xxx" in
2443         /*)
2444                 echo $file is in $xxx.
2445                 ;;
2446         ?:[\\/]*)
2447                 echo $file is in $xxx.
2448                 ;;
2449         *)
2450                 echo "I don't see $file out there, $say."
2451                 say=either
2452                 ;;
2453         esac
2454 done
2455 case "$egrep" in
2456 egrep)
2457         echo "Substituting grep for egrep."
2458         egrep=$grep
2459         _egrep=$grep
2460         ;;
2461 esac
2462 case "$less" in
2463 '')     ;;
2464 *)      if $less -R </dev/null >/dev/null; then
2465                echo "Substituting less -R for less."
2466                less="$less -R"
2467                _less=$less
2468         fi
2469         ;;
2470 esac
2471 case "$ln" in
2472 ln)
2473         echo "Substituting cp for ln."
2474         ln=$cp
2475         _ln=$cp
2476         ;;
2477 esac
2478 case "$make" in
2479 make)
2480         case "$gmake" in
2481         gmake)
2482         echo "I can't find make or gmake, and my life depends on it." >&4
2483         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2484         exit 1
2485         ;;
2486         esac
2487         ;;
2488 esac
2489 case "$gmake" in
2490 gmake)  ;;
2491 *)      # We can't have osname yet.
2492         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2493                 # Assume that gmake, if found, is definitely GNU make
2494                 # and prefer it over the system make.
2495                 echo "Substituting gmake for make."
2496                 make=$gmake
2497                 _make=$gmake
2498         fi
2499         ;;
2500 esac
2501 case "$test" in
2502 test)
2503         echo "Hopefully test is built into your sh."
2504         ;;
2505 *)
2506         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2507                 echo "Using the test built into your sh."
2508                 test=test
2509                 _test=test
2510         fi
2511         ;;
2512 esac
2513 case "$echo" in
2514 echo)
2515         echo "Hopefully echo is built into your sh."
2516         ;;
2517 '') ;;
2518 *)
2519         echo " "
2520 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2521         $echo $n "hi there$c" >foo1
2522         echo $n "hi there$c" >foo2
2523         if cmp foo1 foo2 >/dev/null 2>&1; then
2524                 echo "They are compatible.  In fact, they may be identical."
2525         else
2526                 case "$n" in
2527                 '-n') n='' c='\c';;
2528                 *) n='-n' c='';;
2529                 esac
2530                 cat <<FOO
2531 They are not compatible!  You are probably running ksh on a non-USG system.
2532 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2533 have echo built in and we may have to run some Bourne shell scripts.  That
2534 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2535
2536 FOO
2537                 $echo $n "The star should be here-->$c"
2538                 $echo "*"
2539         fi
2540         $rm -f foo1 foo2
2541         ;;
2542 esac
2543
2544 # This question was auctioned at YAPC::Europe-2007 in Vienna
2545 # I never promised you could answer it. I only auctioned the question.
2546 cat <<FOO
2547 The following message is sponsored by
2548
2549   Dresden.pm<--The stars should be here.
2550
2551 Dear Perl user, system administrator or package
2552 maintainer, the Perl community sends greetings to
2553 you. Do you (emblematical) greet back [Y/n]? n
2554
2555 FOO
2556
2557 : Check what type of C compiler we use
2558 cat <<EOS >trygcc
2559 $startsh
2560 EOS
2561 cat <<'EOSC' >>trygcc
2562 case "$cc" in
2563 '') ;;
2564 *)  $rm -f try try.*
2565     $cat >try.c <<EOM
2566 int main(int argc, char *argv[]) {
2567   return 0;
2568 }
2569 EOM
2570     if $cc -o try $ccflags $ldflags try.c; then
2571        :
2572     else
2573         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2574         despair=yes
2575         trygcc=yes
2576         case "$cc" in
2577         *gcc*) trygcc=no ;;
2578         esac
2579         # Skip this test because it gives a false match on output like:
2580         #    ./trygcc: line 23: cc: command not found
2581         # case "`$cc -v -c try.c 2>&1`" in
2582         # *gcc*) trygcc=no ;;
2583         # esac
2584         if $test X"$trygcc" = Xyes; then
2585             if gcc -o try -c try.c; then
2586                 echo " "
2587                 echo "You seem to have a working gcc, though." >&4
2588                 # Switching compilers may undo the work of hints files.
2589                 # The most common problem is -D_REENTRANT for threads.
2590                 # This heuristic catches that case, but gets false positives
2591                 # if -Dusethreads was not actually specified.  Better to
2592                 # bail out here with a useful message than fail 
2593                 # mysteriously later. Should we perhaps just try to
2594                 # re-invoke Configure -Dcc=gcc config_args ?
2595                 if $test -f usethreads.cbu; then
2596                         $cat >&4 <<EOM 
2597
2598 *** However, any setting of the C compiler flags (e.g. for thread support)
2599 *** will be lost.  It may be necessary for you to restart Configure and
2600 *** add -Dcc=gcc to your Configure command line.
2601
2602 EOM
2603                         rp="Would you like to go ahead and try gcc anyway?"
2604                         dflt=n
2605                 else
2606                         rp="Would you like to use it?"
2607                         dflt=y
2608                 fi
2609                 if $test -f myread; then
2610                     . ./myread
2611                 else
2612                     if $test -f UU/myread; then
2613                         . ./UU/myread
2614                     else
2615                         echo "Cannot find myread, sorry.  Aborting." >&2
2616                         exit 1
2617                     fi
2618                 fi  
2619                 case "$ans" in
2620                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2621                 esac
2622             fi
2623         fi
2624     fi
2625     $rm -f try try.*
2626     ;;
2627 esac
2628 EOSC
2629
2630 cat <<EOS >checkcc
2631 $startsh
2632 EOS
2633 cat <<'EOSC' >>checkcc
2634 case "$cc" in        
2635 '') ;;
2636 *)  $rm -f try try.*              
2637     $cat >try.c <<EOM
2638 int main(int argc, char *argv[]) {
2639   return 0;
2640 }
2641 EOM
2642     if $cc -o try $ccflags $ldflags try.c; then
2643        :
2644     else
2645         if $test X"$despair" = Xyes; then
2646            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2647         fi
2648         $cat >&4 <<EOM         
2649 You need to find a working C compiler.
2650 Either (purchase and) install the C compiler supplied by your OS vendor,
2651 or for a free C compiler try http://gcc.gnu.org/
2652 I cannot continue any further, aborting.
2653 EOM
2654         exit 1
2655     fi
2656     $rm -f try try.*
2657     ;;
2658 esac
2659 EOSC
2660
2661 : determine whether symbolic links are supported
2662 echo " "
2663 $touch blurfl
2664 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2665         echo "Symbolic links are supported." >&4
2666         lns="$ln -s"
2667 else
2668         echo "Symbolic links are NOT supported." >&4
2669         lns="$ln"
2670 fi
2671 $rm -f blurfl sym
2672
2673 : determine whether symbolic links are supported
2674 echo " "
2675 case "$lns" in
2676 *"ln"*" -s")
2677         echo "Checking how to test for symbolic links..." >&4
2678         $lns blurfl sym
2679         if $test "X$issymlink" = X; then
2680                 case "$newsh" in
2681                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2682                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2683                 esac
2684                 if test $? = 0; then
2685                         issymlink="test -h"
2686                 else
2687                         echo "Your builtin 'test -h' may be broken." >&4
2688                         case "$test" in
2689                         /*)     ;;
2690                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2691                                 for p in $pth
2692                                 do
2693                                         if test -f "$p/$test"; then
2694                                                 test="$p/$test"
2695                                                 break
2696                                         fi
2697                                 done
2698                                 ;;
2699                         esac
2700                         case "$test" in
2701                         /*)
2702                                 echo "Trying external '$test -h'." >&4
2703                                 issymlink="$test -h"
2704                                 if $test ! -h sym >/dev/null 2>&1; then
2705                                         echo "External '$test -h' is broken, too." >&4
2706                                         issymlink=''
2707                                 fi
2708                                 ;;
2709                         *)      issymlink='' ;;
2710                         esac
2711                 fi
2712         fi
2713         if $test "X$issymlink" = X; then
2714                 if $test -L sym 2>/dev/null; then
2715                         issymlink="$test -L"
2716                         echo "The builtin '$test -L' worked." >&4
2717                 fi
2718         fi
2719         if $test "X$issymlink" != X; then
2720                 echo "You can test for symbolic links with '$issymlink'." >&4
2721         else
2722                 echo "I do not know how you can test for symbolic links." >&4
2723         fi
2724         $rm -f blurfl sym
2725         ;;
2726 *)      echo "No symbolic links, so not testing for their testing..." >&4
2727         ;;
2728 esac
2729 echo " "
2730
2731 : Make symlinks util
2732 case "$mksymlinks" in
2733 $define|true|[yY]*)
2734         case "$src" in
2735         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2736                 exit 1
2737                 ;;
2738         *)      case "$lns:$issymlink" in
2739                 *"ln"*" -s:"*"test -"?)
2740                         echo "Creating the symbolic links..." >&4
2741                         echo "(First creating the subdirectories...)" >&4
2742                         cd ..
2743                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2744                                 read directory
2745                                 test -z "$directory" && break
2746                                 mkdir -p $directory
2747                         done
2748                         # Sanity check 1.
2749                         if test ! -d t/base; then
2750                                 echo "Failed to create the subdirectories.  Aborting." >&4
2751                                 exit 1
2752                         fi
2753                         echo "(Then creating the symlinks...)" >&4
2754                         awk '{print $1}' $src/MANIFEST | while true; do
2755                                 read filename
2756                                 test -z "$filename" && break
2757                                 if test -f $filename; then
2758                                         if $issymlink $filename; then
2759                                                 rm -f $filename
2760                                         fi
2761                                 fi
2762                                 if test -f $filename; then
2763                                         echo "$filename already exists, not symlinking."
2764                                 else
2765                                         ln -s $src/$filename $filename
2766                                 fi
2767                         done
2768                         # Sanity check 2.
2769                         if test ! -f t/base/lex.t; then
2770                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2771                                 exit 1
2772                         fi
2773                         cd UU
2774                         ;;
2775                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2776                         ;;
2777                 esac
2778                 ;;
2779         esac
2780         ;;
2781 esac
2782
2783 : Check for Cross-Compilation
2784 case "$usecrosscompile" in
2785 $define|true|[yY]*)
2786         $echo "Cross-compiling..."
2787         croak=''
2788         case "$cc" in
2789         *-*-gcc) # A cross-compiling gcc, probably.
2790             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2791             ar=$targetarch-ar
2792             # leave out ld, choosing it is more complex
2793             nm=$targetarch-nm
2794             ranlib=$targetarch-ranlib
2795             $echo 'extern int foo;' > try.c
2796             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2797             shift
2798             if $test $# -gt 0; then
2799                 incpth="$incpth $*"
2800                 incpth="`$echo $incpth|$sed 's/^ //'`"
2801                 echo "Guessing incpth '$incpth'." >&4
2802                 for i in $*; do
2803                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2804                     if $test -d $j; then
2805                         libpth="$libpth $j"
2806                     fi
2807                 done   
2808                 libpth="`$echo $libpth|$sed 's/^ //'`"
2809                 echo "Guessing libpth '$libpth'." >&4
2810             fi
2811             $rm -f try.c
2812             ;;
2813         esac
2814         case "$targetarch" in
2815         '') echo "Targetarch not defined." >&4; croak=y ;;
2816         *)  echo "Using targetarch $targetarch." >&4 ;;
2817         esac
2818         case "$incpth" in
2819         '') echo "Incpth not defined." >&4; croak=y ;;
2820         *)  echo "Using incpth '$incpth'." >&4 ;;
2821         esac
2822         case "$libpth" in
2823         '') echo "Libpth not defined." >&4; croak=y ;;
2824         *)  echo "Using libpth '$libpth'." >&4 ;;
2825         esac
2826         case "$usrinc" in
2827         '') for i in $incpth; do
2828                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2829                     usrinc=$i
2830                     echo "Guessing usrinc $usrinc." >&4
2831                     break
2832                 fi
2833             done
2834             case "$usrinc" in
2835             '') echo "Usrinc not defined." >&4; croak=y ;;
2836             esac
2837             ;;
2838         *)  echo "Using usrinc $usrinc." >&4 ;;
2839         esac
2840         case "$targethost" in
2841         '') echo "Targethost not defined." >&4; croak=y ;;
2842         *)  echo "Using targethost $targethost." >&4
2843         esac
2844         locincpth=' '
2845         loclibpth=' '
2846         case "$croak" in
2847         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2848         esac
2849         case "$src" in
2850         /*) run=$src/Cross/run
2851             targetmkdir=$src/Cross/mkdir
2852             to=$src/Cross/to
2853             from=$src/Cross/from
2854             ;;
2855         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2856             run=$pwd/Cross/run
2857             targetmkdir=$pwd/Cross/mkdir
2858             to=$pwd/Cross/to
2859             from=$pwd/Cross/from
2860             ;;
2861         esac
2862         case "$targetrun" in
2863         '') targetrun=ssh ;;
2864         esac
2865         case "$targetto" in
2866         '') targetto=scp ;;
2867         esac
2868         case "$targetfrom" in
2869         '') targetfrom=scp ;;
2870         esac
2871         run=$run-$targetrun
2872         to=$to-$targetto
2873         from=$from-$targetfrom
2874         case "$targetdir" in
2875         '')  targetdir=/tmp
2876              echo "Guessing targetdir $targetdir." >&4
2877              ;;
2878         esac
2879         case "$targetuser" in
2880         '')  targetuser=root
2881              echo "Guessing targetuser $targetuser." >&4
2882              ;;
2883         esac
2884         case "$targetfrom" in
2885         scp)    q=-q ;;
2886         *)      q='' ;;
2887         esac
2888         case "$targetrun" in
2889         ssh|rsh)
2890             cat >$run <<EOF
2891 #!/bin/sh
2892 case "\$1" in
2893 -cwd)
2894   shift
2895   cwd=\$1
2896   shift
2897   ;;
2898 esac
2899 case "\$cwd" in
2900 '') cwd=$targetdir ;;
2901 esac
2902 exe=\$1
2903 shift
2904 if $test ! -f \$exe.xok; then
2905   $to \$exe
2906   $touch \$exe.xok
2907 fi
2908 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2909 EOF
2910             ;;
2911         *)  echo "Unknown targetrun '$targetrun'" >&4
2912             exit 1
2913             ;;
2914         esac
2915         case "$targetmkdir" in
2916         */Cross/mkdir)
2917             cat >$targetmkdir <<EOF
2918 #!/bin/sh
2919 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2920 EOF
2921             $chmod a+rx $targetmkdir
2922             ;;
2923         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2924             exit 1
2925             ;;
2926         esac
2927         case "$targetto" in
2928         scp|rcp)
2929             cat >$to <<EOF
2930 #!/bin/sh
2931 for f in \$@
2932 do
2933   case "\$f" in
2934   /*)
2935     $targetmkdir \`dirname \$f\`
2936     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2937     ;;
2938   *)
2939     $targetmkdir $targetdir/\`dirname \$f\`
2940     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2941     ;;
2942   esac
2943 done
2944 exit 0
2945 EOF
2946             ;;
2947         cp) cat >$to <<EOF
2948 #!/bin/sh
2949 for f in \$@
2950 do
2951   case "\$f" in
2952   /*)
2953     $mkdir -p $targetdir/\`dirname \$f\`
2954     $cp \$f $targetdir/\$f || exit 1
2955     ;;
2956   *)
2957     $targetmkdir $targetdir/\`dirname \$f\`
2958     $cp \$f $targetdir/\$f || exit 1
2959     ;;
2960   esac
2961 done
2962 exit 0
2963 EOF
2964             ;;
2965         *)  echo "Unknown targetto '$targetto'" >&4
2966             exit 1
2967             ;;
2968         esac
2969         case "$targetfrom" in
2970         scp|rcp)
2971           cat >$from <<EOF
2972 #!/bin/sh
2973 for f in \$@
2974 do
2975   $rm -f \$f
2976   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2977 done
2978 exit 0
2979 EOF
2980             ;;
2981         cp) cat >$from <<EOF
2982 #!/bin/sh
2983 for f in \$@
2984 do
2985   $rm -f \$f
2986   cp $targetdir/\$f . || exit 1
2987 done
2988 exit 0
2989 EOF
2990             ;;
2991         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2992             exit 1
2993             ;;
2994         esac
2995         if $test ! -f $run; then
2996             echo "Target 'run' script '$run' not found." >&4
2997         else
2998             $chmod a+rx $run
2999         fi
3000         if $test ! -f $to; then
3001             echo "Target 'to' script '$to' not found." >&4
3002         else
3003             $chmod a+rx $to
3004         fi
3005         if $test ! -f $from; then
3006             echo "Target 'from' script '$from' not found." >&4
3007         else
3008             $chmod a+rx $from
3009         fi
3010         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3011             exit 1
3012         fi
3013         cat >&4 <<EOF
3014 Using '$run' for remote execution,
3015 and '$from' and '$to'
3016 for remote file transfer.
3017 EOF
3018         ;;
3019 *)      run=''
3020         to=:
3021         from=:
3022         usecrosscompile='undef'
3023         targetarch=''
3024         ;;
3025 esac
3026
3027 : see whether [:lower:] and [:upper:] are supported character classes
3028 echo " "
3029 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3030 ABYZ)
3031         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3032         up='[:upper:]'
3033         low='[:lower:]'
3034         ;;
3035 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3036         # (0xd9 and 0xe2), therefore that is a nice testing point.
3037         if test "X$up" = X -o "X$low" = X; then
3038             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3039             rs) up='[A-Z]'
3040                 low='[a-z]'
3041                 ;;
3042             esac
3043         fi
3044         if test "X$up" = X -o "X$low" = X; then
3045             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3046             rs) up='A-Z'
3047                 low='a-z'
3048                 ;;
3049             esac
3050         fi
3051         if test "X$up" = X -o "X$low" = X; then
3052             case "`echo RS | od -x 2>/dev/null`" in
3053             *D9E2*|*d9e2*)
3054                 echo "Hey, this might be EBCDIC." >&4
3055                 if test "X$up" = X -o "X$low" = X; then
3056                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3057                     rs) up='[A-IJ-RS-Z]'
3058                         low='[a-ij-rs-z]'
3059                         ;;
3060                     esac
3061                 fi
3062                 if test "X$up" = X -o "X$low" = X; then
3063                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3064                     rs) up='A-IJ-RS-Z'
3065                         low='a-ij-rs-z'
3066                         ;;
3067                     esac
3068                 fi
3069                 ;;
3070             esac
3071         fi
3072 esac
3073 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3074 rs)
3075     echo "Using $up and $low to convert case." >&4
3076     ;;
3077 *)
3078     echo "I don't know how to translate letters from upper to lower case." >&4
3079     echo "Your tr is not acting any way I know of." >&4
3080     exit 1
3081     ;;
3082 esac
3083 : set up the translation script tr, must be called with ./tr of course
3084 cat >tr <<EOSC
3085 $startsh
3086 case "\$1\$2" in
3087 '[A-Z][a-z]') exec $tr '$up' '$low';;
3088 '[a-z][A-Z]') exec $tr '$low' '$up';;
3089 esac
3090 exec $tr "\$@"
3091 EOSC
3092 chmod +x tr
3093 $eunicefix tr
3094
3095 : Try to determine whether config.sh was made on this system
3096 case "$config_sh" in
3097 '')
3098 myuname=`$uname -a 2>/dev/null`
3099 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3100 # Downcase everything to avoid ambiguity.
3101 # Remove slashes and single quotes so we can use parts of this in
3102 # directory and file names.
3103 # Remove newlines so myuname is sane to use elsewhere.
3104 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3105 # because the A-Z/a-z are not consecutive.
3106 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3107         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3108 newmyuname="$myuname"
3109 dflt=n
3110 case "$knowitall" in
3111 '')
3112         if test -f ../config.sh; then
3113                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3114                         eval "`grep myuname= ../config.sh`"
3115                 fi
3116                 if test "X$myuname" = "X$newmyuname"; then
3117                         dflt=y
3118                 fi
3119         fi
3120         ;;
3121 *) dflt=y;;
3122 esac
3123
3124 : Get old answers from old config file if Configure was run on the
3125 : same system, otherwise use the hints.
3126 hint=default
3127 cd ..
3128 if test -f config.sh; then
3129         echo " "
3130         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3131         . UU/myread
3132         case "$ans" in
3133         n*|N*) echo "OK, I'll ignore it."
3134                 mv config.sh config.sh.old
3135                 myuname="$newmyuname"
3136                 ;;
3137         *)  echo "Fetching default answers from your old config.sh file..." >&4
3138                 tmp_n="$n"
3139                 tmp_c="$c"
3140                 tmp_sh="$sh"
3141                 . ./config.sh
3142                 cp config.sh UU
3143                 n="$tmp_n"
3144                 c="$tmp_c"
3145                 : Older versions did not always set $sh.  Catch re-use of such
3146                 : an old config.sh.
3147                 case "$sh" in
3148                 '') sh="$tmp_sh" ;;
3149                 esac
3150                 hint=previous
3151                 ;;
3152         esac
3153 fi
3154 . ./UU/checkcc
3155 if test ! -f config.sh; then
3156         $cat <<EOM
3157
3158 First time through, eh?  I have some defaults handy for some systems
3159 that need some extra help getting the Configure answers right:
3160
3161 EOM
3162         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3163         dflt=''
3164         : Half the following guesses are probably wrong... If you have better
3165         : tests or hints, please send them to perlbug@perl.org
3166         : The metaconfig authors would also appreciate a copy...
3167         $test -f /irix && osname=irix
3168         $test -f /xenix && osname=sco_xenix
3169         $test -f /dynix && osname=dynix
3170         $test -f /dnix && osname=dnix
3171         $test -f /lynx.os && osname=lynxos
3172         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3173         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3174         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3175         $test -f /bin/mips && /bin/mips && osname=mips
3176         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3177                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3178         $test -d /usr/apollo/bin && osname=apollo
3179         $test -f /etc/saf/_sactab && osname=svr4
3180         $test -d /usr/include/minix && osname=minix
3181         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3182         if $test -d /MachTen -o -d /MachTen_Folder; then
3183                 osname=machten
3184                 if $test -x /sbin/version; then
3185                         osvers=`/sbin/version | $awk '{print $2}' |
3186                         $sed -e 's/[A-Za-z]$//'`
3187                 elif $test -x /usr/etc/version; then
3188                         osvers=`/usr/etc/version | $awk '{print $2}' |
3189                         $sed -e 's/[A-Za-z]$//'`
3190                 else
3191                         osvers="$2.$3"
3192                 fi
3193         fi
3194
3195         $test -f /sys/posix.dll &&
3196                 $test -f /usr/bin/what &&
3197                 set X `/usr/bin/what /sys/posix.dll` &&
3198                 $test "$3" = UWIN &&
3199                 osname=uwin &&
3200                 osvers="$5"
3201
3202         if $test -f $uname; then
3203                 set X $myuname
3204                 shift
3205
3206                 case "$5" in
3207                 fps*) osname=fps ;;
3208                 mips*)
3209                         case "$4" in
3210                         umips) osname=umips ;;
3211                         *) osname=mips ;;
3212                         esac;;
3213                 [23]100) osname=mips ;;
3214                 next*) osname=next ;;
3215                 i386*)
3216                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3217                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3218                                 osname='sco'
3219                                 osvers=$tmp
3220                         elif $test -f /etc/kconfig; then
3221                                 osname=isc
3222                                 if test "$lns" = "$ln -s"; then
3223                                         osvers=4
3224                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3225                                         osvers=3
3226                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3227                                         osvers=2
3228                                 fi
3229                         fi
3230                         tmp=''
3231                         ;;
3232                 pc*)
3233                         if test -n "$DJGPP"; then
3234                                 osname=dos
3235                                 osvers=djgpp
3236                         fi
3237                         ;;
3238                 esac
3239
3240                 case "$1" in
3241                 aix) osname=aix
3242                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3243                         case "$tmp" in
3244                         # oslevel can fail with:
3245                         # oslevel: Unable to acquire lock.
3246                         *not\ found) osvers="$4"."$3" ;;
3247                         '<3240'|'<>3240') osvers=3.2.0 ;;
3248                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3249                         '=3250'|'>3250') osvers=3.2.5 ;;
3250                         *) osvers=$tmp;;
3251                         esac
3252                         ;;
3253                 bitrig) osname=bitrig
3254                         osvers="$3"
3255                         ;;
3256                 bsd386) osname=bsd386
3257                         osvers=`$uname -r`
3258                         ;;
3259                 cygwin*) osname=cygwin
3260                         osvers="$3"
3261                         ;;
3262                 *dc.osx) osname=dcosx
3263                         osvers="$3"
3264                         ;;
3265                 dnix) osname=dnix
3266                         osvers="$3"
3267                         ;;
3268                 domainos) osname=apollo
3269                         osvers="$3"
3270                         ;;
3271                 dgux)   osname=dgux
3272                         osvers="$3"
3273                         ;;
3274                 dragonfly) osname=dragonfly
3275                         osvers="$3"
3276                         ;;
3277                 dynixptx*) osname=dynixptx
3278                         osvers=`echo "$4"|sed 's/^v//'`
3279                         ;;
3280                 freebsd) osname=freebsd
3281                         osvers="$3" ;;
3282                 genix)  osname=genix ;;
3283                 gnu)    osname=gnu
3284                         osvers="$3" ;;
3285                 hp*)    osname=hpux
3286                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3287                         ;;
3288                 irix*)  osname=irix
3289                         case "$3" in
3290                         4*) osvers=4 ;;
3291                         5*) osvers=5 ;;
3292                         *)      osvers="$3" ;;
3293                         esac
3294                         ;;
3295                 linux)  osname=linux
3296                         case "$3" in
3297                         *)      osvers="$3" ;;
3298                         esac
3299                         ;;
3300                 MiNT)   osname=mint
3301                         ;;
3302                 netbsd*) osname=netbsd
3303                         osvers="$3"
3304                         ;;
3305                 news-os) osvers="$3"
3306                         case "$3" in
3307                         4*) osname=newsos4 ;;
3308                         *) osname=newsos ;;
3309                         esac
3310                         ;;
3311                 next*) osname=next ;;
3312                 nonstop-ux) osname=nonstopux ;;
3313                 openbsd) osname=openbsd
3314                         osvers="$3"
3315                         ;;
3316                 os2)    osname=os2
3317                         osvers="$4"
3318                         ;;
3319                 POSIX-BC | posix-bc ) osname=posix-bc
3320                         osvers="$3"
3321                         ;;
3322                 powerux | power_ux | powermax_os | powermaxos | \
3323                 powerunix | power_unix) osname=powerux
3324                         osvers="$3"
3325                         ;;
3326                 qnx) osname=qnx
3327                         osvers="$4"
3328                         ;;
3329                 solaris) osname=solaris
3330                         case "$3" in
3331                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3332                         *)      osvers="$3" ;;
3333                         esac
3334                         ;;
3335                 sunos) osname=sunos
3336                         case "$3" in
3337                         5*) osname=solaris
3338                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3339                         *)      osvers="$3" ;;
3340                         esac
3341                         ;;
3342                 titanos) osname=titanos
3343                         case "$3" in
3344                         1*) osvers=1 ;;
3345                         2*) osvers=2 ;;
3346                         3*) osvers=3 ;;
3347                         4*) osvers=4 ;;
3348                         *)      osvers="$3" ;;
3349                         esac
3350                         ;;
3351                 ultrix) osname=ultrix
3352                         osvers="$3"
3353                         ;;
3354                 osf1|mls+)      case "$5" in
3355                                 alpha)
3356                                         osname=dec_osf
3357                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3358                                         case "$osvers" in
3359                                         [1-9].[0-9]*) ;;
3360                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3361                                         esac
3362                                         ;;
3363                         hp*)    osname=hp_osf1  ;;
3364                         mips)   osname=mips_osf1 ;;
3365                         esac
3366                         ;;
3367                 # UnixWare 7.1.2 is known as Open UNIX 8
3368                 openunix|unixware) osname=svr5
3369                         osvers="$4"
3370                         ;;
3371                 uts)    osname=uts
3372                         osvers="$3"
3373                         ;;
3374                 vos) osvers="$3"
3375                         ;;
3376                 $2) case "$osname" in
3377                         *isc*) ;;
3378                         *freebsd*) ;;
3379                         svr*)
3380                                 : svr4.x or possibly later
3381                                 case "svr$3" in
3382                                 ${osname}*)
3383                                         osname=svr$3
3384                                         osvers=$4
3385                                         ;;
3386                                 esac
3387                                 case "$osname" in
3388                                 svr4.0)
3389                                         : Check for ESIX
3390                                         if test -f /stand/boot ; then
3391                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3392                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3393                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3394                                                         if test -n "$isesix"; then
3395                                                                 osname=esix4
3396                                                         fi
3397                                                 fi
3398                                         fi
3399                                         ;;
3400                                 esac
3401                                 ;;
3402                         *)      if test -f /etc/systemid; then
3403                                         osname=sco
3404                                         set `echo $3 | $sed 's/\./ /g'` $4
3405                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3406                                                 osvers=$1.$2.$3
3407                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3408                                                 osvers=$1.$2
3409                                         elif $test -f $src/hints/sco_$1.sh; then
3410                                                 osvers=$1
3411                                         fi
3412                                 else
3413                                         case "$osname" in
3414                                         '') : Still unknown.  Probably a generic Sys V.
3415                                                 osname="sysv"
3416                                                 osvers="$3"
3417                                                 ;;
3418                                         esac
3419                                 fi
3420                                 ;;
3421                         esac
3422                         ;;
3423                 *)      case "$osname" in
3424                         '') : Still unknown.  Probably a generic BSD.
3425                                 osname="$1"
3426                                 osvers="$3"
3427                                 ;;
3428                         esac
3429                         ;;
3430                 esac
3431         else
3432                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3433                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3434                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3435                                 osname=news_os
3436                         fi
3437                         $rm -f UU/kernel.what
3438                 elif test -d c:/. -o -n "$is_os2" ; then
3439                         set X $myuname
3440                         osname=os2
3441                         osvers="$5"
3442                 fi
3443         fi
3444
3445         case "$targetarch" in
3446         '') ;;
3447         *)  hostarch=$osname
3448             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3449             osvers=''
3450             ;;
3451         esac
3452
3453         : Now look for a hint file osname_osvers, unless one has been
3454         : specified already.
3455         case "$hintfile" in
3456         ''|' ')
3457                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3458                 : Also try without trailing minor version numbers.
3459                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3460                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3461                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3462                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3463                 case "$file" in
3464                 '') dflt=none ;;
3465                 *)  case "$osvers" in
3466                         '') dflt=$file
3467                                 ;;
3468                         *)  if $test -f $src/hints/$file.sh ; then
3469                                         dflt=$file
3470                                 elif $test -f $src/hints/$xfile.sh ; then
3471                                         dflt=$xfile
3472                                 elif $test -f $src/hints/$xxfile.sh ; then
3473                                         dflt=$xxfile
3474                                 elif $test -f $src/hints/$xxxfile.sh ; then
3475                                         dflt=$xxxfile
3476                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3477                                         dflt=$xxxxfile
3478                                 elif $test -f "$src/hints/${osname}.sh" ; then
3479                                         dflt="${osname}"
3480                                 else
3481                                         dflt=none
3482                                 fi
3483                                 ;;
3484                         esac
3485                         ;;
3486                 esac
3487                 if $test -f Policy.sh ; then
3488                         case "$dflt" in
3489                         *Policy*) ;;
3490                         none) dflt="Policy" ;;
3491                         *) dflt="Policy $dflt" ;;
3492                         esac
3493                 fi
3494                 ;;
3495         *)
3496                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3497                 ;;
3498         esac
3499
3500         if $test -f Policy.sh ; then
3501                 $cat <<EOM
3502
3503 There's also a Policy hint file available, which should make the
3504 site-specific (policy) questions easier to answer.
3505 EOM
3506
3507         fi
3508
3509         $cat <<EOM
3510
3511 You may give one or more space-separated answers, or "none" if appropriate.
3512 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3513 previous run of Configure, you may specify it as well as or instead of
3514 OS-specific hints.  If hints are provided for your OS, you should use them:
3515 although Perl can probably be built without hints on many platforms, using
3516 hints often improve performance and may enable features that Configure can't
3517 set up on its own. If there are no hints that match your OS, specify "none";
3518 DO NOT give a wrong version or a wrong OS.
3519
3520 EOM
3521
3522         rp="Which of these apply, if any?"
3523         . UU/myread
3524         tans=$ans
3525         for file in $tans; do
3526                 if $test X$file = XPolicy -a -f Policy.sh; then
3527                         . Policy.sh
3528                         $cat Policy.sh >> UU/config.sh
3529                 elif $test -f $src/hints/$file.sh; then
3530                         . $src/hints/$file.sh
3531                         $cat $src/hints/$file.sh >> UU/config.sh
3532                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3533                         : nothing
3534                 else
3535                         : Give one chance to correct a possible typo.
3536                         echo "$file.sh does not exist"
3537                         dflt=$file
3538                         rp="hint to use instead?"
3539                         . UU/myread
3540                         for file in $ans; do
3541                                 if $test -f "$src/hints/$file.sh"; then
3542                                         . $src/hints/$file.sh
3543                                         $cat $src/hints/$file.sh >> UU/config.sh
3544                                 elif $test X$ans = X -o X$ans = Xnone ; then
3545                                         : nothing
3546                                 else
3547                                         echo "$file.sh does not exist -- ignored."
3548                                 fi
3549                         done
3550                 fi
3551         done
3552
3553         hint=recommended
3554         : Remember our hint file for later.
3555         if $test -f "$src/hints/$file.sh" ; then
3556                 hintfile="$file"
3557         else
3558                 hintfile=''
3559         fi
3560 fi
3561 cd UU
3562 ;;
3563 *)
3564         echo " "
3565         echo "Fetching default answers from $config_sh..." >&4
3566         tmp_n="$n"
3567         tmp_c="$c"
3568         cd ..
3569         cp $config_sh config.sh 2>/dev/null
3570         chmod +w config.sh
3571         . ./config.sh
3572         cd UU
3573         cp ../config.sh .
3574         n="$tmp_n"
3575         c="$tmp_c"
3576         hint=previous
3577         ;;
3578 esac
3579 test "$override" && . ./optdef.sh
3580
3581 : Restore computed paths
3582 for file in $loclist $trylist; do
3583         eval $file="\$_$file"
3584 done
3585
3586 cat << EOM
3587
3588 Configure uses the operating system name and version to set some defaults.
3589 The default value is probably right if the name rings a bell. Otherwise,
3590 since spelling matters for me, either accept the default or answer "none"
3591 to leave it blank.
3592
3593 EOM
3594 case "$osname" in
3595         ''|' ')
3596                 case "$hintfile" in
3597                 ''|' '|none) dflt=none ;;
3598                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3599                 esac
3600                 ;;
3601         *) dflt="$osname" ;;
3602 esac
3603 rp="Operating system name?"
3604 . ./myread
3605 case "$ans" in
3606 none)  osname='' ;;
3607 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3608 esac
3609 echo " "
3610 case "$osvers" in
3611         ''|' ')
3612                 case "$hintfile" in
3613                 ''|' '|none) dflt=none ;;
3614                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3615                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3616                         case "$dflt" in
3617                         ''|' ') dflt=none ;;
3618                         esac
3619                         ;;
3620                 esac
3621                 ;;
3622         *) dflt="$osvers" ;;
3623 esac
3624 rp="Operating system version?"
3625 . ./myread
3626 case "$ans" in
3627 none)  osvers='' ;;
3628 *) osvers="$ans" ;;
3629 esac
3630
3631
3632 . ./posthint.sh
3633
3634 : who configured the system
3635 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3636 case "$cf_by" in
3637 "")
3638         cf_by=`(logname) 2>/dev/null`
3639         case "$cf_by" in
3640         "")
3641                 cf_by=`(whoami) 2>/dev/null`
3642                 case "$cf_by" in
3643                 "") cf_by=unknown ;;
3644                 esac ;;
3645         esac ;;
3646 esac
3647
3648 : decide how portable to be.  Allow command line overrides.
3649 case "$d_portable" in
3650 "$undef") ;;
3651 *)      d_portable="$define" ;;
3652 esac
3653
3654 : set up shell script to do ~ expansion
3655 cat >filexp <<EOSS
3656 $startsh
3657 : expand filename
3658 case "\$1" in
3659  \~/*|\~)
3660         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3661         ;;
3662  \~*)
3663         if $test -f /bin/csh; then
3664                 /bin/csh -f -c "glob \$1"
3665                 failed=\$?
3666                 echo ""
3667                 exit \$failed
3668         else
3669                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3670                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3671                 if $test ! -d "\$dir"; then
3672                         me=\`basename \$0\`
3673                         echo "\$me: can't locate home directory for: \$name" >&2
3674                         exit 1
3675                 fi
3676                 case "\$1" in
3677                 */*)
3678                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3679                         ;;
3680                 *)
3681                         echo \$dir
3682                         ;;
3683                 esac
3684         fi
3685         ;;
3686 *)
3687         echo \$1
3688         ;;
3689 esac
3690 EOSS
3691 chmod +x filexp
3692 $eunicefix filexp
3693
3694 : now set up to get a file name
3695 cat <<EOS >getfile
3696 $startsh
3697 EOS
3698 cat <<'EOSC' >>getfile
3699 tilde=''
3700 fullpath=''
3701 already=''
3702 skip=''
3703 none_ok=''
3704 exp_file=''
3705 nopath_ok=''
3706 orig_rp="$rp"
3707 orig_dflt="$dflt"
3708 case "$gfpth" in
3709 '') gfpth='.' ;;
3710 esac
3711
3712 case "$fn" in
3713 *\(*)
3714         : getfile will accept an answer from the comma-separated list
3715         : enclosed in parentheses even if it does not meet other criteria.
3716         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3717         fn=`echo $fn | sed 's/(.*)//'`
3718         ;;
3719 esac
3720
3721 case "$fn" in
3722 *:*)
3723         loc_file=`expr $fn : '.*:\(.*\)'`
3724         fn=`expr $fn : '\(.*\):.*'`
3725         ;;
3726 esac
3727
3728 case "$fn" in
3729 *~*) tilde=true;;
3730 esac
3731 case "$fn" in
3732 */*) fullpath=true;;
3733 esac
3734 case "$fn" in
3735 *+*) skip=true;;
3736 esac
3737 case "$fn" in
3738 *n*) none_ok=true;;
3739 esac
3740 case "$fn" in
3741 *e*) exp_file=true;;
3742 esac
3743 case "$fn" in
3744 *p*) nopath_ok=true;;
3745 esac
3746
3747 case "$fn" in
3748 *f*) type='File';;
3749 *d*) type='Directory';;
3750 *l*) type='Locate';;
3751 esac
3752
3753 what="$type"
3754 case "$what" in
3755 Locate) what='File';;
3756 esac
3757
3758 case "$exp_file" in
3759 '')
3760         case "$d_portable" in
3761         "$define") ;;
3762         *) exp_file=true;;
3763         esac
3764         ;;
3765 esac
3766
3767 cd ..
3768 while test "$type"; do
3769         redo=''
3770         rp="$orig_rp"
3771         dflt="$orig_dflt"
3772         case "$tilde" in
3773         true) rp="$rp (~name ok)";;
3774         esac
3775         . UU/myread
3776         if test -f UU/getfile.ok && \
3777                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3778         then
3779                 value="$ans"
3780                 ansexp="$ans"
3781                 break
3782         fi
3783         case "$ans" in
3784         none)
3785                 value=''
3786                 ansexp=''
3787                 case "$none_ok" in
3788                 true) type='';;
3789                 esac
3790                 ;;
3791         *)
3792                 case "$tilde" in
3793                 '') value="$ans"
3794                         ansexp="$ans";;
3795                 *)
3796                         value=`UU/filexp $ans`
3797                         case $? in
3798                         0)
3799                                 if test "$ans" != "$value"; then
3800                                         echo "(That expands to $value on this system.)"
3801                                 fi
3802                                 ;;
3803                         *) value="$ans";;
3804                         esac
3805                         ansexp="$value"
3806                         case "$exp_file" in
3807                         '') value="$ans";;
3808                         esac
3809                         ;;
3810                 esac
3811                 case "$fullpath" in
3812                 true)
3813                         case "$ansexp" in
3814                         /*) value="$ansexp" ;;
3815                         [a-zA-Z]:/*) value="$ansexp" ;;
3816                         *)
3817                                 redo=true
3818                                 case "$already" in
3819                                 true)
3820                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3821                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3822                                         ;;
3823                                 *)
3824                                 echo "Please give a full path name, starting with slash." >&4
3825                                         case "$tilde" in
3826                                         true)
3827                                 echo "Note that using ~name is ok provided it expands well." >&4
3828                                                 already=true
3829                                                 ;;
3830                                         esac
3831                                 esac
3832                                 ;;
3833                         esac
3834                         ;;
3835                 esac
3836                 case "$redo" in
3837                 '')
3838                         case "$type" in
3839                         File)
3840                                 for fp in $gfpth; do
3841                                         if test "X$fp" = X.; then
3842                                             pf="$ansexp"
3843                                         else    
3844                                             pf="$fp/$ansexp"
3845                                         fi
3846                                         if test -f "$pf"; then
3847                                                 type=''
3848                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3849                                         then
3850                                                 echo "($value is not a plain file, but that's ok.)"
3851                                                 type=''
3852                                         fi
3853                                         if test X"$type" = X; then
3854                                             value="$pf"
3855                                             break
3856                                         fi
3857                                 done
3858                                 ;;
3859                         Directory)
3860                                 for fp in $gfpth; do
3861                                         if test "X$fp" = X.; then
3862                                             dir="$ans"
3863                                             direxp="$ansexp"
3864                                         else    
3865                                             dir="$fp/$ansexp"
3866                                             direxp="$fp/$ansexp"
3867                                         fi
3868                                         if test -d "$direxp"; then
3869                                                 type=''
3870                                                 value="$dir"
3871                                                 break
3872                                         fi
3873                                 done
3874                                 ;;
3875                         Locate)
3876                                 if test -d "$ansexp"; then
3877                                         echo "(Looking for $loc_file in directory $value.)"
3878                                         value="$value/$loc_file"
3879                                         ansexp="$ansexp/$loc_file"
3880                                 fi
3881                                 if test -f "$ansexp"; then
3882                                         type=''
3883                                 fi
3884                                 case "$nopath_ok" in
3885                                 true)   case "$value" in
3886                                         */*) ;;
3887                                         *)      echo "Assuming $value will be in people's path."
3888                                                 type=''
3889                                                 ;;
3890                                         esac
3891                                         ;;
3892                                 esac
3893                                 ;;
3894                         esac
3895
3896                         case "$skip" in
3897                         true) type='';
3898                         esac
3899
3900                         case "$type" in
3901                         '') ;;
3902                         *)
3903                                 if test "$fastread" = yes; then
3904                                         dflt=y
3905                                 else
3906                                         dflt=n
3907                                 fi
3908                                 rp="$what $value doesn't exist.  Use that name anyway?"
3909                                 . UU/myread
3910                                 dflt=''
3911                                 case "$ans" in
3912                                 y*) type='';;
3913                                 *) echo " ";;
3914                                 esac
3915                                 ;;
3916                         esac
3917                         ;;
3918                 esac
3919                 ;;
3920         esac
3921 done
3922 cd UU
3923 ans="$value"
3924 rp="$orig_rp"
3925 dflt="$orig_dflt"
3926 rm -f getfile.ok
3927 test "X$gfpthkeep" != Xy && gfpth=""
3928 EOSC
3929
3930 : determine root of directory hierarchy where package will be installed.
3931 case "$prefix" in
3932 '')
3933         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3934         ;;
3935 *?/)
3936         dflt=`echo "$prefix" | sed 's/.$//'`
3937         ;;
3938 *)
3939         dflt="$prefix"
3940         ;;
3941 esac
3942 $cat <<EOM
3943
3944 By default, $package will be installed in $dflt/bin, manual pages
3945 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3946 installation directories. Typically this is something like /usr/local.
3947 If you wish to have binaries under /usr/bin but other parts of the
3948 installation under /usr/local, that's ok: you will be prompted
3949 separately for each of the installation directories, the prefix being
3950 only used to set the defaults.
3951
3952 EOM
3953 fn=d~
3954 rp='Installation prefix to use?'
3955 . ./getfile
3956 oldprefix=''
3957 case "$prefix" in
3958 '') ;;
3959 *)
3960         case "$ans" in
3961         "$prefix") ;;
3962         *) oldprefix="$prefix";;
3963         esac
3964         ;;
3965 esac
3966 prefix="$ans"
3967 prefixexp="$ansexp"
3968
3969 : allow them to override the AFS root
3970 case "$afsroot" in
3971 '')     afsroot=/afs ;;
3972 *)      afsroot=$afsroot ;;
3973 esac
3974
3975 : is AFS running?
3976 echo " "
3977 case "$afs" in
3978 $define|true)   afs=true ;;
3979 $undef|false)   afs=false ;;
3980 *)      if $test -d $afsroot; then
3981                 afs=true
3982         else
3983                 afs=false
3984         fi
3985         ;;
3986 esac
3987 if $afs; then
3988         echo "AFS may be running... I'll be extra cautious then..." >&4
3989 else
3990         echo "AFS does not seem to be running..." >&4
3991 fi
3992
3993 : determine installation prefix for where package is to be installed.
3994 if $afs; then
3995 $cat <<EOM
3996
3997 Since you are running AFS, I need to distinguish the directory in which
3998 files will reside from the directory in which they are installed (and from
3999 which they are presumably copied to the former directory by occult means).
4000
4001 EOM
4002         case "$installprefix" in
4003         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4004         *) dflt="$installprefix";;
4005         esac
4006 else
4007 $cat <<EOM
4008
4009 In some special cases, particularly when building $package for distribution,
4010 it is convenient to distinguish the directory in which files should be
4011 installed from the directory ($prefix) in which they will
4012 eventually reside.  For most users, these two directories are the same.
4013
4014 EOM
4015         case "$installprefix" in
4016         '') dflt=$prefix ;;
4017         *) dflt=$installprefix;;
4018         esac
4019 fi
4020 fn=d~
4021 rp='What installation prefix should I use for installing files?'
4022 . ./getfile
4023 installprefix="$ans"
4024 installprefixexp="$ansexp"
4025
4026 : Perform the prefixexp/installprefixexp correction if necessary
4027 cat <<EOS >installprefix
4028 $startsh
4029 EOS
4030 cat <<'EOSC' >>installprefix
4031 : Change installation prefix, if necessary.
4032 if $test X"$prefix" != X"$installprefix"; then
4033     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4034 else
4035     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4036 fi
4037 EOSC
4038 chmod +x installprefix
4039 $eunicefix installprefix
4040
4041 : Set variables such as privlib and privlibexp from the output of ./getfile
4042 : performing the prefixexp/installprefixexp correction if necessary.
4043 cat <<EOS >setprefixvar
4044 $startsh
4045 EOS
4046 cat <<'EOSC' >>setprefixvar
4047 eval "${prefixvar}=\"\$ans\""
4048 eval "${prefixvar}exp=\"\$ansexp\""
4049 . ./installprefix
4050 EOSC
4051 chmod +x setprefixvar
4052 $eunicefix setprefixvar
4053
4054 : set up the script used to warn in case of inconsistency
4055 cat <<EOS >whoa
4056 $startsh
4057 EOS
4058 cat <<'EOSC' >>whoa
4059 dflt=y
4060 case "$hint" in
4061     recommended)
4062         case "$hintfile" in
4063         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4064                 ;;
4065         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4066                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4067                 ;;
4068         esac
4069         ;;
4070     *)  echo " "
4071         echo "*** WHOA THERE!!! ***" >&4
4072         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4073         ;;
4074 esac
4075 rp="    Keep the $hint value?"
4076 . ./myread
4077 case "$ans" in
4078 y) td=$was; tu=$was;;
4079 esac
4080 EOSC
4081
4082 : function used to set '$1' to '$val'
4083 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4084 case "$val$was" in
4085 $define$undef) . ./whoa; eval "$var=\$td";;
4086 $undef$define) . ./whoa; eval "$var=\$tu";;
4087 *) eval "$var=$val";;
4088 esac'
4089
4090 : get the patchlevel
4091 echo " "
4092 echo "Getting the current patchlevel..." >&4
4093 if $test -r $rsrc/patchlevel.h;then
4094         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4095         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4096         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4097         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4098         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4099         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4100         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4101 else
4102         revision=0
4103         patchlevel=0
4104         subversion=0
4105         api_revision=0
4106         api_version=0
4107         api_subversion=0
4108         perl_patchlevel=0
4109         $echo "(You do not have patchlevel.h.  Eek.)"
4110 fi
4111 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4112 version_patchlevel_string="version $patchlevel subversion $subversion"
4113 case "$perl_patchlevel" in
4114 0|'') ;;
4115 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4116     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4117     ;;
4118 esac
4119
4120 $echo "(You have $package $version_patchlevel_string.)"
4121
4122 case "$osname" in
4123 dos|vms)
4124         : XXX Should be a Configure test for double-dots in filenames.
4125         version=`echo $revision $patchlevel $subversion | \
4126                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4127         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4128                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4129         ;;
4130 *)
4131         version=`echo $revision $patchlevel $subversion | \
4132                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4133         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4134                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4135         ;;
4136 esac
4137 : Special case the 5.005_xx maintenance series, which used 5.005
4138 : without any subversion label as a subdirectory in $sitelib
4139 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4140         api_versionstring='5.005'
4141 fi
4142
4143 : Do we want threads support and if so, what type
4144 case "$usethreads" in
4145 $define|true|[yY]*)     dflt='y';;
4146 *)     # Catch case where user specified ithreads or 5005threads but
4147        # forgot -Dusethreads (A.D. 4/2002)
4148        case "$useithreads$use5005threads" in
4149        *$define*)       dflt='y';;
4150        *)               dflt='n';;
4151        esac
4152        ;;
4153 esac
4154 cat <<EOM
4155
4156 Perl can be built to offer a form of threading support on some systems
4157 To do so, Configure can be run with -Dusethreads.
4158
4159 Note that Perl built with threading support runs slightly slower
4160 and uses slightly more memory than plain Perl.
4161
4162 If this doesn't make any sense to you, just accept the default '$dflt'.
4163 EOM
4164 rp='Build a threading Perl?'
4165 . ./myread
4166 case "$ans" in
4167 y|Y)    val="$define" ;;
4168 *)      val="$undef" ;;
4169 esac
4170 set usethreads
4171 eval $setvar
4172
4173 if $test $patchlevel -lt 9; then
4174     case "$usethreads" in
4175     $define)
4176         : Default to ithreads unless overridden on command line or with
4177         : old config.sh
4178         dflt='y'
4179         case "$use5005threads" in
4180                 $define|true|[yY]*)
4181                         echo "5.005 threads are no longer supported"
4182                         exit 1
4183                 ;;
4184         esac
4185         case "$useithreads" in
4186                 $undef|false|[nN]*) dflt='n';;
4187         esac
4188         rp='Use the newer interpreter-based ithreads?'
4189         . ./myread
4190         case "$ans" in
4191         y|Y)    val="$define" ;;
4192         *)      val="$undef" ;;
4193         esac
4194         set useithreads
4195         eval $setvar
4196         : Now set use5005threads to the opposite value.
4197         case "$useithreads" in
4198         $define) val="$undef" ;;
4199         *) val="$define" ;;
4200         esac
4201         set use5005threads
4202         eval $setvar
4203         ;;
4204     *)
4205         useithreads="$undef"
4206         use5005threads="$undef"
4207         ;;
4208     esac
4209
4210     case "$useithreads$use5005threads" in
4211     "$define$define")
4212         $cat >&4 <<EOM
4213
4214 You cannot have both the ithreads and the 5.005 threads enabled
4215 at the same time.  Disabling the 5.005 threads since they are
4216 much less stable than the ithreads.
4217
4218 EOM
4219         use5005threads="$undef"
4220         ;;
4221     esac
4222
4223 else
4224 : perl-5.9.x and later
4225
4226     if test X"$usethreads" = "X$define"; then
4227         case "$use5005threads" in
4228             $define|true|[yY]*)
4229                 $cat >&4 <<EOM
4230
4231 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4232
4233 EOM
4234             ;;
4235         esac
4236     fi
4237
4238     use5005threads="$undef"
4239     useithreads="$usethreads"
4240 fi
4241
4242 case "$d_oldpthreads" in
4243 '')     : Configure tests would be welcome here.  For now, assume undef.
4244         val="$undef" ;;
4245 *)      val="$d_oldpthreads" ;;
4246 esac
4247 set d_oldpthreads
4248 eval $setvar
4249
4250
4251 : Look for a hint-file generated 'call-back-unit'.  If the
4252 : user has specified that a threading perl is to be built,
4253 : we may need to set or change some other defaults.
4254 if $test -f usethreads.cbu; then
4255     echo "Your platform has some specific hints regarding threaded builds, using them..."
4256     . ./usethreads.cbu
4257 else
4258     case "$usethreads" in
4259         "$define"|true|[yY]*)
4260                 $cat <<EOM
4261 (Your platform does not have any specific hints for threaded builds.
4262  Assuming POSIX threads, then.)
4263 EOM
4264         ;;
4265     esac
4266 fi
4267
4268 : Check if multiplicity is required
4269 cat <<EOM
4270
4271 Perl can be built so that multiple Perl interpreters can coexist
4272 within the same Perl executable.
4273 EOM
4274
4275 case "$useithreads" in
4276 $define)
4277         cat <<EOM
4278 This multiple interpreter support is required for interpreter-based threads.
4279 EOM
4280         val="$define"
4281         ;;
4282 *)      case "$usemultiplicity" in
4283         $define|true|[yY]*)     dflt='y';;
4284         *) dflt='n';;
4285         esac
4286         echo " "
4287         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4288         rp='Build Perl for multiplicity?'
4289         . ./myread
4290         case "$ans" in
4291         y|Y)    val="$define" ;;
4292         *)      val="$undef" ;;
4293         esac
4294         ;;
4295 esac
4296 set usemultiplicity
4297 eval $setvar
4298
4299 : Check if morebits is requested
4300 case "$usemorebits" in
4301 "$define"|true|[yY]*)
4302         use64bitint="$define"
4303         uselongdouble="$define"
4304         usemorebits="$define"
4305         ;;
4306 *)      usemorebits="$undef"
4307         ;;
4308 esac
4309
4310 : Determine the C compiler to be used
4311 echo " "
4312 case "$cc" in
4313 '') dflt=cc;;
4314 *) dflt="$cc";;
4315 esac
4316 rp="Use which C compiler?"
4317 . ./myread
4318 cc="$ans"
4319
4320 : See whether they have no cc but they do have gcc
4321 . ./trygcc
4322 if $test -f cc.cbu; then
4323     . ./cc.cbu
4324 fi
4325 . ./checkcc
4326
4327 : make some quick guesses about what we are up against
4328 echo " "
4329 $echo $n "Hmm...  $c"
4330 echo exit 1 >bsd
4331 echo exit 1 >usg
4332 echo exit 1 >v7
4333 echo exit 1 >osf1
4334 echo exit 1 >eunice
4335 echo exit 1 >xenix
4336 echo exit 1 >venix
4337 echo exit 1 >os2
4338 d_bsd="$undef"
4339 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4340 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4341 then
4342         echo "Looks kind of like an OSF/1 system, but we'll see..."
4343         echo exit 0 >osf1
4344 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4345         xxx=`./loc addbib blurfl $pth`
4346         if $test -f $xxx; then
4347         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4348                 echo exit 0 >bsd
4349                 echo exit 0 >usg
4350         else
4351                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4352                         echo "Looks kind of like an extended USG system, but we'll see..."
4353                 else
4354                         echo "Looks kind of like a USG system, but we'll see..."
4355                 fi
4356                 echo exit 0 >usg
4357         fi
4358 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4359         echo "Looks kind of like a BSD system, but we'll see..."
4360         d_bsd="$define"
4361         echo exit 0 >bsd
4362 else
4363         echo "Looks kind of like a Version 7 system, but we'll see..."
4364         echo exit 0 >v7
4365 fi
4366 case "$eunicefix" in
4367 *unixtovms*)
4368         $cat <<'EOI'
4369 There is, however, a strange, musty smell in the air that reminds me of
4370 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4371 EOI
4372         echo exit 0 >eunice
4373         d_eunice="$define"
4374 : it so happens the Eunice I know will not run shell scripts in Unix format
4375         ;;
4376 *)
4377         echo " "
4378         echo "Congratulations.  You aren't running Eunice."
4379         d_eunice="$undef"
4380         ;;
4381 esac
4382 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4383 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4384 : semicolon as a patch separator
4385 case "$p_" in
4386 :) ;;
4387 *)
4388         $cat <<'EOI'
4389 I have the feeling something is not exactly right, however...don't tell me...
4390 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4391 (Or you may be running DOS with DJGPP.)
4392 EOI
4393         echo exit 0 >os2
4394         ;;
4395 esac
4396 if test -f /xenix; then
4397         echo "Actually, this looks more like a XENIX system..."
4398         echo exit 0 >xenix
4399         d_xenix="$define"
4400 else
4401         echo " "
4402         echo "It's not Xenix..."
4403         d_xenix="$undef"
4404 fi
4405 chmod +x xenix
4406 $eunicefix xenix
4407 if test -f /venix; then
4408         echo "Actually, this looks more like a VENIX system..."
4409         echo exit 0 >venix
4410 else
4411         echo " "
4412         if ./xenix; then
4413                 : null
4414         else
4415                 echo "Nor is it Venix..."
4416         fi
4417 fi
4418 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4419 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4420 $rm -f foo
4421
4422 : Check if we are using GNU gcc and what its version is
4423 echo " "
4424 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4425 $cat >try.c <<EOM
4426 #include <stdio.h>
4427 int main() {
4428 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4429 #ifdef __VERSION__
4430         printf("%s\n", __VERSION__);
4431 #else
4432         printf("%s\n", "1");
4433 #endif
4434 #endif
4435         return(0);
4436 }
4437 EOM
4438 if $cc -o try $ccflags $ldflags try.c; then
4439         gccversion=`$run ./try`
4440         case "$gccversion" in
4441         '') echo "You are not using GNU cc." ;;
4442         *)  echo "You are using GNU cc $gccversion."
4443             ccname=gcc
4444             ;;
4445         esac
4446 else
4447         echo " "
4448         echo "*** WHOA THERE!!! ***" >&4
4449         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4450         case "$knowitall" in
4451         '')
4452         echo "    You'd better start hunting for one and let me know about it." >&4
4453                 exit 1
4454                 ;;
4455         esac
4456 fi
4457 $rm -f try try.*
4458 case "$gccversion" in
4459 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4460 esac
4461 case "$gccversion" in
4462 '') gccosandvers='' ;;
4463 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4464    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4465    gccshortvers=''
4466    case "$gccosandvers" in
4467    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4468    $osname$osvers) ;; # looking good
4469    $osname*) cat <<EOM >&4
4470
4471 *** WHOA THERE!!! ***
4472
4473     Your gcc has not been compiled for the exact release of
4474     your operating system ($gccosandvers versus $osname$osvers).
4475
4476     In general it is a good idea to keep gcc synchronized with
4477     the operating system because otherwise serious problems
4478     may ensue when trying to compile software, like Perl.
4479
4480     I'm trying to be optimistic here, though, and will continue.
4481     If later during the configuration and build icky compilation
4482     problems appear (headerfile conflicts being the most common
4483     manifestation), I suggest reinstalling the gcc to match
4484     your operating system release.
4485
4486 EOM
4487       ;;
4488    *) gccosandvers='' ;; # failed to parse, better be silent
4489    esac
4490    ;;
4491 esac
4492 case "$ccname" in
4493 '') ccname="$cc" ;;
4494 esac
4495
4496 # gcc 3.* complain about adding -Idirectories that they already know about,
4497 # so we will take those off from locincpth.
4498 case "$gccversion" in
4499 3*)
4500     echo "main(){}">try.c
4501     for incdir in $locincpth; do
4502        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4503              grep '^c[cp]p*[01]: warning: changing search order '`
4504        if test "X$warn" != X; then
4505            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4506        fi
4507     done
4508     $rm -f try try.*
4509 esac
4510
4511 : What should the include directory be ?
4512 echo " "
4513 $echo $n "Hmm...  $c"
4514 dflt='/usr/include'
4515 incpath=''
4516 mips_type=''
4517 if $test -f /bin/mips && /bin/mips; then
4518         echo "Looks like a MIPS system..."
4519         $cat >usr.c <<'EOCP'
4520 #ifdef SYSTYPE_BSD43
4521 /bsd43
4522 #endif
4523 EOCP
4524         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4525                 dflt='/bsd43/usr/include'
4526                 incpath='/bsd43'
4527                 mips_type='BSD 4.3'
4528         else
4529                 mips_type='System V'
4530         fi
4531         $rm -f usr.c usr.out
4532         echo "and you're compiling with the $mips_type compiler and libraries."
4533         xxx_prompt=y
4534         echo "exit 0" >mips
4535 else
4536         echo "Doesn't look like a MIPS system."
4537         xxx_prompt=n
4538         echo "exit 1" >mips
4539 fi
4540 chmod +x mips
4541 $eunicefix mips
4542 case "$usrinc" in
4543 '') ;;
4544 *) dflt="$usrinc";;
4545 esac
4546 case "$xxx_prompt" in
4547 y)      fn=d/
4548         echo " "
4549         rp='Where are the include files you want to use?'
4550         . ./getfile
4551         usrinc="$ans"
4552         ;;
4553 *)      usrinc="$dflt"
4554         ;;
4555 esac
4556
4557 : see how we invoke the C preprocessor
4558 echo " "
4559 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4560 cat <<'EOT' >testcpp.c
4561 #define ABC abc
4562 #define XYZ xyz
4563 ABC.XYZ
4564 EOT
4565 cd ..
4566 if test ! -f cppstdin; then
4567         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4568                 # AIX cc -E doesn't show the absolute headerfile
4569                 # locations but we'll cheat by using the -M flag.
4570                 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
4571         else
4572                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4573         fi
4574 else
4575         echo "Keeping your $hint cppstdin wrapper."
4576 fi
4577 chmod 755 cppstdin
4578 wrapper=`pwd`/cppstdin
4579 ok='false'
4580 cd UU
4581
4582 if $test "X$cppstdin" != "X" && \
4583         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4584         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4585 then
4586         echo "You used to use $cppstdin $cppminus so we'll use that again."
4587         case "$cpprun" in
4588         '') echo "But let's see if we can live without a wrapper..." ;;
4589         *)
4590                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4591                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4592                 then
4593                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4594                         ok='true'
4595                 else
4596                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4597                 fi
4598                 ;;
4599         esac
4600 else
4601         case "$cppstdin" in
4602         '') ;;
4603         *)
4604                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4605                 ;;
4606         esac
4607 fi
4608
4609 if $ok; then
4610         : nothing
4611 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4612         $cc -E <testcpp.c >testcpp.out 2>&1; \
4613         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4614         echo "Yup, it does."
4615         x_cpp="$cc -E"
4616         x_minus='';
4617 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4618         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4619         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4620         echo "Yup, it does."
4621         x_cpp="$cc -E"
4622         x_minus='-';
4623 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4624         $cc -P <testcpp.c >testcpp.out 2>&1; \
4625         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4626         echo "Yipee, that works!"
4627         x_cpp="$cc -P"
4628         x_minus='';
4629 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4630         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4631         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4632         echo "At long last!"
4633         x_cpp="$cc -P"
4634         x_minus='-';
4635 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4636         $cpp <testcpp.c >testcpp.out 2>&1; \
4637         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4638         echo "It works!"
4639         x_cpp="$cpp"
4640         x_minus='';
4641 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4642         $cpp - <testcpp.c >testcpp.out 2>&1; \
4643         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4644         echo "Hooray, it works!  I was beginning to wonder."
4645         x_cpp="$cpp"
4646         x_minus='-';
4647 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4648         $wrapper <testcpp.c >testcpp.out 2>&1; \
4649         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4650         x_cpp="$wrapper"
4651         x_minus=''
4652         echo "Eureka!"
4653 else
4654         dflt=''
4655         rp="No dice.  I can't find a C preprocessor.  Name one:"
4656         . ./myread
4657         x_cpp="$ans"
4658         x_minus=''
4659         $x_cpp <testcpp.c >testcpp.out 2>&1
4660         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4661                 echo "OK, that will do." >&4
4662         else
4663 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4664                 exit 1
4665         fi
4666 fi
4667
4668 case "$ok" in
4669 false)
4670         cppstdin="$x_cpp"
4671         cppminus="$x_minus"
4672         cpprun="$x_cpp"
4673         cpplast="$x_minus"
4674         set X $x_cpp
4675         shift
4676         case "$1" in
4677         "$cpp")
4678                 echo "Perhaps can we force $cc -E using a wrapper..."
4679                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4680                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4681                 then
4682                         echo "Yup, we can."
4683                         cppstdin="$wrapper"
4684                         cppminus='';
4685                 else
4686                         echo "Nope, we'll have to live without it..."
4687                 fi
4688                 ;;
4689         esac
4690         case "$cpprun" in
4691         "$wrapper")
4692                 cpprun=''
4693                 cpplast=''
4694                 ;;
4695         esac
4696         ;;
4697 esac
4698
4699 case "$cppstdin" in
4700 "$wrapper"|'cppstdin') ;;
4701 *) $rm -f $wrapper;;
4702 esac
4703 $rm -f testcpp.c testcpp.out
4704
4705 : Set private lib path
4706 case "$plibpth" in
4707 '') if ./mips; then
4708                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4709         fi;;
4710 esac
4711 case "$libpth" in
4712 ' ') dlist='';;
4713 '') dlist="$loclibpth $plibpth $glibpth";;
4714 *) dlist="$libpth";;
4715 esac
4716
4717 : Now check and see which directories actually exist, avoiding duplicates
4718 libpth=''
4719 for xxx in $dlist
4720 do
4721     if $test -d $xxx; then
4722                 case " $libpth " in
4723                 *" $xxx "*) ;;
4724                 *) libpth="$libpth $xxx";;
4725                 esac
4726     fi
4727 done
4728 $cat <<'EOM'
4729
4730 Some systems have incompatible or broken versions of libraries.  Among
4731 the directories listed in the question below, please remove any you
4732 know not to be holding relevant libraries, and add any that are needed.
4733 Say "none" for none.
4734
4735 EOM
4736 case "$libpth" in
4737 '') dflt='none';;
4738 *)
4739         set X $libpth
4740         shift
4741         dflt=${1+"$@"}
4742         ;;
4743 esac
4744 rp="Directories to use for library searches?"
4745 . ./myread
4746 case "$ans" in
4747 none) libpth=' ';;
4748 *) libpth="$ans";;
4749 esac
4750
4751 : compute shared library extension
4752 case "$so" in
4753 '')
4754         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4755                 dflt='sl'
4756         else
4757                 dflt='so'
4758         fi
4759         ;;
4760 *) dflt="$so";;
4761 esac
4762 $cat <<EOM
4763
4764 On some systems, shared libraries may be available.  Answer 'none' if
4765 you want to suppress searching of shared libraries for the remainder
4766 of this configuration.
4767
4768 EOM
4769 rp='What is the file extension used for shared libraries?'
4770 . ./myread
4771 so="$ans"
4772
4773 : Does target system insist that shared library basenames are unique
4774 $cat << EOM
4775
4776 Some dynamic loaders assume that the *basename* of shared
4777 library filenames are globally unique.
4778 We'll default this to undef as we assume your system is not this
4779 weird. Set to defined if you're on one of them.
4780
4781 EOM
4782
4783 dflt='n'
4784 rp='Make shared library basenames unique?'
4785 . ./myread
4786 case "$ans" in
4787 y|Y)    val="$define" ;;
4788 *)      val="$undef"  ;;
4789 esac
4790 set d_libname_unique
4791 eval $setvar
4792
4793 : Define several unixisms.
4794 : Hints files or command line option can be used to override them.
4795 : The convoluted testing is in case hints files set either the old
4796 : or the new name.
4797 case "$_exe" in
4798 '')     case "$exe_ext" in
4799         '')     ;;
4800         *)      _exe="$exe_ext" ;;
4801         esac
4802         ;;
4803 esac
4804 case "$_a" in
4805 '')     case "$lib_ext" in
4806     '') _a='.a';;
4807         *)      _a="$lib_ext" ;;
4808         esac
4809         ;;
4810 esac
4811 case "$_o" in
4812 '') case "$obj_ext" in
4813         '')     _o='.o';;
4814         *)      _o="$obj_ext";;
4815         esac
4816         ;;
4817 esac
4818 case "$p_" in
4819 '') case "$path_sep" in
4820         '')     p_=':';;
4821         *)      p_="$path_sep";;
4822         esac
4823         ;;
4824 esac
4825 exe_ext=$_exe
4826 lib_ext=$_a
4827 obj_ext=$_o
4828 path_sep=$p_
4829
4830 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4831
4832 : Which makefile gets called first.  This is used by make depend.
4833 case "$firstmakefile" in
4834 '') firstmakefile='makefile';;
4835 esac
4836
4837 : Check is we will use socks
4838 case "$usesocks" in
4839 $define|true|[yY]*)     dflt='y';;
4840 *) dflt='n';;
4841 esac
4842 cat <<EOM
4843
4844 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4845 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4846 to use the PerlIO abstraction layer, this will be implicitly selected.
4847
4848 If this doesn't make any sense to you, just accept the default '$dflt'.
4849 EOM
4850 rp='Build Perl for SOCKS?'
4851 . ./myread
4852 case "$ans" in
4853 y|Y)    val="$define" ;;
4854 *)      val="$undef" ;;
4855 esac
4856 set usesocks
4857 eval $setvar
4858
4859 : Check for uselongdouble support
4860 case "$ccflags" in
4861 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4862 esac
4863
4864 case "$uselongdouble" in
4865 $define|true|[yY]*)     dflt='y';;
4866 *) dflt='n';;
4867 esac
4868 cat <<EOM
4869
4870 Perl can be built to take advantage of long doubles which
4871 (if available) may give more accuracy and range for floating point numbers.
4872
4873 If this doesn't make any sense to you, just accept the default '$dflt'.
4874 EOM
4875 rp='Try to use long doubles if available?'
4876 . ./myread
4877 case "$ans" in
4878 y|Y)    val="$define"   ;;
4879 *)      val="$undef"    ;;
4880 esac
4881 set uselongdouble
4882 eval $setvar
4883
4884 case "$uselongdouble" in
4885 true|[yY]*) uselongdouble="$define" ;;
4886 esac
4887
4888 : Look for a hint-file generated 'call-back-unit'.  If the
4889 : user has specified that long doubles should be used,
4890 : we may need to set or change some other defaults.
4891 if $test -f uselongdouble.cbu; then
4892     echo "Your platform has some specific hints regarding long doubles, using them..."
4893     . ./uselongdouble.cbu
4894 else
4895     case "$uselongdouble" in
4896         $define)
4897                 $cat <<EOM
4898 (Your platform does not have any specific hints for long doubles.)
4899 EOM
4900         ;;
4901     esac
4902 fi
4903
4904 : Looking for optional libraries
4905 echo " "
4906 echo "Checking for optional libraries..." >&4
4907 case "$libs" in
4908 ' '|'') dflt='';;
4909 *) dflt="$libs";;
4910 esac
4911 case "$libswanted" in
4912 '') libswanted='c_s';;
4913 esac
4914 case "$usesocks" in
4915 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4916 esac
4917 libsfound=''
4918 libsfiles=''
4919 libsdirs=''
4920 libspath=''
4921 for thisdir in $libpth $xlibpth; do
4922   test -d $thisdir && libspath="$libspath $thisdir"
4923 done
4924 for thislib in $libswanted; do
4925         for thisdir in $libspath; do
4926             xxx=''
4927             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4928                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4929                 $test -f "$xxx" && eval $libscheck
4930                 $test -f "$xxx" && libstyle=shared
4931             fi
4932             if test ! -f "$xxx"; then
4933                 xxx=$thisdir/lib$thislib.$so
4934                 $test -f "$xxx" && eval $libscheck
4935                 $test -f "$xxx" && libstyle=shared
4936             fi
4937             if test ! -f "$xxx"; then
4938                 xxx=$thisdir/lib$thislib$_a
4939                 $test -f "$xxx" && eval $libscheck
4940                 $test -f "$xxx" && libstyle=static
4941             fi
4942             if test ! -f "$xxx"; then
4943                 xxx=$thisdir/$thislib$_a
4944                 $test -f "$xxx" && eval $libscheck
4945                 $test -f "$xxx" && libstyle=static
4946             fi
4947             if test ! -f "$xxx"; then
4948                 xxx=$thisdir/lib${thislib}_s$_a
4949                 $test -f "$xxx" && eval $libscheck
4950                 $test -f "$xxx" && libstyle=static
4951                 $test -f "$xxx" && thislib=${thislib}_s
4952             fi
4953             if test ! -f "$xxx"; then
4954                 xxx=$thisdir/Slib$thislib$_a
4955                 $test -f "$xxx" && eval $libscheck
4956                 $test -f "$xxx" && libstyle=static
4957             fi
4958             if $test -f "$xxx"; then
4959                 case "$libstyle" in
4960                 shared) echo "Found -l$thislib (shared)." ;;
4961                 static) echo "Found -l$thislib." ;;
4962                 *)      echo "Found -l$thislib ($libstyle)." ;;
4963                 esac
4964                 case " $dflt " in
4965                 *"-l$thislib "*);;
4966                 *) dflt="$dflt -l$thislib"
4967                    libsfound="$libsfound $xxx"
4968                    yyy=`basename $xxx`
4969                    libsfiles="$libsfiles $yyy"
4970                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4971                    case " $libsdirs " in
4972                    *" $yyy "*) ;;
4973                    *) libsdirs="$libsdirs $yyy" ;;
4974                    esac
4975                    ;;
4976                 esac
4977                 break
4978             fi
4979         done
4980         if $test ! -f "$xxx"; then
4981             echo "No -l$thislib."
4982         fi
4983 done
4984 set X $dflt
4985 shift
4986 dflt="$*"
4987 case "$libs" in
4988 '') dflt="$dflt";;
4989 *) dflt="$libs";;
4990 esac
4991 case "$dflt" in
4992 ' '|'') dflt='none';;
4993 esac
4994
4995 $cat <<EOM
4996
4997 In order to compile $package on your machine, a number of libraries
4998 are usually needed.  Include any other special libraries here as well.
4999 Say "none" for none.  The default list is almost always right.
5000 EOM
5001
5002 echo " "
5003 rp="What libraries to use?"
5004 . ./myread
5005 case "$ans" in
5006 none) libs=' ';;
5007 *) libs="$ans";;
5008 esac
5009
5010 : determine optimization, if desired, or use for debug flag also
5011 case "$optimize" in
5012 ' '|$undef) dflt='none';;
5013 '') dflt='-O';;
5014 *) dflt="$optimize";;
5015 esac
5016 $cat <<EOH
5017
5018 By default, $package compiles with the -O flag to use the optimizer.
5019 Alternately, you might want to use the symbolic debugger, which uses
5020 the -g flag (on traditional Unix systems).  Either flag can be
5021 specified here.  To use neither flag, specify the word "none".
5022
5023 EOH
5024 rp="What optimizer/debugger flag should be used?"
5025 . ./myread
5026 optimize="$ans"
5027 case "$optimize" in
5028 'none') optimize=" ";;
5029 esac
5030
5031 : Check what DEBUGGING is required from the command line
5032 : -DEBUGGING      or -DDEBUGGING or
5033 : -DEBUGGING=both                       = -g + -DDEBUGGING
5034 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5035 : -DEBUGGING=none or -UDEBUGGING        =
5036 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5037 case "$EBUGGING" in
5038 '')     ;;
5039 *)      DEBUGGING=$EBUGGING ;;
5040 esac
5041
5042 case "$DEBUGGING" in
5043 -g|both|$define)
5044     case "$optimize" in
5045         *-g*) ;;
5046         *)    optimize="$optimize -g" ;;
5047     esac ;;
5048 none|$undef)
5049     case "$optimize" in
5050         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5051                 shift
5052                 optimize="$*"
5053                 ;;
5054     esac ;;
5055 esac
5056
5057 dflt=''
5058 case "$DEBUGGING" in
5059 both|$define) dflt='-DDEBUGGING'
5060 esac
5061
5062 : argument order is deliberate, as the flag will start with - which set could
5063 : think is an option
5064 checkccflag='check=$1; flag=$2; callback=$3;
5065 echo " ";
5066 echo "Checking if your compiler accepts $flag" 2>&1;
5067 echo "int main(void) { return 0; }" > gcctest.c;
5068 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5069     echo "Yes, it does." 2>&1;
5070     if $test -s gcctest.out ; then
5071         echo "But your platform does not like it:";
5072         cat gcctest.out;
5073     else
5074         case "$ccflags" in
5075         *$check*)
5076             echo "Leaving current flags $ccflags alone." 2>&1
5077             ;;
5078         *) dflt="$dflt $flag";
5079             eval $callback
5080             ;;
5081         esac
5082     fi
5083 else
5084     echo "Nope, it does not, but that is ok." 2>&1;
5085 fi
5086 '
5087
5088 : We will not override a previous value, but we might want to
5089 : augment a hint file
5090 case "$hint" in
5091 default|recommended)
5092         case "$gccversion" in
5093         1*) dflt="$dflt -fpcc-struct-return" ;;
5094         esac
5095         case "$optimize:$DEBUGGING" in
5096         *-g*:old) dflt="$dflt -DDEBUGGING";;
5097         esac
5098         case "$gccversion" in
5099         2*) if $test -d /etc/conf/kconfig.d &&
5100                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5101                 then
5102                         # Interactive Systems (ISC) POSIX mode.
5103                         dflt="$dflt -posix"
5104                 fi
5105                 ;;
5106         esac
5107         case "$gccversion" in
5108         1*) ;;
5109         2.[0-8]*) ;;
5110         ?*)     set strict-aliasing -fno-strict-aliasing
5111                 eval $checkccflag
5112                 ;;
5113         esac
5114         # For gcc, adding -pipe speeds up compilations for some, but apparently
5115         # some assemblers can't read from stdin.  (It also slows down compilations
5116         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5117         case "$gccversion" in
5118         ?*)     set pipe -pipe
5119                 eval $checkccflag
5120                 ;;
5121         esac
5122
5123         # on x86_64 (at least) we require an extra library (libssp) in the
5124         # link command line. This library is not named, so I infer that it is
5125         # an implementation detail that may change. Hence the safest approach
5126         # is to add the flag to the flags passed to the compiler at link time,
5127         # as that way the compiler can do the right implementation dependant
5128         # thing. (NWC)
5129         case "$gccversion" in
5130         ?*)     set stack-protector -fstack-protector
5131                 eval $checkccflag
5132                 ;;
5133         esac
5134         ;;
5135 esac
5136
5137 case "$mips_type" in
5138 *BSD*|'') inclwanted="$locincpth $usrinc";;
5139 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5140 esac
5141 for thisincl in $inclwanted; do
5142         if $test -d $thisincl; then
5143                 if $test x$thisincl != x$usrinc; then
5144                         case "$dflt" in
5145                         *" -I$thisincl "*);;
5146                         *) dflt="$dflt -I$thisincl ";;
5147                         esac
5148                 fi
5149         fi
5150 done
5151
5152 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5153         xxx=true;
5154 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5155         xxx=true;
5156 else
5157         xxx=false;
5158 fi;
5159 if $xxx; then
5160         case "$dflt" in
5161         *$2*);;
5162         *) dflt="$dflt -D$2";;
5163         esac;
5164 fi'
5165
5166 set signal.h LANGUAGE_C; eval $inctest
5167
5168 case "$usesocks" in
5169 $define)
5170         ccflags="$ccflags -DSOCKS"
5171         ;;
5172 esac
5173
5174 case "$hint" in
5175 default|recommended) dflt="$ccflags $dflt" ;;
5176 *) dflt="$ccflags";;
5177 esac
5178
5179 case "$dflt" in
5180 ''|' ') dflt=none;;
5181 esac
5182
5183 $cat <<EOH
5184
5185 Your C compiler may want other flags.  For this question you should include
5186 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5187 but you should NOT include libraries or ld flags like -lwhatever.  If you
5188 want $package to honor its debug switch, you should include -DDEBUGGING here.
5189 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5190
5191 To use no flags, specify the word "none".
5192
5193 EOH
5194 set X $dflt
5195 shift
5196 dflt=${1+"$@"}
5197 rp="Any additional cc flags?"
5198 . ./myread
5199 case "$ans" in
5200 none) ccflags='';;
5201 *) ccflags="$ans";;
5202 esac
5203
5204 : the following weeds options from ccflags that are of no interest to cpp
5205 case "$cppflags" in
5206 '') cppflags="$ccflags" ;;
5207 *)  cppflags="$cppflags $ccflags" ;;
5208 esac
5209 case "$gccversion" in
5210 1*) cppflags="$cppflags -D__GNUC__"
5211 esac
5212 case "$mips_type" in
5213 '');;
5214 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5215 esac
5216 case "$cppflags" in
5217 '');;
5218 *)
5219         echo " "
5220         echo "Let me guess what the preprocessor flags are..." >&4
5221         set X $cppflags
5222         shift
5223         cppflags=''
5224         $cat >cpp.c <<'EOM'
5225 #define BLURFL foo
5226
5227 BLURFL xx LFRULB
5228 EOM
5229         previous=''
5230         for flag in $*
5231         do
5232                 case "$flag" in
5233                 -*) ftry="$flag";;
5234                 *) ftry="$previous $flag";;
5235                 esac
5236                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5237                         >cpp1.out 2>/dev/null && \
5238                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5239                         >cpp2.out 2>/dev/null && \
5240                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5241                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5242                 then
5243                         cppflags="$cppflags $ftry"
5244                         previous=''
5245                 else
5246                         previous="$flag"
5247                 fi
5248         done
5249         set X $cppflags
5250         shift
5251         cppflags=${1+"$@"}
5252         case "$cppflags" in
5253         *-*)  echo "They appear to be: $cppflags";;
5254         esac
5255         $rm -f cpp.c cpp?.out
5256         ;;
5257 esac
5258
5259 : flags used in final linking phase
5260 case "$ldflags" in
5261 '') if ./venix; then
5262                 dflt='-i -z'
5263         else
5264                 dflt=''
5265         fi
5266         case "$ccflags" in
5267         *-posix*) dflt="$dflt -posix" ;;
5268         esac
5269         ;;
5270 *) dflt="$ldflags";;
5271 esac
5272 # See note above about -fstack-protector
5273 case "$ccflags" in
5274 *-fstack-protector*)
5275         case "$dflt" in
5276         *-fstack-protector*) ;; # Don't add it again
5277         *) dflt="$dflt -fstack-protector" ;;
5278         esac
5279         ;;
5280 esac
5281
5282 : Try to guess additional flags to pick up local libraries.
5283 for thislibdir in $libpth; do
5284         case " $loclibpth " in
5285         *" $thislibdir "*)
5286                 case "$dflt " in
5287                 *"-L$thislibdir "*) ;;
5288                 *)  dflt="$dflt -L$thislibdir" ;;
5289                 esac
5290                 ;;
5291         esac
5292 done
5293
5294 case "$dflt" in
5295 '') dflt='none' ;;
5296 esac
5297
5298 $cat <<EOH
5299
5300 Your C linker may need flags.  For this question you should
5301 include -L/whatever and any other flags used by the C linker, but you
5302 should NOT include libraries like -lwhatever.
5303
5304 Make sure you include the appropriate -L/path flags if your C linker
5305 does not normally search all of the directories you specified above,
5306 namely
5307         $libpth
5308 To use no flags, specify the word "none".
5309
5310 EOH
5311
5312 rp="Any additional ld flags (NOT including libraries)?"
5313 . ./myread
5314 case "$ans" in
5315 none) ldflags='';;
5316 *) ldflags="$ans";;
5317 esac
5318 rmlist="$rmlist pdp11"
5319
5320 : coherency check
5321 echo " "
5322 echo "Checking your choice of C compiler and flags for coherency..." >&4
5323 $cat > try.c <<'EOF'
5324 #include <stdio.h>
5325 int main() { printf("Ok\n"); return(0); }
5326 EOF
5327 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5328 shift
5329 $cat >try.msg <<'EOM'
5330 I've tried to compile and run the following simple program:
5331
5332 EOM
5333 $cat try.c >> try.msg
5334
5335 $cat >> try.msg <<EOM
5336
5337 I used the command:
5338
5339         $*
5340         $run ./try
5341
5342 and I got the following output:
5343
5344 EOM
5345 dflt=y
5346 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5347         if $sh -c "$run ./try " >>try.msg 2>&1; then
5348                 xxx=`$run ./try`
5349                 case "$xxx" in
5350                 "Ok") dflt=n ;;
5351                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5352                 esac
5353         else
5354                 echo "The program compiled OK, but exited with status $?." >>try.msg
5355                 rp="You have a problem.  Shall I abort Configure"
5356                 dflt=y
5357         fi
5358 else
5359         echo "I can't compile the test program." >>try.msg
5360         rp="You have a BIG problem.  Shall I abort Configure"
5361         dflt=y
5362 fi
5363 case "$dflt" in
5364 y)
5365         $cat try.msg >&4
5366         case "$knowitall" in
5367         '')
5368                 echo "(The supplied flags or libraries might be incorrect.)"
5369                 ;;
5370         *) dflt=n;;
5371         esac
5372         echo " "
5373         . ./myread
5374         case "$ans" in
5375         n*|N*) ;;
5376         *)      echo "Ok.  Stopping Configure." >&4
5377                 exit 1
5378                 ;;
5379         esac
5380         ;;
5381 n) echo "OK, that should do.";;
5382 esac
5383 $rm_try gcctest gcctest.out
5384
5385 : define a shorthand compile call
5386 compile='
5387 mc_file=$1;
5388 shift;
5389 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5390 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5391 exit 1;
5392 fi;
5393 esac;
5394 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5395 : define a shorthand compile call for compilations that should be ok.
5396 compile_ok='
5397 mc_file=$1;
5398 shift;
5399 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5400
5401 : determine filename position in cpp output
5402 echo " "
5403 echo "Computing filename position in cpp output for #include directives..." >&4
5404 case "$osname" in
5405 vos) testaccess=-e ;;
5406 *)   testaccess=-r ;;
5407 esac
5408 echo '#include <stdio.h>' > foo.c
5409 $cat >fieldn <<EOF
5410 $startsh
5411 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5412 $grep '^[       ]*#.*stdio\.h' | \
5413 while read cline; do
5414         pos=1
5415         set \$cline
5416         while $test \$# -gt 0; do
5417                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5418                         echo "\$pos"
5419                         exit 0
5420                 fi
5421                 shift
5422                 pos=\`expr \$pos + 1\`
5423         done
5424 done
5425 EOF
5426 chmod +x fieldn
5427 fieldn=`./fieldn`
5428 $rm -f foo.c fieldn
5429 case $fieldn in
5430 '') pos='???';;
5431 1) pos=first;;
5432 2) pos=second;;
5433 3) pos=third;;
5434 *) pos="${fieldn}th";;
5435 esac
5436 echo "Your cpp writes the filename in the $pos field of the line."
5437
5438 case "$osname" in
5439 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5440 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5441 *)   cppfilter='' ;;
5442 esac
5443 : locate header file
5444 $cat >findhdr <<EOF
5445 $startsh
5446 wanted=\$1
5447 name=''
5448 for usrincdir in $usrinc
5449 do
5450         if test -f \$usrincdir/\$wanted; then
5451                 echo "\$usrincdir/\$wanted"
5452                 exit 0
5453         fi
5454 done
5455 awkprg='{ print \$$fieldn }'
5456 echo "#include <\$wanted>" > foo\$\$.c
5457 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5458 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5459 while read cline; do
5460         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5461         case "\$name" in
5462         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5463         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5464         *) exit 2;;
5465         esac;
5466 done;
5467 #
5468 # status = 0: grep returned 0 lines, case statement not executed
5469 # status = 1: headerfile found
5470 # status = 2: while loop executed, no headerfile found
5471 #
5472 status=\$?
5473 $rm -f foo\$\$.c;
5474 if test \$status -eq 1; then
5475         exit 0;
5476 fi
5477 exit 1
5478 EOF
5479 chmod +x findhdr
5480
5481 : define an alternate in-header-list? function
5482 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5483 cont=true; xxf="echo \"<\$1> found.\" >&4";
5484 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5485 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5486 esac;
5487 case $# in 4) instead=instead;; *) instead="at last";; esac;
5488 while $test "$cont"; do
5489         xxx=`./findhdr $1`
5490         var=$2; eval "was=\$$2";
5491         if $test "$xxx" && $test -r "$xxx";
5492         then eval $xxf;
5493         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5494                 cont="";
5495         else eval $xxnf;
5496         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5497         set $yyy; shift; shift; yyy=$@;
5498         case $# in 0) cont="";;
5499         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5500                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5501         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5502                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5503         esac;
5504 done;
5505 while $test "$yyy";
5506 do set $yyy; var=$2; eval "was=\$$2";
5507         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5508         set $yyy; shift; shift; yyy=$@;
5509 done'
5510
5511 : see if stdlib is available
5512 set stdlib.h i_stdlib
5513 eval $inhdr
5514
5515 : check for lengths of integral types
5516 echo " "
5517 case "$intsize" in
5518 '')
5519         echo "Checking to see how big your integers are..." >&4
5520         $cat >try.c <<EOCP
5521 #include <stdio.h>
5522 #$i_stdlib I_STDLIB
5523 #ifdef I_STDLIB
5524 #include <stdlib.h>
5525 #endif
5526 int main()
5527 {
5528         printf("intsize=%d;\n", (int)sizeof(int));
5529         printf("longsize=%d;\n", (int)sizeof(long));
5530         printf("shortsize=%d;\n", (int)sizeof(short));
5531         exit(0);
5532 }
5533 EOCP
5534         set try
5535         if eval $compile_ok && $run ./try > /dev/null; then
5536                 eval `$run ./try`
5537                 echo "Your integers are $intsize bytes long."
5538                 echo "Your long integers are $longsize bytes long."
5539                 echo "Your short integers are $shortsize bytes long."
5540         else
5541                 $cat >&4 <<EOM
5542 !
5543 Help! I can't compile and run the intsize test program: please enlighten me!
5544 (This is probably a misconfiguration in your system or libraries, and
5545 you really ought to fix it.  Still, I'll try anyway.)
5546 !
5547 EOM
5548                 dflt=4
5549                 rp="What is the size of an integer (in bytes)?"
5550                 . ./myread
5551                 intsize="$ans"
5552                 dflt=$intsize
5553                 rp="What is the size of a long integer (in bytes)?"
5554                 . ./myread
5555                 longsize="$ans"
5556                 dflt=2
5557                 rp="What is the size of a short integer (in bytes)?"
5558                 . ./myread
5559                 shortsize="$ans"
5560         fi
5561         ;;
5562 esac
5563 $rm_try
5564
5565 : check for long long
5566 echo " "
5567 echo "Checking to see if you have long long..." >&4
5568 echo 'int main() { long long x = 7; return 0; }' > try.c
5569 set try
5570 if eval $compile; then
5571         val="$define"
5572         echo "You have long long."
5573 else
5574         val="$undef"
5575         echo "You do not have long long."
5576 fi
5577 $rm_try
5578 set d_longlong
5579 eval $setvar
5580
5581 : check for length of long long
5582 case "${d_longlong}${longlongsize}" in
5583 $define)
5584         echo " "
5585         echo "Checking to see how big your long longs are..." >&4
5586         $cat >try.c <<'EOCP'
5587 #include <stdio.h>
5588 int main()
5589 {
5590     printf("%d\n", (int)sizeof(long long));
5591     return(0);
5592 }
5593 EOCP
5594         set try
5595         if eval $compile_ok; then
5596                 longlongsize=`$run ./try`
5597                 echo "Your long longs are $longlongsize bytes long."
5598         else
5599                 dflt='8'
5600                 echo " "
5601                 echo "(I can't seem to compile the test program.  Guessing...)"
5602                 rp="What is the size of a long long (in bytes)?"
5603                 . ./myread
5604                 longlongsize="$ans"
5605         fi
5606         if $test "X$longsize" = "X$longlongsize"; then
5607                 echo "(That isn't any different from an ordinary long.)"
5608         fi
5609         ;;
5610 esac
5611 $rm_try
5612
5613 : see if inttypes.h is available
5614 : we want a real compile instead of Inhdr because some systems
5615 : have an inttypes.h which includes non-existent headers
5616 echo " "
5617 $cat >try.c <<EOCP
5618 #include <inttypes.h>
5619 int main() {
5620         static int32_t foo32 = 0x12345678;
5621 }
5622 EOCP
5623 set try
5624 if eval $compile; then
5625         echo "<inttypes.h> found." >&4
5626         val="$define"
5627 else
5628         echo "<inttypes.h> NOT found." >&4
5629         val="$undef"
5630 fi
5631 $rm_try
5632 set i_inttypes
5633 eval $setvar
5634
5635 : check for int64_t
5636 echo " "
5637 echo "Checking to see if you have int64_t..." >&4
5638 $cat >try.c <<EOCP
5639 #include <sys/types.h>
5640 #$i_inttypes I_INTTYPES
5641 #ifdef I_INTTYPES
5642 #include <inttypes.h>
5643 #endif
5644 int main() { int64_t x = 7; }
5645 EOCP
5646 set try
5647 if eval $compile; then
5648         val="$define"
5649         echo "You have int64_t."
5650 else
5651         val="$undef"
5652         echo "You do not have int64_t."
5653 fi
5654 $rm_try
5655 set d_int64_t
5656 eval $setvar
5657
5658 : Check if 64bit ints have a quad type
5659 echo " "
5660 echo "Checking which 64-bit integer type we could use..." >&4
5661
5662 case "$intsize" in
5663 8) val=int
5664    set quadtype
5665    eval $setvar
5666    val='"unsigned int"'
5667    set uquadtype
5668    eval $setvar
5669    quadkind=1
5670    ;;
5671 *) case "$longsize" in
5672    8) val=long
5673       set quadtype
5674       eval $setvar
5675       val='"unsigned long"'
5676       set uquadtype
5677       eval $setvar
5678       quadkind=2
5679       ;;
5680    *) case "$d_longlong:$longlongsize" in
5681       define:8)
5682         val='"long long"'
5683         set quadtype
5684         eval $setvar
5685         val='"unsigned long long"'
5686         set uquadtype
5687         eval $setvar
5688         quadkind=3
5689         ;;
5690       *) case "$d_int64_t" in
5691          define)
5692            val=int64_t
5693            set quadtype
5694            eval $setvar
5695            val=uint64_t
5696            set uquadtype
5697            eval $setvar
5698            quadkind=4
5699            ;;
5700          esac
5701          ;;
5702       esac
5703       ;;
5704    esac
5705    ;;
5706 esac
5707
5708 case "$quadtype" in
5709 '')     echo "Alas, no 64-bit integer types in sight." >&4
5710         d_quad="$undef"
5711         ;;
5712 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5713         d_quad="$define"
5714         ;;
5715 esac
5716
5717 : Do we want 64bit support
5718 case "$uselonglong" in
5719 "$define"|true|[yY]*)
5720         cat <<EOM >&4
5721
5722 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5723 EOM
5724         use64bitint="$define"
5725         ;;
5726 esac
5727 case "$use64bits" in
5728 "$define"|true|[yY]*)
5729         cat <<EOM >&4
5730
5731 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5732 EOM
5733         use64bitint="$define"
5734         ;;
5735 esac
5736 case "$use64bitints" in
5737 "$define"|true|[yY]*)
5738         cat <<EOM >&4
5739
5740 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5741 EOM
5742         use64bitint="$define"
5743         ;;
5744 esac
5745 case "$use64bitsint" in
5746 "$define"|true|[yY]*)
5747         cat <<EOM >&4
5748
5749 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5750 EOM
5751         use64bitint="$define"
5752         ;;
5753 esac
5754 case "$uselonglongs" in
5755 "$define"|true|[yY]*)
5756         cat <<EOM >&4
5757
5758 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5759 EOM
5760         use64bitint="$define"
5761         ;;
5762 esac
5763 case "$use64bitsall" in
5764 "$define"|true|[yY]*)
5765         cat <<EOM >&4
5766
5767 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5768 EOM
5769         use64bitall="$define"
5770         ;;
5771 esac
5772
5773 case "$ccflags" in
5774 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5775 esac
5776 case "$use64bitall" in
5777 "$define"|true|[yY]*) use64bitint="$define" ;;
5778 esac
5779
5780 case "$longsize" in
5781 8) cat <<EOM
5782
5783 You have natively 64-bit long integers.
5784 EOM
5785    val="$define"
5786    ;;
5787 *) case "$use64bitint" in
5788    "$define"|true|[yY]*) dflt='y';;
5789    *) dflt='n';;
5790    esac
5791    case "$d_quad" in
5792    "$define") ;;
5793    *) dflt='n' ;;
5794    esac
5795    cat <<EOM
5796
5797 Perl can be built to take advantage of 64-bit integer types
5798 on some systems.  To do so, Configure can be run with -Duse64bitint.
5799 Choosing this option will most probably introduce binary incompatibilities.
5800
5801 If this doesn't make any sense to you, just accept the default '$dflt'.
5802 (The default has been chosen based on your configuration.)
5803 EOM
5804    rp='Try to use 64-bit integers, if available?'
5805    . ./myread
5806    case "$ans" in
5807    [yY]*) val="$define" ;;
5808    *)     val="$undef"  ;;
5809    esac
5810    ;;
5811 esac
5812 set use64bitint
5813 eval $setvar
5814
5815 case "$use64bitall" in
5816 "$define"|true|[yY]*) dflt='y' ;;
5817 *) case "$longsize" in
5818    8) dflt='y' ;;
5819    *) dflt='n' ;;
5820    esac
5821    ;;
5822 esac
5823 cat <<EOM
5824
5825 You may also choose to try maximal 64-bitness.  It means using as much
5826 64-bitness as possible on the platform.  This in turn means even more
5827 binary incompatibilities.  On the other hand, your platform may not
5828 have any more 64-bitness available than what you already have chosen.
5829
5830 If this doesn't make any sense to you, just accept the default '$dflt'.
5831 (The default has been chosen based on your configuration.)
5832 EOM
5833 rp='Try to use maximal 64-bit support, if available?'
5834 . ./myread
5835 case "$ans" in
5836 [yY]*) val="$define" ;;
5837 *)     val="$undef"  ;;
5838 esac
5839 set use64bitall
5840 eval $setvar
5841 case "$use64bitall" in
5842 "$define")
5843         case "$use64bitint" in
5844         "$undef")
5845                 cat <<EOM
5846
5847 Since you have chosen a maximally 64-bit build, I'm also turning on
5848 the use of 64-bit integers.
5849 EOM
5850                 use64bitint="$define" ;;
5851         esac
5852         ;;
5853 esac
5854
5855 : Look for a hint-file generated 'call-back-unit'.  If the
5856 : user has specified that a 64-bit perl is to be built,
5857 : we may need to set or change some other defaults.
5858 if $test -f use64bitint.cbu; then
5859         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5860         . ./use64bitint.cbu
5861 fi
5862 case "$use64bitint" in
5863 "$define"|true|[yY]*)
5864         : This test was common to all the OpenBSD forks, and seems harmless for
5865         : other platforms:
5866         echo " "
5867         echo "Checking if your C library has broken 64-bit functions..." >&4
5868         cat >try.c <<EOCP
5869 #include <stdio.h>
5870 typedef $uquadtype myULL;
5871 int main (void)
5872 {
5873     struct {
5874         double d;
5875         myULL  u;
5876     } *p, test[] = {
5877         {4294967303.15, 4294967303ULL},
5878         {4294967294.2,  4294967294ULL},
5879         {4294967295.7,  4294967295ULL},
5880         {0.0, 0ULL}
5881     };
5882     for (p = test; p->u; p++) {
5883         myULL x = (myULL)p->d;
5884         if (x != p->u) {
5885             printf("buggy\n");
5886             return 0;
5887         }
5888     }
5889     printf("ok\n");
5890     return 0;
5891 }
5892 EOCP
5893         set try
5894         if eval $compile_ok; then
5895             libcquad=`./try`
5896             echo "Your C library's 64-bit functions are $libcquad."
5897         else
5898             echo "(I can't seem to compile the test program.)"
5899             echo "Assuming that your C library's 64-bit functions are ok."
5900             libcquad="ok"
5901         fi
5902         $rm_try
5903
5904         case "$libcquad" in
5905             buggy*)
5906                 cat >&4 <<EOM
5907
5908 *** You have a C library with broken 64-bit functions.
5909 *** 64-bit support does not work reliably in this configuration.
5910 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5911 *** Cannot continue, aborting.
5912
5913 EOM
5914                 exit 1
5915                 ;;
5916         esac
5917         case "$longsize" in
5918         4) case "$archname64" in
5919            '') archname64=64int ;;
5920            esac
5921            ;;
5922         esac
5923         ;;
5924 esac
5925
5926 : Look for a hint-file generated 'call-back-unit'.  If the
5927 : user has specified that a maximally 64-bit perl is to be built,
5928 : we may need to set or change some other defaults.
5929 if $test -f use64bitall.cbu; then
5930         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5931         . ./use64bitall.cbu
5932 fi
5933 case "$use64bitall" in
5934 "$define"|true|[yY]*)
5935         case "$longsize" in
5936         4) case "$archname64" in
5937            ''|64int) archname64=64all ;;
5938            esac
5939            ;;
5940         esac
5941         ;;
5942 esac
5943
5944 case "$d_quad:$use64bitint" in
5945 $undef:$define)
5946         cat >&4 <<EOF
5947
5948 *** You have chosen to use 64-bit integers,
5949 *** but none can be found.
5950 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5951 *** Cannot continue, aborting.
5952
5953 EOF
5954         exit 1
5955         ;;
5956 esac
5957
5958 : check for length of double
5959 echo " "
5960 case "$doublesize" in
5961 '')
5962         echo "Checking to see how big your double precision numbers are..." >&4
5963         $cat >try.c <<EOCP
5964 #include <stdio.h>
5965 #$i_stdlib I_STDLIB
5966 #ifdef I_STDLIB
5967 #include <stdlib.h>
5968 #endif
5969 int main()
5970 {
5971     printf("%d\n", (int)sizeof(double));
5972     exit(0);
5973 }
5974 EOCP
5975         set try
5976         if eval $compile_ok; then
5977                 doublesize=`$run ./try`
5978                 echo "Your double is $doublesize bytes long."
5979         else
5980                 dflt='8'
5981                 echo "(I can't seem to compile the test program.  Guessing...)"
5982                 rp="What is the size of a double precision number (in bytes)?"
5983                 . ./myread
5984                 doublesize="$ans"
5985         fi
5986         ;;
5987 esac
5988 $rm_try
5989
5990 : check for long doubles
5991 echo " "
5992 echo "Checking to see if you have long double..." >&4
5993 echo 'int main() { long double x = 7.0; }' > try.c
5994 set try
5995 if eval $compile; then
5996         val="$define"
5997         echo "You have long double."
5998 else
5999         val="$undef"
6000         echo "You do not have long double."
6001 fi
6002 $rm_try
6003 set d_longdbl
6004 eval $setvar
6005
6006 : check for length of long double
6007 case "${d_longdbl}${longdblsize}" in
6008 $define)
6009         echo " "
6010         echo "Checking to see how big your long doubles are..." >&4
6011         $cat >try.c <<'EOCP'
6012 #include <stdio.h>
6013 int main()
6014 {
6015         printf("%d\n", sizeof(long double));
6016 }
6017 EOCP
6018         set try
6019         set try
6020         if eval $compile; then
6021                 longdblsize=`$run ./try`
6022                 echo "Your long doubles are $longdblsize bytes long."
6023         else
6024                 dflt='8'
6025                 echo " "
6026                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6027                 rp="What is the size of a long double (in bytes)?"
6028                 . ./myread
6029                 longdblsize="$ans"
6030         fi
6031         if $test "X$doublesize" = "X$longdblsize"; then
6032                 echo "That isn't any different from an ordinary double."
6033                 echo "I'll keep your setting anyway, but you may see some"
6034                 echo "harmless compilation warnings."
6035         fi
6036         ;;
6037 esac
6038 $rm_try
6039
6040 : determine the architecture name
6041 echo " "
6042 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6043         tarch=`arch`"-$osname"
6044 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6045         if uname -m > tmparch 2>&1 ; then
6046                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6047                         -e 's/$/'"-$osname/" tmparch`
6048         else
6049                 tarch="$osname"
6050         fi
6051         $rm -f tmparch
6052 else
6053         tarch="$osname"
6054 fi
6055 case "$myarchname" in
6056 ''|"$tarch") ;;
6057 *)
6058         echo "(Your architecture name used to be $myarchname.)"
6059         archname=''
6060         ;;
6061 esac
6062 case "$targetarch" in
6063 '') ;;
6064 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6065 esac
6066 myarchname="$tarch"
6067 case "$archname" in
6068 '') dflt="$tarch";;
6069 *) dflt="$archname";;
6070 esac
6071 rp='What is your architecture name'
6072 . ./myread
6073 archname="$ans"
6074
6075 : optionally add API version to the architecture for versioned archlibs
6076 case "$useversionedarchname" in
6077 $define|true|[yY]*) dflt='y';;
6078 *)                  dflt='n';;
6079 esac
6080 rp='Add the Perl API version to your archname?'
6081 . ./myread
6082 case "$ans" in
6083 y|Y)    useversionedarchname="$define" ;;
6084 *)      useversionedarchname="$undef" ;;
6085 esac
6086 case "$useversionedarchname" in
6087 $define)
6088         case "$archname" in
6089         *-$api_versionstring)
6090                 echo "...and architecture name already has -$api_versionstring" >&4
6091                 ;;
6092         *)
6093                 archname="$archname-$api_versionstring"
6094                 echo "...setting architecture name to $archname." >&4
6095                 ;;
6096         esac
6097         ;;
6098 esac
6099
6100 case "$usethreads" in
6101 $define)
6102         echo "Threads selected." >&4
6103         case "$archname" in
6104         *-thread*) echo "...and architecture name already has -thread." >&4
6105                 ;;
6106         *)      archname="$archname-thread"
6107                 echo "...setting architecture name to $archname." >&4
6108                 ;;
6109         esac
6110         ;;
6111 esac
6112 case "$usemultiplicity" in
6113 $define)
6114         echo "Multiplicity selected." >&4
6115         case "$archname" in
6116         *-multi*) echo "...and architecture name already has -multi." >&4
6117                 ;;
6118         *)      archname="$archname-multi"
6119                 echo "...setting architecture name to $archname." >&4
6120                 ;;
6121         esac
6122         ;;
6123 esac
6124 case "$use64bitint$use64bitall" in
6125 *"$define"*)
6126         case "$archname64" in
6127         '')
6128                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6129                 ;;
6130         *)
6131                 case "$use64bitint" in
6132                 "$define") echo "64 bit integers selected." >&4 ;;
6133                 esac
6134                 case "$use64bitall" in
6135                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6136                 esac
6137                 case "$archname" in
6138                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6139                         ;;
6140                 *)      archname="$archname-$archname64"
6141                         echo "...setting architecture name to $archname." >&4
6142                         ;;
6143                 esac
6144                 ;;
6145         esac
6146 esac
6147 case "$uselongdouble" in
6148 $define)
6149         echo "Long doubles selected." >&4
6150         case "$longdblsize" in
6151         $doublesize)
6152                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6153                 ;;
6154         *)
6155                 case "$archname" in
6156                 *-ld*) echo "...and architecture name already has -ld." >&4
6157                         ;;
6158                 *)      archname="$archname-ld"
6159                         echo "...setting architecture name to $archname." >&4
6160                         ;;
6161                 esac
6162                 ;;
6163         esac
6164         ;;
6165 esac
6166 if $test -f archname.cbu; then
6167         echo "Your platform has some specific hints for architecture name, using them..."
6168         . ./archname.cbu
6169 fi
6170
6171 : set the prefixit variable, to compute a suitable default value
6172 prefixit='case "$3" in
6173 ""|none)
6174         case "$oldprefix" in
6175         "") eval "$1=\"\$$2\"";;
6176         *)
6177                 case "$3" in
6178                 "") eval "$1=";;
6179                 none)
6180                         eval "tp=\"\$$2\"";
6181                         case "$tp" in
6182                         ""|" ") eval "$1=\"\$$2\"";;
6183                         *) eval "$1=";;
6184                         esac;;
6185                 esac;;
6186         esac;;
6187 *)
6188         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6189         case "$tp" in
6190         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6191         /*-$oldprefix/*|\~*-$oldprefix/*)
6192                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6193         *) eval "$1=\"\$$2\"";;
6194         esac;;
6195 esac'
6196
6197 : determine installation style
6198 : For now, try to deduce it from prefix unless it is already set.
6199 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6200 case "$installstyle" in
6201 '')     case "$prefix" in
6202                 *perl*) dflt='lib';;
6203                 *) dflt='lib/perl5' ;;
6204         esac
6205         ;;
6206 *)      dflt="$installstyle" ;;
6207 esac
6208 : Probably not worth prompting for this since we prompt for all
6209 : the directories individually, and the prompt would be too long and
6210 : confusing anyway.
6211 installstyle=$dflt
6212
6213 : determine where public executables go
6214 echo " "
6215 set dflt bin bin
6216 eval $prefixit
6217 fn=d~
6218 rp='Pathname where the public executables will reside?'
6219 . ./getfile
6220 if $test "X$ansexp" != "X$binexp"; then
6221         installbin=''
6222 fi
6223 prefixvar=bin
6224 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6225 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6226 :     this via initialinstalllocation
6227 . ./setprefixvar
6228
6229 case "$userelocatableinc" in
6230 $define|true|[yY]*)     dflt='y' ;;
6231 *)                      dflt='n' ;;
6232 esac
6233 cat <<EOM
6234
6235 Would you like to build Perl so that the installation is relocatable, so that
6236 library paths in @INC are determined relative to the path of the perl binary?
6237 This is not advised for system Perl installs, or if you need to run setid
6238 scripts or scripts under taint mode.
6239
6240 If this doesn't make any sense to you, just accept the default '$dflt'.
6241 EOM
6242 rp='Use relocatable @INC?'
6243 . ./myread
6244 case "$ans" in
6245 y|Y)    val="$define" ;;
6246 *)      val="$undef"  ;;
6247 esac
6248 set userelocatableinc
6249 eval $setvar
6250
6251 initialinstalllocation="$binexp"
6252 : Default prefix is now "up one level from where the binaries are"
6253 case "$userelocatableinc" in
6254 $define|true|[yY]*)
6255     bin=".../"
6256     binexp=".../"
6257     prefix=".../.."
6258     prefixexp=".../.."
6259     installprefixexp=".../.."
6260     ;;
6261 esac
6262
6263 : determine where private library files go
6264 : Usual default is /usr/local/lib/perl5/$version.
6265 : Also allow things like /opt/perl/lib/$version, since
6266 : /opt/perl/lib/perl5... would be redundant.
6267 : The default "style" setting is made in installstyle.U
6268 case "$installstyle" in
6269 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6270 *)       set dflt privlib lib/$version ;;
6271 esac
6272 eval $prefixit
6273 $cat <<EOM
6274
6275 There are some auxiliary files for $package that need to be put into a
6276 private library directory that is accessible by everyone.
6277
6278 EOM
6279 fn=$binexp
6280 fn=d~+
6281 rp='Pathname where the private library files will reside?'
6282 . ./getfile
6283 prefixvar=privlib
6284 . ./setprefixvar
6285
6286 : set the prefixup variable, to restore leading tilda escape
6287 prefixup='case "$prefixexp" in
6288 "$prefix") ;;
6289 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6290 esac'
6291
6292 : determine where public architecture dependent libraries go
6293 set archlib archlib
6294 eval $prefixit
6295 : privlib default is /usr/local/lib/$package/$version
6296 : archlib default is /usr/local/lib/$package/$version/$archname
6297 : privlib may have an optional trailing /share.
6298 tdflt=`echo $privlib | $sed 's,/share$,,'`
6299 tdflt=$tdflt/$archname
6300 case "$archlib" in
6301 '')     dflt=$tdflt
6302         ;;
6303 *)      dflt="$archlib"
6304     ;;
6305 esac
6306 $cat <<EOM
6307
6308 $spackage contains architecture-dependent library files.  If you are
6309 sharing libraries in a heterogeneous environment, you might store
6310 these files in a separate location.  Otherwise, you can just include
6311 them with the rest of the public library files.
6312
6313 EOM
6314 fn=$binexp
6315 fn=d+~
6316 rp='Where do you want to put the public architecture-dependent libraries?'
6317 . ./getfile
6318 prefixvar=archlib
6319 . ./setprefixvar
6320 if $test X"$archlib" = X"$privlib"; then
6321         d_archlib="$undef"
6322 else
6323         d_archlib="$define"
6324 fi
6325
6326 : see if setuid scripts can be secure
6327 $cat <<EOM
6328
6329 Some kernels have a bug that prevents setuid #! scripts from being
6330 secure.  Some sites have disabled setuid #! scripts because of this.
6331
6332 First let's decide if your kernel supports secure setuid #! scripts.
6333 (If setuid #! scripts would be secure but have been disabled anyway,
6334 don't say that they are secure if asked.)
6335
6336 EOM
6337
6338 val="$undef"
6339 if $test -d /dev/fd; then
6340         echo "#!$ls" >reflect
6341         chmod +x,u+s reflect
6342         ./reflect >flect 2>&1
6343         if $contains "/dev/fd" flect >/dev/null; then
6344                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6345                 val="$define"
6346         else
6347                 $cat <<EOM
6348 If you are not sure if they are secure, I can check but I'll need a
6349 username and password different from the one you are using right now.
6350 If you don't have such a username or don't want me to test, simply
6351 enter 'none'.
6352
6353 EOM
6354                 rp='Other username to test security of setuid scripts with?'
6355                 dflt='none'
6356                 . ./myread
6357                 case "$ans" in
6358                 n|none)
6359                         case "$d_suidsafe" in
6360                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6361                                 dflt=n;;
6362                         "$undef")
6363                                 echo "Well, the $hint value is *not* secure." >&4
6364                                 dflt=n;;
6365                         *)      echo "Well, the $hint value *is* secure." >&4
6366                                 dflt=y;;
6367                         esac
6368                         ;;
6369                 *)
6370                         $rm -f reflect flect
6371                         echo "#!$ls" >reflect
6372                         chmod +x,u+s reflect
6373                         echo >flect
6374                         chmod a+w flect
6375                         echo '"su" will (probably) prompt you for '"$ans's password."
6376                         su $ans -c './reflect >flect'
6377                         if $contains "/dev/fd" flect >/dev/null; then
6378                                 echo "Okay, it looks like setuid scripts are secure." >&4
6379                                 dflt=y
6380                         else
6381                                 echo "I don't think setuid scripts are secure." >&4
6382                                 dflt=n
6383                         fi
6384                         ;;
6385                 esac
6386                 rp='Does your kernel have *secure* setuid scripts?'
6387                 . ./myread
6388                 case "$ans" in
6389                 [yY]*)  val="$define";;
6390                 *)      val="$undef";;
6391                 esac
6392         fi
6393 else
6394         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6395         echo "(That's for file descriptors, not floppy disks.)"
6396         val="$undef"
6397 fi
6398 set d_suidsafe
6399 eval $setvar
6400
6401 $rm -f reflect flect
6402
6403 : now see if they want to do setuid emulation
6404 if $test $patchlevel -lt 11; then
6405 echo " "
6406 val="$undef"
6407 case "$d_suidsafe" in
6408 "$define")
6409         val="$undef"
6410         echo "No need to emulate SUID scripts since they are secure here." >&4
6411         ;;
6412 *)
6413         $cat <<EOM
6414 Some systems have disabled setuid scripts, especially systems where
6415 setuid scripts cannot be secure.  On systems where setuid scripts have
6416 been disabled, the setuid/setgid bits on scripts are currently
6417 useless.  It is possible for $package to detect those bits and emulate
6418 setuid/setgid in a secure fashion.  This emulation will only work if
6419 setuid scripts have been disabled in your kernel.
6420
6421 EOM
6422         case "$d_dosuid" in
6423         "$define") dflt=y ;;
6424         *) dflt=n ;;
6425         esac
6426         rp="Do you want to do setuid/setgid emulation?"
6427         . ./myread
6428         case "$ans" in
6429         [yY]*)  val="$define";;
6430         *)      val="$undef";;
6431         esac
6432         ;;
6433 esac
6434 set d_dosuid
6435 eval $setvar
6436 else
6437     case "$d_dosuid" in
6438         "$define")
6439         cat >&4 <<EOH
6440
6441 SUID emulation has been removed for 5.12
6442 Please re-run Configure without -Dd_dosuid
6443
6444 EOH
6445         exit 1;
6446         ;;
6447     esac
6448     d_dosuid=undef
6449 fi
6450
6451 : Find perl5.005 or later.
6452 echo "Looking for a previously installed perl5.005 or later... "
6453 case "$perl5" in
6454 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6455                 : Check if this perl is recent and can load a simple module
6456                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6457                         perl5=$tdir/perl
6458                         break;
6459                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6460                         perl5=$tdir/perl5
6461                         break;
6462                 fi
6463         done
6464         ;;
6465 *)      perl5="$perl5"
6466         ;;
6467 esac
6468 case "$perl5" in
6469 '')     echo "None found.  That's ok.";;
6470 *)      echo "Using $perl5." ;;
6471 esac
6472
6473 : Set the siteprefix variables
6474 $cat <<EOM
6475
6476 After $package is installed, you may wish to install various
6477 add-on modules and utilities.  Typically, these add-ons will
6478 be installed under $prefix with the rest
6479 of this package.  However, you may wish to install such add-ons
6480 elsewhere under a different prefix.
6481
6482 If you do not wish to put everything under a single prefix, that's
6483 ok.  You will be prompted for the individual locations; this siteprefix
6484 is only used to suggest the defaults.
6485
6486 The default should be fine for most people.
6487
6488 EOM
6489 fn=d~+
6490 rp='Installation prefix to use for add-on modules and utilities?'
6491 : XXX Here might be another good place for an installstyle setting.
6492 case "$siteprefix" in
6493 '') dflt=$prefix ;;
6494 *)  dflt=$siteprefix ;;
6495 esac
6496 . ./getfile
6497 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6498 oldsiteprefix=''
6499 case "$siteprefix" in
6500 '') ;;
6501 *)      case "$ans" in
6502         "$prefix") ;;
6503         *) oldsiteprefix="$prefix";;
6504         esac
6505         ;;
6506 esac
6507 siteprefix="$ans"
6508 siteprefixexp="$ansexp"
6509
6510 : determine where site specific libraries go.
6511 : Usual default is /usr/local/lib/perl5/site_perl/$version
6512 : The default "style" setting is made in installstyle.U
6513 : XXX No longer works with Prefixit stuff.
6514 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6515 case "$sitelib" in
6516 '') case "$installstyle" in
6517         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6518         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6519         esac
6520         ;;
6521 *)      dflt="$sitelib"
6522         ;;
6523 esac
6524 $cat <<EOM
6525
6526 The installation process will create a directory for
6527 site-specific extensions and modules.  Most users find it convenient
6528 to place all site-specific files in this directory rather than in the
6529 main distribution directory.
6530
6531 EOM
6532 fn=d~+
6533 rp='Pathname for the site-specific library files?'
6534 . ./getfile
6535 prefixvar=sitelib
6536 . ./setprefixvar
6537 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6538
6539 : Determine list of previous versions to include in @INC
6540 $cat > getverlist <<EOPL
6541 #!$perl5 -w
6542 use File::Basename;
6543 \$api_versionstring = "$api_versionstring";
6544 \$version = "$version";
6545 \$stem = "$sitelib_stem";
6546 \$archname = "$archname";
6547 EOPL
6548         $cat >> getverlist <<'EOPL'
6549 # The list found is store twice for each entry: the original name, and
6550 # the binary broken down version as pack "sss", so sorting is easy and
6551 # unambiguous. This will work for all versions that have a maximum of
6552 # three digit groups, separate by '.'s or '_'s. Names are extended with
6553 # ".0.0" to ensure at least three elements for the pack.
6554 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6555
6556 # Can't have leading @ because metaconfig interprets it as a command!
6557 ;@inc_version_list=();
6558 # XXX Redo to do opendir/readdir?
6559 if (-d $stem) {
6560     chdir($stem);
6561     ;@candidates = map {
6562         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6563     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6564 }
6565 else {
6566     ;@candidates = ();
6567 }
6568
6569 ($pversion, $aversion, $vsn5005) = map {
6570     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6571 foreach $d (@candidates) {
6572     if ($d->[1] lt $pversion) {
6573         if ($d->[1] ge $aversion) {
6574             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6575         }
6576         elsif ($d->[1] ge $vsn5005) {
6577             unshift(@inc_version_list, grep { -d } $d->[0]);
6578         }
6579     }
6580     else {
6581         # Skip newer version.  I.e. don't look in
6582         # 5.7.0 if we're installing 5.6.1.
6583     }
6584 }
6585
6586 if (@inc_version_list) {
6587     print join(' ', @inc_version_list);
6588 }
6589 else {
6590     # Blank space to preserve value for next Configure run.
6591     print " ";
6592 }
6593 EOPL
6594 chmod +x getverlist
6595 case "$inc_version_list" in
6596 '')     if test -x "$perl5$exe_ext"; then
6597                 dflt=`$perl5 getverlist`
6598         else
6599                 dflt='none'
6600         fi
6601         ;;
6602 $undef) dflt='none' ;;
6603 *)  eval dflt=\"$inc_version_list\" ;;
6604 esac
6605 case "$dflt" in
6606 ''|' ') dflt=none ;;
6607 esac
6608 case "$dflt" in
6609 5.005) dflt=none ;;
6610 esac
6611 $cat <<EOM
6612
6613 In order to ease the process of upgrading, this version of perl
6614 can be configured to use modules built and installed with earlier
6615 versions of perl that were installed under $prefix.  Specify here
6616 the list of earlier versions that this version of perl should check.
6617 If Configure detected no earlier versions of perl installed under
6618 $prefix, then the list will be empty.  Answer 'none' to tell perl
6619 to not search earlier versions.
6620
6621 The default should almost always be sensible, so if you're not sure,
6622 just accept the default.
6623 EOM
6624
6625 rp='List of earlier versions to include in @INC?'
6626 . ./myread
6627 case "$ans" in
6628 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6629 *) inc_version_list="$ans" ;;
6630 esac
6631 case "$inc_version_list" in
6632 ''|' ')
6633         inc_version_list_init='0'
6634         d_inc_version_list="$undef"
6635         ;;
6636 *)      inc_version_list_init=`echo $inc_version_list |
6637                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6638         d_inc_version_list="$define"
6639         ;;
6640 esac
6641 $rm -f getverlist
6642
6643 : see if malloc/malloc.h has to be included
6644 set malloc/malloc.h i_mallocmalloc
6645 eval $inhdr
6646
6647 : see if this is a malloc.h system
6648 : we want a real compile instead of Inhdr because some systems have a
6649 : malloc.h that just gives a compile error saying to use stdlib.h instead
6650 echo " "
6651 $cat >try.c <<EOCP
6652 #include <stdlib.h>
6653 #include <malloc.h>
6654 #$i_mallocmalloc I_MALLOCMALLOC
6655 #ifdef I_MALLOCMALLOC
6656 # include <malloc/malloc.h>
6657 #endif
6658
6659 int main () { return 0; }
6660 EOCP
6661 set try
6662 if eval $compile; then
6663     echo "<malloc.h> found." >&4
6664     val="$define"
6665 else
6666     echo "<malloc.h> NOT found." >&4
6667     val="$undef"
6668 fi
6669 $rm_try
6670 set i_malloc
6671 eval $setvar
6672
6673 : check for length of pointer
6674 echo " "
6675 case "$ptrsize" in
6676 '')
6677         echo "Checking to see how big your pointers are..." >&4
6678         $cat >>try.c <<EOCP
6679 #include <stdio.h>
6680 #$i_stdlib I_STDLIB
6681 #ifdef I_STDLIB
6682 #include <stdlib.h>
6683 #endif
6684 int main()
6685 {
6686     printf("%d\n", (int)sizeof(void *));
6687     exit(0);
6688 }
6689 EOCP
6690         set try
6691         if eval $compile_ok; then
6692                 ptrsize=`$run ./try`
6693                 echo "Your pointers are $ptrsize bytes long."
6694         else
6695                 dflt='4'
6696                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6697                 rp="What is the size of a pointer (in bytes)?"
6698                 . ./myread
6699                 ptrsize="$ans"
6700         fi
6701         ;;
6702 esac
6703 $rm_try
6704 case "$use64bitall" in
6705 "$define"|true|[yY]*)
6706         case "$ptrsize" in
6707         4)      cat <<EOM >&4
6708
6709 *** You have chosen a maximally 64-bit build,
6710 *** but your pointers are only 4 bytes wide.
6711 *** Please rerun Configure without -Duse64bitall.
6712 EOM
6713                 case "$d_quad" in
6714                 define)
6715                         cat <<EOM >&4
6716 *** Since you have quads, you could possibly try with -Duse64bitint.
6717 EOM
6718                         ;;
6719                 esac
6720                 cat <<EOM >&4
6721 *** Cannot continue, aborting.
6722
6723 EOM
6724
6725                 exit 1
6726                 ;;
6727         esac
6728         ;;
6729 esac
6730
6731
6732 : determine whether to use malloc wrapping
6733 echo " "
6734 case "$usemallocwrap" in
6735 [yY]*|true|$define)     dflt='y' ;;
6736 [nN]*|false|$undef)     dflt='n' ;;
6737 *)      case "$usedevel" in
6738         [yY]*|true|$define)     dflt='y' ;;
6739         *) dflt='n' ;;
6740         esac
6741         ;;
6742 esac
6743 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6744 . ./myread
6745 usemallocwrap="$ans"
6746 case "$ans" in
6747 y*|true)
6748         usemallocwrap="$define" ;;
6749 *)
6750         usemallocwrap="$undef" ;;
6751 esac
6752
6753 : determine which malloc to compile in
6754 echo " "
6755 case "$usemymalloc" in
6756 [yY]*|true|$define)     dflt='y' ;;
6757 [nN]*|false|$undef)     dflt='n' ;;
6758 *)      case "$ptrsize" in
6759         4) dflt='y' ;;
6760         *) dflt='n' ;;
6761         esac
6762         if test "$useithreads" = "$define"; then dflt='n'; fi
6763         ;;
6764 esac
6765 rp="Do you wish to attempt to use the malloc that comes with $package?"
6766 . ./myread
6767 usemymalloc="$ans"
6768 case "$ans" in
6769 y*|true)
6770         usemymalloc='y'
6771         mallocsrc='malloc.c'
6772         mallocobj="malloc$_o"
6773         d_mymalloc="$define"
6774         case "$libs" in
6775         *-lmalloc*)
6776                 : Remove malloc from list of libraries to use
6777                 echo "Removing unneeded -lmalloc from library list" >&4
6778                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6779                 shift
6780                 libs="$*"
6781                 echo "libs = $libs" >&4
6782                 ;;
6783         esac
6784         ;;
6785 *)
6786         usemymalloc='n'
6787         mallocsrc=''
6788         mallocobj=''
6789         d_mymalloc="$undef"
6790         ;;
6791 esac
6792
6793 : compute the return types of malloc and free
6794 echo " "
6795 $cat >malloc.c <<END
6796 #$i_malloc I_MALLOC
6797 #$i_stdlib I_STDLIB
6798 #include <stdio.h>
6799 #include <sys/types.h>
6800 #ifdef I_MALLOC
6801 #include <malloc.h>
6802 #endif
6803 #ifdef I_STDLIB
6804 #include <stdlib.h>
6805 #endif
6806 #ifdef TRY_MALLOC
6807 void *malloc();
6808 #endif
6809 #ifdef TRY_FREE
6810 void free();
6811 #endif
6812 END
6813 case "$malloctype" in
6814 '')
6815         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6816                 malloctype='void *'
6817         else
6818                 malloctype='char *'
6819         fi
6820         ;;
6821 esac
6822 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6823
6824 case "$freetype" in
6825 '')
6826         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6827                 freetype='void'
6828         else
6829                 freetype='int'
6830         fi
6831         ;;
6832 esac
6833 echo "Your system uses $freetype free(), it would seem." >&4
6834 $rm -f malloc.[co]
6835 : determine where site specific architecture-dependent libraries go.
6836 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6837 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6838 : sitelib may have an optional trailing /share.
6839 case "$sitearch" in
6840 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6841         dflt="$dflt/$archname"
6842         ;;
6843 *)      dflt="$sitearch"
6844         ;;
6845 esac
6846 set sitearch sitearch none
6847 eval $prefixit
6848 $cat <<EOM
6849
6850 The installation process will also create a directory for
6851 architecture-dependent site-specific extensions and modules.
6852
6853 EOM
6854 fn=d~+
6855 rp='Pathname for the site-specific architecture-dependent library files?'
6856 . ./getfile
6857 prefixvar=sitearch
6858 . ./setprefixvar
6859 if $test X"$sitearch" = X"$sitelib"; then
6860         d_sitearch="$undef"
6861 else
6862         d_sitearch="$define"
6863 fi
6864
6865 : Set the vendorprefix variables
6866 $cat <<EOM
6867
6868 The installation process will also create a directory for
6869 vendor-supplied add-ons.  Vendors who supply perl with their system
6870 may find it convenient to place all vendor-supplied files in this
6871 directory rather than in the main distribution directory.  This will
6872 ease upgrades between binary-compatible maintenance versions of perl.
6873
6874 Of course you may also use these directories in whatever way you see
6875 fit.  For example, you might use them to access modules shared over a
6876 company-wide network.
6877
6878 The default answer should be fine for most people.
6879 This causes further questions about vendor add-ons to be skipped
6880 and no vendor-specific directories will be configured for perl.
6881
6882 EOM
6883 rp='Do you want to configure vendor-specific add-on directories?'
6884 case "$usevendorprefix" in
6885 define|true|[yY]*) dflt=y ;;
6886 *)      : User may have set vendorprefix directly on Configure command line.
6887         case "$vendorprefix" in
6888         ''|' ') dflt=n ;;
6889         *)      dflt=y ;;
6890         esac
6891         ;;
6892 esac
6893 . ./myread
6894 case "$ans" in
6895 [yY]*)  fn=d~+
6896         rp='Installation prefix to use for vendor-supplied add-ons?'
6897         case "$vendorprefix" in
6898         '') dflt="$prefix" ;;
6899         *)  dflt=$vendorprefix ;;
6900         esac
6901         . ./getfile
6902         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6903         oldvendorprefix=''
6904         case "$vendorprefix" in
6905         '') ;;
6906         *)      case "$ans" in
6907                 "$prefix") ;;
6908                 *) oldvendorprefix="$prefix";;
6909                 esac
6910                 ;;
6911         esac
6912         usevendorprefix="$define"
6913         vendorprefix="$ans"
6914         vendorprefixexp="$ansexp"
6915         ;;
6916 *)      usevendorprefix="$undef"
6917         vendorprefix=''
6918         vendorprefixexp=''
6919         ;;
6920 esac
6921
6922 : Set the vendorlib variables
6923 case "$vendorprefix" in
6924 '')     d_vendorlib="$undef"
6925         vendorlib=''
6926         vendorlibexp=''
6927         ;;
6928 *)      d_vendorlib="$define"
6929         : determine where vendor-supplied modules go.
6930         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6931         case "$vendorlib" in
6932         '')
6933                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6934                 case "$installstyle" in
6935                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6936                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6937                 esac
6938                 ;;
6939         *)      dflt="$vendorlib"
6940                 ;;
6941         esac
6942         fn=d~+
6943         rp='Pathname for the vendor-supplied library files?'
6944         . ./getfile
6945         vendorlib="$ans"
6946         vendorlibexp="$ansexp"
6947         ;;
6948 esac
6949 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6950 prefixvar=vendorlib
6951 . ./installprefix
6952
6953 : Set the vendorarch variables
6954 case "$vendorprefix" in
6955 '')     d_vendorarch="$undef"
6956         vendorarch=''
6957         vendorarchexp=''
6958         ;;
6959 *)      d_vendorarch="$define"
6960         : determine where vendor-supplied architecture-dependent libraries go.
6961         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6962         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6963         : vendorlib may have an optional trailing /share.
6964         case "$vendorarch" in
6965         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6966                 dflt="$dflt/$archname"
6967                 ;;
6968         *)      dflt="$vendorarch" ;;
6969         esac
6970         fn=d~+
6971         rp='Pathname for vendor-supplied architecture-dependent files?'
6972         . ./getfile
6973         vendorarch="$ans"
6974         vendorarchexp="$ansexp"
6975         ;;
6976 esac
6977 prefixvar=vendorarch
6978 . ./installprefix
6979 if $test X"$vendorarch" = X"$vendorlib"; then
6980         d_vendorarch="$undef"
6981 else
6982         d_vendorarch="$define"
6983 fi
6984
6985 : Final catch-all directories to search
6986 $cat <<EOM
6987
6988 Lastly, you can have perl look in other directories for extensions and
6989 modules in addition to those already specified.
6990 These directories will be searched after
6991         $sitearch
6992         $sitelib
6993 EOM
6994 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6995 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6996 echo ' '
6997 case "$otherlibdirs" in
6998 ''|' ') dflt='none' ;;
6999 *)      dflt="$otherlibdirs" ;;
7000 esac
7001 $cat <<EOM
7002 Enter a colon-separated set of extra paths to include in perl's @INC
7003 search path, or enter 'none' for no extra paths.
7004
7005 EOM
7006
7007 rp='Colon-separated list of additional directories for perl to search?'
7008 . ./myread
7009 case "$ans" in
7010 ' '|''|none)    otherlibdirs=' ' ;;
7011 *)      otherlibdirs="$ans" ;;
7012 esac
7013 case "$otherlibdirs" in
7014 ' ') val=$undef ;;
7015 *)      val=$define ;;
7016 esac
7017 set d_perl_otherlibdirs
7018 eval $setvar
7019
7020 : Cruising for prototypes
7021 echo " "
7022 echo "Checking out function prototypes..." >&4
7023 $cat >prototype.c <<EOCP
7024 #$i_stdlib I_STDLIB
7025 #ifdef I_STDLIB
7026 #include <stdlib.h>
7027 #endif
7028 int main(int argc, char *argv[]) {
7029         exit(0);}
7030 EOCP
7031 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7032         echo "Your C compiler appears to support function prototypes."
7033         val="$define"
7034 else
7035         echo "Your C compiler doesn't seem to understand function prototypes."
7036         val="$undef"
7037 fi
7038 set prototype
7039 eval $setvar
7040 $rm -f prototype*
7041
7042 : Check if ansi2knr is required
7043 case "$prototype" in
7044 "$define") ;;
7045 *)      ansi2knr='ansi2knr'
7046         echo " "
7047         cat <<EOM >&4
7048
7049 $me:  FATAL ERROR:
7050 This version of $package can only be compiled by a compiler that 
7051 understands function prototypes.  Unfortunately, your C compiler 
7052         $cc $ccflags
7053 doesn't seem to understand them.  Sorry about that.
7054
7055 If GNU cc is available for your system, perhaps you could try that instead.  
7056
7057 Eventually, we hope to support building Perl with pre-ANSI compilers.
7058 If you would like to help in that effort, please contact <perlbug@perl.org>.
7059
7060 Aborting Configure now.
7061 EOM
7062         exit 2
7063         ;;
7064 esac
7065
7066 : DTrace support
7067 dflt_dtrace='/usr/sbin/dtrace'
7068 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7069
7070 cat <<EOM
7071
7072 Perl can be built to support DTrace on platforms that support it.
7073 DTrace is a diagnosis and performance analysis tool from Sun.
7074
7075 If this doesn't make any sense to you, just accept the default '$dflt'.
7076 EOM
7077
7078 while $test 1 ; do
7079         case "$usedtrace" in
7080         $define|true|[yY]*)
7081                 dflt='y'
7082                 ;;
7083         ?*)
7084                 dflt='y'
7085                 dflt_dtrace=$usedtrace
7086                 ;;
7087         *)
7088                 dflt='n'
7089                 ;;
7090         esac
7091
7092         rp='Support DTrace if available?'
7093         . ./myread
7094         case "$ans" in
7095         y|Y)    val="$define" ;;
7096         *)      val="$undef" ;;
7097         esac
7098         set usedtrace
7099         eval $setvar
7100
7101         test "X$usedtrace" != "X$define" && break
7102
7103         echo " "
7104         rp='Where is the dtrace executable?'
7105         dflt=$dflt_dtrace
7106         . ./getfile
7107         val="$ans"
7108         set dtrace
7109         eval $setvar
7110
7111         if $test -f $dtrace
7112         then
7113                 if $dtrace -h -s ../perldtrace.d \
7114                         -o perldtrace.tmp >/dev/null 2>&1 \
7115                         && rm -f perldtrace.tmp
7116                 then
7117                         echo " "
7118                         echo "Good: your $dtrace knows about the -h flag."
7119                 else
7120                         cat >&2 <<EOM
7121
7122 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7123 ***
7124 *** Your installed dtrace doesn't support the -h switch to compile a D
7125 *** program into a C header. Can't continue.
7126
7127 EOM
7128                         exit 1
7129                 fi
7130                 break;
7131         fi
7132
7133         case "$fastread" in
7134         yes)
7135                 cat >&2 <<EOM
7136
7137 *** $me:  Fatal Error:  $dtrace not found.
7138 *** Can't continue.
7139
7140 EOM
7141                 exit 1
7142                 ;;
7143         *)
7144                 echo "*** $dtrace was not found."
7145                 echo " "
7146                 ;;
7147         esac
7148 done
7149
7150 : See if we want extra modules installed
7151 echo " "
7152 case "$extras" in
7153 '') dflt='n';;
7154 *) dflt='y';;
7155 esac
7156 cat <<EOM
7157 Perl can be built with extra modules or bundles of modules which
7158 will be fetched from the CPAN and installed alongside Perl.
7159
7160 Notice that you will need access to the CPAN; either via the Internet,
7161 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7162 be asked later to configure the CPAN.pm module which will in turn do
7163 the installation of the rest of the extra modules or bundles.)
7164
7165 Notice also that if the modules require any external software such as
7166 libraries and headers (the libz library and the zlib.h header for the
7167 Compress::Zlib module, for example) you MUST have any such software
7168 already installed, this configuration process will NOT install such
7169 things for you.
7170
7171 If this doesn't make any sense to you, just accept the default '$dflt'.
7172 EOM
7173 rp='Install any extra modules (y or n)?'
7174 . ./myread
7175 case "$ans" in
7176 y|Y)
7177         cat <<EOM
7178
7179 Please list any extra modules or bundles to be installed from CPAN,
7180 with spaces between the names.  The names can be in any format the
7181 'install' command of CPAN.pm will understand.  (Answer 'none',
7182 without the quotes, to install no extra modules or bundles.)
7183 EOM
7184         rp='Extras?'
7185         dflt="$extras"
7186         . ./myread
7187         extras="$ans"
7188 esac
7189 case "$extras" in
7190 ''|'none')
7191         val=''
7192         $rm -f ../extras.lst
7193         ;;
7194 *)      echo "(Saving the list of extras for later...)"
7195         echo "$extras" > ../extras.lst
7196         val="'$extras'"
7197         ;;
7198 esac
7199 set extras
7200 eval $setvar
7201 echo " "
7202
7203 : determine where html pages for programs go
7204 set html1dir html1dir none
7205 eval $prefixit
7206 $cat <<EOM
7207
7208 If you wish to install html files for programs in $spackage, indicate
7209 the appropriate directory here.  To skip installing html files,
7210 answer "none".
7211 EOM
7212 case "$html1dir" in
7213 ''|none|$undef|' ') dflt=none ;;
7214 *) dflt=$html1dir ;;
7215 esac
7216 fn=dn+~
7217 rp="Directory for the main $spackage html pages?"
7218 . ./getfile
7219 prefixvar=html1dir
7220 . ./setprefixvar
7221 : Use ' ' for none so value is preserved next time through Configure
7222 $test X"$html1dir" = "X" && html1dir=' '
7223
7224 : determine where html pages for libraries and modules go
7225 set html3dir html3dir none
7226 eval $prefixit
7227 $cat <<EOM
7228
7229 If you wish to install html files for modules associated with $spackage,
7230 indicate the appropriate directory here.  To skip installing html files,
7231 answer "none".
7232 EOM
7233 : There is no obvious default.  If they have specified html1dir, then
7234 : try to key off that, possibly changing .../html1 into .../html3.
7235 case "$html3dir" in
7236 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7237 *) dflt=$html3dir ;;
7238 esac
7239 fn=dn+~
7240 rp="Directory for the $spackage module html pages?"
7241 . ./getfile
7242 prefixvar=html3dir
7243 . ./setprefixvar
7244 : Use ' ' for none so value is preserved next time through Configure
7245 $test X"$html3dir" = "X" && html3dir=' '
7246
7247 : determine whether to install perl also as /usr/bin/perl
7248
7249 echo " "
7250 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7251         $cat <<EOM
7252 Many scripts expect perl to be installed as /usr/bin/perl.
7253
7254 If you want to, I can install the perl you are about to compile
7255 as /usr/bin/perl (in addition to $bin/perl).
7256 EOM
7257         if test -f /usr/bin/perl; then
7258             $cat <<EOM
7259
7260 However, please note that because you already have a /usr/bin/perl,
7261 overwriting that with a new Perl would very probably cause problems.
7262 Therefore I'm assuming you don't want to do that (unless you insist).
7263
7264 EOM
7265             case "$installusrbinperl" in
7266             "$define"|[yY]*)    dflt='y';;
7267             *)                  dflt='n';;
7268             esac
7269         else
7270             $cat <<EOM
7271
7272 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7273
7274 EOM
7275             case "$installusrbinperl" in
7276             "$undef"|[nN]*)     dflt='n';;
7277             *)                  dflt='y';;
7278             esac
7279         fi
7280         rp="Do you want to install perl as /usr/bin/perl?"
7281         . ./myread
7282         case "$ans" in
7283         [yY]*)  val="$define";;
7284         *)      val="$undef" ;;
7285         esac
7286 else
7287         val="$undef"
7288 fi
7289 set installusrbinperl
7290 eval $setvar
7291
7292 : Check if we are using the GNU C library
7293 echo " "
7294 echo "Checking for GNU C Library..." >&4
7295 cat >try.c <<'EOCP'
7296 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7297    alone are insufficient to distinguish different versions, such as
7298    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7299    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7300 */
7301 #include <stdio.h>
7302 int main(void)
7303 {
7304 #ifdef __GLIBC__
7305 #   ifdef __GLIBC_MINOR__
7306 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7307 #           include <gnu/libc-version.h>
7308             printf("%s\n",  gnu_get_libc_version());
7309 #       else
7310             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7311 #       endif
7312 #   else
7313         printf("%d\n",  __GLIBC__);
7314 #   endif
7315     return 0;
7316 #else
7317     return 1;
7318 #endif
7319 }
7320 EOCP
7321 set try
7322 if eval $compile_ok && $run ./try > glibc.ver; then
7323         val="$define"
7324         gnulibc_version=`$cat glibc.ver`
7325         echo "You are using the GNU C Library version $gnulibc_version"
7326 else
7327         val="$undef"
7328         gnulibc_version=''
7329         echo "You are not using the GNU C Library"
7330 fi
7331 $rm_try glibc.ver
7332 set d_gnulibc
7333 eval $setvar
7334
7335 : see if nm is to be used to determine whether a symbol is defined or not
7336 case "$usenm" in
7337 '')
7338         dflt=''
7339         case "$d_gnulibc" in
7340         "$define")
7341                 echo " "
7342                 echo "nm probably won't work on the GNU C Library." >&4
7343                 dflt=n
7344                 ;;
7345         esac
7346         case "$dflt" in
7347         '')
7348                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7349                         echo " "
7350                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7351                         echo "'nm' won't be sufficient on this system." >&4
7352                         dflt=n
7353                 fi
7354                 ;;
7355         esac
7356         case "$dflt" in
7357         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7358                 if $test $dflt -gt 20; then
7359                         dflt=y
7360                 else
7361                         dflt=n
7362                 fi
7363                 ;;
7364         esac
7365         ;;
7366 *)
7367         case "$usenm" in
7368         true|$define) dflt=y;;
7369         *) dflt=n;;
7370         esac
7371         ;;
7372 esac
7373 $cat <<EOM
7374
7375 I can use $nm to extract the symbols from your C libraries. This
7376 is a time consuming task which may generate huge output on the disk (up
7377 to 3 megabytes) but that should make the symbols extraction faster. The
7378 alternative is to skip the 'nm' extraction part and to compile a small
7379 test program instead to determine whether each symbol is present. If
7380 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7381 this may be the best solution.
7382
7383 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7384
7385 EOM
7386 rp="Shall I use $nm to extract C symbols from the libraries?"
7387 . ./myread
7388 case "$ans" in
7389 [Nn]*) usenm=false;;
7390 *) usenm=true;;
7391 esac
7392
7393 runnm=$usenm
7394 case "$reuseval" in
7395 true) runnm=false;;
7396 esac
7397
7398 : nm options which may be necessary
7399 case "$nm_opt" in
7400 '') if $test -f /mach_boot; then
7401                 nm_opt=''       # Mach
7402         elif $test -d /usr/ccs/lib; then
7403                 nm_opt='-p'     # Solaris (and SunOS?)
7404         elif $test -f /dgux; then
7405                 nm_opt='-p'     # DG-UX
7406         elif $test -f /lib64/rld; then
7407                 nm_opt='-p'     # 64-bit Irix
7408         else
7409                 nm_opt=''
7410         fi;;
7411 esac
7412
7413 : nm options which may be necessary for shared libraries but illegal
7414 : for archive libraries.  Thank you, Linux.
7415 case "$nm_so_opt" in
7416 '')     case "$myuname" in
7417         *linux*|gnu*)
7418                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7419                         nm_so_opt='--dynamic'
7420                 fi
7421                 ;;
7422         esac
7423         ;;
7424 esac
7425
7426 : Figure out where the libc is located
7427 case "$runnm" in
7428 true)
7429 : get list of predefined functions in a handy place
7430 echo " "
7431 case "$libc" in
7432 '') libc=unknown
7433         case "$libs" in
7434         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7435         esac
7436         ;;
7437 esac
7438 case "$libs" in
7439 '') ;;
7440 *)  for thislib in $libs; do
7441         case "$thislib" in
7442         -lc|-lc_s)
7443                 : Handle C library specially below.
7444                 ;;
7445         -l*)
7446                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7447                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7448                         :
7449                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7450                         :
7451                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7452                         :
7453                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7454                         :
7455                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7456                         :
7457                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7458                         :
7459                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7460                         :
7461                 else
7462                         try=''
7463                 fi
7464                 libnames="$libnames $try"
7465                 ;;
7466         *) libnames="$libnames $thislib" ;;
7467         esac
7468         done
7469         ;;
7470 esac
7471 xxx=normal
7472 case "$libc" in
7473 unknown)
7474         set /lib/libc.$so
7475         for xxx in $libpth; do
7476                 $test -r $1 || set $xxx/libc.$so
7477                 : The messy sed command sorts on library version numbers.
7478                 $test -r $1 || \
7479                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7480                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7481                                 h
7482                                 s/[0-9][0-9]*/0000&/g
7483                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7484                                 G
7485                                 s/\n/ /' | \
7486                          $sort | $sed -e 's/^.* //'`
7487                 eval set \$$#
7488         done
7489         $test -r $1 || set /usr/ccs/lib/libc.$so
7490         $test -r $1 || set /lib/libsys_s$_a
7491         ;;
7492 *)
7493         set blurfl
7494         ;;
7495 esac
7496 if $test -r "$1"; then
7497         echo "Your (shared) C library seems to be in $1."
7498         libc="$1"
7499 elif $test -r /lib/libc && $test -r /lib/clib; then
7500         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7501         xxx=apollo
7502         libc='/lib/clib /lib/libc'
7503         if $test -r /lib/syslib; then
7504                 echo "(Your math library is in /lib/syslib.)"
7505                 libc="$libc /lib/syslib"
7506         fi
7507 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7508         echo "Your C library seems to be in $libc, as you said before."
7509 elif $test -r $incpath/usr/lib/libc$_a; then
7510         libc=$incpath/usr/lib/libc$_a;
7511         echo "Your C library seems to be in $libc.  That's fine."
7512 elif $test -r /lib/libc$_a; then
7513         libc=/lib/libc$_a;
7514         echo "Your C library seems to be in $libc.  You're normal."
7515 else
7516         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7517                 :
7518         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7519                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7520         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7521                 :
7522         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7523                 :
7524         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7525                 :
7526         else
7527                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7528         fi
7529         if $test -r "$tans"; then
7530                 echo "Your C library seems to be in $tans, of all places."
7531                 libc=$tans
7532         else
7533                 libc='blurfl'
7534         fi
7535 fi
7536 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7537         dflt="$libc"
7538         cat <<EOM
7539
7540 If the guess above is wrong (which it might be if you're using a strange
7541 compiler, or your machine supports multiple models), you can override it here.
7542
7543 EOM
7544 else
7545         dflt=''
7546         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7547         cat >&4 <<EOM
7548 I can't seem to find your C library.  I've looked in the following places:
7549
7550 EOM
7551         $sed 's/^/      /' libpath
7552         cat <<EOM
7553
7554 None of these seems to contain your C library. I need to get its name...
7555
7556 EOM
7557 fi
7558 fn=f
7559 rp='Where is your C library?'
7560 . ./getfile
7561 libc="$ans"
7562
7563 echo " "
7564 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7565 set X `cat libnames`
7566 shift
7567 xxx=files
7568 case $# in 1) xxx=file; esac
7569 echo "Extracting names from the following $xxx for later perusal:" >&4
7570 echo " "
7571 $sed 's/^/      /' libnames >&4
7572 echo " "
7573 $echo $n "This may take a while...$c" >&4
7574
7575 for file in $*; do
7576         case $file in
7577         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7578         *) $nm $nm_opt $file 2>/dev/null;;
7579         esac
7580 done >libc.tmp
7581
7582 $echo $n ".$c"
7583 $grep fprintf libc.tmp > libc.ptf
7584 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7585 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7586 xxx='[ADTSIWi]'
7587 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7588         eval $xscan;\
7589         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7590                 eval $xrun
7591 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7592         eval $xscan;\
7593         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7594                 eval $xrun
7595 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7596         eval $xscan;\
7597         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7598                 eval $xrun
7599 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7600         eval $xscan;\
7601         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7602                 eval $xrun
7603 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7604         eval $xscan;\
7605         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7606                 eval $xrun
7607 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7608         eval $xscan;\
7609         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7610                 eval $xrun
7611 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7612                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7613         eval $xscan;\
7614         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7615                 eval $xrun
7616 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7617         eval $xscan;\
7618         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7619                 eval $xrun
7620 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7621         eval $xscan;\
7622         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7623                 eval $xrun
7624 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7625         eval $xscan;\
7626         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7627                 eval $xrun
7628 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7629         eval $xscan;\
7630         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7631                 eval $xrun
7632 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7633         eval $xscan;\
7634         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7635                 eval $xrun
7636 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7637         eval $xscan;\
7638         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7639                 eval $xrun
7640 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7641         eval $xscan;\
7642         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7643                 eval $xrun
7644 else
7645         $nm -p $* 2>/dev/null >libc.tmp
7646         $grep fprintf libc.tmp > libc.ptf
7647         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7648                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7649         then
7650                 nm_opt='-p'
7651                 eval $xrun
7652         else
7653                 echo " "
7654                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7655                 com=''
7656                 if $ar t $libc > libc.tmp && \
7657                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7658                 then
7659                         for thisname in $libnames $libc; do
7660                                 $ar t $thisname >>libc.tmp
7661                         done
7662                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7663                         echo "Ok." >&4
7664                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7665                         for thisname in $libnames $libc; do
7666                                 $ar tv $thisname >>libc.tmp
7667                                 emximp -o tmp.imp $thisname \
7668                                     2>/dev/null && \
7669                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7670                                     < tmp.imp >>libc.tmp
7671                                 $rm -f tmp.imp
7672                         done
7673                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7674                         echo "Ok." >&4
7675                 else
7676                         echo "$ar didn't seem to work right." >&4
7677                         echo "Maybe this is a Cray...trying bld instead..." >&4
7678                         if  bld t $libc | \
7679                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7680                                 $test -s libc.list
7681                         then
7682                                 for thisname in $libnames; do
7683                                         bld t $libnames | \
7684                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7685                                         $ar t $thisname >>libc.tmp
7686                                 done
7687                                 echo "Ok." >&4
7688                         else
7689                                 echo "That didn't work either.  Giving up." >&4
7690                                 exit 1
7691                         fi
7692                 fi
7693         fi
7694 fi
7695 nm_extract="$com"
7696 case "$PASE" in
7697 define)
7698     echo " "
7699     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7700     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7701     ;;
7702 *)  if $test -f /lib/syscalls.exp; then
7703         echo " "
7704         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7705         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7706                 /lib/syscalls.exp >>libc.list
7707     fi
7708     ;;
7709 esac
7710 ;;
7711 esac
7712 $rm -f libnames libpath
7713
7714 : Check if we are using C++
7715 echo " "
7716 echo "Checking for C++..." >&4
7717 $cat >try.c <<'EOCP'
7718 #include <stdio.h>
7719 int main(void)
7720 {
7721 #ifdef __cplusplus
7722     return 0;
7723 #else
7724     return 1;
7725 #endif
7726 }
7727 EOCP
7728 set try
7729 if eval $compile_ok && $run ./try; then
7730         val="$define"
7731         echo "You are using a C++ compiler."
7732 else
7733         val="$undef"
7734         echo "You are not using a C++ compiler."
7735 fi
7736 $rm_try cplusplus$$
7737 set d_cplusplus
7738 eval $setvar
7739
7740 : is a C symbol defined?
7741 csym='tlook=$1;
7742 case "$3" in
7743 -v) tf=libc.tmp; tdc="";;
7744 -a) tf=libc.tmp; tdc="[]";;
7745 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7746 esac;
7747 case "$d_cplusplus" in
7748     $define)    extern_C="extern \"C\"" ;;
7749     *)          extern_C="extern"       ;;
7750 esac;
7751 tx=yes;
7752 case "$reuseval-$4" in
7753 true-) ;;
7754 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7755 esac;
7756 case "$tx" in
7757 yes)
7758         tval=false;
7759         if $test "$runnm" = true; then
7760                 if $contains $tlook $tf >/dev/null 2>&1; then
7761                         tval=true;
7762                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7763                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7764                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7765                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7766                         $rm_try;
7767                 fi;
7768         else
7769                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7770                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7771                 $rm_try;
7772         fi;
7773         ;;
7774 *)
7775         case "$tval" in
7776         $define) tval=true;;
7777         *) tval=false;;
7778         esac;
7779         ;;
7780 esac;
7781 eval "$2=$tval"'
7782
7783 : define an is-in-libc? function
7784 inlibc='echo " "; td=$define; tu=$undef;
7785 sym=$1; var=$2; eval "was=\$$2";
7786 tx=yes;
7787 case "$reuseval$was" in
7788 true) ;;
7789 true*) tx=no;;
7790 esac;
7791 case "$tx" in
7792 yes)
7793         set $sym tres -f;
7794         eval $csym;
7795         case "$tres" in
7796         true)
7797                 echo "$sym() found." >&4;
7798                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7799         *)
7800                 echo "$sym() NOT found." >&4;
7801                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7802         esac;;
7803 *)
7804         case "$was" in
7805         $define) echo "$sym() found." >&4;;
7806         *) echo "$sym() NOT found." >&4;;
7807         esac;;
7808 esac'
7809
7810 : see if dlopen exists
7811 xxx_runnm="$runnm"
7812 xxx_ccflags="$ccflags"
7813 runnm=false
7814 : with g++ one needs -shared to get is-in-libc to work for dlopen
7815 case "$gccversion" in
7816 '')     ;;
7817 *)      case "$d_cplusplus" in
7818         "$define") ccflags="$ccflags -shared" ;;
7819         esac
7820         ;;
7821 esac
7822 set dlopen d_dlopen
7823 eval $inlibc
7824 runnm="$xxx_runnm"
7825 ccflags="$xxx_ccflags"
7826
7827 : see if this is a unistd.h system
7828 set unistd.h i_unistd
7829 eval $inhdr
7830
7831 : determine which dynamic loading, if any, to compile in
7832 echo " "
7833 dldir="ext/DynaLoader"
7834 case "$usedl" in
7835 $define|y|true)
7836         dflt='y'
7837         usedl="$define"
7838         ;;
7839 $undef|n|false)
7840         dflt='n'
7841         usedl="$undef"
7842         ;;
7843 *)
7844         dflt='n'
7845         case "$d_dlopen" in
7846             $define) dflt='y' ;;
7847         esac
7848         : Does a dl_xxx.xs file exist for this operating system
7849         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7850         ;;
7851 esac
7852 rp="Do you wish to use dynamic loading?"
7853 . ./myread
7854 usedl="$ans"
7855 bin_ELF="$undef"
7856 case "$ans" in
7857 y*) usedl="$define"
7858         case "$dlsrc" in
7859         '')
7860                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7861                         dflt="$dldir/dl_${osname}.xs"
7862                 elif $test "$d_dlopen" = "$define" ; then
7863                         dflt="$dldir/dl_dlopen.xs"
7864                 else
7865                         dflt=''
7866                 fi
7867                 ;;
7868         *)      dflt="$dldir/$dlsrc"
7869                 ;;
7870         esac
7871     echo "The following dynamic loading files are available:"
7872         : Can not go over to $dldir because getfile has path hard-coded in.
7873         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7874         rp="Source file to use for dynamic loading"
7875         fn="fne"
7876         gfpth="$src"
7877         . ./getfile
7878         usedl="$define"
7879         : emulate basename
7880         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7881
7882         $cat << EOM
7883
7884 Some systems may require passing special flags to $cc -c to
7885 compile modules that will be used to create a shared library.
7886 To use no flags, say "none".
7887
7888 EOM
7889     case "$cccdlflags" in
7890     '') case "$gccversion" in
7891                 '') case "$osname" in
7892                         hpux)   dflt='+z' ;;
7893                         next)   dflt='none' ;;
7894                         irix*)  dflt='-KPIC' ;;
7895                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7896                         sunos)  dflt='-pic' ;;
7897                         *)      dflt='none' ;;
7898                     esac
7899                         ;;
7900                 *)  case "$osname" in
7901                         darwin) dflt='none' ;;
7902                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7903                         *)      dflt='-fpic' ;;
7904                     esac ;;
7905             esac ;;
7906         ' ') dflt='none' ;;
7907     *)  dflt="$cccdlflags" ;;
7908     esac
7909     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7910     . ./myread
7911     case "$ans" in
7912     none) cccdlflags=' ' ;;
7913     *) cccdlflags="$ans" ;;
7914     esac
7915
7916     cat << EOM
7917
7918 Some systems use ld to create libraries that can be dynamically loaded,
7919 while other systems (such as those using ELF) use $cc.
7920
7921 EOM
7922
7923 : Determine if this is ELF
7924         $cat >try.c <<EOM
7925 /* Test for whether ELF binaries are produced */
7926 #include <fcntl.h>
7927 #$i_stdlib I_STDLIB
7928 #ifdef I_STDLIB
7929 #include <stdlib.h>
7930 #endif
7931 #$i_unistd I_UNISTD
7932 #ifdef I_UNISTD
7933 #include <unistd.h>
7934 #endif
7935 int main() {
7936         char b[4];
7937         int i = open("a.out",O_RDONLY);
7938         if(i == -1)
7939                 exit(1); /* fail */
7940         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7941                 exit(0); /* succeed (yes, it is ELF) */
7942         else
7943                 exit(1); /* fail */
7944 }
7945 EOM
7946         if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7947                 bin_ELF="$define"
7948         fi
7949         $rm_try
7950
7951         case "$ld" in
7952         '')     if $test $bin_ELF = "$define"; then
7953                         cat <<EOM
7954 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7955 EOM
7956                         dflt="$cc"
7957                 else
7958                         echo "I'll use ld to build dynamic libraries."
7959                         dflt='ld'
7960                 fi
7961                 ;;
7962         *)      dflt="$ld"
7963                 ;;
7964         esac
7965
7966     rp="What command should be used to create dynamic libraries?"
7967     . ./myread
7968         ld="$ans"
7969
7970     cat << EOM
7971
7972 Some systems may require passing special flags to $ld to create a
7973 library that can be dynamically loaded.  If your ld flags include
7974 -L/other/path options to locate libraries outside your loader's normal
7975 search path, you may need to specify those -L options here as well.  To
7976 use no flags, say "none".
7977
7978 EOM
7979     case "$lddlflags" in
7980     '') case "$osname" in
7981                         haiku) dflt='-shared' ;;
7982                         hpux) dflt='-b';
7983                               case "$gccversion" in
7984                               '') dflt="$dflt +vnocompatwarnings" ;;
7985                               esac
7986                               ;;
7987                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
7988                         next)  dflt='none' ;;
7989                         solaris) # See [perl #66604].
7990                                 # On Solaris 11, gcc -m64 on amd64 
7991                                 # appears not to understand -G.  gcc versions at
7992                                 # least as old as 3.4.3 support -shared, so just
7993                                 # use that with Solaris 11 and later, but keep
7994                                 # the old behavior for older Solaris versions.
7995                                 case "$gccversion" in
7996                                         '') dflt='-G' ;;
7997                                         *)      case "$osvers" in
7998                                                         2.?|2.10) dflt='-G' ;;
7999                                                         *) dflt='-shared' ;;
8000                                                 esac
8001                                                 ;;
8002                                 esac
8003                                 ;;
8004                         sunos) dflt='-assert nodefinitions' ;;
8005                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8006                 *)     dflt='none' ;;
8007                         esac
8008                         ;;
8009     *) dflt="$lddlflags" ;;
8010     esac
8011
8012         : Try to guess additional flags to pick up local libraries.
8013         : Be careful not to append to a plain 'none'
8014         case "$dflt" in
8015         none) dflt='' ;;
8016         esac
8017         for thisflag in $ldflags; do
8018                 case "$thisflag" in
8019                 -L*|-R*|-Wl,-R*)
8020                         case " $dflt " in
8021                         *" $thisflag "*) ;;
8022                         *) dflt="$dflt $thisflag" ;;
8023                         esac
8024                         ;;
8025                 esac
8026         done
8027
8028         case "$dflt" in
8029         ''|' ') dflt='none' ;;
8030         esac
8031
8032         case "$ldflags" in
8033         *-fstack-protector*)
8034             case "$dflt" in
8035                         *-fstack-protector*) ;; # Don't add it again
8036                         *) dflt="$dflt -fstack-protector" ;; 
8037                 esac
8038                 ;;
8039         esac
8040
8041
8042     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8043     . ./myread
8044     case "$ans" in
8045     none) lddlflags=' ' ;;
8046     *) lddlflags="$ans" ;;
8047     esac
8048
8049         cat <<EOM
8050
8051 Some systems may require passing special flags to $cc to indicate that
8052 the resulting executable will use dynamic linking.  To use no flags,
8053 say "none".
8054
8055 EOM
8056     case "$ccdlflags" in
8057     '') case "$osname" in
8058             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8059             next|sunos) dflt='none' ;;
8060             *)          dflt='none' ;;
8061             esac ;;
8062     ' ')  dflt='none' ;;
8063     *)  dflt="$ccdlflags" ;;
8064     esac
8065     rp="Any special flags to pass to $cc to use dynamic linking?"
8066     . ./myread
8067     case "$ans" in
8068     none) ccdlflags=' ' ;;
8069     *) ccdlflags="$ans" ;;
8070     esac
8071     ;;
8072 *)  usedl="$undef"
8073         ld='ld'
8074     dlsrc='dl_none.xs'
8075     lddlflags=''
8076     ccdlflags=''
8077     ;;
8078 esac
8079
8080 ld_can_script="$undef"
8081 case "$bin_ELF$usedl" in
8082 $define$define)
8083     # Abuse try.h and a.out names for neat cleanup
8084     $cat >try.c <<EOM
8085 void foo() {}
8086 void bar() {}
8087 EOM
8088     $cat >try.h <<EOM
8089 LIBTEST_42 {
8090  global:
8091   foo;
8092  local: *;
8093  };
8094 EOM
8095     if $cc $cccdlflags $ccdlflags $ccflags \
8096            $ldflags $lddlflags -o a.out try.c \
8097            -Wl,--version-script=try.h >/dev/null 2>&1 \
8098        &&  $test -s a.out ; then
8099         echo "ld supports scripting" >&4
8100         ld_can_script="$define"
8101     else
8102         echo "ld does not support scripting" >&4
8103     fi
8104     $rm_try
8105     ;;
8106 esac
8107
8108 : Do we want a shared libperl?
8109 also=''
8110 case "$usedl" in
8111 $undef)
8112         # No dynamic loading being used, so don't bother even to prompt.
8113         useshrplib='false'
8114         ;;
8115 *)      case "$useshrplib" in
8116         '')     case "$osname" in
8117                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8118                         dflt=y
8119                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8120                         ;;
8121                 next*)
8122                         case "$osvers" in
8123                         4*)     dflt=y
8124                                 also='Building a shared libperl is needed for MAB support.'
8125                                 ;;
8126                         *)      dflt=n
8127                                 ;;
8128                         esac
8129                         ;;
8130                 *)      dflt=n
8131                         ;;
8132                 esac
8133                 ;;
8134         $define|true|[Yy]*)
8135                 dflt=y
8136                 ;;
8137         *)      dflt=n
8138                 ;;
8139         esac
8140         $cat << EOM
8141
8142 The perl executable is normally obtained by linking perlmain.c with
8143 libperl${_a}, any static extensions (usually just DynaLoader), and
8144 any other libraries needed on this system (such as -lm, etc.).  Since
8145 your system supports dynamic loading, it is probably possible to build
8146 a shared libperl.$so.  If you will have more than one executable linked
8147 to libperl.$so, this will significantly reduce the size of each
8148 executable, but it may have a noticeable effect on performance.  The
8149 default is probably sensible for your system.
8150 $also
8151
8152 EOM
8153         rp="Build a shared libperl.$so (y/n)"
8154         . ./myread
8155         case "$ans" in
8156         true|$define|[Yy]*)
8157                 useshrplib='true'  ;;
8158         *)      useshrplib='false' ;;
8159         esac
8160         ;;
8161 esac
8162
8163 case "$useshrplib" in
8164 true)
8165         case "$userelocatableinc" in
8166         true|define)
8167                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8168                 echo "See INSTALL for an explanation why that won't work." >&4
8169                 exit 4
8170                 ;;
8171         esac
8172         case "$libperl" in
8173         '')
8174                 # Figure out a good name for libperl.so.  Since it gets stored in
8175                 # a version-specific architecture-dependent library, the version
8176                 # number isn't really that important, except for making cc/ld happy.
8177                 #
8178                 # A name such as libperl.so.10.1
8179                 majmin="libperl.$so.$patchlevel.$subversion"
8180                 # A name such as libperl.so.100
8181                 majonly=`echo $patchlevel $subversion |
8182                         $awk '{printf "%d%02d", $1, $2}'`
8183                 majonly=libperl.$so.$majonly
8184                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8185                 # rely on figuring it out from the naming of libc.
8186                 case "${osname}${osvers}" in
8187                 next4*)
8188                         dflt=libperl.5.$so
8189                         # XXX How handle the --version stuff for MAB?
8190                         ;;
8191                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8192                         dflt=libperl.$so
8193                         ;;
8194                 cygwin*) # ld links now against the dll directly
8195                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8196                         majonly=`echo $patchlevel $subversion |
8197                                 $awk '{printf "%03d%03d", $1, $2}'`
8198                         majonly=cygperl5.$majonly.$so
8199                         dflt=$majmin
8200                         ;;
8201                 *)      # Try to guess based on whether libc has major.minor.
8202                         case "$libc" in
8203                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8204                         *libc.$so.[0-9]*) dflt=$majonly ;;
8205                         *)      dflt=libperl.$so ;;
8206                         esac
8207                         ;;
8208                 esac
8209                 ;;
8210         *)      dflt=$libperl
8211                 ;;
8212         esac
8213         cat << EOM
8214
8215 I need to select a good name for the shared libperl.  If your system uses
8216 library names with major and minor numbers, then you might want something
8217 like $majmin.  Alternatively, if your system uses a single version
8218 number for shared libraries, then you might want to use $majonly.
8219 Or, your system might be quite happy with a simple libperl.$so.
8220
8221 Since the shared libperl will get installed into a version-specific
8222 architecture-dependent directory, the version number of the shared perl
8223 library probably isn't important, so the default should be o.k.
8224
8225 EOM
8226         rp='What name do you want to give to the shared libperl?'
8227         . ./myread
8228         libperl=$ans
8229         echo "Ok, I'll use $libperl"
8230         ;;
8231 *)
8232         libperl="libperl${_a}"
8233         ;;
8234 esac
8235
8236 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8237 case "$shrpdir" in
8238 '') ;;
8239 *)      $cat >&4 <<EOM
8240 WARNING:  Use of the shrpdir variable for the installation location of
8241 the shared $libperl is not supported.  It was never documented and
8242 will not work in this version.  Let me (perlbug@perl.org)
8243 know of any problems this may cause.
8244
8245 EOM
8246         case "$shrpdir" in
8247         "$archlibexp/CORE")
8248                 $cat >&4 <<EOM
8249 But your current setting of $shrpdir is
8250 the default anyway, so it's harmless.
8251 EOM
8252                 ;;
8253         *)
8254                 $cat >&4 <<EOM
8255 Further, your current attempted setting of $shrpdir
8256 conflicts with the value of $archlibexp/CORE
8257 that installperl will use.
8258 EOM
8259                 ;;
8260         esac
8261         ;;
8262 esac
8263
8264 # How will the perl executable find the installed shared $libperl?
8265 # Add $xxx to ccdlflags.
8266 # If we can't figure out a command-line option, use $shrpenv to
8267 # set env LD_RUN_PATH.  The main perl makefile uses this.
8268 shrpdir=$archlibexp/CORE
8269 xxx=''
8270 tmp_shrpenv=''
8271 if "$useshrplib"; then
8272     case "$osname" in
8273         aix)
8274                 # We'll set it in Makefile.SH...
8275                 ;;
8276         solaris)
8277                 xxx="-R $shrpdir"
8278                 ;;
8279         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8280                 xxx="-Wl,-R$shrpdir"
8281                 ;;
8282         bsdos|linux|irix*|dec_osf|gnu*)
8283                 xxx="-Wl,-rpath,$shrpdir"
8284                 ;;
8285         next)
8286                 # next doesn't like the default...
8287                 ;;
8288         haiku)
8289                 # Haiku doesn't like the default, either.
8290                 ;;
8291         hpux*)
8292                 # hpux doesn't like the default, either.
8293                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8294                 ;;
8295         cygwin)
8296                 # cygwin needs only ldlibpth
8297                 ;;
8298         *)
8299                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8300                 ;;
8301         esac
8302         case "$xxx" in
8303         '') ;;
8304         *)
8305                 # Only add $xxx if it isn't already in ccdlflags.
8306                 case " $ccdlflags " in
8307                 *" $xxx "*)     ;;
8308                 *)      ccdlflags="$ccdlflags $xxx"
8309                         cat <<EOM >&4
8310
8311 Adding $xxx to the flags
8312 passed to $ld so that the perl executable will find the
8313 installed shared $libperl.
8314
8315 EOM
8316                         ;;
8317                 esac
8318                 ;;
8319         esac
8320 fi
8321 # Fix ccdlflags in AIX for building external extensions.
8322 # (For building Perl itself bare -bE:perl.exp is needed,
8323 #  Makefile.SH takes care of this.)
8324 case "$osname" in
8325 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8326 esac
8327 # Respect a hint or command-line value.
8328 case "$shrpenv" in
8329 '') shrpenv="$tmp_shrpenv" ;;
8330 esac
8331 case "$ldlibpthname" in
8332 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8333 none)   ldlibpthname='' ;;
8334 esac
8335
8336 : determine where manual pages are on this system
8337 echo " "
8338 case "$sysman" in
8339 '')
8340         syspath='/usr/share/man/man1 /usr/man/man1'
8341         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8342         syspath="$syspath /usr/man/u_man/man1"
8343         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8344         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8345         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8346         sysman=`./loc . /usr/man/man1 $syspath`
8347         ;;
8348 esac
8349 if $test -d "$sysman"; then
8350         echo "System manual is in $sysman." >&4
8351 else
8352         echo "Could not find manual pages in source form." >&4
8353 fi
8354
8355 : determine where manual pages go
8356 set man1dir man1dir none
8357 eval $prefixit
8358 $cat <<EOM
8359
8360 $spackage has manual pages available in source form.
8361 EOM
8362 case "$nroff" in
8363 nroff)
8364         echo "However, you don't have nroff, so they're probably useless to you."
8365         case "$man1dir" in
8366         '') man1dir="none";;
8367         esac;;
8368 esac
8369 echo "If you don't want the manual sources installed, answer 'none'."
8370 case "$man1dir" in
8371 ' ') dflt=none
8372         ;;
8373 '')
8374         lookpath="$prefixexp/share/man/man1"
8375         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8376         lookpath="$lookpath $prefixexp/man/p_man/man1"
8377         lookpath="$lookpath $prefixexp/man/u_man/man1"
8378         lookpath="$lookpath $prefixexp/man/man.1"
8379         case "$sysman" in
8380         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8381         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8382         esac
8383         set dflt
8384         eval $prefixup
8385         ;;
8386 *)  dflt="$man1dir"
8387         ;;
8388 esac
8389 echo " "
8390 fn=dn+~
8391 rp="Where do the main $spackage manual pages (source) go?"
8392 . ./getfile
8393 if $test "X$man1direxp" != "X$ansexp"; then
8394         installman1dir=''
8395 fi
8396 prefixvar=man1dir
8397 . ./setprefixvar
8398
8399 case "$man1dir" in
8400 '')     man1dir=' '
8401         installman1dir='';;
8402 esac
8403
8404 : What suffix to use on installed man pages
8405
8406 case "$man1dir" in
8407 ' ')
8408         man1ext='0'
8409         ;;
8410 *)
8411         rp="What suffix should be used for the main $spackage man pages?"
8412         case "$man1ext" in
8413         '')     case "$man1dir" in
8414                 *1)  dflt=1 ;;
8415                 *1p) dflt=1p ;;
8416                 *1pm) dflt=1pm ;;
8417                 *l) dflt=l;;
8418                 *n) dflt=n;;
8419                 *o) dflt=o;;
8420                 *p) dflt=p;;
8421                 *C) dflt=C;;
8422                 *L) dflt=L;;
8423                 *L1) dflt=L1;;
8424                 *) dflt=1;;
8425                 esac
8426                 ;;
8427         *)      dflt="$man1ext";;
8428         esac
8429         . ./myread
8430         man1ext="$ans"
8431         ;;
8432 esac
8433
8434 : see if we can have long filenames
8435 echo " "
8436 first=123456789abcdef
8437 $rm -f $first
8438 if (echo hi >$first) 2>/dev/null; then
8439         if $test -f 123456789abcde; then
8440                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8441                 val="$undef"
8442         else
8443                 echo 'You can have filenames longer than 14 characters.'>&4
8444                 val="$define"
8445         fi
8446 else
8447         $cat <<'EOM'
8448 You can't have filenames longer than 14 chars.
8449 You can't even think about them!
8450 EOM
8451         val="$undef"
8452 fi
8453 set d_flexfnam
8454 eval $setvar
8455 $rm -rf 123456789abcde*
8456
8457 : determine where library module manual pages go
8458 set man3dir man3dir none
8459 eval $prefixit
8460 $cat <<EOM
8461
8462 $spackage has manual pages for many of the library modules.
8463 EOM
8464
8465 case "$nroff" in
8466 nroff)
8467         $cat <<'EOM'
8468 However, you don't have nroff, so they're probably useless to you.
8469 EOM
8470         case "$man3dir" in
8471         '') man3dir="none";;
8472         esac;;
8473 esac
8474
8475 case "$d_flexfnam" in
8476 undef)
8477         $cat <<'EOM'
8478 However, your system can't handle the long file names like File::Basename.3.
8479 EOM
8480         case "$man3dir" in
8481         '') man3dir="none";;
8482         esac;;
8483 esac
8484
8485 echo "If you don't want the manual sources installed, answer 'none'."
8486 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8487 case "$man3dir" in
8488 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8489         if $test -d "$privlib/man/man3"; then
8490                 cat <<EOM >&4
8491
8492 WARNING:  Previous versions of perl installed man3 pages into
8493 $privlib/man/man3.  This version will suggest a
8494 new default of $dflt.
8495 EOM
8496                 tdflt=$dflt
8497                 dflt='n'
8498                 rp='Do you wish to preserve the old behavior?(y/n)'
8499                 . ./myread
8500                 case "$ans" in
8501                 y*) dflt="$privlib/man/man3" ;;
8502                 *)  dflt=$tdflt ;;
8503                 esac
8504     fi
8505         ;;
8506 *)      dflt="$man3dir" ;;
8507 esac
8508 case "$dflt" in
8509 ' ') dflt=none ;;
8510 esac
8511 echo " "
8512 fn=dn+~
8513 rp="Where do the $package library man pages (source) go?"
8514 . ./getfile
8515 prefixvar=man3dir
8516 . ./setprefixvar
8517
8518 case "$man3dir" in
8519 '')     man3dir=' '
8520         installman3dir='';;
8521 esac
8522
8523 : What suffix to use on installed man pages
8524 case "$man3dir" in
8525 ' ')
8526         man3ext='0'
8527         ;;
8528 *)
8529         rp="What suffix should be used for the $package library man pages?"
8530         case "$man3ext" in
8531         '')     case "$man3dir" in
8532                 *3)  dflt=3 ;;
8533                 *3p) dflt=3p ;;
8534                 *3pm) dflt=3pm ;;
8535                 *l) dflt=l;;
8536                 *n) dflt=n;;
8537                 *o) dflt=o;;
8538                 *p) dflt=p;;
8539                 *C) dflt=C;;
8540                 *L) dflt=L;;
8541                 *L3) dflt=L3;;
8542                 *) dflt=3;;
8543                 esac
8544                 ;;
8545         *)      dflt="$man3ext";;
8546         esac
8547         . ./myread
8548         man3ext="$ans"
8549         ;;
8550 esac
8551
8552 : see if we have to deal with yellow pages, now NIS.
8553 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8554         if $test -f /usr/etc/nibindd; then
8555                 echo " "
8556                 echo "I'm fairly confident you're on a NeXT."
8557                 echo " "
8558                 rp='Do you get the hosts file via NetInfo?'
8559                 dflt=y
8560                 case "$hostcat" in
8561                 nidump*) ;;
8562                 '') ;;
8563                 *) dflt=n;;
8564                 esac
8565                 . ./myread
8566                 case "$ans" in
8567                 y*) hostcat='nidump hosts .';;
8568                 *)      case "$hostcat" in
8569                         nidump*) hostcat='';;
8570                         esac
8571                         ;;
8572                 esac
8573         fi
8574         case "$hostcat" in
8575         nidump*) ;;
8576         *)
8577                 case "$hostcat" in
8578                 *ypcat*) dflt=y;;
8579                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8580                                 dflt=y
8581                         else
8582                                 dflt=n
8583                         fi;;
8584                 *) dflt=n;;
8585                 esac
8586                 echo " "
8587                 rp='Are you getting the hosts file via yellow pages?'
8588                 . ./myread
8589                 case "$ans" in
8590                 y*) hostcat='ypcat hosts';;
8591                 *) hostcat='cat /etc/hosts';;
8592                 esac
8593                 ;;
8594         esac
8595 fi
8596 case "$hostcat" in
8597 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8598 esac
8599 case "$groupcat" in
8600 '') test -f /etc/group && groupcat='cat /etc/group';;
8601 esac
8602 case "$passcat" in
8603 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8604 esac
8605
8606 : now get the host name
8607 echo " "
8608 echo "Figuring out host name..." >&4
8609 case "$myhostname" in
8610 '') cont=true
8611         echo 'Maybe "hostname" will work...'
8612         if tans=`sh -c hostname 2>&1` ; then
8613                 myhostname=$tans
8614                 phostname=hostname
8615                 cont=''
8616         fi
8617         ;;
8618 *) cont='';;
8619 esac
8620 if $test "$cont"; then
8621         if ./xenix; then
8622                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8623                 if tans=`cat /etc/systemid 2>&1` ; then
8624                         myhostname=$tans
8625                         phostname='cat /etc/systemid'
8626                         echo "Whadyaknow.  Xenix always was a bit strange..."
8627                         cont=''
8628                 fi
8629         elif $test -r /etc/systemid; then
8630                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8631         fi
8632 fi
8633 if $test "$cont"; then
8634         echo 'No, maybe "uuname -l" will work...'
8635         if tans=`sh -c 'uuname -l' 2>&1` ; then
8636                 myhostname=$tans
8637                 phostname='uuname -l'
8638         else
8639                 echo 'Strange.  Maybe "uname -n" will work...'
8640                 if tans=`sh -c 'uname -n' 2>&1` ; then
8641                         myhostname=$tans
8642                         phostname='uname -n'
8643                 else
8644                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8645                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8646                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8647                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8648                         else
8649                                 case "$myhostname" in
8650                                 '') echo "Does this machine have an identity crisis or something?"
8651                                         phostname='';;
8652                                 *)
8653                                         echo "Well, you said $myhostname before..."
8654                                         phostname='echo $myhostname';;
8655                                 esac
8656                         fi
8657                 fi
8658         fi
8659 fi
8660 case "$myhostname" in
8661 '') myhostname=noname ;;
8662 esac
8663 : you do not want to know about this
8664 set $myhostname
8665 myhostname=$1
8666
8667 : verify guess
8668 if $test "$myhostname" ; then
8669         dflt=y
8670         rp='Your host name appears to be "'$myhostname'".'" Right?"
8671         . ./myread
8672         case "$ans" in
8673         y*) ;;
8674         *) myhostname='';;
8675         esac
8676 fi
8677
8678 : bad guess or no guess
8679 while $test "X$myhostname" = X ; do
8680         dflt=''
8681         rp="Please type the (one word) name of your host:"
8682         . ./myread
8683         myhostname="$ans"
8684 done
8685
8686 : translate upper to lower if necessary
8687 case "$myhostname" in
8688 *[A-Z]*)
8689         echo "(Normalizing case in your host name)"
8690         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8691         ;;
8692 esac
8693
8694 case "$myhostname" in
8695 *.*)
8696         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8697         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8698         echo "(Trimming domain name from host name--host name is now $myhostname)"
8699         ;;
8700 *) case "$mydomain" in
8701         '')
8702                 {
8703                         test "X$hostcat" = "Xypcat hosts" &&
8704                         ypmatch "$myhostname" hosts 2>/dev/null |\
8705                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8706                         $test -s hosts
8707                 } || {
8708                         test "X$hostcat" != "X" &&
8709                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8710                                         /[       ]$myhostname[  . ]/p" > hosts
8711                 }
8712                 tmp_re="[       . ]"
8713                 if $test -f hosts; then
8714                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8715                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8716                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8717                                 hosts | $sort | $uniq | \
8718                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8719                         case `$echo X$dflt` in
8720                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8721                                 dflt=.
8722                                 ;;
8723                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8724                                 ;;
8725                         esac
8726                 else
8727                         echo "(I cannot locate a hosts database anywhere)"
8728                         dflt=.
8729                 fi
8730                 case "$dflt" in
8731                 .)
8732                         tans=`./loc resolv.conf X /etc /usr/etc`
8733                         if $test -f "$tans"; then
8734                                 echo "(Attempting domain name extraction from $tans)"
8735                                 dflt=.`$sed -n -e 's/   / /g' \
8736                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8737                                   -e 1q 2>/dev/null`
8738                                 case "$dflt" in
8739                                 .) dflt=.`$sed -n -e 's/        / /g' \
8740                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8741                                      -e 1q 2>/dev/null`
8742                                         ;;
8743                                 esac
8744                         fi
8745                         ;;
8746                 esac
8747                 case "$dflt" in
8748                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8749                         dflt=.`sh -c domainname 2>/dev/null`
8750                         case "$dflt" in
8751                         '') dflt='.';;
8752                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8753                         esac
8754                         ;;
8755                 esac
8756                 case "$dflt$osname" in
8757                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8758                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8759                         ;;
8760                 esac
8761                 case "$dflt" in
8762                 .) echo "(Lost all hope -- silly guess then)"
8763                         dflt='.nonet'
8764                         ;;
8765                 esac
8766                 $rm -f hosts
8767                 ;;
8768         *) dflt="$mydomain";;
8769         esac;;
8770 esac
8771 echo " "
8772 rp="What is your domain name?"
8773 . ./myread
8774 tans="$ans"
8775 case "$ans" in
8776 '') ;;
8777 .*) ;;
8778 *) tans=".$tans";;
8779 esac
8780 mydomain="$tans"
8781
8782 : translate upper to lower if necessary
8783 case "$mydomain" in
8784 *[A-Z]*)
8785         echo "(Normalizing case in your domain name)"
8786         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8787         ;;
8788 esac
8789
8790 : a little sanity check here
8791 case "$phostname" in
8792 '') ;;
8793 *)
8794         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8795         $myhostname$mydomain|$myhostname) ;;
8796         *)
8797                 case "$phostname" in
8798                 sed*)
8799                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8800                         ;;
8801                 *)
8802                         echo "(That doesn't agree with your $phostname command, by the way.)"
8803                         ;;
8804                 esac
8805         ;;
8806         esac
8807         ;;
8808 esac
8809
8810 : determine the e-mail address of the user who is running us
8811 $cat <<EOM
8812
8813 I need to get your e-mail address in Internet format if possible, i.e.
8814 something like user@host.domain. Please answer accurately since I have
8815 no easy means to double check it. The default value provided below
8816 is most probably close to reality but may not be valid from outside
8817 your organization...
8818
8819 EOM
8820 cont=x
8821 while test "$cont"; do
8822         case "$MAILDOMAIN" in
8823         '')
8824                 if $test -s /etc/mailname; then
8825                         maildomain=`$cat /etc/mailname`
8826                 else
8827                         maildomain="$myhostname$mydomain"
8828                 fi
8829                 ;;
8830         *)  maildomain="$MAILDOMAIN";;
8831         esac
8832         case "$cf_email" in
8833         '') dflt="$cf_by@$maildomain";;
8834         *)  dflt="$cf_email";;
8835         esac
8836         rp='What is your e-mail address?'
8837         . ./myread
8838         cf_email="$ans"
8839         case "$cf_email" in
8840         *@*.*) cont='' ;;
8841         *)
8842                 rp='Address does not look like an Internet one.  Use it anyway?'
8843                 case "$fastread" in
8844                 yes) dflt=y ;;
8845                 *) dflt=n ;;
8846                 esac
8847                 . ./myread
8848                 case "$ans" in
8849                 y*) cont='' ;;
8850                 *) echo " " ;;
8851                 esac
8852                 ;;
8853         esac
8854 done
8855
8856 : Ask e-mail of administrator
8857 $cat <<EOM
8858
8859 If you or somebody else will be maintaining perl at your site, please
8860 fill in the correct e-mail address here so that they may be contacted
8861 if necessary. Currently, the "perlbug" program included with perl
8862 will send mail to this address in addition to perlbug@perl.org. You may
8863 enter "none" for no administrator.
8864
8865 EOM
8866 case "$perladmin" in
8867 '') dflt="$cf_email";;
8868 *) dflt="$perladmin";;
8869 esac
8870 rp='Perl administrator e-mail address'
8871 . ./myread
8872 perladmin="$ans"
8873
8874 : determine whether to only install version-specific parts.
8875 echo " "
8876 $cat <<EOM
8877 Do you want to install only the version-specific parts of the perl
8878 distribution?  Usually you do *not* want to do this.
8879 EOM
8880 case "$versiononly" in
8881 "$define"|[Yy]*|true) dflt='y' ;;
8882 *) dflt='n';
8883 esac
8884 rp="Do you want to install only the version-specific parts of perl?"
8885 . ./myread
8886 case "$ans" in
8887 [yY]*)  val="$define";;
8888 *)      val="$undef" ;;
8889 esac
8890 set versiononly
8891 eval $setvar
8892
8893 case "$versiononly" in
8894 "$define") inc_version_list=''
8895            inc_version_list_init=0
8896            ;;
8897 esac
8898
8899 : figure out how to guarantee perl startup
8900 : XXX Note that this currently takes advantage of the bug that binexp ignores
8901 :     the Configure -Dinstallprefix setting, which in turn means that under
8902 :     relocatable @INC, initialinstalllocation is what binexp started as.
8903 case "$startperl" in
8904 '')
8905         case "$sharpbang" in
8906         *!)
8907                 $cat <<EOH
8908
8909 I can use the #! construct to start perl on your system. This will
8910 make startup of perl scripts faster, but may cause problems if you
8911 want to share those scripts and perl is not in a standard place
8912 ($initialinstalllocation/perl) on all your platforms. The alternative
8913 is to force a shell by starting the script with a single ':' character.
8914
8915 EOH
8916                 case "$versiononly" in
8917                 "$define")      dflt="$initialinstalllocation/perl$version";;
8918                 *)              dflt="$initialinstalllocation/perl";;
8919                 esac
8920                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8921                 . ./myread
8922                 case "$ans" in
8923                 none)   startperl=": # use perl";;
8924                 *)      startperl="#!$ans"
8925                         if $test 30 -lt `echo "$ans" | wc -c`; then
8926                                 $cat >&4 <<EOM
8927
8928 WARNING:  Some systems limit the #! command to 32 characters.
8929 If you experience difficulty running Perl scripts with #!, try
8930 installing Perl in a directory with a shorter pathname.
8931
8932 EOM
8933                         fi ;;
8934                 esac
8935                 ;;
8936         *) startperl=": # use perl"
8937                 ;;
8938         esac
8939         ;;
8940 esac
8941 echo "I'll use $startperl to start perl scripts."
8942
8943 : figure best path for perl in scripts
8944 case "$perlpath" in
8945 '')
8946         case "$versiononly" in
8947         "$define")      perlpath="$initialinstalllocation/perl$version";;
8948         *)              perlpath="$initialinstalllocation/perl";;
8949         esac
8950         case "$startperl" in
8951         *!*) ;;
8952         *)
8953                 $cat <<EOH
8954
8955 I will use the "eval 'exec'" idiom to start Perl on your system.
8956 I can use the full path of your Perl binary for this purpose, but
8957 doing so may cause problems if you want to share those scripts and
8958 Perl is not always in a standard place ($initialinstalllocation/perl).
8959
8960 EOH
8961                 dflt="$initialinstalllocation/perl"
8962                 rp="What path shall I use in \"eval 'exec'\"?"
8963                 . ./myread
8964                 perlpath="$ans"
8965                 ;;
8966         esac
8967         ;;
8968 esac
8969 case "$startperl" in
8970 *!*)    ;;
8971 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8972 esac
8973
8974 : determine where public executable scripts go
8975 set scriptdir scriptdir
8976 eval $prefixit
8977 case "$scriptdir" in
8978 '')
8979         dflt="$bin"
8980         : guess some guesses
8981         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8982         $test -d /usr/share/bin     && dflt=/usr/share/bin
8983         $test -d /usr/local/script  && dflt=/usr/local/script
8984         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8985         $test -d $prefixexp/script  && dflt=$prefixexp/script
8986         set dflt
8987         eval $prefixup
8988         ;;
8989 *)  dflt="$scriptdir"
8990         ;;
8991 esac
8992 $cat <<EOM
8993
8994 Some installations have a separate directory just for executable scripts so
8995 that they can mount it across multiple architectures but keep the scripts in
8996 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8997 Or you might just lump your scripts in with all your other executables.
8998
8999 EOM
9000 fn=d~
9001 rp='Where do you keep publicly executable scripts?'
9002 . ./getfile
9003 if $test "X$ansexp" != "X$scriptdirexp"; then
9004         installscript=''
9005 fi
9006 installscriptdir=''
9007 prefixvar=scriptdir
9008 . ./setprefixvar
9009 : A little fix up for an irregularly named variable.
9010 installscript="$installscriptdir"
9011
9012 : determine where add-on public executables go
9013 case "$sitebin" in
9014 '')     dflt=$siteprefix/bin ;;
9015 *)      dflt=$sitebin ;;
9016 esac
9017 fn=d~
9018 rp='Pathname where the add-on public executables should be installed?'
9019 . ./getfile
9020 prefixvar=sitebin
9021 . ./setprefixvar
9022
9023 : determine where add-on html pages go
9024 : There is no standard location, so try to copy the previously-selected
9025 : directory structure for the core html pages.
9026 case "$sitehtml1dir" in
9027 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9028 *)     dflt=$sitehtml1dir ;;
9029 esac
9030 case "$dflt" in
9031 ''|' ') dflt=none ;;
9032 esac
9033 fn=dn+~
9034 rp='Pathname where the site-specific html pages should be installed?'
9035 . ./getfile
9036 prefixvar=sitehtml1dir
9037 . ./setprefixvar
9038
9039 : determine where add-on library html pages go
9040 : There is no standard location, so try to copy the previously-selected
9041 : directory structure for the core html pages.
9042 case "$sitehtml3dir" in
9043 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9044 *)     dflt=$sitehtml3dir ;;
9045 esac
9046 case "$dflt" in
9047 ''|' ') dflt=none ;;
9048 esac
9049 fn=dn+~
9050 rp='Pathname where the site-specific library html pages should be installed?'
9051 . ./getfile
9052 prefixvar=sitehtml3dir
9053 . ./setprefixvar
9054
9055 : determine where add-on manual pages go
9056 case "$siteman1dir" in
9057 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9058 *)      dflt=$siteman1dir ;;
9059 esac
9060 case "$dflt" in
9061 ''|' ') dflt=none ;;
9062 esac
9063 fn=dn+~
9064 rp='Pathname where the site-specific manual pages should be installed?'
9065 . ./getfile
9066 prefixvar=siteman1dir
9067 . ./setprefixvar
9068
9069 : determine where add-on library man pages go
9070 case "$siteman3dir" in
9071 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9072 *)      dflt=$siteman3dir ;;
9073 esac
9074 case "$dflt" in
9075 ''|' ') dflt=none ;;
9076 esac
9077 fn=dn+~
9078 rp='Pathname where the site-specific library manual pages should be installed?'
9079 . ./getfile
9080 prefixvar=siteman3dir
9081 . ./setprefixvar
9082
9083 : determine where add-on public executable scripts go
9084 case "$sitescript" in
9085 '')     dflt=$siteprefix/script
9086         $test -d $dflt || dflt=$sitebin ;;
9087 *)  dflt="$sitescript" ;;
9088 esac
9089 fn=d~+
9090 rp='Pathname where add-on public executable scripts should be installed?'
9091 . ./getfile
9092 prefixvar=sitescript
9093 . ./setprefixvar
9094
9095 : Check if faststdio is requested and available
9096 case "$usefaststdio" in
9097 $define|true|[yY]*|'')
9098         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9099         case "$xversion" in
9100         [68])   dflt='y' ;;
9101         *)      dflt='n' ;;
9102         esac
9103         ;;
9104 *) dflt='n';;
9105 esac
9106 cat <<EOM
9107
9108 Perl can be built to use 'fast stdio', which means using the stdio
9109 library but also directly manipulating the stdio buffers to enable
9110 faster I/O.  Using stdio is better for backward compatibility (especially
9111 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9112 interface has been preferred instead of stdio.
9113
9114 If this doesn't make any sense to you, just accept the default '$dflt'.
9115 EOM
9116 rp='Use the "fast stdio" if available?'
9117 . ./myread
9118 case "$ans" in
9119 y|Y)    val="$define" ;;
9120 *)      val="$undef" ;;
9121 esac
9122 set usefaststdio
9123 eval $setvar
9124
9125
9126 : define an is-a-typedef? function
9127 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9128 case "$inclist" in
9129 "") inclist="sys/types.h";;
9130 esac;
9131 eval "varval=\$$var";
9132 case "$varval" in
9133 "")
9134         $rm -f temp.c;
9135         for inc in $inclist; do
9136                 echo "#include <$inc>" >>temp.c;
9137         done;
9138         echo "#ifdef $type" >> temp.c;
9139         echo "printf(\"We have $type\");" >> temp.c;
9140         echo "#endif" >> temp.c;
9141         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9142         if $contains $type temp.E >/dev/null 2>&1; then
9143                 eval "$var=\$type";
9144         else
9145                 eval "$var=\$def";
9146         fi;
9147         $rm -f temp.?;;
9148 *) eval "$var=\$varval";;
9149 esac'
9150
9151 : define an is-a-typedef? function that prompts if the type is not available.
9152 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9153 case "$inclist" in
9154 "") inclist="sys/types.h";;
9155 esac;
9156 eval "varval=\$$var";
9157 case "$varval" in
9158 "")
9159         $rm -f temp.c;
9160         for inc in $inclist; do
9161                 echo "#include <$inc>" >>temp.c;
9162         done;
9163         echo "#ifdef $type" >> temp.c;
9164         echo "printf(\"We have $type\");" >> temp.c;
9165         echo "#endif" >> temp.c;
9166         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9167         echo " " ;
9168         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9169         if $contains $type temp.E >/dev/null 2>&1; then
9170                 echo "$type found." >&4;
9171                 eval "$var=\$type";
9172         else
9173                 echo "$type NOT found." >&4;
9174                 dflt="$def";
9175                 . ./myread ;
9176                 eval "$var=\$ans";
9177         fi;
9178         $rm -f temp.?;;
9179 *) eval "$var=\$varval";;
9180 esac'
9181
9182 : see what type lseek is declared as in the kernel
9183 rp="What is the type used for lseek's offset on this system?"
9184 set off_t lseektype long stdio.h sys/types.h
9185 eval $typedef_ask
9186
9187 echo " "
9188 echo "Checking to see how big your file offsets are..." >&4
9189 $cat >try.c <<EOCP
9190 #include <sys/types.h>
9191 #include <stdio.h>
9192 int main()
9193 {
9194     printf("%d\n", (int)sizeof($lseektype));
9195     return(0);
9196 }
9197 EOCP
9198 set try
9199 if eval $compile_ok; then
9200         lseeksize=`$run ./try`
9201         echo "Your file offsets are $lseeksize bytes long."
9202 else
9203         dflt=$longsize
9204         echo " "
9205         echo "(I can't seem to compile the test program.  Guessing...)"
9206         rp="What is the size of your file offsets (in bytes)?"
9207         . ./myread
9208         lseeksize="$ans"
9209 fi
9210 $rm_try
9211
9212 : see what type file positions are declared as in the library
9213 rp="What is the type for file position used by fsetpos()?"
9214 set fpos_t fpostype long stdio.h sys/types.h
9215 eval $typedef_ask
9216
9217 : Check size for Fpos_t
9218 echo " "
9219 case "$fpostype" in
9220 *_t) zzz="$fpostype"    ;;
9221 *)   zzz="fpos_t"       ;;
9222 esac
9223 echo "Checking the size of $zzz..." >&4
9224 cat > try.c <<EOCP
9225 #include <sys/types.h>
9226 #include <stdio.h>
9227 #$i_stdlib I_STDLIB
9228 #ifdef I_STDLIB
9229 #include <stdlib.h>
9230 #endif
9231 int main() {
9232     printf("%d\n", (int)sizeof($fpostype));
9233     exit(0);
9234 }
9235 EOCP
9236 set try
9237 if eval $compile_ok; then
9238         yyy=`$run ./try`
9239         case "$yyy" in
9240         '')     fpossize=4
9241                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9242                 ;;
9243         *)      fpossize=$yyy
9244                 echo "Your $zzz is $fpossize bytes long."
9245                 ;;
9246         esac
9247 else
9248         dflt="$longsize"
9249         echo " " >&4
9250         echo "(I can't compile the test program.  Guessing...)" >&4
9251         rp="What is the size of your file positions (in bytes)?"
9252         . ./myread
9253         fpossize="$ans"
9254 fi
9255
9256 : Check for large file support
9257 # Backward compatibility (uselfs is deprecated).
9258 case "$uselfs" in
9259 "$define"|true|[yY]*)
9260         cat <<EOM >&4
9261
9262 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9263 EOM
9264         uselargefiles="$define"
9265         ;;
9266 esac
9267
9268 case "$lseeksize:$fpossize" in
9269 8:8) cat <<EOM
9270
9271 You can have files larger than 2 gigabytes.
9272 EOM
9273    val="$define" ;;
9274 *)    case "$uselargefiles" in
9275    "$undef"|false|[nN]*) dflt='n' ;;
9276    *)   dflt='y' ;;
9277    esac
9278    cat <<EOM
9279
9280 Perl can be built to understand large files (files larger than 2 gigabytes)
9281 on some systems.  To do so, Configure can be run with -Duselargefiles.
9282
9283 If this doesn't make any sense to you, just accept the default '$dflt'.
9284 EOM
9285    rp='Try to understand large files, if available?'
9286    . ./myread
9287    case "$ans" in
9288    y|Y)         val="$define" ;;
9289    *)           val="$undef"  ;;
9290    esac
9291    ;;
9292 esac
9293 set uselargefiles
9294 eval $setvar
9295 : Look for a hint-file generated 'call-back-unit'.  If the
9296 : user has specified that a large files perl is to be built,
9297 : we may need to set or change some other defaults.
9298 if $test -f uselargefiles.cbu; then
9299         echo "Your platform has some specific hints regarding large file builds, using them..."
9300         . ./uselargefiles.cbu
9301 fi
9302 case "$uselargefiles" in
9303 "$define")
9304         if $test -f uselargefiles.cbu; then
9305                 echo " "
9306                 echo "Rechecking to see how big your file offsets are..." >&4
9307                 $cat >try.c <<EOCP
9308 #include <sys/types.h>
9309 #include <stdio.h>
9310 int main()
9311 {
9312     printf("%d\n", (int)sizeof($lseektype));
9313     return(0);
9314 }
9315 EOCP
9316                 set try
9317                 if eval $compile_ok; then
9318                         lseeksize=`$run ./try`
9319                         $echo "Your file offsets are now $lseeksize bytes long."
9320                 else
9321                         dflt="$lseeksize"
9322                         echo " "
9323                         echo "(I can't seem to compile the test program.  Guessing...)"
9324                         rp="What is the size of your file offsets (in bytes)?"
9325                         . ./myread
9326                         lseeksize="$ans"
9327                 fi
9328                 case "$fpostype" in
9329                 *_t) zzz="$fpostype"    ;;
9330                 *)   zzz="fpos_t"       ;;
9331                 esac
9332                 $echo $n "Rechecking the size of $zzz...$c" >&4
9333                 $cat > try.c <<EOCP
9334 #include <sys/types.h>
9335 #include <stdio.h>
9336 #$i_stdlib I_STDLIB
9337 #ifdef I_STDLIB
9338 #include <stdlib.h>
9339 #endif
9340 int main() {
9341     printf("%d\n", (int)sizeof($fpostype));
9342     return(0);
9343 }
9344 EOCP
9345                 set try
9346                 if eval $compile_ok; then
9347                         yyy=`$run ./try`
9348                         dflt="$lseeksize"
9349                         case "$yyy" in
9350                         '')     echo " "
9351                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9352                                 ;;
9353                         *)      fpossize=$yyy
9354                                 echo " $fpossize bytes." >&4
9355                                 ;;
9356                         esac
9357                 else
9358                         dflt="$fpossize"
9359                         echo " "
9360                         echo "(I can't compile the test program.  Guessing...)" >&4
9361                         rp="What is the size of your file positions (in bytes)?"
9362                         . ./myread
9363                         fpossize="$ans"
9364                 fi
9365                 $rm_try
9366         fi
9367         ;;
9368 esac
9369
9370 : Check if we want perlio
9371 useperlio="$define"
9372
9373 : Set the vendorbin variables
9374 case "$vendorprefix" in
9375 '')     d_vendorbin="$undef"
9376         vendorbin=''
9377         vendorbinexp=''
9378         ;;
9379 *)      d_vendorbin="$define"
9380         : determine where vendor-supplied executables go.
9381         case "$vendorbin" in
9382         '') dflt=$vendorprefix/bin ;;
9383         *)      dflt="$vendorbin" ;;
9384         esac
9385         fn=d~+
9386         rp='Pathname for the vendor-supplied executables directory?'
9387         . ./getfile
9388         vendorbin="$ans"
9389         vendorbinexp="$ansexp"
9390         ;;
9391 esac
9392 prefixvar=vendorbin
9393 . ./installprefix
9394
9395 : Set the vendorhtml1dir variables
9396 case "$vendorprefix" in
9397 '')     vendorhtml1dir=''
9398         vendorhtml1direxp=''
9399         ;;
9400 *)      : determine where vendor-supplied html pages go.
9401         : There is no standard location, so try to copy the previously-selected
9402         : directory structure for the core html pages.
9403         : XXX Better default suggestions would be welcome.
9404         case "$vendorhtml1dir" in
9405         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9406         *)      dflt=$vendorhtml1dir ;;
9407         esac
9408         case "$dflt" in
9409         ''|' ') dflt=none ;;
9410         esac
9411         fn=dn+~
9412         rp='Pathname for the vendor-supplied html pages?'
9413         . ./getfile
9414         vendorhtml1dir="$ans"
9415         vendorhtml1direxp="$ansexp"
9416         ;;
9417 esac
9418 : Use ' ' for none so value is preserved next time through Configure
9419 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9420 prefixvar=vendorhtml1dir
9421 . ./installprefix
9422
9423 : Set the vendorhtml3dir variables
9424 case "$vendorprefix" in
9425 '')     vendorhtml3dir=''
9426         vendorhtml3direxp=''
9427         ;;
9428 *)      : determine where vendor-supplied module html pages go.
9429         : There is no standard location, so try to copy the previously-selected
9430         : directory structure for the core html pages.
9431         : XXX Better default suggestions would be welcome.
9432         case "$vendorhtml3dir" in
9433         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9434         *)      dflt=$vendorhtml3dir ;;
9435         esac
9436         case "$dflt" in
9437         ''|' ') dflt=none ;;
9438         esac
9439         fn=dn+~
9440         rp='Pathname for the vendor-supplied html pages?'
9441         . ./getfile
9442         vendorhtml3dir="$ans"
9443         vendorhtml3direxp="$ansexp"
9444         ;;
9445 esac
9446 : Use ' ' for none so value is preserved next time through Configure
9447 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9448 prefixvar=vendorhtml3dir
9449 . ./installprefix
9450
9451 : Set the vendorman1dir variables
9452 case "$vendorprefix" in
9453 '')     vendorman1dir=''
9454         vendorman1direxp=''
9455         ;;
9456 *)      : determine where vendor-supplied manual pages go.
9457         case "$vendorman1dir" in
9458         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9459         *)      dflt=$vendorman1dir ;;
9460         esac
9461         case "$dflt" in
9462         ''|' ') dflt=none ;;
9463         esac
9464         fn=nd~+
9465         rp='Pathname for the vendor-supplied manual section 1 pages?'
9466         . ./getfile
9467         vendorman1dir="$ans"
9468         vendorman1direxp="$ansexp"
9469         ;;
9470 esac
9471 : Use ' ' for none so value is preserved next time through Configure
9472 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9473 prefixvar=vendorman1dir
9474 . ./installprefix
9475
9476 : Set the vendorman3dir variables
9477 case "$vendorprefix" in
9478 '')     vendorman3dir=''
9479         vendorman3direxp=''
9480         ;;
9481 *)      : determine where vendor-supplied module manual pages go.
9482         case "$vendorman3dir" in
9483         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9484         *)      dflt=$vendorman3dir ;;
9485         esac
9486         case "$dflt" in
9487         ''|' ') dflt=none ;;
9488         esac
9489         fn=nd~+
9490         rp='Pathname for the vendor-supplied manual section 3 pages?'
9491         . ./getfile
9492         vendorman3dir="$ans"
9493         vendorman3direxp="$ansexp"
9494         ;;
9495 esac
9496 : Use ' ' for none so value is preserved next time through Configure
9497 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9498 prefixvar=vendorman3dir
9499 . ./installprefix
9500
9501 : Set the vendorscript variables
9502 case "$vendorprefix" in
9503 '')     d_vendorscript="$undef"
9504         vendorscript=''
9505         vendorscriptexp=''
9506         ;;
9507 *)      d_vendorscript="$define"
9508         : determine where vendor-supplied scripts go.
9509         case "$vendorscript" in
9510         '')     dflt=$vendorprefix/script
9511                 $test -d $dflt || dflt=$vendorbin ;;
9512         *)  dflt="$vendorscript" ;;
9513         esac
9514         $cat <<EOM
9515
9516 The installation process will create a directory for
9517 vendor-supplied scripts.
9518
9519 EOM
9520         fn=d~+
9521         rp='Pathname for the vendor-supplied scripts directory?'
9522         . ./getfile
9523         vendorscript="$ans"
9524         vendorscriptexp="$ansexp"
9525         ;;
9526 esac
9527 prefixvar=vendorscript
9528 . ./installprefix
9529
9530 : script used to emit important warnings
9531 cat >warn <<EOS
9532 $startsh
9533 if test \$# -gt 0; then
9534         echo "\$@" >msg
9535 else
9536         cat >msg
9537 fi
9538 echo "*** WARNING:" >&4
9539 sed -e 's/^/*** /' <msg >&4
9540 echo "*** " >&4
9541 cat msg >>config.msg
9542 echo " " >>config.msg
9543 rm -f msg
9544 EOS
9545 chmod +x warn
9546 $eunicefix warn
9547
9548 : see which of string.h or strings.h is needed
9549 echo " "
9550 strings=`./findhdr string.h`
9551 if $test "$strings" && $test -r "$strings"; then
9552         echo "Using <string.h> instead of <strings.h>." >&4
9553         val="$define"
9554 else
9555         val="$undef"
9556         strings=`./findhdr strings.h`
9557         if $test "$strings" && $test -r "$strings"; then
9558                 echo "Using <strings.h> instead of <string.h>." >&4
9559         else
9560                 ./warn "No string header found -- You'll surely have problems."
9561         fi
9562 fi
9563 set i_string
9564 eval $setvar
9565 case "$i_string" in
9566 "$undef") strings=`./findhdr strings.h`;;
9567 *)        strings=`./findhdr string.h`;;
9568 esac
9569
9570 : see if qgcvt exists
9571 set qgcvt d_qgcvt
9572 eval $inlibc
9573
9574 : Check print/scan long double stuff
9575 echo " "
9576
9577 if $test X"$d_longdbl" = X"$define"; then
9578
9579 echo "Checking how to print long doubles..." >&4
9580
9581 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9582         $cat >try.c <<'EOCP'
9583 #include <sys/types.h>
9584 #include <stdio.h>
9585 int main() {
9586   double d = 123.456;
9587   printf("%.3f\n", d);
9588 }
9589 EOCP
9590         set try
9591         if eval $compile; then
9592                 yyy=`$run ./try`
9593                 case "$yyy" in
9594                 123.456)
9595                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9596                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9597                         echo "We will use %f."
9598                         ;;
9599                 esac
9600         fi
9601 fi
9602
9603 if $test X"$sPRIfldbl" = X; then
9604         $cat >try.c <<'EOCP'
9605 #include <sys/types.h>
9606 #include <stdio.h>
9607 int main() {
9608   long double d = 123.456;
9609   printf("%.3Lf\n", d);
9610 }
9611 EOCP
9612         set try
9613         if eval $compile; then
9614                 yyy=`$run ./try`
9615                 case "$yyy" in
9616                 123.456)
9617                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9618                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9619                         echo "We will use %Lf."
9620                         ;;
9621                 esac
9622         fi
9623 fi
9624
9625 if $test X"$sPRIfldbl" = X; then
9626         $cat >try.c <<'EOCP'
9627 #include <sys/types.h>
9628 #include <stdio.h>
9629 int main() {
9630   long double d = 123.456;
9631   printf("%.3llf\n", d);
9632 }
9633 EOCP
9634         set try
9635         if eval $compile; then
9636                 yyy=`$run ./try`
9637                 case "$yyy" in
9638                 123.456)
9639                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9640                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9641                         echo "We will use %llf."
9642                         ;;
9643                 esac
9644         fi
9645 fi
9646
9647 if $test X"$sPRIfldbl" = X; then
9648         $cat >try.c <<'EOCP'
9649 #include <sys/types.h>
9650 #include <stdio.h>
9651 int main() {
9652   long double d = 123.456;
9653   printf("%.3lf\n", d);
9654 }
9655 EOCP
9656         set try
9657         if eval $compile; then
9658                 yyy=`$run ./try`
9659                 case "$yyy" in
9660                 123.456)
9661                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9662                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9663                         echo "We will use %lf."
9664                         ;;
9665                 esac
9666         fi
9667 fi
9668
9669 if $test X"$sPRIfldbl" = X; then
9670         echo "Cannot figure out how to print long doubles." >&4
9671 else
9672         sSCNfldbl=$sPRIfldbl    # expect consistency
9673 fi
9674
9675 $rm_try
9676
9677 fi # d_longdbl
9678
9679 case "$sPRIfldbl" in
9680 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9681         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9682         d_SCNfldbl="$undef";
9683         ;;
9684 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9685         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9686         d_SCNfldbl="$define";
9687         ;;
9688 esac
9689
9690 : Check how to convert floats to strings.
9691
9692 if test "X$d_Gconvert" = X; then
9693
9694 echo " "
9695 echo "Checking for an efficient way to convert floats to strings."
9696 echo " " > try.c
9697 case "$uselongdouble" in
9698 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9699 esac
9700 case "$d_longdbl" in
9701 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9702 esac
9703 case "$d_PRIgldbl" in
9704 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9705 esac
9706 $cat >>try.c <<EOP
9707 #ifdef TRY_gconvert
9708 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9709 char *myname = "gconvert";
9710 #endif
9711 #ifdef TRY_gcvt
9712 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9713 char *myname = "gcvt";
9714 #endif
9715 #ifdef TRY_qgcvt
9716 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9717 char *myname = "qgcvt";
9718 #define DOUBLETYPE long double
9719 #endif
9720 #ifdef TRY_sprintf
9721 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9722 #ifdef HAS_PRIgldbl
9723 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9724 #else
9725 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9726 #endif
9727 #else
9728 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9729 #endif
9730 char *myname = "sprintf";
9731 #endif
9732
9733 #ifndef DOUBLETYPE
9734 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9735 #define DOUBLETYPE long double
9736 #else
9737 #define DOUBLETYPE double
9738 #endif
9739 #endif
9740
9741 #include <stdio.h>
9742
9743 #$i_stdlib I_STDLIB
9744 #ifdef I_STDLIB
9745 #include <stdlib.h>
9746 #endif
9747 #$i_string I_STRING
9748 #ifdef I_STRING
9749 #  include <string.h>
9750 #else
9751 #  include <strings.h>
9752 #endif
9753
9754 int checkit(char *expect, char *got)
9755 {
9756     if (strcmp(expect, got)) {
9757                 printf("%s oddity:  Expected %s, got %s\n",
9758                         myname, expect, got);
9759                 exit(1);
9760         }
9761 }
9762
9763 int main()
9764 {
9765         char buf[64];
9766         buf[63] = '\0';
9767
9768         /* This must be 1st test on (which?) platform */
9769         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9770         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9771         checkit("0.1", buf);
9772
9773         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9774         checkit("0.01", buf);
9775
9776         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9777         checkit("0.001", buf);
9778
9779         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9780         checkit("0.0001", buf);
9781
9782         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9783         if (strlen(buf) > 5)
9784             checkit("9e-005", buf); /* for Microsoft ?? */
9785         else
9786             checkit("9e-05", buf);
9787
9788         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9789         checkit("1", buf);
9790
9791         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9792         checkit("1.1", buf);
9793
9794         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9795         checkit("1.01", buf);
9796
9797         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9798         checkit("1.001", buf);
9799
9800         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9801         checkit("1.0001", buf);
9802
9803         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9804         checkit("1.00001", buf);
9805
9806         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9807         checkit("1.000001", buf);
9808
9809         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9810         checkit("0", buf);
9811
9812         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9813         checkit("-1", buf);
9814
9815         /* Some Linux gcvt's give 1.e+5 here. */
9816         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9817         checkit("100000", buf);
9818
9819         /* Some Linux gcvt's give -1.e+5 here. */
9820         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9821         checkit("-100000", buf);
9822
9823         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9824         checkit("123.456", buf);
9825
9826         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9827         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9828         /* 34 should be enough to scare even long double
9829          * places into using the e notation. */
9830         if (strlen(buf) > 5)
9831             checkit("1e+034", buf); /* for Microsoft */
9832         else
9833             checkit("1e+34", buf);
9834
9835         /* For Perl, if you add additional tests here, also add them to
9836          * t/base/num.t for benefit of platforms not using Configure or
9837          * overriding d_Gconvert */
9838
9839         exit(0);
9840 }
9841 EOP
9842 : first add preferred functions to our list
9843 xxx_list=""
9844 for xxx_convert in $gconvert_preference; do
9845     case $xxx_convert in
9846     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9847     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9848     esac
9849 done
9850 : then add any others
9851 for xxx_convert in gconvert gcvt sprintf; do
9852     case "$xxx_list" in
9853     *$xxx_convert*) ;;
9854     *) xxx_list="$xxx_list $xxx_convert" ;;
9855     esac
9856 done
9857
9858 case "$d_longdbl$uselongdouble" in
9859 "$define$define")
9860     : again, add preferred functions to our list first
9861     xxx_ld_list=""
9862     for xxx_convert in $gconvert_ld_preference; do
9863         case $xxx_convert in
9864         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9865         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9866         esac
9867     done
9868     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9869     for xxx_convert in qgcvt sprintf $xxx_list; do
9870         case "$xxx_ld_list" in
9871         $xxx_convert*|*" $xxx_convert"*) ;;
9872         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9873         esac
9874     done
9875     : if sprintf cannot do long doubles, move it to the end
9876     if test "$d_PRIgldbl" != "$define"; then
9877         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9878     fi
9879     : if no qgcvt, remove it
9880     if test "$d_qgcvt" != "$define"; then
9881         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9882     fi
9883     : use the ld_list
9884     xxx_list="$xxx_ld_list"
9885     ;;
9886 esac
9887
9888 for xxx_convert in $xxx_list; do
9889         echo "Trying $xxx_convert..."
9890         $rm -f try try$_o core
9891         set try -DTRY_$xxx_convert
9892         if eval $compile; then
9893                 echo "$xxx_convert() found." >&4
9894                 if $run ./try; then
9895                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9896                         break;
9897                 else
9898                         echo "...But $xxx_convert didn't work as I expected."
9899                         xxx_convert=''
9900                 fi
9901         else
9902                 echo "$xxx_convert NOT found." >&4
9903         fi
9904 done
9905
9906 if test X$xxx_convert = X; then
9907     echo "*** WHOA THERE!!! ***" >&4
9908     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9909     xxx_convert=sprintf
9910 fi
9911
9912 case "$xxx_convert" in
9913 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9914 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9915 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9916 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9917    "$define$define$define")
9918       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9919    "$define$define$undef")
9920       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9921    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9922    esac
9923    ;;
9924 esac
9925
9926 fi
9927 $rm_try
9928
9929 : see if _fwalk exists
9930 set fwalk d__fwalk
9931 eval $inlibc
9932
9933 : Initialize h_fcntl
9934 h_fcntl=false
9935
9936 : Initialize h_sysfile
9937 h_sysfile=false
9938
9939 : access call always available on UNIX
9940 set access d_access
9941 eval $inlibc
9942
9943 : locate the flags for 'access()'
9944 case "$d_access" in
9945 "$define")
9946         echo " "
9947         $cat >access.c <<EOCP
9948 #include <sys/types.h>
9949 #ifdef I_FCNTL
9950 #include <fcntl.h>
9951 #endif
9952 #ifdef I_SYS_FILE
9953 #include <sys/file.h>
9954 #endif
9955 #ifdef I_UNISTD
9956 #include <unistd.h>
9957 #endif
9958 #$i_stdlib I_STDLIB
9959 #ifdef I_STDLIB
9960 #include <stdlib.h>
9961 #endif
9962 int main() {
9963         exit(R_OK);
9964 }
9965 EOCP
9966         : check sys/file.h first, no particular reason here
9967         if $test `./findhdr sys/file.h` && \
9968                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9969                 h_sysfile=true;
9970                 echo "<sys/file.h> defines the *_OK access constants." >&4
9971         elif $test `./findhdr fcntl.h` && \
9972                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9973                 h_fcntl=true;
9974                 echo "<fcntl.h> defines the *_OK access constants." >&4
9975         elif $test `./findhdr unistd.h` && \
9976                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9977                 echo "<unistd.h> defines the *_OK access constants." >&4
9978         else
9979                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9980         fi
9981         ;;
9982 esac
9983 $rm -f access*
9984
9985 : see if accessx exists
9986 set accessx d_accessx
9987 eval $inlibc
9988
9989 : see if aintl exists
9990 set aintl d_aintl
9991 eval $inlibc
9992
9993 : see if alarm exists
9994 set alarm d_alarm
9995 eval $inlibc
9996
9997 : see if 64bit time functions exists
9998
9999 set ctime64 d_ctime64
10000 eval $inlibc
10001
10002 set localtime64 d_localtime64
10003 eval $inlibc
10004
10005 set gmtime64 d_gmtime64
10006 eval $inlibc
10007
10008 set mktime64 d_mktime64
10009 eval $inlibc
10010
10011 set difftime64 d_difftime64
10012 eval $inlibc
10013
10014 set asctime64 d_asctime64
10015 eval $inlibc
10016
10017 : see if POSIX threads are available
10018 set pthread.h i_pthread
10019 eval $inhdr
10020
10021 : define a function to check prototypes
10022 $cat > protochk <<EOSH
10023 $startsh
10024 cc="$cc"
10025 optimize="$optimize"
10026 ccflags="$ccflags"
10027 prototype="$prototype"
10028 define="$define"
10029 rm_try="$rm_try"
10030 usethreads=$usethreads
10031 i_pthread=$i_pthread
10032 pthread_h_first=$pthread_h_first
10033 EOSH
10034
10035 $cat >> protochk <<'EOSH'
10036
10037 $rm_try
10038 foo="$1"
10039 shift
10040 while test $# -ge 2; do
10041         case "$1" in
10042                 $define) echo "#include <$2>" >> try.c ;;
10043                 literal) echo "$2" >> try.c ;;
10044         esac
10045     # Extra magic for the benefit of systems that need pthread.h
10046     # to be included early to correctly detect threadsafe functions.
10047     # Such functions must guarantee themselves, though, that the usethreads
10048     # and i_pthread have been defined, before calling protochk.
10049     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10050         echo "#include <pthread.h>" >> try.c
10051         pthread_h_done=yes
10052     fi
10053     shift 2
10054 done
10055 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10056 cat >> try.c <<'EOCP'
10057 #ifdef CAN_PROTOTYPE
10058 #define _(args) args
10059 #else
10060 #define _(args) ()
10061 #endif
10062 EOCP
10063 echo "$foo" >> try.c
10064 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10065 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10066 status=$?
10067 $rm_try
10068 exit $status
10069 EOSH
10070 chmod +x protochk
10071 $eunicefix protochk
10072
10073 : Define hasproto macro for Configure internal use
10074 hasproto='varname=$1; func=$2; shift; shift;
10075 while $test $# -ge 2; do
10076         case "$1" in
10077         $define) echo "#include <$2>";;
10078         esac ;
10079     shift 2;
10080 done > try.c;
10081 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10082 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10083         echo "$func() prototype found.";
10084         val="$define";
10085 else
10086         echo "$func() prototype NOT found.";
10087         val="$undef";
10088 fi;
10089 set $varname;
10090 eval $setvar;
10091 $rm_try tryout.c'
10092
10093 : see if sys/types.h has to be included
10094 set sys/types.h i_systypes
10095 eval $inhdr
10096
10097 : see if sys/select.h has to be included
10098 set sys/select.h i_sysselct
10099 eval $inhdr
10100
10101 : Define hasfield macro for Configure internal use
10102 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10103 while $test $# -ge 2; do
10104         case "$1" in
10105         $define) echo "#include <$2>";;
10106         esac ;
10107     shift 2;
10108 done > try.c;
10109 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10110 set try;
10111 if eval $compile; then
10112         val="$define";
10113 else
10114         val="$undef";
10115 fi;
10116 set $varname;
10117 eval $setvar;
10118 $rm_try'
10119
10120 : see if we should include time.h, sys/time.h, or both
10121 echo " "
10122 if test "X$timeincl" = X; then
10123         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10124         $echo $n "I'm now running the test program...$c"
10125         $cat >try.c <<EOCP
10126 #include <sys/types.h>
10127 #ifdef I_TIME
10128 #include <time.h>
10129 #endif
10130 #ifdef I_SYSTIME
10131 #ifdef SYSTIMEKERNEL
10132 #define KERNEL
10133 #endif
10134 #include <sys/time.h>
10135 #endif
10136 #ifdef I_SYSSELECT
10137 #include <sys/select.h>
10138 #endif
10139 #$i_stdlib I_STDLIB
10140 #ifdef I_STDLIB
10141 #include <stdlib.h>
10142 #endif
10143 int main()
10144 {
10145         struct tm foo;
10146 #ifdef S_TIMEVAL
10147         struct timeval bar;
10148 #endif
10149 #ifdef S_TIMEZONE
10150         struct timezone tzp;
10151 #endif
10152         if (foo.tm_sec == foo.tm_sec)
10153                 exit(0);
10154 #ifdef S_TIMEVAL
10155         if (bar.tv_sec == bar.tv_sec)
10156                 exit(0);
10157 #endif
10158         exit(1);
10159 }
10160 EOCP
10161         flags=''
10162         for s_timezone in '-DS_TIMEZONE' ''; do
10163         sysselect=''
10164         for s_timeval in '-DS_TIMEVAL' ''; do
10165         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10166         for i_time in '' '-DI_TIME'; do
10167         for i_systime in '-DI_SYSTIME' ''; do
10168                 case "$flags" in
10169                 '') $echo $n ".$c"
10170                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10171                         if eval $compile; then
10172                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10173                                 shift
10174                                 flags="$*"
10175                                 echo " "
10176                                 $echo $n "Succeeded with $flags$c"
10177                         fi
10178                         ;;
10179                 esac
10180         done
10181         done
10182         done
10183         done
10184         done
10185         timeincl=''
10186         echo " "
10187         case "$flags" in
10188         *SYSTIMEKERNEL*) i_systimek="$define"
10189                 timeincl=`./findhdr sys/time.h`
10190                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10191         *) i_systimek="$undef";;
10192         esac
10193         case "$flags" in
10194         *I_TIME*) i_time="$define"
10195                 timeincl=`./findhdr time.h`" $timeincl"
10196                 echo "We'll include <time.h>." >&4;;
10197         *) i_time="$undef";;
10198         esac
10199         case "$flags" in
10200         *I_SYSTIME*) i_systime="$define"
10201                 timeincl=`./findhdr sys/time.h`" $timeincl"
10202                 echo "We'll include <sys/time.h>." >&4;;
10203         *) i_systime="$undef";;
10204         esac
10205         $rm_try
10206 fi
10207 : see if struct tm knows about tm_zone
10208 case "$i_systime$i_time" in
10209 *$define*)
10210         echo " "
10211         echo "Checking to see if your struct tm has tm_zone field..." >&4
10212         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10213         eval $hasfield
10214         ;;
10215 *)      val="$undef"
10216         set d_tm_tm_zone
10217         eval $setvar
10218         ;;
10219 esac
10220 case "$d_tm_tm_zone" in
10221 "$define")      echo "Yes, it does."   ;;
10222 *)              echo "No, it doesn't." ;;
10223 esac
10224 : see if struct tm knows about tm_gmtoff
10225 case "$i_systime$i_time" in
10226 *$define*)
10227         echo " "
10228         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10229         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10230         eval $hasfield
10231         ;;
10232 *)      val="$undef"
10233         set d_tm_tm_gmtoff
10234         eval $setvar
10235         ;;
10236 esac
10237 case "$d_tm_tm_gmtoff" in
10238 "$define")      echo "Yes, it does."   ;;
10239 *)              echo "No, it doesn't." ;;
10240 esac
10241
10242 : see if asctime_r exists
10243 set asctime_r d_asctime_r
10244 eval $inlibc
10245 case "$d_asctime_r" in
10246 "$define")
10247         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10248         case "$d_asctime_r_proto:$usethreads" in
10249         ":define")      d_asctime_r_proto=define
10250                 set d_asctime_r_proto asctime_r $hdrs
10251                 eval $hasproto ;;
10252         *)      ;;
10253         esac
10254         case "$d_asctime_r_proto" in
10255         define)
10256         case "$asctime_r_proto" in
10257         ''|0) try='char* asctime_r(const struct tm*, char*);'
10258         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10259         esac
10260         case "$asctime_r_proto" in
10261         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10262         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10263         esac
10264         case "$asctime_r_proto" in
10265         ''|0) try='int asctime_r(const struct tm*, char*);'
10266         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10267         esac
10268         case "$asctime_r_proto" in
10269         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10270         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10271         esac
10272         case "$asctime_r_proto" in
10273         ''|0)   d_asctime_r=undef
10274                 asctime_r_proto=0
10275                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10276         * )     case "$asctime_r_proto" in
10277                 REENTRANT_PROTO*) ;;
10278                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10279                 esac
10280                 echo "Prototype: $try" ;;
10281         esac
10282         ;;
10283         *)      case "$usethreads" in
10284                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10285                 esac
10286                 d_asctime_r=undef
10287                 asctime_r_proto=0
10288                 ;;
10289         esac
10290         ;;
10291 *)      asctime_r_proto=0
10292         ;;
10293 esac
10294
10295 : see if atolf exists
10296 set atolf d_atolf
10297 eval $inlibc
10298
10299 : see if atoll exists
10300 set atoll d_atoll
10301 eval $inlibc
10302
10303 : Look for GCC-style attribute format
10304 case "$d_attribute_format" in
10305 '')
10306 echo " "
10307 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10308 $cat >attrib.c <<'EOCP'
10309 #include <stdio.h>
10310 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10311 EOCP
10312 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10313         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10314                 echo "Your C compiler doesn't support __attribute__((format))."
10315                 val="$undef"
10316         else
10317                 echo "Your C compiler supports __attribute__((format))."
10318                 val="$define"
10319         fi
10320 else
10321         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10322         val="$undef"
10323 fi
10324 ;;
10325 *) val="$d_attribute_format" ;;
10326 esac
10327 set d_attribute_format
10328 eval $setvar
10329 $rm -f attrib*
10330
10331 : Look for GCC-style attribute format with null format allowed
10332 case "$d_printf_format_null" in
10333 '') case "$d_attribute_format" in
10334     $define)
10335         echo " "
10336         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10337 $cat >attrib.c <<EOCP
10338 #include <stdio.h>
10339 #$i_stdlib I_STDLIB
10340 #ifdef I_STDLIB
10341 #include <stdlib.h>
10342 #endif
10343 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10344 int null_printf (char* pat,...) { return (int)pat; }
10345 int main () { exit(null_printf(NULL)); }
10346 EOCP
10347         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10348             : run the executable in case it produces a run-time warning
10349             if $run ./attrib >>attrib.out 2>&1; then
10350                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10351                     echo "Your C compiler doesn't allow __printf__ format to be null."
10352                     val="$undef"
10353                 else
10354                     echo "Your C compiler allows __printf__ format to be null."
10355                     val="$define"
10356                 fi
10357             else
10358             echo "Your C compiler executable failed with __printf__ format null."
10359             val="$undef"
10360         fi
10361     else
10362         echo "Your C compiler fails with __printf__ format null."
10363         val="$undef"
10364     fi
10365     ;;
10366     *)  val="$undef" ;;
10367     esac
10368 ;;
10369 *)  val="$d_printf_format_null" ;;
10370 esac
10371 set d_printf_format_null
10372 eval $setvar
10373 $rm -f attrib*
10374
10375 : Look for GCC-style attribute malloc
10376 case "$d_attribute_malloc" in
10377 '')
10378 echo " "
10379 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10380 $cat >attrib.c <<'EOCP'
10381 #include <stdio.h>
10382 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10383 EOCP
10384 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10385         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10386                 echo "Your C compiler doesn't support __attribute__((malloc))."
10387                 val="$undef"
10388         else
10389                 echo "Your C compiler supports __attribute__((malloc))."
10390                 val="$define"
10391         fi
10392 else
10393         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10394         val="$undef"
10395 fi
10396 ;;
10397 *) val="$d_attribute_malloc" ;;
10398 esac
10399 set d_attribute_malloc
10400 eval $setvar
10401 $rm -f attrib*
10402
10403 : Look for GCC-style attribute nonnull
10404 case "$d_attribute_nonnull" in
10405 '')
10406 echo " "
10407 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10408 $cat >attrib.c <<'EOCP'
10409 #include <stdio.h>
10410 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10411 EOCP
10412 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10413         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10414                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10415                 val="$undef"
10416         else
10417                 echo "Your C compiler supports __attribute__((nonnull))."
10418                 val="$define"
10419         fi
10420 else
10421         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10422         val="$undef"
10423 fi
10424 ;;
10425 *) val="$d_attribute_nonnull" ;;
10426 esac
10427 set d_attribute_nonnull
10428 eval $setvar
10429 $rm -f attrib*
10430
10431 : Look for GCC-style attribute noreturn
10432 case "$d_attribute_noreturn" in
10433 '')
10434 echo " "
10435 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10436 $cat >attrib.c <<'EOCP'
10437 #include <stdio.h>
10438 void fall_over_dead( void ) __attribute__((noreturn));
10439 EOCP
10440 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10441         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10442                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10443                 val="$undef"
10444         else
10445                 echo "Your C compiler supports __attribute__((noreturn))."
10446                 val="$define"
10447         fi
10448 else
10449         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10450         val="$undef"
10451 fi
10452 ;;
10453 *) val="$d_attribute_noreturn" ;;
10454 esac
10455 set d_attribute_noreturn
10456 eval $setvar
10457 $rm -f attrib*
10458
10459 : Look for GCC-style attribute pure
10460 case "$d_attribute_pure" in
10461 '')
10462 echo " "
10463 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10464 $cat >attrib.c <<'EOCP'
10465 #include <stdio.h>
10466 int square( int n ) __attribute__((pure));
10467 EOCP
10468 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10469         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10470                 echo "Your C compiler doesn't support __attribute__((pure))."
10471                 val="$undef"
10472         else
10473                 echo "Your C compiler supports __attribute__((pure))."
10474                 val="$define"
10475         fi
10476 else
10477         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10478         val="$undef"
10479 fi
10480 ;;
10481 *) val="$d_attribute_pure" ;;
10482 esac
10483 set d_attribute_pure
10484 eval $setvar
10485 $rm -f attrib*
10486
10487 : Look for GCC-style attribute unused
10488 case "$d_attribute_unused" in
10489 '')
10490 echo " "
10491 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10492 $cat >attrib.c <<'EOCP'
10493 #include <stdio.h>
10494 int do_something( int dummy __attribute__((unused)), int n );
10495 EOCP
10496 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10497         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10498                 echo "Your C compiler doesn't support __attribute__((unused))."
10499                 val="$undef"
10500         else
10501                 echo "Your C compiler supports __attribute__((unused))."
10502                 val="$define"
10503         fi
10504 else
10505         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10506         val="$undef"
10507 fi
10508 ;;
10509 *) val="$d_attribute_unused" ;;
10510 esac
10511 set d_attribute_unused
10512 eval $setvar
10513 $rm -f attrib*
10514
10515 : Look for GCC-style attribute deprecated
10516 case "$d_attribute_deprecated" in
10517 '')
10518 echo " "
10519 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10520 $cat >attrib.c <<'EOCP'
10521 #include <stdio.h>
10522 int I_am_deprecated(void) __attribute__((deprecated));
10523 EOCP
10524 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10525         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10526                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10527                 val="$undef"
10528         else
10529                 echo "Your C compiler supports __attribute__((deprecated))."
10530                 val="$define"
10531         fi
10532 else
10533         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10534         val="$undef"
10535 fi
10536 ;;
10537 *) val="$d_attribute_deprecated" ;;
10538 esac
10539 set d_attribute_deprecated
10540 eval $setvar
10541 $rm -f attrib*
10542
10543 : Look for GCC-style attribute warn_unused_result
10544 case "$d_attribute_warn_unused_result" in
10545 '')
10546 echo " "
10547 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10548 $cat >attrib.c <<'EOCP'
10549 #include <stdio.h>
10550 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10551 EOCP
10552 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10553         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10554                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10555                 val="$undef"
10556         else
10557                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10558                 val="$define"
10559         fi
10560 else
10561         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10562         val="$undef"
10563 fi
10564 ;;
10565 *) val="$d_attribute_warn_unused_result" ;;
10566 esac
10567 set d_attribute_warn_unused_result
10568 eval $setvar
10569 $rm -f attrib*
10570
10571 : see if bcmp exists
10572 set bcmp d_bcmp
10573 eval $inlibc
10574
10575 : see if bcopy exists
10576 set bcopy d_bcopy
10577 eval $inlibc
10578
10579 : see if getpgrp exists
10580 set getpgrp d_getpgrp
10581 eval $inlibc
10582
10583 case "$d_getpgrp" in
10584 "$define")
10585         echo " "
10586         echo "Checking to see which flavor of getpgrp is in use..."
10587         $cat >try.c <<EOP
10588 #$i_unistd I_UNISTD
10589 #include <sys/types.h>
10590 #ifdef I_UNISTD
10591 #  include <unistd.h>
10592 #endif
10593 #$i_stdlib I_STDLIB
10594 #ifdef I_STDLIB
10595 #include <stdlib.h>
10596 #endif
10597 int main()
10598 {
10599         if (getuid() == 0) {
10600                 printf("(I see you are running Configure as super-user...)\n");
10601                 setuid(1);
10602         }
10603 #ifdef TRY_BSD_PGRP
10604         if (getpgrp(1) == 0)
10605                 exit(0);
10606 #else
10607         if (getpgrp() > 0)
10608                 exit(0);
10609 #endif
10610         exit(1);
10611 }
10612 EOP
10613         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10614                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10615                 val="$define"
10616         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10617                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10618                 val="$undef"
10619         else
10620                 echo "I can't seem to compile and run the test program."
10621                 if ./usg; then
10622                         xxx="a USG one, i.e. you use getpgrp()."
10623                 else
10624                         # SVR4 systems can appear rather BSD-ish.
10625                         case "$i_unistd" in
10626                         $undef)
10627                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10628                                 val="$define"
10629                                 ;;
10630                         $define)
10631                                 xxx="probably a USG one, i.e. you use getpgrp()."
10632                                 val="$undef"
10633                                 ;;
10634                         esac
10635                 fi
10636                 echo "Assuming your getpgrp is $xxx" >&4
10637         fi
10638         ;;
10639 *) val="$undef";;
10640 esac
10641 set d_bsdgetpgrp
10642 eval $setvar
10643 $rm_try
10644
10645 : see if setpgrp exists
10646 set setpgrp d_setpgrp
10647 eval $inlibc
10648
10649 case "$d_setpgrp" in
10650 "$define")
10651         echo " "
10652         echo "Checking to see which flavor of setpgrp is in use..."
10653         $cat >try.c <<EOP
10654 #$i_unistd I_UNISTD
10655 #include <sys/types.h>
10656 #ifdef I_UNISTD
10657 #  include <unistd.h>
10658 #endif
10659 #$i_stdlib I_STDLIB
10660 #ifdef I_STDLIB
10661 #include <stdlib.h>
10662 #endif
10663 int main()
10664 {
10665         if (getuid() == 0) {
10666                 printf("(I see you are running Configure as super-user...)\n");
10667                 setuid(1);
10668         }
10669 #ifdef TRY_BSD_PGRP
10670         if (-1 == setpgrp(1, 1))
10671                 exit(0);
10672 #else
10673         if (setpgrp() != -1)
10674                 exit(0);
10675 #endif
10676         exit(1);
10677 }
10678 EOP
10679         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10680                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10681                 val="$define"
10682         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10683                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10684                 val="$undef"
10685         else
10686                 echo "(I can't seem to compile and run the test program.)"
10687                 if ./usg; then
10688                         xxx="a USG one, i.e. you use setpgrp()."
10689                 else
10690                         # SVR4 systems can appear rather BSD-ish.
10691                         case "$i_unistd" in
10692                         $undef)
10693                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10694                                 val="$define"
10695                                 ;;
10696                         $define)
10697                                 xxx="probably a USG one, i.e. you use setpgrp()."
10698                                 val="$undef"
10699                                 ;;
10700                         esac
10701                 fi
10702                 echo "Assuming your setpgrp is $xxx" >&4
10703         fi
10704         ;;
10705 *) val="$undef";;
10706 esac
10707 set d_bsdsetpgrp
10708 eval $setvar
10709 $rm_try
10710
10711 : Look for GCC-style __builtin_choose_expr
10712 case "$d_builtin_choose_expr" in
10713 '')
10714     echo " "
10715     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10716     $cat >try.c <<'EOCP'
10717 #include <assert.h>
10718 #include <stdlib.h>
10719 #include <stdio.h>
10720
10721 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10722
10723 int main(void) {
10724     assert( SYRINX(1) == 2112 );
10725     assert( SYRINX(1) != 5150 );
10726     assert( SYRINX(0) == 5150 );
10727     assert( SYRINX(0) != 2112 );
10728     puts( "All good!" );
10729     exit(0);
10730 }
10731
10732 EOCP
10733     set try
10734     if eval $compile && $run ./try; then
10735         echo "Your C compiler supports __builtin_choose_expr."
10736         val="$define"
10737     else
10738         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10739         val="$undef"
10740     fi
10741 ;;
10742 *) val="$d_builtin_choose_expr" ;;
10743 esac
10744
10745 set d_builtin_choose_expr
10746 eval $setvar
10747 $rm_try
10748
10749 : Look for GCC-style __builtin_expect
10750 case "$d_builtin_expect" in
10751 '')
10752     echo " "
10753     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10754     $cat >try.c <<'EOCP'
10755 int main(void) {
10756     int n = 50;
10757     if ( __builtin_expect(n, 0) ) n = 1;
10758     /* Remember shell exit code truth is 0, C truth is non-zero */
10759     return !(n == 1);
10760 }
10761 EOCP
10762     set try
10763     if eval $compile && $run ./try; then
10764         echo "Your C compiler supports __builtin_expect."
10765         val="$define"
10766     else
10767         echo "Your C compiler doesn't seem to understand __builtin_expect."
10768         val="$undef"
10769     fi
10770     ;;
10771 *) val="$d_builtin_expect" ;;
10772 esac
10773
10774 set d_builtin_expect
10775 eval $setvar
10776 $rm_try
10777
10778 : see if bzero exists
10779 set bzero d_bzero
10780 eval $inlibc
10781
10782 : see if stdarg is available
10783 echo " "
10784 if $test `./findhdr stdarg.h`; then
10785         echo "<stdarg.h> found." >&4
10786         valstd="$define"
10787 else
10788         echo "<stdarg.h> NOT found." >&4
10789         valstd="$undef"
10790 fi
10791
10792 : see if varargs is available
10793 echo " "
10794 if $test `./findhdr varargs.h`; then
10795         echo "<varargs.h> found." >&4
10796 else
10797         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10798 fi
10799
10800 : set up the varargs testing programs
10801 $cat > varargs.c <<EOP
10802 #ifdef I_STDARG
10803 #include <stdarg.h>
10804 #endif
10805 #ifdef I_VARARGS
10806 #include <varargs.h>
10807 #endif
10808
10809 #ifdef I_STDARG
10810 int f(char *p, ...)
10811 #else
10812 int f(va_alist)
10813 va_dcl
10814 #endif
10815 {
10816         va_list ap;
10817 #ifndef I_STDARG
10818         char *p;
10819 #endif
10820 #ifdef I_STDARG
10821         va_start(ap,p);
10822 #else
10823         va_start(ap);
10824         p = va_arg(ap, char *);
10825 #endif
10826         va_end(ap);
10827         return 0;
10828 }
10829 EOP
10830 $cat > varargs <<EOP
10831 $startsh
10832 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10833         echo "true"
10834 else
10835         echo "false"
10836 fi
10837 $rm -f varargs$_o
10838 EOP
10839 chmod +x varargs
10840
10841 : now check which varargs header should be included
10842 echo " "
10843 i_varhdr=''
10844 val=''
10845 case "$valstd" in
10846 "$define")
10847         if `./varargs I_STDARG`; then
10848                 val='stdarg.h'
10849         elif `./varargs I_VARARGS`; then
10850                 val='varargs.h'
10851         fi
10852         ;;
10853 *)
10854         if `./varargs I_VARARGS`; then
10855                 val='varargs.h'
10856         fi
10857         ;;
10858 esac
10859 case "$val" in
10860 '')
10861         echo " "
10862         echo "*** WHOA THERE!!! ***" >&4
10863         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
10864         case "$knowitall" in
10865         '')
10866         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
10867                 exit 1
10868                 ;;
10869         esac
10870 echo "I could not find the definition for va_dcl... You have problems..." >&4
10871         val="$undef"; set i_stdarg; eval $setvar
10872         val="$undef"; set i_varargs; eval $setvar
10873         ;;
10874 *)
10875         set i_varhdr
10876         eval $setvar
10877         case "$i_varhdr" in
10878         stdarg.h)
10879                 val="$define"; set i_stdarg; eval $setvar
10880                 val="$undef"; set i_varargs; eval $setvar
10881                 ;;
10882         varargs.h)
10883                 val="$undef"; set i_stdarg; eval $setvar
10884                 val="$define"; set i_varargs; eval $setvar
10885                 ;;
10886         esac
10887         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10888 esac
10889 $rm -f varargs*
10890
10891 : see if the Compiler supports C99 variadic macros
10892 case "$i_stdarg$i_stdlib" in
10893     "$define$define")
10894     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10895     $cat >try.c <<EOCP
10896 #include <stdio.h>
10897 #include <stdarg.h>
10898
10899 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10900
10901 int main() {
10902   char buf[20];
10903   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10904   puts(buf);
10905   return 0;
10906 }
10907 EOCP
10908     set try
10909     if eval $compile && $run ./try 2>&1 >/dev/null; then
10910         case "`$run ./try`" in
10911             "123 456 789")
10912             echo "You have C99 variadic macros." >&4
10913             d_c99_variadic_macros="$define"
10914             ;;
10915             *)
10916             echo "You don't have functional C99 variadic macros." >&4
10917             d_c99_variadic_macros="$undef"
10918             ;;
10919         esac
10920     else
10921         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10922         d_c99_variadic_macros="$undef"
10923     fi
10924     $rm_try
10925     ;;
10926     *)
10927     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10928     d_c99_variadic_macros="$undef"
10929     ;;
10930 esac
10931
10932 : see if signal is declared as pointer to function returning int or void
10933 echo " "
10934 xxx=`./findhdr signal.h`
10935 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10936 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10937         echo "You have int (*signal())() instead of void." >&4
10938         val="$undef"
10939 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10940         echo "You have void (*signal())()." >&4
10941         val="$define"
10942 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10943         echo "You have int (*signal())() instead of void." >&4
10944         val="$undef"
10945 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10946         echo "You have void (*signal())()." >&4
10947         val="$define"
10948 else
10949         case "$d_voidsig" in
10950         '')
10951         echo "I can't determine whether signal handler returns void or int..." >&4
10952                 dflt=void
10953                 rp="What type does your signal handler return?"
10954                 . ./myread
10955                 case "$ans" in
10956                 v*) val="$define";;
10957                 *) val="$undef";;
10958                 esac;;
10959         "$define")
10960                 echo "As you already told me, signal handler returns void." >&4
10961                 val="$define"
10962                 ;;
10963         *)      echo "As you already told me, signal handler returns int." >&4
10964                 val="$undef"
10965                 ;;
10966         esac
10967 fi
10968 set d_voidsig
10969 eval $setvar
10970 case "$d_voidsig" in
10971 "$define") signal_t="void";;
10972 *) signal_t="int";;
10973 esac
10974 $rm -f $$.tmp
10975
10976 : check for ability to cast large floats to 32-bit ints.
10977 echo " "
10978 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10979 if $test "$intsize" -ge 4; then
10980         xxx=int
10981 else
10982         xxx=long
10983 fi
10984 $cat >try.c <<EOCP
10985 #include <stdio.h>
10986 #$i_stdlib I_STDLIB
10987 #ifdef I_STDLIB
10988 #include <stdlib.h>
10989 #endif
10990 #include <sys/types.h>
10991 #include <signal.h>
10992 $signal_t blech(int s) { exit(3); }
10993 int main()
10994 {
10995         $xxx i32;
10996         double f, g;
10997         int result = 0;
10998         char str[16];
10999         signal(SIGFPE, blech);
11000
11001         /* Don't let compiler optimize the test away.  Store the number
11002            in a writable string for gcc to pass to sscanf under HP-UX.
11003         */
11004         sprintf(str, "2147483647");
11005         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11006         g = 10 * f;
11007         i32  = ($xxx) g;
11008
11009         /* x86 processors will probably give 0x8000 0000, which is a
11010            sign change.  We don't want that.  We want to mimic SPARC
11011            behavior here, which is to preserve the sign and give
11012            back 0x7fff ffff.
11013         */
11014         if (i32 != ($xxx) f)
11015                 result |= 1;
11016         exit(result);
11017 }
11018 EOCP
11019 set try
11020 if eval $compile_ok; then
11021         $run ./try
11022         yyy=$?
11023 else
11024         echo "(I can't seem to compile the test program--assuming it can't)"
11025         yyy=1
11026 fi
11027 case "$yyy" in
11028 0)      val="$define"
11029         echo "Yup, it can."
11030         ;;
11031 *)      val="$undef"
11032         echo "Nope, it can't."
11033         ;;
11034 esac
11035 set d_casti32
11036 eval $setvar
11037 $rm_try
11038
11039 : check for ability to cast negative floats to unsigned
11040 echo " "
11041 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11042 $cat >try.c <<EOCP
11043 #include <stdio.h>
11044 #$i_stdlib I_STDLIB
11045 #ifdef I_STDLIB
11046 #include <stdlib.h>
11047 #endif
11048 #include <sys/types.h>
11049 #include <signal.h>
11050 $signal_t blech(int s) { exit(7); }
11051 $signal_t blech_in_list(int s) { exit(4); }
11052 unsigned long dummy_long(unsigned long p) { return p; }
11053 unsigned int dummy_int(unsigned int p) { return p; }
11054 unsigned short dummy_short(unsigned short p) { return p; }
11055 int main()
11056 {
11057         double f;
11058         unsigned long along;
11059         unsigned int aint;
11060         unsigned short ashort;
11061         int result = 0;
11062         char str[16];
11063
11064         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11065            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11066            optimized the whole file away
11067         */
11068         /* Store the number in a writable string for gcc to pass to
11069            sscanf under HP-UX.
11070         */
11071         sprintf(str, "-123");
11072         sscanf(str, "%lf", &f);  /* f = -123.; */
11073
11074         signal(SIGFPE, blech);
11075         along = (unsigned long)f;
11076         aint = (unsigned int)f;
11077         ashort = (unsigned short)f;
11078         if (along != (unsigned long)-123)
11079                 result |= 1;
11080         if (aint != (unsigned int)-123)
11081                 result |= 1;
11082         if (ashort != (unsigned short)-123)
11083                 result |= 1;
11084         sprintf(str, "1073741824.");
11085         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11086         f = f + f;
11087         along = 0;
11088         along = (unsigned long)f;
11089         if (along != 0x80000000)
11090                 result |= 2;
11091         f -= 1.;
11092         along = 0;
11093         along = (unsigned long)f;
11094         if (along != 0x7fffffff)
11095                 result |= 1;
11096         f += 2.;
11097         along = 0;
11098         along = (unsigned long)f;
11099         if (along != 0x80000001)
11100                 result |= 2;
11101         if (result)
11102                 exit(result);
11103         signal(SIGFPE, blech_in_list);
11104         sprintf(str, "123.");
11105         sscanf(str, "%lf", &f);  /* f = 123.; */
11106         along = dummy_long((unsigned long)f);
11107         aint = dummy_int((unsigned int)f);
11108         ashort = dummy_short((unsigned short)f);
11109         if (along != (unsigned long)123)
11110                 result |= 4;
11111         if (aint != (unsigned int)123)
11112                 result |= 4;
11113         if (ashort != (unsigned short)123)
11114                 result |= 4;
11115         exit(result);
11116
11117 }
11118 EOCP
11119 set try
11120 if eval $compile_ok; then
11121         $run ./try
11122         castflags=$?
11123 else
11124         echo "(I can't seem to compile the test program--assuming it can't)"
11125         castflags=7
11126 fi
11127 case "$castflags" in
11128 0)      val="$define"
11129         echo "Yup, it can."
11130         ;;
11131 *)      val="$undef"
11132         echo "Nope, it can't."
11133         ;;
11134 esac
11135 set d_castneg
11136 eval $setvar
11137 $rm_try
11138
11139 : see if vprintf exists
11140 echo " "
11141 if set vprintf val -f d_vprintf; eval $csym; $val; then
11142         echo 'vprintf() found.' >&4
11143         val="$define"
11144         $cat >try.c <<EOF
11145 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11146 #$i_varargs I_VARARGS
11147
11148 #$i_stdlib I_STDLIB
11149 #$i_unistd I_UNISTD
11150
11151 #ifdef I_STDARG
11152 #  include <stdarg.h>
11153 #else /* I_VARARGS */
11154 #  include <varargs.h>
11155 #endif
11156
11157 #ifdef I_UNISTD
11158 #  include <unistd.h>
11159 #endif
11160
11161 #ifdef I_STDLIB
11162 #  include <stdlib.h>
11163 #endif
11164
11165 #include <stdio.h> /* vsprintf prototype */
11166
11167 #ifdef I_STDARG
11168 void xxx(int n, ...)
11169 {
11170     va_list args;
11171     char buf[10];
11172     va_start(args, n);
11173     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11174 }
11175 int main() { xxx(1, "foo"); }
11176
11177 #else /* I_VARARGS */
11178
11179 xxx(va_alist)
11180 va_dcl
11181 {
11182     va_list args;
11183     char buf[10];
11184     va_start(args);
11185     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11186 }
11187 int main() { xxx("foo"); }
11188
11189 #endif
11190
11191 EOF
11192         set try
11193         if eval $compile_ok; then
11194                 if $run ./try; then
11195                         echo "Your vsprintf() returns (int)." >&4
11196                         val2="$undef"
11197                 else
11198                         echo "Your vsprintf() returns (char*)." >&4
11199                         val2="$define"
11200                 fi
11201         else
11202                 echo 'I am unable to compile the vsprintf() test program.' >&4
11203                 # We shouldn't get here.  If we do, assume the standard signature,
11204                 # not the old BSD one.
11205                 echo 'Guessing that vsprintf() returns (int).' >&4
11206                 val2="$undef"
11207         fi
11208 else
11209         echo 'vprintf() NOT found.' >&4
11210         val="$undef"
11211         val2="$undef"
11212 fi
11213 $rm_try
11214 set d_vprintf
11215 eval $setvar
11216 val=$val2
11217 set d_charvspr
11218 eval $setvar
11219
11220 : see if chown exists
11221 set chown d_chown
11222 eval $inlibc
11223
11224 : see if chroot exists
11225 set chroot d_chroot
11226 eval $inlibc
11227
11228 : see if chsize exists
11229 set chsize d_chsize
11230 eval $inlibc
11231
11232 : see if class exists
11233 set class d_class
11234 eval $inlibc
11235
11236 : see if clearenv exists
11237 set clearenv d_clearenv
11238 eval $inlibc
11239
11240 : Define hasstruct macro for Configure internal use
11241 hasstruct='varname=$1; struct=$2; shift; shift;
11242 while $test $# -ge 2; do
11243         case "$1" in
11244         $define) echo "#include <$2>";;
11245         esac ;
11246     shift 2;
11247 done > try.c;
11248 echo "int main () { struct $struct foo; }" >> try.c;
11249 set try;
11250 if eval $compile; then
11251         val="$define";
11252 else
11253         val="$undef";
11254 fi;
11255 set $varname;
11256 eval $setvar;
11257 $rm_try'
11258
11259 : see whether socket exists
11260 socketlib=''
11261 sockethdr=''
11262 echo " "
11263 $echo $n "Hmm... $c" >&4
11264 if set socket val -f d_socket; eval $csym; $val; then
11265         echo "Looks like you have Berkeley networking support." >&4
11266         d_socket="$define"
11267         if set setsockopt val -f; eval $csym; $val; then
11268                 d_oldsock="$undef"
11269         else
11270                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11271                 d_oldsock="$define"
11272         fi
11273 else
11274         if $contains socklib libc.list >/dev/null 2>&1; then
11275                 echo "Looks like you have Berkeley networking support." >&4
11276                 d_socket="$define"
11277                 : we will have to assume that it supports the 4.2 BSD interface
11278                 d_oldsock="$undef"
11279         else
11280                 echo "You don't have Berkeley networking in libc$_a..." >&4
11281                 if test "X$d_socket" = "X$define"; then
11282                    echo "...but you seem to believe that you have sockets." >&4
11283                 else
11284                         for net in net socket
11285                         do
11286                                 if test -f /usr/lib/lib$net$_a; then
11287                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11288                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11289                                         if $contains socket libc.list >/dev/null 2>&1; then
11290                                                 d_socket="$define"
11291                                                 socketlib="-l$net"
11292                                                 case "$net" in
11293                                                 net)
11294                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11295                                                         sockethdr="-I/usr/netinclude"
11296                                                         ;;
11297                                                 esac
11298                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11299                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11300                                                         d_oldsock="$undef"
11301                                                 else
11302                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11303                                                         d_oldsock="$define"
11304                                                 fi
11305                                                 break
11306                                         fi
11307                                 fi
11308                         done
11309                         if test "X$d_socket" != "X$define"; then
11310                            echo "or anywhere else I see." >&4
11311                            d_socket="$undef"
11312                            d_oldsock="$undef"
11313                         fi
11314                 fi
11315         fi
11316 fi
11317
11318 : see if socketpair exists
11319 set socketpair d_sockpair
11320 eval $inlibc
11321
11322
11323 echo " "
11324 echo "Checking the availability sa_len in the sock struct ..." >&4
11325 $cat >try.c <<EOF
11326 #include <sys/types.h>
11327 #include <sys/socket.h>
11328 int main() {
11329 struct sockaddr sa;
11330 return (sa.sa_len);
11331 }
11332 EOF
11333 val="$undef"
11334 set try; if eval $compile; then
11335         val="$define"
11336 fi
11337 set d_sockaddr_sa_len; eval $setvar
11338 $rm_try
11339
11340 echo " "
11341 echo "Checking the availability struct sockaddr_in6 ..." >&4
11342 $cat >try.c <<EOF
11343 #include <sys/types.h>
11344 #include <sys/socket.h>
11345 #include <netinet/in.h>
11346 int main() {
11347 struct sockaddr_in6 sin6;
11348 return (sin6.sin6_family);
11349 }
11350 EOF
11351 val="$undef"
11352 set try; if eval $compile; then
11353         val="$define"
11354 fi
11355 set d_sockaddr_in6; eval $setvar
11356 $rm_try
11357
11358 echo " "
11359 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11360 $cat >try.c <<EOF
11361 #include <sys/types.h>
11362 #include <sys/socket.h>
11363 #include <netinet/in.h>
11364 int main() {
11365 struct sockaddr_in6 sin6;
11366 return (sin6.sin6_scope_id);
11367 }
11368 EOF
11369 val="$undef"
11370 set try; if eval $compile; then
11371         val="$define"
11372 fi
11373 set d_sin6_scope_id; eval $setvar
11374 $rm_try
11375
11376 echo " "
11377 echo "Checking the availability struct ip_mreq ..." >&4
11378 $cat >try.c <<EOF
11379 #include <sys/types.h>
11380 #include <sys/socket.h>
11381 #include <netinet/in.h>
11382 int main() {
11383 struct ip_mreq mreq;
11384 return (mreq.imr_multiaddr.s_addr);
11385 }
11386 EOF
11387 val="$undef"
11388 set try; if eval $compile; then
11389        val="$define"
11390 fi
11391 set d_ip_mreq; eval $setvar
11392 $rm_try
11393
11394 echo " "
11395 echo "Checking the availability struct ip_mreq_source ..." >&4
11396 $cat >try.c <<EOF
11397 #include <sys/types.h>
11398 #include <sys/socket.h>
11399 #include <netinet/in.h>
11400 int main() {
11401 struct ip_mreq_source mreq;
11402 return (mreq.imr_multiaddr.s_addr);
11403 }
11404 EOF
11405 val="$undef"
11406 set try; if eval $compile; then
11407        val="$define"
11408 fi
11409 set d_ip_mreq_source; eval $setvar
11410 $rm_try
11411
11412 echo " "
11413 echo "Checking the availability struct ipv6_mreq ..." >&4
11414 $cat >try.c <<EOF
11415 #include <sys/types.h>
11416 #include <sys/socket.h>
11417 #include <netinet/in.h>
11418 int main() {
11419 struct ipv6_mreq mreq;
11420 return (mreq.ipv6mr_interface);
11421 }
11422 EOF
11423 val="$undef"
11424 set try; if eval $compile; then
11425         val="$define"
11426 fi
11427 set d_ipv6_mreq; eval $setvar
11428 $rm_try
11429
11430 echo " "
11431 echo "Checking the availability struct ipv6_mreq_source ..." >&4
11432 $cat >try.c <<EOF
11433 #include <sys/types.h>
11434 #include <sys/socket.h>
11435 #include <netinet/in.h>
11436 int main() {
11437 struct ipv6_mreq_source mreq;
11438 return (mreq.imr_multiaddr.s_addr);
11439 }
11440 EOF
11441 val="$undef"
11442 set try; if eval $compile; then
11443        val="$define"
11444 fi
11445 set d_ipv6_mreq_source; eval $setvar
11446 $rm_try
11447
11448 echo " "
11449 echo "Checking the availability of certain socket constants..." >&4
11450 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11451         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11452         $cat >try.c <<EOF
11453 #include <sys/types.h>
11454 #include <sys/socket.h>
11455 int main() {
11456     int i = $ENUM;
11457 }
11458 EOF
11459         val="$undef"
11460         set try; if eval $compile; then
11461                 val="$define"
11462         fi
11463         set d_${enum}; eval $setvar
11464         $rm_try
11465 done
11466
11467 : see if this is a sys/uio.h system
11468 set sys/uio.h i_sysuio
11469 eval $inhdr
11470
11471 : Check for cmsghdr support
11472 echo " "
11473 echo "Checking to see if your system supports struct cmsghdr..." >&4
11474 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11475 eval $hasstruct
11476 case "$d_cmsghdr_s" in
11477 "$define")      echo "Yes, it does."   ;;
11478 *)              echo "No, it doesn't." ;;
11479 esac
11480
11481
11482 : check for const keyword
11483 echo " "
11484 echo 'Checking to see if your C compiler knows about "const"...' >&4
11485 $cat >const.c <<'EOCP'
11486 typedef struct spug { int drokk; } spug;
11487 int main()
11488 {
11489         const char *foo;
11490         const spug y = { 0 };
11491 }
11492 EOCP
11493 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11494         val="$define"
11495         echo "Yup, it does."
11496 else
11497         val="$undef"
11498         echo "Nope, it doesn't."
11499 fi
11500 set d_const
11501 eval $setvar
11502
11503 : see if copysignl exists
11504 set copysignl d_copysignl
11505 eval $inlibc
11506
11507 : see if crypt exists
11508 echo " "
11509 set crypt d_crypt
11510 eval $inlibc
11511 case "$d_crypt" in
11512 $define) cryptlib='' ;;
11513 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11514                 echo 'crypt() found.' >&4
11515                 val="$define"
11516                 cryptlib=''
11517         else
11518                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11519                 if $test -z "$cryptlib"; then
11520                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11521                 else
11522                         cryptlib=-lcrypt
11523                 fi
11524                 if $test -z "$cryptlib"; then
11525                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11526                 else
11527                         cryptlib=-lcrypt
11528                 fi
11529                 if $test -z "$cryptlib"; then
11530                         cryptlib=`./loc libcrypt$_a "" $libpth`
11531                 else
11532                         cryptlib=-lcrypt
11533                 fi
11534                 if $test -z "$cryptlib"; then
11535                         echo 'crypt() NOT found.' >&4
11536                         val="$undef"
11537                 else
11538                         val="$define"
11539                 fi
11540         fi
11541         set d_crypt
11542         eval $setvar
11543         ;;
11544 esac
11545
11546 : see if this is a crypt.h system
11547 set crypt.h i_crypt
11548 eval $inhdr
11549
11550 : see if crypt_r exists
11551 set crypt_r d_crypt_r
11552 eval $inlibc
11553 case "$d_crypt_r" in
11554 "$define")
11555         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11556         case "$d_crypt_r_proto:$usethreads" in
11557         ":define")      d_crypt_r_proto=define
11558                 set d_crypt_r_proto crypt_r $hdrs
11559                 eval $hasproto ;;
11560         *)      ;;
11561         esac
11562         case "$d_crypt_r_proto" in
11563         define)
11564         case "$crypt_r_proto" in
11565         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11566         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11567         esac
11568         case "$crypt_r_proto" in
11569         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11570         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11571         esac
11572         case "$crypt_r_proto" in
11573         ''|0)   d_crypt_r=undef
11574                 crypt_r_proto=0
11575                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11576         * )     case "$crypt_r_proto" in
11577                 REENTRANT_PROTO*) ;;
11578                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11579                 esac
11580                 echo "Prototype: $try" ;;
11581         esac
11582         ;;
11583         *)      case "$usethreads" in
11584                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11585                 esac
11586                 d_crypt_r=undef
11587                 crypt_r_proto=0
11588                 ;;
11589         esac
11590         ;;
11591 *)      crypt_r_proto=0
11592         ;;
11593 esac
11594
11595 : get csh whereabouts
11596 case "$csh" in
11597 'csh') val="$undef" ;;
11598 *) val="$define" ;;
11599 esac
11600 set d_csh
11601 eval $setvar
11602 : Respect a hint or command line value for full_csh.
11603 case "$full_csh" in
11604 '') full_csh=$csh ;;
11605 esac
11606
11607 : see if ctermid exists
11608 set ctermid d_ctermid
11609 eval $inlibc
11610
11611 : see if ctermid_r exists
11612 set ctermid_r d_ctermid_r
11613 eval $inlibc
11614 case "$d_ctermid_r" in
11615 "$define")
11616         hdrs="$i_systypes sys/types.h define stdio.h "
11617         case "$d_ctermid_r_proto:$usethreads" in
11618         ":define")      d_ctermid_r_proto=define
11619                 set d_ctermid_r_proto ctermid_r $hdrs
11620                 eval $hasproto ;;
11621         *)      ;;
11622         esac
11623         case "$d_ctermid_r_proto" in
11624         define)
11625         case "$ctermid_r_proto" in
11626         ''|0) try='char* ctermid_r(char*);'
11627         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11628         esac
11629         case "$ctermid_r_proto" in
11630         ''|0)   d_ctermid_r=undef
11631                 ctermid_r_proto=0
11632                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11633         * )     case "$ctermid_r_proto" in
11634                 REENTRANT_PROTO*) ;;
11635                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11636                 esac
11637                 echo "Prototype: $try" ;;
11638         esac
11639         ;;
11640         *)      case "$usethreads" in
11641                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11642                 esac
11643                 d_ctermid_r=undef
11644                 ctermid_r_proto=0
11645                 ;;
11646         esac
11647         ;;
11648 *)      ctermid_r_proto=0
11649         ;;
11650 esac
11651
11652 : see if ctime_r exists
11653 set ctime_r d_ctime_r
11654 eval $inlibc
11655 case "$d_ctime_r" in
11656 "$define")
11657         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11658         case "$d_ctime_r_proto:$usethreads" in
11659         ":define")      d_ctime_r_proto=define
11660                 set d_ctime_r_proto ctime_r $hdrs
11661                 eval $hasproto ;;
11662         *)      ;;
11663         esac
11664         case "$d_ctime_r_proto" in
11665         define)
11666         case "$ctime_r_proto" in
11667         ''|0) try='char* ctime_r(const time_t*, char*);'
11668         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11669         esac
11670         case "$ctime_r_proto" in
11671         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11672         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11673         esac
11674         case "$ctime_r_proto" in
11675         ''|0) try='int ctime_r(const time_t*, char*);'
11676         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11677         esac
11678         case "$ctime_r_proto" in
11679         ''|0) try='int ctime_r(const time_t*, char*, int);'
11680         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11681         esac
11682         case "$ctime_r_proto" in
11683         ''|0)   d_ctime_r=undef
11684                 ctime_r_proto=0
11685                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11686         * )     case "$ctime_r_proto" in
11687                 REENTRANT_PROTO*) ;;
11688                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11689                 esac
11690                 echo "Prototype: $try" ;;
11691         esac
11692         ;;
11693         *)      case "$usethreads" in
11694                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11695                 esac
11696                 d_ctime_r=undef
11697                 ctime_r_proto=0
11698                 ;;
11699         esac
11700         ;;
11701 *)      ctime_r_proto=0
11702         ;;
11703 esac
11704
11705 : see if cuserid exists
11706 set cuserid d_cuserid
11707 eval $inlibc
11708
11709 : see if this is a limits.h system
11710 set limits.h i_limits
11711 eval $inhdr
11712
11713 : see if this is a float.h system
11714 set float.h i_float
11715 eval $inhdr
11716
11717 : See if number of significant digits in a double precision number is known
11718 echo " "
11719 $cat >dbl_dig.c <<EOM
11720 #$i_limits I_LIMITS
11721 #$i_float I_FLOAT
11722 #ifdef I_LIMITS
11723 #include <limits.h>
11724 #endif
11725 #ifdef I_FLOAT
11726 #include <float.h>
11727 #endif
11728 #ifdef DBL_DIG
11729 printf("Contains DBL_DIG");
11730 #endif
11731 EOM
11732 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11733 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11734         echo "DBL_DIG found." >&4
11735         val="$define"
11736 else
11737         echo "DBL_DIG NOT found." >&4
11738         val="$undef"
11739 fi
11740 $rm -f dbl_dig.?
11741 set d_dbl_dig
11742 eval $setvar
11743
11744 : see if dbm.h is available
11745 : see if dbmclose exists
11746 set dbmclose d_dbmclose
11747 eval $inlibc
11748
11749 case "$d_dbmclose" in
11750 $define)
11751         set dbm.h i_dbm
11752         eval $inhdr
11753         case "$i_dbm" in
11754         $define)
11755                 val="$undef"
11756                 set i_rpcsvcdbm
11757                 eval $setvar
11758                 ;;
11759         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11760                 eval $inhdr
11761                 ;;
11762         esac
11763         ;;
11764 *)      echo "We won't be including <dbm.h>"
11765         val="$undef"
11766         set i_dbm
11767         eval $setvar
11768         val="$undef"
11769         set i_rpcsvcdbm
11770         eval $setvar
11771         ;;
11772 esac
11773
11774 : see if prototype for dbminit is available
11775 echo " "
11776 set d_dbminitproto dbminit $i_dbm dbm.h
11777 eval $hasproto
11778
11779 : see if difftime exists
11780 set difftime d_difftime
11781 eval $inlibc
11782
11783 : see if this is a dirent system
11784 echo " "
11785 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11786         val="$define"
11787         echo "<dirent.h> found." >&4
11788 else
11789         val="$undef"
11790         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11791                 echo "<sys/dir.h> found." >&4
11792                 echo " "
11793         else
11794                 xinc=`./findhdr sys/ndir.h`
11795         fi
11796         echo "<dirent.h> NOT found." >&4
11797 fi
11798 set i_dirent
11799 eval $setvar
11800
11801 : Look for type of directory structure.
11802 echo " "
11803 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11804
11805 case "$direntrytype" in
11806 ''|' ')
11807         case "$i_dirent" in
11808         $define) guess1='struct dirent' ;;
11809         *) guess1='struct direct'  ;;
11810         esac
11811         ;;
11812 *)      guess1="$direntrytype"
11813         ;;
11814 esac
11815
11816 case "$guess1" in
11817 'struct dirent') guess2='struct direct' ;;
11818 *) guess2='struct dirent' ;;
11819 esac
11820
11821 if $contains "$guess1" try.c >/dev/null 2>&1; then
11822         direntrytype="$guess1"
11823         echo "Your directory entries are $direntrytype." >&4
11824 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11825         direntrytype="$guess2"
11826         echo "Your directory entries seem to be $direntrytype." >&4
11827 else
11828         echo "I don't recognize your system's directory entries." >&4
11829         rp="What type is used for directory entries on this system?"
11830         dflt="$guess1"
11831         . ./myread
11832         direntrytype="$ans"
11833 fi
11834 $rm_try
11835
11836 : see if the directory entry stores field length
11837 echo " "
11838 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11839 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11840         echo "Good, your directory entry keeps length information in d_namlen." >&4
11841         val="$define"
11842 else
11843         echo "Your directory entry does not know about the d_namlen field." >&4
11844         val="$undef"
11845 fi
11846 set d_dirnamlen
11847 eval $setvar
11848 $rm_try
11849
11850 : Look for DIR.dd_fd
11851 case "$i_dirent" in
11852 "$define")
11853     echo "Checking to see if DIR has a dd_fd member variable" >&4
11854     $cat >try.c <<EOCP
11855 #$i_stdlib I_STDLIB
11856 #ifdef I_STDLIB
11857 #include <stdlib.h>
11858 #endif
11859 #include <dirent.h>
11860
11861 int main() {
11862     DIR dir;
11863     dir.dd_fd = 1;
11864     return 0;
11865 }
11866 EOCP
11867     val=$undef
11868     set try
11869     if eval $compile; then
11870         echo "Yes, it does."
11871         val="$define"
11872     else
11873         echo "No, it does not."
11874         val="$undef"
11875     fi
11876     ;;
11877 *)
11878     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11879     val="$undef"
11880     ;;
11881 esac
11882 set d_dir_dd_fd
11883 eval $setvar
11884 $rm_try
11885
11886 : see if this is an sysdir system
11887 set sys/dir.h i_sysdir
11888 eval $inhdr
11889
11890 : see if this is an sysndir system
11891 set sys/ndir.h i_sysndir
11892 eval $inhdr
11893
11894 : Look for dirfd
11895 echo " "
11896 $cat >dirfd.c <<EOM
11897 #include <stdio.h>
11898 #$i_stdlib I_STDLIB
11899 #ifdef I_STDLIB
11900 #include <stdlib.h>
11901 #endif
11902 #$i_dirent I_DIRENT             /**/
11903 #$i_sysdir I_SYS_DIR            /**/
11904 #$i_sysndir I_SYS_NDIR          /**/
11905 #$i_systypes I_SYS_TYPES        /**/
11906 #if defined(I_SYS_TYPES)
11907 #include <sys/types.h>
11908 #endif
11909 #if defined(I_DIRENT)
11910 #include <dirent.h>
11911 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11912 #include <sys/dir.h>
11913 #endif
11914 #else
11915 #ifdef I_SYS_NDIR
11916 #include <sys/ndir.h>
11917 #else
11918 #ifdef I_SYS_DIR
11919 #ifdef hp9000s500
11920 #include <ndir.h>       /* may be wrong in the future */
11921 #else
11922 #include <sys/dir.h>
11923 #endif
11924 #endif
11925 #endif
11926 #endif
11927 int main() {
11928         DIR *dirp = opendir(".");
11929         if (dirfd(dirp) >= 0)
11930                 exit(0);
11931         else
11932                 exit(1);
11933 }
11934 EOM
11935 val=$undef
11936 set dirfd
11937 if eval $compile; then
11938         val="$define"
11939 fi
11940 case "$val" in
11941 $define)        echo "dirfd() found." >&4       ;;
11942 *)              echo "dirfd() NOT found." >&4   ;;
11943 esac
11944 set d_dirfd
11945 eval $setvar
11946 $rm -f dirfd*
11947
11948 : see if dlerror exists
11949 xxx_runnm="$runnm"
11950 runnm=false
11951 set dlerror d_dlerror
11952 eval $inlibc
11953 runnm="$xxx_runnm"
11954
11955 : see if dlfcn is available
11956 set dlfcn.h i_dlfcn
11957 eval $inhdr
11958
11959 : Check what extension to use for shared libs
11960 case "$usedl" in
11961 $define|y|true)
11962         $cat << EOM
11963
11964 On a few systems, the dynamically loaded modules that perl generates and uses
11965 will need a different extension than shared libs. The default will probably
11966 be appropriate.
11967
11968 EOM
11969         case "$dlext" in
11970         '')     dflt="$so" ;;
11971         *)      dflt="$dlext" ;;
11972         esac
11973         rp='What is the extension of dynamically loaded modules'
11974         . ./myread
11975         dlext="$ans"
11976         ;;
11977 *)
11978         dlext="none"
11979         ;;
11980 esac
11981
11982 : Check if dlsym need a leading underscore
11983 echo " "
11984 val="$undef"
11985
11986 case "$dlsrc" in
11987 dl_dlopen.xs)
11988         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11989         $cat >dyna.c <<'EOM'
11990 fred () { }
11991 EOM
11992
11993 $cat >fred.c<<EOM
11994
11995 #include <stdio.h>
11996 #$i_stdlib I_STDLIB
11997 #ifdef I_STDLIB
11998 #include <stdlib.h>
11999 #endif
12000 #$i_dlfcn I_DLFCN
12001 #ifdef I_DLFCN
12002 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12003 #else
12004 #include <sys/types.h>
12005 #include <nlist.h>
12006 #include <link.h>
12007 #endif
12008
12009 extern int fred() ;
12010
12011 int main()
12012 {
12013     void * handle ;
12014     void * symbol ;
12015 #ifndef RTLD_LAZY
12016     int mode = 1 ;
12017 #else
12018     int mode = RTLD_LAZY ;
12019 #endif
12020     handle = dlopen("./dyna.$dlext", mode) ;
12021     if (handle == NULL) {
12022         printf ("1\n") ;
12023         fflush (stdout) ;
12024         exit(0);
12025     }
12026     symbol = dlsym(handle, "fred") ;
12027     if (symbol == NULL) {
12028         /* try putting a leading underscore */
12029         symbol = dlsym(handle, "_fred") ;
12030         if (symbol == NULL) {
12031             printf ("2\n") ;
12032             fflush (stdout) ;
12033             exit(0);
12034         }
12035         printf ("3\n") ;
12036     }
12037     else
12038         printf ("4\n") ;
12039     fflush (stdout) ;
12040     exit(0);
12041 }
12042 EOM
12043         : Call the object file tmp-dyna.o in case dlext=o.
12044         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12045                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12046                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12047                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12048                 xxx=`$run ./fred`
12049                 case $xxx in
12050                 1)      echo "Test program failed using dlopen." >&4
12051                         echo "Perhaps you should not use dynamic loading." >&4;;
12052                 2)      echo "Test program failed using dlsym." >&4
12053                         echo "Perhaps you should not use dynamic loading." >&4;;
12054                 3)      echo "dlsym needs a leading underscore" >&4
12055                         val="$define" ;;
12056                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12057                 esac
12058         else
12059                 echo "I can't compile and run the test program." >&4
12060                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12061         fi
12062         ;;
12063 esac
12064
12065 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12066
12067 set d_dlsymun
12068 eval $setvar
12069
12070 : see if drand48_r exists
12071 set drand48_r d_drand48_r
12072 eval $inlibc
12073 case "$d_drand48_r" in
12074 "$define")
12075         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12076         case "$d_drand48_r_proto:$usethreads" in
12077         ":define")      d_drand48_r_proto=define
12078                 set d_drand48_r_proto drand48_r $hdrs
12079                 eval $hasproto ;;
12080         *)      ;;
12081         esac
12082         case "$d_drand48_r_proto" in
12083         define)
12084         case "$drand48_r_proto" in
12085         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12086         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12087         esac
12088         case "$drand48_r_proto" in
12089         ''|0)   d_drand48_r=undef
12090                 drand48_r_proto=0
12091                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12092         * )     case "$drand48_r_proto" in
12093                 REENTRANT_PROTO*) ;;
12094                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12095                 esac
12096                 echo "Prototype: $try" ;;
12097         esac
12098         ;;
12099         *)      case "$usethreads" in
12100                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12101                 esac
12102                 d_drand48_r=undef
12103                 drand48_r_proto=0
12104                 ;;
12105         esac
12106         ;;
12107 *)      drand48_r_proto=0
12108         ;;
12109 esac
12110
12111 : see if prototype for drand48 is available
12112 echo " "
12113 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12114 eval $hasproto
12115
12116 : see if dup2 exists
12117 set dup2 d_dup2
12118 eval $inlibc
12119
12120 : see if eaccess exists
12121 set eaccess d_eaccess
12122 eval $inlibc
12123
12124 : see if endgrent exists
12125 set endgrent d_endgrent
12126 eval $inlibc
12127
12128 : see if this is an grp system
12129 set grp.h i_grp
12130 eval $inhdr
12131
12132 case "$i_grp" in
12133 $define)
12134         xxx=`./findhdr grp.h`
12135         $cppstdin $cppflags $cppminus < $xxx >$$.h
12136
12137         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12138                 val="$define"
12139         else
12140                 val="$undef"
12141         fi
12142         set d_grpasswd
12143         eval $setvar
12144
12145         $rm -f $$.h
12146         ;;
12147 *)
12148         val="$undef";
12149         set d_grpasswd; eval $setvar
12150         ;;
12151 esac
12152
12153 : see if endgrent_r exists
12154 set endgrent_r d_endgrent_r
12155 eval $inlibc
12156 case "$d_endgrent_r" in
12157 "$define")
12158         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12159         case "$d_endgrent_r_proto:$usethreads" in
12160         ":define")      d_endgrent_r_proto=define
12161                 set d_endgrent_r_proto endgrent_r $hdrs
12162                 eval $hasproto ;;
12163         *)      ;;
12164         esac
12165         case "$d_endgrent_r_proto" in
12166         define)
12167         case "$endgrent_r_proto" in
12168         ''|0) try='int endgrent_r(FILE**);'
12169         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12170         esac
12171         case "$endgrent_r_proto" in
12172         ''|0) try='void endgrent_r(FILE**);'
12173         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12174         esac
12175         case "$endgrent_r_proto" in
12176         ''|0)   d_endgrent_r=undef
12177                 endgrent_r_proto=0
12178                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12179         * )     case "$endgrent_r_proto" in
12180                 REENTRANT_PROTO*) ;;
12181                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12182                 esac
12183                 echo "Prototype: $try" ;;
12184         esac
12185         ;;
12186         *)      case "$usethreads" in
12187                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12188                 esac
12189                 d_endgrent_r=undef
12190                 endgrent_r_proto=0
12191                 ;;
12192         esac
12193         ;;
12194 *)      endgrent_r_proto=0
12195         ;;
12196 esac
12197
12198 : see if endhostent exists
12199 set endhostent d_endhent
12200 eval $inlibc
12201
12202 : see if this is a netdb.h system
12203 set netdb.h i_netdb
12204 eval $inhdr
12205
12206 : see if endhostent_r exists
12207 set endhostent_r d_endhostent_r
12208 eval $inlibc
12209 case "$d_endhostent_r" in
12210 "$define")
12211         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12212         case "$d_endhostent_r_proto:$usethreads" in
12213         ":define")      d_endhostent_r_proto=define
12214                 set d_endhostent_r_proto endhostent_r $hdrs
12215                 eval $hasproto ;;
12216         *)      ;;
12217         esac
12218         case "$d_endhostent_r_proto" in
12219         define)
12220         case "$endhostent_r_proto" in
12221         ''|0) try='int endhostent_r(struct hostent_data*);'
12222         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12223         esac
12224         case "$endhostent_r_proto" in
12225         ''|0) try='void endhostent_r(struct hostent_data*);'
12226         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12227         esac
12228         case "$endhostent_r_proto" in
12229         ''|0)   d_endhostent_r=undef
12230                 endhostent_r_proto=0
12231                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12232         * )     case "$endhostent_r_proto" in
12233                 REENTRANT_PROTO*) ;;
12234                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12235                 esac
12236                 echo "Prototype: $try" ;;
12237         esac
12238         ;;
12239         *)      case "$usethreads" in
12240                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12241                 esac
12242                 d_endhostent_r=undef
12243                 endhostent_r_proto=0
12244                 ;;
12245         esac
12246         ;;
12247 *)      endhostent_r_proto=0
12248         ;;
12249 esac
12250
12251 : see if endnetent exists
12252 set endnetent d_endnent
12253 eval $inlibc
12254
12255 : see if endnetent_r exists
12256 set endnetent_r d_endnetent_r
12257 eval $inlibc
12258 case "$d_endnetent_r" in
12259 "$define")
12260         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12261         case "$d_endnetent_r_proto:$usethreads" in
12262         ":define")      d_endnetent_r_proto=define
12263                 set d_endnetent_r_proto endnetent_r $hdrs
12264                 eval $hasproto ;;
12265         *)      ;;
12266         esac
12267         case "$d_endnetent_r_proto" in
12268         define)
12269         case "$endnetent_r_proto" in
12270         ''|0) try='int endnetent_r(struct netent_data*);'
12271         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12272         esac
12273         case "$endnetent_r_proto" in
12274         ''|0) try='void endnetent_r(struct netent_data*);'
12275         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12276         esac
12277         case "$endnetent_r_proto" in
12278         ''|0)   d_endnetent_r=undef
12279                 endnetent_r_proto=0
12280                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12281         * )     case "$endnetent_r_proto" in
12282                 REENTRANT_PROTO*) ;;
12283                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12284                 esac
12285                 echo "Prototype: $try" ;;
12286         esac
12287         ;;
12288         *)      case "$usethreads" in
12289                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12290                 esac
12291                 d_endnetent_r=undef
12292                 endnetent_r_proto=0
12293                 ;;
12294         esac
12295         ;;
12296 *)      endnetent_r_proto=0
12297         ;;
12298 esac
12299
12300 : see if endprotoent exists
12301 set endprotoent d_endpent
12302 eval $inlibc
12303
12304 : see if endprotoent_r exists
12305 set endprotoent_r d_endprotoent_r
12306 eval $inlibc
12307 case "$d_endprotoent_r" in
12308 "$define")
12309         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12310         case "$d_endprotoent_r_proto:$usethreads" in
12311         ":define")      d_endprotoent_r_proto=define
12312                 set d_endprotoent_r_proto endprotoent_r $hdrs
12313                 eval $hasproto ;;
12314         *)      ;;
12315         esac
12316         case "$d_endprotoent_r_proto" in
12317         define)
12318         case "$endprotoent_r_proto" in
12319         ''|0) try='int endprotoent_r(struct protoent_data*);'
12320         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12321         esac
12322         case "$endprotoent_r_proto" in
12323         ''|0) try='void endprotoent_r(struct protoent_data*);'
12324         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12325         esac
12326         case "$endprotoent_r_proto" in
12327         ''|0)   d_endprotoent_r=undef
12328                 endprotoent_r_proto=0
12329                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12330         * )     case "$endprotoent_r_proto" in
12331                 REENTRANT_PROTO*) ;;
12332                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12333                 esac
12334                 echo "Prototype: $try" ;;
12335         esac
12336         ;;
12337         *)      case "$usethreads" in
12338                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12339                 esac
12340                 d_endprotoent_r=undef
12341                 endprotoent_r_proto=0
12342                 ;;
12343         esac
12344         ;;
12345 *)      endprotoent_r_proto=0
12346         ;;
12347 esac
12348
12349 : see if endpwent exists
12350 set endpwent d_endpwent
12351 eval $inlibc
12352
12353 : see if this is a pwd.h system
12354 set pwd.h i_pwd
12355 eval $inhdr
12356
12357 case "$i_pwd" in
12358 $define)
12359         xxx=`./findhdr pwd.h`
12360         $cppstdin $cppflags $cppminus < $xxx >$$.h
12361
12362         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12363                 val="$define"
12364         else
12365                 val="$undef"
12366         fi
12367         set d_pwquota
12368         eval $setvar
12369
12370         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12371                 val="$define"
12372         else
12373                 val="$undef"
12374         fi
12375         set d_pwage
12376         eval $setvar
12377
12378         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12379                 val="$define"
12380         else
12381                 val="$undef"
12382         fi
12383         set d_pwchange
12384         eval $setvar
12385
12386         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12387                 val="$define"
12388         else
12389                 val="$undef"
12390         fi
12391         set d_pwclass
12392         eval $setvar
12393
12394         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12395                 val="$define"
12396         else
12397                 val="$undef"
12398         fi
12399         set d_pwexpire
12400         eval $setvar
12401
12402         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12403                 val="$define"
12404         else
12405                 val="$undef"
12406         fi
12407         set d_pwcomment
12408         eval $setvar
12409
12410         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12411                 val="$define"
12412         else
12413                 val="$undef"
12414         fi
12415         set d_pwgecos
12416         eval $setvar
12417
12418         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12419                 val="$define"
12420         else
12421                 val="$undef"
12422         fi
12423         set d_pwpasswd
12424         eval $setvar
12425
12426         $rm -f $$.h
12427         ;;
12428 *)
12429         val="$undef";
12430         set d_pwquota; eval $setvar
12431         set d_pwage; eval $setvar
12432         set d_pwchange; eval $setvar
12433         set d_pwclass; eval $setvar
12434         set d_pwexpire; eval $setvar
12435         set d_pwcomment; eval $setvar
12436         set d_pwgecos; eval $setvar
12437         set d_pwpasswd; eval $setvar
12438         ;;
12439 esac
12440
12441 : see if endpwent_r exists
12442 set endpwent_r d_endpwent_r
12443 eval $inlibc
12444 case "$d_endpwent_r" in
12445 "$define")
12446         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12447         case "$d_endpwent_r_proto:$usethreads" in
12448         ":define")      d_endpwent_r_proto=define
12449                 set d_endpwent_r_proto endpwent_r $hdrs
12450                 eval $hasproto ;;
12451         *)      ;;
12452         esac
12453         case "$d_endpwent_r_proto" in
12454         define)
12455         case "$endpwent_r_proto" in
12456         ''|0) try='int endpwent_r(FILE**);'
12457         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12458         esac
12459         case "$endpwent_r_proto" in
12460         ''|0) try='void endpwent_r(FILE**);'
12461         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12462         esac
12463         case "$endpwent_r_proto" in
12464         ''|0)   d_endpwent_r=undef
12465                 endpwent_r_proto=0
12466                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12467         * )     case "$endpwent_r_proto" in
12468                 REENTRANT_PROTO*) ;;
12469                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12470                 esac
12471                 echo "Prototype: $try" ;;
12472         esac
12473         ;;
12474         *)      case "$usethreads" in
12475                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12476                 esac
12477                 d_endpwent_r=undef
12478                 endpwent_r_proto=0
12479                 ;;
12480         esac
12481         ;;
12482 *)      endpwent_r_proto=0
12483         ;;
12484 esac
12485
12486 : see if endservent exists
12487 set endservent d_endsent
12488 eval $inlibc
12489
12490 : see if endservent_r exists
12491 set endservent_r d_endservent_r
12492 eval $inlibc
12493 case "$d_endservent_r" in
12494 "$define")
12495         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12496         case "$d_endservent_r_proto:$usethreads" in
12497         ":define")      d_endservent_r_proto=define
12498                 set d_endservent_r_proto endservent_r $hdrs
12499                 eval $hasproto ;;
12500         *)      ;;
12501         esac
12502         case "$d_endservent_r_proto" in
12503         define)
12504         case "$endservent_r_proto" in
12505         ''|0) try='int endservent_r(struct servent_data*);'
12506         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12507         esac
12508         case "$endservent_r_proto" in
12509         ''|0) try='void endservent_r(struct servent_data*);'
12510         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12511         esac
12512         case "$endservent_r_proto" in
12513         ''|0)   d_endservent_r=undef
12514                 endservent_r_proto=0
12515                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12516         * )     case "$endservent_r_proto" in
12517                 REENTRANT_PROTO*) ;;
12518                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12519                 esac
12520                 echo "Prototype: $try" ;;
12521         esac
12522         ;;
12523         *)      case "$usethreads" in
12524                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12525                 esac
12526                 d_endservent_r=undef
12527                 endservent_r_proto=0
12528                 ;;
12529         esac
12530         ;;
12531 *)      endservent_r_proto=0
12532         ;;
12533 esac
12534
12535 : Locate the flags for 'open()'
12536 echo " "
12537 $cat >try.c <<EOCP
12538 #include <sys/types.h>
12539 #ifdef I_FCNTL
12540 #include <fcntl.h>
12541 #endif
12542 #ifdef I_SYS_FILE
12543 #include <sys/file.h>
12544 #endif
12545 #$i_stdlib I_STDLIB
12546 #ifdef I_STDLIB
12547 #include <stdlib.h>
12548 #endif
12549 int main() {
12550         if(O_RDONLY);
12551 #ifdef O_TRUNC
12552         exit(0);
12553 #else
12554         exit(1);
12555 #endif
12556 }
12557 EOCP
12558 : check sys/file.h first to get FREAD on Sun
12559 if $test `./findhdr sys/file.h` && \
12560                 set try -DI_SYS_FILE && eval $compile; then
12561         h_sysfile=true;
12562         echo "<sys/file.h> defines the O_* constants..." >&4
12563         if $run ./try; then
12564                 echo "and you have the 3 argument form of open()." >&4
12565                 val="$define"
12566         else
12567                 echo "but not the 3 argument form of open().  Oh, well." >&4
12568                 val="$undef"
12569         fi
12570 elif $test `./findhdr fcntl.h` && \
12571                 set try -DI_FCNTL && eval $compile; then
12572         h_fcntl=true;
12573         echo "<fcntl.h> defines the O_* constants..." >&4
12574         if $run ./try; then
12575                 echo "and you have the 3 argument form of open()." >&4
12576                 val="$define"
12577         else
12578                 echo "but not the 3 argument form of open().  Oh, well." >&4
12579                 val="$undef"
12580         fi
12581 else
12582         val="$undef"
12583         echo "I can't find the O_* constant definitions!  You got problems." >&4
12584 fi
12585 set d_open3
12586 eval $setvar
12587 $rm_try
12588
12589 : see if this is a sys/file.h system
12590 val=''
12591 set sys/file.h val
12592 eval $inhdr
12593
12594 : do we need to include sys/file.h ?
12595 case "$val" in
12596 "$define")
12597         echo " "
12598         if $h_sysfile; then
12599                 val="$define"
12600                 echo "We'll be including <sys/file.h>." >&4
12601         else
12602                 val="$undef"
12603                 echo "We won't be including <sys/file.h>." >&4
12604         fi
12605         ;;
12606 *)
12607         h_sysfile=false
12608         ;;
12609 esac
12610 set i_sysfile
12611 eval $setvar
12612
12613 : see if fcntl.h is there
12614 val=''
12615 set fcntl.h val
12616 eval $inhdr
12617
12618 : see if we can include fcntl.h
12619 case "$val" in
12620 "$define")
12621         echo " "
12622         if $h_fcntl; then
12623                 val="$define"
12624                 echo "We'll be including <fcntl.h>." >&4
12625         else
12626                 val="$undef"
12627                 if $h_sysfile; then
12628         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12629                 else
12630                         echo "We won't be including <fcntl.h>." >&4
12631                 fi
12632         fi
12633         ;;
12634 *)
12635         h_fcntl=false
12636         val="$undef"
12637         ;;
12638 esac
12639 set i_fcntl
12640 eval $setvar
12641
12642 : see if fork exists
12643 set fork d_fork
12644 eval $inlibc
12645
12646 : see if pipe exists
12647 set pipe d_pipe
12648 eval $inlibc
12649
12650 : check for non-blocking I/O stuff
12651 case "$h_sysfile" in
12652 true) echo "#include <sys/file.h>" > head.c;;
12653 *)
12654        case "$h_fcntl" in
12655        true) echo "#include <fcntl.h>" > head.c;;
12656        *) echo "#include <sys/fcntl.h>" > head.c;;
12657        esac
12658        ;;
12659 esac
12660 echo " "
12661 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12662 case "$o_nonblock" in
12663 '')
12664         $cat head.c > try.c
12665         $cat >>try.c <<EOCP
12666 #include <stdio.h>
12667 #$i_stdlib I_STDLIB
12668 #ifdef I_STDLIB
12669 #include <stdlib.h>
12670 #endif
12671 #$i_fcntl I_FCNTL
12672 #ifdef I_FCNTL
12673 #include <fcntl.h>
12674 #endif
12675 int main() {
12676 #ifdef O_NONBLOCK
12677         printf("O_NONBLOCK\n");
12678         exit(0);
12679 #endif
12680 #ifdef O_NDELAY
12681         printf("O_NDELAY\n");
12682         exit(0);
12683 #endif
12684 #ifdef FNDELAY
12685         printf("FNDELAY\n");
12686         exit(0);
12687 #endif
12688         exit(0);
12689 }
12690 EOCP
12691         set try
12692         if eval $compile_ok; then
12693                 o_nonblock=`$run ./try`
12694                 case "$o_nonblock" in
12695                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12696                 *) echo "Seems like we can use $o_nonblock.";;
12697                 esac
12698         else
12699                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12700         fi
12701         ;;
12702 *) echo "Using $hint value $o_nonblock.";;
12703 esac
12704 $rm_try
12705
12706 echo " "
12707 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12708 case "$eagain" in
12709 '')
12710         case "$d_fork:$d_pipe" in
12711         define:define)
12712         $cat head.c > try.c
12713         $cat >>try.c <<EOCP
12714 #include <errno.h>
12715 #include <sys/types.h>
12716 #include <signal.h>
12717 #include <stdio.h>
12718 #$i_stdlib I_STDLIB
12719 #ifdef I_STDLIB
12720 #include <stdlib.h>
12721 #endif
12722 #$i_fcntl I_FCNTL
12723 #ifdef I_FCNTL
12724 #include <fcntl.h>
12725 #endif
12726 #define MY_O_NONBLOCK $o_nonblock
12727 #ifndef errno  /* XXX need better Configure test */
12728 extern int errno;
12729 #endif
12730 #$i_unistd I_UNISTD
12731 #ifdef I_UNISTD
12732 #include <unistd.h>
12733 #endif
12734 #$i_string I_STRING
12735 #ifdef I_STRING
12736 #include <string.h>
12737 #else
12738 #include <strings.h>
12739 #endif
12740 $signal_t blech(int x) { exit(3); }
12741 EOCP
12742         $cat >> try.c <<'EOCP'
12743 int main()
12744 {
12745         int pd[2];
12746         int pu[2];
12747         char buf[1];
12748         char string[100];
12749
12750         pipe(pd);       /* Down: child -> parent */
12751         pipe(pu);       /* Up: parent -> child */
12752         if (0 != fork()) {
12753                 int ret;
12754                 close(pd[1]);   /* Parent reads from pd[0] */
12755                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12756 #ifdef F_SETFL
12757                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12758                         exit(1);
12759 #else
12760                 exit(4);
12761 #endif
12762                 signal(SIGALRM, blech);
12763                 alarm(5);
12764                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12765                         exit(2);
12766                 sprintf(string, "%d\n", ret);
12767                 write(2, string, strlen(string));
12768                 alarm(0);
12769 #ifdef EAGAIN
12770                 if (errno == EAGAIN) {
12771                         printf("EAGAIN\n");
12772                         goto ok;
12773                 }
12774 #endif
12775 #ifdef EWOULDBLOCK
12776                 if (errno == EWOULDBLOCK)
12777                         printf("EWOULDBLOCK\n");
12778 #endif
12779         ok:
12780                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12781                 sleep(2);                               /* Give it time to close our pipe */
12782                 alarm(5);
12783                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12784                 alarm(0);
12785                 sprintf(string, "%d\n", ret);
12786                 write(4, string, strlen(string));
12787                 exit(0);
12788         }
12789
12790         close(pd[0]);                   /* We write to pd[1] */
12791         close(pu[1]);                   /* We read from pu[0] */
12792         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12793         close(pd[1]);                   /* Pipe pd is now fully closed! */
12794         exit(0);                                /* Bye bye, thank you for playing! */
12795 }
12796 EOCP
12797         set try
12798         if eval $compile_ok; then
12799                 echo "$startsh" >mtry
12800                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12801                 chmod +x mtry
12802                 ./mtry >/dev/null 2>&1
12803                 case $? in
12804                 0) eagain=`$cat try.out`;;
12805                 1) echo "Could not perform non-blocking setting!";;
12806                 2) echo "I did a successful read() for something that was not there!";;
12807                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12808                 4) echo "Could not find F_SETFL!";;
12809                 *) echo "Something terribly wrong happened during testing.";;
12810                 esac
12811                 rd_nodata=`$cat try.ret`
12812                 echo "A read() system call with no data present returns $rd_nodata."
12813                 case "$rd_nodata" in
12814                 0|-1) ;;
12815                 *)
12816                         echo "(That's peculiar, fixing that to be -1.)"
12817                         rd_nodata=-1
12818                         ;;
12819                 esac
12820                 case "$eagain" in
12821                 '')
12822                         echo "Forcing errno EAGAIN on read() with no data available."
12823                         eagain=EAGAIN
12824                         ;;
12825                 *)
12826                         echo "Your read() sets errno to $eagain when no data is available."
12827                         ;;
12828                 esac
12829                 status=`$cat try.err`
12830                 case "$status" in
12831                 0) echo "And it correctly returns 0 to signal EOF.";;
12832                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12833                 *) echo "However, your read() returns '$status' on EOF??";;
12834                 esac
12835                 val="$define"
12836                 if test "$status" = "$rd_nodata"; then
12837                         echo "WARNING: you can't distinguish between EOF and no data!"
12838                         val="$undef"
12839                 fi
12840         else
12841                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12842                 eagain=EAGAIN
12843         fi
12844         ;;
12845         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12846                 eagain=EAGAIN
12847                 val="$define"
12848                 ;;
12849         esac
12850         set d_eofnblk
12851         eval $setvar
12852         ;;
12853 *)
12854         echo "Using $hint value $eagain."
12855         echo "Your read() returns $rd_nodata when no data is present."
12856         case "$d_eofnblk" in
12857         "$define") echo "And you can see EOF because read() returns 0.";;
12858         "$undef") echo "But you can't see EOF status from read() returned value.";;
12859         *)
12860                 echo "(Assuming you can't see EOF status from read anyway.)"
12861                 d_eofnblk=$undef
12862                 ;;
12863         esac
12864         ;;
12865 esac
12866 $rm_try head.c mtry
12867
12868 : see if _ptr and _cnt from stdio act std
12869 echo " "
12870
12871 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12872         echo "(Looks like you have stdio.h from BSD.)"
12873         case "$stdio_ptr" in
12874         '') stdio_ptr='((fp)->_p)'
12875                 ptr_lval=$define
12876                 ;;
12877         *)      ptr_lval=$d_stdio_ptr_lval;;
12878         esac
12879         case "$stdio_cnt" in
12880         '') stdio_cnt='((fp)->_r)'
12881                 cnt_lval=$define
12882                 ;;
12883         *)      cnt_lval=$d_stdio_cnt_lval;;
12884         esac
12885         case "$stdio_base" in
12886         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12887         esac
12888         case "$stdio_bufsiz" in
12889         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12890         esac
12891 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12892         echo "(Looks like you have stdio.h from Linux.)"
12893         case "$stdio_ptr" in
12894         '') stdio_ptr='((fp)->_IO_read_ptr)'
12895                 ptr_lval=$define
12896                 ;;
12897         *)      ptr_lval=$d_stdio_ptr_lval;;
12898         esac
12899         case "$stdio_cnt" in
12900         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12901                 cnt_lval=$undef
12902                 ;;
12903         *)      cnt_lval=$d_stdio_cnt_lval;;
12904         esac
12905         case "$stdio_base" in
12906         '') stdio_base='((fp)->_IO_read_base)';;
12907         esac
12908         case "$stdio_bufsiz" in
12909         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12910         esac
12911 else
12912         case "$stdio_ptr" in
12913         '') stdio_ptr='((fp)->_ptr)'
12914                 ptr_lval=$define
12915                 ;;
12916         *)      ptr_lval=$d_stdio_ptr_lval;;
12917         esac
12918         case "$stdio_cnt" in
12919         '') stdio_cnt='((fp)->_cnt)'
12920                 cnt_lval=$define
12921                 ;;
12922         *)      cnt_lval=$d_stdio_cnt_lval;;
12923         esac
12924         case "$stdio_base" in
12925         '') stdio_base='((fp)->_base)';;
12926         esac
12927         case "$stdio_bufsiz" in
12928         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12929         esac
12930 fi
12931
12932 : test whether _ptr and _cnt really work
12933 echo "Checking how std your stdio is..." >&4
12934 $cat >try.c <<EOP
12935 #include <stdio.h>
12936 #$i_stdlib I_STDLIB
12937 #ifdef I_STDLIB
12938 #include <stdlib.h>
12939 #endif
12940 #define FILE_ptr(fp)    $stdio_ptr
12941 #define FILE_cnt(fp)    $stdio_cnt
12942 int main() {
12943         FILE *fp = fopen("try.c", "r");
12944         char c = getc(fp);
12945         if (
12946                 18 <= FILE_cnt(fp) &&
12947                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12948         )
12949                 exit(0);
12950         exit(1);
12951 }
12952 EOP
12953 val="$undef"
12954 set try
12955 if eval $compile && $to try.c; then
12956         if $run ./try; then
12957                 echo "Your stdio acts pretty std."
12958                 val="$define"
12959         else
12960                 echo "Your stdio isn't very std."
12961         fi
12962 else
12963         echo "Your stdio doesn't appear very std."
12964 fi
12965 $rm_try
12966
12967 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12968 # direct buffer manipulation no longer works.  The Configure tests
12969 # should be changed to correctly detect this, but until then,
12970 # the following check should at least let perl compile and run.
12971 # (This quick fix should be updated before 5.8.1.)
12972 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12973 # A. Dougherty, June 3, 2002.
12974 case "$d_gnulibc" in
12975 $define)
12976         case "$gnulibc_version" in
12977         2.[01]*)  ;;
12978         2.2) ;;
12979         2.2.[0-9]) ;;
12980         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12981                 val="$undef"
12982                 ;;
12983         esac
12984         ;;
12985 esac
12986 set d_stdstdio
12987 eval $setvar
12988
12989 : Can _ptr be used as an lvalue?
12990 case "$d_stdstdio$ptr_lval" in
12991 $define$define) val=$define ;;
12992 *) val=$undef ;;
12993 esac
12994 set d_stdio_ptr_lval
12995 eval $setvar
12996
12997 : Can _cnt be used as an lvalue?
12998 case "$d_stdstdio$cnt_lval" in
12999 $define$define) val=$define ;;
13000 *) val=$undef ;;
13001 esac
13002 set d_stdio_cnt_lval
13003 eval $setvar
13004
13005
13006 : test whether setting _ptr sets _cnt as a side effect
13007 d_stdio_ptr_lval_sets_cnt="$undef"
13008 d_stdio_ptr_lval_nochange_cnt="$undef"
13009 case "$d_stdio_ptr_lval$d_stdstdio" in
13010 $define$define)
13011         echo "Checking to see what happens if we set the stdio ptr..." >&4
13012 $cat >try.c <<EOP
13013 #include <stdio.h>
13014 /* Can we scream? */
13015 /* Eat dust sed :-) */
13016 /* In the buffer space, no one can hear you scream. */
13017 #$i_stdlib I_STDLIB
13018 #ifdef I_STDLIB
13019 #include <stdlib.h>
13020 #endif
13021 #define FILE_ptr(fp)    $stdio_ptr
13022 #define FILE_cnt(fp)    $stdio_cnt
13023 #include <sys/types.h>
13024 int main() {
13025         FILE *fp = fopen("try.c", "r");
13026         int c;
13027         char *ptr;
13028         size_t cnt;
13029         if (!fp) {
13030             puts("Fail even to read");
13031             exit(1);
13032         }
13033         c = getc(fp); /* Read away the first # */
13034         if (c == EOF) {
13035             puts("Fail even to read");
13036             exit(1);
13037         }
13038         if (!(
13039                 18 <= FILE_cnt(fp) &&
13040                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13041         )) {
13042                 puts("Fail even to read");
13043                 exit (1);
13044         }
13045         ptr = (char*) FILE_ptr(fp);
13046         cnt = (size_t)FILE_cnt(fp);
13047
13048         FILE_ptr(fp) += 42;
13049
13050         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13051                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13052                 exit (1);
13053         }
13054         if (FILE_cnt(fp) <= 20) {
13055                 printf ("Fail (<20 chars to test)");
13056                 exit (1);
13057         }
13058         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13059                 puts("Fail compare");
13060                 exit (1);
13061         }
13062         if (cnt == FILE_cnt(fp)) {
13063                 puts("Pass_unchanged");
13064                 exit (0);
13065         }
13066         if (FILE_cnt(fp) == (cnt - 42)) {
13067                 puts("Pass_changed");
13068                 exit (0);
13069         }
13070         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13071         return 1;
13072
13073 }
13074 EOP
13075         set try
13076         if eval $compile && $to try.c; then
13077                 case `$run ./try` in
13078                 Pass_changed)
13079                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13080                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13081                 Pass_unchanged)
13082                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13083                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13084                 Fail*)
13085                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13086                 *)
13087                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13088         esac
13089         else
13090                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13091         fi
13092         $rm_try
13093         ;;
13094 esac
13095
13096 : see if _base is also standard
13097 val="$undef"
13098 case "$d_stdstdio" in
13099 $define)
13100         $cat >try.c <<EOP
13101 #include <stdio.h>
13102 #$i_stdlib I_STDLIB
13103 #ifdef I_STDLIB
13104 #include <stdlib.h>
13105 #endif
13106 #define FILE_base(fp)   $stdio_base
13107 #define FILE_bufsiz(fp) $stdio_bufsiz
13108 int main() {
13109         FILE *fp = fopen("try.c", "r");
13110         char c = getc(fp);
13111         if (
13112                 19 <= FILE_bufsiz(fp) &&
13113                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13114         )
13115                 exit(0);
13116         exit(1);
13117 }
13118 EOP
13119         set try
13120         if eval $compile && $to try.c; then
13121                 if $run ./try; then
13122                         echo "And its _base field acts std."
13123                         val="$define"
13124                 else
13125                         echo "But its _base field isn't std."
13126                 fi
13127         else
13128                 echo "However, it seems to be lacking the _base field."
13129         fi
13130         $rm_try
13131         ;;
13132 esac
13133 set d_stdiobase
13134 eval $setvar
13135
13136 : see if fast_stdio exists
13137 val="$undef"
13138 case "$d_stdstdio:$d_stdio_ptr_lval" in
13139 "$define:$define")
13140         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13141         *$define*)
13142                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13143                 val="$define"
13144                 ;;
13145         esac
13146         ;;
13147 esac
13148 set d_faststdio
13149 eval $setvar
13150
13151
13152
13153 : see if fchdir exists
13154 set fchdir d_fchdir
13155 eval $inlibc
13156
13157 : see if fchmod exists
13158 set fchmod d_fchmod
13159 eval $inlibc
13160
13161 : see if fchown exists
13162 set fchown d_fchown
13163 eval $inlibc
13164
13165 : see if this is an fcntl system
13166 set fcntl d_fcntl
13167 eval $inlibc
13168
13169 : See if fcntl-based locking works.
13170 echo " "
13171 $cat >try.c <<EOCP
13172 #$i_stdlib I_STDLIB
13173 #ifdef I_STDLIB
13174 #include <stdlib.h>
13175 #endif
13176 #include <unistd.h>
13177 #include <fcntl.h>
13178 #include <signal.h>
13179 $signal_t blech(int x) { exit(3); }
13180 int main() {
13181 #if defined(F_SETLK) && defined(F_SETLKW)
13182      struct flock flock;
13183      int retval, fd;
13184      fd = open("try.c", O_RDONLY);
13185      flock.l_type = F_RDLCK;
13186      flock.l_whence = SEEK_SET;
13187      flock.l_start = flock.l_len = 0;
13188      signal(SIGALRM, blech);
13189      alarm(10);
13190      retval = fcntl(fd, F_SETLK, &flock);
13191      close(fd);
13192      (retval < 0 ? exit(2) : exit(0));
13193 #else
13194      exit(2);
13195 #endif
13196 }
13197 EOCP
13198 echo "Checking if fcntl-based file locking works... "
13199 case "$d_fcntl" in
13200 "$define")
13201         set try
13202         if eval $compile_ok; then
13203                 if $run ./try; then
13204                         echo "Yes, it seems to work."
13205                         val="$define"
13206                 else
13207                         echo "Nope, it didn't work."
13208                         val="$undef"
13209                         case "$?" in
13210                         3) $cat >&4 <<EOM
13211 ***
13212 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13213 *** This is (almost) impossible.
13214 *** If your NFS lock daemons are not feeling well, something like
13215 *** this may happen, please investigate.  Cannot continue, aborting.
13216 ***
13217 EOM
13218                                 exit 1
13219                                 ;;
13220                         esac
13221                 fi
13222         else
13223                 echo "I'm unable to compile the test program, so I'll assume not."
13224                 val="$undef"
13225         fi
13226         ;;
13227 *) val="$undef";
13228         echo "Nope, since you don't even have fcntl()."
13229         ;;
13230 esac
13231 set d_fcntl_can_lock
13232 eval $setvar
13233 $rm_try
13234
13235 : check for fd_set items
13236 $cat <<EOM
13237
13238 Checking to see how well your C compiler handles fd_set and friends ...
13239 EOM
13240 $cat >try.c <<EOCP
13241 #$i_stdlib I_STDLIB
13242 #ifdef I_STDLIB
13243 #include <stdlib.h>
13244 #endif
13245 #$i_systime I_SYS_TIME
13246 #$i_sysselct I_SYS_SELECT
13247 #$d_socket HAS_SOCKET
13248 #include <sys/types.h>
13249 #ifdef HAS_SOCKET
13250 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13251 #endif
13252 #ifdef I_SYS_TIME
13253 #include <sys/time.h>
13254 #endif
13255 #ifdef I_SYS_SELECT
13256 #include <sys/select.h>
13257 #endif
13258 int main() {
13259         fd_set fds;
13260
13261 #ifdef TRYBITS
13262         if(fds.fds_bits);
13263 #endif
13264
13265 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13266         exit(0);
13267 #else
13268         exit(1);
13269 #endif
13270 }
13271 EOCP
13272 set try -DTRYBITS
13273 if eval $compile; then
13274         d_fds_bits="$define"
13275         d_fd_set="$define"
13276         echo "Well, your system knows about the normal fd_set typedef..." >&4
13277         if $run ./try; then
13278                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13279                 d_fd_macros="$define"
13280         else
13281                 $cat >&4 <<'EOM'
13282 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13283 EOM
13284                 d_fd_macros="$undef"
13285         fi
13286 else
13287         $cat <<'EOM'
13288 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13289 EOM
13290         set try
13291         if eval $compile; then
13292                 d_fds_bits="$undef"
13293                 d_fd_set="$define"
13294                 echo "Well, your system has some sort of fd_set available..." >&4
13295                 if $run ./try; then
13296                         echo "and you have the normal fd_set macros." >&4
13297                         d_fd_macros="$define"
13298                 else
13299                         $cat <<'EOM'
13300 but not the normal fd_set macros!  Gross!  More work for me...
13301 EOM
13302                         d_fd_macros="$undef"
13303                 fi
13304         else
13305         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13306                 d_fd_set="$undef"
13307                 d_fds_bits="$undef"
13308                 d_fd_macros="$undef"
13309         fi
13310 fi
13311 $rm_try
13312
13313 : see if fgetpos exists
13314 set fgetpos d_fgetpos
13315 eval $inlibc
13316
13317 : see if finite exists
13318 set finite d_finite
13319 eval $inlibc
13320
13321 : see if finitel exists
13322 set finitel d_finitel
13323 eval $inlibc
13324
13325 : see if flock exists
13326 set flock d_flock
13327 eval $inlibc
13328
13329 : see if prototype for flock is available
13330 echo " "
13331 set d_flockproto flock $i_sysfile sys/file.h
13332 eval $hasproto
13333
13334 : see if fp_class exists
13335 set fp_class d_fp_class
13336 eval $inlibc
13337
13338 : see if pathconf exists
13339 set pathconf d_pathconf
13340 eval $inlibc
13341
13342 : see if fpathconf exists
13343 set fpathconf d_fpathconf
13344 eval $inlibc
13345
13346 : see if fpclass exists
13347 set fpclass d_fpclass
13348 eval $inlibc
13349
13350 : see if fpclassify exists
13351 set fpclassify d_fpclassify
13352 eval $inlibc
13353
13354 : see if fpclassl exists
13355 set fpclassl d_fpclassl
13356 eval $inlibc
13357
13358 : check for fpos64_t
13359 echo " "
13360 echo "Checking to see if you have fpos64_t..." >&4
13361 $cat >try.c <<EOCP
13362 #include <stdio.h>
13363 int main() { fpos64_t x = 7; }
13364 EOCP
13365 set try
13366 if eval $compile; then
13367         val="$define"
13368         echo "You have fpos64_t."
13369 else
13370         val="$undef"
13371         echo "You do not have fpos64_t."
13372         case "$fpossize" in
13373         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13374         esac
13375 fi
13376 $rm_try
13377 set d_fpos64_t
13378 eval $setvar
13379
13380 : see if frexpl exists
13381 set frexpl d_frexpl
13382 eval $inlibc
13383
13384 : see if this is a sys/param system
13385 set sys/param.h i_sysparam
13386 eval $inhdr
13387
13388 : see if this is a sys/mount.h system
13389 set sys/mount.h i_sysmount
13390 eval $inhdr
13391
13392 : Check for fs_data_s
13393 echo " "
13394 echo "Checking to see if your system supports struct fs_data..." >&4
13395 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13396 eval $hasstruct
13397 case "$d_fs_data_s" in
13398 "$define")      echo "Yes, it does."   ;;
13399 *)              echo "No, it doesn't." ;;
13400 esac
13401
13402 : see if fseeko exists
13403 set fseeko d_fseeko
13404 eval $inlibc
13405 case "$longsize" in
13406 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13407 esac
13408
13409 : see if fsetpos exists
13410 set fsetpos d_fsetpos
13411 eval $inlibc
13412
13413 : see if fstatfs exists
13414 set fstatfs d_fstatfs
13415 eval $inlibc
13416
13417 : see if statvfs exists
13418 set statvfs d_statvfs
13419 eval $inlibc
13420
13421 : see if fstatvfs exists
13422 set fstatvfs d_fstatvfs
13423 eval $inlibc
13424
13425
13426 : see if fsync exists
13427 set fsync d_fsync
13428 eval $inlibc
13429
13430 : see if ftello exists
13431 set ftello d_ftello
13432 eval $inlibc
13433 case "$longsize" in
13434 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13435 esac
13436
13437 : check for a working futimes
13438 d_futimes="$undef"
13439 echo " "
13440 echo "Checking if you have a working futimes()" >&4
13441 $cat >try.c <<EOCP
13442 #include <stdio.h>
13443 #include <sys/time.h>
13444 #include <errno.h>
13445 #include <fcntl.h>
13446
13447 int main ()
13448 {
13449     int fd, rv;
13450     fd = open ("try.c", O_RDWR);
13451     if (-1 == fd) exit (1);
13452     rv = futimes (fd, NULL);
13453     exit (rv == -1 ? errno : 0);
13454 }
13455 EOCP
13456 set try
13457 if eval $compile; then
13458     `$run ./try`
13459     rc=$?
13460     case "$rc" in
13461         0)  echo "Yes, you have" >&4
13462             d_futimes="$define"
13463             ;;
13464         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13465             ;;
13466     esac
13467 else
13468     echo "No, it does not (probably harmless)" >&4
13469 fi
13470 $rm_try
13471
13472 : see if ndbm.h is available
13473 set ndbm.h i_ndbm
13474 eval $inhdr
13475 : Compatibility location for RedHat 7.1
13476 set gdbm/ndbm.h i_gdbmndbm
13477 eval $inhdr
13478 : Compatibility location for Debian 4.0
13479 set gdbm-ndbm.h i_gdbm_ndbm
13480 eval $inhdr
13481
13482 val="$undef"
13483 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13484         : see if dbm_open exists
13485         set dbm_open d_dbm_open
13486         eval $inlibc
13487         case "$d_dbm_open" in
13488         $undef)
13489                 i_ndbm="$undef"
13490                 i_gdbmndbm="$undef"
13491                 i_gdbm_ndbm="$undef"
13492                 echo "We won't be including <ndbm.h>"
13493                 val="$undef"
13494                 ;;
13495         *) val="$define"
13496            ;;
13497         esac
13498 fi
13499 set d_ndbm
13500 eval $setvar
13501
13502 ndbm_hdr_protochk='name=$1; hdr=$2;
13503 eval "ihdr=\$""i_$name";
13504 val="$undef";
13505 if $test "$ihdr" = "$define"; then
13506         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13507         case "$d_cplusplus" in
13508         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13509         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13510         esac;
13511         case "$val" in
13512         $define) $echo "Your <$hdr> seems to have prototypes";;
13513         *) $echo "Your <$hdr> does not seem to have prototypes";;
13514         esac;
13515 fi;
13516 set "d_${name}_h_uses_prototypes";
13517 eval $setvar'
13518
13519 set ndbm ndbm.h
13520 eval $ndbm_hdr_protochk
13521 set gdbmndbm gdbm/ndbm.h
13522 eval $ndbm_hdr_protochk
13523 set gdbm_ndbm gdbm-ndbm.h
13524 eval $ndbm_hdr_protochk
13525
13526 : see if getaddrinfo exists
13527 set getaddrinfo d_getaddrinfo
13528 eval $inlibc
13529
13530 : see if getcwd exists
13531 set getcwd d_getcwd
13532 eval $inlibc
13533
13534 : see if getespwnam exists
13535 set getespwnam d_getespwnam
13536 eval $inlibc
13537
13538 : see if getfsstat exists
13539 set getfsstat d_getfsstat
13540 eval $inlibc
13541
13542 : see if getgrent exists
13543 set getgrent d_getgrent
13544 eval $inlibc
13545
13546 : see if getgrent_r exists
13547 set getgrent_r d_getgrent_r
13548 eval $inlibc
13549 case "$d_getgrent_r" in
13550 "$define")
13551         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13552         case "$d_getgrent_r_proto:$usethreads" in
13553         ":define")      d_getgrent_r_proto=define
13554                 set d_getgrent_r_proto getgrent_r $hdrs
13555                 eval $hasproto ;;
13556         *)      ;;
13557         esac
13558         case "$d_getgrent_r_proto" in
13559         define)
13560         case "$getgrent_r_proto" in
13561         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13562         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13563         esac
13564         case "$getgrent_r_proto" in
13565         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13566         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13567         esac
13568         case "$getgrent_r_proto" in
13569         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13570         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13571         esac
13572         case "$getgrent_r_proto" in
13573         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13574         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13575         esac
13576         case "$getgrent_r_proto" in
13577         ''|0) try='int getgrent_r(struct group*, char*, int);'
13578         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13579         esac
13580         case "$getgrent_r_proto" in
13581         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13582         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13583         esac
13584         case "$getgrent_r_proto" in
13585         ''|0)   d_getgrent_r=undef
13586                 getgrent_r_proto=0
13587                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13588         * )     case "$getgrent_r_proto" in
13589                 REENTRANT_PROTO*) ;;
13590                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13591                 esac
13592                 echo "Prototype: $try" ;;
13593         esac
13594         ;;
13595         *)      case "$usethreads" in
13596                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13597                 esac
13598                 d_getgrent_r=undef
13599                 getgrent_r_proto=0
13600                 ;;
13601         esac
13602         ;;
13603 *)      getgrent_r_proto=0
13604         ;;
13605 esac
13606
13607 : see if getgrgid_r exists
13608 set getgrgid_r d_getgrgid_r
13609 eval $inlibc
13610 case "$d_getgrgid_r" in
13611 "$define")
13612         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13613         case "$d_getgrgid_r_proto:$usethreads" in
13614         ":define")      d_getgrgid_r_proto=define
13615                 set d_getgrgid_r_proto getgrgid_r $hdrs
13616                 eval $hasproto ;;
13617         *)      ;;
13618         esac
13619         case "$d_getgrgid_r_proto" in
13620         define)
13621         case "$getgrgid_r_proto" in
13622         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13623         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13624         esac
13625         case "$getgrgid_r_proto" in
13626         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13627         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13628         esac
13629         case "$getgrgid_r_proto" in
13630         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13631         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13632         esac
13633         case "$getgrgid_r_proto" in
13634         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13635         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13636         esac
13637         case "$getgrgid_r_proto" in
13638         ''|0)   d_getgrgid_r=undef
13639                 getgrgid_r_proto=0
13640                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13641         * )     case "$getgrgid_r_proto" in
13642                 REENTRANT_PROTO*) ;;
13643                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13644                 esac
13645                 echo "Prototype: $try" ;;
13646         esac
13647         ;;
13648         *)      case "$usethreads" in
13649                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13650                 esac
13651                 d_getgrgid_r=undef
13652                 getgrgid_r_proto=0
13653                 ;;
13654         esac
13655         ;;
13656 *)      getgrgid_r_proto=0
13657         ;;
13658 esac
13659
13660 : see if getgrnam_r exists
13661 set getgrnam_r d_getgrnam_r
13662 eval $inlibc
13663 case "$d_getgrnam_r" in
13664 "$define")
13665         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13666         case "$d_getgrnam_r_proto:$usethreads" in
13667         ":define")      d_getgrnam_r_proto=define
13668                 set d_getgrnam_r_proto getgrnam_r $hdrs
13669                 eval $hasproto ;;
13670         *)      ;;
13671         esac
13672         case "$d_getgrnam_r_proto" in
13673         define)
13674         case "$getgrnam_r_proto" in
13675         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13676         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13677         esac
13678         case "$getgrnam_r_proto" in
13679         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13680         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13681         esac
13682         case "$getgrnam_r_proto" in
13683         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13684         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13685         esac
13686         case "$getgrnam_r_proto" in
13687         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13688         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13689         esac
13690         case "$getgrnam_r_proto" in
13691         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13692         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13693         esac
13694         case "$getgrnam_r_proto" in
13695         ''|0)   d_getgrnam_r=undef
13696                 getgrnam_r_proto=0
13697                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13698         * )     case "$getgrnam_r_proto" in
13699                 REENTRANT_PROTO*) ;;
13700                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13701                 esac
13702                 echo "Prototype: $try" ;;
13703         esac
13704         ;;
13705         *)      case "$usethreads" in
13706                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13707                 esac
13708                 d_getgrnam_r=undef
13709                 getgrnam_r_proto=0
13710                 ;;
13711         esac
13712         ;;
13713 *)      getgrnam_r_proto=0
13714         ;;
13715 esac
13716
13717 : see if gethostbyaddr exists
13718 set gethostbyaddr d_gethbyaddr
13719 eval $inlibc
13720
13721 : see if gethostbyname exists
13722 set gethostbyname d_gethbyname
13723 eval $inlibc
13724
13725 : see if gethostent exists
13726 set gethostent d_gethent
13727 eval $inlibc
13728
13729 : see how we will look up host name
13730 echo " "
13731 call=''
13732 if set gethostname val -f d_gethname; eval $csym; $val; then
13733         echo 'gethostname() found.' >&4
13734         d_gethname="$define"
13735         call=gethostname
13736 fi
13737 if set uname val -f d_uname; eval $csym; $val; then
13738         if ./xenix; then
13739                 $cat <<'EOM'
13740 uname() was found, but you're running xenix, and older versions of xenix
13741 have a broken uname(). If you don't really know whether your xenix is old
13742 enough to have a broken system call, use the default answer.
13743
13744 EOM
13745                 dflt=y
13746                 case "$d_uname" in
13747                 "$define") dflt=n;;
13748                 esac
13749                 rp='Is your uname() broken?'
13750                 . ./myread
13751                 case "$ans" in
13752                 n*) d_uname="$define"; call=uname;;
13753                 esac
13754         else
13755                 echo 'uname() found.' >&4
13756                 d_uname="$define"
13757                 case "$call" in
13758                 '') call=uname ;;
13759                 esac
13760         fi
13761 fi
13762 case "$d_gethname" in
13763 '') d_gethname="$undef";;
13764 esac
13765 case "$d_uname" in
13766 '') d_uname="$undef";;
13767 esac
13768 case "$d_uname$d_gethname" in
13769 *define*)
13770         dflt=n
13771         cat <<EOM
13772
13773 Every now and then someone has a $call() that lies about the hostname
13774 but can't be fixed for political or economic reasons.  If you wish, I can
13775 pretend $call() isn't there and maybe compute hostname at run-time
13776 thanks to the '$phostname' command.
13777
13778 EOM
13779         rp="Shall I ignore $call() from now on?"
13780         . ./myread
13781         case "$ans" in
13782         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13783         esac;;
13784 esac
13785 case "$phostname" in
13786 '') aphostname='';;
13787 *) case "$aphostname" in
13788         /*) ;;
13789         *) set X $phostname
13790                 shift
13791                 file=$1
13792                 shift
13793                 file=`./loc $file $file $pth`
13794                 aphostname=`echo $file $*`
13795                 ;;
13796         esac
13797         ;;
13798 esac
13799 case "$d_uname$d_gethname" in
13800 *define*) ;;
13801 *)
13802         case "$phostname" in
13803         '')
13804                 echo "There will be no way for $package to get your hostname." >&4;;
13805         *)
13806         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13807                 ;;
13808         esac;;
13809 esac
13810 case "$d_phostname" in
13811 '') d_phostname="$undef";;
13812 esac
13813
13814 : see if gethostbyaddr_r exists
13815 set gethostbyaddr_r d_gethostbyaddr_r
13816 eval $inlibc
13817 case "$d_gethostbyaddr_r" in
13818 "$define")
13819         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13820         case "$d_gethostbyaddr_r_proto:$usethreads" in
13821         ":define")      d_gethostbyaddr_r_proto=define
13822                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13823                 eval $hasproto ;;
13824         *)      ;;
13825         esac
13826         case "$d_gethostbyaddr_r_proto" in
13827         define)
13828         case "$gethostbyaddr_r_proto" in
13829         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13830         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13831         esac
13832         case "$gethostbyaddr_r_proto" in
13833         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13834         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13835         esac
13836         case "$gethostbyaddr_r_proto" in
13837         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13838         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13839         esac
13840         case "$gethostbyaddr_r_proto" in
13841         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13842         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13843         esac
13844         case "$gethostbyaddr_r_proto" in
13845         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13846         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13847         esac
13848         case "$gethostbyaddr_r_proto" in
13849         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13850         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13851         esac
13852         case "$gethostbyaddr_r_proto" in
13853         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13854         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13855         esac
13856         case "$gethostbyaddr_r_proto" in
13857         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13858         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13859         esac
13860         case "$gethostbyaddr_r_proto" in
13861         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13862         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13863         esac
13864         case "$gethostbyaddr_r_proto" in
13865         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13866         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13867         esac
13868         case "$gethostbyaddr_r_proto" in
13869         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13870         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13871         esac
13872         case "$gethostbyaddr_r_proto" in
13873         ''|0)   d_gethostbyaddr_r=undef
13874                 gethostbyaddr_r_proto=0
13875                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13876         * )     case "$gethostbyaddr_r_proto" in
13877                 REENTRANT_PROTO*) ;;
13878                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13879                 esac
13880                 echo "Prototype: $try" ;;
13881         esac
13882         ;;
13883         *)      case "$usethreads" in
13884                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13885                 esac
13886                 d_gethostbyaddr_r=undef
13887                 gethostbyaddr_r_proto=0
13888                 ;;
13889         esac
13890         ;;
13891 *)      gethostbyaddr_r_proto=0
13892         ;;
13893 esac
13894
13895 : see if gethostbyname_r exists
13896 set gethostbyname_r d_gethostbyname_r
13897 eval $inlibc
13898 case "$d_gethostbyname_r" in
13899 "$define")
13900         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13901         case "$d_gethostbyname_r_proto:$usethreads" in
13902         ":define")      d_gethostbyname_r_proto=define
13903                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13904                 eval $hasproto ;;
13905         *)      ;;
13906         esac
13907         case "$d_gethostbyname_r_proto" in
13908         define)
13909         case "$gethostbyname_r_proto" in
13910         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13911         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13912         esac
13913         case "$gethostbyname_r_proto" in
13914         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13915         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13916         esac
13917         case "$gethostbyname_r_proto" in
13918         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13919         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13920         esac
13921         case "$gethostbyname_r_proto" in
13922         ''|0)   d_gethostbyname_r=undef
13923                 gethostbyname_r_proto=0
13924                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13925         * )     case "$gethostbyname_r_proto" in
13926                 REENTRANT_PROTO*) ;;
13927                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13928                 esac
13929                 echo "Prototype: $try" ;;
13930         esac
13931         ;;
13932         *)      case "$usethreads" in
13933                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13934                 esac
13935                 d_gethostbyname_r=undef
13936                 gethostbyname_r_proto=0
13937                 ;;
13938         esac
13939         ;;
13940 *)      gethostbyname_r_proto=0
13941         ;;
13942 esac
13943
13944 : see if gethostent_r exists
13945 set gethostent_r d_gethostent_r
13946 eval $inlibc
13947 case "$d_gethostent_r" in
13948 "$define")
13949         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13950         case "$d_gethostent_r_proto:$usethreads" in
13951         ":define")      d_gethostent_r_proto=define
13952                 set d_gethostent_r_proto gethostent_r $hdrs
13953                 eval $hasproto ;;
13954         *)      ;;
13955         esac
13956         case "$d_gethostent_r_proto" in
13957         define)
13958         case "$gethostent_r_proto" in
13959         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13960         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13961         esac
13962         case "$gethostent_r_proto" in
13963         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13964         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13965         esac
13966         case "$gethostent_r_proto" in
13967         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13968         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13969         esac
13970         case "$gethostent_r_proto" in
13971         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13972         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
13973         esac
13974         case "$gethostent_r_proto" in
13975         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13976         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
13977         esac
13978         case "$gethostent_r_proto" in
13979         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13980         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
13981         esac
13982         case "$gethostent_r_proto" in
13983         ''|0)   d_gethostent_r=undef
13984                 gethostent_r_proto=0
13985                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13986         * )     case "$gethostent_r_proto" in
13987                 REENTRANT_PROTO*) ;;
13988                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13989                 esac
13990                 echo "Prototype: $try" ;;
13991         esac
13992         ;;
13993         *)      case "$usethreads" in
13994                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13995                 esac
13996                 d_gethostent_r=undef
13997                 gethostent_r_proto=0
13998                 ;;
13999         esac
14000         ;;
14001 *)      gethostent_r_proto=0
14002         ;;
14003 esac
14004
14005 : see if prototypes for various gethostxxx netdb.h functions are available
14006 echo " "
14007 set d_gethostprotos gethostent $i_netdb netdb.h
14008 eval $hasproto
14009
14010 : see if getitimer exists
14011 set getitimer d_getitimer
14012 eval $inlibc
14013
14014 : see if getlogin exists
14015 set getlogin d_getlogin
14016 eval $inlibc
14017
14018 : see if getlogin_r exists
14019 set getlogin_r d_getlogin_r
14020 eval $inlibc
14021 case "$d_getlogin_r" in
14022 "$define")
14023         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14024         case "$d_getlogin_r_proto:$usethreads" in
14025         ":define")      d_getlogin_r_proto=define
14026                 set d_getlogin_r_proto getlogin_r $hdrs
14027                 eval $hasproto ;;
14028         *)      ;;
14029         esac
14030         case "$d_getlogin_r_proto" in
14031         define)
14032         case "$getlogin_r_proto" in
14033         ''|0) try='int getlogin_r(char*, size_t);'
14034         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14035         esac
14036         case "$getlogin_r_proto" in
14037         ''|0) try='int getlogin_r(char*, int);'
14038         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14039         esac
14040         case "$getlogin_r_proto" in
14041         ''|0) try='char* getlogin_r(char*, size_t);'
14042         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14043         esac
14044         case "$getlogin_r_proto" in
14045         ''|0) try='char* getlogin_r(char*, int);'
14046         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14047         esac
14048         case "$getlogin_r_proto" in
14049         ''|0)   d_getlogin_r=undef
14050                 getlogin_r_proto=0
14051                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14052         * )     case "$getlogin_r_proto" in
14053                 REENTRANT_PROTO*) ;;
14054                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14055                 esac
14056                 echo "Prototype: $try" ;;
14057         esac
14058         ;;
14059         *)      case "$usethreads" in
14060                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14061                 esac
14062                 d_getlogin_r=undef
14063                 getlogin_r_proto=0
14064                 ;;
14065         esac
14066         ;;
14067 *)      getlogin_r_proto=0
14068         ;;
14069 esac
14070
14071 : see if getmnt exists
14072 set getmnt d_getmnt
14073 eval $inlibc
14074
14075 : see if getmntent exists
14076 set getmntent d_getmntent
14077 eval $inlibc
14078
14079 : see if getnameinfo exists
14080 set getnameinfo d_getnameinfo
14081 eval $inlibc
14082
14083 : see if getnetbyaddr exists
14084 set getnetbyaddr d_getnbyaddr
14085 eval $inlibc
14086
14087 : see if getnetbyname exists
14088 set getnetbyname d_getnbyname
14089 eval $inlibc
14090
14091 : see if getnetent exists
14092 set getnetent d_getnent
14093 eval $inlibc
14094
14095 : see if getnetbyaddr_r exists
14096 set getnetbyaddr_r d_getnetbyaddr_r
14097 eval $inlibc
14098 case "$d_getnetbyaddr_r" in
14099 "$define")
14100         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14101         case "$d_getnetbyaddr_r_proto:$usethreads" in
14102         ":define")      d_getnetbyaddr_r_proto=define
14103                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14104                 eval $hasproto ;;
14105         *)      ;;
14106         esac
14107         case "$d_getnetbyaddr_r_proto" in
14108         define)
14109         case "$getnetbyaddr_r_proto" in
14110         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14111         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14112         esac
14113         case "$getnetbyaddr_r_proto" in
14114         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14115         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14116         esac
14117         case "$getnetbyaddr_r_proto" in
14118         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14119         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14120         esac
14121         case "$getnetbyaddr_r_proto" in
14122         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14123         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14124         esac
14125         case "$getnetbyaddr_r_proto" in
14126         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14127         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14128         esac
14129         case "$getnetbyaddr_r_proto" in
14130         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14131         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14132         esac
14133         case "$getnetbyaddr_r_proto" in
14134         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14135         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14136         esac
14137         case "$getnetbyaddr_r_proto" in
14138         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14139         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14140         esac
14141         case "$getnetbyaddr_r_proto" in
14142         ''|0)   d_getnetbyaddr_r=undef
14143                 getnetbyaddr_r_proto=0
14144                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14145         * )     case "$getnetbyaddr_r_proto" in
14146                 REENTRANT_PROTO*) ;;
14147                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14148                 esac
14149                 echo "Prototype: $try" ;;
14150         esac
14151         ;;
14152         *)      case "$usethreads" in
14153                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14154                 esac
14155                 d_getnetbyaddr_r=undef
14156                 getnetbyaddr_r_proto=0
14157                 ;;
14158         esac
14159         ;;
14160 *)      getnetbyaddr_r_proto=0
14161         ;;
14162 esac
14163
14164 : see if getnetbyname_r exists
14165 set getnetbyname_r d_getnetbyname_r
14166 eval $inlibc
14167 case "$d_getnetbyname_r" in
14168 "$define")
14169         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14170         case "$d_getnetbyname_r_proto:$usethreads" in
14171         ":define")      d_getnetbyname_r_proto=define
14172                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14173                 eval $hasproto ;;
14174         *)      ;;
14175         esac
14176         case "$d_getnetbyname_r_proto" in
14177         define)
14178         case "$getnetbyname_r_proto" in
14179         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14180         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14181         esac
14182         case "$getnetbyname_r_proto" in
14183         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14184         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14185         esac
14186         case "$getnetbyname_r_proto" in
14187         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14188         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14189         esac
14190         case "$getnetbyname_r_proto" in
14191         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14192         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14193         esac
14194         case "$getnetbyname_r_proto" in
14195         ''|0)   d_getnetbyname_r=undef
14196                 getnetbyname_r_proto=0
14197                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14198         * )     case "$getnetbyname_r_proto" in
14199                 REENTRANT_PROTO*) ;;
14200                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14201                 esac
14202                 echo "Prototype: $try" ;;
14203         esac
14204         ;;
14205         *)      case "$usethreads" in
14206                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14207                 esac
14208                 d_getnetbyname_r=undef
14209                 getnetbyname_r_proto=0
14210                 ;;
14211         esac
14212         ;;
14213 *)      getnetbyname_r_proto=0
14214         ;;
14215 esac
14216
14217 : see if getnetent_r exists
14218 set getnetent_r d_getnetent_r
14219 eval $inlibc
14220 case "$d_getnetent_r" in
14221 "$define")
14222         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14223         case "$d_getnetent_r_proto:$usethreads" in
14224         ":define")      d_getnetent_r_proto=define
14225                 set d_getnetent_r_proto getnetent_r $hdrs
14226                 eval $hasproto ;;
14227         *)      ;;
14228         esac
14229         case "$d_getnetent_r_proto" in
14230         define)
14231         case "$getnetent_r_proto" in
14232         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14233         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14234         esac
14235         case "$getnetent_r_proto" in
14236         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14237         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14238         esac
14239         case "$getnetent_r_proto" in
14240         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14241         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14242         esac
14243         case "$getnetent_r_proto" in
14244         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14245         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14246         esac
14247         case "$getnetent_r_proto" in
14248         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14249         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14250         esac
14251         case "$getnetent_r_proto" in
14252         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14253         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14254         esac
14255         case "$getnetent_r_proto" in
14256         ''|0)   d_getnetent_r=undef
14257                 getnetent_r_proto=0
14258                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14259         * )     case "$getnetent_r_proto" in
14260                 REENTRANT_PROTO*) ;;
14261                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14262                 esac
14263                 echo "Prototype: $try" ;;
14264         esac
14265         ;;
14266         *)      case "$usethreads" in
14267                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14268                 esac
14269                 d_getnetent_r=undef
14270                 getnetent_r_proto=0
14271                 ;;
14272         esac
14273         ;;
14274 *)      getnetent_r_proto=0
14275         ;;
14276 esac
14277
14278 : see if prototypes for various getnetxxx netdb.h functions are available
14279 echo " "
14280 set d_getnetprotos getnetent $i_netdb netdb.h
14281 eval $hasproto
14282
14283 : see if getpagesize exists
14284 set getpagesize d_getpagsz
14285 eval $inlibc
14286
14287 : Optional checks for getprotobyname and getprotobynumber
14288
14289 : see if getprotobyname exists
14290 set getprotobyname d_getpbyname
14291 eval $inlibc
14292
14293 : see if getprotobynumber exists
14294 set getprotobynumber d_getpbynumber
14295 eval $inlibc
14296
14297 : see if getprotoent exists
14298 set getprotoent d_getpent
14299 eval $inlibc
14300
14301 : see if getpgid exists
14302 set getpgid d_getpgid
14303 eval $inlibc
14304
14305 : see if getpgrp2 exists
14306 set getpgrp2 d_getpgrp2
14307 eval $inlibc
14308
14309 : see if getppid exists
14310 set getppid d_getppid
14311 eval $inlibc
14312
14313 : see if getpriority exists
14314 set getpriority d_getprior
14315 eval $inlibc
14316
14317 : see if getprotobyname_r exists
14318 set getprotobyname_r d_getprotobyname_r
14319 eval $inlibc
14320 case "$d_getprotobyname_r" in
14321 "$define")
14322         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14323         case "$d_getprotobyname_r_proto:$usethreads" in
14324         ":define")      d_getprotobyname_r_proto=define
14325                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14326                 eval $hasproto ;;
14327         *)      ;;
14328         esac
14329         case "$d_getprotobyname_r_proto" in
14330         define)
14331         case "$getprotobyname_r_proto" in
14332         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14333         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14334         esac
14335         case "$getprotobyname_r_proto" in
14336         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14337         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14338         esac
14339         case "$getprotobyname_r_proto" in
14340         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14341         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14342         esac
14343         case "$getprotobyname_r_proto" in
14344         ''|0)   d_getprotobyname_r=undef
14345                 getprotobyname_r_proto=0
14346                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14347         * )     case "$getprotobyname_r_proto" in
14348                 REENTRANT_PROTO*) ;;
14349                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14350                 esac
14351                 echo "Prototype: $try" ;;
14352         esac
14353         ;;
14354         *)      case "$usethreads" in
14355                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14356                 esac
14357                 d_getprotobyname_r=undef
14358                 getprotobyname_r_proto=0
14359                 ;;
14360         esac
14361         ;;
14362 *)      getprotobyname_r_proto=0
14363         ;;
14364 esac
14365
14366 : see if getprotobynumber_r exists
14367 set getprotobynumber_r d_getprotobynumber_r
14368 eval $inlibc
14369 case "$d_getprotobynumber_r" in
14370 "$define")
14371         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14372         case "$d_getprotobynumber_r_proto:$usethreads" in
14373         ":define")      d_getprotobynumber_r_proto=define
14374                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14375                 eval $hasproto ;;
14376         *)      ;;
14377         esac
14378         case "$d_getprotobynumber_r_proto" in
14379         define)
14380         case "$getprotobynumber_r_proto" in
14381         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14382         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14383         esac
14384         case "$getprotobynumber_r_proto" in
14385         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14386         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14387         esac
14388         case "$getprotobynumber_r_proto" in
14389         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14390         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14391         esac
14392         case "$getprotobynumber_r_proto" in
14393         ''|0)   d_getprotobynumber_r=undef
14394                 getprotobynumber_r_proto=0
14395                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14396         * )     case "$getprotobynumber_r_proto" in
14397                 REENTRANT_PROTO*) ;;
14398                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14399                 esac
14400                 echo "Prototype: $try" ;;
14401         esac
14402         ;;
14403         *)      case "$usethreads" in
14404                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14405                 esac
14406                 d_getprotobynumber_r=undef
14407                 getprotobynumber_r_proto=0
14408                 ;;
14409         esac
14410         ;;
14411 *)      getprotobynumber_r_proto=0
14412         ;;
14413 esac
14414
14415 : see if getprotoent_r exists
14416 set getprotoent_r d_getprotoent_r
14417 eval $inlibc
14418 case "$d_getprotoent_r" in
14419 "$define")
14420         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14421         case "$d_getprotoent_r_proto:$usethreads" in
14422         ":define")      d_getprotoent_r_proto=define
14423                 set d_getprotoent_r_proto getprotoent_r $hdrs
14424                 eval $hasproto ;;
14425         *)      ;;
14426         esac
14427         case "$d_getprotoent_r_proto" in
14428         define)
14429         case "$getprotoent_r_proto" in
14430         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14431         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14432         esac
14433         case "$getprotoent_r_proto" in
14434         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14435         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14436         esac
14437         case "$getprotoent_r_proto" in
14438         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14439         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14440         esac
14441         case "$getprotoent_r_proto" in
14442         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14443         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14444         esac
14445         case "$getprotoent_r_proto" in
14446         ''|0)   d_getprotoent_r=undef
14447                 getprotoent_r_proto=0
14448                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14449         * )     case "$getprotoent_r_proto" in
14450                 REENTRANT_PROTO*) ;;
14451                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14452                 esac
14453                 echo "Prototype: $try" ;;
14454         esac
14455         ;;
14456         *)      case "$usethreads" in
14457                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14458                 esac
14459                 d_getprotoent_r=undef
14460                 getprotoent_r_proto=0
14461                 ;;
14462         esac
14463         ;;
14464 *)      getprotoent_r_proto=0
14465         ;;
14466 esac
14467
14468 : see if prototypes for various getprotoxxx netdb.h functions are available
14469 echo " "
14470 set d_getprotoprotos getprotoent $i_netdb netdb.h
14471 eval $hasproto
14472
14473 : see if getprpwnam exists
14474 set getprpwnam d_getprpwnam
14475 eval $inlibc
14476
14477 : see if getpwent exists
14478 set getpwent d_getpwent
14479 eval $inlibc
14480
14481 : see if getpwent_r exists
14482 set getpwent_r d_getpwent_r
14483 eval $inlibc
14484 case "$d_getpwent_r" in
14485 "$define")
14486         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14487         case "$d_getpwent_r_proto:$usethreads" in
14488         ":define")      d_getpwent_r_proto=define
14489                 set d_getpwent_r_proto getpwent_r $hdrs
14490                 eval $hasproto ;;
14491         *)      ;;
14492         esac
14493         case "$d_getpwent_r_proto" in
14494         define)
14495         case "$getpwent_r_proto" in
14496         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14497         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14498         esac
14499         case "$getpwent_r_proto" in
14500         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14501         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14502         esac
14503         case "$getpwent_r_proto" in
14504         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14505         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14506         esac
14507         case "$getpwent_r_proto" in
14508         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14509         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14510         esac
14511         case "$getpwent_r_proto" in
14512         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14513         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14514         esac
14515         case "$getpwent_r_proto" in
14516         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14517         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14518         esac
14519         case "$getpwent_r_proto" in
14520         ''|0)   d_getpwent_r=undef
14521                 getpwent_r_proto=0
14522                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14523         * )     case "$getpwent_r_proto" in
14524                 REENTRANT_PROTO*) ;;
14525                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14526                 esac
14527                 echo "Prototype: $try" ;;
14528         esac
14529         ;;
14530         *)      case "$usethreads" in
14531                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14532                 esac
14533                 d_getpwent_r=undef
14534                 getpwent_r_proto=0
14535                 ;;
14536         esac
14537         ;;
14538 *)      getpwent_r_proto=0
14539         ;;
14540 esac
14541
14542 : see if getpwnam_r exists
14543 set getpwnam_r d_getpwnam_r
14544 eval $inlibc
14545 case "$d_getpwnam_r" in
14546 "$define")
14547         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14548         case "$d_getpwnam_r_proto:$usethreads" in
14549         ":define")      d_getpwnam_r_proto=define
14550                 set d_getpwnam_r_proto getpwnam_r $hdrs
14551                 eval $hasproto ;;
14552         *)      ;;
14553         esac
14554         case "$d_getpwnam_r_proto" in
14555         define)
14556         case "$getpwnam_r_proto" in
14557         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14558         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14559         esac
14560         case "$getpwnam_r_proto" in
14561         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14562         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14563         esac
14564         case "$getpwnam_r_proto" in
14565         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14566         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14567         esac
14568         case "$getpwnam_r_proto" in
14569         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14570         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14571         esac
14572         case "$getpwnam_r_proto" in
14573         ''|0)   d_getpwnam_r=undef
14574                 getpwnam_r_proto=0
14575                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14576         * )     case "$getpwnam_r_proto" in
14577                 REENTRANT_PROTO*) ;;
14578                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14579                 esac
14580                 echo "Prototype: $try" ;;
14581         esac
14582         ;;
14583         *)      case "$usethreads" in
14584                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14585                 esac
14586                 d_getpwnam_r=undef
14587                 getpwnam_r_proto=0
14588                 ;;
14589         esac
14590         ;;
14591 *)      getpwnam_r_proto=0
14592         ;;
14593 esac
14594
14595 : see if getpwuid_r exists
14596 set getpwuid_r d_getpwuid_r
14597 eval $inlibc
14598 case "$d_getpwuid_r" in
14599 "$define")
14600         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14601         case "$d_getpwuid_r_proto:$usethreads" in
14602         ":define")      d_getpwuid_r_proto=define
14603                 set d_getpwuid_r_proto getpwuid_r $hdrs
14604                 eval $hasproto ;;
14605         *)      ;;
14606         esac
14607         case "$d_getpwuid_r_proto" in
14608         define)
14609         case "$getpwuid_r_proto" in
14610         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14611         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14612         esac
14613         case "$getpwuid_r_proto" in
14614         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14615         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14616         esac
14617         case "$getpwuid_r_proto" in
14618         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14619         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14620         esac
14621         case "$getpwuid_r_proto" in
14622         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14623         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14624         esac
14625         case "$getpwuid_r_proto" in
14626         ''|0)   d_getpwuid_r=undef
14627                 getpwuid_r_proto=0
14628                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14629         * )     case "$getpwuid_r_proto" in
14630                 REENTRANT_PROTO*) ;;
14631                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14632                 esac
14633                 echo "Prototype: $try" ;;
14634         esac
14635         ;;
14636         *)      case "$usethreads" in
14637                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14638                 esac
14639                 d_getpwuid_r=undef
14640                 getpwuid_r_proto=0
14641                 ;;
14642         esac
14643         ;;
14644 *)      getpwuid_r_proto=0
14645         ;;
14646 esac
14647
14648 : Optional checks for getsbyname and getsbyport
14649
14650 : see if getservbyname exists
14651 set getservbyname d_getsbyname
14652 eval $inlibc
14653
14654 : see if getservbyport exists
14655 set getservbyport d_getsbyport
14656 eval $inlibc
14657
14658 : see if getservent exists
14659 set getservent d_getsent
14660 eval $inlibc
14661
14662 : see if getservbyname_r exists
14663 set getservbyname_r d_getservbyname_r
14664 eval $inlibc
14665 case "$d_getservbyname_r" in
14666 "$define")
14667         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14668         case "$d_getservbyname_r_proto:$usethreads" in
14669         ":define")      d_getservbyname_r_proto=define
14670                 set d_getservbyname_r_proto getservbyname_r $hdrs
14671                 eval $hasproto ;;
14672         *)      ;;
14673         esac
14674         case "$d_getservbyname_r_proto" in
14675         define)
14676         case "$getservbyname_r_proto" in
14677         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14678         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14679         esac
14680         case "$getservbyname_r_proto" in
14681         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14682         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14683         esac
14684         case "$getservbyname_r_proto" in
14685         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14686         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14687         esac
14688         case "$getservbyname_r_proto" in
14689         ''|0)   d_getservbyname_r=undef
14690                 getservbyname_r_proto=0
14691                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14692         * )     case "$getservbyname_r_proto" in
14693                 REENTRANT_PROTO*) ;;
14694                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14695                 esac
14696                 echo "Prototype: $try" ;;
14697         esac
14698         ;;
14699         *)      case "$usethreads" in
14700                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14701                 esac
14702                 d_getservbyname_r=undef
14703                 getservbyname_r_proto=0
14704                 ;;
14705         esac
14706         ;;
14707 *)      getservbyname_r_proto=0
14708         ;;
14709 esac
14710
14711 : see if getservbyport_r exists
14712 set getservbyport_r d_getservbyport_r
14713 eval $inlibc
14714 case "$d_getservbyport_r" in
14715 "$define")
14716         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14717         case "$d_getservbyport_r_proto:$usethreads" in
14718         ":define")      d_getservbyport_r_proto=define
14719                 set d_getservbyport_r_proto getservbyport_r $hdrs
14720                 eval $hasproto ;;
14721         *)      ;;
14722         esac
14723         case "$d_getservbyport_r_proto" in
14724         define)
14725         case "$getservbyport_r_proto" in
14726         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14727         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14728         esac
14729         case "$getservbyport_r_proto" in
14730         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14731         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14732         esac
14733         case "$getservbyport_r_proto" in
14734         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14735         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14736         esac
14737         case "$getservbyport_r_proto" in
14738         ''|0)   d_getservbyport_r=undef
14739                 getservbyport_r_proto=0
14740                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14741         * )     case "$getservbyport_r_proto" in
14742                 REENTRANT_PROTO*) ;;
14743                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14744                 esac
14745                 echo "Prototype: $try" ;;
14746         esac
14747         ;;
14748         *)      case "$usethreads" in
14749                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14750                 esac
14751                 d_getservbyport_r=undef
14752                 getservbyport_r_proto=0
14753                 ;;
14754         esac
14755         ;;
14756 *)      getservbyport_r_proto=0
14757         ;;
14758 esac
14759
14760 : see if getservent_r exists
14761 set getservent_r d_getservent_r
14762 eval $inlibc
14763 case "$d_getservent_r" in
14764 "$define")
14765         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14766         case "$d_getservent_r_proto:$usethreads" in
14767         ":define")      d_getservent_r_proto=define
14768                 set d_getservent_r_proto getservent_r $hdrs
14769                 eval $hasproto ;;
14770         *)      ;;
14771         esac
14772         case "$d_getservent_r_proto" in
14773         define)
14774         case "$getservent_r_proto" in
14775         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14776         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14777         esac
14778         case "$getservent_r_proto" in
14779         ''|0) try='int getservent_r(struct servent*, char*, int);'
14780         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14781         esac
14782         case "$getservent_r_proto" in
14783         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14784         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14785         esac
14786         case "$getservent_r_proto" in
14787         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14788         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14789         esac
14790         case "$getservent_r_proto" in
14791         ''|0)   d_getservent_r=undef
14792                 getservent_r_proto=0
14793                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14794         * )     case "$getservent_r_proto" in
14795                 REENTRANT_PROTO*) ;;
14796                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14797                 esac
14798                 echo "Prototype: $try" ;;
14799         esac
14800         ;;
14801         *)      case "$usethreads" in
14802                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14803                 esac
14804                 d_getservent_r=undef
14805                 getservent_r_proto=0
14806                 ;;
14807         esac
14808         ;;
14809 *)      getservent_r_proto=0
14810         ;;
14811 esac
14812
14813 : see if prototypes for various getservxxx netdb.h functions are available
14814 echo " "
14815 set d_getservprotos getservent $i_netdb netdb.h
14816 eval $hasproto
14817
14818 : see if getspnam exists
14819 set getspnam d_getspnam
14820 eval $inlibc
14821
14822 : see if this is a shadow.h system
14823 set shadow.h i_shadow
14824 eval $inhdr
14825
14826 : see if getspnam_r exists
14827 set getspnam_r d_getspnam_r
14828 eval $inlibc
14829 case "$d_getspnam_r" in
14830 "$define")
14831         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14832         case "$d_getspnam_r_proto:$usethreads" in
14833         ":define")      d_getspnam_r_proto=define
14834                 set d_getspnam_r_proto getspnam_r $hdrs
14835                 eval $hasproto ;;
14836         *)      ;;
14837         esac
14838         case "$d_getspnam_r_proto" in
14839         define)
14840         case "$getspnam_r_proto" in
14841         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14842         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14843         esac
14844         case "$getspnam_r_proto" in
14845         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14846         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14847         esac
14848         case "$getspnam_r_proto" in
14849         ''|0)   d_getspnam_r=undef
14850                 getspnam_r_proto=0
14851                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14852         * )     case "$getspnam_r_proto" in
14853                 REENTRANT_PROTO*) ;;
14854                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14855                 esac
14856                 echo "Prototype: $try" ;;
14857         esac
14858         ;;
14859         *)      case "$usethreads" in
14860                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14861                 esac
14862                 d_getspnam_r=undef
14863                 getspnam_r_proto=0
14864                 ;;
14865         esac
14866         ;;
14867 *)      getspnam_r_proto=0
14868         ;;
14869 esac
14870
14871 : see if gettimeofday or ftime exists
14872 set gettimeofday d_gettimeod
14873 eval $inlibc
14874 case "$d_gettimeod" in
14875 "$undef")
14876         set ftime d_ftime 
14877         eval $inlibc
14878         ;;
14879 *)
14880         val="$undef"; set d_ftime; eval $setvar
14881         ;;
14882 esac
14883 case "$d_gettimeod$d_ftime" in
14884 "$undef$undef")
14885         echo " "
14886         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14887         ;;
14888 esac
14889
14890 : see if gmtime_r exists
14891 set gmtime_r d_gmtime_r
14892 eval $inlibc
14893 case "$d_gmtime_r" in
14894 "$define")
14895         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14896         case "$d_gmtime_r_proto:$usethreads" in
14897         ":define")      d_gmtime_r_proto=define
14898                 set d_gmtime_r_proto gmtime_r $hdrs
14899                 eval $hasproto ;;
14900         *)      ;;
14901         esac
14902         case "$d_gmtime_r_proto" in
14903         define)
14904         case "$gmtime_r_proto" in
14905         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14906         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14907         esac
14908         case "$gmtime_r_proto" in
14909         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14910         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14911         esac
14912         case "$gmtime_r_proto" in
14913         ''|0)   d_gmtime_r=undef
14914                 gmtime_r_proto=0
14915                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14916         * )     case "$gmtime_r_proto" in
14917                 REENTRANT_PROTO*) ;;
14918                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14919                 esac
14920                 echo "Prototype: $try" ;;
14921         esac
14922         ;;
14923         *)      case "$usethreads" in
14924                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14925                 esac
14926                 d_gmtime_r=undef
14927                 gmtime_r_proto=0
14928                 ;;
14929         esac
14930         ;;
14931 *)      gmtime_r_proto=0
14932         ;;
14933 esac
14934
14935 : see if hasmntopt exists
14936 set hasmntopt d_hasmntopt
14937 eval $inlibc
14938
14939 : see if this is a netinet/in.h or sys/in.h system
14940 set netinet/in.h i_niin sys/in.h i_sysin
14941 eval $inhdr
14942
14943 : see if arpa/inet.h has to be included
14944 set arpa/inet.h i_arpainet
14945 eval $inhdr
14946
14947 : see if htonl --and friends-- exists
14948 val=''
14949 set htonl val
14950 eval $inlibc
14951
14952 : Maybe they are macros.
14953 case "$val" in
14954 $undef)
14955         $cat >htonl.c <<EOM
14956 #include <stdio.h>
14957 #include <sys/types.h>
14958 #$i_niin I_NETINET_IN
14959 #$i_sysin I_SYS_IN
14960 #$i_arpainet I_ARPA_INET
14961 #ifdef I_NETINET_IN
14962 #include <netinet/in.h>
14963 #endif
14964 #ifdef I_SYS_IN
14965 #include <sys/in.h>
14966 #endif
14967 #ifdef I_ARPA_INET
14968 #include <arpa/inet.h>
14969 #endif
14970 #ifdef htonl
14971 printf("Defined as a macro.");
14972 #endif
14973 EOM
14974         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14975         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14976                 val="$define"
14977                 echo "But it seems to be defined as a macro." >&4
14978         fi
14979         $rm -f htonl.?
14980         ;;
14981 esac
14982 set d_htonl
14983 eval $setvar
14984
14985 : see if ilogbl exists
14986 set ilogbl d_ilogbl
14987 eval $inlibc
14988
14989 : index or strchr
14990 echo " "
14991 if set index val -f; eval $csym; $val; then
14992         if set strchr val -f d_strchr; eval $csym; $val; then
14993                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14994                         val="$define"
14995                         vali="$undef"
14996                         echo "strchr() found." >&4
14997                 else
14998                         val="$undef"
14999                         vali="$define"
15000                         echo "index() found." >&4
15001                 fi
15002         else
15003                 val="$undef"
15004                 vali="$define"
15005                 echo "index() found." >&4
15006         fi
15007 else
15008         if set strchr val -f d_strchr; eval $csym; $val; then
15009                 val="$define"
15010                 vali="$undef"
15011                 echo "strchr() found." >&4
15012         else
15013                 echo "No index() or strchr() found!" >&4
15014                 val="$undef"
15015                 vali="$undef"
15016         fi
15017 fi
15018 set d_strchr; eval $setvar
15019 val="$vali"
15020 set d_index; eval $setvar
15021
15022 : check whether inet_aton exists
15023 set inet_aton d_inetaton
15024 eval $inlibc
15025
15026 : see if inet_ntop exists
15027 set inet_ntop d_inetntop
15028 eval $inlibc
15029
15030 : see if inet_pton exists
15031 set inet_pton d_inetpton
15032 eval $inlibc
15033
15034 : Look for isascii
15035 echo " "
15036 $cat >isascii.c <<EOCP
15037 #include <stdio.h>
15038 #include <ctype.h>
15039 #$i_stdlib I_STDLIB
15040 #ifdef I_STDLIB
15041 #include <stdlib.h>
15042 #endif
15043 int main() {
15044         int c = 'A';
15045         if (isascii(c))
15046                 exit(0);
15047         else
15048                 exit(1);
15049 }
15050 EOCP
15051 set isascii
15052 if eval $compile; then
15053         echo "isascii() found." >&4
15054         val="$define"
15055 else
15056         echo "isascii() NOT found." >&4
15057         val="$undef"
15058 fi
15059 set d_isascii
15060 eval $setvar
15061 $rm -f isascii*
15062
15063 : Look for isblank
15064 echo " "
15065 $cat >isblank.c <<'EOCP'
15066 #include <stdio.h>
15067 #include <ctype.h>
15068 int main() {
15069         int c = ' ';
15070         if (isblank(c))
15071                 return 0 ;
15072         else
15073                 return 1 ;
15074 }
15075 EOCP
15076 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15077         echo "isblank() found." >&4
15078         val="$define"
15079 else
15080         echo "isblank() NOT found." >&4
15081         val="$undef"
15082 fi
15083 set d_isblank
15084 eval $setvar
15085 $rm -f isblank*
15086
15087 : see if isfinite exists
15088 set isfinite d_isfinite
15089 eval $inlibc
15090
15091 : see if isinf exists
15092 set isinf d_isinf
15093 eval $inlibc
15094
15095 : see if isnan exists
15096 set isnan d_isnan
15097 eval $inlibc
15098
15099 : see if isnanl exists
15100 set isnanl d_isnanl
15101 eval $inlibc
15102
15103 : see if killpg exists
15104 set killpg d_killpg
15105 eval $inlibc
15106
15107 : see if lchown exists
15108 echo " "
15109 $cat > try.c <<'EOCP'
15110 /* System header to define __stub macros and hopefully few prototypes,
15111     which can conflict with char lchown(); below.  */
15112 #include <assert.h>
15113 /* Override any gcc2 internal prototype to avoid an error.  */
15114 /* We use char because int might match the return type of a gcc2
15115    builtin and then its argument prototype would still apply.  */
15116 char lchown();
15117 int main() {
15118     /*  The GNU C library defines this for functions which it implements
15119         to always fail with ENOSYS.  Some functions are actually named
15120         something starting with __ and the normal name is an alias.  */
15121 #if defined (__stub_lchown) || defined (__stub___lchown)
15122 choke me
15123 #else
15124 lchown();
15125 #endif
15126 ; return 0; }
15127 EOCP
15128 set try
15129 if eval $compile; then
15130     $echo "lchown() found." >&4
15131     val="$define"
15132 else
15133     $echo "lchown() NOT found." >&4
15134     val="$undef"
15135 fi
15136 set d_lchown
15137 eval $setvar
15138
15139 : See if number of significant digits in a double precision number is known
15140 echo " "
15141 $cat >ldbl_dig.c <<EOM
15142 #$i_limits I_LIMITS
15143 #$i_float I_FLOAT
15144 #ifdef I_LIMITS
15145 #include <limits.h>
15146 #endif
15147 #ifdef I_FLOAT
15148 #include <float.h>
15149 #endif
15150 #ifdef LDBL_DIG
15151 printf("Contains LDBL_DIG");
15152 #endif
15153 EOM
15154 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15155 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15156         echo "LDBL_DIG found." >&4
15157         val="$define"
15158 else
15159         echo "LDBL_DIG NOT found." >&4
15160         val="$undef"
15161 fi
15162 $rm -f ldbl_dig.?
15163 set d_ldbl_dig
15164 eval $setvar
15165
15166 : see if this is a math.h system
15167 set math.h i_math
15168 eval $inhdr
15169
15170 : check to see if math.h defines _LIB_VERSION
15171 d_libm_lib_version="$undef"
15172 case $i_math in
15173     $define)
15174         echo " "
15175         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15176         $cat >try.c <<EOCP
15177 #include <unistd.h>
15178 #include <math.h>
15179 int main (int argc, char *argv[])
15180 {
15181     printf ("%d\n", _LIB_VERSION);
15182     return (0);
15183     } /* main */
15184 EOCP
15185         set try
15186         if eval $compile; then
15187             foo=`$run ./try`
15188             echo "Yes, it does ($foo)" >&4
15189             d_libm_lib_version="$define"
15190         else
15191             echo "No, it does not (probably harmless)" >&4
15192             fi
15193         $rm_try
15194         ;;
15195
15196     esac
15197
15198 : see if link exists
15199 set link d_link
15200 eval $inlibc
15201
15202 : see if localtime_r exists
15203 set localtime_r d_localtime_r
15204 eval $inlibc
15205 case "$d_localtime_r" in
15206 "$define")
15207         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15208         case "$d_localtime_r_proto:$usethreads" in
15209         ":define")      d_localtime_r_proto=define
15210                 set d_localtime_r_proto localtime_r $hdrs
15211                 eval $hasproto ;;
15212         *)      ;;
15213         esac
15214         case "$d_localtime_r_proto" in
15215         define)
15216         case "$localtime_r_proto" in
15217         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15218         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15219         esac
15220         case "$localtime_r_proto" in
15221         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15222         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15223         esac
15224         case "$localtime_r_proto" in
15225         ''|0)   d_localtime_r=undef
15226                 localtime_r_proto=0
15227                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15228         * )     case "$localtime_r_proto" in
15229                 REENTRANT_PROTO*) ;;
15230                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15231                 esac
15232                 echo "Prototype: $try" ;;
15233         esac
15234         ;;
15235         *)      case "$usethreads" in
15236                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15237                 esac
15238                 d_localtime_r=undef
15239                 localtime_r_proto=0
15240                 ;;
15241         esac
15242         ;;
15243 *)      localtime_r_proto=0
15244         ;;
15245 esac
15246
15247 : see if localtime_r calls tzset
15248 case "$localtime_r_proto" in
15249 REENTRANT_PROTO*)
15250         $cat >try.c <<EOCP
15251 /*  Does our libc's localtime_r call tzset ?
15252  *  return 0 if so, 1 otherwise.
15253  */
15254 #$i_systypes    I_SYS_TYPES
15255 #$i_unistd      I_UNISTD
15256 #$i_time        I_TIME
15257 #$i_stdlib      I_STDLIB
15258 #$i_string      I_STRING
15259 #$i_malloc      I_MALLOC
15260 #ifdef I_SYS_TYPES
15261 #  include <sys/types.h>
15262 #endif
15263 #ifdef I_UNISTD
15264 #  include <unistd.h>
15265 #endif
15266 #ifdef I_TIME
15267 #  include <time.h>
15268 #endif
15269 #ifdef I_STDLIB
15270 #include <stdlib.h>
15271 #endif
15272 #ifdef I_STRING
15273 #  include <string.h>
15274 #else
15275 #  include <strings.h>
15276 #endif
15277 #ifdef I_MALLOC
15278 #  include <malloc.h>
15279 #endif
15280 int main()
15281 {
15282     time_t t = time(0L);
15283     char w_tz[]="TZ" "=GMT+5",
15284          e_tz[]="TZ" "=GMT-5",
15285         *tz_e = (char*)malloc(16),
15286         *tz_w = (char*)malloc(16);
15287     struct tm tm_e, tm_w;
15288     memset(&tm_e,'\0',sizeof(struct tm));
15289     memset(&tm_w,'\0',sizeof(struct tm));
15290     strcpy(tz_e,e_tz);
15291     strcpy(tz_w,w_tz);
15292
15293     putenv(tz_e);
15294     localtime_r(&t, &tm_e);
15295
15296     putenv(tz_w);
15297     localtime_r(&t, &tm_w);
15298
15299     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15300         return 1;
15301     return 0;
15302 }
15303 EOCP
15304         set try
15305         if eval $compile; then
15306             if $run ./try; then
15307                 d_localtime_r_needs_tzset=undef;
15308             else
15309                 d_localtime_r_needs_tzset=define;
15310             fi;
15311         else
15312             d_localtime_r_needs_tzset=undef;
15313         fi;
15314      ;;
15315   *)
15316      d_localtime_r_needs_tzset=undef;
15317      ;;
15318 esac
15319 $rm_try
15320
15321 : see if localeconv exists
15322 set localeconv d_locconv
15323 eval $inlibc
15324
15325 : see if lockf exists
15326 set lockf d_lockf
15327 eval $inlibc
15328
15329 : see if prototype for lseek is available
15330 echo " "
15331 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15332 eval $hasproto
15333
15334 : see if lstat exists
15335 set lstat d_lstat
15336 eval $inlibc
15337
15338 : see if madvise exists
15339 set madvise d_madvise
15340 eval $inlibc
15341
15342 : see if malloc_size exists
15343 set malloc_size d_malloc_size
15344 eval $inlibc
15345
15346 : see if malloc_size_good exists
15347 set malloc_good_size d_malloc_good_size
15348 eval $inlibc
15349
15350 : see if mblen exists
15351 set mblen d_mblen
15352 eval $inlibc
15353
15354 : see if mbstowcs exists
15355 set mbstowcs d_mbstowcs
15356 eval $inlibc
15357
15358 : see if mbtowc exists
15359 set mbtowc d_mbtowc
15360 eval $inlibc
15361
15362 : see if memchr exists
15363 set memchr d_memchr
15364 eval $inlibc
15365
15366 : see if memcmp exists
15367 set memcmp d_memcmp
15368 eval $inlibc
15369
15370 : see if memcpy exists
15371 set memcpy d_memcpy
15372 eval $inlibc
15373
15374 : see if memmove exists
15375 set memmove d_memmove
15376 eval $inlibc
15377
15378 : see if memset exists
15379 set memset d_memset
15380 eval $inlibc
15381
15382 : see if mkdir exists
15383 set mkdir d_mkdir
15384 eval $inlibc
15385
15386 : see if mkdtemp exists
15387 set mkdtemp d_mkdtemp
15388 eval $inlibc
15389
15390 : see if mkfifo exists
15391 set mkfifo d_mkfifo
15392 eval $inlibc
15393
15394 : see if mkstemp exists
15395 set mkstemp d_mkstemp
15396 eval $inlibc
15397
15398 : see if mkstemps exists
15399 set mkstemps d_mkstemps
15400 eval $inlibc
15401
15402 : see if mktime exists
15403 set mktime d_mktime
15404 eval $inlibc
15405
15406 : see if this is a sys/mman.h system
15407 set sys/mman.h i_sysmman
15408 eval $inhdr
15409
15410 : see if mmap exists
15411 set mmap d_mmap
15412 eval $inlibc
15413 : see what shmat returns
15414 : default to something harmless
15415 mmaptype='void *'
15416 case "$i_sysmman$d_mmap" in
15417 "$define$define")
15418         $cat >mmap.c <<'END'
15419 #include <sys/mman.h>
15420 void *mmap();
15421 END
15422         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15423                 mmaptype='void *'
15424         else
15425                 mmaptype='caddr_t'
15426         fi
15427         echo "and it returns ($mmaptype)." >&4
15428         ;;
15429 esac
15430
15431
15432
15433 : see if sqrtl exists
15434 set sqrtl d_sqrtl
15435 eval $inlibc
15436
15437 : see if scalbnl exists
15438 set scalbnl d_scalbnl
15439 eval $inlibc
15440
15441 : see if modfl exists
15442 set modfl d_modfl
15443 eval $inlibc
15444
15445 : see if prototype for modfl is available
15446 echo " "
15447 set d_modflproto modfl $i_math math.h
15448 eval $hasproto
15449
15450 d_modfl_pow32_bug="$undef"
15451
15452 case "$d_longdbl$d_modfl" in
15453 $define$define)
15454         $cat <<EOM
15455 Checking to see whether your modfl() is okay for large values...
15456 EOM
15457 $cat >try.c <<EOCP
15458 #include <math.h>
15459 #include <stdio.h>
15460 EOCP
15461 if $test "X$d_modflproto" != "X$define"; then
15462         $cat >>try.c <<EOCP
15463 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15464 long double modfl (long double, long double *);
15465 EOCP
15466 fi
15467 $cat >>try.c <<EOCP
15468 int main() {
15469     long double nv = 4294967303.15;
15470     long double v, w;
15471     v = modfl(nv, &w);
15472 #ifdef __GLIBC__
15473     printf("glibc");
15474 #endif
15475     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15476     return 0;
15477 }
15478 EOCP
15479         case "$osname:$gccversion" in
15480         aix:)   saveccflags="$ccflags"
15481                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15482         esac
15483         set try
15484         if eval $compile; then
15485                 foo=`$run ./try`
15486                 case "$foo" in
15487                 *" 4294967303.150000 1.150000 4294967302.000000")
15488                         echo >&4 "Your modfl() is broken for large values."
15489                         d_modfl_pow32_bug="$define"
15490                         case "$foo" in
15491                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15492                         ;;
15493                         esac
15494                         ;;
15495                 *" 4294967303.150000 0.150000 4294967303.000000")
15496                         echo >&4 "Your modfl() seems okay for large values."
15497                         ;;
15498                 *)      echo >&4 "I don't understand your modfl() at all."
15499                         d_modfl="$undef"
15500                         ;;
15501                 esac
15502                 $rm_try
15503         else
15504                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15505                 d_modfl="$undef"
15506         fi
15507         case "$osname:$gccversion" in
15508         aix:)   ccflags="$saveccflags" ;; # restore
15509         esac
15510         ;;
15511 esac
15512
15513 if $test "$uselongdouble" = "$define"; then
15514     message=""
15515     if $test "$d_sqrtl" != "$define"; then
15516         message="$message sqrtl"
15517     fi
15518     if $test "$d_modfl" != "$define"; then
15519         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15520             echo "You have both aintl and copysignl, so I can emulate modfl."
15521         else
15522             message="$message modfl"
15523         fi
15524     fi
15525     if $test "$d_frexpl" != "$define"; then
15526         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15527             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15528         else
15529             message="$message frexpl"
15530         fi
15531     fi
15532
15533     if $test "$message" != ""; then
15534         $cat <<EOM >&4
15535
15536 *** You requested the use of long doubles but you do not seem to have
15537 *** the following mathematical functions needed for long double support:
15538 ***    $message
15539 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15540 *** Cannot continue, aborting.
15541
15542 EOM
15543
15544         exit 1
15545     fi
15546 fi
15547
15548 : see if mprotect exists
15549 set mprotect d_mprotect
15550 eval $inlibc
15551
15552 : see if msgctl exists
15553 set msgctl d_msgctl
15554 eval $inlibc
15555
15556 : see if msgget exists
15557 set msgget d_msgget
15558 eval $inlibc
15559
15560 : see if msgsnd exists
15561 set msgsnd d_msgsnd
15562 eval $inlibc
15563
15564 : see if msgrcv exists
15565 set msgrcv d_msgrcv
15566 eval $inlibc
15567
15568 : see how much of the 'msg*(2)' library is present.
15569 h_msg=true
15570 echo " "
15571 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15572 *"$undef"*) h_msg=false;;
15573 esac
15574 case "$osname" in
15575 freebsd)
15576     case "`ipcs 2>&1`" in
15577     "SVID messages"*"not configured"*)
15578         echo "Your $osname does not have the msg*(2) configured." >&4
15579         h_msg=false
15580         val="$undef"
15581         set msgctl d_msgctl
15582         eval $setvar
15583         set msgget d_msgget
15584         eval $setvar
15585         set msgsnd d_msgsnd
15586         eval $setvar
15587         set msgrcv d_msgrcv
15588         eval $setvar
15589         ;;
15590     esac
15591     ;;
15592 esac
15593 : we could also check for sys/ipc.h ...
15594 if $h_msg && $test `./findhdr sys/msg.h`; then
15595         echo "You have the full msg*(2) library." >&4
15596         val="$define"
15597 else
15598         echo "You don't have the full msg*(2) library." >&4
15599         val="$undef"
15600 fi
15601 set d_msg
15602 eval $setvar
15603
15604 : Check for msghdr_s
15605 echo " "
15606 echo "Checking to see if your system supports struct msghdr..." >&4
15607 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15608 eval $hasstruct
15609 case "$d_msghdr_s" in
15610 "$define")      echo "Yes, it does."   ;;
15611 *)              echo "No, it doesn't." ;;
15612 esac
15613
15614
15615 : see if msync exists
15616 set msync d_msync
15617 eval $inlibc
15618
15619 : see if munmap exists
15620 set munmap d_munmap
15621 eval $inlibc
15622
15623 : see if nice exists
15624 set nice d_nice
15625 eval $inlibc
15626
15627 : see if this is a langinfo.h system
15628 set langinfo.h i_langinfo
15629 eval $inhdr
15630
15631 : see if nl_langinfo exists
15632 set nl_langinfo d_nl_langinfo
15633 eval $inlibc
15634
15635 : check for volatile keyword
15636 echo " "
15637 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15638 $cat >try.c <<'EOCP'
15639 int main()
15640 {
15641         typedef struct _goo_struct goo_struct;
15642         goo_struct * volatile goo = ((goo_struct *)0);
15643         struct _goo_struct {
15644                 long long_int;
15645                 int reg_int;
15646                 char char_var;
15647         };
15648         typedef unsigned short foo_t;
15649         char *volatile foo;
15650         volatile int bar;
15651         volatile foo_t blech;
15652         foo = foo;
15653 }
15654 EOCP
15655 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15656         val="$define"
15657         echo "Yup, it does."
15658 else
15659         val="$undef"
15660         echo "Nope, it doesn't."
15661 fi
15662 set d_volatile
15663 eval $setvar
15664 $rm_try
15665
15666 : Check basic sizes
15667 echo " "
15668 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15669
15670 case "$use64bitint:$d_quad:$quadtype" in
15671 define:define:?*)
15672         ivtype="$quadtype"
15673         uvtype="$uquadtype"
15674         ivsize=8
15675         uvsize=8
15676         ;;
15677 *)      ivtype="long"
15678         uvtype="unsigned long"
15679         ivsize=$longsize
15680         uvsize=$longsize
15681         ;;
15682 esac
15683
15684 case "$uselongdouble:$d_longdbl" in
15685 define:define)
15686         nvtype="long double"
15687         nvsize=$longdblsize
15688         ;;
15689 *)      nvtype=double
15690         nvsize=$doublesize
15691         ;;
15692 esac
15693
15694 $echo "(IV will be "$ivtype", $ivsize bytes)"
15695 $echo "(UV will be "$uvtype", $uvsize bytes)"
15696 $echo "(NV will be "$nvtype", $nvsize bytes)"
15697
15698 $cat >try.c <<EOCP
15699 #$i_inttypes I_INTTYPES
15700 #ifdef I_INTTYPES
15701 #include <inttypes.h>
15702 #endif
15703 #include <stdio.h>
15704 int main() {
15705 #ifdef INT8
15706    int8_t i =  INT8_MAX;
15707   uint8_t u = UINT8_MAX;
15708   printf("int8_t\n");
15709 #endif
15710 #ifdef INT16
15711    int16_t i =  INT16_MAX;
15712   uint16_t u = UINT16_MAX;
15713   printf("int16_t\n");
15714 #endif
15715 #ifdef INT32
15716    int32_t i =  INT32_MAX;
15717   uint32_t u = UINT32_MAX;
15718   printf("int32_t\n");
15719 #endif
15720 }
15721 EOCP
15722
15723 i8type="signed char"
15724 u8type="unsigned char"
15725 i8size=1
15726 u8size=1
15727
15728 case "$i16type" in
15729 '')     case "$shortsize" in
15730         2)      i16type=short
15731                 u16type="unsigned short"
15732                 i16size=$shortsize
15733                 u16size=$shortsize
15734                 ;;
15735         esac
15736         ;;
15737 esac
15738 case "$i16type" in
15739 '')     set try -DINT16
15740         if eval $compile; then
15741                 case "`$run ./try`" in
15742                 int16_t)
15743                         i16type=int16_t
15744                         u16type=uint16_t
15745                         i16size=2
15746                         u16size=2
15747                         ;;
15748                 esac
15749         fi
15750         ;;
15751 esac
15752 case "$i16type" in
15753 '')     if $test $shortsize -ge 2; then
15754                 i16type=short
15755                 u16type="unsigned short"
15756                 i16size=$shortsize
15757                 u16size=$shortsize
15758         fi
15759         ;;
15760 esac
15761
15762 case "$i32type" in
15763 '')     case "$longsize" in
15764         4)      i32type=long
15765                 u32type="unsigned long"
15766                 i32size=$longsize
15767                 u32size=$longsize
15768                 ;;
15769         *)      case "$intsize" in
15770                 4)      i32type=int
15771                         u32type="unsigned int"
15772                         i32size=$intsize
15773                         u32size=$intsize
15774                         ;;
15775                 esac
15776                 ;;
15777         esac
15778         ;;
15779 esac
15780 case "$i32type" in
15781 '')     set try -DINT32
15782         if eval $compile; then
15783                 case "`$run ./try`" in
15784                 int32_t)
15785                         i32type=int32_t
15786                         u32type=uint32_t
15787                         i32size=4
15788                         u32size=4
15789                         ;;
15790                 esac
15791         fi
15792         ;;
15793 esac
15794 case "$i32type" in
15795 '')     if $test $intsize -ge 4; then
15796                 i32type=int
15797                 u32type="unsigned int"
15798                 i32size=$intsize
15799                 u32size=$intsize
15800         fi
15801         ;;
15802 esac
15803
15804 case "$i64type" in
15805 '')     case "$d_quad:$quadtype" in
15806         define:?*)
15807                 i64type="$quadtype"
15808                 u64type="$uquadtype"
15809                 i64size=8
15810                 u64size=8
15811                 ;;
15812         esac
15813         ;;
15814 esac
15815
15816 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15817 : volatile so that the compiler has to store it out to memory.
15818 if test X"$d_volatile" = X"$define"; then
15819         volatile=volatile
15820 fi
15821 $cat <<EOP >try.c
15822 #include <stdio.h>
15823 #$i_stdlib I_STDLIB
15824 #ifdef I_STDLIB
15825 #include <stdlib.h>
15826 #endif
15827 #include <sys/types.h>
15828 #include <signal.h>
15829 #ifdef SIGFPE
15830 $volatile int bletched = 0;
15831 $signal_t blech(int s) { bletched = 1; }
15832 #endif
15833 int main() {
15834     $uvtype u = 0;
15835     $nvtype d;
15836     int     n = 8 * $uvsize;
15837     int     i;
15838 #ifdef SIGFPE
15839     signal(SIGFPE, blech);
15840 #endif
15841
15842     for (i = 0; i < n; i++) {
15843       u = u << 1 | ($uvtype)1;
15844       d = ($nvtype)u;
15845       if (($uvtype)d != u)
15846         break;
15847       if (d <= 0)
15848         break;
15849       d = ($nvtype)(u - 1);
15850       if (($uvtype)d != (u - 1))
15851         break;
15852 #ifdef SIGFPE
15853       if (bletched)
15854         break;
15855 #endif
15856     }
15857     printf("%d\n", ((i == n) ? -n : i));
15858     exit(0);
15859 }
15860 EOP
15861 set try
15862
15863 d_nv_preserves_uv="$undef"
15864 if eval $compile; then
15865         nv_preserves_uv_bits="`$run ./try`"
15866 fi
15867 case "$nv_preserves_uv_bits" in
15868 \-[1-9]*)
15869         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15870         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15871         d_nv_preserves_uv="$define"
15872         ;;
15873 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15874         d_nv_preserves_uv="$undef" ;;
15875 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15876         nv_preserves_uv_bits="0" ;;
15877 esac
15878 $rm_try
15879
15880 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15881 : volatile so that the compiler has to store it out to memory.
15882 if test X"$d_volatile" = X"$define"; then
15883         volatile=volatile
15884 fi
15885 $cat <<EOP >try.c
15886 #include <stdio.h>
15887
15888 typedef $nvtype NV;
15889
15890 int
15891 main() {
15892   NV value = 2;
15893   int count = 1;
15894
15895   while(count < 256) {
15896     $volatile NV up = value + 1.0;
15897     $volatile NV negated = -value;
15898     $volatile NV down = negated - 1.0;
15899     $volatile NV got_up = up - value;
15900     int up_good = got_up == 1.0;
15901     int got_down = down - negated;
15902     int down_good = got_down == -1.0;
15903
15904     if (down_good != up_good) {
15905       fprintf(stderr,
15906               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15907               up_good, (double) got_up, down_good, (double) got_down,
15908               count, (double) value);
15909       return 1;
15910     }
15911     if (!up_good) {
15912       while (1) {
15913         if (count > 8) {
15914           count -= 8;
15915           fputs("256.0", stdout);
15916         } else {
15917           count--;
15918           fputs("2.0", stdout);
15919         }
15920         if (!count) {
15921           puts("");
15922           return 0;
15923         }
15924         fputs("*", stdout);
15925       }
15926     }
15927     value *= 2;
15928     ++count;
15929   }
15930   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15931           count, (double) value);
15932   return 1;
15933 }
15934 EOP
15935 set try
15936
15937 nv_overflows_integers_at='0'
15938 if eval $compile; then
15939     xxx="`$run ./try`"
15940     case "$?" in
15941         0)
15942             case "$xxx" in
15943                 2*)  cat >&4 <<EOM
15944 The largest integer your NVs can preserve is equal to $xxx
15945 EOM
15946                     nv_overflows_integers_at="$xxx"
15947                     ;;
15948                 *)  cat >&4 <<EOM
15949 Cannot determine the largest integer value your NVs can hold, unexpected output
15950 '$xxx'
15951 EOM
15952                     ;;
15953             esac
15954             ;;
15955         *)  cat >&4 <<EOM
15956 Cannot determine the largest integer value your NVs can hold
15957 EOM
15958             ;;
15959     esac
15960 fi
15961 $rm_try
15962
15963 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15964 : volatile so that the compiler has to store it out to memory.
15965 if test X"$d_volatile" = X"$define"; then
15966         volatile=volatile
15967 fi
15968 $cat <<EOP >try.c
15969 #include <stdio.h>
15970 #$i_stdlib I_STDLIB
15971 #ifdef I_STDLIB
15972 #include <stdlib.h>
15973 #endif
15974 #$i_string I_STRING
15975 #ifdef I_STRING
15976 #  include <string.h>
15977 #else
15978 #  include <strings.h>
15979 #endif
15980 #include <sys/types.h>
15981 #include <signal.h>
15982 #ifdef SIGFPE
15983 $volatile int bletched = 0;
15984 $signal_t blech(int s) { bletched = 1; }
15985 #endif
15986
15987 int checkit($nvtype d, char *where) {
15988     unsigned char *p = (char *)&d;
15989     unsigned char *end = p + sizeof(d);
15990     int fail = 0;
15991
15992     while (p < end)
15993         fail += *p++;
15994
15995     if (!fail)
15996         return 0;
15997
15998     p = (char *)&d;
15999     printf("No - %s: 0x", where);
16000     while (p < end)
16001         printf ("%02X", *p++);
16002     printf("\n");
16003     return 1;
16004 }
16005
16006 int main(int argc, char **argv) {
16007     $nvtype d = 0.0;
16008     int fail = 0;
16009     fail += checkit(d, "0.0");
16010
16011     /* The compiler shouldn't be assuming that bletched is 0  */
16012     d = bletched;
16013
16014     fail += checkit(d, "bleched");
16015
16016 #ifdef SIGFPE
16017     signal(SIGFPE, blech);
16018 #endif
16019
16020     /* Paranoia - the compiler should have no way of knowing that ANSI says
16021        that argv[argc] will always be NULL.  Actually, if it did assume this it
16022        would be buggy, as this is C and main() can be called from elsewhere in
16023        the program.  */
16024     d = argv[argc] ? 1 : 0;
16025
16026     if (d) {
16027         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16028     }
16029
16030     fail += checkit(d, "ternary");
16031
16032     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16033
16034     if (d != 0.0) {
16035         printf("No - memset doesn't give 0.0\n");
16036         /* This might just blow up:  */
16037         printf("(gives %g)\n", d);
16038         return 1;
16039     }
16040
16041 #ifdef SIGFPE
16042     if (bletched) {
16043         printf("No - something bleched\n");
16044         return 1;
16045     }
16046 #endif
16047     if (fail) {
16048       printf("No - %d fail(s)\n", fail);
16049       return 1;
16050     }
16051     printf("Yes\n");
16052     return 0;
16053 }
16054 EOP
16055 set try
16056
16057 d_nv_zero_is_allbits_zero="$undef"
16058 if eval $compile; then
16059     xxx="`$run ./try`"
16060     case "$?" in
16061         0)
16062             case "$xxx" in
16063                 Yes)  cat >&4 <<EOM
16064 0.0 is represented as all bits zero in memory
16065 EOM
16066                     d_nv_zero_is_allbits_zero="$define"
16067                     ;;
16068                 *)  cat >&4 <<EOM
16069 0.0 is not represented as all bits zero in memory
16070 EOM
16071                     d_nv_zero_is_allbits_zero="$undef"
16072                     ;;
16073             esac
16074             ;;
16075         *)  cat >&4 <<EOM
16076 0.0 is not represented as all bits zero in memory
16077 EOM
16078             d_nv_zero_is_allbits_zero="$undef"
16079             ;;
16080     esac
16081 fi
16082 $rm_try
16083
16084 : check for off64_t
16085 echo " "
16086 echo "Checking to see if you have off64_t..." >&4
16087 $cat >try.c <<EOCP
16088 #include <sys/types.h>
16089 #include <unistd.h>
16090 int main() { off64_t x = 7; }
16091 EOCP
16092 set try
16093 if eval $compile; then
16094         val="$define"
16095         echo "You have off64_t."
16096 else
16097         val="$undef"
16098         echo "You do not have off64_t."
16099         case "$lseeksize" in
16100         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16101         esac
16102 fi
16103 $rm_try
16104 set d_off64_t
16105 eval $setvar
16106
16107 : how to create joinable pthreads
16108 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16109         echo " "
16110         echo "Checking what constant to use for creating joinable pthreads..." >&4
16111         $cat >try.c <<'EOCP'
16112 #include <pthread.h>
16113 int main() {
16114     int detachstate = JOINABLE;
16115 }
16116 EOCP
16117         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16118         if eval $compile; then
16119                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16120                 val="$undef" # Yes, undef.
16121                 set d_old_pthread_create_joinable
16122                 eval $setvar
16123                 val=""
16124                 set old_pthread_create_joinable
16125                 eval $setvar
16126         else
16127                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16128                 if eval $compile; then
16129                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16130                         val="$define"
16131                         set d_old_pthread_create_joinable
16132                         eval $setvar
16133                         val=PTHREAD_CREATE_UNDETACHED
16134                         set old_pthread_create_joinable
16135                         eval $setvar
16136                 else
16137                         set try -DJOINABLE=__UNDETACHED
16138                         if eval $compile; then
16139                                 echo "You seem to use __UNDETACHED." >&4
16140                                 val="$define"
16141                                 set d_old_pthread_create_joinable
16142                                 eval $setvar
16143                                 val=__UNDETACHED
16144                                 set old_pthread_create_joinable
16145                                 eval $setvar
16146                         else
16147                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16148                                 val="$define"
16149                                 set d_old_pthread_create_joinable
16150                                 eval $setvar
16151                                 val=0
16152                                 set old_pthread_create_joinable
16153                                 eval $setvar
16154                         fi
16155                 fi
16156         fi
16157         $rm_try
16158 else
16159     d_old_pthread_create_joinable="$undef"
16160     old_pthread_create_joinable=""
16161 fi
16162
16163 : see if pause exists
16164 set pause d_pause
16165 eval $inlibc
16166
16167 : see if poll exists
16168 set poll d_poll
16169 eval $inlibc
16170
16171 : see if prctl exists
16172 set prctl d_prctl
16173 eval $inlibc
16174
16175 : see if prctl supports PR_SET_NAME
16176 d_prctl_set_name=$undef
16177 case $d_prctl in
16178     $define)
16179         $cat >try.c <<EOM
16180 #include <sys/prctl.h>
16181
16182 int main (int argc, char *argv[])
16183 {
16184     return (prctl (PR_SET_NAME, "Test"));
16185     } /* main */
16186 EOM
16187         set try
16188         if eval $compile_ok && $run ./try; then
16189             echo "Your prctl (PR_SET_NAME, ...) works"
16190             d_prctl_set_name=$define
16191             fi
16192         $rm_try
16193         ;;
16194     esac
16195
16196 : see if readlink exists
16197 set readlink d_readlink
16198 eval $inlibc
16199
16200 : Check if exe is symlink to abs path of executing program
16201 echo " "
16202 procselfexe=''
16203 val="$undef"
16204 case "$d_readlink" in
16205     "$define")
16206         : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
16207         : more tidy to avoid an extra level of symlink
16208         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
16209         while test $# -gt 0; do
16210             type=$1; try=$2
16211             shift; shift
16212             if $issymlink $try; then
16213                 $ls -l $try > reflect
16214                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16215                     echo "You have $type-like $try."
16216                     procselfexe='"'$try'"'
16217                     val="$define"
16218                     : This will break out of the loop
16219                     set X; shift
16220                 fi
16221             fi
16222         done
16223         ;;
16224 esac
16225 $rm -f reflect
16226 set d_procselfexe
16227 eval $setvar
16228
16229 : backward compatibility for d_hvfork
16230 if test X$d_hvfork != X; then
16231         d_vfork="$d_hvfork"
16232         d_hvfork=''
16233 fi
16234 : see if there is a vfork
16235 val=''
16236 set vfork val
16237 eval $inlibc
16238
16239 d_pseudofork=$undef
16240
16241 : Ok, but do we want to use it. vfork is reportedly unreliable in
16242 : perl on Solaris 2.x, and probably elsewhere.
16243 case "$val" in
16244 $define)
16245         echo " "
16246         case "$usevfork" in
16247         false) dflt='n';;
16248         *) dflt='y';;
16249         esac
16250         cat <<'EOM'
16251
16252 Perl can only use a vfork() that doesn't suffer from strict
16253 restrictions on calling functions or modifying global data in
16254 the child.  For example, glibc-2.1 contains such a vfork()
16255 that is unsuitable.  If your system provides a proper fork()
16256 call, chances are that you do NOT want perl to use vfork().
16257
16258 EOM
16259         rp="Do you still want to use vfork()?"
16260         . ./myread
16261         case "$ans" in
16262         y|Y) ;;
16263         *)
16264                 echo "Ok, we won't use vfork()."
16265                 val="$undef"
16266                 ;;
16267         esac
16268         ;;
16269 esac
16270 set d_vfork
16271 eval $setvar
16272 case "$d_vfork" in
16273 $define) usevfork='true';;
16274 *) usevfork='false';;
16275 esac
16276
16277 : see whether the pthread_atfork exists
16278 $cat >try.c <<EOP
16279 #include <pthread.h>
16280 #include <stdio.h>
16281 int main() {
16282 #ifdef  PTHREAD_ATFORK
16283         pthread_atfork(NULL,NULL,NULL);
16284 #endif
16285 }
16286 EOP
16287
16288 : see if pthread_atfork exists
16289 set try -DPTHREAD_ATFORK
16290 if eval $compile; then
16291     val="$define"
16292 else
16293     val="$undef"
16294 fi
16295 case "$usethreads" in
16296 $define)
16297         case "$val" in
16298         $define) echo 'pthread_atfork found.' >&4        ;;
16299         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16300         esac
16301 esac
16302 set d_pthread_atfork
16303 eval $setvar
16304
16305 : see if pthread_attr_setscope exists
16306 set pthread_attr_setscope d_pthread_attr_setscope
16307 eval $inlibc
16308
16309 : see whether the various POSIXish _yields exist
16310 $cat >try.c <<EOP
16311 #include <pthread.h>
16312 #include <stdio.h>
16313 int main() {
16314 #ifdef SCHED_YIELD
16315         sched_yield();
16316 #else
16317 #ifdef PTHREAD_YIELD
16318         pthread_yield();
16319 #else
16320 #ifdef PTHREAD_YIELD_NULL
16321         pthread_yield(NULL);
16322 #endif
16323 #endif
16324 #endif
16325 }
16326 EOP
16327 : see if sched_yield exists
16328 set try -DSCHED_YIELD
16329 if eval $compile; then
16330     val="$define"
16331     sched_yield='sched_yield()'
16332 else
16333     val="$undef"
16334 fi
16335 case "$usethreads" in
16336 $define)
16337         case "$val" in
16338         $define) echo 'sched_yield() found.' >&4        ;;
16339         *)       echo 'sched_yield() NOT found.' >&4    ;;
16340         esac
16341 esac
16342 set d_sched_yield
16343 eval $setvar
16344
16345 : see if pthread_yield exists
16346 set try -DPTHREAD_YIELD
16347 if eval $compile; then
16348     val="$define"
16349     case "$sched_yield" in
16350     '') sched_yield='pthread_yield()' ;;
16351     esac
16352 else
16353     set try -DPTHREAD_YIELD_NULL
16354     if eval $compile; then
16355         val="$define"
16356         case "$sched_yield" in
16357         '') sched_yield='pthread_yield(NULL)' ;;
16358         esac
16359     else
16360         val="$undef"
16361     fi
16362 fi
16363 case "$usethreads" in
16364 $define)
16365         case "$val" in
16366         $define) echo 'pthread_yield() found.' >&4      ;;
16367         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16368         esac
16369         ;;
16370 esac
16371 set d_pthread_yield
16372 eval $setvar
16373 case "$sched_yield" in
16374 '') sched_yield=undef ;;
16375 esac
16376 $rm_try
16377
16378 : see if random_r exists
16379 set random_r d_random_r
16380 eval $inlibc
16381 case "$d_random_r" in
16382 "$define")
16383         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16384         case "$d_random_r_proto:$usethreads" in
16385         ":define")      d_random_r_proto=define
16386                 set d_random_r_proto random_r $hdrs
16387                 eval $hasproto ;;
16388         *)      ;;
16389         esac
16390         case "$d_random_r_proto" in
16391         define)
16392         case "$random_r_proto" in
16393         ''|0) try='int random_r(int*, struct random_data*);'
16394         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16395         esac
16396         case "$random_r_proto" in
16397         ''|0) try='int random_r(long*, struct random_data*);'
16398         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16399         esac
16400         case "$random_r_proto" in
16401         ''|0) try='int random_r(struct random_data*, int32_t*);'
16402         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16403         esac
16404         case "$random_r_proto" in
16405         ''|0)   d_random_r=undef
16406                 random_r_proto=0
16407                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16408         * )     case "$random_r_proto" in
16409                 REENTRANT_PROTO*) ;;
16410                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16411                 esac
16412                 echo "Prototype: $try" ;;
16413         esac
16414         ;;
16415         *)      case "$usethreads" in
16416                 define) echo "random_r has no prototype, not using it." >&4 ;;
16417                 esac
16418                 d_random_r=undef
16419                 random_r_proto=0
16420                 ;;
16421         esac
16422         ;;
16423 *)      random_r_proto=0
16424         ;;
16425 esac
16426
16427 : see if readdir and friends exist
16428 set readdir d_readdir
16429 eval $inlibc
16430 set seekdir d_seekdir
16431 eval $inlibc
16432 set telldir d_telldir
16433 eval $inlibc
16434 set rewinddir d_rewinddir
16435 eval $inlibc
16436
16437 : see if readdir64_r exists
16438 set readdir64_r d_readdir64_r
16439 eval $inlibc
16440 case "$d_readdir64_r" in
16441 "$define")
16442         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16443         case "$d_readdir64_r_proto:$usethreads" in
16444         ":define")      d_readdir64_r_proto=define
16445                 set d_readdir64_r_proto readdir64_r $hdrs
16446                 eval $hasproto ;;
16447         *)      ;;
16448         esac
16449         case "$d_readdir64_r_proto" in
16450         define)
16451         case "$readdir64_r_proto" in
16452         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16453         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16454         esac
16455         case "$readdir64_r_proto" in
16456         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16457         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16458         esac
16459         case "$readdir64_r_proto" in
16460         ''|0)   d_readdir64_r=undef
16461                 readdir64_r_proto=0
16462                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16463         * )     case "$readdir64_r_proto" in
16464                 REENTRANT_PROTO*) ;;
16465                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16466                 esac
16467                 echo "Prototype: $try" ;;
16468         esac
16469         ;;
16470         *)      case "$usethreads" in
16471                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16472                 esac
16473                 d_readdir64_r=undef
16474                 readdir64_r_proto=0
16475                 ;;
16476         esac
16477         ;;
16478 *)      readdir64_r_proto=0
16479         ;;
16480 esac
16481
16482 : see if readdir_r exists
16483 set readdir_r d_readdir_r
16484 eval $inlibc
16485 case "$d_readdir_r" in
16486 "$define")
16487         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16488         case "$d_readdir_r_proto:$usethreads" in
16489         ":define")      d_readdir_r_proto=define
16490                 set d_readdir_r_proto readdir_r $hdrs
16491                 eval $hasproto ;;
16492         *)      ;;
16493         esac
16494         case "$d_readdir_r_proto" in
16495         define)
16496         case "$readdir_r_proto" in
16497         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16498         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16499         esac
16500         case "$readdir_r_proto" in
16501         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16502         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16503         esac
16504         case "$readdir_r_proto" in
16505         ''|0)   d_readdir_r=undef
16506                 readdir_r_proto=0
16507                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16508         * )     case "$readdir_r_proto" in
16509                 REENTRANT_PROTO*) ;;
16510                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16511                 esac
16512                 echo "Prototype: $try" ;;
16513         esac
16514         ;;
16515         *)      case "$usethreads" in
16516                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16517                 esac
16518                 d_readdir_r=undef
16519                 readdir_r_proto=0
16520                 ;;
16521         esac
16522         ;;
16523 *)      readdir_r_proto=0
16524         ;;
16525 esac
16526
16527 : see if readv exists
16528 set readv d_readv
16529 eval $inlibc
16530
16531 : see if recvmsg exists
16532 set recvmsg d_recvmsg
16533 eval $inlibc
16534
16535 : see if rename exists
16536 set rename d_rename
16537 eval $inlibc
16538
16539 : see if rmdir exists
16540 set rmdir d_rmdir
16541 eval $inlibc
16542
16543 : see if memory.h is available.
16544 val=''
16545 set memory.h val
16546 eval $inhdr
16547
16548 : See if it conflicts with string.h
16549 case "$val" in
16550 $define)
16551         case "$strings" in
16552         '') ;;
16553         *)
16554                 $cppstdin $cppflags $cppminus < $strings > mem.h
16555                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16556                         echo " "
16557                         echo "We won't be including <memory.h>."
16558                         val="$undef"
16559                 fi
16560                 $rm -f mem.h
16561                 ;;
16562         esac
16563 esac
16564 set i_memory
16565 eval $setvar
16566
16567 : can bcopy handle overlapping blocks?
16568 echo " "
16569 val="$undef"
16570 case "$d_memmove" in
16571 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16572 *)      case "$d_bcopy" in
16573         "$define")
16574                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16575                 $cat >try.c <<EOCP
16576 #$i_memory I_MEMORY
16577 #$i_stdlib I_STDLIB
16578 #$i_string I_STRING
16579 #$i_unistd I_UNISTD
16580 EOCP
16581         $cat >>try.c <<'EOCP'
16582 #include <stdio.h>
16583 #ifdef I_MEMORY
16584 #  include <memory.h>
16585 #endif
16586 #ifdef I_STDLIB
16587 #  include <stdlib.h>
16588 #endif
16589 #ifdef I_STRING
16590 #  include <string.h>
16591 #else
16592 #  include <strings.h>
16593 #endif
16594 #ifdef I_UNISTD
16595 #  include <unistd.h>  /* Needed for NetBSD */
16596 #endif
16597 int main()
16598 {
16599 char buf[128], abc[128];
16600 char *b;
16601 int len;
16602 int off;
16603 int align;
16604
16605 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16606    try to store the string in read-only memory. */
16607 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16608
16609 for (align = 7; align >= 0; align--) {
16610         for (len = 36; len; len--) {
16611                 b = buf+align;
16612                 bcopy(abc, b, len);
16613                 for (off = 1; off <= len; off++) {
16614                         bcopy(b, b+off, len);
16615                         bcopy(b+off, b, len);
16616                         if (bcmp(b, abc, len))
16617                                 exit(1);
16618                 }
16619         }
16620 }
16621 exit(0);
16622 }
16623 EOCP
16624                 set try
16625                 if eval $compile_ok; then
16626                         if $run ./try 2>/dev/null; then
16627                                 echo "Yes, it can."
16628                                 val="$define"
16629                         else
16630                                 echo "It can't, sorry."
16631                         fi
16632                 else
16633                         echo "(I can't compile the test program, so we'll assume not...)"
16634                 fi
16635                 ;;
16636         esac
16637         $rm_try
16638         ;;
16639 esac
16640 set d_safebcpy
16641 eval $setvar
16642
16643 : can memcpy handle overlapping blocks?
16644 echo " "
16645 val="$undef"
16646 case "$d_memmove" in
16647 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16648 *)      case "$d_memcpy" in
16649         "$define")
16650                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16651                 $cat >try.c <<EOCP
16652 #$i_memory I_MEMORY
16653 #$i_stdlib I_STDLIB
16654 #$i_string I_STRING
16655 #$i_unistd I_UNISTD
16656 EOCP
16657         $cat >>try.c <<'EOCP'
16658 #include <stdio.h>
16659 #ifdef I_MEMORY
16660 #  include <memory.h>
16661 #endif
16662 #ifdef I_STDLIB
16663 #  include <stdlib.h>
16664 #endif
16665 #ifdef I_STRING
16666 #  include <string.h>
16667 #else
16668 #  include <strings.h>
16669 #endif
16670 #ifdef I_UNISTD
16671 #  include <unistd.h>  /* Needed for NetBSD */
16672 #endif
16673 int main()
16674 {
16675 char buf[128], abc[128];
16676 char *b;
16677 int len;
16678 int off;
16679 int align;
16680
16681 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16682    try to store the string in read-only memory. */
16683 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16684
16685 for (align = 7; align >= 0; align--) {
16686         for (len = 36; len; len--) {
16687                 b = buf+align;
16688                 memcpy(b, abc, len);
16689                 for (off = 1; off <= len; off++) {
16690                         memcpy(b+off, b, len);
16691                         memcpy(b, b+off, len);
16692                         if (memcmp(b, abc, len))
16693                                 exit(1);
16694                 }
16695         }
16696 }
16697 exit(0);
16698 }
16699 EOCP
16700                 set try
16701                 if eval $compile_ok; then
16702                         if $run ./try 2>/dev/null; then
16703                                 echo "Yes, it can."
16704                                 val="$define"
16705                         else
16706                                 echo "It can't, sorry."
16707                         fi
16708                 else
16709                         echo "(I can't compile the test program, so we'll assume not...)"
16710                 fi
16711                 ;;
16712         esac
16713         $rm_try
16714         ;;
16715 esac
16716 set d_safemcpy
16717 eval $setvar
16718
16719 : can memcmp be trusted to compare relative magnitude?
16720 val="$undef"
16721 case "$d_memcmp" in
16722 "$define")
16723         echo " "
16724         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16725         $cat >try.c <<EOCP
16726 #$i_memory I_MEMORY
16727 #$i_stdlib I_STDLIB
16728 #$i_string I_STRING
16729 #$i_unistd I_UNISTD
16730 EOCP
16731         $cat >>try.c <<'EOCP'
16732 #include <stdio.h>
16733 #ifdef I_MEMORY
16734 #  include <memory.h>
16735 #endif
16736 #ifdef I_STDLIB
16737 #  include <stdlib.h>
16738 #endif
16739 #ifdef I_STRING
16740 #  include <string.h>
16741 #else
16742 #  include <strings.h>
16743 #endif
16744 #ifdef I_UNISTD
16745 #  include <unistd.h>  /* Needed for NetBSD */
16746 #endif
16747 int main()
16748 {
16749 char a = -1;
16750 char b = 0;
16751 if ((a < b) && memcmp(&a, &b, 1) < 0)
16752         exit(1);
16753 exit(0);
16754 }
16755 EOCP
16756         set try
16757         if eval $compile_ok; then
16758                 if $run ./try 2>/dev/null; then
16759                         echo "Yes, it can."
16760                         val="$define"
16761                 else
16762                         echo "No, it can't (it uses signed chars)."
16763                 fi
16764         else
16765                 echo "(I can't compile the test program, so we'll assume not...)"
16766         fi
16767         ;;
16768 esac
16769 $rm_try
16770 set d_sanemcmp
16771 eval $setvar
16772
16773 : see if prototype for sbrk is available
16774 echo " "
16775 set d_sbrkproto sbrk $i_unistd unistd.h
16776 eval $hasproto
16777
16778 : see if select exists
16779 set select d_select
16780 eval $inlibc
16781
16782 : see if semctl exists
16783 set semctl d_semctl
16784 eval $inlibc
16785
16786 : see if semget exists
16787 set semget d_semget
16788 eval $inlibc
16789
16790 : see if semop exists
16791 set semop d_semop
16792 eval $inlibc
16793
16794 : see how much of the 'sem*(2)' library is present.
16795 h_sem=true
16796 echo " "
16797 case "$d_semctl$d_semget$d_semop" in
16798 *"$undef"*) h_sem=false;;
16799 esac
16800 case "$osname" in
16801 freebsd)
16802     case "`ipcs 2>&1`" in
16803     "SVID messages"*"not configured"*)
16804         echo "Your $osname does not have the sem*(2) configured." >&4
16805         h_sem=false
16806         val="$undef"
16807         set semctl d_semctl
16808         eval $setvar
16809         set semget d_semget
16810         eval $setvar
16811         set semop d_semop
16812         eval $setvar
16813         ;;
16814     esac
16815     ;;
16816 esac
16817 : we could also check for sys/ipc.h ...
16818 if $h_sem && $test `./findhdr sys/sem.h`; then
16819         echo "You have the full sem*(2) library." >&4
16820         val="$define"
16821 else
16822         echo "You don't have the full sem*(2) library." >&4
16823         val="$undef"
16824 fi
16825 set d_sem
16826 eval $setvar
16827
16828 : see whether sys/sem.h defines union semun
16829 echo " "
16830 $cat > try.c <<'END'
16831 #include <sys/types.h>
16832 #include <sys/ipc.h>
16833 #include <sys/sem.h>
16834 int main () { union semun semun; semun.buf = 0; }
16835 END
16836 set try
16837 if eval $compile; then
16838     echo "You have union semun in <sys/sem.h>." >&4
16839     val="$define"
16840 else
16841     echo "You do not have union semun in <sys/sem.h>." >&4
16842     val="$undef"
16843 fi
16844 $rm_try
16845 set d_union_semun
16846 eval $setvar
16847
16848 : see how to do semctl IPC_STAT
16849 case "$d_sem" in
16850 $define)
16851     echo " "
16852     $cat > tryh.h <<END
16853 #ifndef S_IRUSR
16854 #   ifdef S_IREAD
16855 #       define S_IRUSR S_IREAD
16856 #       define S_IWUSR S_IWRITE
16857 #       define S_IXUSR S_IEXEC
16858 #   else
16859 #       define S_IRUSR 0400
16860 #       define S_IWUSR 0200
16861 #       define S_IXUSR 0100
16862 #   endif
16863 #   define S_IRGRP (S_IRUSR>>3)
16864 #   define S_IWGRP (S_IWUSR>>3)
16865 #   define S_IXGRP (S_IXUSR>>3)
16866 #   define S_IROTH (S_IRUSR>>6)
16867 #   define S_IWOTH (S_IWUSR>>6)
16868 #   define S_IXOTH (S_IXUSR>>6)
16869 #endif
16870 #ifndef S_IRWXU
16871 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16872 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16873 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16874 #endif
16875 END
16876     : see whether semctl IPC_STAT can use union semun
16877     case "$d_semctl_semun" in
16878     '')
16879       val="$undef"
16880       $cat > try.c <<END
16881 #include <sys/types.h>
16882 #include <sys/ipc.h>
16883 #include <sys/sem.h>
16884 #include <sys/stat.h>
16885 #include <stdio.h>
16886 #include <errno.h>
16887 #include "tryh.h"
16888 #ifndef errno
16889 extern int errno;
16890 #endif
16891 #$d_union_semun HAS_UNION_SEMUN
16892 int main() {
16893     union semun
16894 #ifndef HAS_UNION_SEMUN
16895     {
16896         int val;
16897         struct semid_ds *buf;
16898         unsigned short *array;
16899     }
16900 #endif
16901     arg;
16902     int sem, st;
16903
16904 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16905     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16906     if (sem > -1) {
16907         struct semid_ds argbuf;
16908         arg.buf = &argbuf;
16909 #       ifdef IPC_STAT
16910         st = semctl(sem, 0, IPC_STAT, arg);
16911         if (st == 0)
16912             printf("semun\n");
16913         else
16914 #       endif /* IPC_STAT */
16915             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16916 #       ifdef IPC_RMID
16917         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16918 #       endif /* IPC_RMID */
16919             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16920     } else
16921 #endif /* IPC_PRIVATE && ... */
16922         printf("semget failed: errno = %d\n", errno);
16923   return 0;
16924 }
16925 END
16926       set try
16927       if eval $compile; then
16928           xxx=`$run ./try`
16929           case "$xxx" in
16930           semun) val="$define" ;;
16931           esac
16932       fi
16933       $rm_try
16934       set d_semctl_semun
16935       eval $setvar
16936       ;;
16937     esac
16938     case "$d_semctl_semun" in
16939     $define)
16940         echo "You can use union semun for semctl IPC_STAT." >&4
16941         also='also'
16942         ;;
16943     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16944         also=''
16945         ;;
16946     esac
16947
16948     : see whether semctl IPC_STAT can use struct semid_ds pointer
16949     case "$d_semctl_semid_ds" in
16950     '')
16951       val="$undef"
16952       $cat > try.c <<'END'
16953 #include <sys/types.h>
16954 #include <sys/ipc.h>
16955 #include <sys/sem.h>
16956 #include <sys/stat.h>
16957 #include "tryh.h"
16958 #include <stdio.h>
16959 #include <errno.h>
16960 #ifndef errno
16961 extern int errno;
16962 #endif
16963 int main() {
16964     struct semid_ds arg;
16965     int sem, st;
16966
16967 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16968     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16969     if (sem > -1) {
16970 #       ifdef IPC_STAT
16971         st = semctl(sem, 0, IPC_STAT, &arg);
16972         if (st == 0)
16973             printf("semid_ds\n");
16974         else
16975 #       endif /* IPC_STAT */
16976             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16977 #       ifdef IPC_RMID
16978         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16979 #       endif /* IPC_RMID */
16980             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16981     } else
16982 #endif /* IPC_PRIVATE && ... */
16983         printf("semget failed: errno = %d\n", errno);
16984
16985     return 0;
16986 }
16987 END
16988       set try
16989       if eval $compile; then
16990           xxx=`$run ./try`
16991           case "$xxx" in
16992           semid_ds) val="$define" ;;
16993           esac
16994       fi
16995       $rm_try
16996       set d_semctl_semid_ds
16997       eval $setvar
16998       ;;
16999     esac
17000     case "$d_semctl_semid_ds" in
17001     $define)
17002         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17003         ;;
17004     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17005         ;;
17006     esac
17007     ;;
17008 *)  val="$undef"
17009
17010     # We do not have the full sem*(2) library, so assume we can not
17011     # use either.
17012
17013     set d_semctl_semun
17014     eval $setvar
17015
17016     set d_semctl_semid_ds
17017     eval $setvar
17018     ;;
17019 esac
17020 $rm_try tryh.h
17021
17022 : see if sendmsg exists
17023 set sendmsg d_sendmsg
17024 eval $inlibc
17025
17026 : see if setegid exists
17027 set setegid d_setegid
17028 eval $inlibc
17029
17030 : see if seteuid exists
17031 set seteuid d_seteuid
17032 eval $inlibc
17033
17034 : see if setgrent exists
17035 set setgrent d_setgrent
17036 eval $inlibc
17037
17038 : see if setgrent_r exists
17039 set setgrent_r d_setgrent_r
17040 eval $inlibc
17041 case "$d_setgrent_r" in
17042 "$define")
17043         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17044         case "$d_setgrent_r_proto:$usethreads" in
17045         ":define")      d_setgrent_r_proto=define
17046                 set d_setgrent_r_proto setgrent_r $hdrs
17047                 eval $hasproto ;;
17048         *)      ;;
17049         esac
17050         case "$d_setgrent_r_proto" in
17051         define)
17052         case "$setgrent_r_proto" in
17053         ''|0) try='int setgrent_r(FILE**);'
17054         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17055         esac
17056         case "$setgrent_r_proto" in
17057         ''|0) try='void setgrent_r(FILE**);'
17058         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17059         esac
17060         case "$setgrent_r_proto" in
17061         ''|0)   d_setgrent_r=undef
17062                 setgrent_r_proto=0
17063                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17064         * )     case "$setgrent_r_proto" in
17065                 REENTRANT_PROTO*) ;;
17066                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17067                 esac
17068                 echo "Prototype: $try" ;;
17069         esac
17070         ;;
17071         *)      case "$usethreads" in
17072                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17073                 esac
17074                 d_setgrent_r=undef
17075                 setgrent_r_proto=0
17076                 ;;
17077         esac
17078         ;;
17079 *)      setgrent_r_proto=0
17080         ;;
17081 esac
17082
17083 : see if sethostent exists
17084 set sethostent d_sethent
17085 eval $inlibc
17086
17087 : see if sethostent_r exists
17088 set sethostent_r d_sethostent_r
17089 eval $inlibc
17090 case "$d_sethostent_r" in
17091 "$define")
17092         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17093         case "$d_sethostent_r_proto:$usethreads" in
17094         ":define")      d_sethostent_r_proto=define
17095                 set d_sethostent_r_proto sethostent_r $hdrs
17096                 eval $hasproto ;;
17097         *)      ;;
17098         esac
17099         case "$d_sethostent_r_proto" in
17100         define)
17101         case "$sethostent_r_proto" in
17102         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17103         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17104         esac
17105         case "$sethostent_r_proto" in
17106         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17107         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17108         esac
17109         case "$sethostent_r_proto" in
17110         ''|0)   d_sethostent_r=undef
17111                 sethostent_r_proto=0
17112                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17113         * )     case "$sethostent_r_proto" in
17114                 REENTRANT_PROTO*) ;;
17115                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17116                 esac
17117                 echo "Prototype: $try" ;;
17118         esac
17119         ;;
17120         *)      case "$usethreads" in
17121                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17122                 esac
17123                 d_sethostent_r=undef
17124                 sethostent_r_proto=0
17125                 ;;
17126         esac
17127         ;;
17128 *)      sethostent_r_proto=0
17129         ;;
17130 esac
17131
17132 : see if setitimer exists
17133 set setitimer d_setitimer
17134 eval $inlibc
17135
17136 : see if setlinebuf exists
17137 set setlinebuf d_setlinebuf
17138 eval $inlibc
17139
17140 : see if setlocale exists
17141 set setlocale d_setlocale
17142 eval $inlibc
17143
17144 : see if locale.h is available
17145 set locale.h i_locale
17146 eval $inhdr
17147
17148 : see if setlocale_r exists
17149 set setlocale_r d_setlocale_r
17150 eval $inlibc
17151 case "$d_setlocale_r" in
17152 "$define")
17153         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17154         case "$d_setlocale_r_proto:$usethreads" in
17155         ":define")      d_setlocale_r_proto=define
17156                 set d_setlocale_r_proto setlocale_r $hdrs
17157                 eval $hasproto ;;
17158         *)      ;;
17159         esac
17160         case "$d_setlocale_r_proto" in
17161         define)
17162         case "$setlocale_r_proto" in
17163         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17164         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17165         esac
17166         case "$setlocale_r_proto" in
17167         ''|0)   d_setlocale_r=undef
17168                 setlocale_r_proto=0
17169                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17170         * )     case "$setlocale_r_proto" in
17171                 REENTRANT_PROTO*) ;;
17172                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17173                 esac
17174                 echo "Prototype: $try" ;;
17175         esac
17176         ;;
17177         *)      case "$usethreads" in
17178                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17179                 esac
17180                 d_setlocale_r=undef
17181                 setlocale_r_proto=0
17182                 ;;
17183         esac
17184         ;;
17185 *)      setlocale_r_proto=0
17186         ;;
17187 esac
17188
17189 : see if setnetent exists
17190 set setnetent d_setnent
17191 eval $inlibc
17192
17193 : see if setnetent_r exists
17194 set setnetent_r d_setnetent_r
17195 eval $inlibc
17196 case "$d_setnetent_r" in
17197 "$define")
17198         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17199         case "$d_setnetent_r_proto:$usethreads" in
17200         ":define")      d_setnetent_r_proto=define
17201                 set d_setnetent_r_proto setnetent_r $hdrs
17202                 eval $hasproto ;;
17203         *)      ;;
17204         esac
17205         case "$d_setnetent_r_proto" in
17206         define)
17207         case "$setnetent_r_proto" in
17208         ''|0) try='int setnetent_r(int, struct netent_data*);'
17209         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17210         esac
17211         case "$setnetent_r_proto" in
17212         ''|0) try='void setnetent_r(int, struct netent_data*);'
17213         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17214         esac
17215         case "$setnetent_r_proto" in
17216         ''|0)   d_setnetent_r=undef
17217                 setnetent_r_proto=0
17218                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17219         * )     case "$setnetent_r_proto" in
17220                 REENTRANT_PROTO*) ;;
17221                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17222                 esac
17223                 echo "Prototype: $try" ;;
17224         esac
17225         ;;
17226         *)      case "$usethreads" in
17227                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17228                 esac
17229                 d_setnetent_r=undef
17230                 setnetent_r_proto=0
17231                 ;;
17232         esac
17233         ;;
17234 *)      setnetent_r_proto=0
17235         ;;
17236 esac
17237
17238 : see if setprotoent exists
17239 set setprotoent d_setpent
17240 eval $inlibc
17241
17242 : see if setpgid exists
17243 set setpgid d_setpgid
17244 eval $inlibc
17245
17246 : see if setpgrp2 exists
17247 set setpgrp2 d_setpgrp2
17248 eval $inlibc
17249
17250 : see if setpriority exists
17251 set setpriority d_setprior
17252 eval $inlibc
17253
17254 : see if setproctitle exists
17255 set setproctitle d_setproctitle
17256 eval $inlibc
17257
17258 : see if setprotoent_r exists
17259 set setprotoent_r d_setprotoent_r
17260 eval $inlibc
17261 case "$d_setprotoent_r" in
17262 "$define")
17263         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17264         case "$d_setprotoent_r_proto:$usethreads" in
17265         ":define")      d_setprotoent_r_proto=define
17266                 set d_setprotoent_r_proto setprotoent_r $hdrs
17267                 eval $hasproto ;;
17268         *)      ;;
17269         esac
17270         case "$d_setprotoent_r_proto" in
17271         define)
17272         case "$setprotoent_r_proto" in
17273         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17274         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17275         esac
17276         case "$setprotoent_r_proto" in
17277         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17278         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17279         esac
17280         case "$setprotoent_r_proto" in
17281         ''|0)   d_setprotoent_r=undef
17282                 setprotoent_r_proto=0
17283                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17284         * )     case "$setprotoent_r_proto" in
17285                 REENTRANT_PROTO*) ;;
17286                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17287                 esac
17288                 echo "Prototype: $try" ;;
17289         esac
17290         ;;
17291         *)      case "$usethreads" in
17292                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17293                 esac
17294                 d_setprotoent_r=undef
17295                 setprotoent_r_proto=0
17296                 ;;
17297         esac
17298         ;;
17299 *)      setprotoent_r_proto=0
17300         ;;
17301 esac
17302
17303 : see if setpwent exists
17304 set setpwent d_setpwent
17305 eval $inlibc
17306
17307 : see if setpwent_r exists
17308 set setpwent_r d_setpwent_r
17309 eval $inlibc
17310 case "$d_setpwent_r" in
17311 "$define")
17312         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17313         case "$d_setpwent_r_proto:$usethreads" in
17314         ":define")      d_setpwent_r_proto=define
17315                 set d_setpwent_r_proto setpwent_r $hdrs
17316                 eval $hasproto ;;
17317         *)      ;;
17318         esac
17319         case "$d_setpwent_r_proto" in
17320         define)
17321         case "$setpwent_r_proto" in
17322         ''|0) try='int setpwent_r(FILE**);'
17323         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17324         esac
17325         case "$setpwent_r_proto" in
17326         ''|0) try='void setpwent_r(FILE**);'
17327         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17328         esac
17329         case "$setpwent_r_proto" in
17330         ''|0)   d_setpwent_r=undef
17331                 setpwent_r_proto=0
17332                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17333         * )     case "$setpwent_r_proto" in
17334                 REENTRANT_PROTO*) ;;
17335                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17336                 esac
17337                 echo "Prototype: $try" ;;
17338         esac
17339         ;;
17340         *)      case "$usethreads" in
17341                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17342                 esac
17343                 d_setpwent_r=undef
17344                 setpwent_r_proto=0
17345                 ;;
17346         esac
17347         ;;
17348 *)      setpwent_r_proto=0
17349         ;;
17350 esac
17351
17352 : see if setregid exists
17353 set setregid d_setregid
17354 eval $inlibc
17355 set setresgid d_setresgid
17356 eval $inlibc
17357
17358 : see if setreuid exists
17359 set setreuid d_setreuid
17360 eval $inlibc
17361 set setresuid d_setresuid
17362 eval $inlibc
17363
17364 : see if setrgid exists
17365 set setrgid d_setrgid
17366 eval $inlibc
17367
17368 : see if setruid exists
17369 set setruid d_setruid
17370 eval $inlibc
17371
17372 : see if setservent exists
17373 set setservent d_setsent
17374 eval $inlibc
17375
17376 : see if setservent_r exists
17377 set setservent_r d_setservent_r
17378 eval $inlibc
17379 case "$d_setservent_r" in
17380 "$define")
17381         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17382         case "$d_setservent_r_proto:$usethreads" in
17383         ":define")      d_setservent_r_proto=define
17384                 set d_setservent_r_proto setservent_r $hdrs
17385                 eval $hasproto ;;
17386         *)      ;;
17387         esac
17388         case "$d_setservent_r_proto" in
17389         define)
17390         case "$setservent_r_proto" in
17391         ''|0) try='int setservent_r(int, struct servent_data*);'
17392         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17393         esac
17394         case "$setservent_r_proto" in
17395         ''|0) try='void setservent_r(int, struct servent_data*);'
17396         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17397         esac
17398         case "$setservent_r_proto" in
17399         ''|0)   d_setservent_r=undef
17400                 setservent_r_proto=0
17401                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17402         * )     case "$setservent_r_proto" in
17403                 REENTRANT_PROTO*) ;;
17404                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17405                 esac
17406                 echo "Prototype: $try" ;;
17407         esac
17408         ;;
17409         *)      case "$usethreads" in
17410                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17411                 esac
17412                 d_setservent_r=undef
17413                 setservent_r_proto=0
17414                 ;;
17415         esac
17416         ;;
17417 *)      setservent_r_proto=0
17418         ;;
17419 esac
17420
17421 : see if setsid exists
17422 set setsid d_setsid
17423 eval $inlibc
17424
17425 : see if setvbuf exists
17426 set setvbuf d_setvbuf
17427 eval $inlibc
17428
17429 : see if shmctl exists
17430 set shmctl d_shmctl
17431 eval $inlibc
17432
17433 : see if shmget exists
17434 set shmget d_shmget
17435 eval $inlibc
17436
17437 : see if shmat exists
17438 set shmat d_shmat
17439 eval $inlibc
17440 : see what shmat returns
17441 case "$d_shmat" in
17442 "$define")
17443         $cat >shmat.c <<'END'
17444 #include <sys/shm.h>
17445 void *shmat();
17446 END
17447         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17448                 shmattype='void *'
17449         else
17450                 shmattype='char *'
17451         fi
17452         echo "and it returns ($shmattype)." >&4
17453         : see if a prototype for shmat is available
17454         xxx=`./findhdr sys/shm.h`
17455         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17456         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17457                 val="$define"
17458         else
17459                 val="$undef"
17460         fi
17461         $rm -f shmat.[co]
17462         ;;
17463 *)
17464         val="$undef"
17465         ;;
17466 esac
17467 set d_shmatprototype
17468 eval $setvar
17469
17470 : see if shmdt exists
17471 set shmdt d_shmdt
17472 eval $inlibc
17473
17474 : see how much of the 'shm*(2)' library is present.
17475 h_shm=true
17476 echo " "
17477 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17478 *"$undef"*) h_shm=false;;
17479 esac
17480 case "$osname" in
17481 freebsd)
17482     case "`ipcs 2>&1`" in
17483     "SVID shared memory"*"not configured"*)
17484         echo "Your $osname does not have the shm*(2) configured." >&4
17485         h_shm=false
17486         val="$undef"
17487         set shmctl d_shmctl
17488         evat $setvar
17489         set shmget d_shmget
17490         evat $setvar
17491         set shmat d_shmat
17492         evat $setvar
17493         set shmdt d_shmdt
17494         evat $setvar
17495         ;;
17496     esac
17497     ;;
17498 esac
17499 : we could also check for sys/ipc.h ...
17500 if $h_shm && $test `./findhdr sys/shm.h`; then
17501         echo "You have the full shm*(2) library." >&4
17502         val="$define"
17503 else
17504         echo "You don't have the full shm*(2) library." >&4
17505         val="$undef"
17506 fi
17507 set d_shm
17508 eval $setvar
17509
17510 : see if we have sigaction
17511 echo " "
17512 if set sigaction val -f d_sigaction; eval $csym; $val; then
17513         echo 'sigaction() found.' >&4
17514         $cat > try.c <<EOP
17515 #include <stdio.h>
17516 #include <sys/types.h>
17517 #include <signal.h>
17518 #$i_stdlib I_STDLIB
17519 #ifdef I_STDLIB
17520 #include <stdlib.h>
17521 #endif
17522 int main()
17523 {
17524     struct sigaction act, oact;
17525     act.sa_flags = 0;
17526     oact.sa_handler = 0;
17527     /* so that act and oact are used */
17528     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17529 }
17530 EOP
17531         set try
17532         if eval $compile_ok; then
17533                 val="$define"
17534         else
17535                 echo "But you don't seem to have a usable struct sigaction." >&4
17536                 val="$undef"
17537         fi
17538 else
17539         echo 'sigaction NOT found.' >&4
17540         val="$undef"
17541 fi
17542 set d_sigaction; eval $setvar
17543 $rm_try
17544
17545 : see if this is a sunmath.h system
17546 set sunmath.h i_sunmath
17547 eval $inhdr
17548
17549 : see if signbit exists
17550 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17551 $cat >try.c <<EOCP
17552 #$i_math I_MATH
17553 #$i_sunmath I_SUNMATH
17554 #ifdef I_MATH
17555 #  include <math.h>
17556 #endif
17557 #ifdef I_SUNMATH  /* Solaris special math library */
17558 #  include <sunmath.h>
17559 #endif
17560 #define NV $nvtype
17561 int main(int argc, char **argv)
17562 {
17563     NV x = 0.0;
17564     NV y = -0.0;
17565     if ((signbit(x) == 0) && (signbit(y) != 0))
17566         return 0;
17567     else
17568         return 1;
17569 }
17570 EOCP
17571 val="$undef"
17572 set try
17573 if eval $compile; then
17574     if $run ./try; then
17575         $echo "Yes." >&4
17576         val="$define"
17577     else
17578         $echo "Signbit seems to be available, but doesn't work as I expected."
17579         $echo "I won't use it." >&4
17580         val="$undef"
17581     fi
17582 else
17583     $echo "Nope." >&4
17584     dflt="$undef"
17585 fi
17586 set d_signbit
17587 eval $setvar
17588 $rm_try
17589
17590 : see if sigprocmask exists
17591 set sigprocmask d_sigprocmask
17592 eval $inlibc
17593
17594 : see if sigsetjmp exists
17595 echo " "
17596 case "$d_sigsetjmp" in
17597 '')
17598         $cat >try.c <<EOP
17599 #include <setjmp.h>
17600 #$i_stdlib I_STDLIB
17601 #ifdef I_STDLIB
17602 #include <stdlib.h>
17603 #endif
17604 sigjmp_buf env;
17605 int set = 1;
17606 int main()
17607 {
17608         if (sigsetjmp(env,1))
17609                 exit(set);
17610         set = 0;
17611         siglongjmp(env, 1);
17612         exit(1);
17613 }
17614 EOP
17615         set try
17616         if eval $compile; then
17617                 if $run ./try >/dev/null 2>&1; then
17618                         echo "POSIX sigsetjmp found." >&4
17619                         val="$define"
17620                 else
17621                         $cat >&4 <<EOM
17622 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17623 I'll ignore them.
17624 EOM
17625                         val="$undef"
17626                 fi
17627         else
17628                 echo "sigsetjmp not found." >&4
17629                 val="$undef"
17630         fi
17631         ;;
17632 *) val="$d_sigsetjmp"
17633         case "$d_sigsetjmp" in
17634         $define) echo "POSIX sigsetjmp found." >&4;;
17635         $undef) echo "sigsetjmp not found." >&4;;
17636         esac
17637         ;;
17638 esac
17639 set d_sigsetjmp
17640 eval $setvar
17641 $rm_try
17642
17643 : see if snprintf exists
17644 set snprintf d_snprintf
17645 eval $inlibc
17646
17647 : see if vsnprintf exists
17648 set vsnprintf d_vsnprintf
17649 eval $inlibc
17650
17651 case "$d_snprintf-$d_vsnprintf" in
17652 "$define-$define")
17653     $cat <<EOM
17654 Checking whether your snprintf() and vsnprintf() work okay...
17655 EOM
17656     $cat >try.c <<'EOCP'
17657 /* v?snprintf testing logic courtesy of Russ Allbery.
17658  * According to C99:
17659  * - if the buffer is too short it still must be \0-terminated
17660  * - if the buffer is too short the potentially required length
17661  *   must be returned and not -1
17662  * - if the buffer is NULL the potentially required length
17663  *   must be returned and not -1 or core dump
17664  */
17665 #include <stdio.h>
17666 #include <stdarg.h>
17667
17668 char buf[2];
17669
17670 int test (char *format, ...)
17671 {
17672     va_list args;
17673     int count;
17674
17675     va_start (args, format);
17676     count = vsnprintf (buf, sizeof buf, format, args);
17677     va_end (args);
17678     return count;
17679 }
17680
17681 int main ()
17682 {
17683     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17684              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17685 }
17686 EOCP
17687     set try
17688     if eval $compile; then
17689         `$run ./try`
17690         case "$?" in
17691         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17692         *) cat <<EOM >&4
17693 Your snprintf() and snprintf() don't seem to be working okay.
17694 EOM
17695            d_snprintf="$undef"
17696            d_vsnprintf="$undef"
17697            ;;
17698         esac
17699     else
17700         echo "(I can't seem to compile the test program--assuming they don't)"
17701         d_snprintf="$undef"
17702         d_vsnprintf="$undef"
17703     fi
17704     $rm_try
17705     ;;
17706 esac
17707
17708 : see if sockatmark exists
17709 set sockatmark d_sockatmark
17710 eval $inlibc
17711
17712 : see if prototype for sockatmark is available
17713 echo " "
17714 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17715 eval $hasproto
17716
17717 : see if socks5_init exists
17718 set socks5_init d_socks5_init
17719 eval $inlibc
17720
17721 : see if sprintf returns the length of the string in the buffer as per ANSI
17722 $echo "Checking whether sprintf returns the length of the string..." >&4
17723 $cat <<EOP >try.c
17724 #include <stdio.h>
17725 #$i_stdlib I_STDLIB
17726 #ifdef I_STDLIB
17727 #include <stdlib.h>
17728 #endif
17729 #$i_string I_STRING
17730 #ifdef I_STRING
17731 #  include <string.h>
17732 #else
17733 #  include <strings.h>
17734 #endif
17735 #$i_math I_MATH
17736 #ifdef I_MATH
17737 #include <math.h>
17738 #endif
17739
17740 char buffer[256];
17741
17742 int check (size_t expect, int test) {
17743   size_t got = strlen(buffer);
17744   if (expect == got)
17745     return 0;
17746
17747   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17748        test, buffer);
17749   exit (test);
17750 }
17751
17752 int main(int argc, char **argv) {
17753   int test = 0;
17754
17755   check(sprintf(buffer, ""), ++test);
17756   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17757   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17758
17759   return 0;
17760 }
17761 EOP
17762 set try
17763
17764 if eval $compile; then
17765     xxx="`$run ./try`"
17766     case "$?" in
17767         0) cat >&4 <<EOM
17768 sprintf returns the length of the string (as ANSI says it should)
17769 EOM
17770         d_sprintf_returns_strlen="$define"
17771         ;;
17772         *) cat >&4 <<EOM
17773 sprintf does not return the length of the string (how old is this system?)
17774 EOM
17775         d_sprintf_returns_strlen="$undef"
17776         ;;
17777     esac
17778 else
17779     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17780     d_sprintf_returns_strlen="$undef"
17781 fi
17782 $rm_try
17783
17784 : see if srand48_r exists
17785 set srand48_r d_srand48_r
17786 eval $inlibc
17787 case "$d_srand48_r" in
17788 "$define")
17789         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17790         case "$d_srand48_r_proto:$usethreads" in
17791         ":define")      d_srand48_r_proto=define
17792                 set d_srand48_r_proto srand48_r $hdrs
17793                 eval $hasproto ;;
17794         *)      ;;
17795         esac
17796         case "$d_srand48_r_proto" in
17797         define)
17798         case "$srand48_r_proto" in
17799         ''|0) try='int srand48_r(long, struct drand48_data*);'
17800         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17801         esac
17802         case "$srand48_r_proto" in
17803         ''|0)   d_srand48_r=undef
17804                 srand48_r_proto=0
17805                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17806         * )     case "$srand48_r_proto" in
17807                 REENTRANT_PROTO*) ;;
17808                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17809                 esac
17810                 echo "Prototype: $try" ;;
17811         esac
17812         ;;
17813         *)      case "$usethreads" in
17814                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17815                 esac
17816                 d_srand48_r=undef
17817                 srand48_r_proto=0
17818                 ;;
17819         esac
17820         ;;
17821 *)      srand48_r_proto=0
17822         ;;
17823 esac
17824
17825 : see if srandom_r exists
17826 set srandom_r d_srandom_r
17827 eval $inlibc
17828 case "$d_srandom_r" in
17829 "$define")
17830         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17831         case "$d_srandom_r_proto:$usethreads" in
17832         ":define")      d_srandom_r_proto=define
17833                 set d_srandom_r_proto srandom_r $hdrs
17834                 eval $hasproto ;;
17835         *)      ;;
17836         esac
17837         case "$d_srandom_r_proto" in
17838         define)
17839         case "$srandom_r_proto" in
17840         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17841         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17842         esac
17843         case "$srandom_r_proto" in
17844         ''|0)   d_srandom_r=undef
17845                 srandom_r_proto=0
17846                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17847         * )     case "$srandom_r_proto" in
17848                 REENTRANT_PROTO*) ;;
17849                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17850                 esac
17851                 echo "Prototype: $try" ;;
17852         esac
17853         ;;
17854         *)      case "$usethreads" in
17855                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17856                 esac
17857                 d_srandom_r=undef
17858                 srandom_r_proto=0
17859                 ;;
17860         esac
17861         ;;
17862 *)      srandom_r_proto=0
17863         ;;
17864 esac
17865
17866 : see if prototype for setresgid is available
17867 echo " "
17868 set d_sresgproto setresgid $i_unistd unistd.h
17869 eval $hasproto
17870
17871 : see if prototype for setresuid is available
17872 echo " "
17873 set d_sresuproto setresuid $i_unistd unistd.h
17874 eval $hasproto
17875
17876 : see if sys/stat.h is available
17877 set sys/stat.h i_sysstat
17878 eval $inhdr
17879
17880 : see if stat knows about block sizes
17881 echo " "
17882 echo "Checking to see if your struct stat has st_blocks field..." >&4
17883 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17884 eval $hasfield
17885
17886 : see if this is a sys/vfs.h system
17887 set sys/vfs.h i_sysvfs
17888 eval $inhdr
17889
17890 : see if this is a sys/statfs.h system
17891 set sys/statfs.h i_sysstatfs
17892 eval $inhdr
17893
17894 : Check for statfs_s
17895 echo " "
17896 echo "Checking to see if your system supports struct statfs..." >&4
17897 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
17898 eval $hasstruct
17899 case "$d_statfs_s" in
17900 "$define")      echo "Yes, it does."   ;;
17901 *)              echo "No, it doesn't." ;;
17902 esac
17903
17904
17905 : see if struct statfs knows about f_flags
17906 case "$d_statfs_s" in
17907 define)
17908         echo " "
17909         echo "Checking to see if your struct statfs has f_flags field..." >&4
17910         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
17911         eval $hasfield
17912         ;;
17913 *)      val="$undef"
17914         set d_statfs_f_flags
17915         eval $setvar
17916         ;;
17917 esac
17918 case "$d_statfs_f_flags" in
17919 "$define")      echo "Yes, it does."   ;;
17920 *)              echo "No, it doesn't." ;;
17921 esac
17922
17923 : see what flavor, if any, of static inline is supported
17924 echo " "
17925 echo "Checking to see if your system supports static inline..."
17926 $cat > try.c <<'EOCP'
17927 #include <stdlib.h>
17928 extern int f_via_a(int x);
17929 extern int f_via_b(int x);
17930 int main(int argc, char **argv)
17931 {
17932     int y;
17933
17934     y = f_via_a(0);
17935 #ifdef USE_B
17936     y = f_via_b(0);
17937 #endif
17938     if (y == 42) {
17939         return EXIT_SUCCESS;
17940     }
17941     else {
17942         return EXIT_FAILURE;
17943     }
17944 }
17945 EOCP
17946 $cat > a.c <<'EOCP'
17947 static INLINE int f(int x) {
17948     int y;
17949     y = x + 42;
17950     return y;
17951 }
17952
17953 int f_via_a(int x)
17954 {
17955     return f(x);
17956 }
17957 EOCP
17958 $cat > b.c <<'EOCP'
17959 extern int f(int x);
17960
17961 int f_via_b(int x)
17962 {
17963     return f(x);
17964 }
17965 EOCP
17966
17967 # Respect a hint (or previous) value for perl_static_inline, if there is one.
17968 case "$perl_static_inline" in
17969 '')     # Check the various possibilities, and break out on success.
17970         # For gcc, prefer __inline__, which will still permit
17971         # cflags.SH to add in -ansi.
17972         case "$gccversion" in
17973                 '') xxx="inline __inline__ __inline _inline";;
17974                 *)  xxx="__inline__ inline __inline _inline";;
17975         esac
17976         for inline in $xxx; do
17977                 set try -DINLINE=$inline a.c
17978                 if eval $compile && $run ./try; then
17979                         # Now make sure there is no external linkage of static
17980                         # functions
17981                         set try -DINLINE=$inline -DUSE_B a.c b.c
17982                         if eval $compile && $run ./try; then
17983                                 $echo "Your compiler supports static $inline, " >&4
17984                                 $echo "but it also creates an external definition," >&4
17985                                 $echo "so I won't use it." >&4
17986                                 val=$undef
17987                         else
17988                                 $echo "Your compiler supports static $inline." >&4
17989                                 val=$define
17990                                 perl_static_inline="static $inline";
17991                                 break;
17992                         fi
17993                 else
17994                         $echo "Your compiler does NOT support static $inline." >&4
17995                         val="$undef"
17996                 fi
17997         done
17998         ;;
17999 *inline*) # Some variant of inline exists.
18000         echo "Keeping your $hint value of $perl_static_inline."
18001         val=$define
18002         ;;
18003 static)  # No inline capabilities
18004         echo "Keeping your $hint value of $perl_static_inline."
18005         val=$undef
18006         ;;
18007 *)  # Unrecognized previous value -- blindly trust the supplied
18008         # value and hope it makes sense.  Use old value for
18009         # d_static_inline, if there is one.
18010         echo "Keeping your $hint value of $perl_static_inline."
18011         case "$d_static_inline" in
18012                 '') val=$define ;;
18013                 *)  val=$d_static_inline ;;
18014         esac
18015         ;;
18016 esac
18017 # Fallback to plain 'static' if nothing worked.
18018 case "$perl_static_inline" in
18019 '')
18020         perl_static_inline="static"
18021         val=$undef
18022         ;;
18023 esac
18024 set d_static_inline
18025 eval $setvar
18026 $rm -f a.[co] b.[co]
18027 $rm_try
18028
18029 : Check stream access
18030 $cat >&4 <<EOM
18031 Checking how to access stdio streams by file descriptor number...
18032 EOM
18033 case "$stdio_stream_array" in
18034 '')     $cat >try.c <<EOCP
18035 #include <stdio.h>
18036 int main() {
18037   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18038     printf("yes\n");
18039 }
18040 EOCP
18041         for s in _iob __iob __sF
18042         do
18043                 set try -DSTDIO_STREAM_ARRAY=$s
18044                 if eval $compile; then
18045                         case "`$run ./try`" in
18046                         yes)    stdio_stream_array=$s; break ;;
18047                         esac
18048                 fi
18049         done
18050         $rm_try
18051 esac
18052 case "$stdio_stream_array" in
18053 '')     $cat >&4 <<EOM
18054 I can't figure out how to access stdio streams by file descriptor number.
18055 EOM
18056         d_stdio_stream_array="$undef"
18057         ;;
18058 *)      $cat >&4 <<EOM
18059 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18060 EOM
18061         d_stdio_stream_array="$define"
18062         ;;
18063 esac
18064
18065 : see if strcoll exists
18066 set strcoll d_strcoll
18067 eval $inlibc
18068
18069 : check for structure copying
18070 echo " "
18071 echo "Checking to see if your C compiler can copy structs..." >&4
18072 $cat >try.c <<'EOCP'
18073 int main()
18074 {
18075         struct blurfl {
18076                 int dyick;
18077         } foo, bar;
18078
18079         foo = bar;
18080 }
18081 EOCP
18082 if $cc -c try.c >/dev/null 2>&1 ; then
18083         val="$define"
18084         echo "Yup, it can."
18085 else
18086         val="$undef"
18087         echo "Nope, it can't."
18088 fi
18089 set d_strctcpy
18090 eval $setvar
18091 $rm_try
18092
18093 : see if strerror and/or sys_errlist[] exist
18094 echo " "
18095 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18096     if set strerror val -f d_strerror; eval $csym; $val; then
18097                 echo 'strerror() found.' >&4
18098                 d_strerror="$define"
18099                 d_strerrm='strerror(e)'
18100                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18101                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
18102                         d_syserrlst="$define"
18103                 else
18104                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
18105                         d_syserrlst="$undef"
18106                 fi
18107     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18108                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18109                 echo 'strerror() found in string header.' >&4
18110                 d_strerror="$define"
18111                 d_strerrm='strerror(e)'
18112                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18113                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18114                                 d_syserrlst="$define"
18115                 else
18116                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
18117                         d_syserrlst="$undef"
18118                 fi
18119     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18120                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18121                 d_strerror="$undef"
18122                 d_syserrlst="$define"
18123                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18124     else
18125                 echo 'strerror() and sys_errlist[] NOT found.' >&4
18126                 d_strerror="$undef"
18127                 d_syserrlst="$undef"
18128                 d_strerrm='"unknown"'
18129     fi
18130 fi
18131
18132 : see if strerror_r exists
18133 set strerror_r d_strerror_r
18134 eval $inlibc
18135 case "$d_strerror_r" in
18136 "$define")
18137         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18138         case "$d_strerror_r_proto:$usethreads" in
18139         ":define")      d_strerror_r_proto=define
18140                 set d_strerror_r_proto strerror_r $hdrs
18141                 eval $hasproto ;;
18142         *)      ;;
18143         esac
18144         case "$d_strerror_r_proto" in
18145         define)
18146         case "$strerror_r_proto" in
18147         ''|0) try='int strerror_r(int, char*, size_t);'
18148         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18149         esac
18150         case "$strerror_r_proto" in
18151         ''|0) try='int strerror_r(int, char*, int);'
18152         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18153         esac
18154         case "$strerror_r_proto" in
18155         ''|0) try='char* strerror_r(int, char*, size_t);'
18156         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18157         esac
18158         case "$strerror_r_proto" in
18159         ''|0)   d_strerror_r=undef
18160                 strerror_r_proto=0
18161                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18162         * )     case "$strerror_r_proto" in
18163                 REENTRANT_PROTO*) ;;
18164                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18165                 esac
18166                 echo "Prototype: $try" ;;
18167         esac
18168         ;;
18169         *)      case "$usethreads" in
18170                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18171                 esac
18172                 d_strerror_r=undef
18173                 strerror_r_proto=0
18174                 ;;
18175         esac
18176         ;;
18177 *)      strerror_r_proto=0
18178         ;;
18179 esac
18180
18181 : see if strftime exists
18182 set strftime d_strftime
18183 eval $inlibc
18184
18185 : see if strlcat exists
18186 set strlcat d_strlcat
18187 eval $inlibc
18188
18189 : see if strlcpy exists
18190 set strlcpy d_strlcpy
18191 eval $inlibc
18192
18193 : see if strtod exists
18194 set strtod d_strtod
18195 eval $inlibc
18196
18197 : see if strtol exists
18198 set strtol d_strtol
18199 eval $inlibc
18200
18201 : see if strtold exists
18202 set strtold d_strtold
18203 eval $inlibc
18204
18205 : see if strtoll exists
18206 set strtoll d_strtoll
18207 eval $inlibc
18208
18209 case "$d_longlong-$d_strtoll" in
18210 "$define-$define")
18211         $cat <<EOM
18212 Checking whether your strtoll() works okay...
18213 EOM
18214         $cat >try.c <<'EOCP'
18215 #include <errno.h>
18216 #ifdef __hpux
18217 #define strtoll __strtoll
18218 #endif
18219 #ifdef __EMX__
18220 #define strtoll _strtoll
18221 #endif
18222 #include <stdio.h>
18223 extern long long int strtoll(char *s, char **, int);
18224 static int bad = 0;
18225 int check(char *s, long long ell, int een) {
18226         long long gll;
18227         errno = 0;
18228         gll = strtoll(s, 0, 10);
18229         if (!((gll == ell) && (errno == een)))
18230                 bad++;
18231 }
18232 int main() {
18233         check(" 1",                                      1LL, 0);
18234         check(" 0",                                      0LL, 0);
18235         check("-1",                                     -1LL, 0);
18236         check("-9223372036854775808", -9223372036854775808LL, 0);
18237         check("-9223372036854775808", -9223372036854775808LL, 0);
18238         check(" 9223372036854775807",  9223372036854775807LL, 0);
18239         check("-9223372036854775808", -9223372036854775808LL, 0);
18240         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18241         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18242         if (!bad)
18243                 printf("ok\n");
18244 }
18245 EOCP
18246         set try
18247         if eval $compile; then
18248                 yyy=`$run ./try`
18249                 case "$yyy" in
18250                 ok) echo "Your strtoll() seems to be working okay." ;;
18251                 *) cat <<EOM >&4
18252 Your strtoll() doesn't seem to be working okay.
18253 EOM
18254                    d_strtoll="$undef"
18255                    ;;
18256                 esac
18257         else
18258                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18259                 d_strtoll="$undef"
18260         fi
18261         ;;
18262 esac
18263
18264 : see if strtoq exists
18265 set strtoq d_strtoq
18266 eval $inlibc
18267
18268 : see if strtoul exists
18269 set strtoul d_strtoul
18270 eval $inlibc
18271
18272 case "$d_strtoul" in
18273 "$define")
18274         $cat <<EOM
18275 Checking whether your strtoul() works okay...
18276 EOM
18277         $cat >try.c <<'EOCP'
18278 #include <errno.h>
18279 #include <stdio.h>
18280 extern unsigned long int strtoul(char *s, char **, int);
18281 static int bad = 0;
18282 void check(char *s, unsigned long eul, int een) {
18283         unsigned long gul;
18284         errno = 0;
18285         gul = strtoul(s, 0, 10);
18286         if (!((gul == eul) && (errno == een)))
18287                 bad++;
18288 }
18289 int main() {
18290         check(" 1", 1L, 0);
18291         check(" 0", 0L, 0);
18292 EOCP
18293         case "$longsize" in
18294         8)
18295             $cat >>try.c <<'EOCP'
18296         check("18446744073709551615", 18446744073709551615UL, 0);
18297         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18298 #if 0 /* strtoul() for /^-/ strings is undefined. */
18299         check("-1", 18446744073709551615UL, 0);
18300         check("-18446744073709551614", 2, 0);
18301         check("-18446744073709551615", 1, 0);
18302         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18303         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18304 #endif
18305 EOCP
18306                 ;;
18307         4)
18308                     $cat >>try.c <<'EOCP'
18309         check("4294967295", 4294967295UL, 0);
18310         check("4294967296", 4294967295UL, ERANGE);
18311 #if 0 /* strtoul() for /^-/ strings is undefined. */
18312         check("-1", 4294967295UL, 0);
18313         check("-4294967294", 2, 0);
18314         check("-4294967295", 1, 0);
18315         check("-4294967296", 4294967295UL, ERANGE);
18316         check("-4294967297", 4294967295UL, ERANGE);
18317 #endif
18318 EOCP
18319                 ;;
18320         *)
18321 : Should we write these tests to be more portable by sprintf-ing
18322 : ~0 and then manipulating that char string as input for strtol?
18323                 ;;
18324         esac
18325         $cat >>try.c <<'EOCP'
18326         if (!bad)
18327                 printf("ok\n");
18328         return 0;
18329 }
18330 EOCP
18331         set try
18332         if eval $compile; then
18333                 case "`$run ./try`" in
18334                 ok) echo "Your strtoul() seems to be working okay." ;;
18335                 *) cat <<EOM >&4
18336 Your strtoul() doesn't seem to be working okay.
18337 EOM
18338                    d_strtoul="$undef"
18339                    ;;
18340                 esac
18341         else
18342                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18343                 d_strtoul="$undef"
18344         fi
18345         ;;
18346 esac
18347
18348 : see if strtoull exists
18349 set strtoull d_strtoull
18350 eval $inlibc
18351
18352 case "$d_longlong-$d_strtoull" in
18353 "$define-$define")
18354         $cat <<EOM
18355 Checking whether your strtoull() works okay...
18356 EOM
18357         $cat >try.c <<'EOCP'
18358 #include <errno.h>
18359 #ifdef __hpux
18360 #define strtoull __strtoull
18361 #endif
18362 #include <stdio.h>
18363 extern unsigned long long int strtoull(char *s, char **, int);
18364 static int bad = 0;
18365 int check(char *s, long long eull, int een) {
18366         long long gull;
18367         errno = 0;
18368         gull = strtoull(s, 0, 10);
18369         if (!((gull == eull) && (errno == een)))
18370                 bad++;
18371 }
18372 int main() {
18373         check(" 1",                                        1LL, 0);
18374         check(" 0",                                        0LL, 0);
18375         check("18446744073709551615",  18446744073709551615ULL, 0);
18376         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18377 #if 0 /* strtoull() for /^-/ strings is undefined. */
18378         check("-1",                    18446744073709551615ULL, 0);
18379         check("-18446744073709551614",                     2LL, 0);
18380         check("-18446744073709551615",                     1LL, 0);
18381         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18382         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18383 #endif
18384         if (!bad)
18385                 printf("ok\n");
18386 }
18387 EOCP
18388         set try
18389         if eval $compile; then
18390                 case "`$run ./try`" in
18391                 ok) echo "Your strtoull() seems to be working okay." ;;
18392                 *) cat <<EOM >&4
18393 Your strtoull() doesn't seem to be working okay.
18394 EOM
18395                    d_strtoull="$undef"
18396                    ;;
18397                 esac
18398         else
18399                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18400                 d_strtoull="$undef"
18401         fi
18402         ;;
18403 esac
18404
18405 : see if strtouq exists
18406 set strtouq d_strtouq
18407 eval $inlibc
18408
18409 case "$d_strtouq" in
18410 "$define")
18411         $cat <<EOM
18412 Checking whether your strtouq() works okay...
18413 EOM
18414         $cat >try.c <<'EOCP'
18415 #include <errno.h>
18416 #include <stdio.h>
18417 extern unsigned long long int strtouq(char *s, char **, int);
18418 static int bad = 0;
18419 void check(char *s, unsigned long long eull, int een) {
18420         unsigned long long gull;
18421         errno = 0;
18422         gull = strtouq(s, 0, 10);
18423         if (!((gull == eull) && (errno == een)))
18424                 bad++;
18425 }
18426 int main() {
18427         check(" 1",                                        1LL, 0);
18428         check(" 0",                                        0LL, 0);
18429         check("18446744073709551615",  18446744073709551615ULL, 0);
18430         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18431 #if 0 /* strtouq() for /^-/ strings is undefined. */
18432         check("-1",                    18446744073709551615ULL, 0);
18433         check("-18446744073709551614",                     2LL, 0);
18434         check("-18446744073709551615",                     1LL, 0);
18435         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18436         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18437 #endif
18438         if (!bad)
18439                 printf("ok\n");
18440         return 0;
18441 }
18442 EOCP
18443         set try
18444         if eval $compile; then
18445                 case "`$run ./try`" in
18446                 ok) echo "Your strtouq() seems to be working okay." ;;
18447                 *) cat <<EOM >&4
18448 Your strtouq() doesn't seem to be working okay.
18449 EOM
18450                    d_strtouq="$undef"
18451                    ;;
18452                 esac
18453         else
18454                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18455                 d_strtouq="$undef"
18456         fi
18457         ;;
18458 esac
18459
18460 : see if strxfrm exists
18461 set strxfrm d_strxfrm
18462 eval $inlibc
18463
18464 : see if symlink exists
18465 set symlink d_symlink
18466 eval $inlibc
18467
18468 : see if syscall exists
18469 set syscall d_syscall
18470 eval $inlibc
18471
18472 : see if prototype for syscall is available
18473 echo " "
18474 set d_syscallproto syscall $i_unistd unistd.h
18475 eval $hasproto
18476
18477 : see if sysconf exists
18478 set sysconf d_sysconf
18479 eval $inlibc
18480
18481 : see if system exists
18482 set system d_system
18483 eval $inlibc
18484
18485 : see if tcgetpgrp exists
18486 set tcgetpgrp d_tcgetpgrp
18487 eval $inlibc
18488
18489 : see if tcsetpgrp exists
18490 set tcsetpgrp d_tcsetpgrp
18491 eval $inlibc
18492
18493 : see if prototype for telldir is available
18494 echo " "
18495 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18496 eval $hasproto
18497
18498 : see if time exists
18499 echo " "
18500 if test "X$d_time" = X -o X"$timetype" = X; then
18501     if set time val -f d_time; eval $csym; $val; then
18502                 echo 'time() found.' >&4
18503                 val="$define"
18504                 rp="What is the type returned by time() on this system?"
18505                 set time_t timetype long stdio.h sys/types.h
18506                 eval $typedef_ask
18507     else
18508                 echo 'time() not found, hope that will do.' >&4
18509                 val="$undef"
18510                 timetype='int';
18511     fi
18512     set d_time
18513     eval $setvar
18514 fi
18515
18516 : see if timegm exists
18517 set timegm d_timegm
18518 eval $inlibc
18519
18520 : see if this is a sys/times.h system
18521 set sys/times.h i_systimes
18522 eval $inhdr
18523
18524 : see if times exists
18525 echo " "
18526 if set times val -f d_times; eval $csym; $val; then
18527         echo 'times() found.' >&4
18528         d_times="$define"
18529         inc=''
18530         case "$i_systimes" in
18531         "$define") inc='sys/times.h';;
18532         esac
18533         rp="What is the type returned by times() on this system?"
18534         set clock_t clocktype long stdio.h sys/types.h $inc
18535         eval $typedef_ask
18536 else
18537         echo 'times() NOT found, hope that will do.' >&4
18538         d_times="$undef"
18539         clocktype='int'
18540 fi
18541
18542 : see if tmpnam_r exists
18543 set tmpnam_r d_tmpnam_r
18544 eval $inlibc
18545 case "$d_tmpnam_r" in
18546 "$define")
18547         hdrs="$i_systypes sys/types.h define stdio.h "
18548         case "$d_tmpnam_r_proto:$usethreads" in
18549         ":define")      d_tmpnam_r_proto=define
18550                 set d_tmpnam_r_proto tmpnam_r $hdrs
18551                 eval $hasproto ;;
18552         *)      ;;
18553         esac
18554         case "$d_tmpnam_r_proto" in
18555         define)
18556         case "$tmpnam_r_proto" in
18557         ''|0) try='char* tmpnam_r(char*);'
18558         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18559         esac
18560         case "$tmpnam_r_proto" in
18561         ''|0)   d_tmpnam_r=undef
18562                 tmpnam_r_proto=0
18563                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18564         * )     case "$tmpnam_r_proto" in
18565                 REENTRANT_PROTO*) ;;
18566                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18567                 esac
18568                 echo "Prototype: $try" ;;
18569         esac
18570         ;;
18571         *)      case "$usethreads" in
18572                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18573                 esac
18574                 d_tmpnam_r=undef
18575                 tmpnam_r_proto=0
18576                 ;;
18577         esac
18578         ;;
18579 *)      tmpnam_r_proto=0
18580         ;;
18581 esac
18582
18583 : see if truncate exists
18584 set truncate d_truncate
18585 eval $inlibc
18586
18587 : see if ttyname_r exists
18588 set ttyname_r d_ttyname_r
18589 eval $inlibc
18590 case "$d_ttyname_r" in
18591 "$define")
18592         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18593         case "$d_ttyname_r_proto:$usethreads" in
18594         ":define")      d_ttyname_r_proto=define
18595                 set d_ttyname_r_proto ttyname_r $hdrs
18596                 eval $hasproto ;;
18597         *)      ;;
18598         esac
18599         case "$d_ttyname_r_proto" in
18600         define)
18601         case "$ttyname_r_proto" in
18602         ''|0) try='int ttyname_r(int, char*, size_t);'
18603         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18604         esac
18605         case "$ttyname_r_proto" in
18606         ''|0) try='int ttyname_r(int, char*, int);'
18607         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18608         esac
18609         case "$ttyname_r_proto" in
18610         ''|0) try='char* ttyname_r(int, char*, int);'
18611         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18612         esac
18613         case "$ttyname_r_proto" in
18614         ''|0)   d_ttyname_r=undef
18615                 ttyname_r_proto=0
18616                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18617         * )     case "$ttyname_r_proto" in
18618                 REENTRANT_PROTO*) ;;
18619                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18620                 esac
18621                 echo "Prototype: $try" ;;
18622         esac
18623         ;;
18624         *)      case "$usethreads" in
18625                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18626                 esac
18627                 d_ttyname_r=undef
18628                 ttyname_r_proto=0
18629                 ;;
18630         esac
18631         ;;
18632 *)      ttyname_r_proto=0
18633         ;;
18634 esac
18635
18636 : see if tzname[] exists
18637 echo " "
18638 if set tzname val -a d_tzname; eval $csym; $val; then
18639         val="$define"
18640         echo 'tzname[] found.' >&4
18641 else
18642         val="$undef"
18643         echo 'tzname[] NOT found.' >&4
18644 fi
18645 set d_tzname
18646 eval $setvar
18647
18648 : Check if is a multiplatform env
18649 case "$osname" in
18650 next|darwin) multiarch="$define" ;;
18651 esac
18652 case "$multiarch" in
18653 ''|[nN]*) multiarch="$undef" ;;
18654 esac
18655
18656 : check for ordering of bytes in a UV
18657 echo " "
18658 case "$usecrosscompile$multiarch" in
18659 *$define*)
18660         $cat <<EOM
18661 You seem to be either cross-compiling or doing a multiarchitecture build,
18662 skipping the byteorder check.
18663
18664 EOM
18665         byteorder='ffff'
18666         ;;
18667 *)
18668         case "$byteorder" in
18669         '')
18670                 $cat <<'EOM'
18671 In the following, larger digits indicate more significance.  A big-endian
18672 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18673 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18674 machines may have weird orders like 3412.  A Cray will report 87654321,
18675 an Alpha will report 12345678. If the test program works the default is
18676 probably right.
18677 I'm now running the test program...
18678 EOM
18679                 $cat >try.c <<EOCP
18680 #include <stdio.h>
18681 #$i_stdlib I_STDLIB
18682 #ifdef I_STDLIB
18683 #include <stdlib.h>
18684 #endif
18685 #include <sys/types.h>
18686 typedef $uvtype UV;
18687 int main()
18688 {
18689         int i;
18690         union {
18691                 UV l;
18692                 char c[$uvsize];
18693         } u;
18694
18695         if ($uvsize > 4)
18696                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18697         else
18698                 u.l = (UV)0x04030201;
18699         for (i = 0; i < $uvsize; i++)
18700                 printf("%c", u.c[i]+'0');
18701         printf("\n");
18702         exit(0);
18703 }
18704 EOCP
18705                 xxx_prompt=y
18706                 set try
18707                 if eval $compile && $run ./try > /dev/null; then
18708                         dflt=`$run ./try`
18709                         case "$dflt" in
18710                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18711                                 echo "(The test program ran ok.)"
18712                                 echo "byteorder=$dflt"
18713                                 xxx_prompt=n
18714                         ;;
18715                         ????|????????) echo "(The test program ran ok.)" ;;
18716                         *) echo "(The test program didn't run right for some reason.)" ;;
18717                         esac
18718                 else
18719                         dflt='4321'
18720                         cat <<'EOM'
18721 (I can't seem to compile the test program.  Guessing big-endian...)
18722 EOM
18723                 fi
18724                 case "$xxx_prompt" in
18725                 y)
18726                         rp="What is the order of bytes in $uvtype?"
18727                         . ./myread
18728                         byteorder="$ans"
18729                         ;;
18730                 *)      byteorder=$dflt
18731                         ;;
18732                 esac
18733                 ;;
18734         esac
18735         $rm_try
18736         ;;
18737 esac
18738
18739 : Checking 32bit alignedness
18740 $cat <<EOM
18741
18742 Checking to see whether you can access character data unalignedly...
18743 EOM
18744 case "$d_u32align" in
18745 '')   $cat >try.c <<EOCP
18746 #include <stdio.h>
18747 #$i_stdlib I_STDLIB
18748 #ifdef I_STDLIB
18749 #include <stdlib.h>
18750 #endif
18751 #define U32 $u32type
18752 #define BYTEORDER 0x$byteorder
18753 #define U8 $u8type
18754 #include <signal.h>
18755 #ifdef SIGBUS
18756 $signal_t bletch(int s) { exit(4); }
18757 #endif
18758 int main() {
18759 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18760     volatile U8 buf[8];
18761     volatile U32 *up;
18762     int i;
18763
18764     if (sizeof(U32) != 4) {
18765         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18766         exit(1);
18767     }
18768
18769     fflush(stdout);
18770
18771 #ifdef SIGBUS
18772     signal(SIGBUS, bletch);
18773 #endif
18774
18775     buf[0] = 0;
18776     buf[1] = 0;
18777     buf[2] = 0;
18778     buf[3] = 1;
18779     buf[4] = 0;
18780     buf[5] = 0;
18781     buf[6] = 0;
18782     buf[7] = 1;
18783
18784     for (i = 0; i < 4; i++) {
18785         up = (U32*)(buf + i);
18786         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18787                (*up == 1 << (8*(3-i)))  /* little-endian */
18788               )
18789            )
18790         {
18791             printf("read failed (%x)\n", *up);
18792             exit(2);
18793         }
18794     }
18795
18796     /* write test */
18797     for (i = 0; i < 4; i++) {
18798         up = (U32*)(buf + i);
18799         *up = 0xBeef;
18800         if (*up != 0xBeef) {
18801             printf("write failed (%x)\n", *up);
18802             exit(3);
18803         }
18804     }
18805
18806     exit(0);
18807 #else
18808     printf("1\n");
18809     exit(1);
18810 #endif
18811     return 0;
18812 }
18813 EOCP
18814 set try
18815 if eval $compile_ok; then
18816         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18817         $run ./try 2>&1 >/dev/null
18818         case "$?" in
18819         0)      cat >&4 <<EOM
18820 You can access character data pretty unalignedly.
18821 EOM
18822                 d_u32align="$undef"
18823                 ;;
18824         *)      cat >&4 <<EOM
18825 It seems that you must access character data in an aligned manner.
18826 EOM
18827                 d_u32align="$define"
18828                 ;;
18829         esac
18830 else
18831         rp='Can you access character data at unaligned addresses?'
18832         dflt='n'
18833         . ./myread
18834         case "$ans" in
18835         [yY]*)  d_u32align="$undef"  ;;
18836         *)      d_u32align="$define" ;;
18837         esac
18838 fi
18839 $rm_try
18840 ;;
18841 esac
18842
18843 : see if ualarm exists
18844 set ualarm d_ualarm
18845 eval $inlibc
18846
18847 : see if umask exists
18848 set umask d_umask
18849 eval $inlibc
18850
18851 : see if unordered exists
18852 set unordered d_unordered
18853 eval $inlibc
18854
18855 : see if unsetenv exists
18856 set unsetenv d_unsetenv
18857 eval $inlibc
18858
18859 : see if usleep exists
18860 set usleep d_usleep
18861 eval $inlibc
18862
18863 : see if prototype for usleep is available
18864 echo " "
18865 set d_usleepproto usleep $i_unistd unistd.h
18866 eval $hasproto
18867
18868 : see if ustat exists
18869 set ustat d_ustat
18870 eval $inlibc
18871
18872 : see if closedir exists
18873 set closedir d_closedir
18874 eval $inlibc
18875
18876 case "$d_closedir" in
18877 "$define")
18878         echo " "
18879         echo "Checking whether closedir() returns a status..." >&4
18880         cat > try.c <<EOM
18881 #$i_dirent I_DIRENT             /**/
18882 #$i_sysdir I_SYS_DIR            /**/
18883 #$i_sysndir I_SYS_NDIR          /**/
18884 #$i_systypes I_SYS_TYPES        /**/
18885
18886 #if defined(I_SYS_TYPES)
18887 #include <sys/types.h>
18888 #endif
18889 #if defined(I_DIRENT)
18890 #include <dirent.h>
18891 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18892 #include <sys/dir.h>
18893 #endif
18894 #else
18895 #ifdef I_SYS_NDIR
18896 #include <sys/ndir.h>
18897 #else
18898 #ifdef I_SYS_DIR
18899 #ifdef hp9000s500
18900 #include <ndir.h>       /* may be wrong in the future */
18901 #else
18902 #include <sys/dir.h>
18903 #endif
18904 #endif
18905 #endif
18906 #endif
18907 int main() { return closedir(opendir(".")); }
18908 EOM
18909         set try
18910         if eval $compile_ok; then
18911                 if $run ./try > /dev/null 2>&1 ; then
18912                         echo "Yes, it does."
18913                         val="$undef"
18914                 else
18915                         echo "No, it doesn't."
18916                         val="$define"
18917                 fi
18918         else
18919                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18920                 val="$define"
18921         fi
18922         ;;
18923 *)
18924         val="$undef";
18925         ;;
18926 esac
18927 set d_void_closedir
18928 eval $setvar
18929 $rm_try
18930
18931 : see if there is a wait4
18932 set wait4 d_wait4
18933 eval $inlibc
18934
18935 : see if waitpid exists
18936 set waitpid d_waitpid
18937 eval $inlibc
18938
18939 : see if wcstombs exists
18940 set wcstombs d_wcstombs
18941 eval $inlibc
18942
18943 : see if wctomb exists
18944 set wctomb d_wctomb
18945 eval $inlibc
18946
18947 : see if writev exists
18948 set writev d_writev
18949 eval $inlibc
18950
18951 : preserve RCS keywords in files with variable substitution, grrr
18952 Date='$Date'
18953 Id='$Id'
18954 Log='$Log'
18955 RCSfile='$RCSfile'
18956 Revision='$Revision'
18957
18958 : check for alignment requirements
18959 echo " "
18960 case "$usecrosscompile" in
18961 *$define*)
18962         $cat <<EOM
18963 You seem to be cross-compiling.  Skipping the memory alignment check.
18964
18965 EOM
18966         case "$alignbytes" in
18967         '') alignbytes=8 ;;
18968         esac
18969         ;;
18970 *)
18971         case "$alignbytes" in
18972         '') echo "Checking alignment constraints..." >&4
18973                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18974                         $cat >try.c <<'EOCP'
18975 typedef long double NV;
18976 EOCP
18977                 else
18978                         $cat >try.c <<'EOCP'
18979 typedef double NV;
18980 EOCP
18981                 fi
18982                 $cat >>try.c <<'EOCP'
18983 #include <stdio.h>
18984 struct foobar {
18985         char foo;
18986         NV bar;
18987 } try_algn;
18988 int main()
18989 {
18990     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18991     return(0);
18992 }
18993 EOCP
18994                 set try
18995                 if eval $compile_ok; then
18996                         dflt=`$run ./try`
18997                 else
18998                         dflt='8'
18999                         echo "(I can't seem to compile the test program...)"
19000                 fi
19001                 case "$multiarch" in
19002                 *$define*)
19003                         : The usual safe value is 8, but Darwin with -Duselongdouble
19004                         : needs 16.  Hence, we will take 8 as a minimum, but allow
19005                         : Configure to pick a larger value if needed.
19006                         if $test "$dflt" -lt 8; then
19007                             dflt='8'
19008                                 echo "Setting alignment to 8 for multiarch support.">&4
19009                         fi
19010                         ;;
19011                 esac
19012                 ;;
19013         *) dflt="$alignbytes"
19014                 ;;
19015         esac
19016         rp="Doubles must be aligned on a how-many-byte boundary?"
19017         . ./myread
19018         alignbytes="$ans"
19019         $rm_try
19020         ;;
19021 esac
19022
19023
19024 : set the base revision
19025 baserev=5.0
19026
19027 : Determine if this is an EBCDIC system
19028 echo " "
19029 echo "Determining whether or not we are on an EBCDIC system..." >&4
19030 $cat >try.c <<'EOM'
19031 int main()
19032 {
19033   if ('M'==0xd4) return 0;
19034   return 1;
19035 }
19036 EOM
19037
19038 case "$BOOTSTRAP_CHARSET" in
19039     Y|y|define) bootstrap_charset=$define       ;;
19040     *)          bootstrap_charset=$undef        ;;
19041 esac
19042
19043 val=$undef
19044 set try
19045 if eval $compile_ok; then
19046         if $run ./try; then
19047                 echo "You seem to speak EBCDIC." >&4
19048                 val="$define"
19049         else
19050                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19051         fi
19052 else
19053         echo "I'm unable to compile the test program." >&4
19054         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19055 fi
19056 $rm_try
19057 set ebcdic
19058 eval $setvar
19059
19060 : length of character in bytes. Is always 1, otherwise it is not C
19061 : This used to be a test using sizeof
19062 charsize=1
19063
19064 : Check for the number of bits in a character
19065 case "$charbits" in
19066 '')     echo "Checking how long a character is (in bits)..." >&4
19067         $cat >try.c <<EOCP
19068 #include <stdio.h>
19069 int main ()
19070 {
19071     int n;
19072     unsigned char c;
19073     for (c = 1, n = 0; c; c <<= 1, n++) ;
19074     printf ("%d\n", n);
19075     return (0);
19076     }
19077 EOCP
19078         set try
19079         if eval $compile_ok; then
19080                 dflt=`$run ./try`
19081         else
19082                 dflt='8'
19083                 echo "(I can't seem to compile the test program.  Guessing...)"
19084         fi
19085         ;;
19086 *)
19087         dflt="$charbits"
19088         ;;
19089 esac
19090 rp="What is the length of a character (in bits)?"
19091 . ./myread
19092 charbits="$ans"
19093 $rm_try
19094 case "$charbits" in
19095 8)      ;;
19096 *)      cat >&4 << EOM
19097 Your system has an unsigned character size of $charbits bits, which
19098 is rather unusual (normally it is 8 bits).  Perl likely will not work
19099 correctly on your system, with subtle bugs in various places.
19100 EOM
19101         rp='Do you really want to continue?'
19102         dflt='n'
19103         . ./myread
19104         case "$ans" in
19105                 [yY])   echo >&4 "Okay, continuing."    ;;
19106                 *)      exit 1                          ;;
19107         esac
19108 esac
19109
19110 : how do we concatenate cpp tokens here?
19111 echo " "
19112 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19113 $cat >cpp_stuff.c <<'EOCP'
19114 #define RCAT(a,b)a/**/b
19115 #define ACAT(a,b)a ## b
19116 RCAT(Rei,ser)
19117 ACAT(Cir,cus)
19118 EOCP
19119 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19120 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19121         echo "Oh!  Smells like ANSI's been here." >&4
19122         echo "We can catify or stringify, separately or together!"
19123         cpp_stuff=42
19124 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19125         echo "Ah, yes!  The good old days!" >&4
19126         echo "However, in the good old days we don't know how to stringify and"
19127         echo "catify at the same time."
19128         cpp_stuff=1
19129 else
19130         $cat >&4 <<EOM
19131 Hmm, I don't seem to be able to concatenate tokens with your cpp.
19132 You're going to have to edit the values of CAT[2-5] in config.h...
19133 EOM
19134         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19135 fi
19136 $rm -f cpp_stuff.*
19137
19138 : see if this is a db.h system
19139 set db.h i_db
19140 eval $inhdr
19141
19142 case "$i_db" in
19143 $define)
19144         : Check db version.
19145         echo " "
19146         echo "Checking Berkeley DB version ..." >&4
19147         $cat >try.c <<EOCP
19148 #$d_const HASCONST
19149 #ifndef HASCONST
19150 #define const
19151 #endif
19152 #include <sys/types.h>
19153 #include <stdio.h>
19154 #$i_stdlib I_STDLIB
19155 #ifdef I_STDLIB
19156 #include <stdlib.h>
19157 #endif
19158 #include <db.h>
19159 int main(int argc, char *argv[])
19160 {
19161 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19162     int Major, Minor, Patch ;
19163     unsigned long Version ;
19164     (void)db_version(&Major, &Minor, &Patch) ;
19165     if (argc == 2) {
19166         printf("%d %d %d %d %d %d\n",
19167                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19168                Major, Minor, Patch);
19169         exit(0);
19170     }
19171     printf("You have Berkeley DB Version 2 or greater.\n");
19172
19173     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19174                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19175     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19176                 Major, Minor, Patch) ;
19177
19178     /* check that db.h & libdb are compatible */
19179     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19180         printf("db.h and libdb are incompatible.\n") ;
19181         exit(3);
19182     }
19183
19184     printf("db.h and libdb are compatible.\n") ;
19185
19186     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19187                 + DB_VERSION_PATCH ;
19188
19189     /* needs to be >= 2.3.4 */
19190     if (Version < 2003004) {
19191     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19192         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19193         exit(2);
19194     }
19195
19196     exit(0);
19197 #else
19198 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19199     if (argc == 2) {
19200         printf("1 0 0\n");
19201         exit(0);
19202     }
19203     printf("You have Berkeley DB Version 1.\n");
19204     exit(0);    /* DB version < 2: the coast is clear. */
19205 #else
19206     exit(1);    /* <db.h> not Berkeley DB? */
19207 #endif
19208 #endif
19209 }
19210 EOCP
19211         set try
19212         if eval $compile_ok && $run ./try; then
19213                 echo 'Looks OK.' >&4
19214                 set `$run ./try 1`
19215                 db_version_major=$1
19216                 db_version_minor=$2
19217                 db_version_patch=$3
19218         else
19219                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19220                 i_db=$undef
19221                 case " $libs " in
19222                 *"-ldb "*)
19223                         : Remove db from list of libraries to use
19224                         echo "Removing unusable -ldb from library list" >&4
19225                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19226                         shift
19227                         libs="$*"
19228                         echo "libs = $libs" >&4
19229                         ;;
19230                 esac
19231         fi
19232         $rm_try
19233         ;;
19234 esac
19235
19236 case "$i_db" in
19237 define)
19238         : Check the return type needed for hash
19239         echo " "
19240         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19241         $cat >try.c <<EOCP
19242 #$d_const HASCONST
19243 #ifndef HASCONST
19244 #define const
19245 #endif
19246 #include <sys/types.h>
19247 #include <db.h>
19248
19249 #ifndef DB_VERSION_MAJOR
19250 u_int32_t hash_cb (ptr, size)
19251 const void *ptr;
19252 size_t size;
19253 {
19254 }
19255 HASHINFO info;
19256 int main()
19257 {
19258         info.hash = hash_cb;
19259 }
19260 #endif
19261 EOCP
19262         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19263                 if $contains warning try.out >>/dev/null 2>&1 ; then
19264                         db_hashtype='int'
19265                 else
19266                         db_hashtype='u_int32_t'
19267                 fi
19268         else
19269                 : XXX Maybe we should just give up here.
19270                 db_hashtype=u_int32_t
19271                 $cat try.out >&4
19272                 echo "Help:  I can't seem to compile the db test program." >&4
19273                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19274         fi
19275         $rm_try
19276         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19277         ;;
19278 *)      db_hashtype=u_int32_t
19279         ;;
19280 esac
19281 case "$i_db" in
19282 define)
19283         : Check the return type needed for prefix
19284         echo " "
19285         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19286         cat >try.c <<EOCP
19287 #$d_const HASCONST
19288 #ifndef HASCONST
19289 #define const
19290 #endif
19291 #include <sys/types.h>
19292 #include <db.h>
19293
19294 #ifndef DB_VERSION_MAJOR
19295 size_t prefix_cb (key1, key2)
19296 const DBT *key1;
19297 const DBT *key2;
19298 {
19299 }
19300 BTREEINFO info;
19301 int main()
19302 {
19303         info.prefix = prefix_cb;
19304 }
19305 #endif
19306 EOCP
19307         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19308                 if $contains warning try.out >>/dev/null 2>&1 ; then
19309                         db_prefixtype='int'
19310                 else
19311                         db_prefixtype='size_t'
19312                 fi
19313         else
19314                 db_prefixtype='size_t'
19315                 : XXX Maybe we should just give up here.
19316                 $cat try.out >&4
19317                 echo "Help:  I can't seem to compile the db test program." >&4
19318                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19319         fi
19320         $rm_try
19321         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19322         ;;
19323 *)      db_prefixtype='size_t'
19324         ;;
19325 esac
19326
19327 : How can we generate normalized random numbers ?
19328 echo " "
19329 echo "Using our internal random number implementation..." >&4
19330
19331 case "$ccflags" in
19332 *-Dmy_rand=*|*-Dmy_srand=*)
19333         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19334         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19335         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19336         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19337         ;;
19338 esac
19339
19340 randfunc=Perl_drand48
19341 drand01="Perl_drand48()"
19342 seedfunc="Perl_drand48_init"
19343 randbits=48
19344 randseedtype=U32
19345
19346 : Check how to flush
19347 echo " "
19348 $cat >&4 <<EOM
19349 Checking how to flush all pending stdio output...
19350 EOM
19351 # I only know how to find the first 32 possibly open files on SunOS.
19352 # See also hints/sunos_4_1.sh and util.c  --AD
19353 case "$osname" in
19354 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19355 esac
19356 $cat >>try.c <<EOCP
19357 #include <stdio.h>
19358 #$i_stdlib I_STDLIB
19359 #ifdef I_STDLIB
19360 #include <stdlib.h>
19361 #endif
19362 #$i_unistd I_UNISTD
19363 #ifdef I_UNISTD
19364 # include <unistd.h>
19365 #endif
19366 #$d_sysconf HAS_SYSCONF
19367 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19368 #ifdef HAS_STDIO_STREAM_ARRAY
19369 # define STDIO_STREAM_ARRAY $stdio_stream_array
19370 #endif
19371 int main() {
19372   FILE* p;
19373   unlink("try.out");
19374   p = fopen("try.out", "w");
19375 #ifdef TRY_FPUTC
19376   fputc('x', p);
19377 #else
19378 # ifdef TRY_FPRINTF
19379   fprintf(p, "x");
19380 # endif
19381 #endif
19382 #ifdef TRY_FFLUSH_NULL
19383   fflush(NULL);
19384 #endif
19385 #ifdef TRY_FFLUSH_ALL
19386   {
19387     long open_max = -1;
19388 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19389     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19390 # else
19391 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19392     open_max = sysconf(_SC_OPEN_MAX);
19393 #  else
19394 #   ifdef FOPEN_MAX
19395     open_max = FOPEN_MAX;
19396 #   else
19397 #    ifdef OPEN_MAX
19398     open_max = OPEN_MAX;
19399 #    else
19400 #     ifdef _NFILE
19401     open_max = _NFILE;
19402 #     endif
19403 #    endif
19404 #   endif
19405 #  endif
19406 # endif
19407 # ifdef HAS_STDIO_STREAM_ARRAY
19408     if (open_max > 0) {
19409       long i;
19410       for (i = 0; i < open_max; i++)
19411             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19412                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19413                 STDIO_STREAM_ARRAY[i]._flag)
19414                 fflush(&STDIO_STREAM_ARRAY[i]);
19415     }
19416   }
19417 # endif
19418 #endif
19419   _exit(42);
19420 }
19421 EOCP
19422 : first we have to find out how _not_ to flush
19423 $to try.c
19424 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19425     output=''
19426     set try -DTRY_FPUTC
19427     if eval $compile; then
19428             $run ./try 2>/dev/null
19429             code="$?"
19430             $from try.out
19431             if $test ! -s try.out -a "X$code" = X42; then
19432                 output=-DTRY_FPUTC
19433             fi
19434     fi
19435     case "$output" in
19436     '')
19437             set try -DTRY_FPRINTF
19438             if eval $compile; then
19439                     $run ./try 2>/dev/null
19440                     code="$?"
19441                     $from try.out
19442                     if $test ! -s try.out -a "X$code" = X42; then
19443                         output=-DTRY_FPRINTF
19444                     fi
19445             fi
19446         ;;
19447     esac
19448 fi
19449 : check for fflush NULL behavior
19450 case "$fflushNULL" in
19451 '')     set try -DTRY_FFLUSH_NULL $output
19452         if eval $compile; then
19453                 $run ./try 2>/dev/null
19454                 code="$?"
19455                 $from try.out
19456                 if $test -s try.out -a "X$code" = X42; then
19457                         fflushNULL="`$cat try.out`"
19458                 else
19459                         if $test "X$code" != X42; then
19460                                 $cat >&4 <<EOM
19461 (If this test failed, don't worry, we'll try another method shortly.)
19462 EOM
19463                         fi
19464                 fi
19465         fi
19466         $rm -f core try.core core.try.*
19467         case "$fflushNULL" in
19468         x)      $cat >&4 <<EOM
19469 Your fflush(NULL) works okay for output streams.
19470 Let's see if it clobbers input pipes...
19471 EOM
19472 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19473 # bug that improperly flushes the input end of pipes.  So we avoid the
19474 # autoflush on fork/system/exec support for now. :-(
19475 $cat >tryp.c <<EOCP
19476 #include <stdio.h>
19477 int
19478 main(int argc, char **argv)
19479 {
19480     char buf[1024];
19481     int i;
19482     char *bp = buf;
19483     while (1) {
19484         while ((i = getc(stdin)) != -1
19485                && (*bp++ = i) != '\n'
19486                && bp < &buf[1024])
19487         /* DO NOTHING */ ;
19488         *bp = '\0';
19489         fprintf(stdout, "%s", buf);
19490         fflush(NULL);
19491         if (i == -1)
19492             return 0;
19493         bp = buf;
19494     }
19495 }
19496 EOCP
19497                 fflushNULL="$define"
19498                 set tryp
19499                 if eval $compile; then
19500                     $rm -f tryp.out
19501                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19502                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19503                        $cat >&4 <<EOM
19504 fflush(NULL) seems to behave okay with input streams.
19505 EOM
19506                         fflushNULL="$define"
19507                     else
19508                         $cat >&4 <<EOM
19509 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19510 EOM
19511                         fflushNULL="$undef"
19512                     fi
19513                 fi
19514                 $rm -f core tryp.c tryp.core core.tryp.*
19515                 ;;
19516         '')     $cat >&4 <<EOM
19517 Your fflush(NULL) isn't working (contrary to ANSI C).
19518 EOM
19519                 fflushNULL="$undef"
19520                 ;;
19521         *)      $cat >&4 <<EOM
19522 Cannot figure out whether your fflush(NULL) works or not.
19523 I'm assuming it doesn't (contrary to ANSI C).
19524 EOM
19525                 fflushNULL="$undef"
19526                 ;;
19527         esac
19528         ;;
19529 $define|true|[yY]*)
19530         fflushNULL="$define"
19531         ;;
19532 *)
19533         fflushNULL="$undef"
19534         ;;
19535 esac
19536 : check explicit looping only if NULL did not work, and if the pipe
19537 : bug does not show up on an explicit flush too
19538 case "$fflushNULL" in
19539 "$undef")
19540         $cat >tryp.c <<EOCP
19541 #include <stdio.h>
19542 int
19543 main(int argc, char **argv)
19544 {
19545     char buf[1024];
19546     int i;
19547     char *bp = buf;
19548     while (1) {
19549         while ((i = getc(stdin)) != -1
19550                && (*bp++ = i) != '\n'
19551                && bp < &buf[1024])
19552         /* DO NOTHING */ ;
19553         *bp = '\0';
19554         fprintf(stdout, "%s", buf);
19555         fflush(stdin);
19556         if (i == -1)
19557             return 0;
19558         bp = buf;
19559     }
19560 }
19561 EOCP
19562         set tryp
19563         if eval $compile; then
19564             $rm -f tryp.out
19565             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19566             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19567                $cat >&4 <<EOM
19568 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19569 EOM
19570                 : now check for fflushall behaviour
19571                 case "$fflushall" in
19572                 '')     set try -DTRY_FFLUSH_ALL $output
19573                         if eval $compile; then
19574                                 $cat >&4 <<EOM
19575 (Now testing the other method--but note that this also may fail.)
19576 EOM
19577                                 $run ./try 2>/dev/null
19578                                 code=$?
19579                                 $from try.out
19580                                 if $test -s try.out -a "X$code" = X42; then
19581                                         fflushall="`$cat try.out`"
19582                                 fi
19583                         fi
19584                         $rm_try
19585                         case "$fflushall" in
19586                         x)      $cat >&4 <<EOM
19587 Whew. Flushing explicitly all the stdio streams works.
19588 EOM
19589                                 fflushall="$define"
19590                                 ;;
19591                         '')     $cat >&4 <<EOM
19592 Sigh. Flushing explicitly all the stdio streams doesn't work.
19593 EOM
19594                                 fflushall="$undef"
19595                                 ;;
19596                         *)      $cat >&4 <<EOM
19597 Cannot figure out whether flushing stdio streams explicitly works or not.
19598 I'm assuming it doesn't.
19599 EOM
19600                                 fflushall="$undef"
19601                                 ;;
19602                         esac
19603                         ;;
19604                 "$define"|true|[yY]*)
19605                         fflushall="$define"
19606                         ;;
19607                 *)
19608                         fflushall="$undef"
19609                         ;;
19610                 esac
19611             else
19612                 $cat >&4 <<EOM
19613 All is futile.  Even fflush(stdin) clobbers input pipes!
19614 EOM
19615                 fflushall="$undef"
19616             fi
19617         else
19618             fflushall="$undef"
19619         fi
19620         $rm -f core tryp.c tryp.core core.tryp.*
19621         ;;
19622 *)      fflushall="$undef"
19623         ;;
19624 esac
19625
19626 case "$fflushNULL$fflushall" in
19627 undefundef)
19628         $cat <<EOM
19629 OK, I give up.  I cannot figure out how to flush pending stdio output.
19630 We won't be flushing handles at all before fork/exec/popen.
19631 EOM
19632         ;;
19633 esac
19634 $rm_try tryp
19635
19636 : Store the full pathname to the ar program for use in the C program
19637 : Respect a hint or command line value for full_ar.
19638 case "$full_ar" in
19639 '') full_ar=$ar ;;
19640 esac
19641
19642 : Store the full pathname to the sed program for use in the C program
19643 full_sed=$sed
19644
19645 : see what type gids are declared as in the kernel
19646 echo " "
19647 echo "Looking for the type for group ids returned by getgid()."
19648 set gid_t gidtype xxx stdio.h sys/types.h
19649 eval $typedef
19650 case "$gidtype" in
19651 xxx)
19652         xxx=`./findhdr sys/user.h`
19653         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19654         case $1 in
19655         unsigned) dflt="$1 $2" ;;
19656         *) dflt="$1" ;;
19657         esac
19658         ;;
19659 *) dflt="$gidtype";;
19660 esac
19661 case "$gidtype" in
19662 gid_t) echo "gid_t found." ;;
19663 *)      rp="What is the type for group ids returned by getgid()?"
19664         . ./myread
19665         gidtype="$ans"
19666         ;;
19667 esac
19668
19669 : Check the size of GID
19670 echo " "
19671 case "$gidtype" in
19672 *_t) zzz="$gidtype"     ;;
19673 *)   zzz="gid"          ;;
19674 esac
19675 echo "Checking the size of $zzz..." >&4
19676 cat > try.c <<EOCP
19677 #include <sys/types.h>
19678 #include <stdio.h>
19679 #$i_stdlib I_STDLIB
19680 #ifdef I_STDLIB
19681 #include <stdlib.h>
19682 #endif
19683 int main() {
19684     printf("%d\n", (int)sizeof($gidtype));
19685     exit(0);
19686 }
19687 EOCP
19688 set try
19689 if eval $compile_ok; then
19690         yyy=`$run ./try`
19691         case "$yyy" in
19692         '')     gidsize=4
19693                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19694                 ;;
19695         *)      gidsize=$yyy
19696                 echo "Your $zzz is $gidsize bytes long."
19697                 ;;
19698         esac
19699 else
19700         gidsize=4
19701         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19702 fi
19703
19704
19705 : Check if GID is signed
19706 echo " "
19707 case "$gidtype" in
19708 *_t) zzz="$gidtype"     ;;
19709 *)   zzz="gid"          ;;
19710 esac
19711 echo "Checking the sign of $zzz..." >&4
19712 cat > try.c <<EOCP
19713 #include <sys/types.h>
19714 #include <stdio.h>
19715 int main() {
19716         $gidtype foo = -1;
19717         if (foo < 0)
19718                 printf("-1\n");
19719         else
19720                 printf("1\n");
19721 }
19722 EOCP
19723 set try
19724 if eval $compile; then
19725         yyy=`$run ./try`
19726         case "$yyy" in
19727         '')     gidsign=1
19728                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19729                 ;;
19730         *)      gidsign=$yyy
19731                 case "$gidsign" in
19732                  1) echo "Your $zzz is unsigned." ;;
19733                 -1) echo "Your $zzz is signed."   ;;
19734                 esac
19735                 ;;
19736         esac
19737 else
19738         gidsign=1
19739         echo "(I can't compile the test program--guessing unsigned.)" >&4
19740 fi
19741
19742
19743 : Check 64bit sizes
19744 echo " "
19745
19746 if $test X"$quadtype" != X; then
19747
19748 echo "Checking how to print 64-bit integers..." >&4
19749
19750 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19751         $cat >try.c <<'EOCP'
19752 #include <sys/types.h>
19753 #include <stdio.h>
19754 int main() {
19755   int q = 12345678901;
19756   printf("%ld\n", q);
19757 }
19758 EOCP
19759         set try
19760         if eval $compile; then
19761                 yyy=`$run ./try`
19762                 case "$yyy" in
19763                 12345678901)
19764                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19765                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19766                         echo "We will use %d."
19767                         ;;
19768                 esac
19769         fi
19770 fi
19771
19772 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19773         $cat >try.c <<'EOCP'
19774 #include <sys/types.h>
19775 #include <stdio.h>
19776 int main() {
19777   long q = 12345678901;
19778   printf("%ld\n", q);
19779 }
19780 EOCP
19781         set try
19782         if eval $compile; then
19783                 yyy=`$run ./try`
19784                 case "$yyy" in
19785                 12345678901)
19786                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19787                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19788                         echo "We will use %ld."
19789                         ;;
19790                 esac
19791         fi
19792 fi
19793
19794 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19795         $cat >try.c <<'EOCP'
19796 #include <sys/types.h>
19797 #include <inttypes.h>
19798 #include <stdio.h>
19799 int main() {
19800   int64_t q = 12345678901;
19801   printf("%" PRId64 "\n", q);
19802 }
19803 EOCP
19804         set try
19805         if eval $compile; then
19806                 yyy=`$run ./try`
19807                 case "$yyy" in
19808                 12345678901)
19809                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19810                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19811                         echo "We will use the C9X style."
19812                         ;;
19813                 esac
19814         fi
19815 fi
19816
19817 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19818         $cat >try.c <<EOCP
19819 #include <sys/types.h>
19820 #include <stdio.h>
19821 int main() {
19822   $quadtype q = 12345678901;
19823   printf("%Ld\n", q);
19824 }
19825 EOCP
19826         set try
19827         if eval $compile; then
19828                 yyy=`$run ./try`
19829                 case "$yyy" in
19830                 12345678901)
19831                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19832                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19833                         echo "We will use %Ld."
19834                         ;;
19835                 esac
19836         fi
19837 fi
19838
19839 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19840         $cat >try.c <<'EOCP'
19841 #include <sys/types.h>
19842 #include <stdio.h>
19843 int main() {
19844   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19845   printf("%lld\n", q);
19846 }
19847 EOCP
19848         set try
19849         if eval $compile; then
19850                 yyy=`$run ./try`
19851                 case "$yyy" in
19852                 12345678901)
19853                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19854                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19855                         echo "We will use the %lld style."
19856                         ;;
19857                 esac
19858         fi
19859 fi
19860
19861 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19862         $cat >try.c <<EOCP
19863 #include <sys/types.h>
19864 #include <stdio.h>
19865 int main() {
19866   $quadtype q = 12345678901;
19867   printf("%qd\n", q);
19868 }
19869 EOCP
19870         set try
19871         if eval $compile; then
19872                 yyy=`$run ./try`
19873                 case "$yyy" in
19874                 12345678901)
19875                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19876                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19877                         echo "We will use %qd."
19878                         ;;
19879                 esac
19880         fi
19881 fi
19882
19883 if $test X"$sPRId64" = X; then
19884         echo "Cannot figure out how to print 64-bit integers." >&4
19885 fi
19886 $rm_try
19887
19888 fi
19889
19890 case "$sPRId64" in
19891 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19892         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19893         ;;
19894 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19895         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19896         ;;
19897 esac
19898
19899 : Check format strings for internal types
19900 echo " "
19901 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19902
19903 if $test X"$ivsize" = X8; then
19904         ivdformat="$sPRId64"
19905         uvuformat="$sPRIu64"
19906         uvoformat="$sPRIo64"
19907         uvxformat="$sPRIx64"
19908         uvXUformat="$sPRIXU64"
19909 else
19910         if $test X"$ivsize" = X"$longsize"; then
19911                 ivdformat='"ld"'
19912                 uvuformat='"lu"'
19913                 uvoformat='"lo"'
19914                 uvxformat='"lx"'
19915                 uvXUformat='"lX"'
19916         else
19917                 if $test X"$ivsize" = X"$intsize"; then
19918                         ivdformat='"d"'
19919                         uvuformat='"u"'
19920                         uvoformat='"o"'
19921                         uvxformat='"x"'
19922                         uvXUformat='"X"'
19923                 else
19924                         : far out
19925                         if $test X"$ivsize" = X"$shortsize"; then
19926                                 ivdformat='"hd"'
19927                                 uvuformat='"hu"'
19928                                 uvoformat='"ho"'
19929                                 uvxformat='"hx"'
19930                                 uvXUformat='"hX"'
19931                         fi
19932                 fi
19933         fi
19934 fi
19935
19936 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19937         nveformat="$sPRIeldbl"
19938         nvfformat="$sPRIfldbl"
19939         nvgformat="$sPRIgldbl"
19940         nvEUformat="$sPRIEUldbl"
19941         nvFUformat="$sPRIFUldbl"
19942         nvGUformat="$sPRIGUldbl"
19943 else
19944         nveformat='"e"'
19945         nvfformat='"f"'
19946         nvgformat='"g"'
19947         nvEUformat='"E"'
19948         nvFUformat='"F"'
19949         nvGUformat='"G"'
19950 fi
19951
19952 case "$ivdformat" in
19953 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19954     exit 1
19955     ;;
19956 esac
19957
19958 : Check format string for GID
19959
19960 echo " "
19961 $echo "Checking the format string to be used for gids..." >&4
19962
19963 case "$gidsign" in
19964 -1)     if $test X"$gidsize" = X"$ivsize"; then
19965                 gidformat="$ivdformat"
19966         else
19967                 if $test X"$gidsize" = X"$longsize"; then
19968                         gidformat='"ld"'
19969                 else
19970                         if $test X"$gidsize" = X"$intsize"; then
19971                                 gidformat='"d"'
19972                         else
19973                                 if $test X"$gidsize" = X"$shortsize"; then
19974                                         gidformat='"hd"'
19975                                 fi
19976                         fi
19977                 fi
19978         fi
19979         ;;
19980 *)      if $test X"$gidsize" = X"$uvsize"; then
19981                 gidformat="$uvuformat"
19982         else
19983                 if $test X"$gidsize" = X"$longsize"; then
19984                         gidformat='"lu"'
19985                 else
19986                         if $test X"$gidsize" = X"$intsize"; then
19987                                 gidformat='"u"'
19988                         else
19989                                 if $test X"$gidsize" = X"$shortsize"; then
19990                                         gidformat='"hu"'
19991                                 fi
19992                         fi
19993                 fi
19994         fi
19995         ;;
19996 esac
19997
19998 : see if getgroups exists
19999 set getgroups d_getgrps
20000 eval $inlibc
20001
20002 : see if setgroups exists
20003 set setgroups d_setgrps
20004 eval $inlibc
20005
20006 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20007 echo " "
20008 case "$d_getgrps$d_setgrps" in
20009 *define*)
20010         case "$groupstype" in
20011         '') dflt="$gidtype" ;;
20012         *)  dflt="$groupstype" ;;
20013         esac
20014         $cat <<EOM
20015 What type of pointer is the second argument to getgroups() and setgroups()?
20016 Usually this is the same as group ids, $gidtype, but not always.
20017
20018 EOM
20019         rp='What type pointer is the second argument to getgroups() and setgroups()?'
20020         . ./myread
20021         groupstype="$ans"
20022         ;;
20023 *)  groupstype="$gidtype";;
20024 esac
20025
20026 : MAD = Misc Attribute Definition
20027
20028 if $test $patchlevel -lt 9; then
20029 : MAD is not available in 5.8.x or earlier.
20030     ans=n;
20031 else
20032     case "$mad" in
20033     $define|true|[yY]*) dflt='y' ;;
20034     *)                  dflt='n' ;;
20035     esac
20036     cat <<EOM
20037
20038 Would you like to build with Misc Attribute Decoration? This is development
20039 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20040 overhead on the interpreter.
20041
20042 If this doesn't make any sense to you, just accept the default '$dflt'.
20043 EOM
20044     rp='Build Perl with MAD?'
20045     . ./myread
20046 fi
20047 case "$ans" in
20048 y|Y)    val="$define"
20049         madlyh='madly.h madly.act madly.tab'
20050         madlysrc='madly.c'
20051         madlyobj="madly$_o" ;;
20052 *)      val="$undef"
20053         madlyh=''
20054         madlysrc=''
20055         madlyobj='' ;;
20056 esac
20057 set mad
20058 eval $setvar
20059
20060 : check whether make sets MAKE
20061 echo " "
20062 echo "Checking if your $make program sets \$(MAKE)..." >&4
20063 case "$make_set_make" in
20064 '')
20065         $sed 's/^X //' > testmake.mak << 'EOF'
20066 Xall:
20067 X       @echo 'maketemp="$(MAKE)"'
20068 EOF
20069         case "`$make -f testmake.mak 2>/dev/null`" in
20070         *maketemp=*) make_set_make='#' ;;
20071         *)      make_set_make="MAKE=$make" ;;
20072         esac
20073         $rm -f testmake.mak
20074         ;;
20075 esac
20076 case "$make_set_make" in
20077 '#') echo "Yup, it does.";;
20078 *) echo "Nope, it doesn't.";;
20079 esac
20080
20081 : see what type is used for mode_t
20082 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20083 set mode_t modetype int stdio.h sys/types.h
20084 eval $typedef_ask
20085
20086 : see if we need va_copy
20087 echo " "
20088 case "$i_stdarg" in
20089 "$define")
20090         $cat >try.c <<EOCP
20091 #include <stdarg.h>
20092 #include <stdio.h>
20093 #$i_stdlib I_STDLIB
20094 #ifdef I_STDLIB
20095 #include <stdlib.h>
20096 #endif
20097 #include <signal.h>
20098
20099 int
20100 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20101 {
20102   return vfprintf(f, fmt, *valp);
20103 }
20104
20105 int
20106 myvfprintf(FILE *f, const  char *fmt, va_list val)
20107 {
20108   return ivfprintf(f, fmt, &val);
20109 }
20110
20111 int
20112 myprintf(char *fmt, ...)
20113 {
20114   va_list val;
20115   va_start(val, fmt);
20116   return myvfprintf(stdout, fmt, val);
20117 }
20118
20119 int
20120 main(int ac, char **av)
20121 {
20122   signal(SIGSEGV, exit);
20123
20124   myprintf("%s%cs all right, then\n", "that", '\'');
20125   exit(0);
20126 }
20127 EOCP
20128         set try
20129         if eval $compile && $run ./try 2>&1 >/dev/null; then
20130                 case "`$run ./try`" in
20131                 "that's all right, then")
20132                         okay=yes
20133                         ;;
20134                 esac
20135         fi
20136         case "$okay" in
20137         yes)    echo "It seems that you don't need va_copy()." >&4
20138                 need_va_copy="$undef"
20139                 ;;
20140         *)      echo "It seems that va_copy() or similar will be needed." >&4
20141                 need_va_copy="$define"
20142                 ;;
20143         esac
20144         $rm_try
20145         ;;
20146 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20147         need_va_copy="$undef"
20148         ;;
20149 esac
20150
20151 : see what type is used for size_t
20152 rp="What is the type used for the length parameter for string functions?"
20153 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20154 eval $typedef_ask
20155
20156 : check for type of arguments to gethostbyaddr. 
20157 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20158         case "$d_gethbyaddr" in
20159         $define)
20160                 $cat <<EOM
20161
20162 Checking to see what type of arguments are accepted by gethostbyaddr().
20163 EOM
20164                 hdrs="$define sys/types.h
20165                         $d_socket sys/socket.h 
20166                         $i_niin netinet/in.h 
20167                         $i_netdb netdb.h
20168                         $i_unistd unistd.h"
20169                 : The first arg can 'char *' or 'void *'
20170                 : The second arg is some of integral type
20171                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20172                         for yyy in size_t long int; do
20173                                 case "$netdb_host_type" in
20174                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20175                                         if ./protochk "$try" $hdrs; then
20176                                                 echo "Your system accepts $xxx for the first arg."
20177                                                 echo "...and $yyy for the second arg."
20178                                                 netdb_host_type="$xxx"
20179                                                 netdb_hlen_type="$yyy"
20180                                         fi
20181                                         ;;
20182                                 esac
20183                         done
20184                 done
20185                 : In case none of those worked, prompt the user.
20186                 case "$netdb_host_type" in
20187                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20188                         dflt='char *'
20189                         . ./myread
20190                         netdb_host_type=$ans
20191                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20192                         dflt="$sizetype"
20193                         . ./myread
20194                         netdb_hlen_type=$ans
20195                         ;;
20196                 esac
20197                 ;;
20198         *)      : no gethostbyaddr, so pick harmless defaults
20199                 netdb_host_type='char *'
20200                 netdb_hlen_type="$sizetype"
20201                 ;;
20202         esac
20203         # Remove the "const" if needed. -- but then we'll have a 
20204         # prototype clash!
20205         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20206 fi
20207
20208 : check for type of argument to gethostbyname. 
20209 if test "X$netdb_name_type" = X ; then
20210         case "$d_gethbyname" in
20211         $define)
20212                 $cat <<EOM
20213
20214 Checking to see what type of argument is accepted by gethostbyname().
20215 EOM
20216                 hdrs="$define sys/types.h
20217                         $d_socket sys/socket.h 
20218                         $i_niin netinet/in.h 
20219                         $i_netdb netdb.h
20220                         $i_unistd unistd.h"
20221                 for xxx in "const char *" "char *"; do
20222                         case "$netdb_name_type" in
20223                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20224                                 if ./protochk "$try" $hdrs; then
20225                                         echo "Your system accepts $xxx."
20226                                         netdb_name_type="$xxx"
20227                                 fi
20228                                 ;;
20229                         esac
20230                 done
20231                 : In case none of those worked, prompt the user.
20232                 case "$netdb_name_type" in
20233                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20234                         dflt='char *'
20235                         . ./myread
20236                         netdb_name_type=$ans
20237                         ;;
20238                 esac
20239                 ;;
20240         *)      : no gethostbyname, so pick harmless default
20241                 netdb_name_type='char *'
20242                 ;;
20243         esac
20244 fi
20245
20246 : check for type of 1st argument to getnetbyaddr. 
20247 if test "X$netdb_net_type" = X ; then
20248         case "$d_getnbyaddr" in
20249         $define)
20250                 $cat <<EOM
20251
20252 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20253 EOM
20254                 hdrs="$define sys/types.h
20255                         $d_socket sys/socket.h 
20256                         $i_niin netinet/in.h 
20257                         $i_netdb netdb.h
20258                         $i_unistd unistd.h"
20259                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20260                         case "$netdb_net_type" in
20261                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20262                                 if ./protochk "$try" $hdrs; then
20263                                         echo "Your system accepts $xxx."
20264                                         netdb_net_type="$xxx"
20265                                 fi
20266                                 ;;
20267                         esac
20268                 done
20269                 : In case none of those worked, prompt the user.
20270                 case "$netdb_net_type" in
20271                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20272                         dflt='long'
20273                         . ./myread
20274                         netdb_net_type=$ans
20275                         ;;
20276                 esac
20277                 ;;
20278         *)      : no getnetbyaddr, so pick harmless default
20279                 netdb_net_type='long'
20280                 ;;
20281         esac
20282 fi
20283 : locate the preferred pager for this system
20284 fn=f/
20285 case "$pager" in
20286 '')
20287         dflt=''
20288         case "$pg" in
20289         /*) dflt=$pg;;
20290         [a-zA-Z]:/*) dflt=$pg;;
20291         esac
20292         case "$more" in
20293         /*) dflt=$more;;
20294         [a-zA-Z]:/*) dflt=$more;;
20295         esac
20296         case "$less" in
20297         /*) dflt=$less;;
20298         [a-zA-Z]:/*) dflt=$less;;
20299         esac
20300         case "$dflt" in
20301         '') dflt=/usr/ucb/more;;
20302         esac
20303         ;;
20304 *)      dflt="$pager"
20305         ;;
20306 esac
20307 fn="f/($dflt)"
20308 echo " "
20309 rp='What pager is used on your system?'
20310 . ./getfile
20311 pager="$ans"
20312
20313 : see what type pids are declared as in the kernel
20314 rp="What is the type of process ids on this system?"
20315 set pid_t pidtype int stdio.h sys/types.h
20316 eval $typedef_ask
20317
20318 : see if ar generates random libraries by itself
20319 echo " "
20320 echo "Checking how to generate random libraries on your machine..." >&4
20321 echo 'int bar1() { return bar2(); }' > bar1.c
20322 echo 'int bar2() { return 2; }' > bar2.c
20323 $cat > foo.c <<EOP
20324 #$i_stdlib I_STDLIB
20325 #ifdef I_STDLIB
20326 #include <stdlib.h>
20327 #endif
20328 int main() { printf("%d\n", bar1()); exit(0); }
20329 EOP
20330 $cc $ccflags -c bar1.c >/dev/null 2>&1
20331 $cc $ccflags -c bar2.c >/dev/null 2>&1
20332 $cc $ccflags -c foo.c >/dev/null 2>&1
20333 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20334 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20335         $run ./foobar >/dev/null 2>&1; then
20336         echo "$ar appears to generate random libraries itself."
20337         orderlib=false
20338         if [ "X$ranlib" = "X" ]; then
20339             ranlib=":"
20340         fi
20341 elif $ar s bar$_a >/dev/null 2>&1 &&
20342         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20343         $run ./foobar >/dev/null 2>&1; then
20344                 echo "a table of contents needs to be added with '$ar s'."
20345                 orderlib=false
20346                 ranlib="$ar s"
20347 elif $ar ts bar$_a >/dev/null 2>&1 &&
20348         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20349         $run ./foobar >/dev/null 2>&1; then
20350                 echo "a table of contents needs to be added with '$ar ts'."
20351                 orderlib=false
20352                 ranlib="$ar ts"
20353 else
20354         case "$ranlib" in
20355         :) ranlib='';;
20356         '')
20357                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20358                 $test -f $ranlib || ranlib=''
20359                 ;;
20360         esac
20361         if $test -n "$ranlib"; then
20362                 echo "your system has '$ranlib'; we'll use that."
20363                 orderlib=false
20364         else
20365                 echo "your system doesn't seem to support random libraries"
20366                 echo "so we'll use lorder and tsort to order the libraries."
20367                 orderlib=true
20368                 ranlib=":"
20369         fi
20370 fi
20371 $rm -f foo* bar*
20372
20373 : see if this is a values.h system
20374 set values.h i_values
20375 eval $inhdr
20376
20377 : Check the max offset that gmtime and localtime accept
20378 echo "Checking max offsets that gmtime () accepts"
20379
20380 case $i_values in
20381     define) yyy="#include <values.h>" ;;
20382     *)      yyy="" ;;
20383     esac
20384
20385 case "$sGMTIME_min/$sGMTIME_max" in
20386     0/0|/)
20387         $cat >try.c <<EOCP
20388 #include <sys/types.h>
20389 #include <stdio.h>
20390 #include <time.h>
20391 $yyy
20392
20393 int i;
20394 struct tm *tmp;
20395 time_t pt;
20396
20397 void gm_check (time_t t, int min_year, int max_year)
20398 {
20399     tmp = gmtime (&t);
20400     if ( tmp == NULL ||
20401         /* Check tm_year overflow */
20402          tmp->tm_year < min_year || tmp->tm_year > max_year)
20403         tmp = NULL;
20404     else
20405         pt = t;
20406     } /* gm_check */
20407
20408 int check_max ()
20409 {
20410     tmp = NULL;
20411     pt  = 0;
20412 #ifdef MAXLONG
20413     gm_check (MAXLONG, 69, 0x7fffffff);
20414 #endif
20415     if (tmp == NULL || tmp->tm_year < 0) {
20416         for (i = 63; i >= 0; i--) {
20417             time_t x = pt | ((time_t)1 << i);
20418             if (x < 0 || x < pt) continue;
20419             gm_check (x, 69, 0x7fffffff);
20420             }
20421         }
20422     printf ("sGMTIME_max=%ld\n", pt);
20423     return (0);
20424     } /* check_max */
20425
20426 int check_min ()
20427 {
20428     tmp = NULL;
20429     pt  = 0;
20430 #ifdef MINLONG
20431     gm_check (MINLONG, -1900, 70);
20432 #endif
20433     if (tmp == NULL) {
20434         for (i = 36; i >= 0; i--) {
20435             time_t x = pt - ((time_t)1 << i);
20436             if (x > 0) continue;
20437             gm_check (x, -1900, 70);
20438             }
20439         }
20440     printf ("sGMTIME_min=%ld\n", pt);
20441     return (0);
20442     } /* check_min */
20443
20444 int main (int argc, char *argv[])
20445 {
20446     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20447     check_max ();
20448     check_min ();
20449     return (0);
20450     } /* main */
20451 EOCP
20452         set try
20453         if eval $compile; then
20454             eval `$run ./try`
20455         else
20456             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20457             fi
20458         $rm_try
20459         ;;
20460     esac
20461
20462 echo "Checking max offsets that localtime () accepts"
20463
20464 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20465     0/0|/)
20466         $cat >try.c <<EOCP
20467 #include <sys/types.h>
20468 #include <stdio.h>
20469 #include <time.h>
20470 $yyy
20471
20472 int i;
20473 struct tm *tmp;
20474 time_t pt;
20475
20476 void local_check (time_t t, int min_year, int max_year)
20477 {
20478     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20479         tmp = NULL;
20480     else
20481         tmp = localtime (&t);
20482     if ( tmp == NULL ||
20483         /* Check tm_year overflow */
20484          tmp->tm_year < min_year || tmp->tm_year > max_year)
20485         tmp = NULL;
20486     else
20487         pt = t;
20488     } /* local_check */
20489
20490 int check_max ()
20491 {
20492     tmp = NULL;
20493     pt  = 0;
20494 #ifdef MAXLONG
20495     local_check (MAXLONG, 69, 0x7fffffff);
20496 #endif
20497     if (tmp == NULL || tmp->tm_year < 0) {
20498         for (i = 63; i >= 0; i--) {
20499             time_t x = pt | ((time_t)1 << i);
20500             if (x < 0 || x < pt) continue;
20501             local_check (x, 69, 0x7fffffff);
20502             }
20503         }
20504     printf ("sLOCALTIME_max=%ld\n", pt);
20505     return (0);
20506    } /* check_max */
20507
20508 int check_min ()
20509 {
20510     tmp = NULL;
20511     pt  = 0;
20512 #ifdef MINLONG
20513     local_check (MINLONG, -1900, 70);
20514 #endif
20515     if (tmp == NULL) {
20516         for (i = 36; i >= 0; i--) {
20517             time_t x = pt - ((time_t)1 << i);
20518             if (x > 0) continue;
20519             local_check (x, -1900, 70);
20520             }
20521         }
20522     printf ("sLOCALTIME_min=%ld\n", pt);
20523     return (0);
20524     } /* check_min */
20525
20526 int main (int argc, char *argv[])
20527 {
20528     check_max ();
20529     check_min ();
20530     return (0);
20531     } /* main */
20532 EOCP
20533         set try
20534         if eval $compile; then
20535             eval `$run ./try`
20536         else
20537             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20538             fi
20539         $rm_try
20540         ;;
20541     esac
20542
20543 : check for type of arguments to select.
20544 case "$selecttype" in
20545 '') case "$d_select" in
20546         $define)
20547                 echo " "
20548                 $cat <<EOM
20549 Checking to see what type of arguments are accepted by select().
20550 EOM
20551                 hdrs="$define sys/types.h
20552                         $i_systime sys/time.h
20553                         $i_sysselct sys/select.h
20554                         $d_socket sys/socket.h"
20555                 : The first arg can be int, unsigned, or size_t
20556                 : The last arg may or may not be 'const'
20557                 val=''
20558                 : void pointer has been seen but using that
20559                 : breaks the selectminbits test
20560                 for xxx in 'fd_set *' 'int *'; do
20561                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20562                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20563                                         case "$val" in
20564                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20565                                                 if ./protochk "$try" $hdrs; then
20566                                                         echo "Your system accepts $xxx."
20567                                                         val="$xxx"
20568                                                 fi
20569                                                 ;;
20570                                         esac
20571                                 done
20572                         done
20573                 done
20574                 case "$val" in
20575                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20576                         case "$d_fd_set" in
20577                                 $define) dflt="fd_set *" ;;
20578                                 *)              dflt="int *" ;;
20579                         esac
20580                         . ./myread
20581                         val=$ans
20582                         ;;
20583                 esac
20584                 selecttype="$val"
20585                 ;;
20586         *)      : no select, so pick a harmless default
20587                 selecttype='int *'
20588                 ;;
20589         esac
20590         ;;
20591 esac
20592
20593 : check for the select 'width'
20594 case "$selectminbits" in
20595 '') safebits=`expr $ptrsize \* 8`
20596     case "$d_select" in
20597         $define)
20598                 $cat <<EOM
20599
20600 Checking to see on how many bits at a time your select() operates...
20601 EOM
20602                 $cat >try.c <<EOCP
20603 #include <sys/types.h>
20604 #$i_time I_TIME
20605 #$i_systime I_SYS_TIME
20606 #$i_systimek I_SYS_TIME_KERNEL
20607 #ifdef I_TIME
20608 #   include <time.h>
20609 #endif
20610 #ifdef I_SYS_TIME
20611 #   ifdef I_SYS_TIME_KERNEL
20612 #       define KERNEL
20613 #   endif
20614 #   include <sys/time.h>
20615 #   ifdef I_SYS_TIME_KERNEL
20616 #       undef KERNEL
20617 #   endif
20618 #endif
20619 #$i_sysselct I_SYS_SELECT
20620 #ifdef I_SYS_SELECT
20621 #include <sys/select.h>
20622 #endif
20623 #$d_socket HAS_SOCKET
20624 #ifdef HAS_SOCKET
20625 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20626 #endif
20627 #include <stdio.h>
20628 #$i_stdlib I_STDLIB
20629 #ifdef I_STDLIB
20630 #include <stdlib.h>
20631 #endif
20632 $selecttype b;
20633 #define S sizeof(*(b))
20634 #define MINBITS 64
20635 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20636 #define NBITS  (NBYTES * 8)
20637 int main() {
20638     char *s = (char *)malloc(NBYTES);
20639     struct timeval t;
20640     int i;
20641     FILE* fp;
20642     int fd;
20643
20644     if (!s)
20645         exit(1);
20646     fclose(stdin);
20647     fp = fopen("try.c", "r");
20648     if (fp == 0)
20649       exit(2);
20650     fd = fileno(fp);
20651     if (fd < 0)
20652       exit(3);
20653     b = ($selecttype)s;
20654     for (i = 0; i < NBITS; i++)
20655         FD_SET(i, b);
20656     t.tv_sec  = 0;
20657     t.tv_usec = 0;
20658     select(fd + 1, b, 0, 0, &t);
20659     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20660     free(s);
20661     printf("%d\n", i + 1);
20662     return 0;
20663 }
20664 EOCP
20665                 set try
20666                 if eval $compile_ok; then
20667                         selectminbits=`$run ./try`
20668                         case "$selectminbits" in
20669                         '')     cat >&4 <<EOM
20670 Cannot figure out on how many bits at a time your select() operates.
20671 I'll play safe and guess it is $safebits bits.
20672 EOM
20673                                 selectminbits=$safebits
20674                                 bits="$safebits bits"
20675                                 ;;
20676                         1)      bits="1 bit" ;;
20677                         *)      bits="$selectminbits bits" ;;
20678                         esac
20679                         echo "Your select() operates on $bits at a time." >&4
20680                 else
20681                         rp='What is the minimum number of bits your select() operates on?'
20682                         case "$byteorder" in
20683                         12345678)       dflt=64 ;;
20684                         1234)           dflt=32 ;;
20685                         *)              dflt=1  ;;
20686                         esac
20687                         . ./myread
20688                         val=$ans
20689                         selectminbits="$val"
20690                 fi
20691                 $rm_try
20692                 ;;
20693         *)      : no select, so pick a harmless default
20694                 selectminbits=$safebits
20695                 ;;
20696         esac
20697         ;;
20698 esac
20699
20700 : Trace out the files included by signal.h, then look for SIGxxx names.
20701 if [ "X$fieldn" = X ]; then
20702         : Just make some guesses.  We check them later.
20703         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20704 else
20705         xxx=`echo '#include <signal.h>' |
20706         $cppstdin $cppminus $cppflags 2>/dev/null |
20707         $grep '^[       ]*#.*include' |
20708         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20709                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20710 fi
20711 xxxfiles=''
20712 for xx in $xxx /dev/null ; do
20713         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20714 done
20715 case "$xxxfiles" in
20716 '')     xxxfiles=`./findhdr signal.h` ;;
20717 esac
20718 xxx=`awk '
20719 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20720         print substr($2, 4, 20)
20721 }
20722 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20723         print substr($3, 4, 20)
20724 }' $xxxfiles`
20725 : Append some common names just in case the awk scan failed.
20726 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20727 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20728 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20729 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20730 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20731
20732 : generate a few handy files for later
20733 $cat > signal.c <<EOCP
20734 #include <sys/types.h>
20735 #include <signal.h>
20736 #$i_stdlib I_STDLIB
20737 #ifdef I_STDLIB
20738 #include <stdlib.h>
20739 #endif
20740 #include <stdio.h>
20741 int main() {
20742
20743 /* Strange style to avoid deeply-nested #if/#else/#endif */
20744 #ifndef NSIG
20745 #  ifdef _NSIG
20746 #    define NSIG (_NSIG)
20747 #  endif
20748 #endif
20749
20750 #ifndef NSIG
20751 #  ifdef SIGMAX
20752 #    define NSIG (SIGMAX+1)
20753 #  endif
20754 #endif
20755
20756 #ifndef NSIG
20757 #  ifdef SIG_MAX
20758 #    define NSIG (SIG_MAX+1)
20759 #  endif
20760 #endif
20761
20762 #ifndef NSIG
20763 #  ifdef _SIG_MAX
20764 #    define NSIG (_SIG_MAX+1)
20765 #  endif
20766 #endif
20767
20768 #ifndef NSIG
20769 #  ifdef MAXSIG
20770 #    define NSIG (MAXSIG+1)
20771 #  endif
20772 #endif
20773
20774 #ifndef NSIG
20775 #  ifdef MAX_SIG
20776 #    define NSIG (MAX_SIG+1)
20777 #  endif
20778 #endif
20779
20780 #ifndef NSIG
20781 #  ifdef SIGARRAYSIZE
20782 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20783 #  endif
20784 #endif
20785
20786 #ifndef NSIG
20787 #  ifdef _sys_nsig
20788 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20789 #  endif
20790 #endif
20791
20792 /* Default to some arbitrary number that's big enough to get most
20793    of the common signals.
20794 */
20795 #ifndef NSIG
20796 #    define NSIG 50
20797 #endif
20798
20799 printf("NSIG %d\n", NSIG);
20800
20801 #ifndef JUST_NSIG
20802
20803 EOCP
20804
20805 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20806 {
20807         printf "#ifdef SIG"; printf $1; printf "\n"
20808         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20809         printf $1; printf ");\n"
20810         printf "#endif\n"
20811 }
20812 END {
20813         printf "#endif /* JUST_NSIG */\n";
20814         printf "exit(0);\n}\n";
20815 }
20816 ' >>signal.c
20817 $cat >signal.awk <<'EOP'
20818 BEGIN { ndups = 0 }
20819 $1 ~ /^NSIG$/ { nsig = $2 }
20820 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20821     if ($2 > maxsig) { maxsig = $2 }
20822     if (sig_name[$2]) {
20823         dup_name[ndups] = $1
20824         dup_num[ndups] = $2
20825         ndups++
20826     }
20827     else {
20828         sig_name[$2] = $1
20829         sig_num[$2] = $2
20830     }
20831 }
20832 END {
20833     if (nsig == 0) {
20834         nsig = maxsig + 1
20835     }
20836     printf("NSIG %d\n", nsig);
20837     for (n = 1; n < nsig; n++) {
20838         if (sig_name[n]) {
20839             printf("%s %d\n", sig_name[n], sig_num[n])
20840         }
20841         else {
20842             printf("NUM%d %d\n", n, n)
20843         }
20844     }
20845     for (n = 0; n < ndups; n++) {
20846         printf("%s %d\n", dup_name[n], dup_num[n])
20847     }
20848 }
20849 EOP
20850 $cat >signal_cmd <<EOS
20851 $startsh
20852 if $test -s signal.lst; then
20853     echo "Using your existing signal.lst file"
20854         exit 0
20855 fi
20856 xxx="$xxx"
20857 EOS
20858 $cat >>signal_cmd <<'EOS'
20859
20860 set signal
20861 if eval $compile_ok; then
20862         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20863                 $uniq | $awk -f signal.awk >signal.lst
20864 else
20865         echo "(I can't seem be able to compile the whole test program)" >&4
20866         echo "(I'll try it in little pieces.)" >&4
20867         set signal -DJUST_NSIG
20868         if eval $compile_ok; then
20869                 $run ./signal$_exe > signal.nsg
20870                 $cat signal.nsg
20871         else
20872                 echo "I can't seem to figure out how many signals you have." >&4
20873                 echo "Guessing 50." >&4
20874                 echo 'NSIG 50' > signal.nsg
20875         fi
20876         : Now look at all the signal names, one at a time.
20877         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20878                 $cat > signal.c <<EOCP
20879 #include <sys/types.h>
20880 #include <signal.h>
20881 #include <stdio.h>
20882 int main() {
20883 printf("$xx %d\n", SIG${xx});
20884 return 0;
20885 }
20886 EOCP
20887                 set signal
20888                 if eval $compile; then
20889                         echo "SIG${xx} found."
20890                         $run ./signal$_exe  >> signal.ls1
20891                 else
20892                         echo "SIG${xx} NOT found."
20893                 fi
20894         done
20895         if $test -s signal.ls1; then
20896                 $cat signal.nsg signal.ls1 |
20897                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20898         fi
20899
20900 fi
20901 if $test -s signal.lst; then
20902         :
20903 else
20904         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20905         echo 'kill -l' >signal
20906         set X `csh -f <signal`
20907         $rm -f signal
20908         shift
20909         case $# in
20910         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20911         esac
20912         echo $@ | $tr ' ' $trnl | \
20913             $awk '{ printf "%s %d\n", $1, ++s; }
20914                   END { printf "NSIG %d\n", ++s }' >signal.lst
20915 fi
20916 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20917 EOS
20918 chmod a+x signal_cmd
20919 $eunicefix signal_cmd
20920
20921 : generate list of signal names
20922 echo " "
20923 case "$sig_name_init" in
20924 '') doinit=yes ;;
20925 *)  case "$sig_num_init" in
20926     ''|*,*) doinit=yes ;;
20927     esac ;;
20928 esac
20929 case "$doinit" in
20930 yes)
20931         echo "Generating a list of signal names and numbers..." >&4
20932         . ./signal_cmd
20933         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20934         sig_name=`$awk 'BEGIN { printf "ZERO " }
20935                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20936         sig_num=`$awk  'BEGIN { printf "0 " }
20937                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20938         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20939                              !/^NSIG/   { printf "\"%s\", ", $1 }
20940                              END        { printf "0\n" }' signal.lst`
20941         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20942                              !/^NSIG/   { printf "%d, ", $2}
20943                              END        { printf "0\n"}' signal.lst`
20944         ;;
20945 esac
20946 echo "The following $sig_count signals are available:"
20947 echo " "
20948 echo $sig_name | $awk \
20949 'BEGIN { linelen = 0 }
20950 {
20951         for (i = 1; i <= NF; i++) {
20952                 name = "SIG" $i " "
20953                 linelen = linelen + length(name)
20954                 if (linelen > 70) {
20955                         printf "\n"
20956                         linelen = length(name)
20957                 }
20958                 printf "%s", name
20959         }
20960         printf "\n"
20961 }'
20962 sig_size=`echo $sig_name | awk '{print NF}'`
20963 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20964
20965 : Check size of size
20966 echo " "
20967 case "$sizetype" in
20968 *_t) zzz="$sizetype"    ;;
20969 *)   zzz="filesize"     ;;
20970 esac
20971 echo "Checking the size of $zzz..." >&4
20972 cat > try.c <<EOCP
20973 #include <sys/types.h>
20974 #include <stdio.h>
20975 #$i_stdlib I_STDLIB
20976 #ifdef I_STDLIB
20977 #include <stdlib.h>
20978 #endif
20979 int main() {
20980     printf("%d\n", (int)sizeof($sizetype));
20981     exit(0);
20982 }
20983 EOCP
20984 set try
20985 if eval $compile_ok; then
20986         yyy=`$run ./try`
20987         case "$yyy" in
20988         '')     sizesize=4
20989                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20990                 ;;
20991         *)      sizesize=$yyy
20992                 echo "Your $zzz size is $sizesize bytes."
20993                 ;;
20994         esac
20995 else
20996         sizesize=4
20997         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20998 fi
20999
21000
21001 : check for socklen_t
21002 echo " "
21003 echo "Checking to see if you have socklen_t..." >&4
21004 $cat >try.c <<EOCP
21005 #include <sys/types.h>
21006 #$d_socket HAS_SOCKET
21007 #ifdef HAS_SOCKET
21008 #include <sys/socket.h>
21009 #endif
21010 int main() { socklen_t x = 16; }
21011 EOCP
21012 set try
21013 if eval $compile; then
21014         val="$define"
21015         echo "You have socklen_t."
21016 else
21017         val="$undef"
21018         echo "You do not have socklen_t."
21019         case "$sizetype" in
21020         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21021         esac
21022 fi
21023 $rm_try
21024 set d_socklen_t
21025 eval $setvar
21026
21027 : see if this is a socks.h system
21028 set socks.h i_socks
21029 eval $inhdr
21030
21031 : check for type of the size argument to socket calls
21032 case "$d_socket" in
21033 "$define")
21034         $cat <<EOM
21035
21036 Checking to see what type is the last argument of accept().
21037 EOM
21038         yyy=''
21039         case "$d_socklen_t" in
21040         "$define") yyy="$yyy socklen_t"
21041         esac
21042         yyy="$yyy $sizetype int long unsigned"
21043         for xxx in $yyy; do
21044                 case "$socksizetype" in
21045                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21046                         case "$usesocks" in
21047                         "$define")
21048                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21049                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21050                                         socksizetype="$xxx"
21051                                 fi
21052                                 ;;
21053                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21054                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21055                                         socksizetype="$xxx"
21056                                 fi
21057                                 ;;
21058                         esac
21059                         ;;
21060                 esac
21061         done
21062 : In case none of those worked, prompt the user.
21063         case "$socksizetype" in
21064         '')     rp='What is the type for socket address structure sizes?'
21065                 dflt='int'
21066                 . ./myread
21067                 socksizetype=$ans
21068                 ;;
21069         esac
21070         ;;
21071 *)      : no sockets, so pick relatively harmless default
21072         socksizetype='int'
21073         ;;
21074 esac
21075
21076 : see what type is used for signed size_t
21077 set ssize_t ssizetype int stdio.h sys/types.h
21078 eval $typedef
21079 dflt="$ssizetype"
21080 $cat > try.c <<EOM
21081 #include <stdio.h>
21082 #$i_stdlib I_STDLIB
21083 #ifdef I_STDLIB
21084 #include <stdlib.h>
21085 #endif
21086 #include <sys/types.h>
21087 #define Size_t $sizetype
21088 #define SSize_t $dflt
21089 int main()
21090 {
21091         if (sizeof(Size_t) == sizeof(SSize_t))
21092                 printf("$dflt\n");
21093         else if (sizeof(Size_t) == sizeof(int))
21094                 printf("int\n");
21095         else
21096                 printf("long\n");
21097         exit(0);
21098 }
21099 EOM
21100 echo " "
21101 set try
21102 if eval $compile_ok && $run ./try > /dev/null; then
21103         ssizetype=`$run ./try`
21104         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21105 else
21106         $cat >&4 <<EOM
21107 Help! I can't compile and run the ssize_t test program: please enlighten me!
21108 (This is probably a misconfiguration in your system or libraries, and
21109 you really ought to fix it.  Still, I'll try anyway.)
21110
21111 I need a type that is the same size as $sizetype, but is guaranteed to
21112 be signed.  Common values are ssize_t, int and long.
21113
21114 EOM
21115         rp="What signed type is the same size as $sizetype?"
21116         . ./myread
21117         ssizetype="$ans"
21118 fi
21119 $rm_try
21120
21121 : Check the size of st_ino
21122 $echo " "
21123 $echo "Checking the size of st_ino..." >&4
21124 $cat > try.c <<EOCP
21125 #include <sys/stat.h>
21126 #include <stdio.h>
21127 #$i_stdlib I_STDLIB
21128 #ifdef I_STDLIB
21129 #include <stdlib.h>
21130 #endif
21131 int main() {
21132     struct stat st;
21133     printf("%d\n", (int)sizeof(st.st_ino));
21134     exit(0);
21135 }
21136 EOCP
21137 set try
21138 if eval $compile_ok; then
21139         val=`$run ./try`
21140         case "$val" in
21141         '')     st_ino_size=4
21142                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21143                 ;;
21144         *)      st_ino_size=$val
21145                 $echo "Your st_ino is $st_ino_size bytes long."
21146                 ;;
21147         esac
21148 else
21149         st_ino_size=4
21150         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21151 fi
21152 $rm_try
21153
21154 : Check if st_ino is signed
21155 $echo " "
21156 $echo "Checking the sign of st_ino..." >&4
21157 $cat > try.c <<EOCP
21158 #include <sys/stat.h>
21159 #include <stdio.h>
21160 int main() {
21161         struct stat foo;
21162         foo.st_ino = -1;
21163         if (foo.st_ino < 0)
21164                 printf("-1\n");
21165         else
21166                 printf("1\n");
21167 }
21168 EOCP
21169 set try
21170 if eval $compile; then
21171         val=`$run ./try`
21172         case "$val" in
21173         '')     st_ino_sign=1
21174                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
21175                 ;;
21176         *)      st_ino_sign=$val
21177                 case "$st_ino_sign" in
21178                  1) $echo "Your st_ino is unsigned." ;;
21179                 -1) $echo "Your st_ino is signed."   ;;
21180                 esac
21181                 ;;
21182         esac
21183 else
21184         st_ino_sign=1
21185         $echo "(I can't compile the test program--guessing unsigned.)" >&4
21186 fi
21187 $rm_try
21188
21189 : see what type of char stdio uses.
21190 echo " "
21191 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21192 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21193         echo "Your stdio uses unsigned chars." >&4
21194         stdchar="unsigned char"
21195 else
21196         echo "Your stdio uses signed chars." >&4
21197         stdchar="char"
21198 fi
21199 $rm -f stdioh
21200
21201 : see what type uids are declared as in the kernel
21202 echo " "
21203 echo "Looking for the type for user ids returned by getuid()."
21204 set uid_t uidtype xxx stdio.h sys/types.h
21205 eval $typedef
21206 case "$uidtype" in
21207 xxx)
21208         xxx=`./findhdr sys/user.h`
21209         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21210         case $1 in
21211         unsigned) dflt="$1 $2" ;;
21212         *) dflt="$1" ;;
21213         esac
21214         ;;
21215 *) dflt="$uidtype";;
21216 esac
21217 case "$uidtype" in
21218 uid_t)  echo "uid_t found." ;;
21219 *)      rp="What is the type for user ids returned by getuid()?"
21220         . ./myread
21221         uidtype="$ans"
21222         ;;
21223 esac
21224
21225 : Check size of UID
21226 echo " "
21227 case "$uidtype" in
21228 *_t) zzz="$uidtype"     ;;
21229 *)   zzz="uid"          ;;
21230 esac
21231 echo "Checking the size of $zzz..." >&4
21232 cat > try.c <<EOCP
21233 #include <sys/types.h>
21234 #include <stdio.h>
21235 #$i_stdlib I_STDLIB
21236 #ifdef I_STDLIB
21237 #include <stdlib.h>
21238 #endif
21239 int main() {
21240     printf("%d\n", (int)sizeof($uidtype));
21241     exit(0);
21242 }
21243 EOCP
21244 set try
21245 if eval $compile_ok; then
21246         yyy=`$run ./try`
21247         case "$yyy" in
21248         '')     uidsize=4
21249                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21250                 ;;
21251         *)      uidsize=$yyy
21252                 echo "Your $zzz is $uidsize bytes long."
21253                 ;;
21254         esac
21255 else
21256         uidsize=4
21257         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21258 fi
21259
21260 : Check if UID is signed
21261 echo " "
21262 case "$uidtype" in
21263 *_t) zzz="$uidtype"     ;;
21264 *)   zzz="uid"          ;;
21265 esac
21266 echo "Checking the sign of $zzz..." >&4
21267 cat > try.c <<EOCP
21268 #include <sys/types.h>
21269 #include <stdio.h>
21270 int main() {
21271         $uidtype foo = -1;
21272         if (foo < 0)
21273                 printf("-1\n");
21274         else
21275                 printf("1\n");
21276 }
21277 EOCP
21278 set try
21279 if eval $compile; then
21280         yyy=`$run ./try`
21281         case "$yyy" in
21282         '')     uidsign=1
21283                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21284                 ;;
21285         *)      uidsign=$yyy
21286                 case "$uidsign" in
21287                  1) echo "Your $zzz is unsigned." ;;
21288                 -1) echo "Your $zzz is signed."   ;;
21289                 esac
21290                 ;;
21291         esac
21292 else
21293         uidsign=1
21294         echo "(I can't compile the test program--guessing unsigned.)" >&4
21295 fi
21296
21297
21298 : Check format string for UID
21299 echo " "
21300 $echo "Checking the format string to be used for uids..." >&4
21301
21302 case "$uidsign" in
21303 -1)     if $test X"$uidsize" = X"$ivsize"; then
21304                 uidformat="$ivdformat"
21305         else
21306                 if $test X"$uidsize" = X"$longsize"; then
21307                         uidformat='"ld"'
21308                 else
21309                         if $test X"$uidsize" = X"$intsize"; then
21310                                 uidformat='"d"'
21311                         else
21312                                 if $test X"$uidsize" = X"$shortsize"; then
21313                                         uidformat='"hd"'
21314                                 fi
21315                         fi
21316                 fi
21317         fi
21318         ;;
21319 *)      if $test X"$uidsize" = X"$uvsize"; then
21320                 uidformat="$uvuformat"
21321         else
21322                 if $test X"$uidsize" = X"$longsize"; then
21323                         uidformat='"lu"'
21324                 else
21325                         if $test X"$uidsize" = X"$intsize"; then
21326                                 uidformat='"u"'
21327                         else
21328                                 if $test X"$uidsize" = X"$shortsize"; then
21329                                         uidformat='"hu"'
21330                                 fi
21331                         fi
21332                 fi
21333         fi
21334         ;;
21335 esac
21336
21337 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
21338 echo " "
21339 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
21340 $cat >try.c <<'EOM'
21341 /* Intentionally a long probe as I'd like to sanity check that the exact
21342    approach is going to work, as thinking it will work, but only having it
21343    part working at runtime is worse than not having it.  */
21344
21345 #include <sys/types.h>
21346 #include <sys/sysctl.h>
21347 #include <sys/param.h>
21348 #include <stdio.h>
21349 #include <string.h>
21350 #include <stdlib.h>
21351 #include <unistd.h>
21352
21353 int
21354 main(int argc, char **argv) {
21355     char *buffer;
21356     char *argv_leaf = strrchr(argv[0], '/');
21357     char *buffer_leaf;
21358     size_t size = 0;
21359     int mib[4];
21360
21361     mib[0] = CTL_KERN;
21362     mib[1] = KERN_PROC;
21363     mib[2] = KERN_PROC_PATHNAME;
21364     mib[3] = -1;
21365
21366     if (!argv_leaf) {
21367         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21368         return 1;
21369     }
21370
21371     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
21372         perror("sysctl");
21373         return 2;
21374     }
21375
21376     if (size < strlen(argv_leaf) + 1) {
21377         fprintf(stderr, "size %lu is too short for a path\n",
21378                 (unsigned long) size);
21379         return 3;
21380     }
21381
21382     if (size > MAXPATHLEN * MAXPATHLEN) {
21383         fprintf(stderr, "size %lu is too long for a path\n",
21384                 (unsigned long) size);
21385         return 4;
21386     }
21387
21388     buffer = malloc(size);
21389     if (!buffer) {
21390         perror("malloc");
21391         return 5;
21392     }
21393
21394     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
21395         perror("sysctl");
21396         return 6;
21397     }
21398
21399     if (strlen(buffer) + 1 != size) {
21400         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
21401                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
21402         return 7;
21403     }
21404
21405
21406     if (*buffer != '/') {
21407         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
21408         return 8;
21409     }
21410
21411     if (strstr(buffer, "/./")) {
21412         fprintf(stderr, "Contains /./: '%s'\n", buffer);
21413         return 9;
21414     }
21415
21416     if (strstr(buffer, "/../")) {
21417         fprintf(stderr, "Contains /../: '%s'\n", buffer);
21418         return 10;
21419     }
21420
21421     buffer_leaf = strrchr(buffer, '/');
21422     if (strcmp(buffer_leaf, argv_leaf) != 0) {
21423         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
21424         return 11;
21425     }
21426
21427     free(buffer);
21428
21429     return 0;
21430 }
21431 EOM
21432
21433 val=$undef
21434 set try
21435 if eval $compile; then
21436         if $run ./try; then
21437                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
21438                 val="$define"
21439         else
21440                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
21441                 val="$undef"
21442         fi
21443 else
21444         echo "I'm unable to compile the test program." >&4
21445         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
21446         val="$undef"
21447 fi
21448 $rm_try
21449 set usekernprocpathname
21450 eval $setvar
21451
21452 : Determine if we can use _NSGetExecutablePath to find executing program
21453 echo " "
21454 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
21455 $cat >try.c <<'EOM'
21456 /* Intentionally a long probe as I'd like to sanity check that the exact
21457    approach is going to work, as thinking it will work, but only having it
21458    part working at runtime is worse than not having it.  */
21459 #include <mach-o/dyld.h>
21460 #include <stdio.h>
21461 #include <stdlib.h>
21462 #include <sys/param.h>
21463 #include <string.h>
21464
21465 int
21466 main(int argc, char **argv) {
21467     char buf[1];
21468     uint32_t size = sizeof(buf);
21469     int result;
21470     char *buffer;
21471     char *tidied;
21472     char *argv_leaf = strrchr(argv[0], '/');
21473     char *tidied_leaf;
21474
21475     if (!argv_leaf) {
21476         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21477         return 1;
21478     }
21479
21480     _NSGetExecutablePath(buf, &size);
21481     if (size > MAXPATHLEN * MAXPATHLEN) {
21482         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
21483                 (unsigned int) size);
21484         return 2;
21485     }
21486
21487     buffer = malloc(size);
21488     if (!buffer) {
21489         perror("malloc");
21490         return 3;
21491     }
21492
21493     result = _NSGetExecutablePath(buffer, &size);
21494     if (result != 0) {
21495         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
21496                 result, (unsigned int) size);
21497         return 4;
21498     }
21499
21500     tidied = realpath(buffer, NULL);
21501     if (!tidied) {
21502         perror("realpath");
21503         return 5;
21504     }
21505
21506     free(buffer);
21507
21508     if (*tidied != '/') {
21509         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
21510         return 6;
21511     }
21512
21513     if (strstr(tidied, "/./")) {
21514         fprintf(stderr, "Contains /./: '%s'\n", tidied);
21515         return 7;
21516     }
21517
21518     if (strstr(tidied, "/../")) {
21519         fprintf(stderr, "Contains /../: '%s'\n", tidied);
21520         return 8;
21521     }
21522
21523     tidied_leaf = strrchr(tidied, '/');
21524     if (strcmp(tidied_leaf, argv_leaf) != 0) {
21525         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
21526         return 9;
21527     }
21528
21529     free(tidied);
21530
21531     return 0;
21532 }
21533 EOM
21534
21535 val=$undef
21536 set try
21537 if eval $compile; then
21538         if $run ./try; then
21539                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
21540                 val="$define"
21541         else
21542                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
21543         fi
21544 else
21545         echo "I'm unable to compile the test program." >&4
21546         echo "I'll assume no _NSGetExecutablePath here." >&4
21547 fi
21548 $rm_try
21549 set usensgetexecutablepath
21550 eval $setvar
21551
21552 : Check if site customization support was requested
21553 case "$usesitecustomize" in
21554     $define|true|[Yy]*)
21555         usesitecustomize="$define"
21556         ;;
21557     *)
21558         usesitecustomize="$undef"
21559         ;;
21560     esac
21561
21562 : see if prototypes support variable argument declarations
21563 echo " "
21564 case "$prototype$i_stdarg" in
21565 $define$define)
21566         echo "It appears we'll be able to prototype varargs functions." >&4
21567         val="$define"
21568         ;;
21569 *)
21570         echo "Too bad... We won't be using prototyped varargs functions..." >&4
21571         val="$undef"
21572         ;;
21573 esac
21574 set vaproto
21575 eval $setvar
21576
21577 : determine compiler compiler
21578 case "$yacc" in
21579 '')
21580         dflt=yacc;;
21581 *)
21582         dflt="$yacc";;
21583 esac
21584 echo " "
21585 comp='yacc'
21586 if $test -f "$byacc$_exe"; then
21587         dflt="$byacc"
21588         comp="byacc or $comp"
21589 fi
21590 if $test -f "$bison$_exe"; then
21591         comp="$comp or bison -y"
21592 fi
21593 rp="Which compiler compiler ($comp) shall I use?"
21594 . ./myread
21595 yacc="$ans"
21596 case "$yacc" in
21597 *bis*)
21598         case "$yacc" in
21599         *-y*) ;;
21600         *)
21601                 yacc="$yacc -y"
21602                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
21603                 ;;
21604         esac
21605         ;;
21606 esac
21607
21608 : see if this is a assert.h system
21609 set assert.h i_assert
21610 eval $inhdr
21611
21612 : see if this is a fp.h system
21613 set fp.h i_fp
21614 eval $inhdr
21615
21616 : see if this is a fp_class.h system
21617 set fp_class.h i_fp_class
21618 eval $inhdr
21619
21620 : see if gdbm.h is available
21621 set gdbm.h t_gdbm
21622 eval $inhdr
21623 case "$t_gdbm" in
21624 $define)
21625         : see if gdbm_open exists
21626         set gdbm_open d_gdbm_open
21627         eval $inlibc
21628         case "$d_gdbm_open" in
21629         $undef)
21630                 t_gdbm="$undef"
21631                 echo "We won't be including <gdbm.h>"
21632                 ;;
21633         esac
21634         ;;
21635 esac
21636 val="$t_gdbm"
21637 set i_gdbm
21638 eval $setvar
21639
21640 : see if this is a ieeefp.h system
21641 case "$i_ieeefp" in
21642 '' ) set ieeefp.h i_ieeefp
21643      eval $inhdr
21644      ;;
21645 esac
21646
21647 : see if this is a libutil.h system
21648 set libutil.h i_libutil
21649 eval $inhdr
21650
21651 : see if mach cthreads are available
21652 if test "X$usethreads" = "X$define"; then
21653         set mach/cthreads.h i_machcthr
21654         eval $inhdr
21655 else
21656         i_machcthr="$undef"
21657 fi
21658
21659 : see if this is a mntent.h system
21660 set mntent.h i_mntent
21661 eval $inhdr
21662
21663 : see if net/errno.h is available
21664 val=''
21665 set net/errno.h val
21666 eval $inhdr
21667
21668 : Unfortunately, it causes problems on some systems.  Arrgh.
21669 case "$val" in
21670 $define)
21671         cat > try.c <<'EOM'
21672 #include <stdio.h>
21673 #include <errno.h>
21674 #include <net/errno.h>
21675 int func()
21676 {
21677         return ENOTSOCK;
21678 }
21679 EOM
21680         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21681                 echo "We'll be including <net/errno.h>." >&4
21682         else
21683                 echo "We won't be including <net/errno.h>." >&4
21684                 val="$undef"
21685         fi
21686         $rm_try
21687         ;;
21688 esac
21689 set i_neterrno
21690 eval $setvar
21691
21692 : see if netinet/tcp.h is available
21693 set netinet/tcp.h i_netinettcp
21694 eval $inhdr
21695
21696 : see if this is a poll.h system
21697 set poll.h i_poll
21698 eval $inhdr
21699
21700 : see if this is a prot.h system
21701 set prot.h i_prot
21702 eval $inhdr
21703
21704 : Preprocessor symbols
21705 echo " "
21706 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21707 $cat <<'EOSH' > Cppsym.know
21708 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21709 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21710 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21711 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21712 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21713 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21714 bull c cadmus clipper CMU COFF COMPILER_VERSION
21715 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21716 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21717 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21718 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21719 GLIBC GLIBC_MINOR
21720 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21721 H3050R H3050RX hbullx20 hcx host_mips
21722 hp200 hp300 hp700 HP700 hp800 hp9000
21723 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21724 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21725 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21726 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21727 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21728 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21729 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21730 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21731 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21732 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21733 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21734 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21735 MATH_HAS_NO_SIDE_EFFECTS
21736 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21737 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21738 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21739 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21740 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21741 NetBSD news1500 news1700 news1800 news1900 news3700
21742 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21743 ns32016 ns32332 ns32k nsc32000
21744 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21745 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21746 pc532 pdp11 PGC PIC plexus PORTAR posix
21747 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21748 POSIX_C_SOURCE POSIX_SOURCE POWER
21749 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21750 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21751 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21752 sony sony_news sonyrisc sparc sparclite spectrum
21753 stardent stdc STDC_EXT stratos sun sun3 sun386
21754 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21755 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21756 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21757 sysV68 sysV88 Tek4132 Tek4300 titan
21758 TM3200 TM5400 TM5600
21759 tower tower32 tower32_200 tower32_600 tower32_700
21760 tower32_800 tower32_850 tss
21761 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21762 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21763 unix UNIX95 UNIX99 unixpc unos
21764 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21765 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21766 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21767 USGr4 USGr4_2
21768 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21769 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21770 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21771 z8000
21772 EOSH
21773 # Maybe put other stuff here too.
21774 cat <<EOSH >>Cppsym.know
21775 $osname
21776 EOSH
21777 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21778 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21779 $cat Cppsym.know > Cppsym.c
21780 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21781 $rm -f Cppsym.a Cppsym.b Cppsym.c
21782 cat <<EOSH > Cppsym
21783 $startsh
21784 if $test \$# -gt 0; then
21785     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21786     if $test -s Cppsym.got; then
21787         $rm -f Cppsym.got
21788         exit 0
21789     fi
21790     $rm -f Cppsym.got
21791     exit 1
21792 else
21793     $tr " " "$trnl" | ./Cppsym.try
21794     exit 0
21795 fi
21796 EOSH
21797 chmod +x Cppsym
21798 $eunicefix Cppsym
21799 cat <<EOSH > Cppsym.try
21800 $startsh
21801 cat <<'EOCP' > try.c
21802 #include <stdio.h>
21803 #if cpp_stuff == 1
21804 #define STRINGIFY(a)    "a"
21805 #endif
21806 #if cpp_stuff == 42
21807 #define StGiFy(a)  #a
21808 #define STRINGIFY(a)    StGiFy(a)
21809 #endif
21810 #if $cpp_stuff != 1 && $cpp_stuff != 42
21811 #   include "Bletch: How does this C preprocessor stringify macros?"
21812 #endif
21813 int main() {
21814 EOCP
21815 $awk \\
21816 EOSH
21817 cat <<'EOSH' >> Cppsym.try
21818 'length($1) > 0 {
21819     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21820     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21821     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21822     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21823 }'       >> try.c
21824 echo 'return 0;}' >> try.c
21825 EOSH
21826 cat <<EOSH >> Cppsym.try
21827 ccflags="$ccflags"
21828 case "$osname-$gccversion" in
21829 irix-) ccflags="\$ccflags -woff 1178" ;;
21830 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21831 esac
21832 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21833 EOSH
21834 chmod +x Cppsym.try
21835 $eunicefix Cppsym.try
21836 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
21837 : Add in any Linux cpp "predefined macros":
21838 case "$osname::$gccversion" in
21839   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
21840     tHdrH=_tmpHdr
21841     rm -f $tHdrH'.h' $tHdrH
21842     touch $tHdrH'.h'
21843     # Filter out macro arguments, such as Linux's __INT8_C(c)
21844     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21845        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21846        if [ -s $tHdrH'_cppsym.real' ]; then
21847           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21848        fi
21849     fi
21850     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21851   ;;
21852 esac
21853 : now check the C compiler for additional symbols
21854 postprocess_cc_v=''
21855 case "$osname" in
21856 aix) postprocess_cc_v="|$tr , ' '" ;;
21857 esac
21858 $cat >ccsym <<EOS
21859 $startsh
21860 $cat >tmp.c <<EOF
21861 extern int foo;
21862 EOF
21863 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21864 do
21865         case "\$i" in
21866         -D*) echo "\$i" | $sed 's/^-D//';;
21867         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21868         esac
21869 done
21870 $rm_try
21871 EOS
21872 postprocess_cc_v=''
21873 chmod +x ccsym
21874 $eunicefix ccsym
21875 ./ccsym > ccsym1.raw
21876 if $test -s ccsym1.raw; then
21877        $sort ccsym1.raw | $uniq >ccsym.raw
21878 else
21879        mv ccsym1.raw ccsym.raw
21880 fi
21881
21882 $awk '/\=/ { print $0; next }
21883         { print $0"=1" }' ccsym.raw >ccsym.list
21884 $comm -13 Cppsym.true ccsym.list >ccsym.own
21885 $comm -12 Cppsym.true ccsym.list >ccsym.com
21886 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21887 also=''
21888 if $test -z ccsym.raw; then
21889         echo "Your C compiler doesn't seem to define any symbols!" >&4
21890         echo " "
21891         echo "However, your C preprocessor defines the following symbols:"
21892         $cat Cppsym.true
21893         ccsymbols=''
21894         cppsymbols=`$cat Cppsym.true`
21895         cppsymbols=`echo $cppsymbols`
21896         cppccsymbols="$cppsymbols"
21897 else
21898         if $test -s ccsym.com; then
21899                 echo "Your C compiler and pre-processor define these symbols:"
21900                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21901                 also='also '
21902                 symbols='ones'
21903                 cppccsymbols=`$cat ccsym.com`
21904                 cppccsymbols=`echo $cppccsymbols`
21905                 $test "$silent" || sleep 1
21906         fi
21907         if $test -s ccsym.cpp; then
21908                 $test "$also" && echo " "
21909                 echo "Your C pre-processor ${also}defines the following symbols:"
21910                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21911                 also='further '
21912                 cppsymbols=`$cat ccsym.cpp`
21913                 cppsymbols=`echo $cppsymbols`
21914                 $test "$silent" || sleep 1
21915         fi
21916         if $test -s ccsym.own; then
21917                 $test "$also" && echo " "
21918                 echo "Your C compiler ${also}defines the following cpp symbols:"
21919                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21920                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21921                 ccsymbols=`$cat ccsym.own`
21922                 ccsymbols=`echo $ccsymbols`
21923                 $test "$silent" || sleep 1
21924         fi
21925 fi
21926
21927 : see if this is a termio system
21928 val="$undef"
21929 val2="$undef"
21930 val3="$undef"
21931 if $test `./findhdr termios.h`; then
21932         set tcsetattr i_termios
21933         eval $inlibc
21934         val3="$i_termios"
21935 fi
21936 echo " "
21937 case "$val3" in
21938 "$define") echo "You have POSIX termios.h... good!" >&4;;
21939 *) if ./Cppsym pyr; then
21940                 case "`/bin/universe`" in
21941                 ucb) if $test `./findhdr sgtty.h`; then
21942                                 val2="$define"
21943                                 echo "<sgtty.h> found." >&4
21944                         else
21945                                 echo "System is pyramid with BSD universe."
21946                                 ./warn "<sgtty.h> not found--you could have problems."
21947                         fi;;
21948                 *) if $test `./findhdr termio.h`; then
21949                                 val="$define"
21950                                 echo "<termio.h> found." >&4
21951                         else
21952                                 echo "System is pyramid with USG universe."
21953                                 ./warn "<termio.h> not found--you could have problems."
21954                         fi;;
21955                 esac
21956         elif ./usg; then
21957                 if $test `./findhdr termio.h`; then
21958                         echo "<termio.h> found." >&4
21959                         val="$define"
21960                 elif $test `./findhdr sgtty.h`; then
21961                         echo "<sgtty.h> found." >&4
21962                         val2="$define"
21963                 else
21964                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21965                 fi
21966         else
21967                 if $test `./findhdr sgtty.h`; then
21968                         echo "<sgtty.h> found." >&4
21969                         val2="$define"
21970                 elif $test `./findhdr termio.h`; then
21971                         echo "<termio.h> found." >&4
21972                         val="$define"
21973                 else
21974                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
21975                 fi
21976         fi;;
21977 esac
21978 set i_termio; eval $setvar
21979 val=$val2; set i_sgtty; eval $setvar
21980 val=$val3; set i_termios; eval $setvar
21981
21982 : see if stdbool is available
21983 : we want a real compile instead of Inhdr because some Solaris systems
21984 : have stdbool.h, but it can only be used if the compiler indicates it
21985 : is sufficiently c99-compliant.
21986 echo " "
21987 $cat >try.c <<EOCP
21988 #include <stdio.h>
21989 #include <stdbool.h>
21990 int func(bool x)
21991 {
21992     return x ? 1 : 0;
21993 }
21994 int main(int argc, char **argv)
21995 {
21996     return func(0);
21997 }
21998 EOCP
21999 set try
22000 if eval $compile; then
22001         echo "<stdbool.h> found." >&4
22002         val="$define"
22003 else
22004         echo "<stdbool.h> NOT found." >&4
22005         val="$undef"
22006 fi
22007 $rm_try
22008 set i_stdbool
22009 eval $setvar
22010
22011 : see if stddef is available
22012 set stddef.h i_stddef
22013 eval $inhdr
22014
22015 : see if sys/access.h is available
22016 set sys/access.h i_sysaccess
22017 eval $inhdr
22018
22019 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
22020 set sys/filio.h i_sysfilio
22021 eval $inhdr
22022 echo " "
22023 if $test `./findhdr sys/ioctl.h`; then
22024         val="$define"
22025         echo '<sys/ioctl.h> found.' >&4
22026 else
22027         val="$undef"
22028         if $test $i_sysfilio = "$define"; then
22029             echo '<sys/ioctl.h> NOT found.' >&4
22030         else
22031                 $test $i_sgtty = "$define" && xxx="sgtty.h"
22032                 $test $i_termio = "$define" && xxx="termio.h"
22033                 $test $i_termios = "$define" && xxx="termios.h"
22034 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
22035         fi
22036 fi
22037 set i_sysioctl
22038 eval $setvar
22039
22040 : see if socket ioctl defs are in sys/sockio.h
22041 echo " "
22042 xxx=`./findhdr sys/sockio.h`
22043 if $test "$xxx"; then
22044         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
22045                 val="$define"
22046                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
22047         else
22048                 val="$undef"
22049                 echo "No socket ioctls found in <sys/sockio.h>." >&4
22050         fi
22051 else
22052         val="$undef"
22053         $cat <<EOM
22054 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
22055 EOM
22056 fi
22057 set i_syssockio
22058 eval $setvar
22059
22060 : see if this is a syslog.h system
22061 set syslog.h i_syslog
22062 eval $inhdr
22063
22064 : see if this is a sys/mode.h system
22065 set sys/mode.h i_sysmode
22066 eval $inhdr
22067
22068 : see if there is a sys/poll.h file
22069 set sys/poll.h i_syspoll
22070 eval $inhdr
22071
22072 : see if sys/resource.h has to be included
22073 set sys/resource.h i_sysresrc
22074 eval $inhdr
22075
22076 : see if sys/security.h is available
22077 set sys/security.h i_syssecrt
22078 eval $inhdr
22079
22080 : see if this is a sys/statvfs.h system
22081 set sys/statvfs.h i_sysstatvfs
22082 eval $inhdr
22083
22084 : see if this is a sys/un.h system
22085 set sys/un.h i_sysun
22086 eval $inhdr
22087
22088 : see if this is a sys/utsname.h system
22089 set sys/utsname.h i_sysutsname
22090 eval $inhdr
22091
22092 : see if this is a syswait system
22093 set sys/wait.h i_syswait
22094 eval $inhdr
22095
22096 : see if this is a ustat.h system
22097 set ustat.h i_ustat
22098 eval $inhdr
22099
22100 : see if this is an utime system
22101 set utime.h i_utime
22102 eval $inhdr
22103
22104 : see if this is a vfork system
22105 case "$d_vfork" in
22106 "$define")
22107         set vfork.h i_vfork
22108         eval $inhdr
22109         ;;
22110 *)
22111         i_vfork="$undef"
22112         ;;
22113 esac
22114
22115 : Check extensions
22116 echo " "
22117 echo "Looking for extensions..." >&4
22118 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
22119 : contain old or inaccurate or duplicate values.
22120 nonxs_extensions=''
22121 xs_extensions=''
22122 : We do not use find because it might not be available.
22123 : We do not just use MANIFEST because the user may have dropped
22124 : some additional extensions into the source tree and expect them
22125 : to be built.
22126
22127 : Function to recursively find available extensions, ignoring DynaLoader
22128 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
22129 : In 5.10.1 and later, extensions are stored in directories
22130 : like File-Glob instead of the older File/Glob/.
22131 find_extensions='
22132     for xxx in *; do
22133         case "$xxx" in
22134             DynaLoader|dynaload) ;;
22135             *)
22136             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
22137             case "$this_ext" in
22138                 Scalar/List/Utils) this_ext="List/Util" ;;
22139                 PathTools)         this_ext="Cwd"       ;;
22140             esac;
22141             echo " $xs_extensions $nonxs_extensions" > $$.tmp;
22142             if $contains " $this_ext " $$.tmp; then
22143                 echo >&4;
22144                 echo "Duplicate directories detected for extension $xxx" >&4;
22145                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
22146                 case "$knowitall" in
22147                 "") dflt=y;;
22148                 *) dflt=n;;
22149                 esac;
22150                 . ../UU/myread;
22151                 case "$ans" in
22152                 n*|N*) ;;
22153                 *) echo >&4;
22154                     echo "Ok.  Stopping Configure." >&4;
22155                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
22156                     exit 1;;
22157                 esac;
22158                 echo "Ok.  You will need to correct config.sh before running make." >&4;
22159             fi;
22160             $ls -1 $xxx > $$.tmp;
22161             if   $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
22162                 xs_extensions="$xs_extensions $this_ext";
22163             elif $contains "\.c$"  $$.tmp > /dev/null 2>&1; then
22164                 xs_extensions="$xs_extensions $this_ext";
22165             elif $test -d $xxx; then
22166                 nonxs_extensions="$nonxs_extensions $this_ext";
22167             fi;
22168             $rm -f $$.tmp;
22169             ;;
22170         esac;
22171     done'
22172 tdir=`pwd`
22173 cd "$rsrc/cpan"
22174 set X
22175 shift
22176 eval $find_extensions
22177 cd "$rsrc/dist"
22178 set X
22179 shift
22180 eval $find_extensions
22181 cd "$rsrc/ext"
22182 set X
22183 shift
22184 eval $find_extensions
22185 set X $xs_extensions
22186 shift
22187 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22188 set X $nonxs_extensions
22189 shift
22190 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22191 cd "$tdir"
22192 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
22193
22194 : Now see which are supported on this system.
22195 avail_ext=''
22196 for xxx in $xs_extensions ; do
22197         case "$xxx" in
22198         DB_File|db_file)
22199                 case "$i_db" in
22200                 $define) avail_ext="$avail_ext $xxx" ;;
22201                 esac
22202                 ;;
22203         GDBM_File|gdbm_fil)
22204                 case "$i_gdbm" in
22205                 $define) avail_ext="$avail_ext $xxx" ;;
22206                 esac
22207                 ;;
22208         I18N/Langinfo|i18n_lan)
22209                 case "$i_langinfo$d_nl_langinfo" in
22210                 $define$define) avail_ext="$avail_ext $xxx" ;;
22211                 esac
22212                 ;;
22213         IPC/SysV|ipc/sysv)
22214                 : XXX Do we need a useipcsysv variable here
22215                 case "${d_msg}${d_sem}${d_shm}" in
22216                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
22217                 esac
22218                 ;;
22219         NDBM_File|ndbm_fil)
22220                 case "$d_ndbm" in
22221                 $define)
22222                     case "$osname-$use64bitint" in
22223                     hpux-define)
22224                         case "$libs" in
22225                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
22226                         esac
22227                         ;;
22228                     *) avail_ext="$avail_ext $xxx" ;;
22229                     esac
22230                     ;;
22231                 esac
22232                 ;;
22233         ODBM_File|odbm_fil)
22234                 case "${i_dbm}${i_rpcsvcdbm}" in
22235                 *"${define}"*)
22236                     case "$d_cplusplus" in
22237                     define) ;; # delete as a function name will not work
22238                     *)  case "$osname-$use64bitint" in
22239                         hpux-define)
22240                             case "$libs" in
22241                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22242                             esac
22243                             ;;
22244                         *) avail_ext="$avail_ext $xxx" ;;
22245                         esac
22246                         ;;
22247                     esac
22248                     ;;
22249                 esac
22250                 ;;
22251         Opcode|opcode)
22252                 case "$useopcode" in
22253                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22254                 esac
22255                 ;;
22256         POSIX|posix)
22257                 case "$useposix" in
22258                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22259                 esac
22260                 ;;
22261         Socket|socket)
22262                 case "$d_socket" in
22263                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22264                 esac
22265                 ;;
22266         Sys/Syslog|sys/syslog)
22267                 : XXX syslog requires socket
22268                 case "$d_socket" in
22269                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22270                 esac
22271                 ;;
22272         Thread|thread)
22273                 case "$usethreads" in
22274                 true|$define|y)
22275                         case "$use5005threads" in
22276                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
22277                         esac
22278                 esac
22279                 ;;
22280         threads|threads/shared)
22281                 # threads and threads::shared are special cases.
22282                 # To stop people from asking "Perl 5.8.0 was supposed
22283                 # to have this new fancy threads implementation but my
22284                 # perl doesn't have it" and from people trying to
22285                 # (re)install the threads module using CPAN.pm and
22286                 # CPAN.pm then offering to reinstall Perl 5.8.0,
22287                 # the threads.pm and threads/shared.pm will always be
22288                 # there, croaking informatively ("you need to rebuild
22289                 # all of Perl with threads, sorry") when threads haven't
22290                 # been compiled in.
22291                 # --jhi
22292                 avail_ext="$avail_ext $xxx"
22293                 ;;
22294         VMS*)
22295                 ;;
22296         Win32*)
22297                 case "$osname" in
22298                 cygwin) avail_ext="$avail_ext $xxx" ;;
22299                 esac
22300                 ;;
22301         XS/APItest|xs/apitest)
22302                 # This is just for testing.  Skip it unless we have dynamic loading.
22303
22304                 case "$usedl" in
22305                 $define) avail_ext="$avail_ext $xxx" ;;
22306                 esac
22307                 ;;
22308         XS/Typemap|xs/typemap)
22309                 # This is just for testing.  Skip it unless we have dynamic loading.
22310                 case "$usedl" in
22311                 $define) avail_ext="$avail_ext $xxx" ;;
22312                 esac
22313                 ;;
22314         *)      avail_ext="$avail_ext $xxx"
22315                 ;;
22316         esac
22317 done
22318
22319 set X $avail_ext
22320 shift
22321 avail_ext="$*"
22322
22323 case "$onlyextensions" in
22324 '') ;;
22325 *)  keepextensions=''
22326     echo "You have requested that only certain extensions be included..." >&4
22327     for i in $onlyextensions; do
22328         case " $avail_ext " in
22329         *" $i "*)
22330             echo "Keeping extension $i."
22331             keepextensions="$keepextensions $i"
22332             ;;
22333         *) echo "Ignoring extension $i." ;;
22334         esac
22335     done
22336     avail_ext="$keepextensions"
22337     ;;
22338 esac
22339
22340 case "$noextensions" in
22341 '') ;;
22342 *)  keepextensions=''
22343     echo "You have requested that certain extensions be ignored..." >&4
22344     for i in $avail_ext; do
22345         case " $noextensions " in
22346         *" $i "*) echo "Ignoring extension $i." ;;
22347         *) echo "Keeping extension $i.";
22348            keepextensions="$keepextensions $i"
22349            ;;
22350         esac
22351     done
22352     avail_ext="$keepextensions"
22353     ;;
22354 esac
22355
22356 : Now see which nonxs extensions are supported on this system.
22357 : For now assume all are.
22358 nonxs_ext=''
22359 for xxx in $nonxs_extensions ; do
22360         case "$xxx" in
22361         VMS*)
22362                 ;;
22363         *)      nonxs_ext="$nonxs_ext $xxx"
22364                 ;;
22365         esac
22366 done
22367
22368 set X $nonxs_ext
22369 shift
22370 nonxs_ext="$*"
22371
22372 case $usedl in
22373 $define)
22374         $cat <<EOM
22375 A number of extensions are supplied with $package.  You may choose to
22376 compile these extensions for dynamic loading (the default), compile
22377 them into the $package executable (static loading), or not include
22378 them at all.  Answer "none" to include no extensions.
22379 Note that DynaLoader is always built and need not be mentioned here.
22380
22381 EOM
22382         case "$dynamic_ext" in
22383         '')
22384                 : Exclude those listed in static_ext
22385                 dflt=''
22386                 for xxx in $avail_ext; do
22387                         case " $static_ext " in
22388                         *" $xxx "*) ;;
22389                         *) dflt="$dflt $xxx" ;;
22390                         esac
22391                 done
22392                 set X $dflt
22393                 shift
22394                 dflt="$*"
22395                 ;;
22396         *)      dflt="$dynamic_ext"
22397                 # Perhaps we are reusing an old out-of-date config.sh.
22398                 case "$hint" in
22399                 previous)
22400                         if test X"$dynamic_ext" != X"$avail_ext"; then
22401                                 $cat <<EOM
22402 NOTICE:  Your previous config.sh list may be incorrect.
22403 The extensions now available to you are
22404         ${avail_ext}
22405 but the default list from your previous config.sh is
22406         ${dynamic_ext}
22407
22408 EOM
22409                         fi
22410                         ;;
22411                 esac
22412                 ;;
22413         esac
22414         case "$dflt" in
22415         '')     dflt=none;;
22416         esac
22417         rp="What extensions do you wish to load dynamically?"
22418         . ./myread
22419         case "$ans" in
22420         none) dynamic_ext=' ' ;;
22421         *) dynamic_ext="$ans" ;;
22422         esac
22423
22424         case "$static_ext" in
22425         '')
22426                 : Exclude those already listed in dynamic linking
22427                 dflt=''
22428                 for xxx in $avail_ext; do
22429                         case " $dynamic_ext " in
22430                         *" $xxx "*) ;;
22431                         *) dflt="$dflt $xxx" ;;
22432                         esac
22433                 done
22434                 set X $dflt
22435                 shift
22436                 dflt="$*"
22437                 ;;
22438         *)  dflt="$static_ext"
22439                 ;;
22440         esac
22441
22442         case "$dflt" in
22443         '')     dflt=none;;
22444         esac
22445         rp="What extensions do you wish to load statically?"
22446         . ./myread
22447         case "$ans" in
22448         none) static_ext=' ' ;;
22449         *) static_ext="$ans" ;;
22450         esac
22451         ;;
22452 *)
22453         $cat <<EOM
22454 A number of extensions are supplied with $package.  Answer "none"
22455 to include no extensions.
22456 Note that DynaLoader is always built and need not be mentioned here.
22457
22458 EOM
22459         case "$static_ext" in
22460         '') dflt="$avail_ext" ;;
22461         *)      dflt="$static_ext"
22462                 # Perhaps we are reusing an old out-of-date config.sh.
22463                 case "$hint" in
22464                 previous)
22465                         if test X"$static_ext" != X"$avail_ext"; then
22466                                 $cat <<EOM
22467 NOTICE:  Your previous config.sh list may be incorrect.
22468 The extensions now available to you are
22469         ${avail_ext}
22470 but the default list from your previous config.sh is
22471         ${static_ext}
22472
22473 EOM
22474                         fi
22475                         ;;
22476                 esac
22477                 ;;
22478         esac
22479         : Exclude those that are not xs extensions
22480         case "$dflt" in
22481         '')     dflt=none;;
22482         esac
22483         rp="What extensions do you wish to include?"
22484         . ./myread
22485         case "$ans" in
22486         none) static_ext=' ' ;;
22487         *) static_ext="$ans" ;;
22488         esac
22489         ;;
22490 esac
22491 #
22492 # Encode is a special case.  If we are building Encode as a static
22493 # extension, we need to explicitly list its subextensions as well.
22494 # For other nested extensions, this is handled automatically by
22495 # the appropriate Makefile.PL.
22496 case " $static_ext " in
22497         *" Encode "*) # Add the subextensions of Encode
22498         cd "$rsrc/cpan"
22499         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22500                 static_ext="$static_ext Encode/$xxx"
22501                 known_extensions="$known_extensions Encode/$xxx"
22502         done
22503         cd "$tdir"
22504         ;;
22505 esac
22506
22507 set X $dynamic_ext $static_ext $nonxs_ext
22508 shift
22509 extensions="$*"
22510
22511 # Sanity check:  We require an extension suitable for use with
22512 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22513 # should show up as failures in the test suite, but it's helpful to
22514 # catch them now.) The 'extensions' list is normally sorted
22515 # alphabetically, so we need to accept either
22516 #    DB_File ... Fcntl ... IO  ....
22517 # or something like
22518 #    Fcntl ... NDBM_File ... IO  ....
22519 case " $extensions"  in
22520 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22521 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22522 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22523 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22524    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22525    ;;
22526 esac
22527
22528 : Remove libraries needed only for extensions
22529 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22530 : The exception is SunOS 4.x, which needs them.
22531 case "${osname}X${osvers}" in
22532 sunos*X4*)
22533     perllibs="$libs"
22534     ;;
22535 *) case "$usedl" in
22536     $define|true|[yY]*)
22537             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
22538             shift
22539             perllibs="$*"
22540             ;;
22541     *)  perllibs="$libs"
22542             ;;
22543     esac
22544     ;;
22545 esac
22546
22547 : Remove build directory name from cppstdin so it can be used from
22548 : either the present location or the final installed location.
22549 echo " "
22550 : Get out of the UU directory to get correct path name.
22551 cd ..
22552 case "$cppstdin" in
22553 `pwd`/cppstdin)
22554         echo "Stripping down cppstdin path name"
22555         cppstdin=cppstdin
22556         ;;
22557 esac
22558 cd UU
22559
22560 : end of configuration questions
22561 echo " "
22562 echo "End of configuration questions."
22563 echo " "
22564
22565 : back to where it started
22566 if test -d ../UU; then
22567         cd ..
22568 fi
22569
22570 : configuration may be unconditionally patched via a 'config.arch' file
22571 if $test -f config.arch; then
22572         echo "I see a config.arch file, loading it." >&4
22573         . ./config.arch
22574 fi
22575
22576 : configuration may be patched via a 'config.over' file
22577 if $test -f config.over; then
22578         echo " "
22579         dflt=y
22580         rp='I see a config.over file.  Do you wish to load it?'
22581         . UU/myread
22582         case "$ans" in
22583         n*) echo "OK, I'll ignore it.";;
22584         *)      . ./config.over
22585                 echo "Configuration override changes have been loaded."
22586                 ;;
22587         esac
22588 fi
22589
22590 : in case they want portability, strip down executable paths
22591 case "$d_portable" in
22592 "$define")
22593         echo " "
22594         echo "Stripping down executable paths..." >&4
22595         for file in $loclist $trylist; do
22596                 eval temp=\$$file
22597                 eval $file=`basename $temp`
22598         done
22599         ;;
22600 esac
22601
22602 : create config.sh file
22603 echo " "
22604 echo "Creating config.sh..." >&4
22605 $spitshell <<EOT >config.sh
22606 $startsh
22607 #
22608 # This file was produced by running the Configure script. It holds all the
22609 # definitions figured out by Configure. Should you modify one of these values,
22610 # do not forget to propagate your changes by running "Configure -der". You may
22611 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22612 #
22613
22614 # Package name      : $package
22615 # Source directory  : $src
22616 # Configuration time: $cf_time
22617 # Configured by     : $cf_by
22618 # Target system     : $myuname
22619
22620 EOT
22621 : Add in command line options if available
22622 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22623
22624 $spitshell <<EOT >>config.sh
22625
22626 Author='$Author'
22627 Date='$Date'
22628 Header='$Header'
22629 Id='$Id'
22630 Locker='$Locker'
22631 Log='$Log'
22632 RCSfile='$RCSfile'
22633 Revision='$Revision'
22634 Source='$Source'
22635 State='$State'
22636 _a='$_a'
22637 _exe='$_exe'
22638 _o='$_o'
22639 afs='$afs'
22640 afsroot='$afsroot'
22641 alignbytes='$alignbytes'
22642 ansi2knr='$ansi2knr'
22643 aphostname='$aphostname'
22644 api_revision='$api_revision'
22645 api_subversion='$api_subversion'
22646 api_version='$api_version'
22647 api_versionstring='$api_versionstring'
22648 ar='$ar'
22649 archlib='$archlib'
22650 archlibexp='$archlibexp'
22651 archname64='$archname64'
22652 archname='$archname'
22653 archobjs='$archobjs'
22654 asctime_r_proto='$asctime_r_proto'
22655 awk='$awk'
22656 baserev='$baserev'
22657 bash='$bash'
22658 bin='$bin'
22659 bin_ELF='$bin_ELF'
22660 binexp='$binexp'
22661 bison='$bison'
22662 bootstrap_charset='$bootstrap_charset'
22663 byacc='$byacc'
22664 byteorder='$byteorder'
22665 c='$c'
22666 castflags='$castflags'
22667 cat='$cat'
22668 cc='$cc'
22669 cccdlflags='$cccdlflags'
22670 ccdlflags='$ccdlflags'
22671 ccflags='$ccflags'
22672 ccflags_uselargefiles='$ccflags_uselargefiles'
22673 ccname='$ccname'
22674 ccsymbols='$ccsymbols'
22675 ccversion='$ccversion'
22676 cf_by='$cf_by'
22677 cf_email='$cf_email'
22678 cf_time='$cf_time'
22679 charbits='$charbits'
22680 charsize='$charsize'
22681 chgrp='$chgrp'
22682 chmod='$chmod'
22683 chown='$chown'
22684 clocktype='$clocktype'
22685 comm='$comm'
22686 compress='$compress'
22687 contains='$contains'
22688 cp='$cp'
22689 cpio='$cpio'
22690 cpp='$cpp'
22691 cpp_stuff='$cpp_stuff'
22692 cppccsymbols='$cppccsymbols'
22693 cppflags='$cppflags'
22694 cpplast='$cpplast'
22695 cppminus='$cppminus'
22696 cpprun='$cpprun'
22697 cppstdin='$cppstdin'
22698 cppsymbols='$cppsymbols'
22699 crypt_r_proto='$crypt_r_proto'
22700 cryptlib='$cryptlib'
22701 csh='$csh'
22702 ctermid_r_proto='$ctermid_r_proto'
22703 ctime_r_proto='$ctime_r_proto'
22704 d_Gconvert='$d_Gconvert'
22705 d_PRIEUldbl='$d_PRIEUldbl'
22706 d_PRIFUldbl='$d_PRIFUldbl'
22707 d_PRIGUldbl='$d_PRIGUldbl'
22708 d_PRIXU64='$d_PRIXU64'
22709 d_PRId64='$d_PRId64'
22710 d_PRIeldbl='$d_PRIeldbl'
22711 d_PRIfldbl='$d_PRIfldbl'
22712 d_PRIgldbl='$d_PRIgldbl'
22713 d_PRIi64='$d_PRIi64'
22714 d_PRIo64='$d_PRIo64'
22715 d_PRIu64='$d_PRIu64'
22716 d_PRIx64='$d_PRIx64'
22717 d_SCNfldbl='$d_SCNfldbl'
22718 d__fwalk='$d__fwalk'
22719 d_access='$d_access'
22720 d_accessx='$d_accessx'
22721 d_aintl='$d_aintl'
22722 d_alarm='$d_alarm'
22723 d_archlib='$d_archlib'
22724 d_asctime64='$d_asctime64'
22725 d_asctime_r='$d_asctime_r'
22726 d_atolf='$d_atolf'
22727 d_atoll='$d_atoll'
22728 d_attribute_deprecated='$d_attribute_deprecated'
22729 d_attribute_format='$d_attribute_format'
22730 d_attribute_malloc='$d_attribute_malloc'
22731 d_attribute_nonnull='$d_attribute_nonnull'
22732 d_attribute_noreturn='$d_attribute_noreturn'
22733 d_attribute_pure='$d_attribute_pure'
22734 d_attribute_unused='$d_attribute_unused'
22735 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22736 d_bcmp='$d_bcmp'
22737 d_bcopy='$d_bcopy'
22738 d_bsd='$d_bsd'
22739 d_bsdgetpgrp='$d_bsdgetpgrp'
22740 d_bsdsetpgrp='$d_bsdsetpgrp'
22741 d_builtin_choose_expr='$d_builtin_choose_expr'
22742 d_builtin_expect='$d_builtin_expect'
22743 d_bzero='$d_bzero'
22744 d_c99_variadic_macros='$d_c99_variadic_macros'
22745 d_casti32='$d_casti32'
22746 d_castneg='$d_castneg'
22747 d_charvspr='$d_charvspr'
22748 d_chown='$d_chown'
22749 d_chroot='$d_chroot'
22750 d_chsize='$d_chsize'
22751 d_class='$d_class'
22752 d_clearenv='$d_clearenv'
22753 d_closedir='$d_closedir'
22754 d_cmsghdr_s='$d_cmsghdr_s'
22755 d_const='$d_const'
22756 d_copysignl='$d_copysignl'
22757 d_cplusplus='$d_cplusplus'
22758 d_crypt='$d_crypt'
22759 d_crypt_r='$d_crypt_r'
22760 d_csh='$d_csh'
22761 d_ctermid='$d_ctermid'
22762 d_ctermid_r='$d_ctermid_r'
22763 d_ctime64='$d_ctime64'
22764 d_ctime_r='$d_ctime_r'
22765 d_cuserid='$d_cuserid'
22766 d_dbl_dig='$d_dbl_dig'
22767 d_dbminitproto='$d_dbminitproto'
22768 d_difftime64='$d_difftime64'
22769 d_difftime='$d_difftime'
22770 d_dir_dd_fd='$d_dir_dd_fd'
22771 d_dirfd='$d_dirfd'
22772 d_dirnamlen='$d_dirnamlen'
22773 d_dlerror='$d_dlerror'
22774 d_dlopen='$d_dlopen'
22775 d_dlsymun='$d_dlsymun'
22776 d_dosuid='$d_dosuid'
22777 d_drand48_r='$d_drand48_r'
22778 d_drand48proto='$d_drand48proto'
22779 d_dup2='$d_dup2'
22780 d_eaccess='$d_eaccess'
22781 d_endgrent='$d_endgrent'
22782 d_endgrent_r='$d_endgrent_r'
22783 d_endhent='$d_endhent'
22784 d_endhostent_r='$d_endhostent_r'
22785 d_endnent='$d_endnent'
22786 d_endnetent_r='$d_endnetent_r'
22787 d_endpent='$d_endpent'
22788 d_endprotoent_r='$d_endprotoent_r'
22789 d_endpwent='$d_endpwent'
22790 d_endpwent_r='$d_endpwent_r'
22791 d_endsent='$d_endsent'
22792 d_endservent_r='$d_endservent_r'
22793 d_eofnblk='$d_eofnblk'
22794 d_eunice='$d_eunice'
22795 d_faststdio='$d_faststdio'
22796 d_fchdir='$d_fchdir'
22797 d_fchmod='$d_fchmod'
22798 d_fchown='$d_fchown'
22799 d_fcntl='$d_fcntl'
22800 d_fcntl_can_lock='$d_fcntl_can_lock'
22801 d_fd_macros='$d_fd_macros'
22802 d_fd_set='$d_fd_set'
22803 d_fds_bits='$d_fds_bits'
22804 d_fgetpos='$d_fgetpos'
22805 d_finite='$d_finite'
22806 d_finitel='$d_finitel'
22807 d_flexfnam='$d_flexfnam'
22808 d_flock='$d_flock'
22809 d_flockproto='$d_flockproto'
22810 d_fork='$d_fork'
22811 d_fp_class='$d_fp_class'
22812 d_fpathconf='$d_fpathconf'
22813 d_fpclass='$d_fpclass'
22814 d_fpclassify='$d_fpclassify'
22815 d_fpclassl='$d_fpclassl'
22816 d_fpos64_t='$d_fpos64_t'
22817 d_frexpl='$d_frexpl'
22818 d_fs_data_s='$d_fs_data_s'
22819 d_fseeko='$d_fseeko'
22820 d_fsetpos='$d_fsetpos'
22821 d_fstatfs='$d_fstatfs'
22822 d_fstatvfs='$d_fstatvfs'
22823 d_fsync='$d_fsync'
22824 d_ftello='$d_ftello'
22825 d_ftime='$d_ftime'
22826 d_futimes='$d_futimes'
22827 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22828 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
22829 d_getaddrinfo='$d_getaddrinfo'
22830 d_getcwd='$d_getcwd'
22831 d_getespwnam='$d_getespwnam'
22832 d_getfsstat='$d_getfsstat'
22833 d_getgrent='$d_getgrent'
22834 d_getgrent_r='$d_getgrent_r'
22835 d_getgrgid_r='$d_getgrgid_r'
22836 d_getgrnam_r='$d_getgrnam_r'
22837 d_getgrps='$d_getgrps'
22838 d_gethbyaddr='$d_gethbyaddr'
22839 d_gethbyname='$d_gethbyname'
22840 d_gethent='$d_gethent'
22841 d_gethname='$d_gethname'
22842 d_gethostbyaddr_r='$d_gethostbyaddr_r'
22843 d_gethostbyname_r='$d_gethostbyname_r'
22844 d_gethostent_r='$d_gethostent_r'
22845 d_gethostprotos='$d_gethostprotos'
22846 d_getitimer='$d_getitimer'
22847 d_getlogin='$d_getlogin'
22848 d_getlogin_r='$d_getlogin_r'
22849 d_getmnt='$d_getmnt'
22850 d_getmntent='$d_getmntent'
22851 d_getnameinfo='$d_getnameinfo'
22852 d_getnbyaddr='$d_getnbyaddr'
22853 d_getnbyname='$d_getnbyname'
22854 d_getnent='$d_getnent'
22855 d_getnetbyaddr_r='$d_getnetbyaddr_r'
22856 d_getnetbyname_r='$d_getnetbyname_r'
22857 d_getnetent_r='$d_getnetent_r'
22858 d_getnetprotos='$d_getnetprotos'
22859 d_getpagsz='$d_getpagsz'
22860 d_getpbyname='$d_getpbyname'
22861 d_getpbynumber='$d_getpbynumber'
22862 d_getpent='$d_getpent'
22863 d_getpgid='$d_getpgid'
22864 d_getpgrp2='$d_getpgrp2'
22865 d_getpgrp='$d_getpgrp'
22866 d_getppid='$d_getppid'
22867 d_getprior='$d_getprior'
22868 d_getprotobyname_r='$d_getprotobyname_r'
22869 d_getprotobynumber_r='$d_getprotobynumber_r'
22870 d_getprotoent_r='$d_getprotoent_r'
22871 d_getprotoprotos='$d_getprotoprotos'
22872 d_getprpwnam='$d_getprpwnam'
22873 d_getpwent='$d_getpwent'
22874 d_getpwent_r='$d_getpwent_r'
22875 d_getpwnam_r='$d_getpwnam_r'
22876 d_getpwuid_r='$d_getpwuid_r'
22877 d_getsbyname='$d_getsbyname'
22878 d_getsbyport='$d_getsbyport'
22879 d_getsent='$d_getsent'
22880 d_getservbyname_r='$d_getservbyname_r'
22881 d_getservbyport_r='$d_getservbyport_r'
22882 d_getservent_r='$d_getservent_r'
22883 d_getservprotos='$d_getservprotos'
22884 d_getspnam='$d_getspnam'
22885 d_getspnam_r='$d_getspnam_r'
22886 d_gettimeod='$d_gettimeod'
22887 d_gmtime64='$d_gmtime64'
22888 d_gmtime_r='$d_gmtime_r'
22889 d_gnulibc='$d_gnulibc'
22890 d_grpasswd='$d_grpasswd'
22891 d_hasmntopt='$d_hasmntopt'
22892 d_htonl='$d_htonl'
22893 d_ilogbl='$d_ilogbl'
22894 d_inc_version_list='$d_inc_version_list'
22895 d_index='$d_index'
22896 d_inetaton='$d_inetaton'
22897 d_inetntop='$d_inetntop'
22898 d_inetpton='$d_inetpton'
22899 d_int64_t='$d_int64_t'
22900 d_ip_mreq='$d_ip_mreq'
22901 d_ip_mreq_source='$d_ip_mreq_source'
22902 d_ipv6_mreq='$d_ipv6_mreq'
22903 d_ipv6_mreq_source='$d_ipv6_mreq_source'
22904 d_isascii='$d_isascii'
22905 d_isblank='$d_isblank'
22906 d_isfinite='$d_isfinite'
22907 d_isinf='$d_isinf'
22908 d_isnan='$d_isnan'
22909 d_isnanl='$d_isnanl'
22910 d_killpg='$d_killpg'
22911 d_lchown='$d_lchown'
22912 d_ldbl_dig='$d_ldbl_dig'
22913 d_libm_lib_version='$d_libm_lib_version'
22914 d_libname_unique='$d_libname_unique'
22915 d_link='$d_link'
22916 d_localtime64='$d_localtime64'
22917 d_localtime_r='$d_localtime_r'
22918 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22919 d_locconv='$d_locconv'
22920 d_lockf='$d_lockf'
22921 d_longdbl='$d_longdbl'
22922 d_longlong='$d_longlong'
22923 d_lseekproto='$d_lseekproto'
22924 d_lstat='$d_lstat'
22925 d_madvise='$d_madvise'
22926 d_malloc_good_size='$d_malloc_good_size'
22927 d_malloc_size='$d_malloc_size'
22928 d_mblen='$d_mblen'
22929 d_mbstowcs='$d_mbstowcs'
22930 d_mbtowc='$d_mbtowc'
22931 d_memchr='$d_memchr'
22932 d_memcmp='$d_memcmp'
22933 d_memcpy='$d_memcpy'
22934 d_memmove='$d_memmove'
22935 d_memset='$d_memset'
22936 d_mkdir='$d_mkdir'
22937 d_mkdtemp='$d_mkdtemp'
22938 d_mkfifo='$d_mkfifo'
22939 d_mkstemp='$d_mkstemp'
22940 d_mkstemps='$d_mkstemps'
22941 d_mktime64='$d_mktime64'
22942 d_mktime='$d_mktime'
22943 d_mmap='$d_mmap'
22944 d_modfl='$d_modfl'
22945 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22946 d_modflproto='$d_modflproto'
22947 d_mprotect='$d_mprotect'
22948 d_msg='$d_msg'
22949 d_msg_ctrunc='$d_msg_ctrunc'
22950 d_msg_dontroute='$d_msg_dontroute'
22951 d_msg_oob='$d_msg_oob'
22952 d_msg_peek='$d_msg_peek'
22953 d_msg_proxy='$d_msg_proxy'
22954 d_msgctl='$d_msgctl'
22955 d_msgget='$d_msgget'
22956 d_msghdr_s='$d_msghdr_s'
22957 d_msgrcv='$d_msgrcv'
22958 d_msgsnd='$d_msgsnd'
22959 d_msync='$d_msync'
22960 d_munmap='$d_munmap'
22961 d_mymalloc='$d_mymalloc'
22962 d_ndbm='$d_ndbm'
22963 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
22964 d_nice='$d_nice'
22965 d_nl_langinfo='$d_nl_langinfo'
22966 d_nv_preserves_uv='$d_nv_preserves_uv'
22967 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22968 d_off64_t='$d_off64_t'
22969 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22970 d_oldpthreads='$d_oldpthreads'
22971 d_oldsock='$d_oldsock'
22972 d_open3='$d_open3'
22973 d_pathconf='$d_pathconf'
22974 d_pause='$d_pause'
22975 d_perl_otherlibdirs='$d_perl_otherlibdirs'
22976 d_phostname='$d_phostname'
22977 d_pipe='$d_pipe'
22978 d_poll='$d_poll'
22979 d_portable='$d_portable'
22980 d_prctl='$d_prctl'
22981 d_prctl_set_name='$d_prctl_set_name'
22982 d_printf_format_null='$d_printf_format_null'
22983 d_procselfexe='$d_procselfexe'
22984 d_pseudofork='$d_pseudofork'
22985 d_pthread_atfork='$d_pthread_atfork'
22986 d_pthread_attr_setscope='$d_pthread_attr_setscope'
22987 d_pthread_yield='$d_pthread_yield'
22988 d_pwage='$d_pwage'
22989 d_pwchange='$d_pwchange'
22990 d_pwclass='$d_pwclass'
22991 d_pwcomment='$d_pwcomment'
22992 d_pwexpire='$d_pwexpire'
22993 d_pwgecos='$d_pwgecos'
22994 d_pwpasswd='$d_pwpasswd'
22995 d_pwquota='$d_pwquota'
22996 d_qgcvt='$d_qgcvt'
22997 d_quad='$d_quad'
22998 d_random_r='$d_random_r'
22999 d_readdir64_r='$d_readdir64_r'
23000 d_readdir='$d_readdir'
23001 d_readdir_r='$d_readdir_r'
23002 d_readlink='$d_readlink'
23003 d_readv='$d_readv'
23004 d_recvmsg='$d_recvmsg'
23005 d_rename='$d_rename'
23006 d_rewinddir='$d_rewinddir'
23007 d_rmdir='$d_rmdir'
23008 d_safebcpy='$d_safebcpy'
23009 d_safemcpy='$d_safemcpy'
23010 d_sanemcmp='$d_sanemcmp'
23011 d_sbrkproto='$d_sbrkproto'
23012 d_scalbnl='$d_scalbnl'
23013 d_sched_yield='$d_sched_yield'
23014 d_scm_rights='$d_scm_rights'
23015 d_seekdir='$d_seekdir'
23016 d_select='$d_select'
23017 d_sem='$d_sem'
23018 d_semctl='$d_semctl'
23019 d_semctl_semid_ds='$d_semctl_semid_ds'
23020 d_semctl_semun='$d_semctl_semun'
23021 d_semget='$d_semget'
23022 d_semop='$d_semop'
23023 d_sendmsg='$d_sendmsg'
23024 d_setegid='$d_setegid'
23025 d_seteuid='$d_seteuid'
23026 d_setgrent='$d_setgrent'
23027 d_setgrent_r='$d_setgrent_r'
23028 d_setgrps='$d_setgrps'
23029 d_sethent='$d_sethent'
23030 d_sethostent_r='$d_sethostent_r'
23031 d_setitimer='$d_setitimer'
23032 d_setlinebuf='$d_setlinebuf'
23033 d_setlocale='$d_setlocale'
23034 d_setlocale_r='$d_setlocale_r'
23035 d_setnent='$d_setnent'
23036 d_setnetent_r='$d_setnetent_r'
23037 d_setpent='$d_setpent'
23038 d_setpgid='$d_setpgid'
23039 d_setpgrp2='$d_setpgrp2'
23040 d_setpgrp='$d_setpgrp'
23041 d_setprior='$d_setprior'
23042 d_setproctitle='$d_setproctitle'
23043 d_setprotoent_r='$d_setprotoent_r'
23044 d_setpwent='$d_setpwent'
23045 d_setpwent_r='$d_setpwent_r'
23046 d_setregid='$d_setregid'
23047 d_setresgid='$d_setresgid'
23048 d_setresuid='$d_setresuid'
23049 d_setreuid='$d_setreuid'
23050 d_setrgid='$d_setrgid'
23051 d_setruid='$d_setruid'
23052 d_setsent='$d_setsent'
23053 d_setservent_r='$d_setservent_r'
23054 d_setsid='$d_setsid'
23055 d_setvbuf='$d_setvbuf'
23056 d_shm='$d_shm'
23057 d_shmat='$d_shmat'
23058 d_shmatprototype='$d_shmatprototype'
23059 d_shmctl='$d_shmctl'
23060 d_shmdt='$d_shmdt'
23061 d_shmget='$d_shmget'
23062 d_sigaction='$d_sigaction'
23063 d_signbit='$d_signbit'
23064 d_sigprocmask='$d_sigprocmask'
23065 d_sigsetjmp='$d_sigsetjmp'
23066 d_sin6_scope_id='$d_sin6_scope_id'
23067 d_sitearch='$d_sitearch'
23068 d_snprintf='$d_snprintf'
23069 d_sockaddr_in6='$d_sockaddr_in6'
23070 d_sockaddr_sa_len='$d_sockaddr_sa_len'
23071 d_sockatmark='$d_sockatmark'
23072 d_sockatmarkproto='$d_sockatmarkproto'
23073 d_socket='$d_socket'
23074 d_socklen_t='$d_socklen_t'
23075 d_sockpair='$d_sockpair'
23076 d_socks5_init='$d_socks5_init'
23077 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
23078 d_sqrtl='$d_sqrtl'
23079 d_srand48_r='$d_srand48_r'
23080 d_srandom_r='$d_srandom_r'
23081 d_sresgproto='$d_sresgproto'
23082 d_sresuproto='$d_sresuproto'
23083 d_statblks='$d_statblks'
23084 d_statfs_f_flags='$d_statfs_f_flags'
23085 d_statfs_s='$d_statfs_s'
23086 d_static_inline='$d_static_inline'
23087 d_statvfs='$d_statvfs'
23088 d_stdio_cnt_lval='$d_stdio_cnt_lval'
23089 d_stdio_ptr_lval='$d_stdio_ptr_lval'
23090 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
23091 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
23092 d_stdio_stream_array='$d_stdio_stream_array'
23093 d_stdiobase='$d_stdiobase'
23094 d_stdstdio='$d_stdstdio'
23095 d_strchr='$d_strchr'
23096 d_strcoll='$d_strcoll'
23097 d_strctcpy='$d_strctcpy'
23098 d_strerrm='$d_strerrm'
23099 d_strerror='$d_strerror'
23100 d_strerror_r='$d_strerror_r'
23101 d_strftime='$d_strftime'
23102 d_strlcat='$d_strlcat'
23103 d_strlcpy='$d_strlcpy'
23104 d_strtod='$d_strtod'
23105 d_strtol='$d_strtol'
23106 d_strtold='$d_strtold'
23107 d_strtoll='$d_strtoll'
23108 d_strtoq='$d_strtoq'
23109 d_strtoul='$d_strtoul'
23110 d_strtoull='$d_strtoull'
23111 d_strtouq='$d_strtouq'
23112 d_strxfrm='$d_strxfrm'
23113 d_suidsafe='$d_suidsafe'
23114 d_symlink='$d_symlink'
23115 d_syscall='$d_syscall'
23116 d_syscallproto='$d_syscallproto'
23117 d_sysconf='$d_sysconf'
23118 d_sysernlst='$d_sysernlst'
23119 d_syserrlst='$d_syserrlst'
23120 d_system='$d_system'
23121 d_tcgetpgrp='$d_tcgetpgrp'
23122 d_tcsetpgrp='$d_tcsetpgrp'
23123 d_telldir='$d_telldir'
23124 d_telldirproto='$d_telldirproto'
23125 d_time='$d_time'
23126 d_timegm='$d_timegm'
23127 d_times='$d_times'
23128 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
23129 d_tm_tm_zone='$d_tm_tm_zone'
23130 d_tmpnam_r='$d_tmpnam_r'
23131 d_truncate='$d_truncate'
23132 d_ttyname_r='$d_ttyname_r'
23133 d_tzname='$d_tzname'
23134 d_u32align='$d_u32align'
23135 d_ualarm='$d_ualarm'
23136 d_umask='$d_umask'
23137 d_uname='$d_uname'
23138 d_union_semun='$d_union_semun'
23139 d_unordered='$d_unordered'
23140 d_unsetenv='$d_unsetenv'
23141 d_usleep='$d_usleep'
23142 d_usleepproto='$d_usleepproto'
23143 d_ustat='$d_ustat'
23144 d_vendorarch='$d_vendorarch'
23145 d_vendorbin='$d_vendorbin'
23146 d_vendorlib='$d_vendorlib'
23147 d_vendorscript='$d_vendorscript'
23148 d_vfork='$d_vfork'
23149 d_void_closedir='$d_void_closedir'
23150 d_voidsig='$d_voidsig'
23151 d_voidtty='$d_voidtty'
23152 d_volatile='$d_volatile'
23153 d_vprintf='$d_vprintf'
23154 d_vsnprintf='$d_vsnprintf'
23155 d_wait4='$d_wait4'
23156 d_waitpid='$d_waitpid'
23157 d_wcstombs='$d_wcstombs'
23158 d_wctomb='$d_wctomb'
23159 d_writev='$d_writev'
23160 d_xenix='$d_xenix'
23161 date='$date'
23162 db_hashtype='$db_hashtype'
23163 db_prefixtype='$db_prefixtype'
23164 db_version_major='$db_version_major'
23165 db_version_minor='$db_version_minor'
23166 db_version_patch='$db_version_patch'
23167 direntrytype='$direntrytype'
23168 dlext='$dlext'
23169 dlsrc='$dlsrc'
23170 doublesize='$doublesize'
23171 drand01='$drand01'
23172 drand48_r_proto='$drand48_r_proto'
23173 dtrace='$dtrace'
23174 dynamic_ext='$dynamic_ext'
23175 eagain='$eagain'
23176 ebcdic='$ebcdic'
23177 echo='$echo'
23178 egrep='$egrep'
23179 emacs='$emacs'
23180 endgrent_r_proto='$endgrent_r_proto'
23181 endhostent_r_proto='$endhostent_r_proto'
23182 endnetent_r_proto='$endnetent_r_proto'
23183 endprotoent_r_proto='$endprotoent_r_proto'
23184 endpwent_r_proto='$endpwent_r_proto'
23185 endservent_r_proto='$endservent_r_proto'
23186 eunicefix='$eunicefix'
23187 exe_ext='$exe_ext'
23188 expr='$expr'
23189 extensions='$extensions'
23190 extern_C='$extern_C'
23191 extras='$extras'
23192 fflushNULL='$fflushNULL'
23193 fflushall='$fflushall'
23194 find='$find'
23195 firstmakefile='$firstmakefile'
23196 flex='$flex'
23197 fpossize='$fpossize'
23198 fpostype='$fpostype'
23199 freetype='$freetype'
23200 from='$from'
23201 full_ar='$full_ar'
23202 full_csh='$full_csh'
23203 full_sed='$full_sed'
23204 gccansipedantic='$gccansipedantic'
23205 gccosandvers='$gccosandvers'
23206 gccversion='$gccversion'
23207 getgrent_r_proto='$getgrent_r_proto'
23208 getgrgid_r_proto='$getgrgid_r_proto'
23209 getgrnam_r_proto='$getgrnam_r_proto'
23210 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
23211 gethostbyname_r_proto='$gethostbyname_r_proto'
23212 gethostent_r_proto='$gethostent_r_proto'
23213 getlogin_r_proto='$getlogin_r_proto'
23214 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
23215 getnetbyname_r_proto='$getnetbyname_r_proto'
23216 getnetent_r_proto='$getnetent_r_proto'
23217 getprotobyname_r_proto='$getprotobyname_r_proto'
23218 getprotobynumber_r_proto='$getprotobynumber_r_proto'
23219 getprotoent_r_proto='$getprotoent_r_proto'
23220 getpwent_r_proto='$getpwent_r_proto'
23221 getpwnam_r_proto='$getpwnam_r_proto'
23222 getpwuid_r_proto='$getpwuid_r_proto'
23223 getservbyname_r_proto='$getservbyname_r_proto'
23224 getservbyport_r_proto='$getservbyport_r_proto'
23225 getservent_r_proto='$getservent_r_proto'
23226 getspnam_r_proto='$getspnam_r_proto'
23227 gidformat='$gidformat'
23228 gidsign='$gidsign'
23229 gidsize='$gidsize'
23230 gidtype='$gidtype'
23231 glibpth='$glibpth'
23232 gmake='$gmake'
23233 gmtime_r_proto='$gmtime_r_proto'
23234 gnulibc_version='$gnulibc_version'
23235 grep='$grep'
23236 groupcat='$groupcat'
23237 groupstype='$groupstype'
23238 gzip='$gzip'
23239 h_fcntl='$h_fcntl'
23240 h_sysfile='$h_sysfile'
23241 hint='$hint'
23242 hostcat='$hostcat'
23243 html1dir='$html1dir'
23244 html1direxp='$html1direxp'
23245 html3dir='$html3dir'
23246 html3direxp='$html3direxp'
23247 i16size='$i16size'
23248 i16type='$i16type'
23249 i32size='$i32size'
23250 i32type='$i32type'
23251 i64size='$i64size'
23252 i64type='$i64type'
23253 i8size='$i8size'
23254 i8type='$i8type'
23255 i_arpainet='$i_arpainet'
23256 i_assert='$i_assert'
23257 i_bsdioctl='$i_bsdioctl'
23258 i_crypt='$i_crypt'
23259 i_db='$i_db'
23260 i_dbm='$i_dbm'
23261 i_dirent='$i_dirent'
23262 i_dlfcn='$i_dlfcn'
23263 i_fcntl='$i_fcntl'
23264 i_float='$i_float'
23265 i_fp='$i_fp'
23266 i_fp_class='$i_fp_class'
23267 i_gdbm='$i_gdbm'
23268 i_gdbm_ndbm='$i_gdbm_ndbm'
23269 i_gdbmndbm='$i_gdbmndbm'
23270 i_grp='$i_grp'
23271 i_ieeefp='$i_ieeefp'
23272 i_inttypes='$i_inttypes'
23273 i_langinfo='$i_langinfo'
23274 i_libutil='$i_libutil'
23275 i_limits='$i_limits'
23276 i_locale='$i_locale'
23277 i_machcthr='$i_machcthr'
23278 i_malloc='$i_malloc'
23279 i_mallocmalloc='$i_mallocmalloc'
23280 i_math='$i_math'
23281 i_memory='$i_memory'
23282 i_mntent='$i_mntent'
23283 i_ndbm='$i_ndbm'
23284 i_netdb='$i_netdb'
23285 i_neterrno='$i_neterrno'
23286 i_netinettcp='$i_netinettcp'
23287 i_niin='$i_niin'
23288 i_poll='$i_poll'
23289 i_prot='$i_prot'
23290 i_pthread='$i_pthread'
23291 i_pwd='$i_pwd'
23292 i_rpcsvcdbm='$i_rpcsvcdbm'
23293 i_sgtty='$i_sgtty'
23294 i_shadow='$i_shadow'
23295 i_socks='$i_socks'
23296 i_stdarg='$i_stdarg'
23297 i_stdbool='$i_stdbool'
23298 i_stddef='$i_stddef'
23299 i_stdlib='$i_stdlib'
23300 i_string='$i_string'
23301 i_sunmath='$i_sunmath'
23302 i_sysaccess='$i_sysaccess'
23303 i_sysdir='$i_sysdir'
23304 i_sysfile='$i_sysfile'
23305 i_sysfilio='$i_sysfilio'
23306 i_sysin='$i_sysin'
23307 i_sysioctl='$i_sysioctl'
23308 i_syslog='$i_syslog'
23309 i_sysmman='$i_sysmman'
23310 i_sysmode='$i_sysmode'
23311 i_sysmount='$i_sysmount'
23312 i_sysndir='$i_sysndir'
23313 i_sysparam='$i_sysparam'
23314 i_syspoll='$i_syspoll'
23315 i_sysresrc='$i_sysresrc'
23316 i_syssecrt='$i_syssecrt'
23317 i_sysselct='$i_sysselct'
23318 i_syssockio='$i_syssockio'
23319 i_sysstat='$i_sysstat'
23320 i_sysstatfs='$i_sysstatfs'
23321 i_sysstatvfs='$i_sysstatvfs'
23322 i_systime='$i_systime'
23323 i_systimek='$i_systimek'
23324 i_systimes='$i_systimes'
23325 i_systypes='$i_systypes'
23326 i_sysuio='$i_sysuio'
23327 i_sysun='$i_sysun'
23328 i_sysutsname='$i_sysutsname'
23329 i_sysvfs='$i_sysvfs'
23330 i_syswait='$i_syswait'
23331 i_termio='$i_termio'
23332 i_termios='$i_termios'
23333 i_time='$i_time'
23334 i_unistd='$i_unistd'
23335 i_ustat='$i_ustat'
23336 i_utime='$i_utime'
23337 i_values='$i_values'
23338 i_varargs='$i_varargs'
23339 i_varhdr='$i_varhdr'
23340 i_vfork='$i_vfork'
23341 ignore_versioned_solibs='$ignore_versioned_solibs'
23342 inc_version_list='$inc_version_list'
23343 inc_version_list_init='$inc_version_list_init'
23344 incpath='$incpath'
23345 inews='$inews'
23346 initialinstalllocation='$initialinstalllocation'
23347 installarchlib='$installarchlib'
23348 installbin='$installbin'
23349 installhtml1dir='$installhtml1dir'
23350 installhtml3dir='$installhtml3dir'
23351 installman1dir='$installman1dir'
23352 installman3dir='$installman3dir'
23353 installprefix='$installprefix'
23354 installprefixexp='$installprefixexp'
23355 installprivlib='$installprivlib'
23356 installscript='$installscript'
23357 installsitearch='$installsitearch'
23358 installsitebin='$installsitebin'
23359 installsitehtml1dir='$installsitehtml1dir'
23360 installsitehtml3dir='$installsitehtml3dir'
23361 installsitelib='$installsitelib'
23362 installsiteman1dir='$installsiteman1dir'
23363 installsiteman3dir='$installsiteman3dir'
23364 installsitescript='$installsitescript'
23365 installstyle='$installstyle'
23366 installusrbinperl='$installusrbinperl'
23367 installvendorarch='$installvendorarch'
23368 installvendorbin='$installvendorbin'
23369 installvendorhtml1dir='$installvendorhtml1dir'
23370 installvendorhtml3dir='$installvendorhtml3dir'
23371 installvendorlib='$installvendorlib'
23372 installvendorman1dir='$installvendorman1dir'
23373 installvendorman3dir='$installvendorman3dir'
23374 installvendorscript='$installvendorscript'
23375 intsize='$intsize'
23376 issymlink='$issymlink'
23377 ivdformat='$ivdformat'
23378 ivsize='$ivsize'
23379 ivtype='$ivtype'
23380 known_extensions='$known_extensions'
23381 ksh='$ksh'
23382 ld='$ld'
23383 ld_can_script='$ld_can_script'
23384 lddlflags='$lddlflags'
23385 ldflags='$ldflags'
23386 ldflags_uselargefiles='$ldflags_uselargefiles'
23387 ldlibpthname='$ldlibpthname'
23388 less='$less'
23389 lib_ext='$lib_ext'
23390 libc='$libc'
23391 libperl='$libperl'
23392 libpth='$libpth'
23393 libs='$libs'
23394 libsdirs='$libsdirs'
23395 libsfiles='$libsfiles'
23396 libsfound='$libsfound'
23397 libspath='$libspath'
23398 libswanted='$libswanted'
23399 libswanted_uselargefiles='$libswanted_uselargefiles'
23400 line='$line'
23401 lint='$lint'
23402 lkflags='$lkflags'
23403 ln='$ln'
23404 lns='$lns'
23405 localtime_r_proto='$localtime_r_proto'
23406 locincpth='$locincpth'
23407 loclibpth='$loclibpth'
23408 longdblsize='$longdblsize'
23409 longlongsize='$longlongsize'
23410 longsize='$longsize'
23411 lp='$lp'
23412 lpr='$lpr'
23413 ls='$ls'
23414 lseeksize='$lseeksize'
23415 lseektype='$lseektype'
23416 mad='$mad'
23417 madlyh='$madlyh'
23418 madlyobj='$madlyobj'
23419 madlysrc='$madlysrc'
23420 mail='$mail'
23421 mailx='$mailx'
23422 make='$make'
23423 make_set_make='$make_set_make'
23424 mallocobj='$mallocobj'
23425 mallocsrc='$mallocsrc'
23426 malloctype='$malloctype'
23427 man1dir='$man1dir'
23428 man1direxp='$man1direxp'
23429 man1ext='$man1ext'
23430 man3dir='$man3dir'
23431 man3direxp='$man3direxp'
23432 man3ext='$man3ext'
23433 mips_type='$mips_type'
23434 mistrustnm='$mistrustnm'
23435 mkdir='$mkdir'
23436 mmaptype='$mmaptype'
23437 modetype='$modetype'
23438 more='$more'
23439 multiarch='$multiarch'
23440 mv='$mv'
23441 myarchname='$myarchname'
23442 mydomain='$mydomain'
23443 myhostname='$myhostname'
23444 myuname='$myuname'
23445 n='$n'
23446 need_va_copy='$need_va_copy'
23447 netdb_hlen_type='$netdb_hlen_type'
23448 netdb_host_type='$netdb_host_type'
23449 netdb_name_type='$netdb_name_type'
23450 netdb_net_type='$netdb_net_type'
23451 nm='$nm'
23452 nm_opt='$nm_opt'
23453 nm_so_opt='$nm_so_opt'
23454 nonxs_ext='$nonxs_ext'
23455 nroff='$nroff'
23456 nvEUformat='$nvEUformat'
23457 nvFUformat='$nvFUformat'
23458 nvGUformat='$nvGUformat'
23459 nv_overflows_integers_at='$nv_overflows_integers_at'
23460 nv_preserves_uv_bits='$nv_preserves_uv_bits'
23461 nveformat='$nveformat'
23462 nvfformat='$nvfformat'
23463 nvgformat='$nvgformat'
23464 nvsize='$nvsize'
23465 nvtype='$nvtype'
23466 o_nonblock='$o_nonblock'
23467 obj_ext='$obj_ext'
23468 old_pthread_create_joinable='$old_pthread_create_joinable'
23469 optimize='$optimize'
23470 orderlib='$orderlib'
23471 osname='$osname'
23472 osvers='$osvers'
23473 otherlibdirs='$otherlibdirs'
23474 package='$package'
23475 pager='$pager'
23476 passcat='$passcat'
23477 patchlevel='$patchlevel'
23478 path_sep='$path_sep'
23479 perl5='$perl5'
23480 perl='$perl'
23481 perl_patchlevel='$perl_patchlevel'
23482 perl_static_inline='$perl_static_inline'
23483 perladmin='$perladmin'
23484 perllibs='$perllibs'
23485 perlpath='$perlpath'
23486 pg='$pg'
23487 phostname='$phostname'
23488 pidtype='$pidtype'
23489 plibpth='$plibpth'
23490 pmake='$pmake'
23491 pr='$pr'
23492 prefix='$prefix'
23493 prefixexp='$prefixexp'
23494 privlib='$privlib'
23495 privlibexp='$privlibexp'
23496 procselfexe='$procselfexe'
23497 prototype='$prototype'
23498 ptrsize='$ptrsize'
23499 quadkind='$quadkind'
23500 quadtype='$quadtype'
23501 randbits='$randbits'
23502 randfunc='$randfunc'
23503 random_r_proto='$random_r_proto'
23504 randseedtype='$randseedtype'
23505 ranlib='$ranlib'
23506 rd_nodata='$rd_nodata'
23507 readdir64_r_proto='$readdir64_r_proto'
23508 readdir_r_proto='$readdir_r_proto'
23509 revision='$revision'
23510 rm='$rm'
23511 rm_try='$rm_try'
23512 rmail='$rmail'
23513 run='$run'
23514 runnm='$runnm'
23515 sGMTIME_max='$sGMTIME_max'
23516 sGMTIME_min='$sGMTIME_min'
23517 sLOCALTIME_max='$sLOCALTIME_max'
23518 sLOCALTIME_min='$sLOCALTIME_min'
23519 sPRIEUldbl='$sPRIEUldbl'
23520 sPRIFUldbl='$sPRIFUldbl'
23521 sPRIGUldbl='$sPRIGUldbl'
23522 sPRIXU64='$sPRIXU64'
23523 sPRId64='$sPRId64'
23524 sPRIeldbl='$sPRIeldbl'
23525 sPRIfldbl='$sPRIfldbl'
23526 sPRIgldbl='$sPRIgldbl'
23527 sPRIi64='$sPRIi64'
23528 sPRIo64='$sPRIo64'
23529 sPRIu64='$sPRIu64'
23530 sPRIx64='$sPRIx64'
23531 sSCNfldbl='$sSCNfldbl'
23532 sched_yield='$sched_yield'
23533 scriptdir='$scriptdir'
23534 scriptdirexp='$scriptdirexp'
23535 sed='$sed'
23536 seedfunc='$seedfunc'
23537 selectminbits='$selectminbits'
23538 selecttype='$selecttype'
23539 sendmail='$sendmail'
23540 setgrent_r_proto='$setgrent_r_proto'
23541 sethostent_r_proto='$sethostent_r_proto'
23542 setlocale_r_proto='$setlocale_r_proto'
23543 setnetent_r_proto='$setnetent_r_proto'
23544 setprotoent_r_proto='$setprotoent_r_proto'
23545 setpwent_r_proto='$setpwent_r_proto'
23546 setservent_r_proto='$setservent_r_proto'
23547 sh='$sh'
23548 shar='$shar'
23549 sharpbang='$sharpbang'
23550 shmattype='$shmattype'
23551 shortsize='$shortsize'
23552 shrpenv='$shrpenv'
23553 shsharp='$shsharp'
23554 sig_count='$sig_count'
23555 sig_name='$sig_name'
23556 sig_name_init='$sig_name_init'
23557 sig_num='$sig_num'
23558 sig_num_init='$sig_num_init'
23559 sig_size='$sig_size'
23560 signal_t='$signal_t'
23561 sitearch='$sitearch'
23562 sitearchexp='$sitearchexp'
23563 sitebin='$sitebin'
23564 sitebinexp='$sitebinexp'
23565 sitehtml1dir='$sitehtml1dir'
23566 sitehtml1direxp='$sitehtml1direxp'
23567 sitehtml3dir='$sitehtml3dir'
23568 sitehtml3direxp='$sitehtml3direxp'
23569 sitelib='$sitelib'
23570 sitelib_stem='$sitelib_stem'
23571 sitelibexp='$sitelibexp'
23572 siteman1dir='$siteman1dir'
23573 siteman1direxp='$siteman1direxp'
23574 siteman3dir='$siteman3dir'
23575 siteman3direxp='$siteman3direxp'
23576 siteprefix='$siteprefix'
23577 siteprefixexp='$siteprefixexp'
23578 sitescript='$sitescript'
23579 sitescriptexp='$sitescriptexp'
23580 sizesize='$sizesize'
23581 sizetype='$sizetype'
23582 sleep='$sleep'
23583 smail='$smail'
23584 so='$so'
23585 sockethdr='$sockethdr'
23586 socketlib='$socketlib'
23587 socksizetype='$socksizetype'
23588 sort='$sort'
23589 spackage='$spackage'
23590 spitshell='$spitshell'
23591 srand48_r_proto='$srand48_r_proto'
23592 srandom_r_proto='$srandom_r_proto'
23593 src='$src'
23594 ssizetype='$ssizetype'
23595 st_ino_sign='$st_ino_sign'
23596 st_ino_size='$st_ino_size'
23597 startperl='$startperl'
23598 startsh='$startsh'
23599 static_ext='$static_ext'
23600 stdchar='$stdchar'
23601 stdio_base='$stdio_base'
23602 stdio_bufsiz='$stdio_bufsiz'
23603 stdio_cnt='$stdio_cnt'
23604 stdio_filbuf='$stdio_filbuf'
23605 stdio_ptr='$stdio_ptr'
23606 stdio_stream_array='$stdio_stream_array'
23607 strerror_r_proto='$strerror_r_proto'
23608 strings='$strings'
23609 submit='$submit'
23610 subversion='$subversion'
23611 sysman='$sysman'
23612 tail='$tail'
23613 tar='$tar'
23614 targetarch='$targetarch'
23615 tbl='$tbl'
23616 tee='$tee'
23617 test='$test'
23618 timeincl='$timeincl'
23619 timetype='$timetype'
23620 tmpnam_r_proto='$tmpnam_r_proto'
23621 to='$to'
23622 touch='$touch'
23623 tr='$tr'
23624 trnl='$trnl'
23625 troff='$troff'
23626 ttyname_r_proto='$ttyname_r_proto'
23627 u16size='$u16size'
23628 u16type='$u16type'
23629 u32size='$u32size'
23630 u32type='$u32type'
23631 u64size='$u64size'
23632 u64type='$u64type'
23633 u8size='$u8size'
23634 u8type='$u8type'
23635 uidformat='$uidformat'
23636 uidsign='$uidsign'
23637 uidsize='$uidsize'
23638 uidtype='$uidtype'
23639 uname='$uname'
23640 uniq='$uniq'
23641 uquadtype='$uquadtype'
23642 use5005threads='$use5005threads'
23643 use64bitall='$use64bitall'
23644 use64bitint='$use64bitint'
23645 usecrosscompile='$usecrosscompile'
23646 usedevel='$usedevel'
23647 usedl='$usedl'
23648 usedtrace='$usedtrace'
23649 usefaststdio='$usefaststdio'
23650 useithreads='$useithreads'
23651 usekernprocpathname='$usekernprocpathname'
23652 uselargefiles='$uselargefiles'
23653 uselongdouble='$uselongdouble'
23654 usemallocwrap='$usemallocwrap'
23655 usemorebits='$usemorebits'
23656 usemultiplicity='$usemultiplicity'
23657 usemymalloc='$usemymalloc'
23658 usenm='$usenm'
23659 usensgetexecutablepath='$usensgetexecutablepath'
23660 useopcode='$useopcode'
23661 useperlio='$useperlio'
23662 useposix='$useposix'
23663 usereentrant='$usereentrant'
23664 userelocatableinc='$userelocatableinc'
23665 useshrplib='$useshrplib'
23666 usesitecustomize='$usesitecustomize'
23667 usesocks='$usesocks'
23668 usethreads='$usethreads'
23669 usevendorprefix='$usevendorprefix'
23670 useversionedarchname='$useversionedarchname'
23671 usevfork='$usevfork'
23672 usrinc='$usrinc'
23673 uuname='$uuname'
23674 uvXUformat='$uvXUformat'
23675 uvoformat='$uvoformat'
23676 uvsize='$uvsize'
23677 uvtype='$uvtype'
23678 uvuformat='$uvuformat'
23679 uvxformat='$uvxformat'
23680 vaproto='$vaproto'
23681 vendorarch='$vendorarch'
23682 vendorarchexp='$vendorarchexp'
23683 vendorbin='$vendorbin'
23684 vendorbinexp='$vendorbinexp'
23685 vendorhtml1dir='$vendorhtml1dir'
23686 vendorhtml1direxp='$vendorhtml1direxp'
23687 vendorhtml3dir='$vendorhtml3dir'
23688 vendorhtml3direxp='$vendorhtml3direxp'
23689 vendorlib='$vendorlib'
23690 vendorlib_stem='$vendorlib_stem'
23691 vendorlibexp='$vendorlibexp'
23692 vendorman1dir='$vendorman1dir'
23693 vendorman1direxp='$vendorman1direxp'
23694 vendorman3dir='$vendorman3dir'
23695 vendorman3direxp='$vendorman3direxp'
23696 vendorprefix='$vendorprefix'
23697 vendorprefixexp='$vendorprefixexp'
23698 vendorscript='$vendorscript'
23699 vendorscriptexp='$vendorscriptexp'
23700 version='$version'
23701 version_patchlevel_string='$version_patchlevel_string'
23702 versiononly='$versiononly'
23703 vi='$vi'
23704 xlibpth='$xlibpth'
23705 yacc='$yacc'
23706 yaccflags='$yaccflags'
23707 zcat='$zcat'
23708 zip='$zip'
23709 EOT
23710
23711 : add special variables
23712 $test -f $src/patchlevel.h && \
23713 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23714 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23715 echo "PERL_CONFIG_SH=true" >>config.sh
23716
23717 : propagate old symbols
23718 if $test -f UU/config.sh; then
23719         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23720         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23721                 config.sh config.sh UU/oldconfig.sh |\
23722                 $sort | $uniq -u >UU/oldsyms
23723         set X `$cat UU/oldsyms`
23724         shift
23725         case $# in
23726         0) ;;
23727         *)
23728                 $cat <<EOM
23729 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23730 EOM
23731                 echo ": Variables propagated from previous config.sh file." >>config.sh
23732                 for sym in `$cat UU/oldsyms`; do
23733                         echo "    Propagating $hint variable "'$'"$sym..."
23734                         eval 'tmp="$'"${sym}"'"'
23735                         echo "$tmp" | \
23736                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23737                 done
23738                 ;;
23739         esac
23740 fi
23741
23742 : Finish up by extracting the .SH files
23743 case "$alldone" in
23744 exit)
23745         $rm -rf UU
23746         echo "Extraction done."
23747         exit 0
23748         ;;
23749 cont)
23750         ;;
23751 '')
23752         dflt=''
23753         nostick=true
23754         $cat <<EOM
23755
23756 If you'd like to make any changes to the config.sh file before I begin
23757 to configure things, do it as a shell escape now (e.g. !vi config.sh).
23758
23759 EOM
23760         rp="Press return or use a shell escape to edit config.sh:"
23761         . UU/myread
23762         nostick=''
23763         case "$ans" in
23764         '') ;;
23765         *) : in case they cannot read
23766                 sh 1>&4 -c "$ans";;
23767         esac
23768         ;;
23769 esac
23770
23771 : if this fails, just run all the .SH files by hand
23772 . ./config.sh
23773
23774 echo " "
23775 exec 1>&4
23776 pwd=`pwd`
23777 . ./UU/extract
23778 cd "$pwd"
23779
23780 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23781         dflt=y
23782         case "$silent" in
23783         true) ;;
23784         *)
23785                 $cat <<EOM
23786
23787 Now you need to generate make dependencies by running "$make depend".
23788 You might prefer to run it in background: "$make depend > makedepend.out &"
23789 It can take a while, so you might not want to run it right now.
23790
23791 EOM
23792                 ;;
23793         esac
23794         rp="Run $make depend now?"
23795         . UU/myread
23796         case "$ans" in
23797         y*)
23798                 $make depend && echo "Now you must run '$make'."
23799                 ;;
23800         *)
23801                 echo "You must run '$make depend' then '$make'."
23802                 ;;
23803         esac
23804 elif test -f [Mm]akefile; then
23805         echo " "
23806         echo "Now you must run a $make."
23807 else
23808         echo "Configure done."
23809 fi
23810
23811 if $test -f Policy.sh; then
23812     $cat <<EOM
23813
23814 If you compile $package on a different machine or from a different object
23815 directory, copy the Policy.sh file from this object directory to the
23816 new one before you run Configure -- this will help you with most of
23817 the policy defaults.
23818
23819 EOM
23820 fi
23821 if $test -f config.msg; then
23822     echo "Hmm.  I also noted the following information while running:"
23823     echo " "
23824     $cat config.msg >&4
23825     $rm -f config.msg
23826 fi
23827 $rm -f kit*isdone ark*isdone
23828 $rm -rf UU
23829
23830 : End of Configure
23831