This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Extract out functionality into a function
[perl5.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist package (which contains metaconfig) is available via SVN:
17 #     svn co https://svn.code.sf.net/p/dist/code/trunk/dist
18 #
19 # Though this script was generated by metaconfig from metaunits, it is
20 # OK to send patches against Configure itself. It's up to the Configure
21 # pumpkin to backport the patch to the metaunits if it is accepted.
22 # For more information on patching Configure, see pod/perlhack.pod
23 #
24 # The metaunits are also available from the public git repository:
25 #     http://perl5.git.perl.org/metaconfig.git/ or
26 #     $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
27 #
28 # See Porting/pumpkin.pod for more information on metaconfig.
29 #
30
31 # Generated using [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 ) 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 hostgenerate=''
210 hostosname=''
211 hostperl=''
212 run=''
213 targetarch=''
214 targetdir=''
215 targetenv=''
216 targethost=''
217 targetmkdir=''
218 targetport=''
219 to=''
220 usecrosscompile=''
221 extern_C=''
222 mistrustnm=''
223 usedevel=''
224 perllibs=''
225 dynamic_ext=''
226 extensions=''
227 known_extensions=''
228 nonxs_ext=''
229 static_ext=''
230 useopcode=''
231 useposix=''
232 extras=''
233 d_bsd=''
234 d_eunice=''
235 d_xenix=''
236 eunicefix=''
237 ar=''
238 awk=''
239 bash=''
240 bison=''
241 byacc=''
242 cat=''
243 chgrp=''
244 chmod=''
245 chown=''
246 comm=''
247 compress=''
248 cp=''
249 cpio=''
250 cpp=''
251 csh=''
252 date=''
253 echo=''
254 egrep=''
255 emacs=''
256 expr=''
257 find=''
258 flex=''
259 gmake=''
260 grep=''
261 gzip=''
262 inews=''
263 ksh=''
264 less=''
265 line=''
266 lint=''
267 ln=''
268 lp=''
269 lpr=''
270 ls=''
271 mail=''
272 mailx=''
273 make=''
274 mkdir=''
275 more=''
276 mv=''
277 nm=''
278 nroff=''
279 perl=''
280 pg=''
281 pmake=''
282 pr=''
283 rm=''
284 rmail=''
285 sed=''
286 sendmail=''
287 shar=''
288 sleep=''
289 smail=''
290 sort=''
291 submit=''
292 tail=''
293 tar=''
294 tbl=''
295 tee=''
296 test=''
297 touch=''
298 tr=''
299 troff=''
300 uname=''
301 uniq=''
302 uuname=''
303 vi=''
304 zcat=''
305 zip=''
306 full_ar=''
307 full_sed=''
308 libswanted=''
309 hint=''
310 myuname=''
311 osname=''
312 osvers=''
313 Author=''
314 Date=''
315 Header=''
316 Id=''
317 Locker=''
318 Log=''
319 RCSfile=''
320 Revision=''
321 Source=''
322 State=''
323 sysroot=''
324 _a=''
325 _exe=''
326 _o=''
327 archobjs=''
328 exe_ext=''
329 firstmakefile=''
330 lib_ext=''
331 obj_ext=''
332 path_sep=''
333 rm_try=''
334 afs=''
335 afsroot=''
336 alignbytes=''
337 ansi2knr=''
338 archlib=''
339 archlibexp=''
340 d_archlib=''
341 installarchlib=''
342 archname=''
343 myarchname=''
344 useversionedarchname=''
345 d_atolf=''
346 d_atoll=''
347 baserev=''
348 bin=''
349 binexp=''
350 initialinstalllocation=''
351 installbin=''
352 userelocatableinc=''
353 byteorder=''
354 cc=''
355 ccflags=''
356 cppflags=''
357 ldflags=''
358 lkflags=''
359 locincpth=''
360 optimize=''
361 cf_email=''
362 cf_by=''
363 cf_time=''
364 charbits=''
365 charsize=''
366 contains=''
367 cpp_stuff=''
368 cpplast=''
369 cppminus=''
370 cpprun=''
371 cppstdin=''
372 d__fwalk=''
373 d_access=''
374 d_accessx=''
375 d_acosh=''
376 d_aintl=''
377 d_alarm=''
378 asctime_r_proto=''
379 d_asctime_r=''
380 d_attribute_deprecated=''
381 d_attribute_format=''
382 d_attribute_malloc=''
383 d_attribute_nonnull=''
384 d_attribute_noreturn=''
385 d_attribute_pure=''
386 d_attribute_unused=''
387 d_attribute_warn_unused_result=''
388 d_printf_format_null=''
389 d_backtrace=''
390 d_bcmp=''
391 d_bcopy=''
392 d_builtin_choose_expr=''
393 d_builtin_expect=''
394 d_bzero=''
395 d_c99_variadic_macros=''
396 d_casti32=''
397 castflags=''
398 d_castneg=''
399 d_chown=''
400 d_chroot=''
401 d_chsize=''
402 d_class=''
403 d_clearenv=''
404 d_closedir=''
405 d_void_closedir=''
406 d_cmsghdr_s=''
407 d_const=''
408 d_copysignl=''
409 d_cplusplus=''
410 cryptlib=''
411 d_crypt=''
412 crypt_r_proto=''
413 d_crypt_r=''
414 d_csh=''
415 full_csh=''
416 d_ctermid=''
417 ctermid_r_proto=''
418 d_ctermid_r=''
419 ctime_r_proto=''
420 d_ctime_r=''
421 d_cuserid=''
422 d_dbl_dig=''
423 d_dbminitproto=''
424 d_difftime=''
425 d_dir_dd_fd=''
426 d_dirfd=''
427 d_dladdr=''
428 d_dlerror=''
429 d_dlopen=''
430 d_dlsymun=''
431 d_dosuid=''
432 d_suidsafe=''
433 d_drand48_r=''
434 drand48_r_proto=''
435 d_drand48proto=''
436 d_dup2=''
437 d_eaccess=''
438 d_endgrent=''
439 d_endgrent_r=''
440 endgrent_r_proto=''
441 d_endhent=''
442 d_endhostent_r=''
443 endhostent_r_proto=''
444 d_endnent=''
445 d_endnetent_r=''
446 endnetent_r_proto=''
447 d_endpent=''
448 d_endprotoent_r=''
449 endprotoent_r_proto=''
450 d_endpwent=''
451 d_endpwent_r=''
452 endpwent_r_proto=''
453 d_endsent=''
454 d_endservent_r=''
455 endservent_r_proto=''
456 d_faststdio=''
457 d_fchdir=''
458 d_fchmod=''
459 d_fchown=''
460 d_fcntl=''
461 d_fcntl_can_lock=''
462 d_fd_macros=''
463 d_fd_set=''
464 d_fds_bits=''
465 d_fegetround=''
466 d_fgetpos=''
467 d_finite=''
468 d_finitel=''
469 d_flexfnam=''
470 d_flock=''
471 d_flockproto=''
472 d_fork=''
473 d_fp_class=''
474 d_fp_classl=''
475 d_fpclass=''
476 d_fp_classify=''
477 d_fpclassify=''
478 d_fpclassl=''
479 d_fpgetround=''
480 d_fpos64_t=''
481 d_frexpl=''
482 d_fs_data_s=''
483 d_fseeko=''
484 d_fsetpos=''
485 d_fstatfs=''
486 d_fsync=''
487 d_ftello=''
488 d_ftime=''
489 d_gettimeod=''
490 d_futimes=''
491 d_Gconvert=''
492 d_getaddrinfo=''
493 d_getcwd=''
494 d_getespwnam=''
495 d_getfsstat=''
496 d_getgrent=''
497 d_getgrent_r=''
498 getgrent_r_proto=''
499 d_getgrgid_r=''
500 getgrgid_r_proto=''
501 d_getgrnam_r=''
502 getgrnam_r_proto=''
503 d_getgrps=''
504 d_gethbyaddr=''
505 d_gethbyname=''
506 d_gethent=''
507 aphostname=''
508 d_gethname=''
509 d_phostname=''
510 d_uname=''
511 d_gethostbyaddr_r=''
512 gethostbyaddr_r_proto=''
513 d_gethostbyname_r=''
514 gethostbyname_r_proto=''
515 d_gethostent_r=''
516 gethostent_r_proto=''
517 d_gethostprotos=''
518 d_getitimer=''
519 d_getlogin=''
520 d_getlogin_r=''
521 getlogin_r_proto=''
522 d_getmnt=''
523 d_getmntent=''
524 d_getnameinfo=''
525 d_getnbyaddr=''
526 d_getnbyname=''
527 d_getnent=''
528 d_getnetbyaddr_r=''
529 getnetbyaddr_r_proto=''
530 d_getnetbyname_r=''
531 getnetbyname_r_proto=''
532 d_getnetent_r=''
533 getnetent_r_proto=''
534 d_getnetprotos=''
535 d_getpagsz=''
536 d_getpent=''
537 d_getpgid=''
538 d_getpgrp2=''
539 d_bsdgetpgrp=''
540 d_getpgrp=''
541 d_getppid=''
542 d_getprior=''
543 d_getpbyname=''
544 d_getpbynumber=''
545 d_getprotobyname_r=''
546 getprotobyname_r_proto=''
547 d_getprotobynumber_r=''
548 getprotobynumber_r_proto=''
549 d_getprotoent_r=''
550 getprotoent_r_proto=''
551 d_getprotoprotos=''
552 d_getprpwnam=''
553 d_getpwent=''
554 d_getpwent_r=''
555 getpwent_r_proto=''
556 d_getpwnam_r=''
557 getpwnam_r_proto=''
558 d_getpwuid_r=''
559 getpwuid_r_proto=''
560 d_getsent=''
561 d_getservbyname_r=''
562 getservbyname_r_proto=''
563 d_getservbyport_r=''
564 getservbyport_r_proto=''
565 d_getservent_r=''
566 getservent_r_proto=''
567 d_getservprotos=''
568 d_getspnam=''
569 d_getspnam_r=''
570 getspnam_r_proto=''
571 d_getsbyname=''
572 d_getsbyport=''
573 d_gmtime_r=''
574 gmtime_r_proto=''
575 d_gnulibc=''
576 gnulibc_version=''
577 d_hasmntopt=''
578 d_htonl=''
579 d_ilogbl=''
580 d_inetaton=''
581 d_inetntop=''
582 d_inetpton=''
583 d_int64_t=''
584 d_isascii=''
585 d_isblank=''
586 d_isfinite=''
587 d_isfinitel=''
588 d_isinf=''
589 d_isinfl=''
590 d_isnan=''
591 d_isnanl=''
592 d_j0=''
593 d_j0l=''
594 d_killpg=''
595 d_lchown=''
596 d_ldbl_dig=''
597 d_libm_lib_version=''
598 d_link=''
599 d_localtime_r=''
600 d_localtime_r_needs_tzset=''
601 localtime_r_proto=''
602 d_locconv=''
603 d_lockf=''
604 d_ldexpl=''
605 d_longdbl=''
606 longdblkind=''
607 longdblsize=''
608 d_longlong=''
609 longlongsize=''
610 d_lseekproto=''
611 d_lstat=''
612 d_madvise=''
613 d_malloc_good_size=''
614 d_malloc_size=''
615 d_mblen=''
616 d_mbstowcs=''
617 d_mbtowc=''
618 d_memchr=''
619 d_memcmp=''
620 d_memcpy=''
621 d_memmove=''
622 d_memset=''
623 d_mkdir=''
624 d_mkdtemp=''
625 d_mkfifo=''
626 d_mkstemp=''
627 d_mkstemps=''
628 d_mktime=''
629 d_mmap=''
630 mmaptype=''
631 d_modfl=''
632 d_modfl_pow32_bug=''
633 d_modflproto=''
634 d_mprotect=''
635 d_msg=''
636 d_msgctl=''
637 d_msgget=''
638 d_msghdr_s=''
639 d_msgrcv=''
640 d_msgsnd=''
641 d_msync=''
642 d_munmap=''
643 d_nice=''
644 d_nl_langinfo=''
645 d_off64_t=''
646 d_open3=''
647 d_fpathconf=''
648 d_pathconf=''
649 d_pause=''
650 d_pipe=''
651 d_poll=''
652 d_portable=''
653 d_prctl=''
654 d_prctl_set_name=''
655 d_procselfexe=''
656 procselfexe=''
657 d_old_pthread_create_joinable=''
658 old_pthread_create_joinable=''
659 d_pthread_atfork=''
660 d_pthread_attr_setscope=''
661 d_pthread_yield=''
662 d_sched_yield=''
663 sched_yield=''
664 d_ptrdiff_t=''
665 d_qgcvt=''
666 d_random_r=''
667 random_r_proto=''
668 d_readdir64_r=''
669 readdir64_r_proto=''
670 d_readdir=''
671 d_rewinddir=''
672 d_seekdir=''
673 d_telldir=''
674 d_readdir_r=''
675 readdir_r_proto=''
676 d_readlink=''
677 d_readv=''
678 d_recvmsg=''
679 d_rename=''
680 d_rmdir=''
681 d_safebcpy=''
682 d_safemcpy=''
683 d_sanemcmp=''
684 d_sbrkproto=''
685 d_scalbnl=''
686 d_select=''
687 d_sem=''
688 d_semctl=''
689 d_semget=''
690 d_semop=''
691 d_sendmsg=''
692 d_setegid=''
693 d_seteuid=''
694 d_setgrent=''
695 d_setgrent_r=''
696 setgrent_r_proto=''
697 d_setgrps=''
698 d_sethent=''
699 d_sethostent_r=''
700 sethostent_r_proto=''
701 d_setitimer=''
702 d_setlinebuf=''
703 d_setlocale=''
704 d_setlocale_r=''
705 setlocale_r_proto=''
706 d_setnent=''
707 d_setnetent_r=''
708 setnetent_r_proto=''
709 d_setpent=''
710 d_setpgid=''
711 d_setpgrp2=''
712 d_bsdsetpgrp=''
713 d_setpgrp=''
714 d_setprior=''
715 d_setproctitle=''
716 d_setprotoent_r=''
717 setprotoent_r_proto=''
718 d_setpwent=''
719 d_setpwent_r=''
720 setpwent_r_proto=''
721 d_setregid=''
722 d_setresgid=''
723 d_setresuid=''
724 d_setreuid=''
725 d_setrgid=''
726 d_setruid=''
727 d_setsent=''
728 d_setservent_r=''
729 setservent_r_proto=''
730 d_setsid=''
731 d_setvbuf=''
732 d_shm=''
733 d_shmat=''
734 d_shmatprototype=''
735 shmattype=''
736 d_shmctl=''
737 d_shmdt=''
738 d_shmget=''
739 d_sigaction=''
740 d_signbit=''
741 d_sigprocmask=''
742 d_sigsetjmp=''
743 usesitecustomize=''
744 d_snprintf=''
745 d_vsnprintf=''
746 d_sockatmark=''
747 d_sockatmarkproto=''
748 d_ip_mreq=''
749 d_ip_mreq_source=''
750 d_ipv6_mreq=''
751 d_ipv6_mreq_source=''
752 d_msg_ctrunc=''
753 d_msg_dontroute=''
754 d_msg_oob=''
755 d_msg_peek=''
756 d_msg_proxy=''
757 d_oldsock=''
758 d_scm_rights=''
759 d_sin6_scope_id=''
760 d_sockaddr_in6=''
761 d_sockaddr_sa_len=''
762 d_socket=''
763 d_sockpair=''
764 sockethdr=''
765 socketlib=''
766 d_socklen_t=''
767 d_socks5_init=''
768 d_sprintf_returns_strlen=''
769 d_sqrtl=''
770 d_srand48_r=''
771 srand48_r_proto=''
772 d_srandom_r=''
773 srandom_r_proto=''
774 d_sresgproto=''
775 d_sresuproto=''
776 d_statblks=''
777 d_statfs_f_flags=''
778 d_statfs_s=''
779 d_static_inline=''
780 perl_static_inline=''
781 d_fstatvfs=''
782 d_statvfs=''
783 d_stdio_cnt_lval=''
784 d_stdio_ptr_lval=''
785 d_stdio_ptr_lval_nochange_cnt=''
786 d_stdio_ptr_lval_sets_cnt=''
787 d_stdiobase=''
788 d_stdstdio=''
789 stdio_base=''
790 stdio_bufsiz=''
791 stdio_cnt=''
792 stdio_filbuf=''
793 stdio_ptr=''
794 d_index=''
795 d_strchr=''
796 d_strcoll=''
797 d_strctcpy=''
798 d_strerrm=''
799 d_strerror=''
800 d_sysernlst=''
801 d_syserrlst=''
802 d_strerror_r=''
803 strerror_r_proto=''
804 d_strftime=''
805 d_strlcat=''
806 d_strlcpy=''
807 d_strtod=''
808 d_strtol=''
809 d_strtold=''
810 d_strtoll=''
811 d_strtoq=''
812 d_strtoul=''
813 d_strtoull=''
814 d_strtouq=''
815 d_strxfrm=''
816 d_symlink=''
817 d_syscall=''
818 d_syscallproto=''
819 d_sysconf=''
820 d_system=''
821 d_tcgetpgrp=''
822 d_tcsetpgrp=''
823 d_telldirproto=''
824 d_time=''
825 timetype=''
826 d_asctime64=''
827 d_ctime64=''
828 d_difftime64=''
829 d_gmtime64=''
830 d_localtime64=''
831 d_mktime64=''
832 d_timegm=''
833 clocktype=''
834 d_times=''
835 d_tmpnam_r=''
836 tmpnam_r_proto=''
837 d_truncate=''
838 d_ttyname_r=''
839 ttyname_r_proto=''
840 d_tzname=''
841 d_u32align=''
842 d_ualarm=''
843 d_umask=''
844 d_semctl_semid_ds=''
845 d_semctl_semun=''
846 d_union_semun=''
847 d_unordered=''
848 d_unsetenv=''
849 d_usleep=''
850 d_usleepproto=''
851 d_ustat=''
852 d_pseudofork=''
853 d_vfork=''
854 usevfork=''
855 d_voidsig=''
856 signal_t=''
857 d_volatile=''
858 d_charvspr=''
859 d_vprintf=''
860 d_wait4=''
861 d_waitpid=''
862 d_wcscmp=''
863 d_wcstombs=''
864 d_wcsxfrm=''
865 d_wctomb=''
866 d_writev=''
867 dlext=''
868 bin_ELF=''
869 cccdlflags=''
870 ccdlflags=''
871 dlsrc=''
872 ld=''
873 ld_can_script=''
874 lddlflags=''
875 usedl=''
876 doublesize=''
877 ebcdic=''
878 fflushNULL=''
879 fflushall=''
880 fpossize=''
881 fpostype=''
882 gccansipedantic=''
883 gccosandvers=''
884 gccversion=''
885 gidformat=''
886 gidsign=''
887 gidsize=''
888 gidtype=''
889 groupstype=''
890 h_fcntl=''
891 h_sysfile=''
892 html1dir=''
893 html1direxp=''
894 installhtml1dir=''
895 html3dir=''
896 html3direxp=''
897 installhtml3dir=''
898 i_arpainet=''
899 i_assert=''
900 i_bfd=''
901 i_crypt=''
902 db_hashtype=''
903 db_prefixtype=''
904 db_version_major=''
905 db_version_minor=''
906 db_version_patch=''
907 i_db=''
908 i_dbm=''
909 i_rpcsvcdbm=''
910 d_dirnamlen=''
911 direntrytype=''
912 i_dirent=''
913 i_dlfcn=''
914 i_execinfo=''
915 i_fcntl=''
916 i_fenv=''
917 i_float=''
918 i_fp=''
919 i_fp_class=''
920 i_gdbm=''
921 d_grpasswd=''
922 i_grp=''
923 i_ieeefp=''
924 i_inttypes=''
925 i_langinfo=''
926 i_libutil=''
927 i_limits=''
928 i_locale=''
929 i_machcthr=''
930 i_malloc=''
931 i_mallocmalloc=''
932 i_math=''
933 i_memory=''
934 i_mntent=''
935 d_gdbm_ndbm_h_uses_prototypes=''
936 d_gdbmndbm_h_uses_prototypes=''
937 d_ndbm=''
938 d_ndbm_h_uses_prototypes=''
939 i_gdbm_ndbm=''
940 i_gdbmndbm=''
941 i_ndbm=''
942 i_netdb=''
943 i_neterrno=''
944 i_netinettcp=''
945 i_niin=''
946 i_sysin=''
947 i_poll=''
948 i_prot=''
949 i_pthread=''
950 d_pwage=''
951 d_pwchange=''
952 d_pwclass=''
953 d_pwcomment=''
954 d_pwexpire=''
955 d_pwgecos=''
956 d_pwpasswd=''
957 d_pwquota=''
958 i_pwd=''
959 i_shadow=''
960 i_socks=''
961 i_stdbool=''
962 i_stddef=''
963 i_stdint=''
964 i_stdlib=''
965 i_string=''
966 strings=''
967 i_sunmath=''
968 i_sysaccess=''
969 i_sysdir=''
970 i_sysfile=''
971 d_voidtty=''
972 i_bsdioctl=''
973 i_sysfilio=''
974 i_sysioctl=''
975 i_syssockio=''
976 i_syslog=''
977 i_sysmman=''
978 i_sysmode=''
979 i_sysmount=''
980 i_sysndir=''
981 i_sysparam=''
982 i_syspoll=''
983 i_sysresrc=''
984 i_syssecrt=''
985 i_sysselct=''
986 i_sysstat=''
987 i_sysstatfs=''
988 i_sysstatvfs=''
989 i_systimes=''
990 i_systypes=''
991 i_sysuio=''
992 i_sysun=''
993 i_sysutsname=''
994 i_sysvfs=''
995 i_syswait=''
996 i_sgtty=''
997 i_termio=''
998 i_termios=''
999 d_tm_tm_gmtoff=''
1000 d_tm_tm_zone=''
1001 i_systime=''
1002 i_systimek=''
1003 i_time=''
1004 timeincl=''
1005 i_unistd=''
1006 i_ustat=''
1007 i_utime=''
1008 i_values=''
1009 i_stdarg=''
1010 i_varargs=''
1011 i_varhdr=''
1012 i_vfork=''
1013 d_inc_version_list=''
1014 inc_version_list=''
1015 inc_version_list_init=''
1016 installprefix=''
1017 installprefixexp=''
1018 installstyle=''
1019 installusrbinperl=''
1020 intsize=''
1021 longsize=''
1022 shortsize=''
1023 issymlink=''
1024 libc=''
1025 ldlibpthname=''
1026 libperl=''
1027 shrpenv=''
1028 useshrplib=''
1029 glibpth=''
1030 incpth=''
1031 libpth=''
1032 loclibpth=''
1033 plibpth=''
1034 xlibpth=''
1035 ignore_versioned_solibs=''
1036 libs=''
1037 libsdirs=''
1038 libsfiles=''
1039 libsfound=''
1040 libspath=''
1041 lns=''
1042 d_PRIEUldbl=''
1043 d_PRIFUldbl=''
1044 d_PRIGUldbl=''
1045 d_PRIeldbl=''
1046 d_PRIfldbl=''
1047 d_PRIgldbl=''
1048 d_SCNfldbl=''
1049 sPRIEUldbl=''
1050 sPRIFUldbl=''
1051 sPRIGUldbl=''
1052 sPRIeldbl=''
1053 sPRIfldbl=''
1054 sPRIgldbl=''
1055 sSCNfldbl=''
1056 lseeksize=''
1057 lseektype=''
1058 make_set_make=''
1059 d_mymalloc=''
1060 freetype=''
1061 mallocobj=''
1062 mallocsrc=''
1063 malloctype=''
1064 usemallocwrap=''
1065 usemymalloc=''
1066 installman1dir=''
1067 man1dir=''
1068 man1direxp=''
1069 man1ext=''
1070 installman3dir=''
1071 man3dir=''
1072 man3direxp=''
1073 man3ext=''
1074 modetype=''
1075 multiarch=''
1076 mydomain=''
1077 myhostname=''
1078 phostname=''
1079 c=''
1080 n=''
1081 d_eofnblk=''
1082 eagain=''
1083 o_nonblock=''
1084 rd_nodata=''
1085 need_va_copy=''
1086 netdb_hlen_type=''
1087 netdb_host_type=''
1088 netdb_name_type=''
1089 netdb_net_type=''
1090 groupcat=''
1091 hostcat=''
1092 passcat=''
1093 orderlib=''
1094 ranlib=''
1095 d_perl_otherlibdirs=''
1096 otherlibdirs=''
1097 package=''
1098 spackage=''
1099 pager=''
1100 api_revision=''
1101 api_subversion=''
1102 api_version=''
1103 api_versionstring=''
1104 patchlevel=''
1105 perl_patchlevel=''
1106 revision=''
1107 subversion=''
1108 version=''
1109 version_patchlevel_string=''
1110 perl5=''
1111 perladmin=''
1112 perlpath=''
1113 d_nv_preserves_uv=''
1114 d_nv_zero_is_allbits_zero=''
1115 i16size=''
1116 i16type=''
1117 i32size=''
1118 i32type=''
1119 i64size=''
1120 i64type=''
1121 i8size=''
1122 i8type=''
1123 ivsize=''
1124 ivtype=''
1125 nv_overflows_integers_at=''
1126 nv_preserves_uv_bits=''
1127 nvsize=''
1128 nvtype=''
1129 u16size=''
1130 u16type=''
1131 u32size=''
1132 u32type=''
1133 u64size=''
1134 u64type=''
1135 u8size=''
1136 u8type=''
1137 uvsize=''
1138 uvtype=''
1139 ivdformat=''
1140 nvEUformat=''
1141 nvFUformat=''
1142 nvGUformat=''
1143 nveformat=''
1144 nvfformat=''
1145 nvgformat=''
1146 uvXUformat=''
1147 uvoformat=''
1148 uvuformat=''
1149 uvxformat=''
1150 pidtype=''
1151 prefix=''
1152 prefixexp=''
1153 installprivlib=''
1154 privlib=''
1155 privlibexp=''
1156 prototype=''
1157 ptrsize=''
1158 d_PRIXU64=''
1159 d_PRId64=''
1160 d_PRIi64=''
1161 d_PRIo64=''
1162 d_PRIu64=''
1163 d_PRIx64=''
1164 sPRIXU64=''
1165 sPRId64=''
1166 sPRIi64=''
1167 sPRIo64=''
1168 sPRIu64=''
1169 sPRIx64=''
1170 d_quad=''
1171 quadkind=''
1172 quadtype=''
1173 uquadtype=''
1174 drand01=''
1175 randbits=''
1176 randfunc=''
1177 randseedtype=''
1178 seedfunc=''
1179 installscript=''
1180 scriptdir=''
1181 scriptdirexp=''
1182 selectminbits=''
1183 selecttype=''
1184 sh=''
1185 targetsh=''
1186 sig_count=''
1187 sig_name=''
1188 sig_name_init=''
1189 sig_num=''
1190 sig_num_init=''
1191 sig_size=''
1192 d_sitearch=''
1193 installsitearch=''
1194 sitearch=''
1195 sitearchexp=''
1196 installsitebin=''
1197 sitebin=''
1198 sitebinexp=''
1199 installsitehtml1dir=''
1200 sitehtml1dir=''
1201 sitehtml1direxp=''
1202 installsitehtml3dir=''
1203 sitehtml3dir=''
1204 sitehtml3direxp=''
1205 installsitelib=''
1206 sitelib=''
1207 sitelib_stem=''
1208 sitelibexp=''
1209 installsiteman1dir=''
1210 siteman1dir=''
1211 siteman1direxp=''
1212 installsiteman3dir=''
1213 siteman3dir=''
1214 siteman3direxp=''
1215 siteprefix=''
1216 siteprefixexp=''
1217 installsitescript=''
1218 sitescript=''
1219 sitescriptexp=''
1220 sizesize=''
1221 sizetype=''
1222 d_libname_unique=''
1223 so=''
1224 socksizetype=''
1225 sharpbang=''
1226 shsharp=''
1227 spitshell=''
1228 src=''
1229 ssizetype=''
1230 st_ino_sign=''
1231 st_ino_size=''
1232 startperl=''
1233 startsh=''
1234 stdchar=''
1235 d_stdio_stream_array=''
1236 stdio_stream_array=''
1237 sysman=''
1238 sGMTIME_max=''
1239 sGMTIME_min=''
1240 sLOCALTIME_max=''
1241 sLOCALTIME_min=''
1242 trnl=''
1243 uidformat=''
1244 uidsign=''
1245 uidsize=''
1246 uidtype=''
1247 archname64=''
1248 use64bitall=''
1249 use64bitint=''
1250 usecbacktrace=''
1251 dtrace=''
1252 usedtrace=''
1253 usefaststdio=''
1254 usekernprocpathname=''
1255 ccflags_uselargefiles=''
1256 ldflags_uselargefiles=''
1257 libswanted_uselargefiles=''
1258 uselargefiles=''
1259 uselongdouble=''
1260 usemorebits=''
1261 usemultiplicity=''
1262 nm_opt=''
1263 nm_so_opt=''
1264 runnm=''
1265 usenm=''
1266 usensgetexecutablepath=''
1267 useperlio=''
1268 usesocks=''
1269 d_oldpthreads=''
1270 use5005threads=''
1271 useithreads=''
1272 usereentrant=''
1273 usethreads=''
1274 incpath=''
1275 mips_type=''
1276 usrinc=''
1277 vaproto=''
1278 d_vendorarch=''
1279 installvendorarch=''
1280 vendorarch=''
1281 vendorarchexp=''
1282 d_vendorbin=''
1283 installvendorbin=''
1284 vendorbin=''
1285 vendorbinexp=''
1286 installvendorhtml1dir=''
1287 vendorhtml1dir=''
1288 vendorhtml1direxp=''
1289 installvendorhtml3dir=''
1290 vendorhtml3dir=''
1291 vendorhtml3direxp=''
1292 d_vendorlib=''
1293 installvendorlib=''
1294 vendorlib=''
1295 vendorlib_stem=''
1296 vendorlibexp=''
1297 installvendorman1dir=''
1298 vendorman1dir=''
1299 vendorman1direxp=''
1300 installvendorman3dir=''
1301 vendorman3dir=''
1302 vendorman3direxp=''
1303 usevendorprefix=''
1304 vendorprefix=''
1305 vendorprefixexp=''
1306 d_vendorscript=''
1307 installvendorscript=''
1308 vendorscript=''
1309 vendorscriptexp=''
1310 versiononly=''
1311 yacc=''
1312 yaccflags=''
1313 CONFIG=''
1314
1315 : Detect odd OSs
1316 define='define'
1317 undef='undef'
1318 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1319 rmlist=''
1320
1321 : We must find out about Eunice early
1322 eunicefix=':'
1323 if test -f /etc/unixtovms; then
1324         eunicefix=/etc/unixtovms
1325 fi
1326 if test -f /etc/unixtovms.exe; then
1327         eunicefix=/etc/unixtovms.exe
1328 fi
1329
1330 : Set executable suffix now -- needed before hints available
1331 if test -f "/libs/version.library"; then
1332 : Amiga OS
1333     _exe=""
1334 elif test -f "/system/gnu_library/bin/ar.pm"; then
1335 : Stratus VOS
1336     _exe=".pm"
1337 elif test -n "$DJGPP"; then
1338 : DOS DJGPP
1339     _exe=".exe"
1340 elif test -f /kern/cookiejar; then
1341 : MiNT
1342     _exe=""
1343 elif test -d c:/. -o -n "$is_os2" ; then
1344 : OS/2 or cygwin
1345     _exe=".exe"
1346 fi
1347
1348 groupstype=''
1349 i_whoami=''
1350 : Trailing extension.  Override this in a hint file, if needed.
1351 : Extra object files, if any, needed on this platform.
1352 archobjs=''
1353 archname=''
1354 : Possible local include directories to search.
1355 : Set locincpth to "" in a hint file to defeat local include searches.
1356 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1357 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1358 :
1359 : no include file wanted by default
1360 inclwanted=''
1361
1362 : Enable -DEBUGGING and -DDEBUGGING from the command line
1363 EBUGGING=''
1364 DEBUGGING=''
1365
1366 libnames=''
1367 : change the next line if compiling for Xenix/286 on Xenix/386
1368 xlibpth='/usr/lib/386 /lib/386'
1369 : Possible local library directories to search.
1370 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1371 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1372
1373 : general looking path for locating libraries
1374 glibpth="/lib /usr/lib $xlibpth"
1375 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1376 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1377 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1378 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1379
1380 : Private path used by Configure to find libraries.  Its value
1381 : is prepended to libpth. This variable takes care of special
1382 : machines, like the mips.  Usually, it should be empty.
1383 plibpth=''
1384
1385 : default library list
1386 libswanted=''
1387 : some systems want to use only the non-versioned libso:s
1388 ignore_versioned_solibs=''
1389 : set usethreads on the Configure command line to enable threads.
1390 usereentrant='undef'
1391 ccname=''
1392 ccversion=''
1393 perllibs=''
1394 : set useposix=false in your hint file to disable the POSIX extension.
1395 useposix=true
1396 : set useopcode=false in your hint file to disable the Opcode extension.
1397 useopcode=true
1398 archname64=''
1399 ccflags_uselargefiles=''
1400 ldflags_uselargefiles=''
1401 libswanted_uselargefiles=''
1402 : set usemultiplicity on the Configure command line to enable multiplicity.
1403 : set usesocks on the Configure command line to enable socks.
1404 : List of libraries we want.
1405 : If anyone needs extra -lxxx, put those in a hint file.
1406 libswanted="socket bind inet nsl nm ndbm gdbm dbm db malloc dl ld sun"
1407 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1408 : We probably want to search /usr/shlib before most other libraries.
1409 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1410 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1411 glibpth="/usr/shlib $glibpth"
1412 : Do not use vfork unless overridden by a hint file.
1413 usevfork=false
1414
1415 : Find the basic shell for Bourne shell scripts
1416 case "$sh" in
1417 '')
1418         case "$SYSTYPE" in
1419         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1420         *) xxx='/bin/sh';;
1421         esac
1422         if test -f "$xxx"; then
1423                 sh="$xxx"
1424         else
1425                 : Build up a list and do a single loop so we can 'break' out.
1426                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1427                 for xxx in sh bash ksh pdksh ash; do
1428                         for p in $pth; do
1429                                 try="$try ${p}/${xxx}"
1430                         done
1431                 done
1432                 for xxx in $try; do
1433                         if test -f "$xxx"; then
1434                                 sh="$xxx";
1435                                 break
1436                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1437                                 sh="$xxx";
1438                                 break
1439                         elif test -f "$xxx.exe"; then
1440                                 sh="$xxx";
1441                                 break
1442                         fi
1443                 done
1444         fi
1445         ;;
1446 esac
1447
1448 case "$sh" in
1449 '')     cat >&2 <<EOM
1450 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1451
1452 Usually it's in /bin/sh.  How did you even get this far?
1453 Please contact me (Perl Maintainers) at perlbug@perl.org and
1454 we'll try to straighten this all out.
1455 EOM
1456         exit 1
1457         ;;
1458 esac
1459
1460 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1461 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1462 targetsh=$sh
1463
1464 : see if sh knows # comments
1465 if `$sh -c '#' >/dev/null 2>&1`; then
1466         shsharp=true
1467         spitshell=cat
1468         xcat=/bin/cat
1469         test -f $xcat$_exe || xcat=/usr/bin/cat
1470         if test ! -f $xcat$_exe; then
1471                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1472                         if test -f $p/cat$_exe; then
1473                                 xcat=$p/cat
1474                                 break
1475                         fi
1476                 done
1477                 if test ! -f $xcat$_exe; then
1478                         echo "Can't find cat anywhere!"
1479                         exit 1
1480                 fi
1481         fi
1482         echo "#!$xcat" >sharp
1483         $eunicefix sharp
1484         chmod +x sharp
1485         ./sharp > today 2>/dev/null
1486         if test -s today; then
1487                 sharpbang='#!'
1488         else
1489                 echo "#! $xcat" > sharp
1490                 $eunicefix sharp
1491                 chmod +x sharp
1492                 ./sharp > today 2>/dev/null
1493                 if test -s today; then
1494                         sharpbang='#! '
1495                 else
1496                         sharpbang=': use '
1497                 fi
1498         fi
1499 else
1500         echo " "
1501         echo "Your $sh doesn't grok # comments--I will strip them later on."
1502         shsharp=false
1503         cd ..
1504         echo "exec grep -v '^[  ]*#'" >spitshell
1505         chmod +x spitshell
1506         $eunicefix spitshell
1507         spitshell=`pwd`/spitshell
1508         cd UU
1509         echo "I presume that if # doesn't work, #! won't work either!"
1510         sharpbang=': use '
1511 fi
1512 rm -f sharp today
1513
1514 : figure out how to guarantee sh startup
1515 case "$startsh" in
1516 '') startsh=${sharpbang}${sh} ;;
1517 *)
1518 esac
1519 cat >sharp <<EOSS
1520 $startsh
1521 set abc
1522 test "$?abc" != 1
1523 EOSS
1524
1525 chmod +x sharp
1526 $eunicefix sharp
1527 if ./sharp; then
1528         : echo "Yup, it does."
1529 else
1530         echo "Hmm... '$startsh' does not guarantee sh startup..."
1531         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1532 fi
1533 rm -f sharp
1534
1535 : Save command line options in file UU/cmdline.opt for later use in
1536 : generating config.sh.
1537 cat > cmdline.opt <<EOSH
1538 : Configure command line arguments.
1539 config_arg0='$0'
1540 config_args='$*'
1541 config_argc=$#
1542 EOSH
1543 argn=1
1544 args_exp=''
1545 args_sep=''
1546 for arg in "$@"; do
1547         cat >>cmdline.opt <<EOSH
1548 config_arg$argn='$arg'
1549 EOSH
1550         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1551 $arg
1552 EOC
1553         arg_exp=`cat cmdl.opt`
1554         args_exp="$args_exp$args_sep'$arg_exp'"
1555         argn=`expr $argn + 1`
1556         args_sep=' '
1557 done
1558 rm -f cmdl.opt
1559
1560 : produce awk script to parse command line options
1561 cat >options.awk <<'EOF'
1562 BEGIN {
1563         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1564
1565         len = length(optstr);
1566         for (i = 1; i <= len; i++) {
1567                 c = substr(optstr, i, 1);
1568                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1569                 if (a == ":") {
1570                         arg[c] = 1;
1571                         i++;
1572                 }
1573                 opt[c] = 1;
1574         }
1575 }
1576 {
1577         expect = 0;
1578         str = $0;
1579         if (substr(str, 1, 1) != "-") {
1580                 printf("'%s'\n", str);
1581                 next;
1582         }
1583         len = length($0);
1584         for (i = 2; i <= len; i++) {
1585                 c = substr(str, i, 1);
1586                 if (!opt[c]) {
1587                         printf("-%s\n", substr(str, i));
1588                         next;
1589                 }
1590                 printf("-%s\n", c);
1591                 if (arg[c]) {
1592                         if (i < len)
1593                                 printf("'%s'\n", substr(str, i + 1));
1594                         else
1595                                 expect = 1;
1596                         next;
1597                 }
1598         }
1599 }
1600 END {
1601         if (expect)
1602                 print "?";
1603 }
1604 EOF
1605
1606 : process the command line options
1607 set X `for arg in "$@"; do echo "X$arg"; done |
1608         sed -e s/X// | awk -f options.awk`
1609 eval "set $*"
1610 shift
1611 rm -f options.awk
1612
1613 : set up default values
1614 fastread=''
1615 reuseval=false
1616 config_sh=''
1617 alldone=''
1618 error=''
1619 silent=''
1620 extractsh=''
1621 override=''
1622 knowitall=''
1623 rm -f optdef.sh posthint.sh
1624 cat >optdef.sh <<EOS
1625 $startsh
1626 EOS
1627
1628
1629 : option parsing
1630 while test $# -gt 0; do
1631         case "$1" in
1632         -d) shift; fastread=yes;;
1633         -e) shift; alldone=cont;;
1634         -f)
1635                 shift
1636                 cd ..
1637                 if test -r "$1"; then
1638                         config_sh="$1"
1639                 else
1640                         echo "$me: cannot read config file $1." >&2
1641                         error=true
1642                 fi
1643                 cd UU
1644                 shift;;
1645         --help|\
1646         -h) shift; error=true;;
1647         -r) shift; reuseval=true;;
1648         -s) shift; silent=true; realsilent=true;;
1649         -E) shift; alldone=exit;;
1650         -K) shift; knowitall=true;;
1651         -O) shift; override=true;;
1652         -S) shift; silent=true; extractsh=true;;
1653         -D)
1654                 shift
1655                 case "$1" in
1656                 *=)
1657                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1658                         echo "$me: ignoring -D $1" >&2
1659                         ;;
1660                 *=*) echo "$1" | \
1661                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1662                 *) echo "$1='define'" >> optdef.sh;;
1663                 esac
1664                 shift
1665                 ;;
1666         -U)
1667                 shift
1668                 case "$1" in
1669                 *=) echo "$1" >> optdef.sh;;
1670                 *=*)
1671                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1672                         echo "$me: ignoring -U $1" >&2
1673                         ;;
1674                 *) echo "$1='undef'" >> optdef.sh;;
1675                 esac
1676                 shift
1677                 ;;
1678         -A)
1679             shift
1680             xxx=''
1681             yyy="$1"
1682             zzz=''
1683             uuu=undef
1684             case "$yyy" in
1685             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1686                  case "$zzz" in
1687                  *:*) zzz='' ;;
1688                  *)   xxx=append
1689                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1690                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1691                  esac
1692                  ;;
1693             esac
1694             case "$xxx" in
1695             '')  case "$yyy" in
1696                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1697                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1698                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1699                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1700                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1701                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1702                  esac
1703                  ;;
1704             esac
1705             case "$xxx" in
1706             append)
1707                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1708             clear)
1709                 echo "$yyy=''"                  >> posthint.sh ;;
1710             define)
1711                 case "$zzz" in
1712                 '') zzz=define ;;
1713                 esac
1714                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1715             eval)
1716                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1717             prepend)
1718                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1719             undef)
1720                 case "$zzz" in
1721                 '') zzz="$uuu" ;;
1722                 esac
1723                 echo "$yyy=$zzz"                >> posthint.sh ;;
1724             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1725             esac
1726             shift
1727             ;;
1728         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1729             exit 0;;
1730         --) break;;
1731         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1732         *) break;;
1733         esac
1734 done
1735
1736 case "$error" in
1737 true)
1738         cat >&2 <<EOM
1739 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1740                  [-U symbol] [-U symbol=] [-A command:symbol...]
1741   -d : use defaults for all answers.
1742   -e : go on without questioning past the production of config.sh.
1743   -f : specify an alternate default configuration file.
1744   -h : print this help message and exit (with an error status).
1745   -r : reuse C symbols value if possible (skips costly nm extraction).
1746   -s : silent mode, only echoes questions and essential information.
1747   -D : define symbol to have some value:
1748          -D symbol         symbol gets the value 'define'
1749          -D symbol=value   symbol gets the value 'value'
1750        common used examples (see INSTALL for more info):
1751          -Duse64bitint            use 64bit integers
1752          -Duse64bitall            use 64bit integers and pointers
1753          -Dusethreads             use thread support
1754          -Dinc_version_list=none  do not include older perl trees in @INC
1755          -DEBUGGING=none          DEBUGGING options
1756          -Dcc=gcc                 choose your compiler
1757          -Dprefix=/opt/perl5      choose your destination
1758   -E : stop at the end of questions, after having produced config.sh.
1759   -K : do not use unless you know what you are doing.
1760   -O : let -D and -U override definitions from loaded configuration file.
1761   -S : perform variable substitutions on all .SH files (can mix with -f)
1762   -U : undefine symbol:
1763          -U symbol    symbol gets the value 'undef'
1764          -U symbol=   symbol gets completely empty
1765        e.g.:  -Uversiononly
1766   -A : manipulate symbol after the platform specific hints have been applied:
1767          -A append:symbol=value   append value to symbol
1768          -A symbol=value          like append:, but with a separating space
1769          -A define:symbol=value   define symbol to have value
1770          -A clear:symbol          define symbol to be ''
1771          -A define:symbol         define symbol to be 'define'
1772          -A eval:symbol=value     define symbol to be eval of value
1773          -A prepend:symbol=value  prepend value to symbol
1774          -A undef:symbol          define symbol to be 'undef'
1775          -A undef:symbol=         define symbol to be ''
1776        e.g.:  -A prepend:libswanted='cl pthread '
1777               -A ccflags=-DSOME_MACRO
1778   -V : print version number and exit (with a zero status).
1779 EOM
1780         exit 1
1781         ;;
1782 esac
1783
1784 : Sanity checks
1785 case "$fastread$alldone" in
1786 yescont|yesexit) ;;
1787 *)
1788         case "$extractsh" in
1789         true) ;;
1790         *)
1791                 if test ! -t 0; then
1792                         echo "Say 'sh Configure', not 'sh <Configure'"
1793                         exit 1
1794                 fi
1795                 ;;
1796         esac
1797         ;;
1798 esac
1799
1800 exec 4>&1
1801 case "$silent" in
1802 true) exec 1>/dev/null;;
1803 esac
1804
1805 : run the defines and the undefines, if any, but leave the file out there...
1806 touch optdef.sh
1807 . ./optdef.sh
1808 : create the posthint manipulation script and leave the file out there...
1809 touch posthint.sh
1810
1811 : set package name
1812 package='perl5'
1813 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1814 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1815 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1816 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1817 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1818 esac
1819
1820 : Some greps do not return status, grrr.
1821 echo "grimblepritz" >grimble
1822 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1823         contains=contains
1824 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1825         contains=grep
1826 else
1827         contains=contains
1828 fi
1829 rm -f grimble
1830 : the following should work in any shell
1831 case "$contains" in
1832 contains*)
1833         echo " "
1834         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1835         cat >contains <<'EOSS'
1836 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1837 EOSS
1838 chmod +x contains
1839 esac
1840
1841 : Find the path to the source tree
1842 case "$src" in
1843 '') case "$0" in
1844     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1845          case "$src" in
1846          /*)    ;;
1847          .)     ;;
1848          *)     src=`cd ../$src && pwd` ;;
1849          esac
1850          ;;
1851     *)   src='.';;
1852     esac;;
1853 esac
1854 case "$src" in
1855 '')     src=/
1856         rsrc=/
1857         ;;
1858 /*)     rsrc="$src";;
1859 *)      rsrc="../$src";;
1860 esac
1861 if test -f $rsrc/Configure && \
1862         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1863 then
1864    : found it, so we are ok.
1865 else
1866         rsrc=''
1867         for src in . .. ../.. ../../.. ../../../..; do
1868                 if test -f ../$src/Configure && \
1869                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1870                 then
1871                         rsrc=../$src
1872                         break
1873                 fi
1874         done
1875 fi
1876 case "$rsrc" in
1877 '')
1878         cat <<EOM >&4
1879
1880 Sorry, I can't seem to locate the source dir for $package.  Please start
1881 Configure with an explicit path -- i.e. /some/path/Configure.
1882
1883 EOM
1884         exit 1
1885         ;;
1886 ../.)   rsrc='..';;
1887 *)
1888         echo " "
1889         echo "Sources for $package found in \"$src\"." >&4
1890         ;;
1891 esac
1892
1893 : script used to extract .SH files with variable substitutions
1894 cat >extract <<'EOS'
1895 PERL_CONFIG_SH=true
1896 echo "Doing variable substitutions on .SH files..."
1897 if test -f MANIFEST; then
1898         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1899 else
1900         echo "(Looking for .SH files under the source directory.)"
1901         set x `(cd "$src"; find . -name "*.SH" -print)`
1902 fi
1903 shift
1904 case $# in
1905 0) set x `(cd "$src"; echo *.SH)`; shift;;
1906 esac
1907 if test ! -f "$src/$1"; then
1908         shift
1909 fi
1910 mkdir_p='
1911 name=$1;
1912 create="";
1913 while test $name; do
1914         if test ! -d "$name"; then
1915                 create="$name $create";
1916                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1917                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1918         else
1919                 name="";
1920         fi;
1921 done;
1922 for file in $create; do
1923         mkdir $file;
1924 done
1925 '
1926 for file in $*; do
1927         case "$src" in
1928         ".")
1929                 case "$file" in
1930                 */*)
1931                         dir=`expr X$file : 'X\(.*\)/'`
1932                         file=`expr X$file : 'X.*/\(.*\)'`
1933                         (cd "$dir" && . ./$file)
1934                         ;;
1935                 *)
1936                         . ./$file
1937                         ;;
1938                 esac
1939                 ;;
1940         *)
1941                 case "$file" in
1942                 */*)
1943                         dir=`expr X$file : 'X\(.*\)/'`
1944                         file=`expr X$file : 'X.*/\(.*\)'`
1945                         (set x $dir; shift; eval $mkdir_p)
1946                         sh <"$src/$dir/$file"
1947                         ;;
1948                 *)
1949                         sh <"$src/$file"
1950                         ;;
1951                 esac
1952                 ;;
1953         esac
1954 done
1955 if test -f "$src/config_h.SH"; then
1956         if test ! -f config.h; then
1957         : oops, they left it out of MANIFEST, probably, so do it anyway.
1958         . "$src/config_h.SH"
1959         fi
1960 fi
1961 EOS
1962
1963 : extract files and exit if asked to do so
1964 case "$extractsh" in
1965 true)
1966         case "$realsilent" in
1967         true) ;;
1968         *) exec 1>&4;;
1969         esac
1970         case "$config_sh" in
1971         '') config_sh='config.sh';;
1972         esac
1973         echo " "
1974         echo "Fetching answers from $config_sh..."
1975         cd ..
1976         . $config_sh
1977         test "$override" && . ./optdef.sh
1978         echo " "
1979         . UU/extract
1980         rm -rf UU
1981         echo "Extraction done."
1982         exit 0
1983         ;;
1984 esac
1985
1986 : Eunice requires " " instead of "", can you believe it
1987 echo " "
1988 : Here we go...
1989 echo "Beginning of configuration questions for $package."
1990
1991 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1992
1993 : first determine how to suppress newline on echo command
1994 echo " "
1995 echo "Checking echo to see how to suppress newlines..."
1996 (echo "hi there\c" ; echo " ") >.echotmp
1997 if $contains c .echotmp >/dev/null 2>&1 ; then
1998         echo "...using -n."
1999         n='-n'
2000         c=''
2001 else
2002         cat <<'EOM'
2003 ...using \c
2004 EOM
2005         n=''
2006         c='\c'
2007 fi
2008 echo $n "The star should be here-->$c"
2009 echo '*'
2010 rm -f .echotmp
2011
2012 : Now test for existence of everything in MANIFEST
2013 echo " "
2014 if test -f "$rsrc/MANIFEST"; then
2015         echo "First let's make sure your kit is complete.  Checking..." >&4
2016         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2017                 (split -l 50 2>/dev/null || split -50)
2018         rm -f missing
2019         tmppwd=`pwd`
2020         for filelist in x??; do
2021                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2022                         >/dev/null 2>>"$tmppwd/missing")
2023         done
2024         if test -s missing; then
2025                 cat missing >&4
2026                 cat >&4 <<'EOM'
2027
2028 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2029
2030 You have the option of continuing the configuration process, despite the
2031 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2032 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2033 and contact the author (perlbug@perl.org).
2034
2035 EOM
2036                 echo $n "Continue? [n] $c" >&4
2037                 read ans
2038                 case "$ans" in
2039                 y*)
2040                         echo "Continuing..." >&4
2041                         rm -f missing
2042                         ;;
2043                 *)
2044                         echo "ABORTING..." >&4
2045                         kill $$
2046                         ;;
2047                 esac
2048         else
2049                 echo "Looks good..."
2050         fi
2051 else
2052         echo "There is no MANIFEST file.  I hope your kit is complete !"
2053 fi
2054 rm -f missing x??
2055
2056 : Find the appropriate value for a newline for tr
2057 echo " "
2058 if test -n "$DJGPP"; then
2059        trnl='\012'
2060 fi
2061 if test X"$trnl" = X; then
2062         case "`echo foo|tr '\n' x 2>/dev/null`" in
2063         foox) trnl='\n' ;;
2064         esac
2065 fi
2066 if test X"$trnl" = X; then
2067         case "`echo foo|tr '\012' x 2>/dev/null`" in
2068         foox) trnl='\012' ;;
2069         esac
2070 fi
2071 if test X"$trnl" = X; then
2072        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2073        fooxy) trnl='\n\r' ;;
2074        esac
2075 fi
2076 if test X"$trnl" = X; then
2077         cat <<EOM >&2
2078
2079 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2080
2081 EOM
2082         exit 1
2083 fi
2084
2085 : compute the number of columns on the terminal for proper question formatting
2086 case "$COLUMNS" in
2087 '') COLUMNS='80';;
2088 esac
2089
2090 : set up the echo used in my read
2091 myecho="case \"\$xxxm\" in
2092 '') echo $n \"\$rp $c\" >&4;;
2093 *) case \"\$rp\" in
2094         '') echo $n \"[\$xxxm] $c\";;
2095         *)
2096                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2097                         echo \"\$rp\" >&4
2098                         echo $n \"[\$xxxm] $c\" >&4
2099                 else
2100                         echo $n \"\$rp [\$xxxm] $c\" >&4
2101                 fi
2102                 ;;
2103         esac;;
2104 esac"
2105
2106 : now set up to do reads with possible shell escape and default assignment
2107 cat <<EOSC >myread
2108 $startsh
2109 xxxm=\$dflt
2110 $myecho
2111 ans='!'
2112 case "\$fastread" in
2113 yes) case "\$dflt" in
2114         '') ;;
2115         *) ans='';
2116                 case "\$silent-\$rp" in
2117                 true-) ;;
2118                 *) echo " " >&4;;
2119                 esac;;
2120         esac;;
2121 *) case "\$silent" in
2122         true) case "\$rp" in
2123                 '') ans='';;
2124                 esac;;
2125         esac;;
2126 esac
2127 while expr "X\$ans" : "X!" >/dev/null; do
2128         read answ
2129         set x \$xxxm
2130         shift
2131         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2132         case  "\$answ" in
2133         "!")
2134                 sh 1>&4
2135                 echo " "
2136                 $myecho
2137                 ;;
2138         !*)
2139                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2140                 shift
2141                 sh 1>&4 -c "\$*"
2142                 echo " "
2143                 $myecho
2144                 ;;
2145         "\$ans")
2146                 case "\$ans" in
2147                 \\&*)
2148                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2149                         shift
2150                         case "\$1" in
2151                         -d)
2152                                 fastread=yes
2153                                 echo "(OK, I'll run with -d after this question.)" >&4
2154                                 ;;
2155                         -*)
2156                                 echo "*** Sorry, \$1 not supported yet." >&4
2157                                 ;;
2158                         esac
2159                         $myecho
2160                         ans=!
2161                         ;;
2162                 esac;;
2163         *)
2164                 case "\$aok" in
2165                 y)
2166                         echo "*** Substitution done -- please confirm."
2167                         xxxm="\$ans"
2168                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2169                         xxxm="\$ans"
2170                         ans=!
2171                         ;;
2172                 *)
2173                         echo "*** Error -- try again."
2174                         ans=!
2175                         ;;
2176                 esac
2177                 $myecho
2178                 ;;
2179         esac
2180         case "\$ans\$xxxm\$nostick" in
2181         '')
2182                 ans=!
2183                 $myecho
2184                 ;;
2185         esac
2186 done
2187 case "\$ans" in
2188 '') ans="\$xxxm";;
2189 esac
2190 EOSC
2191
2192 : create .config dir to save info across Configure sessions
2193 test -d ../.config || mkdir ../.config
2194 cat >../.config/README <<EOF
2195 This directory created by Configure to save information that should
2196 persist across sessions for $package.
2197
2198 You may safely delete it if you wish.
2199 EOF
2200
2201 : See if we are using a devel version and want that
2202 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2203 case "$usedevel" in
2204 $define|true|[yY]*)
2205     usedevel="$define" ;;
2206 *) case "$xversion" in
2207    *[13579])
2208         cat >&4 <<EOH
2209 *** WHOA THERE!!! ***
2210
2211     This is an UNSTABLE DEVELOPMENT release.
2212     The version of this $package distribution is $xversion, that is, odd,
2213     (as opposed to even) and that signifies a development release.
2214     If you want a maintenance release, you want an even-numbered version.
2215
2216     Do ***NOT*** install this into production use.
2217     Data corruption and crashes are possible.
2218
2219     It is most seriously suggested that you do not continue any further
2220     unless you want to help in developing and debugging Perl.
2221
2222     If you *still* want to build perl, you can answer 'y' now,
2223     or pass -Dusedevel to Configure.
2224
2225 EOH
2226         rp='Do you really want to continue?'
2227         dflt='n'
2228         . ./myread
2229         case "$ans" in
2230         [yY]) echo >&4 "Okay, continuing."
2231               usedevel="$define" ;;
2232         *) echo >&4 "Okay, bye."
2233            exit 1
2234            ;;
2235         esac
2236         ;;
2237     esac
2238     usedevel="$undef"
2239     ;;
2240 esac
2241 case "$usedevel" in
2242 $define|true|[yY]*)
2243         case "$versiononly" in
2244         '') versiononly="$define" ;;
2245         esac
2246         case "$installusrbinperl" in
2247         '') installusrbinperl="$undef" ;;
2248         esac
2249         ;;
2250 esac
2251
2252 : general instructions
2253 needman=true
2254 firsttime=true
2255 user=`(logname) 2>/dev/null`
2256 case "$user" in
2257 '') user=`whoami 2>&1`;;
2258 esac
2259 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2260         firsttime=false
2261         echo " "
2262         rp='Would you like to see the instructions?'
2263         dflt=n
2264         . ./myread
2265         case "$ans" in
2266         [yY]*) ;;
2267         *) needman=false;;
2268         esac
2269 fi
2270 if $needman; then
2271         cat <<EOH
2272
2273 This installation shell script will examine your system and ask you questions
2274 to determine how the perl5 package should be installed. If you get
2275 stuck on a question, you may use a ! shell escape to start a subshell or
2276 execute a command.  Many of the questions will have default answers in square
2277 brackets; typing carriage return will give you the default.
2278
2279 On some of the questions which ask for file or directory names you are allowed
2280 to use the ~name construct to specify the login directory belonging to "name",
2281 even if you don't have a shell which knows about that.  Questions where this is
2282 allowed will be marked "(~name ok)".
2283
2284 EOH
2285         rp=''
2286         dflt='Type carriage return to continue'
2287         . ./myread
2288         cat <<'EOH'
2289
2290 The prompter used in this script allows you to use shell variables and
2291 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2292 in the default answer, as if the default line was a set of arguments given to a
2293 script shell.  This means you may also use $* to repeat the whole default line,
2294 so you do not have to re-type everything to add something to the default.
2295
2296 Every time there is a substitution, you will have to confirm.  If there is an
2297 error (e.g. an unmatched backtick), the default answer will remain unchanged
2298 and you will be prompted again.
2299
2300 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2301 the questions and use the computed defaults (or the previous answers if there
2302 was already a config.sh file). Type 'Configure -h' for a list of options.
2303 You may also start interactively and then answer '& -d' at any prompt to turn
2304 on the non-interactive behaviour for the remainder of the execution.
2305
2306 EOH
2307         . ./myread
2308         cat <<EOH
2309
2310 Much effort has been expended to ensure that this shell script will run on any
2311 Unix system.  If despite that it blows up on yours, your best bet is to edit
2312 Configure and run it again.  If you can't run Configure for some reason,
2313 you'll have to generate a config.sh file by hand.  Whatever problems you
2314 have, let me (perlbug@perl.org) know how I blew it.
2315
2316 This installation script affects things in two ways:
2317
2318 1) it may do direct variable substitutions on some of the files included
2319    in this kit.
2320 2) it builds a config.h file for inclusion in C programs.  You may edit
2321    any of these files as the need arises after running this script.
2322
2323 If you make a mistake on a question, there is no easy way to back up to it
2324 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2325 files.  Configure will offer to let you do this before it runs the SH files.
2326
2327 EOH
2328         dflt='Type carriage return to continue'
2329         . ./myread
2330         case "$firsttime" in
2331         true) echo $user >>../.config/instruct;;
2332         esac
2333 fi
2334
2335 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2336 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2337 if test "X$sysroot" = X; then
2338     sysroot=""
2339 else
2340     case "$cc" in
2341         *gcc*|*g++*)
2342             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2343             # _sysroot is used in places where we need --sysroot=foo
2344             # but using the rest of the flags could cause issues.
2345             _sysroot="--sysroot=$sysroot";
2346             case "$ccflags" in
2347                 *sysroot*) ;;
2348                 'undef'|*)
2349                 ccflags="$ccflags $_sysroot"
2350             esac
2351             case "$ldflags" in
2352                 *sysroot*) ;;
2353                 'undef'|*)
2354                 ldflags="$ldflags $_sysroot"
2355             esac
2356             case "$cppflags" in
2357                 *sysroot*) ;;
2358                 'undef'|*)
2359                 cppflags="$cppflags $_sysroot"
2360             esac
2361             # lddlflags updated below in lddlflags section;
2362             # same with cccdlflags
2363             ;;
2364     esac
2365
2366     # Adjust some defaults to also use $sysroot
2367     for var in xlibpth loclibpth locincpth glibpth; do
2368         eval xxx=\$$var
2369         eval $var=''
2370         for path in $xxx; do
2371             eval $var=\"\$$var $sysroot$path\"
2372         done
2373     done
2374
2375 fi
2376
2377 : find out where common programs are
2378 echo " "
2379 echo "Locating common programs..." >&4
2380 cat <<EOSC >loc
2381 $startsh
2382 case \$# in
2383 0) exit 1;;
2384 esac
2385 thing=\$1
2386 shift
2387 dflt=\$1
2388 shift
2389 for dir in \$*; do
2390         case "\$thing" in
2391         .)
2392         if test -d \$dir/\$thing; then
2393                 echo \$dir
2394                 exit 0
2395         fi
2396         ;;
2397         *)
2398         for thisthing in \$dir/\$thing; do
2399                 : just loop through to pick last item
2400         done
2401         if test -f \$thisthing; then
2402                 echo \$thisthing
2403                 exit 0
2404         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2405                 echo \$thisthing
2406                 exit 0
2407         elif test -f \$dir/\$thing.exe; then
2408                 if test -n "$DJGPP"; then
2409                         echo \$dir/\$thing.exe
2410                 elif test "$eunicefix" != ":"; then
2411                         : on Eunice apparently
2412                         echo \$dir/\$thing
2413                 fi
2414                 exit 0
2415         fi
2416         ;;
2417         esac
2418 done
2419 echo \$dflt
2420 exit 1
2421 EOSC
2422 chmod +x loc
2423 $eunicefix loc
2424 loclist="
2425 awk
2426 cat
2427 chmod
2428 comm
2429 cp
2430 echo
2431 expr
2432 grep
2433 ls
2434 mkdir
2435 rm
2436 sed
2437 sort
2438 touch
2439 tr
2440 uniq
2441 "
2442 trylist="
2443 ar
2444 bison
2445 byacc
2446 cpp
2447 csh
2448 date
2449 egrep
2450 gmake
2451 gzip
2452 less
2453 ln
2454 make
2455 more
2456 nm
2457 nroff
2458 perl
2459 pg
2460 test
2461 uname
2462 zip
2463 "
2464 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2465 pth="$pth $sysroot/lib $sysroot/usr/lib"
2466 for file in $loclist; do
2467         eval xxx=\$$file
2468         case "$xxx" in
2469         /*|?:[\\/]*)
2470                 if test -f "$xxx"; then
2471                         : ok
2472                 else
2473                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2474                         xxx=`./loc $file $file $pth`
2475                 fi
2476                 ;;
2477         '') xxx=`./loc $file $file $pth`;;
2478         *) xxx=`./loc $xxx $xxx $pth`;;
2479         esac
2480         eval $file=$xxx$_exe
2481         eval _$file=$xxx
2482         case "$xxx" in
2483         /*)
2484                 echo $file is in $xxx.
2485                 ;;
2486         ?:[\\/]*)
2487                 echo $file is in $xxx.
2488                 ;;
2489         *)
2490                 echo "I don't know where '$file' is, and my life depends on it." >&4
2491                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2492                 exit 1
2493                 ;;
2494         esac
2495 done
2496 echo " "
2497 echo "Don't worry if any of the following aren't found..."
2498 say=offhand
2499 for file in $trylist; do
2500         eval xxx=\$$file
2501         case "$xxx" in
2502         /*|?:[\\/]*)
2503                 if test -f "$xxx"; then
2504                         : ok
2505                 else
2506                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2507                         xxx=`./loc $file $file $pth`
2508                 fi
2509                 ;;
2510         '') xxx=`./loc $file $file $pth`;;
2511         *) xxx=`./loc $xxx $xxx $pth`;;
2512         esac
2513         eval $file=$xxx$_exe
2514         eval _$file=$xxx
2515         case "$xxx" in
2516         /*)
2517                 echo $file is in $xxx.
2518                 ;;
2519         ?:[\\/]*)
2520                 echo $file is in $xxx.
2521                 ;;
2522         *)
2523                 echo "I don't see $file out there, $say."
2524                 say=either
2525                 ;;
2526         esac
2527 done
2528 case "$egrep" in
2529 egrep)
2530         echo "Substituting grep for egrep."
2531         egrep=$grep
2532         _egrep=$grep
2533         ;;
2534 esac
2535 case "$less" in
2536 '')     ;;
2537 *)      if $less -R </dev/null >/dev/null 2>&1; then
2538                echo "Substituting less -R for less."
2539                less="$less -R"
2540                _less=$less
2541         fi
2542         ;;
2543 esac
2544 case "$ln" in
2545 ln)
2546         echo "Substituting cp for ln."
2547         ln=$cp
2548         _ln=$cp
2549         ;;
2550 esac
2551 case "$make" in
2552 make)
2553         case "$gmake" in
2554         gmake)
2555         echo "I can't find make or gmake, and my life depends on it." >&4
2556         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2557         exit 1
2558         ;;
2559         esac
2560         ;;
2561 esac
2562 case "$gmake" in
2563 gmake)  ;;
2564 *)      # We can't have osname yet.
2565         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2566                 # Assume that gmake, if found, is definitely GNU make
2567                 # and prefer it over the system make.
2568                 echo "Substituting gmake for make."
2569                 make=$gmake
2570                 _make=$gmake
2571         fi
2572         ;;
2573 esac
2574 case "$test" in
2575 test)
2576         echo "Hopefully test is built into your sh."
2577         ;;
2578 *)
2579         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2580                 echo "Using the test built into your sh."
2581                 test=test
2582                 _test=test
2583         fi
2584         ;;
2585 esac
2586 case "$echo" in
2587 echo)
2588         echo "Hopefully echo is built into your sh."
2589         ;;
2590 '') ;;
2591 *)
2592         echo " "
2593 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2594         $echo $n "hi there$c" >foo1
2595         echo $n "hi there$c" >foo2
2596         if cmp foo1 foo2 >/dev/null 2>&1; then
2597                 echo "They are compatible.  In fact, they may be identical."
2598         else
2599                 case "$n" in
2600                 '-n') n='' c='\c';;
2601                 *) n='-n' c='';;
2602                 esac
2603                 cat <<FOO
2604 They are not compatible!  You are probably running ksh on a non-USG system.
2605 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2606 have echo built in and we may have to run some Bourne shell scripts.  That
2607 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2608
2609 FOO
2610                 $echo $n "The star should be here-->$c"
2611                 $echo "*"
2612         fi
2613         $rm -f foo1 foo2
2614         ;;
2615 esac
2616
2617 # This question was auctioned at YAPC::Europe-2007 in Vienna
2618 # I never promised you could answer it. I only auctioned the question.
2619 cat <<FOO
2620 The following message is sponsored by
2621
2622   Dresden.pm<--The stars should be here.
2623
2624 Dear Perl user, system administrator or package
2625 maintainer, the Perl community sends greetings to
2626 you. Do you (emblematical) greet back [Y/n]? n
2627
2628 FOO
2629
2630 : Check what type of C compiler we use
2631 cat <<EOS >trygcc
2632 $startsh
2633 EOS
2634 cat <<'EOSC' >>trygcc
2635 case "$cc" in
2636 '') ;;
2637 *)  $rm -f try try.*
2638     $cat >try.c <<EOM
2639 int main(int argc, char *argv[]) {
2640   return 0;
2641 }
2642 EOM
2643     if $cc -o try $ccflags $ldflags try.c; then
2644        :
2645     else
2646         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2647         despair=yes
2648         trygcc=yes
2649         case "$cc" in
2650         *gcc*) trygcc=no ;;
2651         esac
2652         # Skip this test because it gives a false match on output like:
2653         #    ./trygcc: line 23: cc: command not found
2654         # case "`$cc -v -c try.c 2>&1`" in
2655         # *gcc*) trygcc=no ;;
2656         # esac
2657         if $test X"$trygcc" = Xyes; then
2658             if gcc -o try -c try.c; then
2659                 echo " "
2660                 echo "You seem to have a working gcc, though." >&4
2661                 # Switching compilers may undo the work of hints files.
2662                 # The most common problem is -D_REENTRANT for threads.
2663                 # This heuristic catches that case, but gets false positives
2664                 # if -Dusethreads was not actually specified.  Better to
2665                 # bail out here with a useful message than fail
2666                 # mysteriously later. Should we perhaps just try to
2667                 # re-invoke Configure -Dcc=gcc config_args ?
2668                 if $test -f usethreads.cbu; then
2669                         $cat >&4 <<EOM
2670
2671 *** However, any setting of the C compiler flags (e.g. for thread support)
2672 *** will be lost.  It may be necessary for you to restart Configure and
2673 *** add -Dcc=gcc to your Configure command line.
2674
2675 EOM
2676                         rp="Would you like to go ahead and try gcc anyway?"
2677                         dflt=n
2678                 else
2679                         rp="Would you like to use it?"
2680                         dflt=y
2681                 fi
2682                 if $test -f myread; then
2683                     . ./myread
2684                 else
2685                     if $test -f UU/myread; then
2686                         . ./UU/myread
2687                     else
2688                         echo "Cannot find myread, sorry.  Aborting." >&2
2689                         exit 1
2690                     fi
2691                 fi
2692                 case "$ans" in
2693                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2694                 esac
2695             fi
2696         fi
2697     fi
2698     $rm -f try try.*
2699     ;;
2700 esac
2701 EOSC
2702
2703 cat <<EOS >checkcc
2704 $startsh
2705 EOS
2706 cat <<'EOSC' >>checkcc
2707 case "$cc" in
2708 '') ;;
2709 *)  $rm -f try try.*
2710     $cat >try.c <<EOM
2711 int main(int argc, char *argv[]) {
2712   return 0;
2713 }
2714 EOM
2715     if $cc -o try $ccflags $ldflags try.c; then
2716        :
2717     else
2718         if $test X"$despair" = Xyes; then
2719            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2720         fi
2721         $cat >&4 <<EOM
2722 You need to find a working C compiler.
2723 Either (purchase and) install the C compiler supplied by your OS vendor,
2724 or for a free C compiler try http://gcc.gnu.org/
2725 I cannot continue any further, aborting.
2726 EOM
2727         exit 1
2728     fi
2729     $rm -f try try.*
2730     ;;
2731 esac
2732 EOSC
2733
2734 : determine whether symbolic links are supported
2735 echo " "
2736 $touch blurfl
2737 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2738         echo "Symbolic links are supported." >&4
2739         lns="$ln -s"
2740 else
2741         echo "Symbolic links are NOT supported." >&4
2742         lns="$ln"
2743 fi
2744 $rm -f blurfl sym
2745
2746 : determine whether symbolic links are supported
2747 echo " "
2748 case "$lns" in
2749 *"ln"*" -s")
2750         echo "Checking how to test for symbolic links..." >&4
2751         $lns blurfl sym
2752         if $test "X$issymlink" = X; then
2753                 case "$newsh" in
2754                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2755                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2756                 esac
2757                 if test $? = 0; then
2758                         issymlink="test -h"
2759                 else
2760                         echo "Your builtin 'test -h' may be broken." >&4
2761                         case "$test" in
2762                         /*)     ;;
2763                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2764                                 for p in $pth
2765                                 do
2766                                         if test -f "$p/$test"; then
2767                                                 test="$p/$test"
2768                                                 break
2769                                         fi
2770                                 done
2771                                 ;;
2772                         esac
2773                         case "$test" in
2774                         /*)
2775                                 echo "Trying external '$test -h'." >&4
2776                                 issymlink="$test -h"
2777                                 if $test ! -h sym >/dev/null 2>&1; then
2778                                         echo "External '$test -h' is broken, too." >&4
2779                                         issymlink=''
2780                                 fi
2781                                 ;;
2782                         *)      issymlink='' ;;
2783                         esac
2784                 fi
2785         fi
2786         if $test "X$issymlink" = X; then
2787                 if $test -L sym 2>/dev/null; then
2788                         issymlink="$test -L"
2789                         echo "The builtin '$test -L' worked." >&4
2790                 fi
2791         fi
2792         if $test "X$issymlink" != X; then
2793                 echo "You can test for symbolic links with '$issymlink'." >&4
2794         else
2795                 echo "I do not know how you can test for symbolic links." >&4
2796         fi
2797         $rm -f blurfl sym
2798         ;;
2799 *)      echo "No symbolic links, so not testing for their testing..." >&4
2800         ;;
2801 esac
2802 echo " "
2803
2804 : Make symlinks util
2805 case "$mksymlinks" in
2806 $define|true|[yY]*)
2807         case "$src" in
2808         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2809                 exit 1
2810                 ;;
2811         *)      case "$lns:$issymlink" in
2812                 *"ln"*" -s:"*"test -"?)
2813                         echo "Creating the symbolic links..." >&4
2814                         echo "(First creating the subdirectories...)" >&4
2815                         cd ..
2816                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2817                                 read directory
2818                                 test -z "$directory" && break
2819                                 mkdir -p $directory
2820                         done
2821                         # Sanity check 1.
2822                         if test ! -d t/base; then
2823                                 echo "Failed to create the subdirectories.  Aborting." >&4
2824                                 exit 1
2825                         fi
2826                         echo "(Then creating the symlinks...)" >&4
2827                         awk '{print $1}' $src/MANIFEST | while true; do
2828                                 read filename
2829                                 test -z "$filename" && break
2830                                 if test -f $filename; then
2831                                         if $issymlink $filename; then
2832                                                 rm -f $filename
2833                                         fi
2834                                 fi
2835                                 if test -f $filename; then
2836                                         echo "$filename already exists, not symlinking."
2837                                 else
2838                                         ln -s $src/$filename $filename
2839                                 fi
2840                         done
2841                         # Sanity check 2.
2842                         if test ! -f t/base/lex.t; then
2843                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2844                                 exit 1
2845                         fi
2846                         cd UU
2847                         ;;
2848                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2849                         ;;
2850                 esac
2851                 ;;
2852         esac
2853         ;;
2854 esac
2855
2856 : Check for Cross-Compilation
2857 if $test "X$targethost" = "X"; then
2858     targethost=""
2859 fi
2860 if $test "X$targetenv" = "X"; then
2861     targetenv=""
2862 fi
2863 case "$usecrosscompile" in
2864 $define|true|[yY]*)
2865         $echo "Cross-compiling..."
2866         croak=''
2867         case "$cc" in
2868         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2869             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2870             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2871             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2872             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2873             # leave out ld, choosing it is more complex
2874             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2875             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2876             # We are in a weird spot. Just before us, some values
2877             # were 'saved', to be restored after the hints are
2878             # run.  This means that the changes we made to ar,
2879             # nm and ranlib will get reverted.
2880             # To avoid that, we hijack the saving mechanism and
2881             # have it save our new values.
2882             for file in ar nm ranlib; do
2883                 eval xxx=\$$file
2884                 eval $file=$xxx$_exe
2885                 eval _$file=$xxx
2886             done
2887         ;;
2888         esac
2889         case "$targetarch" in
2890         '') echo "Targetarch not defined." >&4; croak=y ;;
2891         *)  echo "Using targetarch $targetarch." >&4 ;;
2892         esac
2893         case "$targethost" in
2894         '') echo "Targethost not defined." >&4; croak=y ;;
2895         *)  echo "Using targethost $targethost." >&4
2896         esac
2897         locincpth=' '
2898         loclibpth=' '
2899         case "$croak" in
2900         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2901         esac
2902     : compile a host miniperl and generate_uudmap, unless we got passed them
2903     if $test "X$hostperl" = X; then
2904       echo "Building host miniperl and generate_uudmap binaries" >&4
2905       before_host=`pwd`
2906       cd ..
2907       cd $src
2908       src=`pwd`
2909       rm -rf $src/host
2910       mkdir $src/host
2911       cd $src/host
2912       $src/Configure -des -Dusedevel -Dmksymlinks
2913       $make miniperl
2914       case "$hostgenerate" in
2915       '') $make generate_uudmap
2916           hostgenerate=$src/host/generate_uudmap
2917           ;;
2918        "$undef") hostgenerate=''
2919           ;;
2920       esac
2921       hostperl=$src/host/miniperl
2922       cd $before_host
2923     fi
2924     hostosname=`$hostperl -le 'print $^O'`
2925     ;;
2926 *)
2927     usecrosscompile="$undef"
2928     ;;
2929 esac
2930
2931 : Define -Dtargethost=somecomputer to run compiled tests on another machine
2932 case "$targethost" in
2933     '') echo "Checking for cross-compile" >&4
2934     case "$usecrosscompile$multiarch" in
2935        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
2936          if [ -f Makefile ]; then
2937            echo " "
2938            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
2939          else
2940            echo "Configure done."
2941          fi
2942        exit 0
2943        ;;
2944      *) echo "No targethost for running compiler tests against defined, running locally" >&4
2945         run=''
2946         to=:
2947         from=:
2948         ;;
2949     esac
2950     ;;
2951     *) echo "Using targethost $targethost." >&4
2952         case "$src" in
2953         /*) run=$src/Cross/run
2954             targetmkdir=$src/Cross/mkdir
2955             to=$src/Cross/to
2956             from=$src/Cross/from
2957             ;;
2958         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2959             run=$pwd/Cross/run
2960             targetmkdir=$pwd/Cross/mkdir
2961             to=$pwd/Cross/to
2962             from=$pwd/Cross/from
2963             ;;
2964         esac
2965         case "$targetrun" in
2966         '') targetrun=ssh ;;
2967         esac
2968         case "$targetto" in
2969         '') targetto=scp ;;
2970         esac
2971         case "$targetfrom" in
2972         '') targetfrom=scp ;;
2973         esac
2974         run=$run-$targetrun
2975         to=$to-$targetto
2976         from=$from-$targetfrom
2977         case "$targetdir" in
2978         '')  targetdir=/tmp
2979              echo "Guessing targetdir $targetdir." >&4
2980              ;;
2981         esac
2982         case "$targetuser" in
2983         '')  targetuser=root
2984              echo "Guessing targetuser $targetuser." >&4
2985              ;;
2986         esac
2987         case "$targetport" in
2988         '')  targetport=22
2989              echo "Guessing targetport $targetport." >&4
2990              ;;
2991         esac
2992         case "$targetfrom" in
2993         scp)    q=-q ;;
2994         *)      q='' ;;
2995         esac
2996         case "$targetrun" in
2997         ssh|rsh)
2998             cat >$run <<EOF
2999 #!/bin/sh
3000 env=''
3001 case "\$1" in
3002 -cwd)
3003   shift
3004   cwd=\$1
3005   shift
3006   ;;
3007 esac
3008 case "\$1" in
3009 -env)
3010   shift
3011   env=\$1
3012   shift
3013   ;;
3014 esac
3015 case "\$cwd" in
3016 '') cwd=$targetdir ;;
3017 esac
3018 exe=\$1
3019 shift
3020 $to \$exe
3021 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3022 EOF
3023             ;;
3024         adb)
3025             $touch $run
3026             ;;
3027         *)  echo "Unknown targetrun '$targetrun'" >&4
3028             exit 1
3029             ;;
3030         esac
3031         case "$targetmkdir" in
3032         */Cross/mkdir)
3033             cat >$targetmkdir <<EOF
3034 #!/bin/sh
3035 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3036 EOF
3037             $chmod a+rx $targetmkdir
3038             ;;
3039         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3040             exit 1
3041             ;;
3042         esac
3043         case "$targetto" in
3044         scp|rcp)
3045             cat >$to <<EOF
3046 #!/bin/sh
3047 for f in \$@
3048 do
3049   case "\$f" in
3050   /*)
3051     $targetmkdir \`dirname \$f\`
3052     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3053     ;;
3054   *)
3055     $targetmkdir $targetdir/\`dirname \$f\`
3056     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3057     ;;
3058   esac
3059 done
3060 exit 0
3061 EOF
3062             ;;
3063         cp) cat >$to <<EOF
3064 #!/bin/sh
3065 for f in \$@
3066 do
3067   case "\$f" in
3068   /*)
3069     $mkdir -p $targetdir/\`dirname \$f\`
3070     $cp \$f $targetdir/\$f || exit 1
3071     ;;
3072   *)
3073     $targetmkdir $targetdir/\`dirname \$f\`
3074     $cp \$f $targetdir/\$f || exit 1
3075     ;;
3076   esac
3077 done
3078 exit 0
3079 EOF
3080             ;;
3081         *)  echo "Unknown targetto '$targetto'" >&4
3082             exit 1
3083             ;;
3084         esac
3085         case "$targetfrom" in
3086         scp|rcp)
3087           cat >$from <<EOF
3088 #!/bin/sh
3089 for f in \$@
3090 do
3091   $rm -f \$f
3092   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3093 done
3094 exit 0
3095 EOF
3096             ;;
3097         cp) cat >$from <<EOF
3098 #!/bin/sh
3099 for f in \$@
3100 do
3101   $rm -f \$f
3102   cp $targetdir/\$f . || exit 1
3103 done
3104 exit 0
3105 EOF
3106             ;;
3107         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3108             exit 1
3109             ;;
3110         esac
3111         if $test ! -f $run; then
3112             echo "Target 'run' script '$run' not found." >&4
3113         else
3114             $chmod a+rx $run
3115         fi
3116         if $test ! -f $to; then
3117             echo "Target 'to' script '$to' not found." >&4
3118         else
3119             $chmod a+rx $to
3120         fi
3121         if $test ! -f $from; then
3122             echo "Target 'from' script '$from' not found." >&4
3123         else
3124             $chmod a+rx $from
3125         fi
3126         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3127             exit 1
3128         fi
3129         cat >&4 <<EOF
3130 Using '$run' for remote execution,
3131 and '$from' and '$to'
3132 for remote file transfer.
3133 EOF
3134         ;;
3135 *)      run=''
3136         to=:
3137         from=:
3138         usecrosscompile="$undef"
3139         targetarch=''
3140         ;;
3141 esac
3142
3143 : see whether [:lower:] and [:upper:] are supported character classes
3144 echo " "
3145 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3146 ABYZ)
3147         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3148         up='[:upper:]'
3149         low='[:lower:]'
3150         ;;
3151 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3152         # (0xd9 and 0xe2), therefore that is a nice testing point.
3153         if test "X$up" = X -o "X$low" = X; then
3154             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3155             rs) up='[A-Z]'
3156                 low='[a-z]'
3157                 ;;
3158             esac
3159         fi
3160         if test "X$up" = X -o "X$low" = X; then
3161             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3162             rs) up='A-Z'
3163                 low='a-z'
3164                 ;;
3165             esac
3166         fi
3167         if test "X$up" = X -o "X$low" = X; then
3168             case "`echo RS | od -x 2>/dev/null`" in
3169             *D9E2*|*d9e2*)
3170                 echo "Hey, this might be EBCDIC." >&4
3171                 if test "X$up" = X -o "X$low" = X; then
3172                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3173                     rs) up='[A-IJ-RS-Z]'
3174                         low='[a-ij-rs-z]'
3175                         ;;
3176                     esac
3177                 fi
3178                 if test "X$up" = X -o "X$low" = X; then
3179                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3180                     rs) up='A-IJ-RS-Z'
3181                         low='a-ij-rs-z'
3182                         ;;
3183                     esac
3184                 fi
3185                 ;;
3186             esac
3187         fi
3188 esac
3189 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3190 rs)
3191     echo "Using $up and $low to convert case." >&4
3192     ;;
3193 *)
3194     echo "I don't know how to translate letters from upper to lower case." >&4
3195     echo "Your tr is not acting any way I know of." >&4
3196     exit 1
3197     ;;
3198 esac
3199 : set up the translation script tr, must be called with ./tr of course
3200 cat >tr <<EOSC
3201 $startsh
3202 case "\$1\$2" in
3203 '[A-Z][a-z]') exec $tr '$up' '$low';;
3204 '[a-z][A-Z]') exec $tr '$low' '$up';;
3205 esac
3206 exec $tr "\$@"
3207 EOSC
3208 chmod +x tr
3209 $eunicefix tr
3210
3211 : Try to determine whether config.sh was made on this system
3212 case "$config_sh" in
3213 '')
3214 myuname=`$uname -a 2>/dev/null`
3215 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3216 # Downcase everything to avoid ambiguity.
3217 # Remove slashes and single quotes so we can use parts of this in
3218 # directory and file names.
3219 # Remove newlines so myuname is sane to use elsewhere.
3220 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3221 # because the A-Z/a-z are not consecutive.
3222 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3223         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3224 newmyuname="$myuname"
3225 dflt=n
3226 case "$knowitall" in
3227 '')
3228         if test -f ../config.sh; then
3229                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3230                         eval "`grep myuname= ../config.sh`"
3231                 fi
3232                 if test "X$myuname" = "X$newmyuname"; then
3233                         dflt=y
3234                 fi
3235         fi
3236         ;;
3237 *) dflt=y;;
3238 esac
3239
3240 : Get old answers from old config file if Configure was run on the
3241 : same system, otherwise use the hints.
3242 hint=default
3243 cd ..
3244 if test -f config.sh; then
3245         echo " "
3246         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3247         . UU/myread
3248         case "$ans" in
3249         n*|N*) echo "OK, I'll ignore it."
3250                 mv config.sh config.sh.old
3251                 myuname="$newmyuname"
3252                 ;;
3253         *)  echo "Fetching default answers from your old config.sh file..." >&4
3254                 tmp_n="$n"
3255                 tmp_c="$c"
3256                 tmp_sh="$sh"
3257                 . ./config.sh
3258                 cp config.sh UU
3259                 n="$tmp_n"
3260                 c="$tmp_c"
3261                 : Older versions did not always set $sh.  Catch re-use of such
3262                 : an old config.sh.
3263                 case "$sh" in
3264                 '') sh="$tmp_sh" ;;
3265                 esac
3266                 hint=previous
3267                 ;;
3268         esac
3269 fi
3270 . ./UU/checkcc
3271 if test ! -f config.sh; then
3272         $cat <<EOM
3273
3274 First time through, eh?  I have some defaults handy for some systems
3275 that need some extra help getting the Configure answers right:
3276
3277 EOM
3278         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3279         dflt=''
3280         : Half the following guesses are probably wrong... If you have better
3281         : tests or hints, please send them to perlbug@perl.org
3282         : The metaconfig authors would also appreciate a copy...
3283         $test -f /irix && osname=irix
3284         $test -f /xenix && osname=sco_xenix
3285         $test -f /dynix && osname=dynix
3286         $test -f /dnix && osname=dnix
3287         $test -f /lynx.os && osname=lynxos
3288         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3289         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3290         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3291         $test -f /bin/mips && /bin/mips && osname=mips
3292         $test -d /usr/apollo/bin && osname=apollo
3293         $test -f /etc/saf/_sactab && osname=svr4
3294         $test -d /usr/include/minix && osname=minix
3295         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3296         if $test -d /MachTen -o -d /MachTen_Folder; then
3297                 osname=machten
3298                 if $test -x /sbin/version; then
3299                         osvers=`/sbin/version | $awk '{print $2}' |
3300                         $sed -e 's/[A-Za-z]$//'`
3301                 elif $test -x /usr/etc/version; then
3302                         osvers=`/usr/etc/version | $awk '{print $2}' |
3303                         $sed -e 's/[A-Za-z]$//'`
3304                 else
3305                         osvers="$2.$3"
3306                 fi
3307         fi
3308
3309         $test -f /sys/posix.dll &&
3310                 $test -f /usr/bin/what &&
3311                 set X `/usr/bin/what /sys/posix.dll` &&
3312                 $test "$3" = UWIN &&
3313                 osname=uwin &&
3314                 osvers="$5"
3315
3316         if $test -f $uname; then
3317                 set X $myuname
3318                 shift
3319
3320                 case "$5" in
3321                 fps*) osname=fps ;;
3322                 mips*)
3323                         case "$4" in
3324                         umips) osname=umips ;;
3325                         *) osname=mips ;;
3326                         esac;;
3327                 [23]100) osname=mips ;;
3328                 i386*)
3329                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3330                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3331                                 osname='sco'
3332                                 osvers=$tmp
3333                         elif $test -f /etc/kconfig; then
3334                                 osname=isc
3335                                 if test "$lns" = "$ln -s"; then
3336                                         osvers=4
3337                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3338                                         osvers=3
3339                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3340                                         osvers=2
3341                                 fi
3342                         fi
3343                         tmp=''
3344                         ;;
3345                 pc*)
3346                         if test -n "$DJGPP"; then
3347                                 osname=dos
3348                                 osvers=djgpp
3349                         fi
3350                         ;;
3351                 esac
3352
3353                 case "$1" in
3354                 aix) osname=aix
3355                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3356                         case "$tmp" in
3357                         # oslevel can fail with:
3358                         # oslevel: Unable to acquire lock.
3359                         *not\ found) osvers="$4"."$3" ;;
3360                         '<3240'|'<>3240') osvers=3.2.0 ;;
3361                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3362                         '=3250'|'>3250') osvers=3.2.5 ;;
3363                         *) osvers=$tmp;;
3364                         esac
3365                         ;;
3366                 bitrig) osname=bitrig
3367                         osvers="$3"
3368                         ;;
3369                 bsd386) osname=bsd386
3370                         osvers=`$uname -r`
3371                         ;;
3372                 cygwin*) osname=cygwin
3373                         osvers="$3"
3374                         ;;
3375                 *dc.osx) osname=dcosx
3376                         osvers="$3"
3377                         ;;
3378                 dnix) osname=dnix
3379                         osvers="$3"
3380                         ;;
3381                 domainos) osname=apollo
3382                         osvers="$3"
3383                         ;;
3384                 dgux)   osname=dgux
3385                         osvers="$3"
3386                         ;;
3387                 dragonfly) osname=dragonfly
3388                         osvers="$3"
3389                         ;;
3390                 dynixptx*) osname=dynixptx
3391                         osvers=`echo "$4"|sed 's/^v//'`
3392                         ;;
3393                 freebsd) osname=freebsd
3394                         osvers="$3" ;;
3395                 genix)  osname=genix ;;
3396                 gnu)    osname=gnu
3397                         osvers="$3" ;;
3398                 hp*)    osname=hpux
3399                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3400                         ;;
3401                 irix*)  osname=irix
3402                         case "$3" in
3403                         4*) osvers=4 ;;
3404                         5*) osvers=5 ;;
3405                         *)      osvers="$3" ;;
3406                         esac
3407                         ;;
3408                 linux)  osname=linux
3409                         case "$3" in
3410                         *)      osvers="$3" ;;
3411                         esac
3412                         $test -f /system/lib/libandroid.so && osname=linux-android
3413                         ;;
3414                 MiNT)   osname=mint
3415                         ;;
3416                 netbsd*) osname=netbsd
3417                         osvers="$3"
3418                         ;;
3419                 news-os) osvers="$3"
3420                         case "$3" in
3421                         4*) osname=newsos4 ;;
3422                         *) osname=newsos ;;
3423                         esac
3424                         ;;
3425                 nonstop-ux) osname=nonstopux ;;
3426                 openbsd) osname=openbsd
3427                         osvers="$3"
3428                         ;;
3429                 os2)    osname=os2
3430                         osvers="$4"
3431                         ;;
3432                 POSIX-BC | posix-bc ) osname=posix-bc
3433                         osvers="$3"
3434                         ;;
3435                 powerux | power_ux | powermax_os | powermaxos | \
3436                 powerunix | power_unix) osname=powerux
3437                         osvers="$3"
3438                         ;;
3439                 qnx) osname=qnx
3440                         osvers="$4"
3441                         ;;
3442                 solaris) osname=solaris
3443                         case "$3" in
3444                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3445                         *)      osvers="$3" ;;
3446                         esac
3447                         ;;
3448                 sunos) osname=sunos
3449                         case "$3" in
3450                         5*) osname=solaris
3451                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3452                         *)      osvers="$3" ;;
3453                         esac
3454                         ;;
3455                 titanos) osname=titanos
3456                         case "$3" in
3457                         1*) osvers=1 ;;
3458                         2*) osvers=2 ;;
3459                         3*) osvers=3 ;;
3460                         4*) osvers=4 ;;
3461                         *)      osvers="$3" ;;
3462                         esac
3463                         ;;
3464                 ultrix) osname=ultrix
3465                         osvers="$3"
3466                         ;;
3467                 osf1|mls+)      case "$5" in
3468                                 alpha)
3469                                         osname=dec_osf
3470                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3471                                         case "$osvers" in
3472                                         [1-9].[0-9]*) ;;
3473                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3474                                         esac
3475                                         ;;
3476                         hp*)    osname=hp_osf1  ;;
3477                         mips)   osname=mips_osf1 ;;
3478                         esac
3479                         ;;
3480                 # UnixWare 7.1.2 is known as Open UNIX 8
3481                 openunix|unixware) osname=svr5
3482                         osvers="$4"
3483                         ;;
3484                 uts)    osname=uts
3485                         osvers="$3"
3486                         ;;
3487                 vos) osvers="$3"
3488                         ;;
3489                 $2) case "$osname" in
3490                         *isc*) ;;
3491                         *freebsd*) ;;
3492                         svr*)
3493                                 : svr4.x or possibly later
3494                                 case "svr$3" in
3495                                 ${osname}*)
3496                                         osname=svr$3
3497                                         osvers=$4
3498                                         ;;
3499                                 esac
3500                                 case "$osname" in
3501                                 svr4.0)
3502                                         : Check for ESIX
3503                                         if test -f /stand/boot ; then
3504                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3505                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3506                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3507                                                         if test -n "$isesix"; then
3508                                                                 osname=esix4
3509                                                         fi
3510                                                 fi
3511                                         fi
3512                                         ;;
3513                                 esac
3514                                 ;;
3515                         *)      if test -f /etc/systemid; then
3516                                         osname=sco
3517                                         set `echo $3 | $sed 's/\./ /g'` $4
3518                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3519                                                 osvers=$1.$2.$3
3520                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3521                                                 osvers=$1.$2
3522                                         elif $test -f $src/hints/sco_$1.sh; then
3523                                                 osvers=$1
3524                                         fi
3525                                 else
3526                                         case "$osname" in
3527                                         '') : Still unknown.  Probably a generic Sys V.
3528                                                 osname="sysv"
3529                                                 osvers="$3"
3530                                                 ;;
3531                                         esac
3532                                 fi
3533                                 ;;
3534                         esac
3535                         ;;
3536                 *)      case "$osname" in
3537                         '') : Still unknown.  Probably a generic BSD.
3538                                 osname="$1"
3539                                 osvers="$3"
3540                                 ;;
3541                         esac
3542                         ;;
3543                 esac
3544         else
3545                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3546                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3547                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3548                                 osname=news_os
3549                         fi
3550                         $rm -f UU/kernel.what
3551                 elif test -d c:/. -o -n "$is_os2" ; then
3552                         set X $myuname
3553                         osname=os2
3554                         osvers="$5"
3555                 fi
3556         fi
3557
3558         case "$targetarch" in
3559         '') ;;
3560         *)  hostarch=$osname
3561             case "$targetarch" in
3562                 nto*|*-nto-*)
3563                     # Will load qnx.sh, which should change osname to nto
3564                     osname=qnx
3565                     osvers=''
3566                     ;;
3567                 *linux-android*)
3568                     # Catch arm-linux-androideabi, mipsel-linux-android,
3569                     # and i686-linux-android
3570                     osname=linux-android
3571                     osvers=''
3572                     ;;
3573                 *linux*)
3574                     # Something like arm-linux-gnueabihf is really just
3575                     # plain linux.
3576                     osname=linux
3577                     osvers=''
3578                     ;;
3579                 *solaris*|*sunos*)
3580                     osname=solaris
3581                     # XXX perhaps we should just assume
3582                     # osvers to be 2, or maybe take the value
3583                     # from targetarch. Using $run before the
3584                     # hints are run is somewhat icky.
3585                     set X `$run $uname -a 2>/dev/null`
3586                     shift
3587                     case "$3" in
3588                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3589                         *)  osvers="$3" ;;
3590                     esac
3591                     ;;
3592                 *)
3593                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3594                     osvers=''
3595                 ;;
3596             esac
3597             ;;
3598         esac
3599
3600         : Now look for a hint file osname_osvers, unless one has been
3601         : specified already.
3602         case "$hintfile" in
3603         ''|' ')
3604                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3605                 : Also try without trailing minor version numbers.
3606                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3607                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3608                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3609                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3610                 case "$file" in
3611                 '') dflt=none ;;
3612                 *)  case "$osvers" in
3613                         '') dflt=$file
3614                                 ;;
3615                         *)  if $test -f $src/hints/$file.sh ; then
3616                                         dflt=$file
3617                                 elif $test -f $src/hints/$xfile.sh ; then
3618                                         dflt=$xfile
3619                                 elif $test -f $src/hints/$xxfile.sh ; then
3620                                         dflt=$xxfile
3621                                 elif $test -f $src/hints/$xxxfile.sh ; then
3622                                         dflt=$xxxfile
3623                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3624                                         dflt=$xxxxfile
3625                                 elif $test -f "$src/hints/${osname}.sh" ; then
3626                                         dflt="${osname}"
3627                                 else
3628                                         dflt=none
3629                                 fi
3630                                 ;;
3631                         esac
3632                         ;;
3633                 esac
3634                 if $test -f Policy.sh ; then
3635                         case "$dflt" in
3636                         *Policy*) ;;
3637                         none) dflt="Policy" ;;
3638                         *) dflt="Policy $dflt" ;;
3639                         esac
3640                 fi
3641                 ;;
3642         *)
3643                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3644                 ;;
3645         esac
3646
3647         if $test -f Policy.sh ; then
3648                 $cat <<EOM
3649
3650 There's also a Policy hint file available, which should make the
3651 site-specific (policy) questions easier to answer.
3652 EOM
3653
3654         fi
3655
3656         $cat <<EOM
3657
3658 You may give one or more space-separated answers, or "none" if appropriate.
3659 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3660 previous run of Configure, you may specify it as well as or instead of
3661 OS-specific hints.  If hints are provided for your OS, you should use them:
3662 although Perl can probably be built without hints on many platforms, using
3663 hints often improve performance and may enable features that Configure can't
3664 set up on its own. If there are no hints that match your OS, specify "none";
3665 DO NOT give a wrong version or a wrong OS.
3666
3667 EOM
3668
3669         rp="Which of these apply, if any?"
3670         . UU/myread
3671         tans=$ans
3672         for file in $tans; do
3673                 if $test X$file = XPolicy -a -f Policy.sh; then
3674                         . Policy.sh
3675                         $cat Policy.sh >> UU/config.sh
3676                 elif $test -f $src/hints/$file.sh; then
3677                         . $src/hints/$file.sh
3678                         $cat $src/hints/$file.sh >> UU/config.sh
3679                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3680                         : nothing
3681                 else
3682                         : Give one chance to correct a possible typo.
3683                         echo "$file.sh does not exist"
3684                         dflt=$file
3685                         rp="hint to use instead?"
3686                         . UU/myread
3687                         for file in $ans; do
3688                                 if $test -f "$src/hints/$file.sh"; then
3689                                         . $src/hints/$file.sh
3690                                         $cat $src/hints/$file.sh >> UU/config.sh
3691                                 elif $test X$ans = X -o X$ans = Xnone ; then
3692                                         : nothing
3693                                 else
3694                                         echo "$file.sh does not exist -- ignored."
3695                                 fi
3696                         done
3697                 fi
3698         done
3699
3700         hint=recommended
3701         : Remember our hint file for later.
3702         if $test -f "$src/hints/$file.sh" ; then
3703                 hintfile="$file"
3704         else
3705                 hintfile=''
3706         fi
3707 fi
3708 cd UU
3709 ;;
3710 *)
3711         echo " "
3712         echo "Fetching default answers from $config_sh..." >&4
3713         tmp_n="$n"
3714         tmp_c="$c"
3715         cd ..
3716         cp $config_sh config.sh 2>/dev/null
3717         chmod +w config.sh
3718         . ./config.sh
3719         cd UU
3720         cp ../config.sh .
3721         n="$tmp_n"
3722         c="$tmp_c"
3723         hint=previous
3724         ;;
3725 esac
3726 test "$override" && . ./optdef.sh
3727
3728 : Restore computed paths
3729 for file in $loclist $trylist; do
3730         eval $file="\$_$file"
3731 done
3732
3733 cat << EOM
3734
3735 Configure uses the operating system name and version to set some defaults.
3736 The default value is probably right if the name rings a bell. Otherwise,
3737 since spelling matters for me, either accept the default or answer "none"
3738 to leave it blank.
3739
3740 EOM
3741 case "$osname" in
3742         ''|' ')
3743                 case "$hintfile" in
3744                 ''|' '|none) dflt=none ;;
3745                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3746                 esac
3747                 ;;
3748         *) dflt="$osname" ;;
3749 esac
3750 rp="Operating system name?"
3751 . ./myread
3752 case "$ans" in
3753 none)  osname='' ;;
3754 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3755 esac
3756 echo " "
3757 case "$osvers" in
3758         ''|' ')
3759                 case "$hintfile" in
3760                 ''|' '|none) dflt=none ;;
3761                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3762                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3763                         case "$dflt" in
3764                         ''|' ') dflt=none ;;
3765                         esac
3766                         ;;
3767                 esac
3768                 ;;
3769         *) dflt="$osvers" ;;
3770 esac
3771 rp="Operating system version?"
3772 . ./myread
3773 case "$ans" in
3774 none)  osvers='' ;;
3775 *) osvers="$ans" ;;
3776 esac
3777
3778
3779 . ./posthint.sh
3780
3781 : who configured the system
3782 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3783 case "$cf_by" in
3784 "")
3785         cf_by=`(logname) 2>/dev/null`
3786         case "$cf_by" in
3787         "")
3788                 cf_by=`(whoami) 2>/dev/null`
3789                 case "$cf_by" in
3790                 "") cf_by=unknown ;;
3791                 esac ;;
3792         esac ;;
3793 esac
3794
3795 : decide how portable to be.  Allow command line overrides.
3796 case "$d_portable" in
3797 "$undef") ;;
3798 *)      d_portable="$define" ;;
3799 esac
3800
3801 : set up shell script to do ~ expansion
3802 cat >filexp <<EOSS
3803 $startsh
3804 : expand filename
3805 case "\$1" in
3806  \~/*|\~)
3807         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3808         ;;
3809  \~*)
3810         if $test -f /bin/csh; then
3811                 /bin/csh -f -c "glob \$1"
3812                 failed=\$?
3813                 echo ""
3814                 exit \$failed
3815         else
3816                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3817                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3818                 if $test ! -d "\$dir"; then
3819                         me=\`basename \$0\`
3820                         echo "\$me: can't locate home directory for: \$name" >&2
3821                         exit 1
3822                 fi
3823                 case "\$1" in
3824                 */*)
3825                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3826                         ;;
3827                 *)
3828                         echo \$dir
3829                         ;;
3830                 esac
3831         fi
3832         ;;
3833 *)
3834         echo \$1
3835         ;;
3836 esac
3837 EOSS
3838 chmod +x filexp
3839 $eunicefix filexp
3840
3841 : now set up to get a file name
3842 cat <<EOS >getfile
3843 $startsh
3844 EOS
3845 cat <<'EOSC' >>getfile
3846 tilde=''
3847 fullpath=''
3848 already=''
3849 skip=''
3850 none_ok=''
3851 exp_file=''
3852 nopath_ok=''
3853 orig_rp="$rp"
3854 orig_dflt="$dflt"
3855 case "$gfpth" in
3856 '') gfpth='.' ;;
3857 esac
3858
3859 case "$fn" in
3860 *\(*)
3861         : getfile will accept an answer from the comma-separated list
3862         : enclosed in parentheses even if it does not meet other criteria.
3863         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3864         fn=`echo $fn | sed 's/(.*)//'`
3865         ;;
3866 esac
3867
3868 case "$fn" in
3869 *:*)
3870         loc_file=`expr $fn : '.*:\(.*\)'`
3871         fn=`expr $fn : '\(.*\):.*'`
3872         ;;
3873 esac
3874
3875 case "$fn" in
3876 *~*) tilde=true;;
3877 esac
3878 case "$fn" in
3879 */*) fullpath=true;;
3880 esac
3881 case "$fn" in
3882 *+*) skip=true;;
3883 esac
3884 case "$fn" in
3885 *n*) none_ok=true;;
3886 esac
3887 case "$fn" in
3888 *e*) exp_file=true;;
3889 esac
3890 case "$fn" in
3891 *p*) nopath_ok=true;;
3892 esac
3893
3894 case "$fn" in
3895 *f*) type='File';;
3896 *d*) type='Directory';;
3897 *l*) type='Locate';;
3898 esac
3899
3900 what="$type"
3901 case "$what" in
3902 Locate) what='File';;
3903 esac
3904
3905 case "$exp_file" in
3906 '')
3907         case "$d_portable" in
3908         "$define") ;;
3909         *) exp_file=true;;
3910         esac
3911         ;;
3912 esac
3913
3914 cd ..
3915 while test "$type"; do
3916         redo=''
3917         rp="$orig_rp"
3918         dflt="$orig_dflt"
3919         case "$tilde" in
3920         true) rp="$rp (~name ok)";;
3921         esac
3922         . UU/myread
3923         if test -f UU/getfile.ok && \
3924                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3925         then
3926                 value="$ans"
3927                 ansexp="$ans"
3928                 break
3929         fi
3930         case "$ans" in
3931         none)
3932                 value=''
3933                 ansexp=''
3934                 case "$none_ok" in
3935                 true) type='';;
3936                 esac
3937                 ;;
3938         *)
3939                 case "$tilde" in
3940                 '') value="$ans"
3941                         ansexp="$ans";;
3942                 *)
3943                         value=`UU/filexp $ans`
3944                         case $? in
3945                         0)
3946                                 if test "$ans" != "$value"; then
3947                                         echo "(That expands to $value on this system.)"
3948                                 fi
3949                                 ;;
3950                         *) value="$ans";;
3951                         esac
3952                         ansexp="$value"
3953                         case "$exp_file" in
3954                         '') value="$ans";;
3955                         esac
3956                         ;;
3957                 esac
3958                 case "$fullpath" in
3959                 true)
3960                         case "$ansexp" in
3961                         /*) value="$ansexp" ;;
3962                         [a-zA-Z]:/*) value="$ansexp" ;;
3963                         *)
3964                                 redo=true
3965                                 case "$already" in
3966                                 true)
3967                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3968                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3969                                         ;;
3970                                 *)
3971                                 echo "Please give a full path name, starting with slash." >&4
3972                                         case "$tilde" in
3973                                         true)
3974                                 echo "Note that using ~name is ok provided it expands well." >&4
3975                                                 already=true
3976                                                 ;;
3977                                         esac
3978                                 esac
3979                                 ;;
3980                         esac
3981                         ;;
3982                 esac
3983                 case "$redo" in
3984                 '')
3985                         case "$type" in
3986                         File)
3987                                 for fp in $gfpth; do
3988                                         if test "X$fp" = X.; then
3989                                             pf="$ansexp"
3990                                         else    
3991                                             pf="$fp/$ansexp"
3992                                         fi
3993                                         if test -f "$pf"; then
3994                                                 type=''
3995                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3996                                         then
3997                                                 echo "($value is not a plain file, but that's ok.)"
3998                                                 type=''
3999                                         fi
4000                                         if test X"$type" = X; then
4001                                             value="$pf"
4002                                             break
4003                                         fi
4004                                 done
4005                                 ;;
4006                         Directory)
4007                                 for fp in $gfpth; do
4008                                         if test "X$fp" = X.; then
4009                                             dir="$ans"
4010                                             direxp="$ansexp"
4011                                         else    
4012                                             dir="$fp/$ansexp"
4013                                             direxp="$fp/$ansexp"
4014                                         fi
4015                                         if test -d "$direxp"; then
4016                                                 type=''
4017                                                 value="$dir"
4018                                                 break
4019                                         fi
4020                                 done
4021                                 ;;
4022                         Locate)
4023                                 if test -d "$ansexp"; then
4024                                         echo "(Looking for $loc_file in directory $value.)"
4025                                         value="$value/$loc_file"
4026                                         ansexp="$ansexp/$loc_file"
4027                                 fi
4028                                 if test -f "$ansexp"; then
4029                                         type=''
4030                                 fi
4031                                 case "$nopath_ok" in
4032                                 true)   case "$value" in
4033                                         */*) ;;
4034                                         *)      echo "Assuming $value will be in people's path."
4035                                                 type=''
4036                                                 ;;
4037                                         esac
4038                                         ;;
4039                                 esac
4040                                 ;;
4041                         esac
4042
4043                         case "$skip" in
4044                         true) type='';
4045                         esac
4046
4047                         case "$type" in
4048                         '') ;;
4049                         *)
4050                                 if test "$fastread" = yes; then
4051                                         dflt=y
4052                                 else
4053                                         dflt=n
4054                                 fi
4055                                 rp="$what $value doesn't exist.  Use that name anyway?"
4056                                 . UU/myread
4057                                 dflt=''
4058                                 case "$ans" in
4059                                 y*) type='';;
4060                                 *) echo " ";;
4061                                 esac
4062                                 ;;
4063                         esac
4064                         ;;
4065                 esac
4066                 ;;
4067         esac
4068 done
4069 cd UU
4070 ans="$value"
4071 rp="$orig_rp"
4072 dflt="$orig_dflt"
4073 rm -f getfile.ok
4074 test "X$gfpthkeep" != Xy && gfpth=""
4075 EOSC
4076
4077 : determine root of directory hierarchy where package will be installed.
4078 case "$prefix" in
4079 '')
4080         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4081         ;;
4082 *?/)
4083         dflt=`echo "$prefix" | sed 's/.$//'`
4084         ;;
4085 *)
4086         dflt="$prefix"
4087         ;;
4088 esac
4089 $cat <<EOM
4090
4091 By default, $package will be installed in $dflt/bin, manual pages
4092 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4093 installation directories. Typically this is something like /usr/local.
4094 If you wish to have binaries under /usr/bin but other parts of the
4095 installation under /usr/local, that's ok: you will be prompted
4096 separately for each of the installation directories, the prefix being
4097 only used to set the defaults.
4098
4099 EOM
4100 fn=d~
4101 rp='Installation prefix to use?'
4102 . ./getfile
4103 oldprefix=''
4104 case "$prefix" in
4105 '') ;;
4106 *)
4107         case "$ans" in
4108         "$prefix") ;;
4109         *) oldprefix="$prefix";;
4110         esac
4111         ;;
4112 esac
4113 prefix="$ans"
4114 prefixexp="$ansexp"
4115
4116 : allow them to override the AFS root
4117 case "$afsroot" in
4118 '')     afsroot=/afs ;;
4119 *)      afsroot=$afsroot ;;
4120 esac
4121
4122 : is AFS running?
4123 echo " "
4124 case "$afs" in
4125 $define|true)   afs=true ;;
4126 $undef|false)   afs=false ;;
4127 *)      if $test -d $afsroot; then
4128                 afs=true
4129         else
4130                 afs=false
4131         fi
4132         ;;
4133 esac
4134 if $afs; then
4135         echo "AFS may be running... I'll be extra cautious then..." >&4
4136 else
4137         echo "AFS does not seem to be running..." >&4
4138 fi
4139
4140 : determine installation prefix for where package is to be installed.
4141 if $afs; then
4142 $cat <<EOM
4143
4144 Since you are running AFS, I need to distinguish the directory in which
4145 files will reside from the directory in which they are installed (and from
4146 which they are presumably copied to the former directory by occult means).
4147
4148 EOM
4149         case "$installprefix" in
4150         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4151         *) dflt="$installprefix";;
4152         esac
4153 else
4154 $cat <<EOM
4155
4156 In some special cases, particularly when building $package for distribution,
4157 it is convenient to distinguish the directory in which files should be
4158 installed from the directory ($prefix) in which they will
4159 eventually reside.  For most users, these two directories are the same.
4160
4161 EOM
4162         case "$installprefix" in
4163         '') dflt=$prefix ;;
4164         *) dflt=$installprefix;;
4165         esac
4166 fi
4167 fn=d~
4168 rp='What installation prefix should I use for installing files?'
4169 . ./getfile
4170 installprefix="$ans"
4171 installprefixexp="$ansexp"
4172
4173 : Perform the prefixexp/installprefixexp correction if necessary
4174 cat <<EOS >installprefix
4175 $startsh
4176 EOS
4177 cat <<'EOSC' >>installprefix
4178 : Change installation prefix, if necessary.
4179 if $test X"$prefix" != X"$installprefix"; then
4180     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4181 else
4182     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4183 fi
4184 EOSC
4185 chmod +x installprefix
4186 $eunicefix installprefix
4187
4188 : Set variables such as privlib and privlibexp from the output of ./getfile
4189 : performing the prefixexp/installprefixexp correction if necessary.
4190 cat <<EOS >setprefixvar
4191 $startsh
4192 EOS
4193 cat <<'EOSC' >>setprefixvar
4194 eval "${prefixvar}=\"\$ans\""
4195 eval "${prefixvar}exp=\"\$ansexp\""
4196 . ./installprefix
4197 EOSC
4198 chmod +x setprefixvar
4199 $eunicefix setprefixvar
4200
4201 : set up the script used to warn in case of inconsistency
4202 cat <<EOS >whoa
4203 $startsh
4204 EOS
4205 cat <<'EOSC' >>whoa
4206 dflt=y
4207 case "$hint" in
4208     recommended)
4209         case "$hintfile" in
4210         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4211                 ;;
4212         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4213                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4214                 ;;
4215         esac
4216         ;;
4217     *)  echo " "
4218         echo "*** WHOA THERE!!! ***" >&4
4219         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4220         ;;
4221 esac
4222 rp="    Keep the $hint value?"
4223 . ./myread
4224 case "$ans" in
4225 y) td=$was; tu=$was;;
4226 esac
4227 EOSC
4228
4229 : function used to set '$1' to '$val'
4230 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4231 case "$val$was" in
4232 $define$undef) . ./whoa; eval "$var=\$td";;
4233 $undef$define) . ./whoa; eval "$var=\$tu";;
4234 *) eval "$var=$val";;
4235 esac'
4236
4237 : get the patchlevel
4238 echo " "
4239 echo "Getting the current patchlevel..." >&4
4240 if $test -r $rsrc/patchlevel.h;then
4241         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4242         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4243         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4244         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4245         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4246         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4247         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4248 else
4249         revision=0
4250         patchlevel=0
4251         subversion=0
4252         api_revision=0
4253         api_version=0
4254         api_subversion=0
4255         perl_patchlevel=0
4256         $echo "(You do not have patchlevel.h.  Eek.)"
4257 fi
4258 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4259 version_patchlevel_string="version $patchlevel subversion $subversion"
4260 case "$perl_patchlevel" in
4261 0|'') ;;
4262 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4263     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4264     ;;
4265 esac
4266
4267 $echo "(You have $package $version_patchlevel_string.)"
4268
4269 case "$osname" in
4270 dos|vms)
4271         : XXX Should be a Configure test for double-dots in filenames.
4272         version=`echo $revision $patchlevel $subversion | \
4273                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4274         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4275                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4276         ;;
4277 *)
4278         version=`echo $revision $patchlevel $subversion | \
4279                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4280         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4281                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4282         ;;
4283 esac
4284 : Special case the 5.005_xx maintenance series, which used 5.005
4285 : without any subversion label as a subdirectory in $sitelib
4286 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4287         api_versionstring='5.005'
4288 fi
4289
4290 : Do we want threads support and if so, what type
4291 case "$usethreads" in
4292 $define|true|[yY]*)     dflt='y';;
4293 *)     # Catch case where user specified ithreads or 5005threads but
4294        # forgot -Dusethreads (A.D. 4/2002)
4295        case "$useithreads$use5005threads" in
4296        *$define*)       dflt='y';;
4297        *)               dflt='n';;
4298        esac
4299        ;;
4300 esac
4301 cat <<EOM
4302
4303 Perl can be built to offer a form of threading support on some systems
4304 To do so, Configure can be run with -Dusethreads.
4305
4306 Note that Perl built with threading support runs slightly slower
4307 and uses slightly more memory than plain Perl.
4308
4309 If this doesn't make any sense to you, just accept the default '$dflt'.
4310 EOM
4311 rp='Build a threading Perl?'
4312 . ./myread
4313 case "$ans" in
4314 y|Y)    val="$define" ;;
4315 *)      val="$undef" ;;
4316 esac
4317 set usethreads
4318 eval $setvar
4319
4320 if $test $patchlevel -lt 9; then
4321     case "$usethreads" in
4322     $define)
4323         : Default to ithreads unless overridden on command line or with
4324         : old config.sh
4325         dflt='y'
4326         case "$use5005threads" in
4327                 $define|true|[yY]*)
4328                         echo "5.005 threads are no longer supported"
4329                         exit 1
4330                 ;;
4331         esac
4332         case "$useithreads" in
4333                 $undef|false|[nN]*) dflt='n';;
4334         esac
4335         rp='Use the newer interpreter-based ithreads?'
4336         . ./myread
4337         case "$ans" in
4338         y|Y)    val="$define" ;;
4339         *)      val="$undef" ;;
4340         esac
4341         set useithreads
4342         eval $setvar
4343         : Now set use5005threads to the opposite value.
4344         case "$useithreads" in
4345         $define) val="$undef" ;;
4346         *) val="$define" ;;
4347         esac
4348         set use5005threads
4349         eval $setvar
4350         ;;
4351     *)
4352         useithreads="$undef"
4353         use5005threads="$undef"
4354         ;;
4355     esac
4356
4357     case "$useithreads$use5005threads" in
4358     "$define$define")
4359         $cat >&4 <<EOM
4360
4361 You cannot have both the ithreads and the 5.005 threads enabled
4362 at the same time.  Disabling the 5.005 threads since they are
4363 much less stable than the ithreads.
4364
4365 EOM
4366         use5005threads="$undef"
4367         ;;
4368     esac
4369
4370 else
4371 : perl-5.9.x and later
4372
4373     if test X"$usethreads" = "X$define"; then
4374         case "$use5005threads" in
4375             $define|true|[yY]*)
4376                 $cat >&4 <<EOM
4377
4378 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4379
4380 EOM
4381             ;;
4382         esac
4383     fi
4384
4385     use5005threads="$undef"
4386     useithreads="$usethreads"
4387 fi
4388
4389 case "$d_oldpthreads" in
4390 '')     : Configure tests would be welcome here.  For now, assume undef.
4391         val="$undef" ;;
4392 *)      val="$d_oldpthreads" ;;
4393 esac
4394 set d_oldpthreads
4395 eval $setvar
4396
4397
4398 : Look for a hint-file generated 'call-back-unit'.  If the
4399 : user has specified that a threading perl is to be built,
4400 : we may need to set or change some other defaults.
4401 if $test -f usethreads.cbu; then
4402     echo "Your platform has some specific hints regarding threaded builds, using them..."
4403     . ./usethreads.cbu
4404 else
4405     case "$usethreads" in
4406         "$define"|true|[yY]*)
4407                 $cat <<EOM
4408 (Your platform does not have any specific hints for threaded builds.
4409  Assuming POSIX threads, then.)
4410 EOM
4411         ;;
4412     esac
4413 fi
4414
4415 : Check if multiplicity is required
4416 cat <<EOM
4417
4418 Perl can be built so that multiple Perl interpreters can coexist
4419 within the same Perl executable.
4420 EOM
4421
4422 case "$useithreads" in
4423 $define)
4424         cat <<EOM
4425 This multiple interpreter support is required for interpreter-based threads.
4426 EOM
4427         val="$define"
4428         ;;
4429 *)      case "$usemultiplicity" in
4430         $define|true|[yY]*)     dflt='y';;
4431         *) dflt='n';;
4432         esac
4433         echo " "
4434         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4435         rp='Build Perl for multiplicity?'
4436         . ./myread
4437         case "$ans" in
4438         y|Y)    val="$define" ;;
4439         *)      val="$undef" ;;
4440         esac
4441         ;;
4442 esac
4443 set usemultiplicity
4444 eval $setvar
4445
4446 : Check if morebits is requested
4447 case "$usemorebits" in
4448 "$define"|true|[yY]*)
4449         use64bitint="$define"
4450         uselongdouble="$define"
4451         usemorebits="$define"
4452         ;;
4453 *)      usemorebits="$undef"
4454         ;;
4455 esac
4456
4457 : Determine the C compiler to be used
4458 echo " "
4459 case "$cc" in
4460 '') dflt=cc;;
4461 *) dflt="$cc";;
4462 esac
4463 rp="Use which C compiler?"
4464 . ./myread
4465 cc="$ans"
4466
4467 : See whether they have no cc but they do have gcc
4468 . ./trygcc
4469 if $test -f cc.cbu; then
4470     . ./cc.cbu
4471 fi
4472 . ./checkcc
4473
4474 : make some quick guesses about what we are up against
4475 echo " "
4476 $echo $n "Hmm...  $c"
4477 echo exit 1 >bsd
4478 echo exit 1 >usg
4479 echo exit 1 >v7
4480 echo exit 1 >osf1
4481 echo exit 1 >eunice
4482 echo exit 1 >xenix
4483 echo exit 1 >venix
4484 echo exit 1 >os2
4485 d_bsd="$undef"
4486 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4487 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4488 then
4489         echo "Looks kind of like an OSF/1 system, but we'll see..."
4490         echo exit 0 >osf1
4491 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4492         xxx=`./loc addbib blurfl $pth`
4493         if $test -f $xxx; then
4494         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4495                 echo exit 0 >bsd
4496                 echo exit 0 >usg
4497         else
4498                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4499                         echo "Looks kind of like an extended USG system, but we'll see..."
4500                 else
4501                         echo "Looks kind of like a USG system, but we'll see..."
4502                 fi
4503                 echo exit 0 >usg
4504         fi
4505 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4506         echo "Looks kind of like a BSD system, but we'll see..."
4507         d_bsd="$define"
4508         echo exit 0 >bsd
4509 else
4510         echo "Looks kind of like a Version 7 system, but we'll see..."
4511         echo exit 0 >v7
4512 fi
4513 case "$eunicefix" in
4514 *unixtovms*)
4515         $cat <<'EOI'
4516 There is, however, a strange, musty smell in the air that reminds me of
4517 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4518 EOI
4519         echo exit 0 >eunice
4520         d_eunice="$define"
4521 : it so happens the Eunice I know will not run shell scripts in Unix format
4522         ;;
4523 *)
4524         echo " "
4525         echo "Congratulations.  You aren't running Eunice."
4526         d_eunice="$undef"
4527         ;;
4528 esac
4529 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4530 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4531 : semicolon as a patch separator
4532 case "$p_" in
4533 :) ;;
4534 *)
4535         $cat <<'EOI'
4536 I have the feeling something is not exactly right, however...don't tell me...
4537 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4538 (Or you may be running DOS with DJGPP.)
4539 EOI
4540         echo exit 0 >os2
4541         ;;
4542 esac
4543 if test -f /xenix; then
4544         echo "Actually, this looks more like a XENIX system..."
4545         echo exit 0 >xenix
4546         d_xenix="$define"
4547 else
4548         echo " "
4549         echo "It's not Xenix..."
4550         d_xenix="$undef"
4551 fi
4552 chmod +x xenix
4553 $eunicefix xenix
4554 if test -f /venix; then
4555         echo "Actually, this looks more like a VENIX system..."
4556         echo exit 0 >venix
4557 else
4558         echo " "
4559         if ./xenix; then
4560                 : null
4561         else
4562                 echo "Nor is it Venix..."
4563         fi
4564 fi
4565 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4566 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4567 $rm -f foo
4568
4569 : Check if we are using GNU gcc and what its version is
4570 echo " "
4571 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4572 $cat >try.c <<EOM
4573 #include <stdio.h>
4574 int main() {
4575 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4576 #ifdef __VERSION__
4577         printf("%s\n", __VERSION__);
4578 #else
4579         printf("%s\n", "1");
4580 #endif
4581 #endif
4582         return(0);
4583 }
4584 EOM
4585 if $cc -o try $ccflags $ldflags try.c; then
4586         gccversion=`$run ./try`
4587         case "$gccversion" in
4588         '') echo "You are not using GNU cc." ;;
4589         *)  echo "You are using GNU cc $gccversion."
4590             ccname=gcc
4591             ;;
4592         esac
4593 else
4594         echo " "
4595         echo "*** WHOA THERE!!! ***" >&4
4596         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4597         case "$knowitall" in
4598         '')
4599         echo "    You'd better start hunting for one and let me know about it." >&4
4600                 exit 1
4601                 ;;
4602         esac
4603 fi
4604 $rm -f try try.*
4605 case "$gccversion" in
4606 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4607 esac
4608 case "$gccversion" in
4609 '') gccosandvers='' ;;
4610 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4611    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4612    gccshortvers=''
4613    case "$gccosandvers" in
4614    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4615    $osname$osvers) ;; # looking good
4616    $osname*) cat <<EOM >&4
4617
4618 *** WHOA THERE!!! ***
4619
4620     Your gcc has not been compiled for the exact release of
4621     your operating system ($gccosandvers versus $osname$osvers).
4622
4623     In general it is a good idea to keep gcc synchronized with
4624     the operating system because otherwise serious problems
4625     may ensue when trying to compile software, like Perl.
4626
4627     I'm trying to be optimistic here, though, and will continue.
4628     If later during the configuration and build icky compilation
4629     problems appear (headerfile conflicts being the most common
4630     manifestation), I suggest reinstalling the gcc to match
4631     your operating system release.
4632
4633 EOM
4634       ;;
4635    *) gccosandvers='' ;; # failed to parse, better be silent
4636    esac
4637    ;;
4638 esac
4639 case "$ccname" in
4640 '') ccname="$cc" ;;
4641 esac
4642
4643 # gcc 3.* complain about adding -Idirectories that they already know about,
4644 # so we will take those off from locincpth.
4645 case "$gccversion" in
4646 3*)
4647     echo "main(){}">try.c
4648     for incdir in $locincpth; do
4649        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4650              grep '^c[cp]p*[01]: warning: changing search order '`
4651        if test "X$warn" != X; then
4652            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4653        fi
4654     done
4655     $rm -f try try.*
4656 esac
4657
4658 # gcc 4.9 by default does some optimizations that break perl.
4659 # see ticket 121505.
4660 #
4661 # The -fwrapv disables those optimizations (and probably others,) so
4662 # for gcc 4.9 (and later, since the optimizations probably won't go
4663 # away), add -fwrapv unless the user requests -fno-wrapv, which
4664 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4665 # which turns the overflows -fwrapv ignores into runtime errors.
4666 case "$gccversion" in
4667 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4668     case "$ccflags" in
4669     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4670     *) ccflags="$ccflags -fwrapv" ;;
4671     esac
4672 esac
4673
4674 : What should the include directory be ?
4675 : Use sysroot if set, so findhdr looks in the right place.
4676 echo " "
4677 $echo $n "Hmm...  $c"
4678 dflt="$sysroot/usr/include"
4679 incpath=''
4680 mips_type=''
4681 if $test -f /bin/mips && /bin/mips; then
4682         echo "Looks like a MIPS system..."
4683         $cat >usr.c <<'EOCP'
4684 #ifdef SYSTYPE_BSD43
4685 /bsd43
4686 #endif
4687 EOCP
4688         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4689                 dflt='/bsd43/usr/include'
4690                 incpath='/bsd43'
4691                 mips_type='BSD 4.3'
4692         else
4693                 mips_type='System V'
4694         fi
4695         $rm -f usr.c usr.out
4696         echo "and you're compiling with the $mips_type compiler and libraries."
4697         xxx_prompt=y
4698         echo "exit 0" >mips
4699 else
4700         echo "Doesn't look like a MIPS system."
4701         xxx_prompt=n
4702         echo "exit 1" >mips
4703 fi
4704 chmod +x mips
4705 $eunicefix mips
4706 case "$usrinc" in
4707 '') ;;
4708 *) dflt="$usrinc";;
4709 esac
4710 case "$xxx_prompt" in
4711 y)      fn=d/
4712         echo " "
4713         rp='Where are the include files you want to use?'
4714         . ./getfile
4715         usrinc="$ans"
4716         ;;
4717 *)      usrinc="$dflt"
4718         ;;
4719 esac
4720
4721 : see how we invoke the C preprocessor
4722 echo " "
4723 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4724 cat <<'EOT' >testcpp.c
4725 #define ABC abc
4726 #define XYZ xyz
4727 ABC.XYZ
4728 EOT
4729 cd ..
4730 if test ! -f cppstdin; then
4731         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4732                 # AIX cc -E doesn't show the absolute headerfile
4733                 # locations but we'll cheat by using the -M flag.
4734                 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
4735         else
4736                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4737         fi
4738 else
4739         echo "Keeping your $hint cppstdin wrapper."
4740 fi
4741 chmod 755 cppstdin
4742 wrapper=`pwd`/cppstdin
4743 ok='false'
4744 cd UU
4745
4746 if $test "X$cppstdin" != "X" && \
4747         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4748         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4749 then
4750         echo "You used to use $cppstdin $cppminus so we'll use that again."
4751         case "$cpprun" in
4752         '') echo "But let's see if we can live without a wrapper..." ;;
4753         *)
4754                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4755                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4756                 then
4757                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4758                         ok='true'
4759                 else
4760                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4761                 fi
4762                 ;;
4763         esac
4764 else
4765         case "$cppstdin" in
4766         '') ;;
4767         *)
4768                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4769                 ;;
4770         esac
4771 fi
4772
4773 if $ok; then
4774         : nothing
4775 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4776         $cc -E <testcpp.c >testcpp.out 2>&1; \
4777         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4778         echo "Yup, it does."
4779         x_cpp="$cc $cppflags -E"
4780         x_minus='';
4781 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4782         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4783         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4784         echo "Yup, it does."
4785         x_cpp="$cc $cppflags -E"
4786         x_minus='-';
4787 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4788         $cc -P <testcpp.c >testcpp.out 2>&1; \
4789         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4790         echo "Yipee, that works!"
4791         x_cpp="$cc $cppflags -P"
4792         x_minus='';
4793 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4794         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4795         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4796         echo "At long last!"
4797         x_cpp="$cc $cppflags -P"
4798         x_minus='-';
4799 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4800         $cpp <testcpp.c >testcpp.out 2>&1; \
4801         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4802         echo "It works!"
4803         x_cpp="$cpp $cppflags"
4804         x_minus='';
4805 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4806         $cpp - <testcpp.c >testcpp.out 2>&1; \
4807         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4808         echo "Hooray, it works!  I was beginning to wonder."
4809         x_cpp="$cpp $cppflags"
4810         x_minus='-';
4811 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4812         $wrapper <testcpp.c >testcpp.out 2>&1; \
4813         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4814         x_cpp="$wrapper"
4815         x_minus=''
4816         echo "Eureka!"
4817 else
4818         dflt=''
4819         rp="No dice.  I can't find a C preprocessor.  Name one:"
4820         . ./myread
4821         x_cpp="$ans"
4822         x_minus=''
4823         $x_cpp <testcpp.c >testcpp.out 2>&1
4824         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4825                 echo "OK, that will do." >&4
4826         else
4827 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4828                 exit 1
4829         fi
4830 fi
4831
4832 case "$ok" in
4833 false)
4834         cppstdin="$x_cpp"
4835         cppminus="$x_minus"
4836         cpprun="$x_cpp"
4837         cpplast="$x_minus"
4838         set X $x_cpp
4839         shift
4840         case "$1" in
4841         "$cpp")
4842                 echo "Perhaps can we force $cc -E using a wrapper..."
4843                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4844                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4845                 then
4846                         echo "Yup, we can."
4847                         cppstdin="$wrapper"
4848                         cppminus='';
4849                 else
4850                         echo "Nope, we'll have to live without it..."
4851                 fi
4852                 ;;
4853         esac
4854         case "$cpprun" in
4855         "$wrapper")
4856                 cpprun=''
4857                 cpplast=''
4858                 ;;
4859         esac
4860         ;;
4861 esac
4862
4863 case "$cppstdin" in
4864 "$wrapper"|'cppstdin') ;;
4865 *) $rm -f $wrapper;;
4866 esac
4867 $rm -f testcpp.c testcpp.out
4868
4869 : Adjust cppfilter for path component separator
4870 case "$osname" in
4871 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4872 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4873 *)   cppfilter='' ;;
4874 esac
4875
4876 : Use gcc to determine libpth and incpth
4877 # If using gcc or clang, we can get better values for libpth, incpth
4878 # and usrinc directly from the compiler.
4879 # Note that ccname for clang is also gcc.
4880 case "$ccname" in
4881     gcc)
4882         $echo 'extern int foo;' > try.c
4883         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4884         shift
4885         if $test $# -gt 0; then
4886             incpth="$incpth $*"
4887             incpth="`$echo $incpth|$sed 's/^ //'`"
4888             for i in $*; do
4889                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4890                 if $test -d $j; then
4891                     libpth="$libpth $j"
4892                 fi
4893             done
4894             libpth="`$echo $libpth|$sed 's/^ //'`"
4895             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4896                 if $test -d $xxx; then
4897                     case " $libpth " in
4898                     *" $xxx "*) ;;
4899                     *) libpth="$libpth $xxx";;
4900                     esac
4901                 fi
4902             done
4903         fi
4904         $rm -f try.c
4905         case "$usrinc" in
4906         '') for i in $incpth; do
4907                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4908                     usrinc="$i"
4909                     break
4910                 fi
4911             done
4912             ;;
4913         esac
4914
4915         case "$usecrosscompile" in
4916         $define|true|[yY]*)
4917             case "$incpth" in
4918                 '') echo "Incpth not defined." >&4; croak=y ;;
4919                 *)  echo "Using incpth '$incpth'." >&4 ;;
4920             esac
4921             case "$libpth" in
4922                 '') echo "Libpth not defined." >&4; croak=y ;;
4923                 *)  echo "Using libpth '$libpth'." >&4 ;;
4924             esac
4925             case "$usrinc" in
4926                 '') echo "Usrinc not defined." >&4; croak=y ;;
4927                 *)  echo "Using usrinc $usrinc." >&4 ;;
4928             esac
4929             case "$croak" in
4930                 y)
4931                 if test "X$sysroot" = X; then
4932                     echo "Cannot continue, aborting." >&4; exit 1
4933                 else
4934                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
4935                 fi
4936                 ;;
4937             esac
4938             ;;
4939         esac
4940     ;;
4941 esac
4942
4943 : Default value for incpth is just usrinc
4944 case "$incpth" in
4945 '') incpth="$usrinc";;
4946 esac
4947
4948 : Set private lib path
4949 case "$plibpth" in
4950 '') if ./mips; then
4951         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
4952     fi;;
4953 esac
4954 case "$libpth" in
4955 ' ') dlist='';;
4956 '') dlist="$loclibpth $plibpth $glibpth";;
4957 *) dlist="$libpth";;
4958 esac
4959
4960 : Now check and see which directories actually exist, avoiding duplicates
4961 for xxx in $dlist
4962 do
4963     if $test -d $xxx; then
4964                 case " $libpth " in
4965                 *" $xxx "*) ;;
4966                 *) libpth="$libpth $xxx";;
4967                 esac
4968     fi
4969 done
4970 $cat <<'EOM'
4971
4972 Some systems have incompatible or broken versions of libraries.  Among
4973 the directories listed in the question below, please remove any you
4974 know not to be holding relevant libraries, and add any that are needed.
4975 Say "none" for none.
4976
4977 EOM
4978
4979 if test "X$sysroot" != X; then
4980     $cat <<EOM
4981 You have set sysroot to $sysroot, please supply the directories excluding sysroot
4982
4983 EOM
4984 fi
4985
4986 case "$libpth" in
4987 '') dflt='none';;
4988 *)
4989         set X $libpth
4990         shift
4991         dflt=${1+"$@"}
4992         ;;
4993 esac
4994 rp="Directories to use for library searches?"
4995 . ./myread
4996 case "$ans" in
4997 none) libpth=' ';;
4998 *) libpth="$ans";;
4999 esac
5000
5001 : compute shared library extension
5002 case "$so" in
5003 '')
5004         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5005                 dflt='sl'
5006         else
5007                 dflt='so'
5008         fi
5009         ;;
5010 *) dflt="$so";;
5011 esac
5012 $cat <<EOM
5013
5014 On some systems, shared libraries may be available.  Answer 'none' if
5015 you want to suppress searching of shared libraries for the remainder
5016 of this configuration.
5017
5018 EOM
5019 rp='What is the file extension used for shared libraries?'
5020 . ./myread
5021 so="$ans"
5022
5023 : Does target system insist that shared library basenames are unique
5024 $cat << EOM
5025
5026 Some dynamic loaders assume that the *basename* of shared library filenames
5027 are globally unique.  We'll default this to undef as we assume your system
5028 is not this weird. Set to defined if you're on one of them.
5029
5030 EOM
5031
5032 dflt='n'
5033 rp='Make shared library basenames unique?'
5034 . ./myread
5035 case "$ans" in
5036 y|Y) val="$define" ;;
5037 *)   val="$undef"  ;;
5038 esac
5039 set d_libname_unique
5040 eval $setvar
5041
5042 : Define several unixisms.
5043 : Hints files or command line option can be used to override them.
5044 : The convoluted testing is in case hints files set either the old
5045 : or the new name.
5046 case "$_exe" in
5047 '')     case "$exe_ext" in
5048         '')     ;;
5049         *)      _exe="$exe_ext" ;;
5050         esac
5051         ;;
5052 esac
5053 case "$_a" in
5054 '')     case "$lib_ext" in
5055     '') _a='.a';;
5056         *)      _a="$lib_ext" ;;
5057         esac
5058         ;;
5059 esac
5060 case "$_o" in
5061 '') case "$obj_ext" in
5062         '')     _o='.o';;
5063         *)      _o="$obj_ext";;
5064         esac
5065         ;;
5066 esac
5067 case "$p_" in
5068 '') case "$path_sep" in
5069         '')     p_=':';;
5070         *)      p_="$path_sep";;
5071         esac
5072         ;;
5073 esac
5074 exe_ext=$_exe
5075 lib_ext=$_a
5076 obj_ext=$_o
5077 path_sep=$p_
5078
5079 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5080
5081 : Which makefile gets called first.  This is used by make depend.
5082 case "$firstmakefile" in
5083 '') firstmakefile='makefile';;
5084 esac
5085
5086 : Check is we will use socks
5087 case "$usesocks" in
5088 $define|true|[yY]*)     dflt='y';;
5089 *) dflt='n';;
5090 esac
5091 cat <<EOM
5092
5093 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5094 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5095 to use the PerlIO abstraction layer, this will be implicitly selected.
5096
5097 If this doesn't make any sense to you, just accept the default '$dflt'.
5098 EOM
5099 rp='Build Perl for SOCKS?'
5100 . ./myread
5101 case "$ans" in
5102 y|Y)    val="$define" ;;
5103 *)      val="$undef" ;;
5104 esac
5105 set usesocks
5106 eval $setvar
5107
5108 : Check for uselongdouble support
5109 case "$ccflags" in
5110 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5111 esac
5112
5113 case "$uselongdouble" in
5114 $define|true|[yY]*)     dflt='y';;
5115 *) dflt='n';;
5116 esac
5117 cat <<EOM
5118
5119 Perl can be built to take advantage of long doubles which
5120 (if available) may give more accuracy and range for floating point numbers.
5121
5122 If this doesn't make any sense to you, just accept the default '$dflt'.
5123 EOM
5124 rp='Try to use long doubles if available?'
5125 . ./myread
5126 case "$ans" in
5127 y|Y)    val="$define"   ;;
5128 *)      val="$undef"    ;;
5129 esac
5130 set uselongdouble
5131 eval $setvar
5132
5133 case "$uselongdouble" in
5134 true|[yY]*) uselongdouble="$define" ;;
5135 esac
5136
5137 : Look for a hint-file generated 'call-back-unit'.  If the
5138 : user has specified that long doubles should be used,
5139 : we may need to set or change some other defaults.
5140 if $test -f uselongdouble.cbu; then
5141     echo "Your platform has some specific hints regarding long doubles, using them..."
5142     . ./uselongdouble.cbu
5143 else
5144     case "$uselongdouble" in
5145         $define)
5146                 $cat <<EOM
5147 (Your platform does not have any specific hints for long doubles.)
5148 EOM
5149         ;;
5150     esac
5151 fi
5152
5153 : Looking for optional libraries
5154 echo " "
5155 echo "Checking for optional libraries..." >&4
5156 case "$libs" in
5157 ' '|'') dflt='';;
5158 *) dflt="$libs";;
5159 esac
5160 case "$libswanted" in
5161 '') libswanted='c_s';;
5162 esac
5163 case "$usesocks" in
5164 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5165 esac
5166 case "$usecbacktrace" in
5167 "$define") libswanted="$libswanted bfd" ;;
5168 esac
5169 libsfound=''
5170 libsfiles=''
5171 libsdirs=''
5172 libspath=''
5173 for thisdir in $libpth $xlibpth; do
5174   test -d $thisdir && libspath="$libspath $thisdir"
5175 done
5176 for thislib in $libswanted; do
5177         for thisdir in $libspath; do
5178             xxx=''
5179             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5180                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5181                 $test -f "$xxx" && eval $libscheck
5182                 $test -f "$xxx" && libstyle=shared
5183                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5184                 $test -f "$xxx" && eval $libscheck
5185                 $test -f "$xxx" && libstyle=shared
5186             fi
5187             if test ! -f "$xxx"; then
5188                 xxx=$thisdir/lib$thislib.$so
5189                 $test -f "$xxx" && eval $libscheck
5190                 $test -f "$xxx" && libstyle=shared
5191             fi
5192             if test ! -f "$xxx"; then
5193                 xxx=$thisdir/lib$thislib$_a
5194                 $test -f "$xxx" && eval $libscheck
5195                 $test -f "$xxx" && libstyle=static
5196             fi
5197             if test ! -f "$xxx"; then
5198                 xxx=$thisdir/$thislib$_a
5199                 $test -f "$xxx" && eval $libscheck
5200                 $test -f "$xxx" && libstyle=static
5201             fi
5202             if test ! -f "$xxx"; then
5203                 xxx=$thisdir/lib${thislib}_s$_a
5204                 $test -f "$xxx" && eval $libscheck
5205                 $test -f "$xxx" && libstyle=static
5206                 $test -f "$xxx" && thislib=${thislib}_s
5207             fi
5208             if test ! -f "$xxx"; then
5209                 xxx=$thisdir/Slib$thislib$_a
5210                 $test -f "$xxx" && eval $libscheck
5211                 $test -f "$xxx" && libstyle=static
5212             fi
5213             if $test -f "$xxx"; then
5214                 case "$libstyle" in
5215                 shared) echo "Found -l$thislib (shared)." ;;
5216                 static) echo "Found -l$thislib." ;;
5217                 *)      echo "Found -l$thislib ($libstyle)." ;;
5218                 esac
5219                 case " $dflt " in
5220                 *"-l$thislib "*);;
5221                 *) dflt="$dflt -l$thislib"
5222                    libsfound="$libsfound $xxx"
5223                    yyy=`basename $xxx`
5224                    libsfiles="$libsfiles $yyy"
5225                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5226                    case " $libsdirs " in
5227                    *" $yyy "*) ;;
5228                    *) libsdirs="$libsdirs $yyy" ;;
5229                    esac
5230                    ;;
5231                 esac
5232                 break
5233             fi
5234         done
5235         if $test ! -f "$xxx"; then
5236             echo "No -l$thislib."
5237         fi
5238 done
5239 set X $dflt
5240 shift
5241 dflt="$*"
5242 case "$libs" in
5243 '') dflt="$dflt";;
5244 *) dflt="$libs";;
5245 esac
5246 case "$dflt" in
5247 ' '|'') dflt='none';;
5248 esac
5249
5250 $cat <<EOM
5251
5252 In order to compile $package on your machine, a number of libraries
5253 are usually needed.  Include any other special libraries here as well.
5254 Say "none" for none.  The default list is almost always right.
5255 EOM
5256
5257 echo " "
5258 rp="What libraries to use?"
5259 . ./myread
5260 case "$ans" in
5261 none) libs=' ';;
5262 *) libs="$ans";;
5263 esac
5264
5265 : determine optimization, if desired, or use for debug flag also
5266 case "$optimize" in
5267 ' '|$undef) dflt='none';;
5268 '') dflt='-O';;
5269 *) dflt="$optimize";;
5270 esac
5271 $cat <<EOH
5272
5273 By default, $package compiles with the -O flag to use the optimizer.
5274 Alternately, you might want to use the symbolic debugger, which uses
5275 the -g flag (on traditional Unix systems).  Either flag can be
5276 specified here.  To use neither flag, specify the word "none".
5277
5278 EOH
5279 rp="What optimizer/debugger flag should be used?"
5280 . ./myread
5281 optimize="$ans"
5282 case "$optimize" in
5283 'none') optimize=" ";;
5284 esac
5285
5286 : Check what DEBUGGING is required from the command line
5287 : -DEBUGGING      or -DDEBUGGING or
5288 : -DEBUGGING=both                       = -g + -DDEBUGGING
5289 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5290 : -DEBUGGING=none or -UDEBUGGING        =
5291 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5292 case "$EBUGGING" in
5293 '')     ;;
5294 *)      DEBUGGING=$EBUGGING ;;
5295 esac
5296
5297 case "$DEBUGGING" in
5298 -g|both|$define)
5299     case "$optimize" in
5300         *-g*) ;;
5301         *)    optimize="$optimize -g" ;;
5302     esac ;;
5303 none|$undef)
5304     case "$optimize" in
5305         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5306                 shift
5307                 optimize="$*"
5308                 ;;
5309     esac ;;
5310 esac
5311
5312 dflt=''
5313 case "$DEBUGGING" in
5314 both|$define) dflt='-DDEBUGGING'
5315 esac
5316
5317 : argument order is deliberate, as the flag will start with - which set could
5318 : think is an option
5319 checkccflag='check=$1; flag=$2; callback=$3;
5320 echo " ";
5321 echo "Checking if your compiler accepts $flag" 2>&1;
5322 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5323 echo "int main(void) { return 0; }" > gcctest.c;
5324 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5325     echo "Yes, it does." 2>&1;
5326     if $test -s gcctest.out ; then
5327         echo "But your platform does not like it:";
5328         cat gcctest.out;
5329     else
5330         case "$ccflags" in
5331         *$check*)
5332             echo "Leaving current flags $ccflags alone." 2>&1
5333             ;;
5334         *) dflt="$dflt $flag";
5335             eval $callback
5336             ;;
5337         esac
5338     fi
5339 else
5340     echo "Nope, it does not, but that is ok." 2>&1;
5341 fi
5342 '
5343
5344 : We will not override a previous value, but we might want to
5345 : augment a hint file
5346 case "$hint" in
5347 default|recommended)
5348         case "$gccversion" in
5349         1*) dflt="$dflt -fpcc-struct-return" ;;
5350         esac
5351         case "$optimize:$DEBUGGING" in
5352         *-g*:old) dflt="$dflt -DDEBUGGING";;
5353         esac
5354         case "$gccversion" in
5355         2*) if $test -d /etc/conf/kconfig.d &&
5356                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5357                 then
5358                         # Interactive Systems (ISC) POSIX mode.
5359                         dflt="$dflt -posix"
5360                 fi
5361                 ;;
5362         esac
5363         case "$gccversion" in
5364         1*) ;;
5365         2.[0-8]*) ;;
5366         ?*)     set strict-aliasing -fno-strict-aliasing
5367                 eval $checkccflag
5368                 ;;
5369         esac
5370         # For gcc, adding -pipe speeds up compilations for some, but apparently
5371         # some assemblers can't read from stdin.  (It also slows down compilations
5372         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5373         case "$gccversion" in
5374         ?*)     set pipe -pipe
5375                 eval $checkccflag
5376                 ;;
5377         esac
5378
5379         # on x86_64 (at least) we require an extra library (libssp) in the
5380         # link command line. This library is not named, so I infer that it is
5381         # an implementation detail that may change. Hence the safest approach
5382         # is to add the flag to the flags passed to the compiler at link time,
5383         # as that way the compiler can do the right implementation dependant
5384         # thing. (NWC)
5385         case "$gccversion" in
5386         ?*)     set stack-protector -fstack-protector
5387                 eval $checkccflag
5388                 ;;
5389         esac
5390         ;;
5391 esac
5392
5393 case "$mips_type" in
5394 *BSD*|'') inclwanted="$locincpth $usrinc";;
5395 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5396 esac
5397 for thisincl in $inclwanted; do
5398         if $test -d $thisincl; then
5399                 if $test x$thisincl != x$usrinc; then
5400                         case "$dflt" in
5401                         *" -I$thisincl "*);;
5402                         *) dflt="$dflt -I$thisincl ";;
5403                         esac
5404                 fi
5405         fi
5406 done
5407
5408 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5409         xxx=true;
5410 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5411         xxx=true;
5412 else
5413         xxx=false;
5414 fi;
5415 if $xxx; then
5416         case "$dflt" in
5417         *$2*);;
5418         *) dflt="$dflt -D$2";;
5419         esac;
5420 fi'
5421
5422 set signal.h LANGUAGE_C; eval $inctest
5423
5424 case "$usesocks" in
5425 $define)
5426         ccflags="$ccflags -DSOCKS"
5427         ;;
5428 esac
5429
5430 case "$hint" in
5431 default|recommended) dflt="$ccflags $dflt" ;;
5432 *) dflt="$ccflags";;
5433 esac
5434
5435 case "$dflt" in
5436 ''|' ') dflt=none;;
5437 esac
5438
5439 $cat <<EOH
5440
5441 Your C compiler may want other flags.  For this question you should include
5442 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5443 but you should NOT include libraries or ld flags like -lwhatever.  If you
5444 want $package to honor its debug switch, you should include -DDEBUGGING here.
5445 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5446
5447 To use no flags, specify the word "none".
5448
5449 EOH
5450 set X $dflt
5451 shift
5452 dflt=${1+"$@"}
5453 rp="Any additional cc flags?"
5454 . ./myread
5455 case "$ans" in
5456 none) ccflags='';;
5457 *) ccflags="$ans";;
5458 esac
5459
5460 : the following weeds options from ccflags that are of no interest to cpp
5461 case "$cppflags" in
5462 '') cppflags="$ccflags" ;;
5463 *)  cppflags="$cppflags $ccflags" ;;
5464 esac
5465 case "$gccversion" in
5466 1*) cppflags="$cppflags -D__GNUC__"
5467 esac
5468 case "$mips_type" in
5469 '');;
5470 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5471 esac
5472 case "$cppflags" in
5473 '');;
5474 *)
5475         echo " "
5476         echo "Let me guess what the preprocessor flags are..." >&4
5477         set X $cppflags
5478         shift
5479         cppflags=''
5480         $cat >cpp.c <<'EOM'
5481 #define BLURFL foo
5482
5483 BLURFL xx LFRULB
5484 EOM
5485         previous=''
5486         for flag in $*
5487         do
5488                 case "$flag" in
5489                 -*) ftry="$flag";;
5490                 *) ftry="$previous $flag";;
5491                 esac
5492                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5493                         >cpp1.out 2>/dev/null && \
5494                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5495                         >cpp2.out 2>/dev/null && \
5496                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5497                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5498                 then
5499                         cppflags="$cppflags $ftry"
5500                         previous=''
5501                 else
5502                         previous="$flag"
5503                 fi
5504         done
5505         set X $cppflags
5506         shift
5507         cppflags=${1+"$@"}
5508         case "$cppflags" in
5509         *-*)  echo "They appear to be: $cppflags";;
5510         esac
5511         $rm -f cpp.c cpp?.out
5512         ;;
5513 esac
5514
5515 : flags used in final linking phase
5516 case "$ldflags" in
5517 '') if ./venix; then
5518                 dflt='-i -z'
5519         else
5520                 dflt=''
5521         fi
5522         case "$ccflags" in
5523         *-posix*) dflt="$dflt -posix" ;;
5524         esac
5525         ;;
5526 *) dflt="$ldflags";;
5527 esac
5528 # See note above about -fstack-protector
5529 case "$ccflags" in
5530 *-fstack-protector*)
5531         case "$dflt" in
5532         *-fstack-protector*) ;; # Don't add it again
5533         *) dflt="$dflt -fstack-protector" ;;
5534         esac
5535         ;;
5536 esac
5537
5538 : Try to guess additional flags to pick up local libraries.
5539 for thislibdir in $libpth; do
5540         case " $loclibpth " in
5541         *" $thislibdir "*)
5542                 case "$dflt " in
5543                 *"-L$thislibdir "*) ;;
5544                 *)  dflt="$dflt -L$thislibdir" ;;
5545                 esac
5546                 ;;
5547         esac
5548 done
5549
5550 case "$dflt" in
5551 '') dflt='none' ;;
5552 esac
5553
5554 $cat <<EOH
5555
5556 Your C linker may need flags.  For this question you should
5557 include -L/whatever and any other flags used by the C linker, but you
5558 should NOT include libraries like -lwhatever.
5559
5560 Make sure you include the appropriate -L/path flags if your C linker
5561 does not normally search all of the directories you specified above,
5562 namely
5563         $libpth
5564 To use no flags, specify the word "none".
5565
5566 EOH
5567
5568 rp="Any additional ld flags (NOT including libraries)?"
5569 . ./myread
5570 case "$ans" in
5571 none) ldflags='';;
5572 *) ldflags="$ans";;
5573 esac
5574 rmlist="$rmlist pdp11"
5575
5576 : coherency check
5577 echo " "
5578 echo "Checking your choice of C compiler and flags for coherency..." >&4
5579 $cat > try.c <<'EOF'
5580 #include <stdio.h>
5581 int main() { printf("Ok\n"); return(0); }
5582 EOF
5583 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5584 shift
5585 $cat >try.msg <<'EOM'
5586 I've tried to compile and run the following simple program:
5587
5588 EOM
5589 $cat try.c >> try.msg
5590
5591 $cat >> try.msg <<EOM
5592
5593 I used the command:
5594
5595         $*
5596         $run ./try
5597
5598 and I got the following output:
5599
5600 EOM
5601 dflt=y
5602 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5603         if $sh -c "$run ./try " >>try.msg 2>&1; then
5604                 xxx=`$run ./try`
5605                 case "$xxx" in
5606                 "Ok") dflt=n ;;
5607                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5608                 esac
5609         else
5610                 echo "The program compiled OK, but exited with status $?." >>try.msg
5611                 rp="You have a problem.  Shall I abort Configure"
5612                 dflt=y
5613         fi
5614 else
5615         echo "I can't compile the test program." >>try.msg
5616         rp="You have a BIG problem.  Shall I abort Configure"
5617         dflt=y
5618 fi
5619 case "$dflt" in
5620 y)
5621         $cat try.msg >&4
5622         case "$knowitall" in
5623         '')
5624                 echo "(The supplied flags or libraries might be incorrect.)"
5625                 ;;
5626         *) dflt=n;;
5627         esac
5628         echo " "
5629         . ./myread
5630         case "$ans" in
5631         n*|N*) ;;
5632         *)      echo "Ok.  Stopping Configure." >&4
5633                 exit 1
5634                 ;;
5635         esac
5636         ;;
5637 n) echo "OK, that should do.";;
5638 esac
5639 $rm_try gcctest gcctest.out
5640
5641 : define a shorthand compile call
5642 compile='
5643 mc_file=$1;
5644 shift;
5645 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5646 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5647 exit 1;
5648 fi;
5649 esac;
5650 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5651 : define a shorthand compile call for compilations that should be ok.
5652 compile_ok='
5653 mc_file=$1;
5654 shift;
5655 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5656
5657 : determine filename position in cpp output
5658 echo " "
5659 echo "Computing filename position in cpp output for #include directives..." >&4
5660 case "$osname" in
5661 vos) testaccess=-e ;;
5662 *)   testaccess=-r ;;
5663 esac
5664 echo '#include <stdio.h>' > foo.c
5665 $cat >fieldn <<EOF
5666 $startsh
5667 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5668 $grep '^[       ]*#.*stdio\.h' | \
5669 while read cline; do
5670         pos=1
5671         set \$cline
5672         while $test \$# -gt 0; do
5673                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5674                         echo "\$pos"
5675                         exit 0
5676                 fi
5677                 shift
5678                 pos=\`expr \$pos + 1\`
5679         done
5680 done
5681 EOF
5682 chmod +x fieldn
5683 fieldn=`./fieldn`
5684 $rm -f foo.c fieldn
5685 case $fieldn in
5686 '') pos='???';;
5687 1) pos=first;;
5688 2) pos=second;;
5689 3) pos=third;;
5690 *) pos="${fieldn}th";;
5691 esac
5692 echo "Your cpp writes the filename in the $pos field of the line."
5693
5694 : locate header file
5695 $cat >findhdr <<EOF
5696 $startsh
5697 wanted=\$1
5698 name=''
5699 for usrincdir in $incpth
5700 do
5701         if test -f \$usrincdir/\$wanted; then
5702                 echo "\$usrincdir/\$wanted"
5703                 exit 0
5704         fi
5705 done
5706 awkprg='{ print \$$fieldn }'
5707 echo "#include <\$wanted>" > foo\$\$.c
5708 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5709 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5710 while read cline; do
5711         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5712         case "\$name" in
5713         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5714         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5715         *) exit 2;;
5716         esac;
5717 done;
5718 #
5719 # status = 0: grep returned 0 lines, case statement not executed
5720 # status = 1: headerfile found
5721 # status = 2: while loop executed, no headerfile found
5722 #
5723 status=\$?
5724 $rm -f foo\$\$.c;
5725 if test \$status -eq 1; then
5726         exit 0;
5727 fi
5728 exit 1
5729 EOF
5730 chmod +x findhdr
5731
5732 : define an alternate in-header-list? function
5733 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5734 cont=true; xxf="echo \"<\$1> found.\" >&4";
5735 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5736 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5737 esac;
5738 case $# in 4) instead=instead;; *) instead="at last";; esac;
5739 while $test "$cont"; do
5740         xxx=`./findhdr $1`
5741         var=$2; eval "was=\$$2";
5742         if $test "$xxx" && $test -r "$xxx";
5743         then eval $xxf;
5744         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5745                 cont="";
5746         else eval $xxnf;
5747         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5748         set $yyy; shift; shift; yyy=$@;
5749         case $# in 0) cont="";;
5750         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5751                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5752         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5753                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5754         esac;
5755 done;
5756 while $test "$yyy";
5757 do set $yyy; var=$2; eval "was=\$$2";
5758         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5759         set $yyy; shift; shift; yyy=$@;
5760 done'
5761
5762 : see if stdlib is available
5763 set stdlib.h i_stdlib
5764 eval $inhdr
5765
5766 : check for lengths of integral types
5767 echo " "
5768 case "$intsize" in
5769 '')
5770         echo "Checking to see how big your integers are..." >&4
5771         $cat >try.c <<EOCP
5772 #include <stdio.h>
5773 #$i_stdlib I_STDLIB
5774 #ifdef I_STDLIB
5775 #include <stdlib.h>
5776 #endif
5777 int main()
5778 {
5779         printf("intsize=%d;\n", (int)sizeof(int));
5780         printf("longsize=%d;\n", (int)sizeof(long));
5781         printf("shortsize=%d;\n", (int)sizeof(short));
5782         exit(0);
5783 }
5784 EOCP
5785         set try
5786         if eval $compile_ok && $run ./try > /dev/null; then
5787                 eval `$run ./try`
5788                 echo "Your integers are $intsize bytes long."
5789                 echo "Your long integers are $longsize bytes long."
5790                 echo "Your short integers are $shortsize bytes long."
5791         else
5792                 $cat >&4 <<EOM
5793 !
5794 Help! I can't compile and run the intsize test program: please enlighten me!
5795 (This is probably a misconfiguration in your system or libraries, and
5796 you really ought to fix it.  Still, I'll try anyway.)
5797 !
5798 EOM
5799                 dflt=4
5800                 rp="What is the size of an integer (in bytes)?"
5801                 . ./myread
5802                 intsize="$ans"
5803                 dflt=$intsize
5804                 rp="What is the size of a long integer (in bytes)?"
5805                 . ./myread
5806                 longsize="$ans"
5807                 dflt=2
5808                 rp="What is the size of a short integer (in bytes)?"
5809                 . ./myread
5810                 shortsize="$ans"
5811         fi
5812         ;;
5813 esac
5814 $rm_try
5815
5816 : check for long long
5817 echo " "
5818 echo "Checking to see if you have long long..." >&4
5819 echo 'int main() { long long x = 7; return 0; }' > try.c
5820 set try
5821 if eval $compile; then
5822         val="$define"
5823         echo "You have long long."
5824 else
5825         val="$undef"
5826         echo "You do not have long long."
5827 fi
5828 $rm_try
5829 set d_longlong
5830 eval $setvar
5831
5832 : check for length of long long
5833 case "${d_longlong}${longlongsize}" in
5834 $define)
5835         echo " "
5836         echo "Checking to see how big your long longs are..." >&4
5837         $cat >try.c <<'EOCP'
5838 #include <stdio.h>
5839 int main()
5840 {
5841     printf("%d\n", (int)sizeof(long long));
5842     return(0);
5843 }
5844 EOCP
5845         set try
5846         if eval $compile_ok; then
5847                 longlongsize=`$run ./try`
5848                 echo "Your long longs are $longlongsize bytes long."
5849         else
5850                 dflt='8'
5851                 echo " "
5852                 echo "(I can't seem to compile the test program.  Guessing...)"
5853                 rp="What is the size of a long long (in bytes)?"
5854                 . ./myread
5855                 longlongsize="$ans"
5856         fi
5857         if $test "X$longsize" = "X$longlongsize"; then
5858                 echo "(That isn't any different from an ordinary long.)"
5859         fi
5860         ;;
5861 esac
5862 $rm_try
5863
5864 : see if inttypes.h is available
5865 : we want a real compile instead of Inhdr because some systems
5866 : have an inttypes.h which includes non-existent headers
5867 echo " "
5868 $cat >try.c <<EOCP
5869 #include <inttypes.h>
5870 int main() {
5871         static int32_t foo32 = 0x12345678;
5872 }
5873 EOCP
5874 set try
5875 if eval $compile; then
5876         echo "<inttypes.h> found." >&4
5877         val="$define"
5878 else
5879         echo "<inttypes.h> NOT found." >&4
5880         val="$undef"
5881 fi
5882 $rm_try
5883 set i_inttypes
5884 eval $setvar
5885
5886 : check for int64_t
5887 echo " "
5888 echo "Checking to see if you have int64_t..." >&4
5889 $cat >try.c <<EOCP
5890 #include <sys/types.h>
5891 #$i_inttypes I_INTTYPES
5892 #ifdef I_INTTYPES
5893 #include <inttypes.h>
5894 #endif
5895 int main() { int64_t x = 7; }
5896 EOCP
5897 set try
5898 if eval $compile; then
5899         val="$define"
5900         echo "You have int64_t."
5901 else
5902         val="$undef"
5903         echo "You do not have int64_t."
5904 fi
5905 $rm_try
5906 set d_int64_t
5907 eval $setvar
5908
5909 : Check if 64bit ints have a quad type
5910 echo " "
5911 echo "Checking which 64-bit integer type we could use..." >&4
5912
5913 case "$intsize" in
5914 8) val=int
5915    set quadtype
5916    eval $setvar
5917    val='"unsigned int"'
5918    set uquadtype
5919    eval $setvar
5920    quadkind=1
5921    ;;
5922 *) case "$longsize" in
5923    8) val=long
5924       set quadtype
5925       eval $setvar
5926       val='"unsigned long"'
5927       set uquadtype
5928       eval $setvar
5929       quadkind=2
5930       ;;
5931    *) case "$d_longlong:$longlongsize" in
5932       define:8)
5933         val='"long long"'
5934         set quadtype
5935         eval $setvar
5936         val='"unsigned long long"'
5937         set uquadtype
5938         eval $setvar
5939         quadkind=3
5940         ;;
5941       *) case "$d_int64_t" in
5942          define)
5943            val=int64_t
5944            set quadtype
5945            eval $setvar
5946            val=uint64_t
5947            set uquadtype
5948            eval $setvar
5949            quadkind=4
5950            ;;
5951          esac
5952          ;;
5953       esac
5954       ;;
5955    esac
5956    ;;
5957 esac
5958
5959 case "$quadtype" in
5960 '')     echo "Alas, no 64-bit integer types in sight." >&4
5961         d_quad="$undef"
5962         ;;
5963 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5964         d_quad="$define"
5965         ;;
5966 esac
5967
5968 : Do we want 64bit support
5969 case "$uselonglong" in
5970 "$define"|true|[yY]*)
5971         cat <<EOM >&4
5972
5973 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5974 EOM
5975         use64bitint="$define"
5976         ;;
5977 esac
5978 case "$use64bits" in
5979 "$define"|true|[yY]*)
5980         cat <<EOM >&4
5981
5982 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5983 EOM
5984         use64bitint="$define"
5985         ;;
5986 esac
5987 case "$use64bitints" in
5988 "$define"|true|[yY]*)
5989         cat <<EOM >&4
5990
5991 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5992 EOM
5993         use64bitint="$define"
5994         ;;
5995 esac
5996 case "$use64bitsint" in
5997 "$define"|true|[yY]*)
5998         cat <<EOM >&4
5999
6000 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6001 EOM
6002         use64bitint="$define"
6003         ;;
6004 esac
6005 case "$uselonglongs" in
6006 "$define"|true|[yY]*)
6007         cat <<EOM >&4
6008
6009 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6010 EOM
6011         use64bitint="$define"
6012         ;;
6013 esac
6014 case "$use64bitsall" in
6015 "$define"|true|[yY]*)
6016         cat <<EOM >&4
6017
6018 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6019 EOM
6020         use64bitall="$define"
6021         ;;
6022 esac
6023
6024 case "$ccflags" in
6025 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6026 esac
6027 case "$use64bitall" in
6028 "$define"|true|[yY]*) use64bitint="$define" ;;
6029 esac
6030
6031 case "$longsize" in
6032 8) cat <<EOM
6033
6034 You have natively 64-bit long integers.
6035 EOM
6036    val="$define"
6037    ;;
6038 *) case "$use64bitint" in
6039    "$define"|true|[yY]*) dflt='y';;
6040    *) dflt='n';;
6041    esac
6042    case "$d_quad" in
6043    "$define") ;;
6044    *) dflt='n' ;;
6045    esac
6046    cat <<EOM
6047
6048 Perl can be built to take advantage of 64-bit integer types
6049 on some systems.  To do so, Configure can be run with -Duse64bitint.
6050 Choosing this option will most probably introduce binary incompatibilities.
6051
6052 If this doesn't make any sense to you, just accept the default '$dflt'.
6053 (The default has been chosen based on your configuration.)
6054 EOM
6055    rp='Try to use 64-bit integers, if available?'
6056    . ./myread
6057    case "$ans" in
6058    [yY]*) val="$define" ;;
6059    *)     val="$undef"  ;;
6060    esac
6061    ;;
6062 esac
6063 set use64bitint
6064 eval $setvar
6065
6066 case "$use64bitall" in
6067 "$define"|true|[yY]*) dflt='y' ;;
6068 *) case "$longsize" in
6069    8) dflt='y' ;;
6070    *) dflt='n' ;;
6071    esac
6072    ;;
6073 esac
6074 cat <<EOM
6075
6076 You may also choose to try maximal 64-bitness.  It means using as much
6077 64-bitness as possible on the platform.  This in turn means even more
6078 binary incompatibilities.  On the other hand, your platform may not
6079 have any more 64-bitness available than what you already have chosen.
6080
6081 If this doesn't make any sense to you, just accept the default '$dflt'.
6082 (The default has been chosen based on your configuration.)
6083 EOM
6084 rp='Try to use maximal 64-bit support, if available?'
6085 . ./myread
6086 case "$ans" in
6087 [yY]*) val="$define" ;;
6088 *)     val="$undef"  ;;
6089 esac
6090 set use64bitall
6091 eval $setvar
6092 case "$use64bitall" in
6093 "$define")
6094         case "$use64bitint" in
6095         "$undef")
6096                 cat <<EOM
6097
6098 Since you have chosen a maximally 64-bit build, I'm also turning on
6099 the use of 64-bit integers.
6100 EOM
6101                 use64bitint="$define" ;;
6102         esac
6103         ;;
6104 esac
6105
6106 : Look for a hint-file generated 'call-back-unit'.  If the
6107 : user has specified that a 64-bit perl is to be built,
6108 : we may need to set or change some other defaults.
6109 if $test -f use64bitint.cbu; then
6110         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6111         . ./use64bitint.cbu
6112 fi
6113 case "$use64bitint" in
6114 "$define"|true|[yY]*)
6115         : This test was common to all the OpenBSD forks, and seems harmless for
6116         : other platforms:
6117         echo " "
6118         echo "Checking if your C library has broken 64-bit functions..." >&4
6119         cat >try.c <<EOCP
6120 #include <stdio.h>
6121 typedef $uquadtype myULL;
6122 int main (void)
6123 {
6124     struct {
6125         double d;
6126         myULL  u;
6127     } *p, test[] = {
6128         {4294967303.15, 4294967303ULL},
6129         {4294967294.2,  4294967294ULL},
6130         {4294967295.7,  4294967295ULL},
6131         {0.0, 0ULL}
6132     };
6133     for (p = test; p->u; p++) {
6134         myULL x = (myULL)p->d;
6135         if (x != p->u) {
6136             printf("buggy\n");
6137             return 0;
6138         }
6139     }
6140     printf("ok\n");
6141     return 0;
6142 }
6143 EOCP
6144         set try
6145         if eval $compile_ok; then
6146             libcquad=`$run ./try`
6147             echo "Your C library's 64-bit functions are $libcquad."
6148         else
6149             echo "(I can't seem to compile the test program.)"
6150             echo "Assuming that your C library's 64-bit functions are ok."
6151             libcquad="ok"
6152         fi
6153         $rm_try
6154
6155         case "$libcquad" in
6156             buggy*)
6157                 cat >&4 <<EOM
6158
6159 *** You have a C library with broken 64-bit functions.
6160 *** 64-bit support does not work reliably in this configuration.
6161 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6162 *** Cannot continue, aborting.
6163
6164 EOM
6165                 exit 1
6166                 ;;
6167         esac
6168         case "$longsize" in
6169         4) case "$archname64" in
6170            '') archname64=64int ;;
6171            esac
6172            ;;
6173         esac
6174         ;;
6175 esac
6176
6177 : Look for a hint-file generated 'call-back-unit'.  If the
6178 : user has specified that a maximally 64-bit perl is to be built,
6179 : we may need to set or change some other defaults.
6180 if $test -f use64bitall.cbu; then
6181         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6182         . ./use64bitall.cbu
6183 fi
6184 case "$use64bitall" in
6185 "$define"|true|[yY]*)
6186         case "$longsize" in
6187         4) case "$archname64" in
6188            ''|64int) archname64=64all ;;
6189            esac
6190            ;;
6191         esac
6192         ;;
6193 esac
6194
6195 case "$d_quad:$use64bitint" in
6196 $undef:$define)
6197         cat >&4 <<EOF
6198
6199 *** You have chosen to use 64-bit integers,
6200 *** but none can be found.
6201 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6202 *** Cannot continue, aborting.
6203
6204 EOF
6205         exit 1
6206         ;;
6207 esac
6208
6209 : Check if we are using the GNU C library
6210 echo " "
6211 echo "Checking for GNU C Library..." >&4
6212 cat >try.c <<'EOCP'
6213 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6214    alone are insufficient to distinguish different versions, such as
6215    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6216    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6217 */
6218 #include <stdio.h>
6219 int main(void)
6220 {
6221 #ifdef __GLIBC__
6222 #   ifdef __GLIBC_MINOR__
6223 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6224 #           include <gnu/libc-version.h>
6225             printf("%s\n",  gnu_get_libc_version());
6226 #       else
6227             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6228 #       endif
6229 #   else
6230         printf("%d\n",  __GLIBC__);
6231 #   endif
6232     return 0;
6233 #else
6234     return 1;
6235 #endif
6236 }
6237 EOCP
6238 set try
6239 if eval $compile_ok && $run ./try > glibc.ver; then
6240         val="$define"
6241         gnulibc_version=`$cat glibc.ver`
6242         echo "You are using the GNU C Library version $gnulibc_version"
6243 else
6244         val="$undef"
6245         gnulibc_version=''
6246         echo "You are not using the GNU C Library"
6247 fi
6248 $rm_try glibc.ver
6249 set d_gnulibc
6250 eval $setvar
6251
6252 : see if nm is to be used to determine whether a symbol is defined or not
6253 case "$usenm" in
6254 '')
6255         dflt=''
6256         case "$d_gnulibc" in
6257         "$define")
6258                 echo " "
6259                 echo "nm probably won't work on the GNU C Library." >&4
6260                 dflt=n
6261                 ;;
6262         esac
6263         case "$dflt" in
6264         '')
6265                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6266                         echo " "
6267                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6268                         echo "'nm' won't be sufficient on this system." >&4
6269                         dflt=n
6270                 fi
6271                 ;;
6272         esac
6273         case "$dflt" in
6274         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6275                 if $test $dflt -gt 20; then
6276                         dflt=y
6277                 else
6278                         dflt=n
6279                 fi
6280                 ;;
6281         esac
6282         ;;
6283 *)
6284         case "$usenm" in
6285         true|$define) dflt=y;;
6286         *) dflt=n;;
6287         esac
6288         ;;
6289 esac
6290 $cat <<EOM
6291
6292 I can use $nm to extract the symbols from your C libraries. This
6293 is a time consuming task which may generate huge output on the disk (up
6294 to 3 megabytes) but that should make the symbols extraction faster. The
6295 alternative is to skip the 'nm' extraction part and to compile a small
6296 test program instead to determine whether each symbol is present. If
6297 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6298 this may be the best solution.
6299
6300 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6301
6302 EOM
6303 rp="Shall I use $nm to extract C symbols from the libraries?"
6304 . ./myread
6305 case "$ans" in
6306 [Nn]*) usenm=false;;
6307 *) usenm=true;;
6308 esac
6309
6310 runnm=$usenm
6311 case "$reuseval" in
6312 true) runnm=false;;
6313 esac
6314
6315 : nm options which may be necessary
6316 case "$nm_opt" in
6317 '') if $test -f /mach_boot; then
6318                 nm_opt=''       # Mach
6319         elif $test -d /usr/ccs/lib; then
6320                 nm_opt='-p'     # Solaris (and SunOS?)
6321         elif $test -f /dgux; then
6322                 nm_opt='-p'     # DG-UX
6323         elif $test -f /lib64/rld; then
6324                 nm_opt='-p'     # 64-bit Irix
6325         else
6326                 nm_opt=''
6327         fi;;
6328 esac
6329
6330 : nm options which may be necessary for shared libraries but illegal
6331 : for archive libraries.  Thank you, Linux.
6332 case "$nm_so_opt" in
6333 '')     case "$myuname" in
6334         *linux*|gnu*)
6335                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6336                         nm_so_opt='--dynamic'
6337                 fi
6338                 ;;
6339         esac
6340         ;;
6341 esac
6342
6343 : Figure out where the libc is located
6344 case "$runnm" in
6345 true)
6346 : get list of predefined functions in a handy place
6347 echo " "
6348 case "$libc" in
6349 '') libc=unknown
6350         case "$libs" in
6351         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6352         esac
6353         ;;
6354 esac
6355 case "$libs" in
6356 '') ;;
6357 *)  for thislib in $libs; do
6358         case "$thislib" in
6359         -lc|-lc_s)
6360                 : Handle C library specially below.
6361                 ;;
6362         -l*)
6363                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6364                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6365                         :
6366                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6367                         :
6368                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6369                         :
6370                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6371                         :
6372                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6373                         :
6374                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6375                         :
6376                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6377                         :
6378                 else
6379                         try=''
6380                 fi
6381                 libnames="$libnames $try"
6382                 ;;
6383         *) libnames="$libnames $thislib" ;;
6384         esac
6385         done
6386         ;;
6387 esac
6388 xxx=normal
6389 case "$libc" in
6390 unknown)
6391         set /lib/libc.$so
6392         for xxx in $libpth; do
6393                 $test -r $1 || set $xxx/libc.$so
6394                 : The messy sed command sorts on library version numbers.
6395                 $test -r $1 || \
6396                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6397                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6398                                 h
6399                                 s/[0-9][0-9]*/0000&/g
6400                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6401                                 G
6402                                 s/\n/ /' | \
6403                          $sort | $sed -e 's/^.* //'`
6404                 eval set \$$#
6405         done
6406         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6407         $test -r $1 || set $sysroot/lib/libsys_s$_a
6408         ;;
6409 *)
6410         set blurfl
6411         ;;
6412 esac
6413 if $test -r "$1"; then
6414         echo "Your (shared) C library seems to be in $1."
6415         libc="$1"
6416 elif $test -r /lib/libc && $test -r /lib/clib; then
6417         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6418         xxx=apollo
6419         libc='/lib/clib /lib/libc'
6420         if $test -r /lib/syslib; then
6421                 echo "(Your math library is in /lib/syslib.)"
6422                 libc="$libc /lib/syslib"
6423         fi
6424 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6425         echo "Your C library seems to be in $libc, as you said before."
6426 elif $test -r $incpath/usr/lib/libc$_a; then
6427         libc=$incpath/usr/lib/libc$_a;
6428         echo "Your C library seems to be in $libc.  That's fine."
6429 elif $test -r /lib/libc$_a; then
6430         libc=/lib/libc$_a;
6431         echo "Your C library seems to be in $libc.  You're normal."
6432 else
6433         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6434                 :
6435         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6436                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6437         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6438                 :
6439         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6440                 :
6441         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6442                 :
6443         else
6444                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6445         fi
6446         if $test -r "$tans"; then
6447                 echo "Your C library seems to be in $tans, of all places."
6448                 libc=$tans
6449         else
6450                 libc='blurfl'
6451         fi
6452 fi
6453 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6454         dflt="$libc"
6455         cat <<EOM
6456
6457 If the guess above is wrong (which it might be if you're using a strange
6458 compiler, or your machine supports multiple models), you can override it here.
6459
6460 EOM
6461 else
6462         dflt=''
6463         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6464         cat >&4 <<EOM
6465 I can't seem to find your C library.  I've looked in the following places:
6466
6467 EOM
6468         $sed 's/^/      /' libpath
6469         cat <<EOM
6470
6471 None of these seems to contain your C library. I need to get its name...
6472
6473 EOM
6474 fi
6475 fn=f
6476 rp='Where is your C library?'
6477 . ./getfile
6478 libc="$ans"
6479
6480 echo " "
6481 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6482 set X `cat libnames`
6483 shift
6484 xxx=files
6485 case $# in 1) xxx=file; esac
6486 echo "Extracting names from the following $xxx for later perusal:" >&4
6487 echo " "
6488 $sed 's/^/      /' libnames >&4
6489 echo " "
6490 $echo $n "This may take a while...$c" >&4
6491
6492 for file in $*; do
6493         case $file in
6494         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6495         *) $nm $nm_opt $file 2>/dev/null;;
6496         esac
6497 done >libc.tmp
6498
6499 $echo $n ".$c"
6500 $grep fprintf libc.tmp > libc.ptf
6501 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6502 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6503 xxx='[ADTSIWi]'
6504 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6505         eval $xscan;\
6506         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6507                 eval $xrun
6508 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6509         eval $xscan;\
6510         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6511                 eval $xrun
6512 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6513         eval $xscan;\
6514         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6515                 eval $xrun
6516 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6517         eval $xscan;\
6518         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6519                 eval $xrun
6520 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6521         eval $xscan;\
6522         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6523                 eval $xrun
6524 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6525         eval $xscan;\
6526         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6527                 eval $xrun
6528 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6529                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6530         eval $xscan;\
6531         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6532                 eval $xrun
6533 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6534         eval $xscan;\
6535         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6536                 eval $xrun
6537 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6538         eval $xscan;\
6539         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6540                 eval $xrun
6541 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6542         eval $xscan;\
6543         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6544                 eval $xrun
6545 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6546         eval $xscan;\
6547         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6548                 eval $xrun
6549 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6550         eval $xscan;\
6551         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6552                 eval $xrun
6553 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6554         eval $xscan;\
6555         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6556                 eval $xrun
6557 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6558         eval $xscan;\
6559         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6560                 eval $xrun
6561 else
6562         $nm -p $* 2>/dev/null >libc.tmp
6563         $grep fprintf libc.tmp > libc.ptf
6564         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6565                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6566         then
6567                 nm_opt='-p'
6568                 eval $xrun
6569         else
6570                 echo " "
6571                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6572                 com=''
6573                 if $ar t $libc > libc.tmp && \
6574                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6575                 then
6576                         for thisname in $libnames $libc; do
6577                                 $ar t $thisname >>libc.tmp
6578                         done
6579                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6580                         echo "Ok." >&4
6581                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6582                         for thisname in $libnames $libc; do
6583                                 $ar tv $thisname >>libc.tmp
6584                                 emximp -o tmp.imp $thisname \
6585                                     2>/dev/null && \
6586                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6587                                     < tmp.imp >>libc.tmp
6588                                 $rm -f tmp.imp
6589                         done
6590                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6591                         echo "Ok." >&4
6592                 else
6593                         echo "$ar didn't seem to work right." >&4
6594                         echo "Maybe this is a Cray...trying bld instead..." >&4
6595                         if  bld t $libc | \
6596                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6597                                 $test -s libc.list
6598                         then
6599                                 for thisname in $libnames; do
6600                                         bld t $libnames | \
6601                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6602                                         $ar t $thisname >>libc.tmp
6603                                 done
6604                                 echo "Ok." >&4
6605                         else
6606                                 echo "That didn't work either.  Giving up." >&4
6607                                 exit 1
6608                         fi
6609                 fi
6610         fi
6611 fi
6612 nm_extract="$com"
6613 case "$PASE" in
6614 define)
6615     echo " "
6616     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6617     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6618     ;;
6619 *)  if $test -f /lib/syscalls.exp; then
6620         echo " "
6621         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6622         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6623                 /lib/syscalls.exp >>libc.list
6624     fi
6625     ;;
6626 esac
6627 ;;
6628 esac
6629 $rm -f libnames libpath
6630
6631 : Check if we are using C++
6632 echo " "
6633 echo "Checking for C++..." >&4
6634 $cat >try.c <<'EOCP'
6635 #include <stdio.h>
6636 int main(void)
6637 {
6638 #ifdef __cplusplus
6639     return 0;
6640 #else
6641     return 1;
6642 #endif
6643 }
6644 EOCP
6645 set try
6646 if eval $compile_ok && $run ./try; then
6647         val="$define"
6648         echo "You are using a C++ compiler."
6649 else
6650         val="$undef"
6651         echo "You are not using a C++ compiler."
6652 fi
6653 $rm_try cplusplus$$
6654 set d_cplusplus
6655 eval $setvar
6656
6657 : is a C symbol defined?
6658 csym='tlook=$1;
6659 case "$3" in
6660 -v) tf=libc.tmp; tdc="";;
6661 -a) tf=libc.tmp; tdc="[]";;
6662 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6663 esac;
6664 case "$d_cplusplus" in
6665     $define)    extern_C="extern \"C\"" ;;
6666     *)          extern_C="extern"       ;;
6667 esac;
6668 tx=yes;
6669 case "$reuseval-$4" in
6670 true-) ;;
6671 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6672 esac;
6673 case "$tx" in
6674 yes)
6675         tval=false;
6676         if $test "$runnm" = true; then
6677                 if $contains $tlook $tf >/dev/null 2>&1; then
6678                         tval=true;
6679                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6680                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p() && p() != (void *)main) return(0); else return(1); }"> try.c;
6681                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6682                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6683                         $rm_try;
6684                 fi;
6685         else
6686                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p() && p() != (void *)main) return(0); else return(1); }"> try.c;
6687                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6688                 $rm_try;
6689         fi;
6690         ;;
6691 *)
6692         case "$tval" in
6693         $define) tval=true;;
6694         *) tval=false;;
6695         esac;
6696         ;;
6697 esac;
6698 eval "$2=$tval"'
6699
6700 : define an is-in-libc? function
6701 inlibc='echo " "; td=$define; tu=$undef;
6702 sym=$1; var=$2; eval "was=\$$2";
6703 tx=yes;
6704 case "$reuseval$was" in
6705 true) ;;
6706 true*) tx=no;;
6707 esac;
6708 case "$tx" in
6709 yes)
6710         set $sym tres -f;
6711         eval $csym;
6712         case "$tres" in
6713         true)
6714                 echo "$sym() found." >&4;
6715                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6716         *)
6717                 echo "$sym() NOT found." >&4;
6718                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6719         esac;;
6720 *)
6721         case "$was" in
6722         $define) echo "$sym() found." >&4;;
6723         *) echo "$sym() NOT found." >&4;;
6724         esac;;
6725 esac'
6726
6727 : check for length of double
6728 echo " "
6729 case "$doublesize" in
6730 '')
6731         echo "Checking to see how big your double precision numbers are..." >&4
6732         $cat >try.c <<EOCP
6733 #include <stdio.h>
6734 #$i_stdlib I_STDLIB
6735 #ifdef I_STDLIB
6736 #include <stdlib.h>
6737 #endif
6738 int main()
6739 {
6740     printf("%d\n", (int)sizeof(double));
6741     exit(0);
6742 }
6743 EOCP
6744         set try
6745         if eval $compile_ok; then
6746                 doublesize=`$run ./try`
6747                 echo "Your double is $doublesize bytes long."
6748         else
6749                 dflt='8'
6750                 echo "(I can't seem to compile the test program.  Guessing...)"
6751                 rp="What is the size of a double precision number (in bytes)?"
6752                 . ./myread
6753                 doublesize="$ans"
6754         fi
6755         ;;
6756 esac
6757 $rm_try
6758
6759 : see if this is a float.h system
6760 set float.h i_float
6761 eval $inhdr
6762
6763 : check for long doubles
6764 echo " "
6765 echo "Checking to see if you have long double..." >&4
6766 echo 'int main() { long double x = 7.0; }' > try.c
6767 set try
6768 if eval $compile; then
6769         val="$define"
6770         echo "You have long double."
6771 else
6772         val="$undef"
6773         echo "You do not have long double."
6774 fi
6775 $rm_try
6776 set d_longdbl
6777 eval $setvar
6778
6779 : see if ldexpl exists
6780 set ldexpl d_ldexpl
6781 eval $inlibc
6782
6783 : check for length of long double
6784 case "${d_longdbl}${longdblsize}" in
6785 $define)
6786         echo " "
6787         echo "Checking to see how big your long doubles are..." >&4
6788         $cat >try.c <<'EOCP'
6789 #include <stdio.h>
6790 int main()
6791 {
6792         printf("%d\n", sizeof(long double));
6793 }
6794 EOCP
6795         set try
6796         set try
6797         if eval $compile; then
6798                 longdblsize=`$run ./try`
6799                 echo "Your long doubles are $longdblsize bytes long."
6800         else
6801                 dflt='8'
6802                 echo " "
6803                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6804                 rp="What is the size of a long double (in bytes)?"
6805                 . ./myread
6806                 longdblsize="$ans"
6807         fi
6808         if $test "X$doublesize" = "X$longdblsize"; then
6809                 echo "That isn't any different from an ordinary double."
6810                 echo "I'll keep your setting anyway, but you may see some"
6811                 echo "harmless compilation warnings."
6812         fi
6813         ;;
6814 esac
6815 $rm_try
6816
6817 $echo "Checking the kind of long doubles you have..." >&4
6818 case "$d_longdbl" in
6819 define)
6820 $cat <<EOP >try.c
6821 #$i_float I_FLOAT
6822 #$i_stdlib I_STDLIB
6823 #define LONGDBLSIZE $longdblsize
6824 #ifdef I_FLOAT
6825 #include <float.h>
6826 #endif
6827 #ifdef I_STDLIB
6828 #include <stdlib.h>
6829 #endif
6830 #include <stdio.h>
6831 static const long double d = -0.1L;
6832 int main() {
6833   unsigned const char* b = (unsigned const char*)(&d);
6834 #if LDBL_MANT_DIG == 113 && LONGDBLSIZE == 16
6835   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6836     /* IEEE 754 128-bit little-endian */
6837     printf("1\n");
6838     exit(0);
6839   }
6840   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6841     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6842     printf("2\n");
6843     exit(0);
6844   }
6845 #endif
6846 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6847   if (b[0] == 0xCD && b[9] == 0xBF && b[10] == 0x00) {
6848     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6849      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
6850      * Also known as "extended precision". */
6851     printf("3\n");
6852     exit(0);
6853   }
6854   if (b[0] == 0xBF && b[9] == 0xCD && b[10] == 0x00) {
6855     /* is there ever big-endian 80-bit, really? */
6856     printf("4\n");
6857     exit(0);
6858   }
6859 #endif
6860 #if LDBL_MANT_DIG == 106 && LONGDBLSIZE == 16
6861   /* software "double double", the 106 is 53+53 */
6862   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
6863     /* double double 128-bit little-endian,
6864      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
6865     printf("5\n");
6866     exit(0);
6867   }
6868   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
6869     /* double double 128-bit big-endian, e.g. PPC/Power and MIPS:
6870      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
6871     printf("6\n");
6872     exit(0);
6873   }
6874 #endif
6875   printf("-1\n"); /* unknown */
6876   exit(0);
6877 }
6878 EOP
6879 set try
6880 if eval $compile; then
6881     longdblkind=`$run ./try`
6882 else
6883     longdblkind=-1
6884 fi
6885 ;;
6886 *) longdblkind=0 ;;
6887 esac
6888 case "$longdblkind" in
6889 0) echo "Your long doubles are doubles." >&4 ;;
6890 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
6891 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
6892 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
6893 *) echo "Cannot figure out your long double." >&4 ;;
6894 esac
6895 $rm_try
6896
6897
6898 : determine the architecture name
6899 echo " "
6900 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6901         tarch=`arch`"-$osname"
6902 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6903         if uname -m > tmparch 2>&1 ; then
6904                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6905                         -e 's/$/'"-$osname/" tmparch`
6906         else
6907                 tarch="$osname"
6908         fi
6909         $rm -f tmparch
6910 else
6911         tarch="$osname"
6912 fi
6913 case "$myarchname" in
6914 ''|"$tarch") ;;
6915 *)
6916         echo "(Your architecture name used to be $myarchname.)"
6917         archname=''
6918         ;;
6919 esac
6920 case "$targetarch" in
6921 '') ;;
6922 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6923 esac
6924 myarchname="$tarch"
6925 case "$archname" in
6926 '') dflt="$tarch";;
6927 *) dflt="$archname";;
6928 esac
6929 rp='What is your architecture name'
6930 . ./myread
6931 archname="$ans"
6932
6933 : optionally add API version to the architecture for versioned archlibs
6934 case "$useversionedarchname" in
6935 $define|true|[yY]*) dflt='y';;
6936 *)                  dflt='n';;
6937 esac
6938 rp='Add the Perl API version to your archname?'
6939 . ./myread
6940 case "$ans" in
6941 y|Y)    useversionedarchname="$define" ;;
6942 *)      useversionedarchname="$undef" ;;
6943 esac
6944 case "$useversionedarchname" in
6945 $define)
6946         case "$archname" in
6947         *-$api_versionstring)
6948                 echo "...and architecture name already has -$api_versionstring" >&4
6949                 ;;
6950         *)
6951                 archname="$archname-$api_versionstring"
6952                 echo "...setting architecture name to $archname." >&4
6953                 ;;
6954         esac
6955         ;;
6956 esac
6957
6958 case "$usethreads" in
6959 $define)
6960         echo "Threads selected." >&4
6961         case "$archname" in
6962         *-thread*) echo "...and architecture name already has -thread." >&4
6963                 ;;
6964         *)      archname="$archname-thread"
6965                 echo "...setting architecture name to $archname." >&4
6966                 ;;
6967         esac
6968         ;;
6969 esac
6970 case "$usemultiplicity" in
6971 $define)
6972         echo "Multiplicity selected." >&4
6973         case "$archname" in
6974         *-multi*) echo "...and architecture name already has -multi." >&4
6975                 ;;
6976         *)      archname="$archname-multi"
6977                 echo "...setting architecture name to $archname." >&4
6978                 ;;
6979         esac
6980         ;;
6981 esac
6982 case "$use64bitint$use64bitall" in
6983 *"$define"*)
6984         case "$archname64" in
6985         '')
6986                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6987                 ;;
6988         *)
6989                 case "$use64bitint" in
6990                 "$define") echo "64 bit integers selected." >&4 ;;
6991                 esac
6992                 case "$use64bitall" in
6993                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6994                 esac
6995                 case "$archname" in
6996                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6997                         ;;
6998                 *)      archname="$archname-$archname64"
6999                         echo "...setting architecture name to $archname." >&4
7000                         ;;
7001                 esac
7002                 ;;
7003         esac
7004 esac
7005 case "$uselongdouble" in
7006 $define)
7007         echo "Long doubles selected." >&4
7008         case "$longdblsize" in
7009         $doublesize)
7010                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7011                 ;;
7012         *)
7013                 case "$archname" in
7014                 *-ld*) echo "...and architecture name already has -ld." >&4
7015                         ;;
7016                 *)      archname="$archname-ld"
7017                         echo "...setting architecture name to $archname." >&4
7018                         ;;
7019                 esac
7020                 ;;
7021         esac
7022         ;;
7023 esac
7024 if $test -f archname.cbu; then
7025         echo "Your platform has some specific hints for architecture name, using them..."
7026         . ./archname.cbu
7027 fi
7028
7029 : set the prefixit variable, to compute a suitable default value
7030 prefixit='case "$3" in
7031 ""|none)
7032         case "$oldprefix" in
7033         "") eval "$1=\"\$$2\"";;
7034         *)
7035                 case "$3" in
7036                 "") eval "$1=";;
7037                 none)
7038                         eval "tp=\"\$$2\"";
7039                         case "$tp" in
7040                         ""|" ") eval "$1=\"\$$2\"";;
7041                         *) eval "$1=";;
7042                         esac;;
7043                 esac;;
7044         esac;;
7045 *)
7046         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7047         case "$tp" in
7048         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7049         /*-$oldprefix/*|\~*-$oldprefix/*)
7050                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7051         *) eval "$1=\"\$$2\"";;
7052         esac;;
7053 esac'
7054
7055 : determine installation style
7056 : For now, try to deduce it from prefix unless it is already set.
7057 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7058 case "$installstyle" in
7059 '')     case "$prefix" in
7060                 *perl*) dflt='lib';;
7061                 *) dflt='lib/perl5' ;;
7062         esac
7063         ;;
7064 *)      dflt="$installstyle" ;;
7065 esac
7066 : Probably not worth prompting for this since we prompt for all
7067 : the directories individually, and the prompt would be too long and
7068 : confusing anyway.
7069 installstyle=$dflt
7070
7071 : determine where public executables go
7072 echo " "
7073 set dflt bin bin
7074 eval $prefixit
7075 fn=d~
7076 rp='Pathname where the public executables will reside?'
7077 . ./getfile
7078 if $test "X$ansexp" != "X$binexp"; then
7079         installbin=''
7080 fi
7081 prefixvar=bin
7082 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7083 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7084 :     this via initialinstalllocation
7085 . ./setprefixvar
7086
7087 case "$userelocatableinc" in
7088 $define|true|[yY]*)     dflt='y' ;;
7089 *)                      dflt='n' ;;
7090 esac
7091 cat <<EOM
7092
7093 Would you like to build Perl so that the installation is relocatable, so that
7094 library paths in @INC are determined relative to the path of the perl binary?
7095 This is not advised for system Perl installs, or if you need to run setid
7096 scripts or scripts under taint mode.
7097
7098 If this doesn't make any sense to you, just accept the default '$dflt'.
7099 EOM
7100 rp='Use relocatable @INC?'
7101 . ./myread
7102 case "$ans" in
7103 y|Y)    val="$define" ;;
7104 *)      val="$undef"  ;;
7105 esac
7106 set userelocatableinc
7107 eval $setvar
7108
7109 initialinstalllocation="$binexp"
7110 : Default prefix is now "up one level from where the binaries are"
7111 case "$userelocatableinc" in
7112 $define|true|[yY]*)
7113     bin=".../"
7114     binexp=".../"
7115     prefix=".../.."
7116     prefixexp=".../.."
7117     installprefixexp=".../.."
7118     ;;
7119 esac
7120
7121 : determine where private library files go
7122 : Usual default is /usr/local/lib/perl5/$version.
7123 : Also allow things like /opt/perl/lib/$version, since
7124 : /opt/perl/lib/perl5... would be redundant.
7125 : The default "style" setting is made in installstyle.U
7126 case "$installstyle" in
7127 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7128 *)       set dflt privlib lib/$version ;;
7129 esac
7130 eval $prefixit
7131 $cat <<EOM
7132
7133 There are some auxiliary files for $package that need to be put into a
7134 private library directory that is accessible by everyone.
7135
7136 EOM
7137 fn=$binexp
7138 fn=d~+
7139 rp='Pathname where the private library files will reside?'
7140 . ./getfile
7141 prefixvar=privlib
7142 . ./setprefixvar
7143
7144 : set the prefixup variable, to restore leading tilda escape
7145 prefixup='case "$prefixexp" in
7146 "$prefix") ;;
7147 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7148 esac'
7149
7150 : determine where public architecture dependent libraries go
7151 set archlib archlib
7152 eval $prefixit
7153 : privlib default is /usr/local/lib/$package/$version
7154 : archlib default is /usr/local/lib/$package/$version/$archname
7155 : privlib may have an optional trailing /share.
7156 tdflt=`echo $privlib | $sed 's,/share$,,'`
7157 tdflt=$tdflt/$archname
7158 case "$archlib" in
7159 '')     dflt=$tdflt
7160         ;;
7161 *)      dflt="$archlib"
7162     ;;
7163 esac
7164 $cat <<EOM
7165
7166 $spackage contains architecture-dependent library files.  If you are
7167 sharing libraries in a heterogeneous environment, you might store
7168 these files in a separate location.  Otherwise, you can just include
7169 them with the rest of the public library files.
7170
7171 EOM
7172 fn=$binexp
7173 fn=d+~
7174 rp='Where do you want to put the public architecture-dependent libraries?'
7175 . ./getfile
7176 prefixvar=archlib
7177 . ./setprefixvar
7178 if $test X"$archlib" = X"$privlib"; then
7179         d_archlib="$undef"
7180 else
7181         d_archlib="$define"
7182 fi
7183
7184 : see if setuid scripts can be secure
7185 $cat <<EOM
7186
7187 Some kernels have a bug that prevents setuid #! scripts from being
7188 secure.  Some sites have disabled setuid #! scripts because of this.
7189
7190 First let's decide if your kernel supports secure setuid #! scripts.
7191 (If setuid #! scripts would be secure but have been disabled anyway,
7192 don't say that they are secure if asked.)
7193
7194 EOM
7195
7196 val="$undef"
7197 if $test -d /dev/fd; then
7198         echo "#!$ls" >reflect
7199         chmod +x,u+s reflect
7200         ./reflect >flect 2>&1
7201         if $contains "/dev/fd" flect >/dev/null; then
7202                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7203                 val="$define"
7204         else
7205                 $cat <<EOM
7206 If you are not sure if they are secure, I can check but I'll need a
7207 username and password different from the one you are using right now.
7208 If you don't have such a username or don't want me to test, simply
7209 enter 'none'.
7210
7211 EOM
7212                 rp='Other username to test security of setuid scripts with?'
7213                 dflt='none'
7214                 . ./myread
7215                 case "$ans" in
7216                 n|none)
7217                         case "$d_suidsafe" in
7218                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7219                                 dflt=n;;
7220                         "$undef")
7221                                 echo "Well, the $hint value is *not* secure." >&4
7222                                 dflt=n;;
7223                         *)      echo "Well, the $hint value *is* secure." >&4
7224                                 dflt=y;;
7225                         esac
7226                         ;;
7227                 *)
7228                         $rm -f reflect flect
7229                         echo "#!$ls" >reflect
7230                         chmod +x,u+s reflect
7231                         echo >flect
7232                         chmod a+w flect
7233                         echo '"su" will (probably) prompt you for '"$ans's password."
7234                         su $ans -c './reflect >flect'
7235                         if $contains "/dev/fd" flect >/dev/null; then
7236                                 echo "Okay, it looks like setuid scripts are secure." >&4
7237                                 dflt=y
7238                         else
7239                                 echo "I don't think setuid scripts are secure." >&4
7240                                 dflt=n
7241                         fi
7242                         ;;
7243                 esac
7244                 rp='Does your kernel have *secure* setuid scripts?'
7245                 . ./myread
7246                 case "$ans" in
7247                 [yY]*)  val="$define";;
7248                 *)      val="$undef";;
7249                 esac
7250         fi
7251 else
7252         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7253         echo "(That's for file descriptors, not floppy disks.)"
7254         val="$undef"
7255 fi
7256 set d_suidsafe
7257 eval $setvar
7258
7259 $rm -f reflect flect
7260
7261 : now see if they want to do setuid emulation
7262 if $test $patchlevel -lt 11; then
7263 echo " "
7264 val="$undef"
7265 case "$d_suidsafe" in
7266 "$define")
7267         val="$undef"
7268         echo "No need to emulate SUID scripts since they are secure here." >&4
7269         ;;
7270 *)
7271         $cat <<EOM
7272 Some systems have disabled setuid scripts, especially systems where
7273 setuid scripts cannot be secure.  On systems where setuid scripts have
7274 been disabled, the setuid/setgid bits on scripts are currently
7275 useless.  It is possible for $package to detect those bits and emulate
7276 setuid/setgid in a secure fashion.  This emulation will only work if
7277 setuid scripts have been disabled in your kernel.
7278
7279 EOM
7280         case "$d_dosuid" in
7281         "$define") dflt=y ;;
7282         *) dflt=n ;;
7283         esac
7284         rp="Do you want to do setuid/setgid emulation?"
7285         . ./myread
7286         case "$ans" in
7287         [yY]*)  val="$define";;
7288         *)      val="$undef";;
7289         esac
7290         ;;
7291 esac
7292 set d_dosuid
7293 eval $setvar
7294 else
7295     case "$d_dosuid" in
7296         "$define")
7297         cat >&4 <<EOH
7298
7299 SUID emulation has been removed for 5.12
7300 Please re-run Configure without -Dd_dosuid
7301
7302 EOH
7303         exit 1;
7304         ;;
7305     esac
7306     d_dosuid=undef
7307 fi
7308
7309 : Find perl5.005 or later.
7310 echo "Looking for a previously installed perl5.005 or later... "
7311 case "$perl5" in
7312 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7313                 : Check if this perl is recent and can load a simple module
7314                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7315                         perl5=$tdir/perl
7316                         break;
7317                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7318                         perl5=$tdir/perl5
7319                         break;
7320                 fi
7321         done
7322         ;;
7323 *)      perl5="$perl5"
7324         ;;
7325 esac
7326 case "$perl5" in
7327 '')     echo "None found.  That's ok.";;
7328 *)      echo "Using $perl5." ;;
7329 esac
7330
7331 : Set the siteprefix variables
7332 $cat <<EOM
7333
7334 After $package is installed, you may wish to install various
7335 add-on modules and utilities.  Typically, these add-ons will
7336 be installed under $prefix with the rest
7337 of this package.  However, you may wish to install such add-ons
7338 elsewhere under a different prefix.
7339
7340 If you do not wish to put everything under a single prefix, that's
7341 ok.  You will be prompted for the individual locations; this siteprefix
7342 is only used to suggest the defaults.
7343
7344 The default should be fine for most people.
7345
7346 EOM
7347 fn=d~+
7348 rp='Installation prefix to use for add-on modules and utilities?'
7349 : XXX Here might be another good place for an installstyle setting.
7350 case "$siteprefix" in
7351 '') dflt=$prefix ;;
7352 *)  dflt=$siteprefix ;;
7353 esac
7354 . ./getfile
7355 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7356 oldsiteprefix=''
7357 case "$siteprefix" in
7358 '') ;;
7359 *)      case "$ans" in
7360         "$prefix") ;;
7361         *) oldsiteprefix="$prefix";;
7362         esac
7363         ;;
7364 esac
7365 siteprefix="$ans"
7366 siteprefixexp="$ansexp"
7367
7368 : determine where site specific libraries go.
7369 : Usual default is /usr/local/lib/perl5/site_perl/$version
7370 : The default "style" setting is made in installstyle.U
7371 : XXX No longer works with Prefixit stuff.
7372 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7373 case "$sitelib" in
7374 '') case "$installstyle" in
7375         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7376         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7377         esac
7378         ;;
7379 *)      dflt="$sitelib"
7380         ;;
7381 esac
7382 $cat <<EOM
7383
7384 The installation process will create a directory for
7385 site-specific extensions and modules.  Most users find it convenient
7386 to place all site-specific files in this directory rather than in the
7387 main distribution directory.
7388
7389 EOM
7390 fn=d~+
7391 rp='Pathname for the site-specific library files?'
7392 . ./getfile
7393 prefixvar=sitelib
7394 . ./setprefixvar
7395 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7396
7397 : Determine list of previous versions to include in @INC
7398 $cat > getverlist <<EOPL
7399 #!$perl5 -w
7400 use File::Basename;
7401 \$api_versionstring = "$api_versionstring";
7402 \$version = "$version";
7403 \$stem = "$sitelib_stem";
7404 \$archname = "$archname";
7405 EOPL
7406         $cat >> getverlist <<'EOPL'
7407 # The list found is store twice for each entry: the original name, and
7408 # the binary broken down version as pack "sss", so sorting is easy and
7409 # unambiguous. This will work for all versions that have a maximum of
7410 # three digit groups, separate by '.'s or '_'s. Names are extended with
7411 # ".0.0" to ensure at least three elements for the pack.
7412 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7413
7414 # Can't have leading @ because metaconfig interprets it as a command!
7415 ;@inc_version_list=();
7416 # XXX Redo to do opendir/readdir?
7417 if (-d $stem) {
7418     chdir($stem);
7419     ;@candidates = map {
7420         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7421     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7422 }
7423 else {
7424     ;@candidates = ();
7425 }
7426
7427 ($pversion, $aversion, $vsn5005) = map {
7428     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7429 foreach $d (@candidates) {
7430     if ($d->[1] lt $pversion) {
7431         if ($d->[1] ge $aversion) {
7432             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7433         }
7434         elsif ($d->[1] ge $vsn5005) {
7435             unshift(@inc_version_list, grep { -d } $d->[0]);
7436         }
7437     }
7438     else {
7439         # Skip newer version.  I.e. don't look in
7440         # 5.7.0 if we're installing 5.6.1.
7441     }
7442 }
7443
7444 if (@inc_version_list) {
7445     print join(' ', @inc_version_list);
7446 }
7447 else {
7448     # Blank space to preserve value for next Configure run.
7449     print " ";
7450 }
7451 EOPL
7452 chmod +x getverlist
7453 case "$inc_version_list" in
7454 '')     if test -x "$perl5$exe_ext"; then
7455                 dflt=`$perl5 getverlist`
7456         else
7457                 dflt='none'
7458         fi
7459         ;;
7460 $undef) dflt='none' ;;
7461 *)  eval dflt=\"$inc_version_list\" ;;
7462 esac
7463 case "$dflt" in
7464 ''|' ') dflt=none ;;
7465 esac
7466 case "$dflt" in
7467 5.005) dflt=none ;;
7468 esac
7469 $cat <<EOM
7470
7471 In order to ease the process of upgrading, this version of perl
7472 can be configured to use modules built and installed with earlier
7473 versions of perl that were installed under $prefix.  Specify here
7474 the list of earlier versions that this version of perl should check.
7475 If Configure detected no earlier versions of perl installed under
7476 $prefix, then the list will be empty.  Answer 'none' to tell perl
7477 to not search earlier versions.
7478
7479 The default should almost always be sensible, so if you're not sure,
7480 just accept the default.
7481 EOM
7482
7483 rp='List of earlier versions to include in @INC?'
7484 . ./myread
7485 case "$ans" in
7486 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7487 *) inc_version_list="$ans" ;;
7488 esac
7489 case "$inc_version_list" in
7490 ''|' ')
7491         inc_version_list_init='0'
7492         d_inc_version_list="$undef"
7493         ;;
7494 *)      inc_version_list_init=`echo $inc_version_list |
7495                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7496         d_inc_version_list="$define"
7497         ;;
7498 esac
7499 $rm -f getverlist
7500
7501 : see if malloc/malloc.h has to be included
7502 set malloc/malloc.h i_mallocmalloc
7503 eval $inhdr
7504
7505 : see if this is a malloc.h system
7506 : we want a real compile instead of Inhdr because some systems have a
7507 : malloc.h that just gives a compile error saying to use stdlib.h instead
7508 echo " "
7509 $cat >try.c <<EOCP
7510 #include <stdlib.h>
7511 #include <malloc.h>
7512 #$i_mallocmalloc I_MALLOCMALLOC
7513 #ifdef I_MALLOCMALLOC
7514 # include <malloc/malloc.h>
7515 #endif
7516
7517 int main () { return 0; }
7518 EOCP
7519 set try
7520 if eval $compile; then
7521     echo "<malloc.h> found." >&4
7522     val="$define"
7523 else
7524     echo "<malloc.h> NOT found." >&4
7525     val="$undef"
7526 fi
7527 $rm_try
7528 set i_malloc
7529 eval $setvar
7530
7531 : check for length of pointer
7532 echo " "
7533 case "$ptrsize" in
7534 '')
7535         echo "Checking to see how big your pointers are..." >&4
7536         $cat >>try.c <<EOCP
7537 #include <stdio.h>
7538 #$i_stdlib I_STDLIB
7539 #ifdef I_STDLIB
7540 #include <stdlib.h>
7541 #endif
7542 int main()
7543 {
7544     printf("%d\n", (int)sizeof(void *));
7545     exit(0);
7546 }
7547 EOCP
7548         set try
7549         if eval $compile_ok; then
7550                 ptrsize=`$run ./try`
7551                 echo "Your pointers are $ptrsize bytes long."
7552         else
7553                 dflt='4'
7554                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7555                 rp="What is the size of a pointer (in bytes)?"
7556                 . ./myread
7557                 ptrsize="$ans"
7558         fi
7559         ;;
7560 esac
7561 $rm_try
7562 case "$use64bitall" in
7563 "$define"|true|[yY]*)
7564         case "$ptrsize" in
7565         4)      cat <<EOM >&4
7566
7567 *** You have chosen a maximally 64-bit build,
7568 *** but your pointers are only 4 bytes wide.
7569 *** Please rerun Configure without -Duse64bitall.
7570 EOM
7571                 case "$d_quad" in
7572                 define)
7573                         cat <<EOM >&4
7574 *** Since you have quads, you could possibly try with -Duse64bitint.
7575 EOM
7576                         ;;
7577                 esac
7578                 cat <<EOM >&4
7579 *** Cannot continue, aborting.
7580
7581 EOM
7582
7583                 exit 1
7584                 ;;
7585         esac
7586         ;;
7587 esac
7588
7589
7590 : determine whether to use malloc wrapping
7591 echo " "
7592 case "$usemallocwrap" in
7593 [yY]*|true|$define)     dflt='y' ;;
7594 [nN]*|false|$undef)     dflt='n' ;;
7595 *)      case "$usedevel" in
7596         [yY]*|true|$define)     dflt='y' ;;
7597         *) dflt='n' ;;
7598         esac
7599         ;;
7600 esac
7601 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7602 . ./myread
7603 usemallocwrap="$ans"
7604 case "$ans" in
7605 y*|true)
7606         usemallocwrap="$define" ;;
7607 *)
7608         usemallocwrap="$undef" ;;
7609 esac
7610
7611 : determine which malloc to compile in
7612 echo " "
7613 case "$usemymalloc" in
7614 [yY]*|true|$define)     dflt='y' ;;
7615 [nN]*|false|$undef)     dflt='n' ;;
7616 *)      case "$ptrsize" in
7617         4) dflt='y' ;;
7618         *) dflt='n' ;;
7619         esac
7620         if test "$useithreads" = "$define"; then dflt='n'; fi
7621         ;;
7622 esac
7623 rp="Do you wish to attempt to use the malloc that comes with $package?"
7624 . ./myread
7625 usemymalloc="$ans"
7626 case "$ans" in
7627 y*|true)
7628         usemymalloc='y'
7629         mallocsrc='malloc.c'
7630         mallocobj="malloc$_o"
7631         d_mymalloc="$define"
7632         case "$libs" in
7633         *-lmalloc*)
7634                 : Remove malloc from list of libraries to use
7635                 echo "Removing unneeded -lmalloc from library list" >&4
7636                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7637                 shift
7638                 libs="$*"
7639                 echo "libs = $libs" >&4
7640                 ;;
7641         esac
7642         ;;
7643 *)
7644         usemymalloc='n'
7645         mallocsrc=''
7646         mallocobj=''
7647         d_mymalloc="$undef"
7648         ;;
7649 esac
7650
7651 : compute the return types of malloc and free
7652 echo " "
7653 $cat >malloc.c <<END
7654 #$i_malloc I_MALLOC
7655 #$i_stdlib I_STDLIB
7656 #include <stdio.h>
7657 #include <sys/types.h>
7658 #ifdef I_MALLOC
7659 #include <malloc.h>
7660 #endif
7661 #ifdef I_STDLIB
7662 #include <stdlib.h>
7663 #endif
7664 #ifdef TRY_MALLOC
7665 void *malloc();
7666 #endif
7667 #ifdef TRY_FREE
7668 void free();
7669 #endif
7670 END
7671 case "$malloctype" in
7672 '')
7673         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7674                 malloctype='void *'
7675         else
7676                 malloctype='char *'
7677         fi
7678         ;;
7679 esac
7680 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7681
7682 case "$freetype" in
7683 '')
7684         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7685                 freetype='void'
7686         else
7687                 freetype='int'
7688         fi
7689         ;;
7690 esac
7691 echo "Your system uses $freetype free(), it would seem." >&4
7692 $rm -f malloc.[co]
7693 : determine where site specific architecture-dependent libraries go.
7694 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7695 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7696 : sitelib may have an optional trailing /share.
7697 case "$sitearch" in
7698 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7699         dflt="$dflt/$archname"
7700         ;;
7701 *)      dflt="$sitearch"
7702         ;;
7703 esac
7704 set sitearch sitearch none
7705 eval $prefixit
7706 $cat <<EOM
7707
7708 The installation process will also create a directory for
7709 architecture-dependent site-specific extensions and modules.
7710
7711 EOM
7712 fn=d~+
7713 rp='Pathname for the site-specific architecture-dependent library files?'
7714 . ./getfile
7715 prefixvar=sitearch
7716 . ./setprefixvar
7717 if $test X"$sitearch" = X"$sitelib"; then
7718         d_sitearch="$undef"
7719 else
7720         d_sitearch="$define"
7721 fi
7722
7723 : Set the vendorprefix variables
7724 $cat <<EOM
7725
7726 The installation process will also create a directory for
7727 vendor-supplied add-ons.  Vendors who supply perl with their system
7728 may find it convenient to place all vendor-supplied files in this
7729 directory rather than in the main distribution directory.  This will
7730 ease upgrades between binary-compatible maintenance versions of perl.
7731
7732 Of course you may also use these directories in whatever way you see
7733 fit.  For example, you might use them to access modules shared over a
7734 company-wide network.
7735
7736 The default answer should be fine for most people.
7737 This causes further questions about vendor add-ons to be skipped
7738 and no vendor-specific directories will be configured for perl.
7739
7740 EOM
7741 rp='Do you want to configure vendor-specific add-on directories?'
7742 case "$usevendorprefix" in
7743 define|true|[yY]*) dflt=y ;;
7744 *)      : User may have set vendorprefix directly on Configure command line.
7745         case "$vendorprefix" in
7746         ''|' ') dflt=n ;;
7747         *)      dflt=y ;;
7748         esac
7749         ;;
7750 esac
7751 . ./myread
7752 case "$ans" in
7753 [yY]*)  fn=d~+
7754         rp='Installation prefix to use for vendor-supplied add-ons?'
7755         case "$vendorprefix" in
7756         '') dflt="$prefix" ;;
7757         *)  dflt=$vendorprefix ;;
7758         esac
7759         . ./getfile
7760         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7761         oldvendorprefix=''
7762         case "$vendorprefix" in
7763         '') ;;
7764         *)      case "$ans" in
7765                 "$prefix") ;;
7766                 *) oldvendorprefix="$prefix";;
7767                 esac
7768                 ;;
7769         esac
7770         usevendorprefix="$define"
7771         vendorprefix="$ans"
7772         vendorprefixexp="$ansexp"
7773         ;;
7774 *)      usevendorprefix="$undef"
7775         vendorprefix=''
7776         vendorprefixexp=''
7777         ;;
7778 esac
7779
7780 : Set the vendorlib variables
7781 case "$vendorprefix" in
7782 '')     d_vendorlib="$undef"
7783         vendorlib=''
7784         vendorlibexp=''
7785         ;;
7786 *)      d_vendorlib="$define"
7787         : determine where vendor-supplied modules go.
7788         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7789         case "$vendorlib" in
7790         '')
7791                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7792                 case "$installstyle" in
7793                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7794                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7795                 esac
7796                 ;;
7797         *)      dflt="$vendorlib"
7798                 ;;
7799         esac
7800         fn=d~+
7801         rp='Pathname for the vendor-supplied library files?'
7802         . ./getfile
7803         vendorlib="$ans"
7804         vendorlibexp="$ansexp"
7805         ;;
7806 esac
7807 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7808 prefixvar=vendorlib
7809 . ./installprefix
7810
7811 : Set the vendorarch variables
7812 case "$vendorprefix" in
7813 '')     d_vendorarch="$undef"
7814         vendorarch=''
7815         vendorarchexp=''
7816         ;;
7817 *)      d_vendorarch="$define"
7818         : determine where vendor-supplied architecture-dependent libraries go.
7819         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7820         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7821         : vendorlib may have an optional trailing /share.
7822         case "$vendorarch" in
7823         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7824                 dflt="$dflt/$archname"
7825                 ;;
7826         *)      dflt="$vendorarch" ;;
7827         esac
7828         fn=d~+
7829         rp='Pathname for vendor-supplied architecture-dependent files?'
7830         . ./getfile
7831         vendorarch="$ans"
7832         vendorarchexp="$ansexp"
7833         ;;
7834 esac
7835 prefixvar=vendorarch
7836 . ./installprefix
7837 if $test X"$vendorarch" = X"$vendorlib"; then
7838         d_vendorarch="$undef"
7839 else
7840         d_vendorarch="$define"
7841 fi
7842
7843 : Final catch-all directories to search
7844 $cat <<EOM
7845
7846 Lastly, you can have perl look in other directories for extensions and
7847 modules in addition to those already specified.
7848 These directories will be searched after
7849         $sitearch
7850         $sitelib
7851 EOM
7852 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7853 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7854 echo ' '
7855 case "$otherlibdirs" in
7856 ''|' ') dflt='none' ;;
7857 *)      dflt="$otherlibdirs" ;;
7858 esac
7859 $cat <<EOM
7860 Enter a colon-separated set of extra paths to include in perl's @INC
7861 search path, or enter 'none' for no extra paths.
7862
7863 EOM
7864
7865 rp='Colon-separated list of additional directories for perl to search?'
7866 . ./myread
7867 case "$ans" in
7868 ' '|''|none)    otherlibdirs=' ' ;;
7869 *)      otherlibdirs="$ans" ;;
7870 esac
7871 case "$otherlibdirs" in
7872 ' ') val=$undef ;;
7873 *)      val=$define ;;
7874 esac
7875 set d_perl_otherlibdirs
7876 eval $setvar
7877
7878 : Cruising for prototypes
7879 echo " "
7880 echo "Checking out function prototypes..." >&4
7881 $cat >prototype.c <<EOCP
7882 #$i_stdlib I_STDLIB
7883 #ifdef I_STDLIB
7884 #include <stdlib.h>
7885 #endif
7886 int main(int argc, char *argv[]) {
7887         exit(0);}
7888 EOCP
7889 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7890         echo "Your C compiler appears to support function prototypes."
7891         val="$define"
7892 else
7893         echo "Your C compiler doesn't seem to understand function prototypes."
7894         val="$undef"
7895 fi
7896 set prototype
7897 eval $setvar
7898 $rm -f prototype*
7899
7900 : Check if ansi2knr is required
7901 case "$prototype" in
7902 "$define") ;;
7903 *)      ansi2knr='ansi2knr'
7904         echo " "
7905         cat <<EOM >&4
7906
7907 $me:  FATAL ERROR:
7908 This version of $package can only be compiled by a compiler that
7909 understands function prototypes.  Unfortunately, your C compiler
7910         $cc $ccflags
7911 doesn't seem to understand them.  Sorry about that.
7912
7913 If GNU cc is available for your system, perhaps you could try that instead.
7914
7915 Eventually, we hope to support building Perl with pre-ANSI compilers.
7916 If you would like to help in that effort, please contact <perlbug@perl.org>.
7917
7918 Aborting Configure now.
7919 EOM
7920         exit 2
7921         ;;
7922 esac
7923
7924 : DTrace support
7925 dflt_dtrace='/usr/sbin/dtrace'
7926 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7927
7928 cat <<EOM
7929
7930 Perl can be built to support DTrace on platforms that support it.
7931 DTrace is a diagnosis and performance analysis tool from Sun.
7932
7933 If this doesn't make any sense to you, just accept the default '$dflt'.
7934 EOM
7935
7936 while $test 1 ; do
7937         case "$usedtrace" in
7938         $define|true|[yY]*)
7939                 dflt='y'
7940                 ;;
7941         ?*)
7942                 dflt='y'
7943                 dflt_dtrace=$usedtrace
7944                 ;;
7945         *)
7946                 dflt='n'
7947                 ;;
7948         esac
7949
7950         rp='Support DTrace if available?'
7951         . ./myread
7952         case "$ans" in
7953         y|Y)    val="$define" ;;
7954         *)      val="$undef" ;;
7955         esac
7956         set usedtrace
7957         eval $setvar
7958
7959         test "X$usedtrace" != "X$define" && break
7960
7961         echo " "
7962         rp='Where is the dtrace executable?'
7963         dflt=$dflt_dtrace
7964         . ./getfile
7965         val="$ans"
7966         set dtrace
7967         eval $setvar
7968
7969         if $test -f $dtrace
7970         then
7971                 if $dtrace -h -s ../perldtrace.d \
7972                         -o perldtrace.tmp >/dev/null 2>&1 \
7973                         && rm -f perldtrace.tmp
7974                 then
7975                         echo " "
7976                         echo "Good: your $dtrace knows about the -h flag."
7977                 else
7978                         cat >&2 <<EOM
7979
7980 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7981 ***
7982 *** Your installed dtrace doesn't support the -h switch to compile a D
7983 *** program into a C header. Can't continue.
7984
7985 EOM
7986                         exit 1
7987                 fi
7988                 break;
7989         fi
7990
7991         case "$fastread" in
7992         yes)
7993                 cat >&2 <<EOM
7994
7995 *** $me:  Fatal Error:  $dtrace not found.
7996 *** Can't continue.
7997
7998 EOM
7999                 exit 1
8000                 ;;
8001         *)
8002                 echo "*** $dtrace was not found."
8003                 echo " "
8004                 ;;
8005         esac
8006 done
8007
8008 : See if we want extra modules installed
8009 echo " "
8010 case "$extras" in
8011 '') dflt='n';;
8012 *) dflt='y';;
8013 esac
8014 cat <<EOM
8015 Perl can be built with extra modules or bundles of modules which
8016 will be fetched from the CPAN and installed alongside Perl.
8017
8018 Notice that you will need access to the CPAN; either via the Internet,
8019 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8020 be asked later to configure the CPAN.pm module which will in turn do
8021 the installation of the rest of the extra modules or bundles.)
8022
8023 Notice also that if the modules require any external software such as
8024 libraries and headers (the libz library and the zlib.h header for the
8025 Compress::Zlib module, for example) you MUST have any such software
8026 already installed, this configuration process will NOT install such
8027 things for you.
8028
8029 If this doesn't make any sense to you, just accept the default '$dflt'.
8030 EOM
8031 rp='Install any extra modules (y or n)?'
8032 . ./myread
8033 case "$ans" in
8034 y|Y)
8035         cat <<EOM
8036
8037 Please list any extra modules or bundles to be installed from CPAN,
8038 with spaces between the names.  The names can be in any format the
8039 'install' command of CPAN.pm will understand.  (Answer 'none',
8040 without the quotes, to install no extra modules or bundles.)
8041 EOM
8042         rp='Extras?'
8043         dflt="$extras"
8044         . ./myread
8045         extras="$ans"
8046 esac
8047 case "$extras" in
8048 ''|'none')
8049         val=''
8050         $rm -f ../extras.lst
8051         ;;
8052 *)      echo "(Saving the list of extras for later...)"
8053         echo "$extras" > ../extras.lst
8054         val="'$extras'"
8055         ;;
8056 esac
8057 set extras
8058 eval $setvar
8059 echo " "
8060
8061 : determine where html pages for programs go
8062 set html1dir html1dir none
8063 eval $prefixit
8064 $cat <<EOM
8065
8066 If you wish to install html files for programs in $spackage, indicate
8067 the appropriate directory here.  To skip installing html files,
8068 answer "none".
8069 EOM
8070 case "$html1dir" in
8071 ''|none|$undef|' ') dflt=none ;;
8072 *) dflt=$html1dir ;;
8073 esac
8074 fn=dn+~
8075 rp="Directory for the main $spackage html pages?"
8076 . ./getfile
8077 prefixvar=html1dir
8078 . ./setprefixvar
8079 : Use ' ' for none so value is preserved next time through Configure
8080 $test X"$html1dir" = "X" && html1dir=' '
8081
8082 : determine where html pages for libraries and modules go
8083 set html3dir html3dir none
8084 eval $prefixit
8085 $cat <<EOM
8086
8087 If you wish to install html files for modules associated with $spackage,
8088 indicate the appropriate directory here.  To skip installing html files,
8089 answer "none".
8090 EOM
8091 : There is no obvious default.  If they have specified html1dir, then
8092 : try to key off that, possibly changing .../html1 into .../html3.
8093 case "$html3dir" in
8094 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8095 *) dflt=$html3dir ;;
8096 esac
8097 fn=dn+~
8098 rp="Directory for the $spackage module html pages?"
8099 . ./getfile
8100 prefixvar=html3dir
8101 . ./setprefixvar
8102 : Use ' ' for none so value is preserved next time through Configure
8103 $test X"$html3dir" = "X" && html3dir=' '
8104
8105 : determine whether to install perl also as /usr/bin/perl
8106
8107 echo " "
8108 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8109         $cat <<EOM
8110 Many scripts expect perl to be installed as /usr/bin/perl.
8111
8112 If you want to, I can install the perl you are about to compile
8113 as /usr/bin/perl (in addition to $bin/perl).
8114 EOM
8115         if test -f /usr/bin/perl; then
8116             $cat <<EOM
8117
8118 However, please note that because you already have a /usr/bin/perl,
8119 overwriting that with a new Perl would very probably cause problems.
8120 Therefore I'm assuming you don't want to do that (unless you insist).
8121
8122 EOM
8123             case "$installusrbinperl" in
8124             "$define"|[yY]*)    dflt='y';;
8125             *)                  dflt='n';;
8126             esac
8127         else
8128             $cat <<EOM
8129
8130 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8131
8132 EOM
8133             case "$installusrbinperl" in
8134             "$undef"|[nN]*)     dflt='n';;
8135             *)                  dflt='y';;
8136             esac
8137         fi
8138         rp="Do you want to install perl as /usr/bin/perl?"
8139         . ./myread
8140         case "$ans" in
8141         [yY]*)  val="$define";;
8142         *)      val="$undef" ;;
8143         esac
8144 else
8145         val="$undef"
8146 fi
8147 set installusrbinperl
8148 eval $setvar
8149
8150 : see if dlopen exists
8151 xxx_runnm="$runnm"
8152 xxx_ccflags="$ccflags"
8153 runnm=false
8154 : with g++ one needs -shared to get is-in-libc to work for dlopen
8155 case "$gccversion" in
8156 '')     ;;
8157 *)      case "$d_cplusplus" in
8158         "$define") ccflags="$ccflags -shared" ;;
8159         esac
8160         ;;
8161 esac
8162 set dlopen d_dlopen
8163 eval $inlibc
8164 runnm="$xxx_runnm"
8165 ccflags="$xxx_ccflags"
8166
8167 : see if this is a unistd.h system
8168 set unistd.h i_unistd
8169 eval $inhdr
8170
8171 : determine which dynamic loading, if any, to compile in
8172 echo " "
8173 dldir="ext/DynaLoader"
8174 case "$usedl" in
8175     $define|y|true)
8176         dflt='y'
8177         usedl="$define"
8178         ;;
8179     $undef|n|false)
8180         dflt='n'
8181         usedl="$undef"
8182         ;;
8183     *)
8184         dflt='n'
8185         case "$d_dlopen" in
8186             $define) dflt='y' ;;
8187         esac
8188         : Does a dl_xxx.xs file exist for this operating system
8189         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8190         ;;
8191 esac
8192 rp="Do you wish to use dynamic loading?"
8193 . ./myread
8194 usedl="$ans"
8195 bin_ELF="$undef"
8196 case "$ans" in
8197     y*) usedl="$define"
8198         case "$dlsrc" in
8199             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8200                     dflt="$dldir/dl_${osname}.xs"
8201                 elif $test "$d_dlopen" = "$define" ; then
8202                     dflt="$dldir/dl_dlopen.xs"
8203                 else
8204                     dflt=''
8205                 fi
8206                 ;;
8207             *)  dflt="$dldir/$dlsrc"
8208                 ;;
8209         esac
8210         echo "The following dynamic loading files are available:"
8211         : Can not go over to $dldir because getfile has path hard-coded in.
8212         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8213         rp="Source file to use for dynamic loading"
8214         fn="fne"
8215         gfpth="$src"
8216         . ./getfile
8217         usedl="$define"
8218         : emulate basename
8219         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8220
8221         $cat << EOM
8222
8223 Some systems may require passing special flags to $cc -c to
8224 compile modules that will be used to create a shared library.
8225 To use no flags, say "none".
8226
8227 EOM
8228         case "$cccdlflags" in
8229             '') case "$gccversion" in
8230                 '') case "$osname" in
8231                         hpux)   dflt='+z' ;;
8232                         irix*)  dflt='-KPIC' ;;
8233                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8234                         sunos)  dflt='-pic' ;;
8235                         *)      dflt='none' ;;
8236                     esac
8237                     ;;
8238                 *)  case "$osname" in
8239                         darwin) dflt='none' ;;
8240                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8241                         *)      dflt='-fpic' ;;
8242                     esac ;;
8243                 esac ;;
8244             ' ') dflt='none' ;;
8245             *)   dflt="$cccdlflags" ;;
8246         esac
8247
8248         case "$dflt" in
8249             none) dflt='' ;;
8250         esac
8251
8252         # If -Dsysroot was specified, now's the time to add it
8253         # to cccdlflags
8254         if test "X$sysroot" != X; then
8255             case "$gccversion" in
8256                 '') ;;
8257                 *)  case "$dflt" in
8258                         *sysroot*) ;;
8259                         'undef'|*)
8260                             dflt="$dflt --sysroot=$sysroot" ;;
8261                     esac
8262                     ;;
8263             esac
8264         fi
8265
8266         case "$dflt" in
8267             '') dflt='none';;
8268         esac
8269
8270         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8271         . ./myread
8272         case "$ans" in
8273             none) cccdlflags=' ' ;;
8274             *)    cccdlflags="$ans" ;;
8275         esac
8276
8277         cat << EOM
8278
8279 Some systems use ld to create libraries that can be dynamically loaded,
8280 while other systems (such as those using ELF) use $cc.
8281
8282 EOM
8283
8284 : Determine if this is ELF
8285         $cat >try.c <<EOM
8286 /* Test for whether ELF binaries are produced */
8287 #include <fcntl.h>
8288 #$i_stdlib I_STDLIB
8289 #ifdef I_STDLIB
8290 #include <stdlib.h>
8291 #endif
8292 #$i_unistd I_UNISTD
8293 #ifdef I_UNISTD
8294 #include <unistd.h>
8295 #endif
8296 int main() {
8297     char b[4];
8298     int i = open("a.out",O_RDONLY);
8299     if(i == -1)
8300         exit(1); /* fail */
8301     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8302         exit(0); /* succeed (yes, it is ELF) */
8303     exit(1); /* fail */
8304 }
8305 EOM
8306         if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8307             bin_ELF="$define"
8308         fi
8309         $rm_try
8310
8311         case "$ld" in
8312             '') if $test $bin_ELF = "$define"; then
8313                     cat <<EOM
8314 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8315 EOM
8316                     dflt="$cc"
8317                 else
8318                     echo "I'll use ld to build dynamic libraries."
8319                     dflt='ld'
8320                 fi
8321                 ;;
8322             *)  dflt="$ld"
8323                 ;;
8324         esac
8325
8326         rp="What command should be used to create dynamic libraries?"
8327         . ./myread
8328         ld="$ans"
8329
8330         cat << EOM
8331
8332 Some systems may require passing special flags to $ld to create a
8333 library that can be dynamically loaded.  If your ld flags include
8334 -L/other/path options to locate libraries outside your loader's normal
8335 search path, you may need to specify those -L options here as well.  To
8336 use no flags, say "none".
8337
8338 EOM
8339         case "$lddlflags" in
8340             '') case "$osname" in
8341                     haiku) dflt='-shared' ;;
8342                     hpux) dflt='-b';
8343                           case "$gccversion" in
8344                               '') dflt="$dflt +vnocompatwarnings" ;;
8345                           esac
8346                           ;;
8347                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8348                     solaris) # See [perl #66604].
8349                             # On Solaris 11, gcc -m64 on amd64
8350                             # appears not to understand -G.  gcc versions at
8351                             # least as old as 3.4.3 support -shared, so just
8352                             # use that with Solaris 11 and later, but keep
8353                             # the old behavior for older Solaris versions.
8354                             case "$gccversion" in
8355                                 '') dflt='-G' ;;
8356                                 *)  case "$osvers" in
8357                                         2.?|2.10) dflt='-G' ;;
8358                                         *) dflt='-shared' ;;
8359                                     esac
8360                                     ;;
8361                             esac
8362                             ;;
8363                     sunos) dflt='-assert nodefinitions' ;;
8364                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8365                     *)     dflt='none' ;;
8366                 esac
8367                 ;;
8368             *) dflt="$lddlflags" ;;
8369         esac
8370
8371         : Only do this for gcc, since, for example, qcc has no concept
8372         : of --sysroot.
8373         if $test "X$sysroot" != X; then
8374             case "$gccversion" in
8375                 '') ;;
8376                 *)  dflt="$dflt --sysroot $sysroot" ;;
8377             esac
8378         fi
8379
8380         : Try to guess additional flags to pick up local libraries.
8381         : Be careful not to append to a plain 'none'
8382         case "$dflt" in
8383             none) dflt='' ;;
8384         esac
8385         for thisflag in $ldflags; do
8386             case "$thisflag" in
8387                 -L*|-R*|-Wl,-R*)
8388                     case " $dflt " in
8389                         *" $thisflag "*) ;;
8390                         *) dflt="$dflt $thisflag" ;;
8391                     esac
8392                     ;;
8393             esac
8394         done
8395
8396         case "$dflt" in
8397             ''|' ') dflt='none' ;;
8398         esac
8399
8400         case "$ldflags" in
8401             *-fstack-protector*)
8402                 case "$dflt" in
8403                     *-fstack-protector*) ;; # Don't add it again
8404                     *) dflt="$dflt -fstack-protector" ;;
8405                 esac
8406                 ;;
8407         esac
8408
8409         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8410         . ./myread
8411         case "$ans" in
8412             none) lddlflags=' ' ;;
8413             *) lddlflags="$ans" ;;
8414         esac
8415
8416         cat <<EOM
8417
8418 Some systems may require passing special flags to $cc to indicate that
8419 the resulting executable will use dynamic linking.  To use no flags,
8420 say "none".
8421
8422 EOM
8423         case "$ccdlflags" in
8424             '') case "$osname" in
8425                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8426                     sunos)             dflt='none'   ;;
8427                     *)                 dflt='none'   ;;
8428                 esac ;;
8429             ' ') dflt='none' ;;
8430             *)   dflt="$ccdlflags" ;;
8431         esac
8432         rp="Any special flags to pass to $cc to use dynamic linking?"
8433         . ./myread
8434         case "$ans" in
8435             none) ccdlflags=' ' ;;
8436             *)    ccdlflags="$ans" ;;
8437         esac
8438         ;;
8439
8440     *)  usedl="$undef"
8441         ld='ld'
8442         dlsrc='dl_none.xs'
8443         lddlflags=''
8444         ccdlflags=''
8445         ;;
8446 esac
8447
8448 ld_can_script="$undef"
8449 case "$bin_ELF$usedl" in
8450     $define$define)
8451         # Abuse try.h and a.out names for neat cleanup
8452         $cat >try.c <<EOM
8453 void foo() {}
8454 void bar() {}
8455 EOM
8456         $cat >try.h <<EOM
8457 LIBTEST_42 {
8458  global:
8459   foo;
8460  local: *;
8461  };
8462 EOM
8463         if $cc $cccdlflags $ccdlflags $ccflags \
8464                $ldflags $lddlflags -o a.out try.c \
8465                -Wl,--version-script=try.h >/dev/null 2>&1 \
8466            &&  $test -s a.out ; then
8467             echo "ld supports scripting" >&4
8468             ld_can_script="$define"
8469         else
8470             echo "ld does not support scripting" >&4
8471         fi
8472         $rm_try
8473         ;;
8474 esac
8475
8476 : Do we want a shared libperl?
8477 also=''
8478 case "$usedl" in
8479 $undef)
8480         # No dynamic loading being used, so don't bother even to prompt.
8481         useshrplib='false'
8482         ;;
8483 *)      case "$useshrplib" in
8484         '')     case "$osname" in
8485                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8486                         dflt=y
8487                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8488                         ;;
8489                 *)      dflt=n
8490                         ;;
8491                 esac
8492                 ;;
8493         $define|true|[Yy]*)
8494                 dflt=y
8495                 ;;
8496         *)      dflt=n
8497                 ;;
8498         esac
8499         $cat << EOM
8500
8501 The perl executable is normally obtained by linking perlmain.c with
8502 libperl${_a}, any static extensions (usually just DynaLoader), and
8503 any other libraries needed on this system (such as -lm, etc.).  Since
8504 your system supports dynamic loading, it is probably possible to build
8505 a shared libperl.$so.  If you will have more than one executable linked
8506 to libperl.$so, this will significantly reduce the size of each
8507 executable, but it may have a noticeable effect on performance.  The
8508 default is probably sensible for your system.
8509 $also
8510
8511 EOM
8512         rp="Build a shared libperl.$so (y/n)"
8513         . ./myread
8514         case "$ans" in
8515         true|$define|[Yy]*)
8516                 useshrplib='true'  ;;
8517         *)      useshrplib='false' ;;
8518         esac
8519         ;;
8520 esac
8521
8522 case "$useshrplib" in
8523 true)
8524         case "$userelocatableinc" in
8525         true|define)
8526                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8527                 echo "See INSTALL for an explanation why that won't work." >&4
8528                 exit 4
8529                 ;;
8530         esac
8531         case "$libperl" in
8532         '')
8533                 # Figure out a good name for libperl.so.  Since it gets stored in
8534                 # a version-specific architecture-dependent library, the version
8535                 # number isn't really that important, except for making cc/ld happy.
8536                 #
8537                 # A name such as libperl.so.10.1
8538                 majmin="libperl.$so.$patchlevel.$subversion"
8539                 # A name such as libperl.so.100
8540                 majonly=`echo $patchlevel $subversion |
8541                         $awk '{printf "%d%02d", $1, $2}'`
8542                 majonly=libperl.$so.$majonly
8543                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8544                 # rely on figuring it out from the naming of libc.
8545                 case "${osname}${osvers}" in
8546                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8547                         dflt=libperl.$so
8548                         ;;
8549                 cygwin*) # ld links now against the dll directly
8550                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8551                         majonly=`echo $patchlevel $subversion |
8552                                 $awk '{printf "%03d%03d", $1, $2}'`
8553                         majonly=cygperl5.$majonly.$so
8554                         dflt=$majmin
8555                         ;;
8556                 *)      # Try to guess based on whether libc has major.minor.
8557                         case "$libc" in
8558                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8559                         *libc.$so.[0-9]*) dflt=$majonly ;;
8560                         *)      dflt=libperl.$so ;;
8561                         esac
8562                         ;;
8563                 esac
8564                 ;;
8565         *)      dflt=$libperl
8566                 ;;
8567         esac
8568         cat << EOM
8569
8570 I need to select a good name for the shared libperl.  If your system uses
8571 library names with major and minor numbers, then you might want something
8572 like $majmin.  Alternatively, if your system uses a single version
8573 number for shared libraries, then you might want to use $majonly.
8574 Or, your system might be quite happy with a simple libperl.$so.
8575
8576 Since the shared libperl will get installed into a version-specific
8577 architecture-dependent directory, the version number of the shared perl
8578 library probably isn't important, so the default should be o.k.
8579
8580 EOM
8581         rp='What name do you want to give to the shared libperl?'
8582         . ./myread
8583         libperl=$ans
8584         echo "Ok, I'll use $libperl"
8585         ;;
8586 *)
8587         libperl="libperl${_a}"
8588         ;;
8589 esac
8590
8591 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8592 case "$shrpdir" in
8593 '') ;;
8594 *)      $cat >&4 <<EOM
8595 WARNING:  Use of the shrpdir variable for the installation location of
8596 the shared $libperl is not supported.  It was never documented and
8597 will not work in this version.  Let me (perlbug@perl.org)
8598 know of any problems this may cause.
8599
8600 EOM
8601         case "$shrpdir" in
8602         "$archlibexp/CORE")
8603                 $cat >&4 <<EOM
8604 But your current setting of $shrpdir is
8605 the default anyway, so it's harmless.
8606 EOM
8607                 ;;
8608         *)
8609                 $cat >&4 <<EOM
8610 Further, your current attempted setting of $shrpdir
8611 conflicts with the value of $archlibexp/CORE
8612 that installperl will use.
8613 EOM
8614                 ;;
8615         esac
8616         ;;
8617 esac
8618
8619 # How will the perl executable find the installed shared $libperl?
8620 # Add $xxx to ccdlflags.
8621 # If we can't figure out a command-line option, use $shrpenv to
8622 # set env LD_RUN_PATH.  The main perl makefile uses this.
8623 shrpdir=$archlibexp/CORE
8624 xxx=''
8625 tmp_shrpenv=''
8626 if "$useshrplib"; then
8627     case "$osname" in
8628         aix)
8629                 # We'll set it in Makefile.SH...
8630                 ;;
8631         solaris)
8632                 xxx="-R $shrpdir"
8633                 ;;
8634         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8635                 xxx="-Wl,-R$shrpdir"
8636                 ;;
8637         bsdos|linux|irix*|dec_osf|gnu*)
8638                 xxx="-Wl,-rpath,$shrpdir"
8639                 ;;
8640         haiku)
8641                 # Haiku doesn't like the default, either.
8642                 ;;
8643         hpux*)
8644                 # hpux doesn't like the default, either.
8645                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8646                 ;;
8647         cygwin)
8648                 # cygwin needs only ldlibpth
8649                 ;;
8650         *)
8651                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8652                 ;;
8653         esac
8654         case "$xxx" in
8655         '') ;;
8656         *)
8657                 # Only add $xxx if it isn't already in ccdlflags.
8658                 case " $ccdlflags " in
8659                 *" $xxx "*)     ;;
8660                 *)      ccdlflags="$ccdlflags $xxx"
8661                         cat <<EOM >&4
8662
8663 Adding $xxx to the flags
8664 passed to $ld so that the perl executable will find the
8665 installed shared $libperl.
8666
8667 EOM
8668                         ;;
8669                 esac
8670                 ;;
8671         esac
8672 fi
8673 # Fix ccdlflags in AIX for building external extensions.
8674 # (For building Perl itself bare -bE:perl.exp is needed,
8675 #  Makefile.SH takes care of this.)
8676 case "$osname" in
8677 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8678 esac
8679 # Respect a hint or command-line value.
8680 case "$shrpenv" in
8681 '') shrpenv="$tmp_shrpenv" ;;
8682 esac
8683 case "$ldlibpthname" in
8684 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8685 none)   ldlibpthname='' ;;
8686 esac
8687
8688 : determine where manual pages are on this system
8689 echo " "
8690 case "$sysman" in
8691 '')
8692         syspath='/usr/share/man/man1 /usr/man/man1'
8693         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8694         syspath="$syspath /usr/man/u_man/man1"
8695         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8696         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8697         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8698         sysman=`./loc . /usr/man/man1 $syspath`
8699         ;;
8700 esac
8701 if $test -d "$sysman"; then
8702         echo "System manual is in $sysman." >&4
8703 else
8704         echo "Could not find manual pages in source form." >&4
8705 fi
8706
8707 : determine where manual pages go
8708 set man1dir man1dir none
8709 eval $prefixit
8710 $cat <<EOM
8711
8712 $spackage has manual pages available in source form.
8713 EOM
8714 case "$nroff" in
8715 nroff)
8716         echo "However, you don't have nroff, so they're probably useless to you."
8717         case "$man1dir" in
8718         '') man1dir="none";;
8719         esac;;
8720 esac
8721 echo "If you don't want the manual sources installed, answer 'none'."
8722 case "$man1dir" in
8723 ' ') dflt=none
8724         ;;
8725 '')
8726         lookpath="$prefixexp/share/man/man1"
8727         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8728         lookpath="$lookpath $prefixexp/man/p_man/man1"
8729         lookpath="$lookpath $prefixexp/man/u_man/man1"
8730         lookpath="$lookpath $prefixexp/man/man.1"
8731         case "$sysman" in
8732         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8733         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8734         esac
8735         set dflt
8736         eval $prefixup
8737         ;;
8738 *)  dflt="$man1dir"
8739         ;;
8740 esac
8741 echo " "
8742 fn=dn+~
8743 rp="Where do the main $spackage manual pages (source) go?"
8744 . ./getfile
8745 if $test "X$man1direxp" != "X$ansexp"; then
8746         installman1dir=''
8747 fi
8748 prefixvar=man1dir
8749 . ./setprefixvar
8750
8751 case "$man1dir" in
8752 '')     man1dir=' '
8753         installman1dir='';;
8754 esac
8755
8756 : What suffix to use on installed man pages
8757
8758 case "$man1dir" in
8759 ' ')
8760         man1ext='0'
8761         ;;
8762 *)
8763         rp="What suffix should be used for the main $spackage man pages?"
8764         case "$man1ext" in
8765         '')     case "$man1dir" in
8766                 *1)  dflt=1 ;;
8767                 *1p) dflt=1p ;;
8768                 *1pm) dflt=1pm ;;
8769                 *l) dflt=l;;
8770                 *n) dflt=n;;
8771                 *o) dflt=o;;
8772                 *p) dflt=p;;
8773                 *C) dflt=C;;
8774                 *L) dflt=L;;
8775                 *L1) dflt=L1;;
8776                 *) dflt=1;;
8777                 esac
8778                 ;;
8779         *)      dflt="$man1ext";;
8780         esac
8781         . ./myread
8782         man1ext="$ans"
8783         ;;
8784 esac
8785
8786 : see if we can have long filenames
8787 echo " "
8788 first=123456789abcdef
8789 $rm -f $first
8790 if (echo hi >$first) 2>/dev/null; then
8791         if $test -f 123456789abcde; then
8792                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8793                 val="$undef"
8794         else
8795                 echo 'You can have filenames longer than 14 characters.'>&4
8796                 val="$define"
8797         fi
8798 else
8799         $cat <<'EOM'
8800 You can't have filenames longer than 14 chars.
8801 You can't even think about them!
8802 EOM
8803         val="$undef"
8804 fi
8805 set d_flexfnam
8806 eval $setvar
8807 $rm -rf 123456789abcde*
8808
8809 : determine where library module manual pages go
8810 set man3dir man3dir none
8811 eval $prefixit
8812 $cat <<EOM
8813
8814 $spackage has manual pages for many of the library modules.
8815 EOM
8816
8817 case "$nroff" in
8818 nroff)
8819         $cat <<'EOM'
8820 However, you don't have nroff, so they're probably useless to you.
8821 EOM
8822         case "$man3dir" in
8823         '') man3dir="none";;
8824         esac;;
8825 esac
8826
8827 case "$d_flexfnam" in
8828 undef)
8829         $cat <<'EOM'
8830 However, your system can't handle the long file names like File::Basename.3.
8831 EOM
8832         case "$man3dir" in
8833         '') man3dir="none";;
8834         esac;;
8835 esac
8836
8837 echo "If you don't want the manual sources installed, answer 'none'."
8838 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8839 case "$man3dir" in
8840 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8841         if $test -d "$privlib/man/man3"; then
8842                 cat <<EOM >&4
8843
8844 WARNING:  Previous versions of perl installed man3 pages into
8845 $privlib/man/man3.  This version will suggest a
8846 new default of $dflt.
8847 EOM
8848                 tdflt=$dflt
8849                 dflt='n'
8850                 rp='Do you wish to preserve the old behavior?(y/n)'
8851                 . ./myread
8852                 case "$ans" in
8853                 y*) dflt="$privlib/man/man3" ;;
8854                 *)  dflt=$tdflt ;;
8855                 esac
8856     fi
8857         ;;
8858 *)      dflt="$man3dir" ;;
8859 esac
8860 case "$dflt" in
8861 ' ') dflt=none ;;
8862 esac
8863 echo " "
8864 fn=dn+~
8865 rp="Where do the $package library man pages (source) go?"
8866 . ./getfile
8867 prefixvar=man3dir
8868 . ./setprefixvar
8869
8870 case "$man3dir" in
8871 '')     man3dir=' '
8872         installman3dir='';;
8873 esac
8874
8875 : What suffix to use on installed man pages
8876 case "$man3dir" in
8877 ' ')
8878         man3ext='0'
8879         ;;
8880 *)
8881         rp="What suffix should be used for the $package library man pages?"
8882         case "$man3ext" in
8883         '')     case "$man3dir" in
8884                 *3)  dflt=3 ;;
8885                 *3p) dflt=3p ;;
8886                 *3pm) dflt=3pm ;;
8887                 *l) dflt=l;;
8888                 *n) dflt=n;;
8889                 *o) dflt=o;;
8890                 *p) dflt=p;;
8891                 *C) dflt=C;;
8892                 *L) dflt=L;;
8893                 *L3) dflt=L3;;
8894                 *) dflt=3;;
8895                 esac
8896                 ;;
8897         *)      dflt="$man3ext";;
8898         esac
8899         . ./myread
8900         man3ext="$ans"
8901         ;;
8902 esac
8903
8904 : see if we have to deal with yellow pages, now NIS.
8905 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8906         case "$hostcat" in
8907         nidump*) ;;
8908         *)
8909                 case "$hostcat" in
8910                 *ypcat*) dflt=y;;
8911                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8912                                 dflt=y
8913                         else
8914                                 dflt=n
8915                         fi;;
8916                 *) dflt=n;;
8917                 esac
8918                 echo " "
8919                 rp='Are you getting the hosts file via yellow pages?'
8920                 . ./myread
8921                 case "$ans" in
8922                 y*) hostcat='ypcat hosts';;
8923                 *) hostcat='cat /etc/hosts';;
8924                 esac
8925                 ;;
8926         esac
8927 fi
8928 case "$hostcat" in
8929 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8930 esac
8931 case "$groupcat" in
8932 '') test -f /etc/group && groupcat='cat /etc/group';;
8933 esac
8934 case "$passcat" in
8935 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8936 esac
8937
8938 : now get the host name
8939 echo " "
8940 echo "Figuring out host name..." >&4
8941 case "$myhostname" in
8942 '') cont=true
8943         echo 'Maybe "hostname" will work...'
8944         if tans=`sh -c hostname 2>&1` ; then
8945                 myhostname=$tans
8946                 phostname=hostname
8947                 cont=''
8948         fi
8949         ;;
8950 *) cont='';;
8951 esac
8952 if $test "$cont"; then
8953         if ./xenix; then
8954                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8955                 if tans=`cat /etc/systemid 2>&1` ; then
8956                         myhostname=$tans
8957                         phostname='cat /etc/systemid'
8958                         echo "Whadyaknow.  Xenix always was a bit strange..."
8959                         cont=''
8960                 fi
8961         elif $test -r /etc/systemid; then
8962                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8963         fi
8964 fi
8965 if $test "$cont"; then
8966         echo 'No, maybe "uuname -l" will work...'
8967         if tans=`sh -c 'uuname -l' 2>&1` ; then
8968                 myhostname=$tans
8969                 phostname='uuname -l'
8970         else
8971                 echo 'Strange.  Maybe "uname -n" will work...'
8972                 if tans=`sh -c 'uname -n' 2>&1` ; then
8973                         myhostname=$tans
8974                         phostname='uname -n'
8975                 else
8976                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8977                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8978                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8979                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8980                         else
8981                                 case "$myhostname" in
8982                                 '') echo "Does this machine have an identity crisis or something?"
8983                                         phostname='';;
8984                                 *)
8985                                         echo "Well, you said $myhostname before..."
8986                                         phostname='echo $myhostname';;
8987                                 esac
8988                         fi
8989                 fi
8990         fi
8991 fi
8992 case "$myhostname" in
8993 '') myhostname=noname ;;
8994 esac
8995 : you do not want to know about this
8996 set $myhostname
8997 myhostname=$1
8998
8999 : verify guess
9000 if $test "$myhostname" ; then
9001         dflt=y
9002         rp='Your host name appears to be "'$myhostname'".'" Right?"
9003         . ./myread
9004         case "$ans" in
9005         y*) ;;
9006         *) myhostname='';;
9007         esac
9008 fi
9009
9010 : bad guess or no guess
9011 while $test "X$myhostname" = X ; do
9012         dflt=''
9013         rp="Please type the (one word) name of your host:"
9014         . ./myread
9015         myhostname="$ans"
9016 done
9017
9018 : translate upper to lower if necessary
9019 case "$myhostname" in
9020 *[A-Z]*)
9021         echo "(Normalizing case in your host name)"
9022         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9023         ;;
9024 esac
9025
9026 case "$myhostname" in
9027 *.*)
9028         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9029         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9030         echo "(Trimming domain name from host name--host name is now $myhostname)"
9031         ;;
9032 *) case "$mydomain" in
9033         '')
9034                 {
9035                         test "X$hostcat" = "Xypcat hosts" &&
9036                         ypmatch "$myhostname" hosts 2>/dev/null |\
9037                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9038                         $test -s hosts
9039                 } || {
9040                         test "X$hostcat" != "X" &&
9041                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9042                                         /[       ]$myhostname[  . ]/p" > hosts
9043                 }
9044                 tmp_re="[       . ]"
9045                 if $test -f hosts; then
9046                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9047                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9048                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9049                                 hosts | $sort | $uniq | \
9050                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9051                         case `$echo X$dflt` in
9052                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9053                                 dflt=.
9054                                 ;;
9055                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9056                                 ;;
9057                         esac
9058                 else
9059                         echo "(I cannot locate a hosts database anywhere)"
9060                         dflt=.
9061                 fi
9062                 case "$dflt" in
9063                 .)
9064                         tans=`./loc resolv.conf X /etc /usr/etc`
9065                         if $test -f "$tans"; then
9066                                 echo "(Attempting domain name extraction from $tans)"
9067                                 dflt=.`$sed -n -e 's/   / /g' \
9068                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9069                                   -e 1q 2>/dev/null`
9070                                 case "$dflt" in
9071                                 .) dflt=.`$sed -n -e 's/        / /g' \
9072                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9073                                      -e 1q 2>/dev/null`
9074                                         ;;
9075                                 esac
9076                         fi
9077                         ;;
9078                 esac
9079                 case "$dflt" in
9080                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9081                         dflt=.`sh -c domainname 2>/dev/null`
9082                         case "$dflt" in
9083                         '') dflt='.';;
9084                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9085                         esac
9086                         ;;
9087                 esac
9088                 case "$dflt$osname" in
9089                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9090                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9091                         ;;
9092                 esac
9093                 case "$dflt" in
9094                 .) echo "(Lost all hope -- silly guess then)"
9095                         dflt='.nonet'
9096                         ;;
9097                 esac
9098                 $rm -f hosts
9099                 ;;
9100         *) dflt="$mydomain";;
9101         esac;;
9102 esac
9103 echo " "
9104 rp="What is your domain name?"
9105 . ./myread
9106 tans="$ans"
9107 case "$ans" in
9108 '') ;;
9109 .*) ;;
9110 *) tans=".$tans";;
9111 esac
9112 mydomain="$tans"
9113
9114 : translate upper to lower if necessary
9115 case "$mydomain" in
9116 *[A-Z]*)
9117         echo "(Normalizing case in your domain name)"
9118         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9119         ;;
9120 esac
9121
9122 : a little sanity check here
9123 case "$phostname" in
9124 '') ;;
9125 *)
9126         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9127         $myhostname$mydomain|$myhostname) ;;
9128         *)
9129                 case "$phostname" in
9130                 sed*)
9131                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9132                         ;;
9133                 *)
9134                         echo "(That doesn't agree with your $phostname command, by the way.)"
9135                         ;;
9136                 esac
9137         ;;
9138         esac
9139         ;;
9140 esac
9141
9142 : determine the e-mail address of the user who is running us
9143 $cat <<EOM
9144
9145 I need to get your e-mail address in Internet format if possible, i.e.
9146 something like user@host.domain. Please answer accurately since I have
9147 no easy means to double check it. The default value provided below
9148 is most probably close to reality but may not be valid from outside
9149 your organization...
9150
9151 EOM
9152 cont=x
9153 while test "$cont"; do
9154         case "$MAILDOMAIN" in
9155         '')
9156                 if $test -s /etc/mailname; then
9157                         maildomain=`$cat /etc/mailname`
9158                 else
9159                         maildomain="$myhostname$mydomain"
9160                 fi
9161                 ;;
9162         *)  maildomain="$MAILDOMAIN";;
9163         esac
9164         case "$cf_email" in
9165         '') dflt="$cf_by@$maildomain";;
9166         *)  dflt="$cf_email";;
9167         esac
9168         rp='What is your e-mail address?'
9169         . ./myread
9170         cf_email="$ans"
9171         case "$cf_email" in
9172         *@*.*) cont='' ;;
9173         *)
9174                 rp='Address does not look like an Internet one.  Use it anyway?'
9175                 case "$fastread" in
9176                 yes) dflt=y ;;
9177                 *) dflt=n ;;
9178                 esac
9179                 . ./myread
9180                 case "$ans" in
9181                 y*) cont='' ;;
9182                 *) echo " " ;;
9183                 esac
9184                 ;;
9185         esac
9186 done
9187
9188 : Ask e-mail of administrator
9189 $cat <<EOM
9190
9191 If you or somebody else will be maintaining perl at your site, please
9192 fill in the correct e-mail address here so that they may be contacted
9193 if necessary. Currently, the "perlbug" program included with perl
9194 will send mail to this address in addition to perlbug@perl.org. You may
9195 enter "none" for no administrator.
9196
9197 EOM
9198 case "$perladmin" in
9199 '') dflt="$cf_email";;
9200 *) dflt="$perladmin";;
9201 esac
9202 rp='Perl administrator e-mail address'
9203 . ./myread
9204 perladmin="$ans"
9205
9206 : determine whether to only install version-specific parts.
9207 echo " "
9208 $cat <<EOM
9209 Do you want to install only the version-specific parts of the perl
9210 distribution?  Usually you do *not* want to do this.
9211 EOM
9212 case "$versiononly" in
9213 "$define"|[Yy]*|true) dflt='y' ;;
9214 *) dflt='n';
9215 esac
9216 rp="Do you want to install only the version-specific parts of perl?"
9217 . ./myread
9218 case "$ans" in
9219 [yY]*)  val="$define";;
9220 *)      val="$undef" ;;
9221 esac
9222 set versiononly
9223 eval $setvar
9224
9225 case "$versiononly" in
9226 "$define") inc_version_list=''
9227            inc_version_list_init=0
9228            ;;
9229 esac
9230
9231 : figure out how to guarantee perl startup
9232 : XXX Note that this currently takes advantage of the bug that binexp ignores
9233 :     the Configure -Dinstallprefix setting, which in turn means that under
9234 :     relocatable @INC, initialinstalllocation is what binexp started as.
9235 case "$startperl" in
9236 '')
9237         case "$sharpbang" in
9238         *!)
9239                 $cat <<EOH
9240
9241 I can use the #! construct to start perl on your system. This will
9242 make startup of perl scripts faster, but may cause problems if you
9243 want to share those scripts and perl is not in a standard place
9244 ($initialinstalllocation/perl) on all your platforms. The alternative
9245 is to force a shell by starting the script with a single ':' character.
9246
9247 EOH
9248                 case "$versiononly" in
9249                 "$define")      dflt="$initialinstalllocation/perl$version";;
9250                 *)              dflt="$initialinstalllocation/perl";;
9251                 esac
9252                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9253                 . ./myread
9254                 case "$ans" in
9255                 none)   startperl=": # use perl";;
9256                 *)      startperl="#!$ans"
9257                         if $test 30 -lt `echo "$ans" | wc -c`; then
9258                                 $cat >&4 <<EOM
9259
9260 WARNING:  Some systems limit the #! command to 32 characters.
9261 If you experience difficulty running Perl scripts with #!, try
9262 installing Perl in a directory with a shorter pathname.
9263
9264 EOM
9265                         fi ;;
9266                 esac
9267                 ;;
9268         *) startperl=": # use perl"
9269                 ;;
9270         esac
9271         ;;
9272 esac
9273 echo "I'll use $startperl to start perl scripts."
9274
9275 : figure best path for perl in scripts
9276 case "$perlpath" in
9277 '')
9278         case "$versiononly" in
9279         "$define")      perlpath="$initialinstalllocation/perl$version";;
9280         *)              perlpath="$initialinstalllocation/perl";;
9281         esac
9282         case "$startperl" in
9283         *!*) ;;
9284         *)
9285                 $cat <<EOH
9286
9287 I will use the "eval 'exec'" idiom to start Perl on your system.
9288 I can use the full path of your Perl binary for this purpose, but
9289 doing so may cause problems if you want to share those scripts and
9290 Perl is not always in a standard place ($initialinstalllocation/perl).
9291
9292 EOH
9293                 dflt="$initialinstalllocation/perl"
9294                 rp="What path shall I use in \"eval 'exec'\"?"
9295                 . ./myread
9296                 perlpath="$ans"
9297                 ;;
9298         esac
9299         ;;
9300 esac
9301 case "$startperl" in
9302 *!*)    ;;
9303 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9304 esac
9305
9306 : determine where public executable scripts go
9307 set scriptdir scriptdir
9308 eval $prefixit
9309 case "$scriptdir" in
9310 '')
9311         dflt="$bin"
9312         : guess some guesses
9313         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9314         $test -d /usr/share/bin     && dflt=/usr/share/bin
9315         $test -d /usr/local/script  && dflt=/usr/local/script
9316         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9317         $test -d $prefixexp/script  && dflt=$prefixexp/script
9318         set dflt
9319         eval $prefixup
9320         ;;
9321 *)  dflt="$scriptdir"
9322         ;;
9323 esac
9324 $cat <<EOM
9325
9326 Some installations have a separate directory just for executable scripts so
9327 that they can mount it across multiple architectures but keep the scripts in
9328 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9329 Or you might just lump your scripts in with all your other executables.
9330
9331 EOM
9332 fn=d~
9333 rp='Where do you keep publicly executable scripts?'
9334 . ./getfile
9335 if $test "X$ansexp" != "X$scriptdirexp"; then
9336         installscript=''
9337 fi
9338 installscriptdir=''
9339 prefixvar=scriptdir
9340 . ./setprefixvar
9341 : A little fix up for an irregularly named variable.
9342 installscript="$installscriptdir"
9343
9344 : determine where add-on public executables go
9345 case "$sitebin" in
9346 '')     dflt=$siteprefix/bin ;;
9347 *)      dflt=$sitebin ;;
9348 esac
9349 fn=d~
9350 rp='Pathname where the add-on public executables should be installed?'
9351 . ./getfile
9352 prefixvar=sitebin
9353 . ./setprefixvar
9354
9355 : determine where add-on html pages go
9356 : There is no standard location, so try to copy the previously-selected
9357 : directory structure for the core html pages.
9358 case "$sitehtml1dir" in
9359 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9360 *)     dflt=$sitehtml1dir ;;
9361 esac
9362 case "$dflt" in
9363 ''|' ') dflt=none ;;
9364 esac
9365 fn=dn+~
9366 rp='Pathname where the site-specific html pages should be installed?'
9367 . ./getfile
9368 prefixvar=sitehtml1dir
9369 . ./setprefixvar
9370
9371 : determine where add-on library html pages go
9372 : There is no standard location, so try to copy the previously-selected
9373 : directory structure for the core html pages.
9374 case "$sitehtml3dir" in
9375 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9376 *)     dflt=$sitehtml3dir ;;
9377 esac
9378 case "$dflt" in
9379 ''|' ') dflt=none ;;
9380 esac
9381 fn=dn+~
9382 rp='Pathname where the site-specific library html pages should be installed?'
9383 . ./getfile
9384 prefixvar=sitehtml3dir
9385 . ./setprefixvar
9386
9387 : determine where add-on manual pages go
9388 case "$siteman1dir" in
9389 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9390 *)      dflt=$siteman1dir ;;
9391 esac
9392 case "$dflt" in
9393 ''|' ') dflt=none ;;
9394 esac
9395 fn=dn+~
9396 rp='Pathname where the site-specific manual pages should be installed?'
9397 . ./getfile
9398 prefixvar=siteman1dir
9399 . ./setprefixvar
9400
9401 : determine where add-on library man pages go
9402 case "$siteman3dir" in
9403 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9404 *)      dflt=$siteman3dir ;;
9405 esac
9406 case "$dflt" in
9407 ''|' ') dflt=none ;;
9408 esac
9409 fn=dn+~
9410 rp='Pathname where the site-specific library manual pages should be installed?'
9411 . ./getfile
9412 prefixvar=siteman3dir
9413 . ./setprefixvar
9414
9415 : determine where add-on public executable scripts go
9416 case "$sitescript" in
9417 '')     dflt=$siteprefix/script
9418         $test -d $dflt || dflt=$sitebin ;;
9419 *)  dflt="$sitescript" ;;
9420 esac
9421 fn=d~+
9422 rp='Pathname where add-on public executable scripts should be installed?'
9423 . ./getfile
9424 prefixvar=sitescript
9425 . ./setprefixvar
9426
9427 : see if backtrace exists
9428 set backtrace d_backtrace
9429 eval $inlibc
9430
9431 : add flags if using c backtrace
9432 case "$usecbacktrace" in
9433   "") usecbacktrace=$undef ;;
9434   [yY]*|true|$define)
9435     case "$d_backtrace" in
9436       [yY]*|true|$define)
9437         case " $ccflags " in
9438           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9439           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9440           esac
9441         ;;
9442       *)
9443         echo "This system does not support backtrace" >&4
9444         usecbacktrace=$undef
9445         ;;
9446       esac
9447     ;;
9448   esac
9449
9450 : Check if faststdio is requested and available
9451 case "$usefaststdio" in
9452 $define|true|[yY]*|'')
9453         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9454         case "$xversion" in
9455         [68])   dflt='y' ;;
9456         *)      dflt='n' ;;
9457         esac
9458         ;;
9459 *) dflt='n';;
9460 esac
9461 cat <<EOM
9462
9463 Perl can be built to use 'fast stdio', which means using the stdio
9464 library but also directly manipulating the stdio buffers to enable
9465 faster I/O.  Using stdio is better for backward compatibility (especially
9466 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9467 interface has been preferred instead of stdio.
9468
9469 If this doesn't make any sense to you, just accept the default '$dflt'.
9470 EOM
9471 rp='Use the "fast stdio" if available?'
9472 . ./myread
9473 case "$ans" in
9474 y|Y)    val="$define" ;;
9475 *)      val="$undef" ;;
9476 esac
9477 set usefaststdio
9478 eval $setvar
9479
9480
9481 : define an is-a-typedef? function
9482 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9483 case "$inclist" in
9484 "") inclist="sys/types.h";;
9485 esac;
9486 eval "varval=\$$var";
9487 case "$varval" in
9488 "")
9489         $rm -f temp.c;
9490         for inc in $inclist; do
9491                 echo "#include <$inc>" >>temp.c;
9492         done;
9493         echo "#ifdef $type" >> temp.c;
9494         echo "printf(\"We have $type\");" >> temp.c;
9495         echo "#endif" >> temp.c;
9496         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9497         if $contains $type temp.E >/dev/null 2>&1; then
9498                 eval "$var=\$type";
9499         else
9500                 eval "$var=\$def";
9501         fi;
9502         $rm -f temp.?;;
9503 *) eval "$var=\$varval";;
9504 esac'
9505
9506 : define an is-a-typedef? function that prompts if the type is not available.
9507 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9508 case "$inclist" in
9509 "") inclist="sys/types.h";;
9510 esac;
9511 eval "varval=\$$var";
9512 case "$varval" in
9513 "")
9514         $rm -f temp.c;
9515         for inc in $inclist; do
9516                 echo "#include <$inc>" >>temp.c;
9517         done;
9518         echo "#ifdef $type" >> temp.c;
9519         echo "printf(\"We have $type\");" >> temp.c;
9520         echo "#endif" >> temp.c;
9521         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9522         echo " " ;
9523         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9524         if $contains $type temp.E >/dev/null 2>&1; then
9525                 echo "$type found." >&4;
9526                 eval "$var=\$type";
9527         else
9528                 echo "$type NOT found." >&4;
9529                 dflt="$def";
9530                 . ./myread ;
9531                 eval "$var=\$ans";
9532         fi;
9533         $rm -f temp.?;;
9534 *) eval "$var=\$varval";;
9535 esac'
9536
9537 : see what type lseek is declared as in the kernel
9538 rp="What is the type used for lseek's offset on this system?"
9539 set off_t lseektype long stdio.h sys/types.h
9540 eval $typedef_ask
9541
9542 echo " "
9543 echo "Checking to see how big your file offsets are..." >&4
9544 $cat >try.c <<EOCP
9545 #include <sys/types.h>
9546 #include <stdio.h>
9547 int main()
9548 {
9549     printf("%d\n", (int)sizeof($lseektype));
9550     return(0);
9551 }
9552 EOCP
9553 set try
9554 if eval $compile_ok; then
9555         lseeksize=`$run ./try`
9556         echo "Your file offsets are $lseeksize bytes long."
9557 else
9558         dflt=$longsize
9559         echo " "
9560         echo "(I can't seem to compile the test program.  Guessing...)"
9561         rp="What is the size of your file offsets (in bytes)?"
9562         . ./myread
9563         lseeksize="$ans"
9564 fi
9565 $rm_try
9566
9567 : see what type file positions are declared as in the library
9568 rp="What is the type for file position used by fsetpos()?"
9569 set fpos_t fpostype long stdio.h sys/types.h
9570 eval $typedef_ask
9571
9572 : Check size for Fpos_t
9573 echo " "
9574 case "$fpostype" in
9575 *_t) zzz="$fpostype"    ;;
9576 *)   zzz="fpos_t"       ;;
9577 esac
9578 echo "Checking the size of $zzz..." >&4
9579 cat > try.c <<EOCP
9580 #include <sys/types.h>
9581 #include <stdio.h>
9582 #$i_stdlib I_STDLIB
9583 #ifdef I_STDLIB
9584 #include <stdlib.h>
9585 #endif
9586 int main() {
9587     printf("%d\n", (int)sizeof($fpostype));
9588     exit(0);
9589 }
9590 EOCP
9591 set try
9592 if eval $compile_ok; then
9593         yyy=`$run ./try`
9594         case "$yyy" in
9595         '')     fpossize=4
9596                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9597                 ;;
9598         *)      fpossize=$yyy
9599                 echo "Your $zzz is $fpossize bytes long."
9600                 ;;
9601         esac
9602 else
9603         dflt="$longsize"
9604         echo " " >&4
9605         echo "(I can't compile the test program.  Guessing...)" >&4
9606         rp="What is the size of your file positions (in bytes)?"
9607         . ./myread
9608         fpossize="$ans"
9609 fi
9610
9611 : Check for large file support
9612 # Backward compatibility (uselfs is deprecated).
9613 case "$uselfs" in
9614 "$define"|true|[yY]*)
9615         cat <<EOM >&4
9616
9617 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9618 EOM
9619         uselargefiles="$define"
9620         ;;
9621 esac
9622
9623 case "$lseeksize:$fpossize" in
9624 8:8) cat <<EOM
9625
9626 You can have files larger than 2 gigabytes.
9627 EOM
9628    val="$define" ;;
9629 *)    case "$uselargefiles" in
9630    "$undef"|false|[nN]*) dflt='n' ;;
9631    *)   dflt='y' ;;
9632    esac
9633    cat <<EOM
9634
9635 Perl can be built to understand large files (files larger than 2 gigabytes)
9636 on some systems.  To do so, Configure can be run with -Duselargefiles.
9637
9638 If this doesn't make any sense to you, just accept the default '$dflt'.
9639 EOM
9640    rp='Try to understand large files, if available?'
9641    . ./myread
9642    case "$ans" in
9643    y|Y)         val="$define" ;;
9644    *)           val="$undef"  ;;
9645    esac
9646    ;;
9647 esac
9648 set uselargefiles
9649 eval $setvar
9650 : Look for a hint-file generated 'call-back-unit'.  If the
9651 : user has specified that a large files perl is to be built,
9652 : we may need to set or change some other defaults.
9653 if $test -f uselargefiles.cbu; then
9654         echo "Your platform has some specific hints regarding large file builds, using them..."
9655         . ./uselargefiles.cbu
9656 fi
9657 case "$uselargefiles" in
9658 "$define")
9659         if $test -f uselargefiles.cbu; then
9660                 echo " "
9661                 echo "Rechecking to see how big your file offsets are..." >&4
9662                 $cat >try.c <<EOCP
9663 #include <sys/types.h>
9664 #include <stdio.h>
9665 int main()
9666 {
9667     printf("%d\n", (int)sizeof($lseektype));
9668     return(0);
9669 }
9670 EOCP
9671                 set try
9672                 if eval $compile_ok; then
9673                         lseeksize=`$run ./try`
9674                         $echo "Your file offsets are now $lseeksize bytes long."
9675                 else
9676                         dflt="$lseeksize"
9677                         echo " "
9678                         echo "(I can't seem to compile the test program.  Guessing...)"
9679                         rp="What is the size of your file offsets (in bytes)?"
9680                         . ./myread
9681                         lseeksize="$ans"
9682                 fi
9683                 case "$fpostype" in
9684                 *_t) zzz="$fpostype"    ;;
9685                 *)   zzz="fpos_t"       ;;
9686                 esac
9687                 $echo $n "Rechecking the size of $zzz...$c" >&4
9688                 $cat > try.c <<EOCP
9689 #include <sys/types.h>
9690 #include <stdio.h>
9691 #$i_stdlib I_STDLIB
9692 #ifdef I_STDLIB
9693 #include <stdlib.h>
9694 #endif
9695 int main() {
9696     printf("%d\n", (int)sizeof($fpostype));
9697     return(0);
9698 }
9699 EOCP
9700                 set try
9701                 if eval $compile_ok; then
9702                         yyy=`$run ./try`
9703                         dflt="$lseeksize"
9704                         case "$yyy" in
9705                         '')     echo " "
9706                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9707                                 ;;
9708                         *)      fpossize=$yyy
9709                                 echo " $fpossize bytes." >&4
9710                                 ;;
9711                         esac
9712                 else
9713                         dflt="$fpossize"
9714                         echo " "
9715                         echo "(I can't compile the test program.  Guessing...)" >&4
9716                         rp="What is the size of your file positions (in bytes)?"
9717                         . ./myread
9718                         fpossize="$ans"
9719                 fi
9720                 $rm_try
9721         fi
9722         ;;
9723 esac
9724
9725 : Check if we want perlio
9726 useperlio="$define"
9727
9728 : Set the vendorbin variables
9729 case "$vendorprefix" in
9730 '')     d_vendorbin="$undef"
9731         vendorbin=''
9732         vendorbinexp=''
9733         ;;
9734 *)      d_vendorbin="$define"
9735         : determine where vendor-supplied executables go.
9736         case "$vendorbin" in
9737         '') dflt=$vendorprefix/bin ;;
9738         *)      dflt="$vendorbin" ;;
9739         esac
9740         fn=d~+
9741         rp='Pathname for the vendor-supplied executables directory?'
9742         . ./getfile
9743         vendorbin="$ans"
9744         vendorbinexp="$ansexp"
9745         ;;
9746 esac
9747 prefixvar=vendorbin
9748 . ./installprefix
9749
9750 : Set the vendorhtml1dir variables
9751 case "$vendorprefix" in
9752 '')     vendorhtml1dir=''
9753         vendorhtml1direxp=''
9754         ;;
9755 *)      : determine where vendor-supplied html pages go.
9756         : There is no standard location, so try to copy the previously-selected
9757         : directory structure for the core html pages.
9758         : XXX Better default suggestions would be welcome.
9759         case "$vendorhtml1dir" in
9760         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9761         *)      dflt=$vendorhtml1dir ;;
9762         esac
9763         case "$dflt" in
9764         ''|' ') dflt=none ;;
9765         esac
9766         fn=dn+~
9767         rp='Pathname for the vendor-supplied html pages?'
9768         . ./getfile
9769         vendorhtml1dir="$ans"
9770         vendorhtml1direxp="$ansexp"
9771         ;;
9772 esac
9773 : Use ' ' for none so value is preserved next time through Configure
9774 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9775 prefixvar=vendorhtml1dir
9776 . ./installprefix
9777
9778 : Set the vendorhtml3dir variables
9779 case "$vendorprefix" in
9780 '')     vendorhtml3dir=''
9781         vendorhtml3direxp=''
9782         ;;
9783 *)      : determine where vendor-supplied module html pages go.
9784         : There is no standard location, so try to copy the previously-selected
9785         : directory structure for the core html pages.
9786         : XXX Better default suggestions would be welcome.
9787         case "$vendorhtml3dir" in
9788         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9789         *)      dflt=$vendorhtml3dir ;;
9790         esac
9791         case "$dflt" in
9792         ''|' ') dflt=none ;;
9793         esac
9794         fn=dn+~
9795         rp='Pathname for the vendor-supplied html pages?'
9796         . ./getfile
9797         vendorhtml3dir="$ans"
9798         vendorhtml3direxp="$ansexp"
9799         ;;
9800 esac
9801 : Use ' ' for none so value is preserved next time through Configure
9802 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9803 prefixvar=vendorhtml3dir
9804 . ./installprefix
9805
9806 : Set the vendorman1dir variables
9807 case "$vendorprefix" in
9808 '')     vendorman1dir=''
9809         vendorman1direxp=''
9810         ;;
9811 *)      : determine where vendor-supplied manual pages go.
9812         case "$vendorman1dir" in
9813         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9814         *)      dflt=$vendorman1dir ;;
9815         esac
9816         case "$dflt" in
9817         ''|' ') dflt=none ;;
9818         esac
9819         fn=nd~+
9820         rp='Pathname for the vendor-supplied manual section 1 pages?'
9821         . ./getfile
9822         vendorman1dir="$ans"
9823         vendorman1direxp="$ansexp"
9824         ;;
9825 esac
9826 : Use ' ' for none so value is preserved next time through Configure
9827 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9828 prefixvar=vendorman1dir
9829 . ./installprefix
9830
9831 : Set the vendorman3dir variables
9832 case "$vendorprefix" in
9833 '')     vendorman3dir=''
9834         vendorman3direxp=''
9835         ;;
9836 *)      : determine where vendor-supplied module manual pages go.
9837         case "$vendorman3dir" in
9838         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9839         *)      dflt=$vendorman3dir ;;
9840         esac
9841         case "$dflt" in
9842         ''|' ') dflt=none ;;
9843         esac
9844         fn=nd~+
9845         rp='Pathname for the vendor-supplied manual section 3 pages?'
9846         . ./getfile
9847         vendorman3dir="$ans"
9848         vendorman3direxp="$ansexp"
9849         ;;
9850 esac
9851 : Use ' ' for none so value is preserved next time through Configure
9852 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9853 prefixvar=vendorman3dir
9854 . ./installprefix
9855
9856 : Set the vendorscript variables
9857 case "$vendorprefix" in
9858 '')     d_vendorscript="$undef"
9859         vendorscript=''
9860         vendorscriptexp=''
9861         ;;
9862 *)      d_vendorscript="$define"
9863         : determine where vendor-supplied scripts go.
9864         case "$vendorscript" in
9865         '')     dflt=$vendorprefix/script
9866                 $test -d $dflt || dflt=$vendorbin ;;
9867         *)  dflt="$vendorscript" ;;
9868         esac
9869         $cat <<EOM
9870
9871 The installation process will create a directory for
9872 vendor-supplied scripts.
9873
9874 EOM
9875         fn=d~+
9876         rp='Pathname for the vendor-supplied scripts directory?'
9877         . ./getfile
9878         vendorscript="$ans"
9879         vendorscriptexp="$ansexp"
9880         ;;
9881 esac
9882 prefixvar=vendorscript
9883 . ./installprefix
9884
9885 : script used to emit important warnings
9886 cat >warn <<EOS
9887 $startsh
9888 if test \$# -gt 0; then
9889         echo "\$@" >msg
9890 else
9891         cat >msg
9892 fi
9893 echo "*** WARNING:" >&4
9894 sed -e 's/^/*** /' <msg >&4
9895 echo "*** " >&4
9896 cat msg >>config.msg
9897 echo " " >>config.msg
9898 rm -f msg
9899 EOS
9900 chmod +x warn
9901 $eunicefix warn
9902
9903 : see which of string.h or strings.h is needed
9904 echo " "
9905 strings=`./findhdr string.h`
9906 if $test "$strings" && $test -r "$strings"; then
9907         echo "Using <string.h> instead of <strings.h>." >&4
9908         val="$define"
9909 else
9910         val="$undef"
9911         strings=`./findhdr strings.h`
9912         if $test "$strings" && $test -r "$strings"; then
9913                 echo "Using <strings.h> instead of <string.h>." >&4
9914         else
9915                 ./warn "No string header found -- You'll surely have problems."
9916         fi
9917 fi
9918 set i_string
9919 eval $setvar
9920 case "$i_string" in
9921 "$undef") strings=`./findhdr strings.h`;;
9922 *)        strings=`./findhdr string.h`;;
9923 esac
9924
9925 : see if qgcvt exists
9926 set qgcvt d_qgcvt
9927 eval $inlibc
9928
9929 : Check print/scan long double stuff
9930 echo " "
9931
9932 if $test X"$d_longdbl" = X"$define"; then
9933
9934 echo "Checking how to print long doubles..." >&4
9935
9936 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9937         $cat >try.c <<'EOCP'
9938 #include <sys/types.h>
9939 #include <stdio.h>
9940 int main() {
9941   double d = 123.456;
9942   printf("%.3f\n", d);
9943 }
9944 EOCP
9945         set try
9946         if eval $compile; then
9947                 yyy=`$run ./try`
9948                 case "$yyy" in
9949                 123.456)
9950                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9951                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9952                         echo "We will use %f."
9953                         ;;
9954                 esac
9955         fi
9956 fi
9957
9958 if $test X"$sPRIfldbl" = X; then
9959         $cat >try.c <<'EOCP'
9960 #include <sys/types.h>
9961 #include <stdio.h>
9962 int main() {
9963   long double d = 123.456;
9964   printf("%.3Lf\n", d);
9965 }
9966 EOCP
9967         set try
9968         if eval $compile; then
9969                 yyy=`$run ./try`
9970                 case "$yyy" in
9971                 123.456)
9972                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9973                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9974                         echo "We will use %Lf."
9975                         ;;
9976                 esac
9977         fi
9978 fi
9979
9980 if $test X"$sPRIfldbl" = X; then
9981         $cat >try.c <<'EOCP'
9982 #include <sys/types.h>
9983 #include <stdio.h>
9984 int main() {
9985   long double d = 123.456;
9986   printf("%.3llf\n", d);
9987 }
9988 EOCP
9989         set try
9990         if eval $compile; then
9991                 yyy=`$run ./try`
9992                 case "$yyy" in
9993                 123.456)
9994                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9995                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9996                         echo "We will use %llf."
9997                         ;;
9998                 esac
9999         fi
10000 fi
10001
10002 if $test X"$sPRIfldbl" = X; then
10003         $cat >try.c <<'EOCP'
10004 #include <sys/types.h>
10005 #include <stdio.h>
10006 int main() {
10007   long double d = 123.456;
10008   printf("%.3lf\n", d);
10009 }
10010 EOCP
10011         set try
10012         if eval $compile; then
10013                 yyy=`$run ./try`
10014                 case "$yyy" in
10015                 123.456)
10016                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10017                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10018                         echo "We will use %lf."
10019                         ;;
10020                 esac
10021         fi
10022 fi
10023
10024 if $test X"$sPRIfldbl" = X; then
10025         echo "Cannot figure out how to print long doubles." >&4
10026 else
10027         sSCNfldbl=$sPRIfldbl    # expect consistency
10028 fi
10029
10030 $rm_try
10031
10032 fi # d_longdbl
10033
10034 case "$sPRIfldbl" in
10035 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10036         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10037         d_SCNfldbl="$undef";
10038         ;;
10039 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10040         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10041         d_SCNfldbl="$define";
10042         ;;
10043 esac
10044
10045 : Check how to convert floats to strings.
10046
10047 if test "X$d_Gconvert" = X; then
10048
10049 echo " "
10050 echo "Checking for an efficient way to convert floats to strings."
10051 echo " " > try.c
10052 case "$uselongdouble" in
10053 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10054 esac
10055 case "$d_longdbl" in
10056 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10057 esac
10058 case "$d_PRIgldbl" in
10059 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10060 esac
10061 $cat >>try.c <<EOP
10062 #ifdef TRY_gconvert
10063 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10064 char *myname = "gconvert";
10065 #endif
10066 #ifdef TRY_gcvt
10067 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10068 char *myname = "gcvt";
10069 #endif
10070 #ifdef TRY_qgcvt
10071 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10072 char *myname = "qgcvt";
10073 #define DOUBLETYPE long double
10074 #endif
10075 #ifdef TRY_sprintf
10076 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10077 #ifdef HAS_PRIgldbl
10078 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10079 #else
10080 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10081 #endif
10082 #else
10083 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10084 #endif
10085 char *myname = "sprintf";
10086 #endif
10087
10088 #ifndef DOUBLETYPE
10089 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10090 #define DOUBLETYPE long double
10091 #else
10092 #define DOUBLETYPE double
10093 #endif
10094 #endif
10095
10096 #include <stdio.h>
10097
10098 #$i_stdlib I_STDLIB
10099 #ifdef I_STDLIB
10100 #include <stdlib.h>
10101 #endif
10102 #$i_string I_STRING
10103 #ifdef I_STRING
10104 #  include <string.h>
10105 #else
10106 #  include <strings.h>
10107 #endif
10108
10109 int checkit(char *expect, char *got)
10110 {
10111     if (strcmp(expect, got)) {
10112                 printf("%s oddity:  Expected %s, got %s\n",
10113                         myname, expect, got);
10114                 exit(1);
10115         }
10116 }
10117
10118 int main()
10119 {
10120         char buf[64];
10121         buf[63] = '\0';
10122
10123         /* This must be 1st test on (which?) platform */
10124         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10125         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10126         checkit("0.1", buf);
10127
10128         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10129         checkit("0.01", buf);
10130
10131         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10132         checkit("0.001", buf);
10133
10134         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10135         checkit("0.0001", buf);
10136
10137         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10138         if (strlen(buf) > 5)
10139             checkit("9e-005", buf); /* for Microsoft ?? */
10140         else
10141             checkit("9e-05", buf);
10142
10143         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10144         checkit("1", buf);
10145
10146         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10147         checkit("1.1", buf);
10148
10149         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10150         checkit("1.01", buf);
10151
10152         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10153         checkit("1.001", buf);
10154
10155         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10156         checkit("1.0001", buf);
10157
10158         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10159         checkit("1.00001", buf);
10160
10161         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10162         checkit("1.000001", buf);
10163
10164         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10165         checkit("0", buf);
10166
10167         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10168         checkit("-1", buf);
10169
10170         /* Some Linux gcvt's give 1.e+5 here. */
10171         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10172         checkit("100000", buf);
10173
10174         /* Some Linux gcvt's give -1.e+5 here. */
10175         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10176         checkit("-100000", buf);
10177
10178         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10179         checkit("123.456", buf);
10180
10181         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10182         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10183         /* 34 should be enough to scare even long double
10184          * places into using the e notation. */
10185         if (strlen(buf) > 5)
10186             checkit("1e+034", buf); /* for Microsoft */
10187         else
10188             checkit("1e+34", buf);
10189
10190         /* For Perl, if you add additional tests here, also add them to
10191          * t/base/num.t for benefit of platforms not using Configure or
10192          * overriding d_Gconvert */
10193
10194         exit(0);
10195 }
10196 EOP
10197 : first add preferred functions to our list
10198 xxx_list=""
10199 for xxx_convert in $gconvert_preference; do
10200     case $xxx_convert in
10201     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10202     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10203     esac
10204 done
10205 : then add any others
10206 for xxx_convert in gconvert gcvt sprintf; do
10207     case "$xxx_list" in
10208     *$xxx_convert*) ;;
10209     *) xxx_list="$xxx_list $xxx_convert" ;;
10210     esac
10211 done
10212
10213 case "$d_longdbl$uselongdouble" in
10214 "$define$define")
10215     : again, add preferred functions to our list first
10216     xxx_ld_list=""
10217     for xxx_convert in $gconvert_ld_preference; do
10218         case $xxx_convert in
10219         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10220         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10221         esac
10222     done
10223     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10224     for xxx_convert in qgcvt sprintf $xxx_list; do
10225         case "$xxx_ld_list" in
10226         $xxx_convert*|*" $xxx_convert"*) ;;
10227         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10228         esac
10229     done
10230     : if sprintf cannot do long doubles, move it to the end
10231     if test "$d_PRIgldbl" != "$define"; then
10232         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10233     fi
10234     : if no qgcvt, remove it
10235     if test "$d_qgcvt" != "$define"; then
10236         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10237     fi
10238     : use the ld_list
10239     xxx_list="$xxx_ld_list"
10240     ;;
10241 esac
10242
10243 for xxx_convert in $xxx_list; do
10244         echo "Trying $xxx_convert..."
10245         $rm -f try try$_o core
10246         set try -DTRY_$xxx_convert
10247         if eval $compile; then
10248                 echo "$xxx_convert() found." >&4
10249                 if $run ./try; then
10250                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10251                         break;
10252                 else
10253                         echo "...But $xxx_convert didn't work as I expected."
10254                         xxx_convert=''
10255                 fi
10256         else
10257                 echo "$xxx_convert NOT found." >&4
10258         fi
10259 done
10260
10261 if test X$xxx_convert = X; then
10262     echo "*** WHOA THERE!!! ***" >&4
10263     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10264     xxx_convert=sprintf
10265 fi
10266
10267 case "$xxx_convert" in
10268 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10269 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10270 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10271 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10272    "$define$define$define")
10273       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10274    "$define$define$undef")
10275       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10276    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10277    esac
10278    ;;
10279 esac
10280
10281 fi
10282 $rm_try
10283
10284 : see if _fwalk exists
10285 set fwalk d__fwalk
10286 eval $inlibc
10287
10288 : Initialize h_fcntl
10289 h_fcntl=false
10290
10291 : Initialize h_sysfile
10292 h_sysfile=false
10293
10294 : access call always available on UNIX
10295 set access d_access
10296 eval $inlibc
10297
10298 : locate the flags for 'access()'
10299 case "$d_access" in
10300 "$define")
10301         echo " "
10302         $cat >access.c <<EOCP
10303 #include <sys/types.h>
10304 #ifdef I_FCNTL
10305 #include <fcntl.h>
10306 #endif
10307 #ifdef I_SYS_FILE
10308 #include <sys/file.h>
10309 #endif
10310 #ifdef I_UNISTD
10311 #include <unistd.h>
10312 #endif
10313 #$i_stdlib I_STDLIB
10314 #ifdef I_STDLIB
10315 #include <stdlib.h>
10316 #endif
10317 int main() {
10318         exit(R_OK);
10319 }
10320 EOCP
10321         : check sys/file.h first, no particular reason here
10322         if $test `./findhdr sys/file.h` && \
10323                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10324                 h_sysfile=true;
10325                 echo "<sys/file.h> defines the *_OK access constants." >&4
10326         elif $test `./findhdr fcntl.h` && \
10327                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10328                 h_fcntl=true;
10329                 echo "<fcntl.h> defines the *_OK access constants." >&4
10330         elif $test `./findhdr unistd.h` && \
10331                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10332                 echo "<unistd.h> defines the *_OK access constants." >&4
10333         else
10334                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10335         fi
10336         ;;
10337 esac
10338 $rm -f access*
10339
10340 : see if accessx exists
10341 set accessx d_accessx
10342 eval $inlibc
10343
10344 : see if acosh exists
10345 set acosh d_acosh
10346 eval $inlibc
10347
10348 : see if aintl exists
10349 set aintl d_aintl
10350 eval $inlibc
10351
10352 : see if alarm exists
10353 set alarm d_alarm
10354 eval $inlibc
10355
10356 : see if 64bit time functions exists
10357
10358 set ctime64 d_ctime64
10359 eval $inlibc
10360
10361 set localtime64 d_localtime64
10362 eval $inlibc
10363
10364 set gmtime64 d_gmtime64
10365 eval $inlibc
10366
10367 set mktime64 d_mktime64
10368 eval $inlibc
10369
10370 set difftime64 d_difftime64
10371 eval $inlibc
10372
10373 set asctime64 d_asctime64
10374 eval $inlibc
10375
10376 : see if POSIX threads are available
10377 set pthread.h i_pthread
10378 eval $inhdr
10379
10380 : define a function to check prototypes
10381 $cat > protochk <<EOSH
10382 $startsh
10383 cc="$cc"
10384 optimize="$optimize"
10385 ccflags="$ccflags"
10386 prototype="$prototype"
10387 define="$define"
10388 rm_try="$rm_try"
10389 usethreads=$usethreads
10390 i_pthread=$i_pthread
10391 pthread_h_first=$pthread_h_first
10392 EOSH
10393
10394 $cat >> protochk <<'EOSH'
10395
10396 $rm_try
10397 foo="$1"
10398 shift
10399 while test $# -ge 2; do
10400         case "$1" in
10401                 $define) echo "#include <$2>" >> try.c ;;
10402                 literal) echo "$2" >> try.c ;;
10403         esac
10404     # Extra magic for the benefit of systems that need pthread.h
10405     # to be included early to correctly detect threadsafe functions.
10406     # Such functions must guarantee themselves, though, that the usethreads
10407     # and i_pthread have been defined, before calling protochk.
10408     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10409         echo "#include <pthread.h>" >> try.c
10410         pthread_h_done=yes
10411     fi
10412     shift 2
10413 done
10414 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10415 cat >> try.c <<'EOCP'
10416 #ifdef CAN_PROTOTYPE
10417 #define _(args) args
10418 #else
10419 #define _(args) ()
10420 #endif
10421 EOCP
10422 echo "$foo" >> try.c
10423 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10424 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10425 status=$?
10426 $rm_try
10427 exit $status
10428 EOSH
10429 chmod +x protochk
10430 $eunicefix protochk
10431
10432 : Define hasproto macro for Configure internal use
10433 hasproto='varname=$1; func=$2; shift; shift;
10434 while $test $# -ge 2; do
10435         case "$1" in
10436         $define) echo "#include <$2>";;
10437         esac ;
10438     shift 2;
10439 done > try.c;
10440 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10441 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10442         echo "$func() prototype found.";
10443         val="$define";
10444 else
10445         echo "$func() prototype NOT found.";
10446         val="$undef";
10447 fi;
10448 set $varname;
10449 eval $setvar;
10450 $rm_try tryout.c'
10451
10452 : see if sys/types.h has to be included
10453 set sys/types.h i_systypes
10454 eval $inhdr
10455
10456 : see if sys/select.h has to be included
10457 set sys/select.h i_sysselct
10458 eval $inhdr
10459
10460 : Define hasfield macro for Configure internal use
10461 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10462 while $test $# -ge 2; do
10463         case "$1" in
10464         $define) echo "#include <$2>";;
10465         esac ;
10466     shift 2;
10467 done > try.c;
10468 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10469 set try;
10470 if eval $compile; then
10471         val="$define";
10472 else
10473         val="$undef";
10474 fi;
10475 set $varname;
10476 eval $setvar;
10477 $rm_try'
10478
10479 : see if we should include time.h, sys/time.h, or both
10480 echo " "
10481 if test "X$timeincl" = X; then
10482         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10483         $echo $n "I'm now running the test program...$c"
10484         $cat >try.c <<EOCP
10485 #include <sys/types.h>
10486 #ifdef I_TIME
10487 #include <time.h>
10488 #endif
10489 #ifdef I_SYSTIME
10490 #ifdef SYSTIMEKERNEL
10491 #define KERNEL
10492 #endif
10493 #include <sys/time.h>
10494 #endif
10495 #ifdef I_SYSSELECT
10496 #include <sys/select.h>
10497 #endif
10498 #$i_stdlib I_STDLIB
10499 #ifdef I_STDLIB
10500 #include <stdlib.h>
10501 #endif
10502 int main()
10503 {
10504         struct tm foo;
10505 #ifdef S_TIMEVAL
10506         struct timeval bar;
10507 #endif
10508 #ifdef S_TIMEZONE
10509         struct timezone tzp;
10510 #endif
10511         if (foo.tm_sec == foo.tm_sec)
10512                 exit(0);
10513 #ifdef S_TIMEVAL
10514         if (bar.tv_sec == bar.tv_sec)
10515                 exit(0);
10516 #endif
10517         exit(1);
10518 }
10519 EOCP
10520         flags=''
10521         for s_timezone in '-DS_TIMEZONE' ''; do
10522         sysselect=''
10523         for s_timeval in '-DS_TIMEVAL' ''; do
10524         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10525         for i_time in '' '-DI_TIME'; do
10526         for i_systime in '-DI_SYSTIME' ''; do
10527                 case "$flags" in
10528                 '') $echo $n ".$c"
10529                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10530                         if eval $compile; then
10531                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10532                                 shift
10533                                 flags="$*"
10534                                 echo " "
10535                                 $echo $n "Succeeded with $flags$c"
10536                         fi
10537                         ;;
10538                 esac
10539         done
10540         done
10541         done
10542         done
10543         done
10544         timeincl=''
10545         echo " "
10546         case "$flags" in
10547         *SYSTIMEKERNEL*) i_systimek="$define"
10548                 timeincl=`./findhdr sys/time.h`
10549                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10550         *) i_systimek="$undef";;
10551         esac
10552         case "$flags" in
10553         *I_TIME*) i_time="$define"
10554                 timeincl=`./findhdr time.h`" $timeincl"
10555                 echo "We'll include <time.h>." >&4;;
10556         *) i_time="$undef";;
10557         esac
10558         case "$flags" in
10559         *I_SYSTIME*) i_systime="$define"
10560                 timeincl=`./findhdr sys/time.h`" $timeincl"
10561                 echo "We'll include <sys/time.h>." >&4;;
10562         *) i_systime="$undef";;
10563         esac
10564         $rm_try
10565 fi
10566 : see if struct tm knows about tm_zone
10567 case "$i_systime$i_time" in
10568 *$define*)
10569         echo " "
10570         echo "Checking to see if your struct tm has tm_zone field..." >&4
10571         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10572         eval $hasfield
10573         ;;
10574 *)      val="$undef"
10575         set d_tm_tm_zone
10576         eval $setvar
10577         ;;
10578 esac
10579 case "$d_tm_tm_zone" in
10580 "$define")      echo "Yes, it does."   ;;
10581 *)              echo "No, it doesn't." ;;
10582 esac
10583 : see if struct tm knows about tm_gmtoff
10584 case "$i_systime$i_time" in
10585 *$define*)
10586         echo " "
10587         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10588         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10589         eval $hasfield
10590         ;;
10591 *)      val="$undef"
10592         set d_tm_tm_gmtoff
10593         eval $setvar
10594         ;;
10595 esac
10596 case "$d_tm_tm_gmtoff" in
10597 "$define")      echo "Yes, it does."   ;;
10598 *)              echo "No, it doesn't." ;;
10599 esac
10600
10601 : see if asctime_r exists
10602 set asctime_r d_asctime_r
10603 eval $inlibc
10604 case "$d_asctime_r" in
10605 "$define")
10606         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10607         case "$d_asctime_r_proto:$usethreads" in
10608         ":define")      d_asctime_r_proto=define
10609                 set d_asctime_r_proto asctime_r $hdrs
10610                 eval $hasproto ;;
10611         *)      ;;
10612         esac
10613         case "$d_asctime_r_proto" in
10614         define)
10615         case "$asctime_r_proto" in
10616         ''|0) try='char* asctime_r(const struct tm*, char*);'
10617         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10618         esac
10619         case "$asctime_r_proto" in
10620         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10621         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10622         esac
10623         case "$asctime_r_proto" in
10624         ''|0) try='int asctime_r(const struct tm*, char*);'
10625         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10626         esac
10627         case "$asctime_r_proto" in
10628         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10629         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10630         esac
10631         case "$asctime_r_proto" in
10632         ''|0)   d_asctime_r=undef
10633                 asctime_r_proto=0
10634                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10635         * )     case "$asctime_r_proto" in
10636                 REENTRANT_PROTO*) ;;
10637                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10638                 esac
10639                 echo "Prototype: $try" ;;
10640         esac
10641         ;;
10642         *)      case "$usethreads" in
10643                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10644                 esac
10645                 d_asctime_r=undef
10646                 asctime_r_proto=0
10647                 ;;
10648         esac
10649         ;;
10650 *)      asctime_r_proto=0
10651         ;;
10652 esac
10653
10654 : see if atolf exists
10655 set atolf d_atolf
10656 eval $inlibc
10657
10658 : see if atoll exists
10659 set atoll d_atoll
10660 eval $inlibc
10661
10662 : Look for GCC-style attribute format
10663 case "$d_attribute_format" in
10664 '')
10665 echo " "
10666 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10667 $cat >attrib.c <<'EOCP'
10668 #include <stdio.h>
10669 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10670 EOCP
10671 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10672         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10673                 echo "Your C compiler doesn't support __attribute__((format))."
10674                 val="$undef"
10675         else
10676                 echo "Your C compiler supports __attribute__((format))."
10677                 val="$define"
10678         fi
10679 else
10680         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10681         val="$undef"
10682 fi
10683 ;;
10684 *) val="$d_attribute_format" ;;
10685 esac
10686 set d_attribute_format
10687 eval $setvar
10688 $rm -f attrib*
10689
10690 : Look for GCC-style attribute format with null format allowed
10691 case "$d_printf_format_null" in
10692 '') case "$d_attribute_format" in
10693     $define)
10694         echo " "
10695         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10696 $cat >attrib.c <<EOCP
10697 #include <stdio.h>
10698 #$i_stdlib I_STDLIB
10699 #ifdef I_STDLIB
10700 #include <stdlib.h>
10701 #endif
10702 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10703 int null_printf (char* pat,...) { return (int)pat; }
10704 int main () { exit(null_printf(NULL)); }
10705 EOCP
10706         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10707             : run the executable in case it produces a run-time warning
10708             if $run ./attrib >>attrib.out 2>&1; then
10709                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10710                     echo "Your C compiler doesn't allow __printf__ format to be null."
10711                     val="$undef"
10712                 else
10713                     echo "Your C compiler allows __printf__ format to be null."
10714                     val="$define"
10715                 fi
10716             else
10717             echo "Your C compiler executable failed with __printf__ format null."
10718             val="$undef"
10719         fi
10720     else
10721         echo "Your C compiler fails with __printf__ format null."
10722         val="$undef"
10723     fi
10724     ;;
10725     *)  val="$undef" ;;
10726     esac
10727 ;;
10728 *)  val="$d_printf_format_null" ;;
10729 esac
10730 set d_printf_format_null
10731 eval $setvar
10732 $rm -f attrib*
10733
10734 : Look for GCC-style attribute malloc
10735 case "$d_attribute_malloc" in
10736 '')
10737 echo " "
10738 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10739 $cat >attrib.c <<'EOCP'
10740 #include <stdio.h>
10741 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10742 EOCP
10743 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10744         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10745                 echo "Your C compiler doesn't support __attribute__((malloc))."
10746                 val="$undef"
10747         else
10748                 echo "Your C compiler supports __attribute__((malloc))."
10749                 val="$define"
10750         fi
10751 else
10752         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10753         val="$undef"
10754 fi
10755 ;;
10756 *) val="$d_attribute_malloc" ;;
10757 esac
10758 set d_attribute_malloc
10759 eval $setvar
10760 $rm -f attrib*
10761
10762 : Look for GCC-style attribute nonnull
10763 case "$d_attribute_nonnull" in
10764 '')
10765 echo " "
10766 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10767 $cat >attrib.c <<'EOCP'
10768 #include <stdio.h>
10769 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10770 EOCP
10771 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10772         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10773                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10774                 val="$undef"
10775         else
10776                 echo "Your C compiler supports __attribute__((nonnull))."
10777                 val="$define"
10778         fi
10779 else
10780         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10781         val="$undef"
10782 fi
10783 ;;
10784 *) val="$d_attribute_nonnull" ;;
10785 esac
10786 set d_attribute_nonnull
10787 eval $setvar
10788 $rm -f attrib*
10789
10790 : Look for GCC-style attribute noreturn
10791 case "$d_attribute_noreturn" in
10792 '')
10793 echo " "
10794 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10795 $cat >attrib.c <<'EOCP'
10796 #include <stdio.h>
10797 void fall_over_dead( void ) __attribute__((noreturn));
10798 EOCP
10799 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10800         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10801                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10802                 val="$undef"
10803         else
10804                 echo "Your C compiler supports __attribute__((noreturn))."
10805                 val="$define"
10806         fi
10807 else
10808         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10809         val="$undef"
10810 fi
10811 ;;
10812 *) val="$d_attribute_noreturn" ;;
10813 esac
10814 set d_attribute_noreturn
10815 eval $setvar
10816 $rm -f attrib*
10817
10818 : Look for GCC-style attribute pure
10819 case "$d_attribute_pure" in
10820 '')
10821 echo " "
10822 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10823 $cat >attrib.c <<'EOCP'
10824 #include <stdio.h>
10825 int square( int n ) __attribute__((pure));
10826 EOCP
10827 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10828         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10829                 echo "Your C compiler doesn't support __attribute__((pure))."
10830                 val="$undef"
10831         else
10832                 echo "Your C compiler supports __attribute__((pure))."
10833                 val="$define"
10834         fi
10835 else
10836         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10837         val="$undef"
10838 fi
10839 ;;
10840 *) val="$d_attribute_pure" ;;
10841 esac
10842 set d_attribute_pure
10843 eval $setvar
10844 $rm -f attrib*
10845
10846 : Look for GCC-style attribute unused
10847 case "$d_attribute_unused" in
10848 '')
10849 echo " "
10850 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10851 $cat >attrib.c <<'EOCP'
10852 #include <stdio.h>
10853 int do_something( int dummy __attribute__((unused)), int n );
10854 EOCP
10855 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10856         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10857                 echo "Your C compiler doesn't support __attribute__((unused))."
10858                 val="$undef"
10859         else
10860                 echo "Your C compiler supports __attribute__((unused))."
10861                 val="$define"
10862         fi
10863 else
10864         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10865         val="$undef"
10866 fi
10867 ;;
10868 *) val="$d_attribute_unused" ;;
10869 esac
10870 set d_attribute_unused
10871 eval $setvar
10872 $rm -f attrib*
10873
10874 : Look for GCC-style attribute deprecated
10875 case "$d_attribute_deprecated" in
10876 '')
10877 echo " "
10878 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10879 $cat >attrib.c <<'EOCP'
10880 #include <stdio.h>
10881 int I_am_deprecated(void) __attribute__((deprecated));
10882 EOCP
10883 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10884         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10885                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10886                 val="$undef"
10887         else
10888                 echo "Your C compiler supports __attribute__((deprecated))."
10889                 val="$define"
10890         fi
10891 else
10892         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10893         val="$undef"
10894 fi
10895 ;;
10896 *) val="$d_attribute_deprecated" ;;
10897 esac
10898 set d_attribute_deprecated
10899 eval $setvar
10900 $rm -f attrib*
10901
10902 : Look for GCC-style attribute warn_unused_result
10903 case "$d_attribute_warn_unused_result" in
10904 '')
10905 echo " "
10906 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10907 $cat >attrib.c <<'EOCP'
10908 #include <stdio.h>
10909 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10910 EOCP
10911 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10912         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10913                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10914                 val="$undef"
10915         else
10916                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10917                 val="$define"
10918         fi
10919 else
10920         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10921         val="$undef"
10922 fi
10923 ;;
10924 *) val="$d_attribute_warn_unused_result" ;;
10925 esac
10926 set d_attribute_warn_unused_result
10927 eval $setvar
10928 $rm -f attrib*
10929
10930 : see if bcmp exists
10931 set bcmp d_bcmp
10932 eval $inlibc
10933
10934 : see if bcopy exists
10935 set bcopy d_bcopy
10936 eval $inlibc
10937
10938 : see if getpgrp exists
10939 set getpgrp d_getpgrp
10940 eval $inlibc
10941
10942 case "$d_getpgrp" in
10943 "$define")
10944         echo " "
10945         echo "Checking to see which flavor of getpgrp is in use..."
10946         $cat >try.c <<EOP
10947 #$i_unistd I_UNISTD
10948 #include <sys/types.h>
10949 #ifdef I_UNISTD
10950 #  include <unistd.h>
10951 #endif
10952 #$i_stdlib I_STDLIB
10953 #ifdef I_STDLIB
10954 #include <stdlib.h>
10955 #endif
10956 int main()
10957 {
10958         if (getuid() == 0) {
10959                 printf("(I see you are running Configure as super-user...)\n");
10960                 setuid(1);
10961         }
10962 #ifdef TRY_BSD_PGRP
10963         if (getpgrp(1) == 0)
10964                 exit(0);
10965 #else
10966         if (getpgrp() > 0)
10967                 exit(0);
10968 #endif
10969         exit(1);
10970 }
10971 EOP
10972         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10973                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10974                 val="$define"
10975         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10976                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10977                 val="$undef"
10978         else
10979                 echo "I can't seem to compile and run the test program."
10980                 if ./usg; then
10981                         xxx="a USG one, i.e. you use getpgrp()."
10982                 else
10983                         # SVR4 systems can appear rather BSD-ish.
10984                         case "$i_unistd" in
10985                         $undef)
10986                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10987                                 val="$define"
10988                                 ;;
10989                         $define)
10990                                 xxx="probably a USG one, i.e. you use getpgrp()."
10991                                 val="$undef"
10992                                 ;;
10993                         esac
10994                 fi
10995                 echo "Assuming your getpgrp is $xxx" >&4
10996         fi
10997         ;;
10998 *) val="$undef";;
10999 esac
11000 set d_bsdgetpgrp
11001 eval $setvar
11002 $rm_try
11003
11004 : see if setpgrp exists
11005 set setpgrp d_setpgrp
11006 eval $inlibc
11007
11008 case "$d_setpgrp" in
11009 "$define")
11010         echo " "
11011         echo "Checking to see which flavor of setpgrp is in use..."
11012         $cat >try.c <<EOP
11013 #$i_unistd I_UNISTD
11014 #include <sys/types.h>
11015 #ifdef I_UNISTD
11016 #  include <unistd.h>
11017 #endif
11018 #$i_stdlib I_STDLIB
11019 #ifdef I_STDLIB
11020 #include <stdlib.h>
11021 #endif
11022 int main()
11023 {
11024         if (getuid() == 0) {
11025                 printf("(I see you are running Configure as super-user...)\n");
11026                 setuid(1);
11027         }
11028 #ifdef TRY_BSD_PGRP
11029         if (-1 == setpgrp(1, 1))
11030                 exit(0);
11031 #else
11032         if (setpgrp() != -1)
11033                 exit(0);
11034 #endif
11035         exit(1);
11036 }
11037 EOP
11038         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11039                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11040                 val="$define"
11041         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11042                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11043                 val="$undef"
11044         else
11045                 echo "(I can't seem to compile and run the test program.)"
11046                 if ./usg; then
11047                         xxx="a USG one, i.e. you use setpgrp()."
11048                 else
11049                         # SVR4 systems can appear rather BSD-ish.
11050                         case "$i_unistd" in
11051                         $undef)
11052                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11053                                 val="$define"
11054                                 ;;
11055                         $define)
11056                                 xxx="probably a USG one, i.e. you use setpgrp()."
11057                                 val="$undef"
11058                                 ;;
11059                         esac
11060                 fi
11061                 echo "Assuming your setpgrp is $xxx" >&4
11062         fi
11063         ;;
11064 *) val="$undef";;
11065 esac
11066 set d_bsdsetpgrp
11067 eval $setvar
11068 $rm_try
11069
11070 : Look for GCC-style __builtin_choose_expr
11071 case "$d_builtin_choose_expr" in
11072 '')
11073     echo " "
11074     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11075     $cat >try.c <<'EOCP'
11076 #include <assert.h>
11077 #include <stdlib.h>
11078 #include <stdio.h>
11079
11080 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11081
11082 int main(void) {
11083     assert( SYRINX(1) == 2112 );
11084     assert( SYRINX(1) != 5150 );
11085     assert( SYRINX(0) == 5150 );
11086     assert( SYRINX(0) != 2112 );
11087     puts( "All good!" );
11088     exit(0);
11089 }
11090
11091 EOCP
11092     set try
11093     if eval $compile && $run ./try; then
11094         echo "Your C compiler supports __builtin_choose_expr."
11095         val="$define"
11096     else
11097         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11098         val="$undef"
11099     fi
11100 ;;
11101 *) val="$d_builtin_choose_expr" ;;
11102 esac
11103
11104 set d_builtin_choose_expr
11105 eval $setvar
11106 $rm_try
11107
11108 : Look for GCC-style __builtin_expect
11109 case "$d_builtin_expect" in
11110 '')
11111     echo " "
11112     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11113     $cat >try.c <<'EOCP'
11114 int main(void) {
11115     int n = 50;
11116     if ( __builtin_expect(n, 0) ) n = 1;
11117     /* Remember shell exit code truth is 0, C truth is non-zero */
11118     return !(n == 1);
11119 }
11120 EOCP
11121     set try
11122     if eval $compile && $run ./try; then
11123         echo "Your C compiler supports __builtin_expect."
11124         val="$define"
11125     else
11126         echo "Your C compiler doesn't seem to understand __builtin_expect."
11127         val="$undef"
11128     fi
11129     ;;
11130 *) val="$d_builtin_expect" ;;
11131 esac
11132
11133 set d_builtin_expect
11134 eval $setvar
11135 $rm_try
11136
11137 : see if bzero exists
11138 set bzero d_bzero
11139 eval $inlibc
11140
11141 : see if stdarg is available
11142 echo " "
11143 if $test `./findhdr stdarg.h`; then
11144         echo "<stdarg.h> found." >&4
11145         valstd="$define"
11146 else
11147         echo "<stdarg.h> NOT found." >&4
11148         valstd="$undef"
11149 fi
11150
11151 : see if varargs is available
11152 echo " "
11153 if $test `./findhdr varargs.h`; then
11154         echo "<varargs.h> found." >&4
11155 else
11156         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
11157 fi
11158
11159 : set up the varargs testing programs
11160 $cat > varargs.c <<EOP
11161 #ifdef I_STDARG
11162 #include <stdarg.h>
11163 #endif
11164 #ifdef I_VARARGS
11165 #include <varargs.h>
11166 #endif
11167
11168 #ifdef I_STDARG
11169 int f(char *p, ...)
11170 #else
11171 int f(va_alist)
11172 va_dcl
11173 #endif
11174 {
11175         va_list ap;
11176 #ifndef I_STDARG
11177         char *p;
11178 #endif
11179 #ifdef I_STDARG
11180         va_start(ap,p);
11181 #else
11182         va_start(ap);
11183         p = va_arg(ap, char *);
11184 #endif
11185         va_end(ap);
11186         return 0;
11187 }
11188 EOP
11189 $cat > varargs <<EOP
11190 $startsh
11191 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
11192         echo "true"
11193 else
11194         echo "false"
11195 fi
11196 $rm -f varargs$_o
11197 EOP
11198 chmod +x varargs
11199
11200 : now check which varargs header should be included
11201 echo " "
11202 i_varhdr=''
11203 val=''
11204 case "$valstd" in
11205 "$define")
11206         if `./varargs I_STDARG`; then
11207                 val='stdarg.h'
11208         elif `./varargs I_VARARGS`; then
11209                 val='varargs.h'
11210         fi
11211         ;;
11212 *)
11213         if `./varargs I_VARARGS`; then
11214                 val='varargs.h'
11215         fi
11216         ;;
11217 esac
11218 case "$val" in
11219 '')
11220         echo " "
11221         echo "*** WHOA THERE!!! ***" >&4
11222         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
11223         case "$knowitall" in
11224         '')
11225         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
11226                 exit 1
11227                 ;;
11228         esac
11229 echo "I could not find the definition for va_dcl... You have problems..." >&4
11230         val="$undef"; set i_stdarg; eval $setvar
11231         val="$undef"; set i_varargs; eval $setvar
11232         ;;
11233 *)
11234         set i_varhdr
11235         eval $setvar
11236         case "$i_varhdr" in
11237         stdarg.h)
11238                 val="$define"; set i_stdarg; eval $setvar
11239                 val="$undef"; set i_varargs; eval $setvar
11240                 ;;
11241         varargs.h)
11242                 val="$undef"; set i_stdarg; eval $setvar
11243                 val="$define"; set i_varargs; eval $setvar
11244                 ;;
11245         esac
11246         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
11247 esac
11248 $rm -f varargs*
11249
11250 : see if the Compiler supports C99 variadic macros
11251 case "$i_stdarg$i_stdlib" in
11252     "$define$define")
11253     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
11254     $cat >try.c <<EOCP
11255 #include <stdio.h>
11256 #include <stdarg.h>
11257
11258 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11259
11260 int main() {
11261   char buf[20];
11262   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11263   puts(buf);
11264   return 0;
11265 }
11266 EOCP
11267     set try
11268     if eval $compile && $run ./try 2>&1 >/dev/null; then
11269         case "`$run ./try`" in
11270             "123 456 789")
11271             echo "You have C99 variadic macros." >&4
11272             d_c99_variadic_macros="$define"
11273             ;;
11274             *)
11275             echo "You don't have functional C99 variadic macros." >&4
11276             d_c99_variadic_macros="$undef"
11277             ;;
11278         esac
11279     else
11280         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11281         d_c99_variadic_macros="$undef"
11282     fi
11283     $rm_try
11284     ;;
11285     *)
11286     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
11287     d_c99_variadic_macros="$undef"
11288     ;;
11289 esac
11290
11291 : see if signal is declared as pointer to function returning int or void
11292 echo " "
11293 xxx=`./findhdr signal.h`
11294 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11295 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11296         echo "You have int (*signal())() instead of void." >&4
11297         val="$undef"
11298 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11299         echo "You have void (*signal())()." >&4
11300         val="$define"
11301 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11302         echo "You have int (*signal())() instead of void." >&4
11303         val="$undef"
11304 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11305         echo "You have void (*signal())()." >&4
11306         val="$define"
11307 else
11308         case "$d_voidsig" in
11309         '')
11310         echo "I can't determine whether signal handler returns void or int..." >&4
11311                 dflt=void
11312                 rp="What type does your signal handler return?"
11313                 . ./myread
11314                 case "$ans" in
11315                 v*) val="$define";;
11316                 *) val="$undef";;
11317                 esac;;
11318         "$define")
11319                 echo "As you already told me, signal handler returns void." >&4
11320                 val="$define"
11321                 ;;
11322         *)      echo "As you already told me, signal handler returns int." >&4
11323                 val="$undef"
11324                 ;;
11325         esac
11326 fi
11327 set d_voidsig
11328 eval $setvar
11329 case "$d_voidsig" in
11330 "$define") signal_t="void";;
11331 *) signal_t="int";;
11332 esac
11333 $rm -f $$.tmp
11334
11335 : check for ability to cast large floats to 32-bit ints.
11336 echo " "
11337 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11338 if $test "$intsize" -ge 4; then
11339         xxx=int
11340 else
11341         xxx=long
11342 fi
11343 $cat >try.c <<EOCP
11344 #include <stdio.h>
11345 #$i_stdlib I_STDLIB
11346 #ifdef I_STDLIB
11347 #include <stdlib.h>
11348 #endif
11349 #include <sys/types.h>
11350 #include <signal.h>
11351 $signal_t blech(int s) { exit(3); }
11352 int main()
11353 {
11354         $xxx i32;
11355         double f, g;
11356         int result = 0;
11357         char str[16];
11358         signal(SIGFPE, blech);
11359
11360         /* Don't let compiler optimize the test away.  Store the number
11361            in a writable string for gcc to pass to sscanf under HP-UX.
11362         */
11363         sprintf(str, "2147483647");
11364         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11365         g = 10 * f;
11366         i32  = ($xxx) g;
11367
11368         /* x86 processors will probably give 0x8000 0000, which is a
11369            sign change.  We don't want that.  We want to mimic SPARC
11370            behavior here, which is to preserve the sign and give
11371            back 0x7fff ffff.
11372         */
11373         if (i32 != ($xxx) f)
11374                 result |= 1;
11375         exit(result);
11376 }
11377 EOCP
11378 set try
11379 if eval $compile_ok; then
11380         $run ./try
11381         yyy=$?
11382 else
11383         echo "(I can't seem to compile the test program--assuming it can't)"
11384         yyy=1
11385 fi
11386 case "$yyy" in
11387 0)      val="$define"
11388         echo "Yup, it can."
11389         ;;
11390 *)      val="$undef"
11391         echo "Nope, it can't."
11392         ;;
11393 esac
11394 set d_casti32
11395 eval $setvar
11396 $rm_try
11397
11398 : check for ability to cast negative floats to unsigned
11399 echo " "
11400 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11401 $cat >try.c <<EOCP
11402 #include <stdio.h>
11403 #$i_stdlib I_STDLIB
11404 #ifdef I_STDLIB
11405 #include <stdlib.h>
11406 #endif
11407 #include <sys/types.h>
11408 #include <signal.h>
11409 $signal_t blech(int s) { exit(7); }
11410 $signal_t blech_in_list(int s) { exit(4); }
11411 unsigned long dummy_long(unsigned long p) { return p; }
11412 unsigned int dummy_int(unsigned int p) { return p; }
11413 unsigned short dummy_short(unsigned short p) { return p; }
11414 int main()
11415 {
11416         double f;
11417         unsigned long along;
11418         unsigned int aint;
11419         unsigned short ashort;
11420         int result = 0;
11421         char str[16];
11422
11423         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11424            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11425            optimized the whole file away
11426         */
11427         /* Store the number in a writable string for gcc to pass to
11428            sscanf under HP-UX.
11429         */
11430         sprintf(str, "-123");
11431         sscanf(str, "%lf", &f);  /* f = -123.; */
11432
11433         signal(SIGFPE, blech);
11434         along = (unsigned long)f;
11435         aint = (unsigned int)f;
11436         ashort = (unsigned short)f;
11437         if (along != (unsigned long)-123)
11438                 result |= 1;
11439         if (aint != (unsigned int)-123)
11440                 result |= 1;
11441         if (ashort != (unsigned short)-123)
11442                 result |= 1;
11443         sprintf(str, "1073741824.");
11444         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11445         f = f + f;
11446         along = 0;
11447         along = (unsigned long)f;
11448         if (along != 0x80000000)
11449                 result |= 2;
11450         f -= 1.;
11451         along = 0;
11452         along = (unsigned long)f;
11453         if (along != 0x7fffffff)
11454                 result |= 1;
11455         f += 2.;
11456         along = 0;
11457         along = (unsigned long)f;
11458         if (along != 0x80000001)
11459                 result |= 2;
11460         if (result)
11461                 exit(result);
11462         signal(SIGFPE, blech_in_list);
11463         sprintf(str, "123.");
11464         sscanf(str, "%lf", &f);  /* f = 123.; */
11465         along = dummy_long((unsigned long)f);
11466         aint = dummy_int((unsigned int)f);
11467         ashort = dummy_short((unsigned short)f);
11468         if (along != (unsigned long)123)
11469                 result |= 4;
11470         if (aint != (unsigned int)123)
11471                 result |= 4;
11472         if (ashort != (unsigned short)123)
11473                 result |= 4;
11474         exit(result);
11475
11476 }
11477 EOCP
11478 set try
11479 if eval $compile_ok; then
11480         $run ./try
11481         castflags=$?
11482 else
11483         echo "(I can't seem to compile the test program--assuming it can't)"
11484         castflags=7
11485 fi
11486 case "$castflags" in
11487 0)      val="$define"
11488         echo "Yup, it can."
11489         ;;
11490 *)      val="$undef"
11491         echo "Nope, it can't."
11492         ;;
11493 esac
11494 set d_castneg
11495 eval $setvar
11496 $rm_try
11497
11498 : see if vprintf exists
11499 echo " "
11500 if set vprintf val -f d_vprintf; eval $csym; $val; then
11501         echo 'vprintf() found.' >&4
11502         val="$define"
11503         $cat >try.c <<EOF
11504 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11505 #$i_varargs I_VARARGS
11506
11507 #$i_stdlib I_STDLIB
11508 #$i_unistd I_UNISTD
11509
11510 #ifdef I_STDARG
11511 #  include <stdarg.h>
11512 #else /* I_VARARGS */
11513 #  include <varargs.h>
11514 #endif
11515
11516 #ifdef I_UNISTD
11517 #  include <unistd.h>
11518 #endif
11519
11520 #ifdef I_STDLIB
11521 #  include <stdlib.h>
11522 #endif
11523
11524 #include <stdio.h> /* vsprintf prototype */
11525
11526 #ifdef I_STDARG
11527 void xxx(int n, ...)
11528 {
11529     va_list args;
11530     char buf[10];
11531     va_start(args, n);
11532     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11533 }
11534 int main() { xxx(1, "foo"); }
11535
11536 #else /* I_VARARGS */
11537
11538 xxx(va_alist)
11539 va_dcl
11540 {
11541     va_list args;
11542     char buf[10];
11543     va_start(args);
11544     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11545 }
11546 int main() { xxx("foo"); }
11547
11548 #endif
11549
11550 EOF
11551         set try
11552         if eval $compile_ok; then
11553                 if $run ./try; then
11554                         echo "Your vsprintf() returns (int)." >&4
11555                         val2="$undef"
11556                 else
11557                         echo "Your vsprintf() returns (char*)." >&4
11558                         val2="$define"
11559                 fi
11560         else
11561                 echo 'I am unable to compile the vsprintf() test program.' >&4
11562                 # We shouldn't get here.  If we do, assume the standard signature,
11563                 # not the old BSD one.
11564                 echo 'Guessing that vsprintf() returns (int).' >&4
11565                 val2="$undef"
11566         fi
11567 else
11568         echo 'vprintf() NOT found.' >&4
11569         val="$undef"
11570         val2="$undef"
11571 fi
11572 $rm_try
11573 set d_vprintf
11574 eval $setvar
11575 val=$val2
11576 set d_charvspr
11577 eval $setvar
11578
11579 : see if chown exists
11580 set chown d_chown
11581 eval $inlibc
11582
11583 : see if chroot exists
11584 set chroot d_chroot
11585 eval $inlibc
11586
11587 : see if chsize exists
11588 set chsize d_chsize
11589 eval $inlibc
11590
11591 : see if class exists
11592 set class d_class
11593 eval $inlibc
11594
11595 : see if clearenv exists
11596 set clearenv d_clearenv
11597 eval $inlibc
11598
11599 : Define hasstruct macro for Configure internal use
11600 hasstruct='varname=$1; struct=$2; shift; shift;
11601 while $test $# -ge 2; do
11602         case "$1" in
11603         $define) echo "#include <$2>";;
11604         esac ;
11605     shift 2;
11606 done > try.c;
11607 echo "int main () { struct $struct foo; }" >> try.c;
11608 set try;
11609 if eval $compile; then
11610         val="$define";
11611 else
11612         val="$undef";
11613 fi;
11614 set $varname;
11615 eval $setvar;
11616 $rm_try'
11617
11618 : see whether socket exists
11619 socketlib=''
11620 sockethdr=''
11621 echo " "
11622 $echo $n "Hmm... $c" >&4
11623 if set socket val -f d_socket; eval $csym; $val; then
11624     echo "Looks like you have Berkeley networking support." >&4
11625     d_socket="$define"
11626     if set setsockopt val -f; eval $csym; $val; then
11627         d_oldsock="$undef"
11628     else
11629         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11630         d_oldsock="$define"
11631     fi
11632 else
11633     if $contains socklib libc.list >/dev/null 2>&1; then
11634         echo "Looks like you have Berkeley networking support." >&4
11635         d_socket="$define"
11636         : we will have to assume that it supports the 4.2 BSD interface
11637         d_oldsock="$undef"
11638     else
11639         echo "You don't have Berkeley networking in libc$_a..." >&4
11640         if test "X$d_socket" = "X$define"; then
11641             echo "...but you seem to believe that you have sockets." >&4
11642         else
11643             for net in net socket
11644             do
11645                 if test -f $sysroot/usr/lib/lib$net$_a; then
11646                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11647                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11648                     if $contains socket libc.list >/dev/null 2>&1; then
11649                         d_socket="$define"
11650                         socketlib="-l$net"
11651                         case "$net" in
11652                         net)
11653                             echo "...but the Wollongong group seems to have hacked it in." >&4
11654                             sockethdr="-I$sysroot/usr/netinclude"
11655                             ;;
11656                         esac
11657                         echo "Found Berkeley sockets interface in lib$net." >&4
11658                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11659                             d_oldsock="$undef"
11660                         else
11661                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11662                             d_oldsock="$define"
11663                         fi
11664                         break
11665                     fi
11666                 fi
11667             done
11668             if test "X$d_socket" != "X$define"; then
11669                echo "or anywhere else I see." >&4
11670                d_socket="$undef"
11671                d_oldsock="$undef"
11672             fi
11673         fi
11674     fi
11675 fi
11676
11677 : see if socketpair exists
11678 set socketpair d_sockpair
11679 eval $inlibc
11680
11681
11682 echo " "
11683 echo "Checking the availability sa_len in the sock struct ..." >&4
11684 $cat >try.c <<EOF
11685 #include <sys/types.h>
11686 #include <sys/socket.h>
11687 int main() {
11688 struct sockaddr sa;
11689 return (sa.sa_len);
11690 }
11691 EOF
11692 val="$undef"
11693 set try; if eval $compile; then
11694     val="$define"
11695 fi
11696 set d_sockaddr_sa_len; eval $setvar
11697 $rm_try
11698
11699 echo " "
11700 echo "Checking the availability struct sockaddr_in6 ..." >&4
11701 $cat >try.c <<EOF
11702 #include <sys/types.h>
11703 #include <sys/socket.h>
11704 #include <netinet/in.h>
11705 int main() {
11706 struct sockaddr_in6 sin6;
11707 return (sin6.sin6_family);
11708 }
11709 EOF
11710 val="$undef"
11711 set try; if eval $compile; then
11712     val="$define"
11713 fi
11714 set d_sockaddr_in6; eval $setvar
11715 $rm_try
11716
11717 echo " "
11718 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11719 $cat >try.c <<EOF
11720 #include <sys/types.h>
11721 #include <sys/socket.h>
11722 #include <netinet/in.h>
11723 int main() {
11724 struct sockaddr_in6 sin6;
11725 return (sin6.sin6_scope_id);
11726 }
11727 EOF
11728 val="$undef"
11729 set try; if eval $compile; then
11730     val="$define"
11731 fi
11732 set d_sin6_scope_id; eval $setvar
11733 $rm_try
11734
11735 echo " "
11736 echo "Checking the availability struct ip_mreq ..." >&4
11737 $cat >try.c <<EOF
11738 #include <sys/types.h>
11739 #include <sys/socket.h>
11740 #include <netinet/in.h>
11741 int main() {
11742 struct ip_mreq mreq;
11743 return (mreq.imr_multiaddr.s_addr);
11744 }
11745 EOF
11746 val="$undef"
11747 set try; if eval $compile; then
11748        val="$define"
11749 fi
11750 set d_ip_mreq; eval $setvar
11751 $rm_try
11752
11753 echo " "
11754 echo "Checking the availability struct ip_mreq_source ..." >&4
11755 $cat >try.c <<EOF
11756 #include <sys/types.h>
11757 #include <sys/socket.h>
11758 #include <netinet/in.h>
11759 int main() {
11760 struct ip_mreq_source mreq;
11761 return (mreq.imr_multiaddr.s_addr);
11762 }
11763 EOF
11764 val="$undef"
11765 set try; if eval $compile; then
11766        val="$define"
11767 fi
11768 set d_ip_mreq_source; eval $setvar
11769 $rm_try
11770
11771 echo " "
11772 echo "Checking the availability struct ipv6_mreq ..." >&4
11773 $cat >try.c <<EOF
11774 #include <sys/types.h>
11775 #include <sys/socket.h>
11776 #include <netinet/in.h>
11777 int main() {
11778 struct ipv6_mreq mreq;
11779 return (mreq.ipv6mr_interface);
11780 }
11781 EOF
11782 val="$undef"
11783 set try; if eval $compile; then
11784     val="$define"
11785 fi
11786 set d_ipv6_mreq; eval $setvar
11787 $rm_try
11788
11789 echo " "
11790 echo "Checking the availability struct ipv6_mreq_source ..." >&4
11791 $cat >try.c <<EOF
11792 #include <sys/types.h>
11793 #include <sys/socket.h>
11794 #include <netinet/in.h>
11795 int main() {
11796 struct ipv6_mreq_source mreq;
11797 return (mreq.imr_multiaddr.s_addr);
11798 }
11799 EOF
11800 val="$undef"
11801 set try; if eval $compile; then
11802        val="$define"
11803 fi
11804 set d_ipv6_mreq_source; eval $setvar
11805 $rm_try
11806
11807 echo " "
11808 echo "Checking the availability of certain socket constants..." >&4
11809 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11810     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11811     $cat >try.c <<EOF
11812 #include <sys/types.h>
11813 #include <sys/socket.h>
11814 int main() {
11815     int i = $ENUM;
11816 }
11817 EOF
11818     val="$undef"
11819     set try; if eval $compile; then
11820         val="$define"
11821     fi
11822     set d_${enum}; eval $setvar
11823     $rm_try
11824 done
11825
11826 : see if this is a sys/uio.h system
11827 set sys/uio.h i_sysuio
11828 eval $inhdr
11829
11830 : Check for cmsghdr support
11831 echo " "
11832 echo "Checking to see if your system supports struct cmsghdr..." >&4
11833 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11834 eval $hasstruct
11835 case "$d_cmsghdr_s" in
11836 "$define")      echo "Yes, it does."   ;;
11837 *)              echo "No, it doesn't." ;;
11838 esac
11839
11840
11841 : check for const keyword
11842 echo " "
11843 echo 'Checking to see if your C compiler knows about "const"...' >&4
11844 $cat >const.c <<'EOCP'
11845 typedef struct spug { int drokk; } spug;
11846 int main()
11847 {
11848         const char *foo;
11849         const spug y = { 0 };
11850 }
11851 EOCP
11852 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11853         val="$define"
11854         echo "Yup, it does."
11855 else
11856         val="$undef"
11857         echo "Nope, it doesn't."
11858 fi
11859 set d_const
11860 eval $setvar
11861
11862 : see if copysignl exists
11863 set copysignl d_copysignl
11864 eval $inlibc
11865
11866 : see if crypt exists
11867 echo " "
11868 set crypt d_crypt
11869 eval $inlibc
11870 case "$d_crypt" in
11871 $define) cryptlib='' ;;
11872 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11873                 echo 'crypt() found.' >&4
11874                 val="$define"
11875                 cryptlib=''
11876         else
11877                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11878                 if $test -z "$cryptlib"; then
11879                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11880                 else
11881                         cryptlib=-lcrypt
11882                 fi
11883                 if $test -z "$cryptlib"; then
11884                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11885                 else
11886                         cryptlib=-lcrypt
11887                 fi
11888                 if $test -z "$cryptlib"; then
11889                         cryptlib=`./loc libcrypt$_a "" $libpth`
11890                 else
11891                         cryptlib=-lcrypt
11892                 fi
11893                 if $test -z "$cryptlib"; then
11894                         echo 'crypt() NOT found.' >&4
11895                         val="$undef"
11896                 else
11897                         val="$define"
11898                 fi
11899         fi
11900         set d_crypt
11901         eval $setvar
11902         ;;
11903 esac
11904
11905 : see if this is a crypt.h system
11906 set crypt.h i_crypt
11907 eval $inhdr
11908
11909 : see if crypt_r exists
11910 set crypt_r d_crypt_r
11911 eval $inlibc
11912 case "$d_crypt_r" in
11913 "$define")
11914         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11915         case "$d_crypt_r_proto:$usethreads" in
11916         ":define")      d_crypt_r_proto=define
11917                 set d_crypt_r_proto crypt_r $hdrs
11918                 eval $hasproto ;;
11919         *)      ;;
11920         esac
11921         case "$d_crypt_r_proto" in
11922         define)
11923         case "$crypt_r_proto" in
11924         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11925         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11926         esac
11927         case "$crypt_r_proto" in
11928         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11929         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11930         esac
11931         case "$crypt_r_proto" in
11932         ''|0)   d_crypt_r=undef
11933                 crypt_r_proto=0
11934                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11935         * )     case "$crypt_r_proto" in
11936                 REENTRANT_PROTO*) ;;
11937                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11938                 esac
11939                 echo "Prototype: $try" ;;
11940         esac
11941         ;;
11942         *)      case "$usethreads" in
11943                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11944                 esac
11945                 d_crypt_r=undef
11946                 crypt_r_proto=0
11947                 ;;
11948         esac
11949         ;;
11950 *)      crypt_r_proto=0
11951         ;;
11952 esac
11953
11954 : get csh whereabouts
11955 case "$csh" in
11956 'csh') val="$undef" ;;
11957 *) val="$define" ;;
11958 esac
11959 set d_csh
11960 eval $setvar
11961 : Respect a hint or command line value for full_csh.
11962 case "$full_csh" in
11963 '') full_csh=$csh ;;
11964 esac
11965
11966 : see if ctermid exists
11967 set ctermid d_ctermid
11968 eval $inlibc
11969
11970 : see if ctermid_r exists
11971 set ctermid_r d_ctermid_r
11972 eval $inlibc
11973 case "$d_ctermid_r" in
11974 "$define")
11975         hdrs="$i_systypes sys/types.h define stdio.h "
11976         case "$d_ctermid_r_proto:$usethreads" in
11977         ":define")      d_ctermid_r_proto=define
11978                 set d_ctermid_r_proto ctermid_r $hdrs
11979                 eval $hasproto ;;
11980         *)      ;;
11981         esac
11982         case "$d_ctermid_r_proto" in
11983         define)
11984         case "$ctermid_r_proto" in
11985         ''|0) try='char* ctermid_r(char*);'
11986         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11987         esac
11988         case "$ctermid_r_proto" in
11989         ''|0)   d_ctermid_r=undef
11990                 ctermid_r_proto=0
11991                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11992         * )     case "$ctermid_r_proto" in
11993                 REENTRANT_PROTO*) ;;
11994                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11995                 esac
11996                 echo "Prototype: $try" ;;
11997         esac
11998         ;;
11999         *)      case "$usethreads" in
12000                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12001                 esac
12002                 d_ctermid_r=undef
12003                 ctermid_r_proto=0
12004                 ;;
12005         esac
12006         ;;
12007 *)      ctermid_r_proto=0
12008         ;;
12009 esac
12010
12011 : see if ctime_r exists
12012 set ctime_r d_ctime_r
12013 eval $inlibc
12014 case "$d_ctime_r" in
12015 "$define")
12016         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12017         case "$d_ctime_r_proto:$usethreads" in
12018         ":define")      d_ctime_r_proto=define
12019                 set d_ctime_r_proto ctime_r $hdrs
12020                 eval $hasproto ;;
12021         *)      ;;
12022         esac
12023         case "$d_ctime_r_proto" in
12024         define)
12025         case "$ctime_r_proto" in
12026         ''|0) try='char* ctime_r(const time_t*, char*);'
12027         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12028         esac
12029         case "$ctime_r_proto" in
12030         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12031         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12032         esac
12033         case "$ctime_r_proto" in
12034         ''|0) try='int ctime_r(const time_t*, char*);'
12035         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12036         esac
12037         case "$ctime_r_proto" in
12038         ''|0) try='int ctime_r(const time_t*, char*, int);'
12039         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12040         esac
12041         case "$ctime_r_proto" in
12042         ''|0)   d_ctime_r=undef
12043                 ctime_r_proto=0
12044                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12045         * )     case "$ctime_r_proto" in
12046                 REENTRANT_PROTO*) ;;
12047                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12048                 esac
12049                 echo "Prototype: $try" ;;
12050         esac
12051         ;;
12052         *)      case "$usethreads" in
12053                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12054                 esac
12055                 d_ctime_r=undef
12056                 ctime_r_proto=0
12057                 ;;
12058         esac
12059         ;;
12060 *)      ctime_r_proto=0
12061         ;;
12062 esac
12063
12064 : see if cuserid exists
12065 set cuserid d_cuserid
12066 eval $inlibc
12067
12068 : see if this is a limits.h system
12069 set limits.h i_limits
12070 eval $inhdr
12071
12072 : See if number of significant digits in a double precision number is known
12073 echo " "
12074 $cat >dbl_dig.c <<EOM
12075 #$i_limits I_LIMITS
12076 #$i_float I_FLOAT
12077 #ifdef I_LIMITS
12078 #include <limits.h>
12079 #endif
12080 #ifdef I_FLOAT
12081 #include <float.h>
12082 #endif
12083 #ifdef DBL_DIG
12084 printf("Contains DBL_DIG");
12085 #endif
12086 EOM
12087 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
12088 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
12089         echo "DBL_DIG found." >&4
12090         val="$define"
12091 else
12092         echo "DBL_DIG NOT found." >&4
12093         val="$undef"
12094 fi
12095 $rm -f dbl_dig.?
12096 set d_dbl_dig
12097 eval $setvar
12098
12099 : see if dbm.h is available
12100 : see if dbmclose exists
12101 set dbmclose d_dbmclose
12102 eval $inlibc
12103
12104 case "$d_dbmclose" in
12105 $define)
12106         set dbm.h i_dbm
12107         eval $inhdr
12108         case "$i_dbm" in
12109         $define)
12110                 val="$undef"
12111                 set i_rpcsvcdbm
12112                 eval $setvar
12113                 ;;
12114         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12115                 eval $inhdr
12116                 ;;
12117         esac
12118         ;;
12119 *)      echo "We won't be including <dbm.h>"
12120         val="$undef"
12121         set i_dbm
12122         eval $setvar
12123         val="$undef"
12124         set i_rpcsvcdbm
12125         eval $setvar
12126         ;;
12127 esac
12128
12129 : see if prototype for dbminit is available
12130 echo " "
12131 set d_dbminitproto dbminit $i_dbm dbm.h
12132 eval $hasproto
12133
12134 : see if difftime exists
12135 set difftime d_difftime
12136 eval $inlibc
12137
12138 : see if this is a dirent system
12139 echo " "
12140 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12141         val="$define"
12142         echo "<dirent.h> found." >&4
12143 else
12144         val="$undef"
12145         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12146                 echo "<sys/dir.h> found." >&4
12147                 echo " "
12148         else
12149                 xinc=`./findhdr sys/ndir.h`
12150         fi
12151         echo "<dirent.h> NOT found." >&4
12152 fi
12153 set i_dirent
12154 eval $setvar
12155
12156 : Look for type of directory structure.
12157 echo " "
12158 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12159
12160 case "$direntrytype" in
12161 ''|' ')
12162         case "$i_dirent" in
12163         $define) guess1='struct dirent' ;;
12164         *) guess1='struct direct'  ;;
12165         esac
12166         ;;
12167 *)      guess1="$direntrytype"
12168         ;;
12169 esac
12170
12171 case "$guess1" in
12172 'struct dirent') guess2='struct direct' ;;
12173 *) guess2='struct dirent' ;;
12174 esac
12175
12176 if $contains "$guess1" try.c >/dev/null 2>&1; then
12177         direntrytype="$guess1"
12178         echo "Your directory entries are $direntrytype." >&4
12179 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12180         direntrytype="$guess2"
12181         echo "Your directory entries seem to be $direntrytype." >&4
12182 else
12183         echo "I don't recognize your system's directory entries." >&4
12184         rp="What type is used for directory entries on this system?"
12185         dflt="$guess1"
12186         . ./myread
12187         direntrytype="$ans"
12188 fi
12189 $rm_try
12190
12191 : see if the directory entry stores field length
12192 echo " "
12193 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12194 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12195         echo "Good, your directory entry keeps length information in d_namlen." >&4
12196         val="$define"
12197 else
12198         echo "Your directory entry does not know about the d_namlen field." >&4
12199         val="$undef"
12200 fi
12201 set d_dirnamlen
12202 eval $setvar
12203 $rm_try
12204
12205 : Look for DIR.dd_fd
12206 case "$i_dirent" in
12207 "$define")
12208     echo "Checking to see if DIR has a dd_fd member variable" >&4
12209     $cat >try.c <<EOCP
12210 #$i_stdlib I_STDLIB
12211 #ifdef I_STDLIB
12212 #include <stdlib.h>
12213 #endif
12214 #include <dirent.h>
12215
12216 int main() {
12217     DIR dir;
12218     dir.dd_fd = 1;
12219     return 0;
12220 }
12221 EOCP
12222     val=$undef
12223     set try
12224     if eval $compile; then
12225         echo "Yes, it does."
12226         val="$define"
12227     else
12228         echo "No, it does not."
12229         val="$undef"
12230     fi
12231     ;;
12232 *)
12233     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12234     val="$undef"
12235     ;;
12236 esac
12237 set d_dir_dd_fd
12238 eval $setvar
12239 $rm_try
12240
12241 : see if this is an sysdir system
12242 set sys/dir.h i_sysdir
12243 eval $inhdr
12244
12245 : see if this is an sysndir system
12246 set sys/ndir.h i_sysndir
12247 eval $inhdr
12248
12249 : Look for dirfd
12250 echo " "
12251 $cat >dirfd.c <<EOM
12252 #include <stdio.h>
12253 #$i_stdlib I_STDLIB
12254 #ifdef I_STDLIB
12255 #include <stdlib.h>
12256 #endif
12257 #$i_dirent I_DIRENT             /**/
12258 #$i_sysdir I_SYS_DIR            /**/
12259 #$i_sysndir I_SYS_NDIR          /**/
12260 #$i_systypes I_SYS_TYPES        /**/
12261 #if defined(I_SYS_TYPES)
12262 #include <sys/types.h>
12263 #endif
12264 #if defined(I_DIRENT)
12265 #include <dirent.h>
12266 #else
12267 #ifdef I_SYS_NDIR
12268 #include <sys/ndir.h>
12269 #else
12270 #ifdef I_SYS_DIR
12271 #ifdef hp9000s500
12272 #include <ndir.h>       /* may be wrong in the future */
12273 #else
12274 #include <sys/dir.h>
12275 #endif
12276 #endif
12277 #endif
12278 #endif
12279 int main() {
12280         DIR *dirp = opendir(".");
12281         if (dirfd(dirp) >= 0)
12282                 exit(0);
12283         else
12284                 exit(1);
12285 }
12286 EOM
12287 val=$undef
12288 set dirfd
12289 if eval $compile; then
12290         val="$define"
12291 fi
12292 case "$val" in
12293 $define)        echo "dirfd() found." >&4       ;;
12294 *)              echo "dirfd() NOT found." >&4   ;;
12295 esac
12296 set d_dirfd
12297 eval $setvar
12298 $rm -f dirfd*
12299
12300 : see if dladdr exists
12301 set dladdr d_dladdr
12302 eval $inlibc
12303
12304 : see if dlerror exists
12305 xxx_runnm="$runnm"
12306 runnm=false
12307 set dlerror d_dlerror
12308 eval $inlibc
12309 runnm="$xxx_runnm"
12310
12311 : see if dlfcn is available
12312 set dlfcn.h i_dlfcn
12313 eval $inhdr
12314
12315 : Check what extension to use for shared libs
12316 case "$usedl" in
12317 $define|y|true)
12318         $cat << EOM
12319
12320 On a few systems, the dynamically loaded modules that perl generates and uses
12321 will need a different extension than shared libs. The default will probably
12322 be appropriate.
12323
12324 EOM
12325         case "$dlext" in
12326         '')     dflt="$so" ;;
12327         *)      dflt="$dlext" ;;
12328         esac
12329         rp='What is the extension of dynamically loaded modules'
12330         . ./myread
12331         dlext="$ans"
12332         ;;
12333 *)
12334         dlext="none"
12335         ;;
12336 esac
12337
12338 : Check if dlsym need a leading underscore
12339 echo " "
12340 val="$undef"
12341
12342 case "$dlsrc" in
12343 dl_dlopen.xs)
12344         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12345         $cat >dyna.c <<'EOM'
12346 fred () { }
12347 EOM
12348
12349 $cat >fred.c<<EOM
12350
12351 #include <stdio.h>
12352 #$i_stdlib I_STDLIB
12353 #ifdef I_STDLIB
12354 #include <stdlib.h>
12355 #endif
12356 #$i_dlfcn I_DLFCN
12357 #ifdef I_DLFCN
12358 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12359 #else
12360 #include <sys/types.h>
12361 #include <nlist.h>
12362 #include <link.h>
12363 #endif
12364
12365 extern int fred() ;
12366
12367 int main()
12368 {
12369     void * handle ;
12370     void * symbol ;
12371 #ifndef RTLD_LAZY
12372     int mode = 1 ;
12373 #else
12374     int mode = RTLD_LAZY ;
12375 #endif
12376     handle = dlopen("./dyna.$dlext", mode) ;
12377     if (handle == NULL) {
12378         printf ("1\n") ;
12379         fflush (stdout) ;
12380         exit(0);
12381     }
12382     symbol = dlsym(handle, "fred") ;
12383     if (symbol == NULL) {
12384         /* try putting a leading underscore */
12385         symbol = dlsym(handle, "_fred") ;
12386         if (symbol == NULL) {
12387             printf ("2\n") ;
12388             fflush (stdout) ;
12389             exit(0);
12390         }
12391         printf ("3\n") ;
12392     }
12393     else
12394         printf ("4\n") ;
12395     fflush (stdout) ;
12396     exit(0);
12397 }
12398 EOM
12399         : Call the object file tmp-dyna.o in case dlext=o.
12400         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12401                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12402                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12403                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12404                 xxx=`$run ./fred`
12405                 case $xxx in
12406                 1)      echo "Test program failed using dlopen." >&4
12407                         echo "Perhaps you should not use dynamic loading." >&4;;
12408                 2)      echo "Test program failed using dlsym." >&4
12409                         echo "Perhaps you should not use dynamic loading." >&4;;
12410                 3)      echo "dlsym needs a leading underscore" >&4
12411                         val="$define" ;;
12412                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12413                 esac
12414         else
12415                 echo "I can't compile and run the test program." >&4
12416                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12417         fi
12418         ;;
12419 esac
12420
12421 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12422
12423 set d_dlsymun
12424 eval $setvar
12425
12426 : see if drand48_r exists
12427 set drand48_r d_drand48_r
12428 eval $inlibc
12429 case "$d_drand48_r" in
12430 "$define")
12431         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12432         case "$d_drand48_r_proto:$usethreads" in
12433         ":define")      d_drand48_r_proto=define
12434                 set d_drand48_r_proto drand48_r $hdrs
12435                 eval $hasproto ;;
12436         *)      ;;
12437         esac
12438         case "$d_drand48_r_proto" in
12439         define)
12440         case "$drand48_r_proto" in
12441         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12442         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12443         esac
12444         case "$drand48_r_proto" in
12445         ''|0)   d_drand48_r=undef
12446                 drand48_r_proto=0
12447                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12448         * )     case "$drand48_r_proto" in
12449                 REENTRANT_PROTO*) ;;
12450                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12451                 esac
12452                 echo "Prototype: $try" ;;
12453         esac
12454         ;;
12455         *)      case "$usethreads" in
12456                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12457                 esac
12458                 d_drand48_r=undef
12459                 drand48_r_proto=0
12460                 ;;
12461         esac
12462         ;;
12463 *)      drand48_r_proto=0
12464         ;;
12465 esac
12466
12467 : see if prototype for drand48 is available
12468 echo " "
12469 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12470 eval $hasproto
12471
12472 : see if dup2 exists
12473 set dup2 d_dup2
12474 eval $inlibc
12475
12476 : see if eaccess exists
12477 set eaccess d_eaccess
12478 eval $inlibc
12479
12480 : see if endgrent exists
12481 set endgrent d_endgrent
12482 eval $inlibc
12483
12484 : see if this is an grp system
12485 set grp.h i_grp
12486 eval $inhdr
12487
12488 case "$i_grp" in
12489 $define)
12490         xxx=`./findhdr grp.h`
12491         $cppstdin $cppflags $cppminus < $xxx >$$.h
12492
12493         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12494                 val="$define"
12495         else
12496                 val="$undef"
12497         fi
12498         set d_grpasswd
12499         eval $setvar
12500
12501         $rm -f $$.h
12502         ;;
12503 *)
12504         val="$undef";
12505         set d_grpasswd; eval $setvar
12506         ;;
12507 esac
12508
12509 : see if endgrent_r exists
12510 set endgrent_r d_endgrent_r
12511 eval $inlibc
12512 case "$d_endgrent_r" in
12513 "$define")
12514         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12515         case "$d_endgrent_r_proto:$usethreads" in
12516         ":define")      d_endgrent_r_proto=define
12517                 set d_endgrent_r_proto endgrent_r $hdrs
12518                 eval $hasproto ;;
12519         *)      ;;
12520         esac
12521         case "$d_endgrent_r_proto" in
12522         define)
12523         case "$endgrent_r_proto" in
12524         ''|0) try='int endgrent_r(FILE**);'
12525         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12526         esac
12527         case "$endgrent_r_proto" in
12528         ''|0) try='void endgrent_r(FILE**);'
12529         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12530         esac
12531         case "$endgrent_r_proto" in
12532         ''|0)   d_endgrent_r=undef
12533                 endgrent_r_proto=0
12534                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12535         * )     case "$endgrent_r_proto" in
12536                 REENTRANT_PROTO*) ;;
12537                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12538                 esac
12539                 echo "Prototype: $try" ;;
12540         esac
12541         ;;
12542         *)      case "$usethreads" in
12543                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12544                 esac
12545                 d_endgrent_r=undef
12546                 endgrent_r_proto=0
12547                 ;;
12548         esac
12549         ;;
12550 *)      endgrent_r_proto=0
12551         ;;
12552 esac
12553
12554 : see if endhostent exists
12555 set endhostent d_endhent
12556 eval $inlibc
12557
12558 : see if this is a netdb.h system
12559 set netdb.h i_netdb
12560 eval $inhdr
12561
12562 : see if endhostent_r exists
12563 set endhostent_r d_endhostent_r
12564 eval $inlibc
12565 case "$d_endhostent_r" in
12566 "$define")
12567         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12568         case "$d_endhostent_r_proto:$usethreads" in
12569         ":define")      d_endhostent_r_proto=define
12570                 set d_endhostent_r_proto endhostent_r $hdrs
12571                 eval $hasproto ;;
12572         *)      ;;
12573         esac
12574         case "$d_endhostent_r_proto" in
12575         define)
12576         case "$endhostent_r_proto" in
12577         ''|0) try='int endhostent_r(struct hostent_data*);'
12578         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12579         esac
12580         case "$endhostent_r_proto" in
12581         ''|0) try='void endhostent_r(struct hostent_data*);'
12582         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12583         esac
12584         case "$endhostent_r_proto" in
12585         ''|0)   d_endhostent_r=undef
12586                 endhostent_r_proto=0
12587                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12588         * )     case "$endhostent_r_proto" in
12589                 REENTRANT_PROTO*) ;;
12590                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12591                 esac
12592                 echo "Prototype: $try" ;;
12593         esac
12594         ;;
12595         *)      case "$usethreads" in
12596                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12597                 esac
12598                 d_endhostent_r=undef
12599                 endhostent_r_proto=0
12600                 ;;
12601         esac
12602         ;;
12603 *)      endhostent_r_proto=0
12604         ;;
12605 esac
12606
12607 : see if endnetent exists
12608 set endnetent d_endnent
12609 eval $inlibc
12610
12611 : see if endnetent_r exists
12612 set endnetent_r d_endnetent_r
12613 eval $inlibc
12614 case "$d_endnetent_r" in
12615 "$define")
12616         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12617         case "$d_endnetent_r_proto:$usethreads" in
12618         ":define")      d_endnetent_r_proto=define
12619                 set d_endnetent_r_proto endnetent_r $hdrs
12620                 eval $hasproto ;;
12621         *)      ;;
12622         esac
12623         case "$d_endnetent_r_proto" in
12624         define)
12625         case "$endnetent_r_proto" in
12626         ''|0) try='int endnetent_r(struct netent_data*);'
12627         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12628         esac
12629         case "$endnetent_r_proto" in
12630         ''|0) try='void endnetent_r(struct netent_data*);'
12631         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12632         esac
12633         case "$endnetent_r_proto" in
12634         ''|0)   d_endnetent_r=undef
12635                 endnetent_r_proto=0
12636                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12637         * )     case "$endnetent_r_proto" in
12638                 REENTRANT_PROTO*) ;;
12639                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12640                 esac
12641                 echo "Prototype: $try" ;;
12642         esac
12643         ;;
12644         *)      case "$usethreads" in
12645                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12646                 esac
12647                 d_endnetent_r=undef
12648                 endnetent_r_proto=0
12649                 ;;
12650         esac
12651         ;;
12652 *)      endnetent_r_proto=0
12653         ;;
12654 esac
12655
12656 : see if endprotoent exists
12657 set endprotoent d_endpent
12658 eval $inlibc
12659
12660 : see if endprotoent_r exists
12661 set endprotoent_r d_endprotoent_r
12662 eval $inlibc
12663 case "$d_endprotoent_r" in
12664 "$define")
12665         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12666         case "$d_endprotoent_r_proto:$usethreads" in
12667         ":define")      d_endprotoent_r_proto=define
12668                 set d_endprotoent_r_proto endprotoent_r $hdrs
12669                 eval $hasproto ;;
12670         *)      ;;
12671         esac
12672         case "$d_endprotoent_r_proto" in
12673         define)
12674         case "$endprotoent_r_proto" in
12675         ''|0) try='int endprotoent_r(struct protoent_data*);'
12676         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12677         esac
12678         case "$endprotoent_r_proto" in
12679         ''|0) try='void endprotoent_r(struct protoent_data*);'
12680         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12681         esac
12682         case "$endprotoent_r_proto" in
12683         ''|0)   d_endprotoent_r=undef
12684                 endprotoent_r_proto=0
12685                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12686         * )     case "$endprotoent_r_proto" in
12687                 REENTRANT_PROTO*) ;;
12688                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12689                 esac
12690                 echo "Prototype: $try" ;;
12691         esac
12692         ;;
12693         *)      case "$usethreads" in
12694                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12695                 esac
12696                 d_endprotoent_r=undef
12697                 endprotoent_r_proto=0
12698                 ;;
12699         esac
12700         ;;
12701 *)      endprotoent_r_proto=0
12702         ;;
12703 esac
12704
12705 : see if endpwent exists
12706 set endpwent d_endpwent
12707 eval $inlibc
12708
12709 : see if this is a pwd.h system
12710 set pwd.h i_pwd
12711 eval $inhdr
12712
12713 case "$i_pwd" in
12714 $define)
12715         xxx=`./findhdr pwd.h`
12716         $cppstdin $cppflags $cppminus < $xxx >$$.h
12717
12718         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12719                 val="$define"
12720         else
12721                 val="$undef"
12722         fi
12723         set d_pwquota
12724         eval $setvar
12725
12726         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12727                 val="$define"
12728         else
12729                 val="$undef"
12730         fi
12731         set d_pwage
12732         eval $setvar
12733
12734         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12735                 val="$define"
12736         else
12737                 val="$undef"
12738         fi
12739         set d_pwchange
12740         eval $setvar
12741
12742         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12743                 val="$define"
12744         else
12745                 val="$undef"
12746         fi
12747         set d_pwclass
12748         eval $setvar
12749
12750         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12751                 val="$define"
12752         else
12753                 val="$undef"
12754         fi
12755         set d_pwexpire
12756         eval $setvar
12757
12758         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12759                 val="$define"
12760         else
12761                 val="$undef"
12762         fi
12763         set d_pwcomment
12764         eval $setvar
12765
12766         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12767                 val="$define"
12768         else
12769                 val="$undef"
12770         fi
12771         set d_pwgecos
12772         eval $setvar
12773
12774         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12775                 val="$define"
12776         else
12777                 val="$undef"
12778         fi
12779         set d_pwpasswd
12780         eval $setvar
12781
12782         $rm -f $$.h
12783         ;;
12784 *)
12785         val="$undef";
12786         set d_pwquota; eval $setvar
12787         set d_pwage; eval $setvar
12788         set d_pwchange; eval $setvar
12789         set d_pwclass; eval $setvar
12790         set d_pwexpire; eval $setvar
12791         set d_pwcomment; eval $setvar
12792         set d_pwgecos; eval $setvar
12793         set d_pwpasswd; eval $setvar
12794         ;;
12795 esac
12796
12797 : see if endpwent_r exists
12798 set endpwent_r d_endpwent_r
12799 eval $inlibc
12800 case "$d_endpwent_r" in
12801 "$define")
12802         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12803         case "$d_endpwent_r_proto:$usethreads" in
12804         ":define")      d_endpwent_r_proto=define
12805                 set d_endpwent_r_proto endpwent_r $hdrs
12806                 eval $hasproto ;;
12807         *)      ;;
12808         esac
12809         case "$d_endpwent_r_proto" in
12810         define)
12811         case "$endpwent_r_proto" in
12812         ''|0) try='int endpwent_r(FILE**);'
12813         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12814         esac
12815         case "$endpwent_r_proto" in
12816         ''|0) try='void endpwent_r(FILE**);'
12817         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12818         esac
12819         case "$endpwent_r_proto" in
12820         ''|0)   d_endpwent_r=undef
12821                 endpwent_r_proto=0
12822                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12823         * )     case "$endpwent_r_proto" in
12824                 REENTRANT_PROTO*) ;;
12825                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12826                 esac
12827                 echo "Prototype: $try" ;;
12828         esac
12829         ;;
12830         *)      case "$usethreads" in
12831                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12832                 esac
12833                 d_endpwent_r=undef
12834                 endpwent_r_proto=0
12835                 ;;
12836         esac
12837         ;;
12838 *)      endpwent_r_proto=0
12839         ;;
12840 esac
12841
12842 : see if endservent exists
12843 set endservent d_endsent
12844 eval $inlibc
12845
12846 : see if endservent_r exists
12847 set endservent_r d_endservent_r
12848 eval $inlibc
12849 case "$d_endservent_r" in
12850 "$define")
12851         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12852         case "$d_endservent_r_proto:$usethreads" in
12853         ":define")      d_endservent_r_proto=define
12854                 set d_endservent_r_proto endservent_r $hdrs
12855                 eval $hasproto ;;
12856         *)      ;;
12857         esac
12858         case "$d_endservent_r_proto" in
12859         define)
12860         case "$endservent_r_proto" in
12861         ''|0) try='int endservent_r(struct servent_data*);'
12862         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12863         esac
12864         case "$endservent_r_proto" in
12865         ''|0) try='void endservent_r(struct servent_data*);'
12866         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12867         esac
12868         case "$endservent_r_proto" in
12869         ''|0)   d_endservent_r=undef
12870                 endservent_r_proto=0
12871                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12872         * )     case "$endservent_r_proto" in
12873                 REENTRANT_PROTO*) ;;
12874                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12875                 esac
12876                 echo "Prototype: $try" ;;
12877         esac
12878         ;;
12879         *)      case "$usethreads" in
12880                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12881                 esac
12882                 d_endservent_r=undef
12883                 endservent_r_proto=0
12884                 ;;
12885         esac
12886         ;;
12887 *)      endservent_r_proto=0
12888         ;;
12889 esac
12890
12891 : Locate the flags for 'open()'
12892 echo " "
12893 $cat >try.c <<EOCP
12894 #include <sys/types.h>
12895 #ifdef I_FCNTL
12896 #include <fcntl.h>
12897 #endif
12898 #ifdef I_SYS_FILE
12899 #include <sys/file.h>
12900 #endif
12901 #$i_stdlib I_STDLIB
12902 #ifdef I_STDLIB
12903 #include <stdlib.h>
12904 #endif
12905 int main() {
12906         if(O_RDONLY);
12907 #ifdef O_TRUNC
12908         exit(0);
12909 #else
12910         exit(1);
12911 #endif
12912 }
12913 EOCP
12914 : check sys/file.h first to get FREAD on Sun
12915 if $test `./findhdr sys/file.h` && \
12916                 set try -DI_SYS_FILE && eval $compile; then
12917         h_sysfile=true;
12918         echo "<sys/file.h> defines the O_* constants..." >&4
12919         if $run ./try; then
12920                 echo "and you have the 3 argument form of open()." >&4
12921                 val="$define"
12922         else
12923                 echo "but not the 3 argument form of open().  Oh, well." >&4
12924                 val="$undef"
12925         fi
12926 elif $test `./findhdr fcntl.h` && \
12927                 set try -DI_FCNTL && eval $compile; then
12928         h_fcntl=true;
12929         echo "<fcntl.h> defines the O_* constants..." >&4
12930         if $run ./try; then
12931                 echo "and you have the 3 argument form of open()." >&4
12932                 val="$define"
12933         else
12934                 echo "but not the 3 argument form of open().  Oh, well." >&4
12935                 val="$undef"
12936         fi
12937 else
12938         val="$undef"
12939         echo "I can't find the O_* constant definitions!  You got problems." >&4
12940 fi
12941 set d_open3
12942 eval $setvar
12943 $rm_try
12944
12945 : see if this is a sys/file.h system
12946 val=''
12947 set sys/file.h val
12948 eval $inhdr
12949
12950 : do we need to include sys/file.h ?
12951 case "$val" in
12952 "$define")
12953         echo " "
12954         if $h_sysfile; then
12955                 val="$define"
12956                 echo "We'll be including <sys/file.h>." >&4
12957         else
12958                 val="$undef"
12959                 echo "We won't be including <sys/file.h>." >&4
12960         fi
12961         ;;
12962 *)
12963         h_sysfile=false
12964         ;;
12965 esac
12966 set i_sysfile
12967 eval $setvar
12968
12969 : see if fcntl.h is there
12970 val=''
12971 set fcntl.h val
12972 eval $inhdr
12973
12974 : see if we can include fcntl.h
12975 case "$val" in
12976 "$define")
12977         echo " "
12978         if $h_fcntl; then
12979                 val="$define"
12980                 echo "We'll be including <fcntl.h>." >&4
12981         else
12982                 val="$undef"
12983                 if $h_sysfile; then
12984         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12985                 else
12986                         echo "We won't be including <fcntl.h>." >&4
12987                 fi
12988         fi
12989         ;;
12990 *)
12991         h_fcntl=false
12992         val="$undef"
12993         ;;
12994 esac
12995 set i_fcntl
12996 eval $setvar
12997
12998 : see if fork exists
12999 set fork d_fork
13000 eval $inlibc
13001
13002 : see if pipe exists
13003 set pipe d_pipe
13004 eval $inlibc
13005
13006 : check for non-blocking I/O stuff
13007 case "$h_sysfile" in
13008 true) echo "#include <sys/file.h>" > head.c;;
13009 *)
13010        case "$h_fcntl" in
13011        true) echo "#include <fcntl.h>" > head.c;;
13012        *) echo "#include <sys/fcntl.h>" > head.c;;
13013        esac
13014        ;;
13015 esac
13016 echo " "
13017 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13018 case "$o_nonblock" in
13019 '')
13020         $cat head.c > try.c
13021         $cat >>try.c <<EOCP
13022 #include <stdio.h>
13023 #$i_stdlib I_STDLIB
13024 #ifdef I_STDLIB
13025 #include <stdlib.h>
13026 #endif
13027 #$i_fcntl I_FCNTL
13028 #ifdef I_FCNTL
13029 #include <fcntl.h>
13030 #endif
13031 int main() {
13032 #ifdef O_NONBLOCK
13033         printf("O_NONBLOCK\n");
13034         exit(0);
13035 #endif
13036 #ifdef O_NDELAY
13037         printf("O_NDELAY\n");
13038         exit(0);
13039 #endif
13040 #ifdef FNDELAY
13041         printf("FNDELAY\n");
13042         exit(0);
13043 #endif
13044         exit(0);
13045 }
13046 EOCP
13047         set try
13048         if eval $compile_ok; then
13049                 o_nonblock=`$run ./try`
13050                 case "$o_nonblock" in
13051                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13052                 *) echo "Seems like we can use $o_nonblock.";;
13053                 esac
13054         else
13055                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13056         fi
13057         ;;
13058 *) echo "Using $hint value $o_nonblock.";;
13059 esac
13060 $rm_try
13061
13062 echo " "
13063 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13064 case "$eagain" in
13065 '')
13066         case "$d_fork:$d_pipe" in
13067         define:define)
13068         $cat head.c > try.c
13069         $cat >>try.c <<EOCP
13070 #include <errno.h>
13071 #include <sys/types.h>
13072 #include <signal.h>
13073 #include <stdio.h>
13074 #$i_stdlib I_STDLIB
13075 #ifdef I_STDLIB
13076 #include <stdlib.h>
13077 #endif
13078 #$i_fcntl I_FCNTL
13079 #ifdef I_FCNTL
13080 #include <fcntl.h>
13081 #endif
13082 #define MY_O_NONBLOCK $o_nonblock
13083 #ifndef errno  /* XXX need better Configure test */
13084 extern int errno;
13085 #endif
13086 #$i_unistd I_UNISTD
13087 #ifdef I_UNISTD
13088 #include <unistd.h>
13089 #endif
13090 #$i_string I_STRING
13091 #ifdef I_STRING
13092 #include <string.h>
13093 #else
13094 #include <strings.h>
13095 #endif
13096 $signal_t blech(int x) { exit(3); }
13097 EOCP
13098         $cat >> try.c <<'EOCP'
13099 int main()
13100 {
13101         int pd[2];
13102         int pu[2];
13103         char buf[1];
13104         char string[100];
13105         int ret;
13106
13107         ret = pipe(pd); /* Down: child -> parent */
13108         if (ret != 0)
13109                 exit(3);
13110         ret = pipe(pu); /* Up: parent -> child */
13111         if (ret != 0)
13112                 exit(3);
13113         if (0 != fork()) {
13114                 close(pd[1]);   /* Parent reads from pd[0] */
13115                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13116 #ifdef F_SETFL
13117                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13118                         exit(1);
13119 #else
13120                 exit(4);
13121 #endif
13122                 signal(SIGALRM, blech);
13123                 alarm(5);
13124                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13125                         exit(2);
13126                 sprintf(string, "%d\n", ret);
13127                 ret = write(2, string, strlen(string));
13128                 if (ret != strlen(string))
13129                         exit(3);
13130                 alarm(0);
13131 #ifdef EAGAIN
13132                 if (errno == EAGAIN) {
13133                         printf("EAGAIN\n");
13134                         goto ok;
13135                 }
13136 #endif
13137 #ifdef EWOULDBLOCK
13138                 if (errno == EWOULDBLOCK)
13139                         printf("EWOULDBLOCK\n");
13140 #endif
13141         ok:
13142                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13143                 if (ret != 1)
13144                         exit(3);
13145                 sleep(2);                               /* Give it time to close our pipe */
13146                 alarm(5);
13147                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13148                 alarm(0);
13149                 sprintf(string, "%d\n", ret);
13150                 ret = write(4, string, strlen(string));
13151                 if (ret != strlen(string))
13152                         exit(3);
13153                 exit(0);
13154         }
13155
13156         close(pd[0]);                   /* We write to pd[1] */
13157         close(pu[1]);                   /* We read from pu[0] */
13158         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13159         if (ret != 1)
13160                 exit(3);
13161         close(pd[1]);                   /* Pipe pd is now fully closed! */
13162         exit(0);                                /* Bye bye, thank you for playing! */
13163 }
13164 EOCP
13165         set try
13166         if eval $compile_ok; then
13167                 echo "$startsh" >mtry
13168                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13169                 chmod +x mtry
13170                 $run ./mtry >/dev/null 2>&1
13171                 case $? in
13172                 0) eagain=`$cat try.out`;;
13173                 1) echo "Could not perform non-blocking setting!";;
13174                 2) echo "I did a successful read() for something that was not there!";;
13175                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13176                 4) echo "Could not find F_SETFL!";;
13177                 *) echo "Something terribly wrong happened during testing.";;
13178                 esac
13179                 rd_nodata=`$cat try.ret`
13180                 echo "A read() system call with no data present returns $rd_nodata."
13181                 case "$rd_nodata" in
13182                 0|-1) ;;
13183                 *)
13184                         echo "(That's peculiar, fixing that to be -1.)"
13185                         rd_nodata=-1
13186                         ;;
13187                 esac
13188                 case "$eagain" in
13189                 '')
13190                         echo "Forcing errno EAGAIN on read() with no data available."
13191                         eagain=EAGAIN
13192                         ;;
13193                 *)
13194                         echo "Your read() sets errno to $eagain when no data is available."
13195                         ;;
13196                 esac
13197                 status=`$cat try.err`
13198                 case "$status" in
13199                 0) echo "And it correctly returns 0 to signal EOF.";;
13200                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13201                 *) echo "However, your read() returns '$status' on EOF??";;
13202                 esac
13203                 val="$define"
13204                 if test "$status" = "$rd_nodata"; then
13205                         echo "WARNING: you can't distinguish between EOF and no data!"
13206                         val="$undef"
13207                 fi
13208         else
13209                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13210                 eagain=EAGAIN
13211         fi
13212         ;;
13213         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13214                 eagain=EAGAIN
13215                 val="$define"
13216                 ;;
13217         esac
13218         set d_eofnblk
13219         eval $setvar
13220         ;;
13221 *)
13222         echo "Using $hint value $eagain."
13223         echo "Your read() returns $rd_nodata when no data is present."
13224         case "$d_eofnblk" in
13225         "$define") echo "And you can see EOF because read() returns 0.";;
13226         "$undef") echo "But you can't see EOF status from read() returned value.";;
13227         *)
13228                 echo "(Assuming you can't see EOF status from read anyway.)"
13229                 d_eofnblk=$undef
13230                 ;;
13231         esac
13232         ;;
13233 esac
13234 $rm_try head.c mtry
13235
13236 : see if _ptr and _cnt from stdio act std
13237 echo " "
13238
13239 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13240         echo "(Looks like you have stdio.h from BSD.)"
13241         case "$stdio_ptr" in
13242         '') stdio_ptr='((fp)->_p)'
13243                 ptr_lval=$define
13244                 ;;
13245         *)      ptr_lval=$d_stdio_ptr_lval;;
13246         esac
13247         case "$stdio_cnt" in
13248         '') stdio_cnt='((fp)->_r)'
13249                 cnt_lval=$define
13250                 ;;
13251         *)      cnt_lval=$d_stdio_cnt_lval;;
13252         esac
13253         case "$stdio_base" in
13254         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13255         esac
13256         case "$stdio_bufsiz" in
13257         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13258         esac
13259 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13260         echo "(Looks like you have stdio.h from Linux.)"
13261         case "$stdio_ptr" in
13262         '') stdio_ptr='((fp)->_IO_read_ptr)'
13263                 ptr_lval=$define
13264                 ;;
13265         *)      ptr_lval=$d_stdio_ptr_lval;;
13266         esac
13267         case "$stdio_cnt" in
13268         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13269                 cnt_lval=$undef
13270                 ;;
13271         *)      cnt_lval=$d_stdio_cnt_lval;;
13272         esac
13273         case "$stdio_base" in
13274         '') stdio_base='((fp)->_IO_read_base)';;
13275         esac
13276         case "$stdio_bufsiz" in
13277         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13278         esac
13279 else
13280         case "$stdio_ptr" in
13281         '') stdio_ptr='((fp)->_ptr)'
13282                 ptr_lval=$define
13283                 ;;
13284         *)      ptr_lval=$d_stdio_ptr_lval;;
13285         esac
13286         case "$stdio_cnt" in
13287         '') stdio_cnt='((fp)->_cnt)'
13288                 cnt_lval=$define
13289                 ;;
13290         *)      cnt_lval=$d_stdio_cnt_lval;;
13291         esac
13292         case "$stdio_base" in
13293         '') stdio_base='((fp)->_base)';;
13294         esac
13295         case "$stdio_bufsiz" in
13296         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13297         esac
13298 fi
13299
13300 : test whether _ptr and _cnt really work
13301 echo "Checking how std your stdio is..." >&4
13302 $cat >try.c <<EOP
13303 #include <stdio.h>
13304 #$i_stdlib I_STDLIB
13305 #ifdef I_STDLIB
13306 #include <stdlib.h>
13307 #endif
13308 #define FILE_ptr(fp)    $stdio_ptr
13309 #define FILE_cnt(fp)    $stdio_cnt
13310 int main() {
13311         FILE *fp = fopen("try.c", "r");
13312         char c = getc(fp);
13313         if (
13314                 18 <= FILE_cnt(fp) &&
13315                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13316         )
13317                 exit(0);
13318         exit(1);
13319 }
13320 EOP
13321 val="$undef"
13322 set try
13323 if eval $compile && $to try.c; then
13324         if $run ./try; then
13325                 echo "Your stdio acts pretty std."
13326                 val="$define"
13327         else
13328                 echo "Your stdio isn't very std."
13329         fi
13330 else
13331         echo "Your stdio doesn't appear very std."
13332 fi
13333 $rm_try
13334
13335 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13336 # direct buffer manipulation no longer works.  The Configure tests
13337 # should be changed to correctly detect this, but until then,
13338 # the following check should at least let perl compile and run.
13339 # (This quick fix should be updated before 5.8.1.)
13340 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13341 # A. Dougherty, June 3, 2002.
13342 case "$d_gnulibc" in
13343 $define)
13344         case "$gnulibc_version" in
13345         2.[01]*)  ;;
13346         2.2) ;;
13347         2.2.[0-9]) ;;
13348         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13349                 val="$undef"
13350                 ;;
13351         esac
13352         ;;
13353 esac
13354 set d_stdstdio
13355 eval $setvar
13356
13357 : Can _ptr be used as an lvalue?
13358 case "$d_stdstdio$ptr_lval" in
13359 $define$define) val=$define ;;
13360 *) val=$undef ;;
13361 esac
13362 set d_stdio_ptr_lval
13363 eval $setvar
13364
13365 : Can _cnt be used as an lvalue?
13366 case "$d_stdstdio$cnt_lval" in
13367 $define$define) val=$define ;;
13368 *) val=$undef ;;
13369 esac
13370 set d_stdio_cnt_lval
13371 eval $setvar
13372
13373
13374 : test whether setting _ptr sets _cnt as a side effect
13375 d_stdio_ptr_lval_sets_cnt="$undef"
13376 d_stdio_ptr_lval_nochange_cnt="$undef"
13377 case "$d_stdio_ptr_lval$d_stdstdio" in
13378 $define$define)
13379         echo "Checking to see what happens if we set the stdio ptr..." >&4
13380 $cat >try.c <<EOP
13381 #include <stdio.h>
13382 /* Can we scream? */
13383 /* Eat dust sed :-) */
13384 /* In the buffer space, no one can hear you scream. */
13385 #$i_stdlib I_STDLIB
13386 #ifdef I_STDLIB
13387 #include <stdlib.h>
13388 #endif
13389 #define FILE_ptr(fp)    $stdio_ptr
13390 #define FILE_cnt(fp)    $stdio_cnt
13391 #include <sys/types.h>
13392 int main() {
13393         FILE *fp = fopen("try.c", "r");
13394         int c;
13395         char *ptr;
13396         size_t cnt;
13397         if (!fp) {
13398             puts("Fail even to read");
13399             exit(1);
13400         }
13401         c = getc(fp); /* Read away the first # */
13402         if (c == EOF) {
13403             puts("Fail even to read");
13404             exit(1);
13405         }
13406         if (!(
13407                 18 <= FILE_cnt(fp) &&
13408                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13409         )) {
13410                 puts("Fail even to read");
13411                 exit (1);
13412         }
13413         ptr = (char*) FILE_ptr(fp);
13414         cnt = (size_t)FILE_cnt(fp);
13415
13416         FILE_ptr(fp) += 42;
13417
13418         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13419                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13420                 exit (1);
13421         }
13422         if (FILE_cnt(fp) <= 20) {
13423                 printf ("Fail (<20 chars to test)");
13424                 exit (1);
13425         }
13426         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13427                 puts("Fail compare");
13428                 exit (1);
13429         }
13430         if (cnt == FILE_cnt(fp)) {
13431                 puts("Pass_unchanged");
13432                 exit (0);
13433         }
13434         if (FILE_cnt(fp) == (cnt - 42)) {
13435                 puts("Pass_changed");
13436                 exit (0);
13437         }
13438         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13439         return 1;
13440
13441 }
13442 EOP
13443         set try
13444         if eval $compile && $to try.c; then
13445                 case `$run ./try` in
13446                 Pass_changed)
13447                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13448                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13449                 Pass_unchanged)
13450                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13451                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13452                 Fail*)
13453                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13454                 *)
13455                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13456         esac
13457         else
13458                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13459         fi
13460         $rm_try
13461         ;;
13462 esac
13463
13464 : see if _base is also standard
13465 val="$undef"
13466 case "$d_stdstdio" in
13467 $define)
13468         $cat >try.c <<EOP
13469 #include <stdio.h>
13470 #$i_stdlib I_STDLIB
13471 #ifdef I_STDLIB
13472 #include <stdlib.h>
13473 #endif
13474 #define FILE_base(fp)   $stdio_base
13475 #define FILE_bufsiz(fp) $stdio_bufsiz
13476 int main() {
13477         FILE *fp = fopen("try.c", "r");
13478         char c = getc(fp);
13479         if (
13480                 19 <= FILE_bufsiz(fp) &&
13481                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13482         )
13483                 exit(0);
13484         exit(1);
13485 }
13486 EOP
13487         set try
13488         if eval $compile && $to try.c; then
13489                 if $run ./try; then
13490                         echo "And its _base field acts std."
13491                         val="$define"
13492                 else
13493                         echo "But its _base field isn't std."
13494                 fi
13495         else
13496                 echo "However, it seems to be lacking the _base field."
13497         fi
13498         $rm_try
13499         ;;
13500 esac
13501 set d_stdiobase
13502 eval $setvar
13503
13504 : see if fast_stdio exists
13505 val="$undef"
13506 case "$d_stdstdio:$d_stdio_ptr_lval" in
13507 "$define:$define")
13508         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13509         *$define*)
13510                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13511                 val="$define"
13512                 ;;
13513         esac
13514         ;;
13515 esac
13516 set d_faststdio
13517 eval $setvar
13518
13519
13520
13521 : see if fchdir exists
13522 set fchdir d_fchdir
13523 eval $inlibc
13524
13525 : see if fchmod exists
13526 set fchmod d_fchmod
13527 eval $inlibc
13528
13529 : see if fchown exists
13530 set fchown d_fchown
13531 eval $inlibc
13532
13533 : see if this is an fcntl system
13534 set fcntl d_fcntl
13535 eval $inlibc
13536
13537 : See if fcntl-based locking works.
13538 echo " "
13539 $cat >try.c <<EOCP
13540 #$i_stdlib I_STDLIB
13541 #ifdef I_STDLIB
13542 #include <stdlib.h>
13543 #endif
13544 #include <unistd.h>
13545 #include <fcntl.h>
13546 #include <signal.h>
13547 $signal_t blech(int x) { exit(3); }
13548 int main() {
13549 #if defined(F_SETLK) && defined(F_SETLKW)
13550      struct flock flock;
13551      int retval, fd;
13552      fd = open("try.c", O_RDONLY);
13553      flock.l_type = F_RDLCK;
13554      flock.l_whence = SEEK_SET;
13555      flock.l_start = flock.l_len = 0;
13556      signal(SIGALRM, blech);
13557      alarm(10);
13558      retval = fcntl(fd, F_SETLK, &flock);
13559      close(fd);
13560      (retval < 0 ? exit(2) : exit(0));
13561 #else
13562      exit(2);
13563 #endif
13564 }
13565 EOCP
13566 echo "Checking if fcntl-based file locking works... "
13567 case "$d_fcntl" in
13568 "$define")
13569         set try
13570         if eval $compile_ok; then
13571                 if $run ./try; then
13572                         echo "Yes, it seems to work."
13573                         val="$define"
13574                 else
13575                         echo "Nope, it didn't work."
13576                         val="$undef"
13577                         case "$?" in
13578                         3) $cat >&4 <<EOM
13579 ***
13580 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13581 *** This is (almost) impossible.
13582 *** If your NFS lock daemons are not feeling well, something like
13583 *** this may happen, please investigate.  Cannot continue, aborting.
13584 ***
13585 EOM
13586                                 exit 1
13587                                 ;;
13588                         esac
13589                 fi
13590         else
13591                 echo "I'm unable to compile the test program, so I'll assume not."
13592                 val="$undef"
13593         fi
13594         ;;
13595 *) val="$undef";
13596         echo "Nope, since you don't even have fcntl()."
13597         ;;
13598 esac
13599 set d_fcntl_can_lock
13600 eval $setvar
13601 $rm_try
13602
13603 : check for fd_set items
13604 $cat <<EOM
13605
13606 Checking to see how well your C compiler handles fd_set and friends ...
13607 EOM
13608 $cat >try.c <<EOCP
13609 #$i_stdlib I_STDLIB
13610 #ifdef I_STDLIB
13611 #include <stdlib.h>
13612 #endif
13613 #$i_systime I_SYS_TIME
13614 #$i_sysselct I_SYS_SELECT
13615 #$d_socket HAS_SOCKET
13616 #include <sys/types.h>
13617 #ifdef HAS_SOCKET
13618 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13619 #endif
13620 #ifdef I_SYS_TIME
13621 #include <sys/time.h>
13622 #endif
13623 #ifdef I_SYS_SELECT
13624 #include <sys/select.h>
13625 #endif
13626 int main() {
13627         fd_set fds;
13628
13629 #ifdef TRYBITS
13630         if(fds.fds_bits);
13631 #endif
13632
13633 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13634         exit(0);
13635 #else
13636         exit(1);
13637 #endif
13638 }
13639 EOCP
13640 set try -DTRYBITS
13641 if eval $compile; then
13642         d_fds_bits="$define"
13643         d_fd_set="$define"
13644         echo "Well, your system knows about the normal fd_set typedef..." >&4
13645         if $run ./try; then
13646                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13647                 d_fd_macros="$define"
13648         else
13649                 $cat >&4 <<'EOM'
13650 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13651 EOM
13652                 d_fd_macros="$undef"
13653         fi
13654 else
13655         $cat <<'EOM'
13656 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13657 EOM
13658         set try
13659         if eval $compile; then
13660                 d_fds_bits="$undef"
13661                 d_fd_set="$define"
13662                 echo "Well, your system has some sort of fd_set available..." >&4
13663                 if $run ./try; then
13664                         echo "and you have the normal fd_set macros." >&4
13665                         d_fd_macros="$define"
13666                 else
13667                         $cat <<'EOM'
13668 but not the normal fd_set macros!  Gross!  More work for me...
13669 EOM
13670                         d_fd_macros="$undef"
13671                 fi
13672         else
13673         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13674                 d_fd_set="$undef"
13675                 d_fds_bits="$undef"
13676                 d_fd_macros="$undef"
13677         fi
13678 fi
13679 $rm_try
13680
13681 : see if fegetround exists
13682 set fegetround d_fegetround
13683 eval $inlibc
13684
13685 : see if fgetpos exists
13686 set fgetpos d_fgetpos
13687 eval $inlibc
13688
13689 : see if finite exists
13690 set finite d_finite
13691 eval $inlibc
13692
13693 : see if finitel exists
13694 set finitel d_finitel
13695 eval $inlibc
13696
13697 : see if flock exists
13698 set flock d_flock
13699 eval $inlibc
13700
13701 : see if prototype for flock is available
13702 echo " "
13703 set d_flockproto flock $i_sysfile sys/file.h
13704 eval $hasproto
13705
13706 : see if fp_class exists
13707 set fp_class d_fp_class
13708 eval $inlibc
13709
13710 : see if this is a math.h system
13711 set math.h i_math
13712 eval $inhdr
13713
13714 : check for fpclassify
13715 echo "Checking to see if you have fpclassify..." >&4
13716 $cat >try.c <<EOCP
13717 #$i_math I_MATH
13718 #ifdef I_MATH
13719 #include <math.h>
13720 #endif
13721 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
13722 EOCP
13723 set try
13724 if eval $compile; then
13725         val="$define"
13726         echo "You have fpclassify."
13727 else
13728         val="$undef"
13729         echo "You do not have fpclassify."
13730 fi
13731 $rm_try
13732 set d_fpclassify
13733 eval $setvar
13734
13735 : see if fp_classify exists
13736 set fp_classify d_fp_classify
13737 eval $inlibc
13738
13739 : see if fp_classl exists
13740 set fp_classl d_fp_classl
13741 eval $inlibc
13742
13743 : see if pathconf exists
13744 set pathconf d_pathconf
13745 eval $inlibc
13746
13747 : see if fpathconf exists
13748 set fpathconf d_fpathconf
13749 eval $inlibc
13750
13751 : see if fpclass exists
13752 set fpclass d_fpclass
13753 eval $inlibc
13754
13755 : see if fpclassl exists
13756 set fpclassl d_fpclassl
13757 eval $inlibc
13758
13759 : see if fpgetround exists
13760 set fpgetround d_fpgetround
13761 eval $inlibc
13762
13763 : check for fpos64_t
13764 echo " "
13765 echo "Checking to see if you have fpos64_t..." >&4
13766 $cat >try.c <<EOCP
13767 #include <stdio.h>
13768 int main() { fpos64_t x = 7; }
13769 EOCP
13770 set try
13771 if eval $compile; then
13772         val="$define"
13773         echo "You have fpos64_t."
13774 else
13775         val="$undef"
13776         echo "You do not have fpos64_t."
13777         case "$fpossize" in
13778         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13779         esac
13780 fi
13781 $rm_try
13782 set d_fpos64_t
13783 eval $setvar
13784
13785 : see if frexpl exists
13786 set frexpl d_frexpl
13787 eval $inlibc
13788
13789 : see if this is a sys/param system
13790 set sys/param.h i_sysparam
13791 eval $inhdr
13792
13793 : see if this is a sys/mount.h system
13794 set sys/mount.h i_sysmount
13795 eval $inhdr
13796
13797 : Check for fs_data_s
13798 echo " "
13799 echo "Checking to see if your system supports struct fs_data..." >&4
13800 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13801 eval $hasstruct
13802 case "$d_fs_data_s" in
13803 "$define")      echo "Yes, it does."   ;;
13804 *)              echo "No, it doesn't." ;;
13805 esac
13806
13807 : see if fseeko exists
13808 set fseeko d_fseeko
13809 eval $inlibc
13810 case "$longsize" in
13811 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13812 esac
13813
13814 : see if fsetpos exists
13815 set fsetpos d_fsetpos
13816 eval $inlibc
13817
13818 : see if fstatfs exists
13819 set fstatfs d_fstatfs
13820 eval $inlibc
13821
13822 : see if statvfs exists
13823 set statvfs d_statvfs
13824 eval $inlibc
13825
13826 : see if fstatvfs exists
13827 set fstatvfs d_fstatvfs
13828 eval $inlibc
13829
13830
13831 : see if fsync exists
13832 set fsync d_fsync
13833 eval $inlibc
13834
13835 : see if ftello exists
13836 set ftello d_ftello
13837 eval $inlibc
13838 case "$longsize" in
13839 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13840 esac
13841
13842 : check for a working futimes
13843 d_futimes="$undef"
13844 echo " "
13845 echo "Checking if you have a working futimes()" >&4
13846 $cat >try.c <<EOCP
13847 #include <stdio.h>
13848 #include <sys/time.h>
13849 #include <errno.h>
13850 #include <fcntl.h>
13851
13852 int main ()
13853 {
13854     int fd, rv;
13855     fd = open ("try.c", O_RDWR);
13856     if (-1 == fd) exit (1);
13857     rv = futimes (fd, NULL);
13858     exit (rv == -1 ? errno : 0);
13859 }
13860 EOCP
13861 set try
13862 if eval $compile; then
13863     `$run ./try`
13864     rc=$?
13865     case "$rc" in
13866         0)  echo "Yes, you have" >&4
13867             d_futimes="$define"
13868             ;;
13869         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13870             ;;
13871     esac
13872 else
13873     echo "No, it does not (probably harmless)" >&4
13874 fi
13875 $rm_try
13876
13877 : see if ndbm.h is available
13878 set ndbm.h i_ndbm
13879 eval $inhdr
13880 : Compatibility location for RedHat 7.1
13881 set gdbm/ndbm.h i_gdbmndbm
13882 eval $inhdr
13883 : Compatibility location for Debian 4.0
13884 set gdbm-ndbm.h i_gdbm_ndbm
13885 eval $inhdr
13886
13887 val="$undef"
13888 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13889         : see if dbm_open exists
13890         set dbm_open d_dbm_open
13891         eval $inlibc
13892         case "$d_dbm_open" in
13893         $undef)
13894                 i_ndbm="$undef"
13895                 i_gdbmndbm="$undef"
13896                 i_gdbm_ndbm="$undef"
13897                 echo "We won't be including <ndbm.h>"
13898                 val="$undef"
13899                 ;;
13900         *) val="$define"
13901            ;;
13902         esac
13903 fi
13904 set d_ndbm
13905 eval $setvar
13906
13907 ndbm_hdr_protochk='name=$1; hdr=$2;
13908 eval "ihdr=\$""i_$name";
13909 val="$undef";
13910 if $test "$ihdr" = "$define"; then
13911         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13912         case "$d_cplusplus" in
13913         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13914         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13915         esac;
13916         case "$val" in
13917         $define) $echo "Your <$hdr> seems to have prototypes";;
13918         *) $echo "Your <$hdr> does not seem to have prototypes";;
13919         esac;
13920 fi;
13921 set "d_${name}_h_uses_prototypes";
13922 eval $setvar'
13923
13924 set ndbm ndbm.h
13925 eval $ndbm_hdr_protochk
13926 set gdbmndbm gdbm/ndbm.h
13927 eval $ndbm_hdr_protochk
13928 set gdbm_ndbm gdbm-ndbm.h
13929 eval $ndbm_hdr_protochk
13930
13931 : see if getaddrinfo exists
13932 set getaddrinfo d_getaddrinfo
13933 eval $inlibc
13934
13935 : see if getcwd exists
13936 set getcwd d_getcwd
13937 eval $inlibc
13938
13939 : see if getespwnam exists
13940 set getespwnam d_getespwnam
13941 eval $inlibc
13942
13943 : see if getfsstat exists
13944 set getfsstat d_getfsstat
13945 eval $inlibc
13946
13947 : see if getgrent exists
13948 set getgrent d_getgrent
13949 eval $inlibc
13950
13951 : see if getgrent_r exists
13952 set getgrent_r d_getgrent_r
13953 eval $inlibc
13954 case "$d_getgrent_r" in
13955 "$define")
13956         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13957         case "$d_getgrent_r_proto:$usethreads" in
13958         ":define")      d_getgrent_r_proto=define
13959                 set d_getgrent_r_proto getgrent_r $hdrs
13960                 eval $hasproto ;;
13961         *)      ;;
13962         esac
13963         case "$d_getgrent_r_proto" in
13964         define)
13965         case "$getgrent_r_proto" in
13966         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13967         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13968         esac
13969         case "$getgrent_r_proto" in
13970         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13971         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13972         esac
13973         case "$getgrent_r_proto" in
13974         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13975         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13976         esac
13977         case "$getgrent_r_proto" in
13978         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13979         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13980         esac
13981         case "$getgrent_r_proto" in
13982         ''|0) try='int getgrent_r(struct group*, char*, int);'
13983         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13984         esac
13985         case "$getgrent_r_proto" in
13986         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13987         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13988         esac
13989         case "$getgrent_r_proto" in
13990         ''|0)   d_getgrent_r=undef
13991                 getgrent_r_proto=0
13992                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13993         * )     case "$getgrent_r_proto" in
13994                 REENTRANT_PROTO*) ;;
13995                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13996                 esac
13997                 echo "Prototype: $try" ;;
13998         esac
13999         ;;
14000         *)      case "$usethreads" in
14001                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14002                 esac
14003                 d_getgrent_r=undef
14004                 getgrent_r_proto=0
14005                 ;;
14006         esac
14007         ;;
14008 *)      getgrent_r_proto=0
14009         ;;
14010 esac
14011
14012 : see if getgrgid_r exists
14013 set getgrgid_r d_getgrgid_r
14014 eval $inlibc
14015 case "$d_getgrgid_r" in
14016 "$define")
14017         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14018         case "$d_getgrgid_r_proto:$usethreads" in
14019         ":define")      d_getgrgid_r_proto=define
14020                 set d_getgrgid_r_proto getgrgid_r $hdrs
14021                 eval $hasproto ;;
14022         *)      ;;
14023         esac
14024         case "$d_getgrgid_r_proto" in
14025         define)
14026         case "$getgrgid_r_proto" in
14027         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14028         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14029         esac
14030         case "$getgrgid_r_proto" in
14031         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14032         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14033         esac
14034         case "$getgrgid_r_proto" in
14035         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14036         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14037         esac
14038         case "$getgrgid_r_proto" in
14039         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14040         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14041         esac
14042         case "$getgrgid_r_proto" in
14043         ''|0)   d_getgrgid_r=undef
14044                 getgrgid_r_proto=0
14045                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14046         * )     case "$getgrgid_r_proto" in
14047                 REENTRANT_PROTO*) ;;
14048                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14049                 esac
14050                 echo "Prototype: $try" ;;
14051         esac
14052         ;;
14053         *)      case "$usethreads" in
14054                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14055                 esac
14056                 d_getgrgid_r=undef
14057                 getgrgid_r_proto=0
14058                 ;;
14059         esac
14060         ;;
14061 *)      getgrgid_r_proto=0
14062         ;;
14063 esac
14064
14065 : see if getgrnam_r exists
14066 set getgrnam_r d_getgrnam_r
14067 eval $inlibc
14068 case "$d_getgrnam_r" in
14069 "$define")
14070         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14071         case "$d_getgrnam_r_proto:$usethreads" in
14072         ":define")      d_getgrnam_r_proto=define
14073                 set d_getgrnam_r_proto getgrnam_r $hdrs
14074                 eval $hasproto ;;
14075         *)      ;;
14076         esac
14077         case "$d_getgrnam_r_proto" in
14078         define)
14079         case "$getgrnam_r_proto" in
14080         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14081         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14082         esac
14083         case "$getgrnam_r_proto" in
14084         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14085         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14086         esac
14087         case "$getgrnam_r_proto" in
14088         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14089         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14090         esac
14091         case "$getgrnam_r_proto" in
14092         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14093         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14094         esac
14095         case "$getgrnam_r_proto" in
14096         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14097         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14098         esac
14099         case "$getgrnam_r_proto" in
14100         ''|0)   d_getgrnam_r=undef
14101                 getgrnam_r_proto=0
14102                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14103         * )     case "$getgrnam_r_proto" in
14104                 REENTRANT_PROTO*) ;;
14105                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14106                 esac
14107                 echo "Prototype: $try" ;;
14108         esac
14109         ;;
14110         *)      case "$usethreads" in
14111                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14112                 esac
14113                 d_getgrnam_r=undef
14114                 getgrnam_r_proto=0
14115                 ;;
14116         esac
14117         ;;
14118 *)      getgrnam_r_proto=0
14119         ;;
14120 esac
14121
14122 : see if gethostbyaddr exists
14123 set gethostbyaddr d_gethbyaddr
14124 eval $inlibc
14125
14126 : see if gethostbyname exists
14127 set gethostbyname d_gethbyname
14128 eval $inlibc
14129
14130 : see if gethostent exists
14131 set gethostent d_gethent
14132 eval $inlibc
14133
14134 : see how we will look up host name
14135 echo " "
14136 call=''
14137 if set gethostname val -f d_gethname; eval $csym; $val; then
14138         echo 'gethostname() found.' >&4
14139         d_gethname="$define"
14140         call=gethostname
14141 fi
14142 if set uname val -f d_uname; eval $csym; $val; then
14143         if ./xenix; then
14144                 $cat <<'EOM'
14145 uname() was found, but you're running xenix, and older versions of xenix
14146 have a broken uname(). If you don't really know whether your xenix is old
14147 enough to have a broken system call, use the default answer.
14148
14149 EOM
14150                 dflt=y
14151                 case "$d_uname" in
14152                 "$define") dflt=n;;
14153                 esac
14154                 rp='Is your uname() broken?'
14155                 . ./myread
14156                 case "$ans" in
14157                 n*) d_uname="$define"; call=uname;;
14158                 esac
14159         else
14160                 echo 'uname() found.' >&4
14161                 d_uname="$define"
14162                 case "$call" in
14163                 '') call=uname ;;
14164                 esac
14165         fi
14166 fi
14167 case "$d_gethname" in
14168 '') d_gethname="$undef";;
14169 esac
14170 case "$d_uname" in
14171 '') d_uname="$undef";;
14172 esac
14173 case "$d_uname$d_gethname" in
14174 *define*)
14175         dflt=n
14176         cat <<EOM
14177
14178 Every now and then someone has a $call() that lies about the hostname
14179 but can't be fixed for political or economic reasons.  If you wish, I can
14180 pretend $call() isn't there and maybe compute hostname at run-time
14181 thanks to the '$phostname' command.
14182
14183 EOM
14184         rp="Shall I ignore $call() from now on?"
14185         . ./myread
14186         case "$ans" in
14187         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14188         esac;;
14189 esac
14190 case "$phostname" in
14191 '') aphostname='';;
14192 *) case "$aphostname" in
14193         /*) ;;
14194         *) set X $phostname
14195                 shift
14196                 file=$1
14197                 shift
14198                 file=`./loc $file $file $pth`
14199                 aphostname=`echo $file $*`
14200                 ;;
14201         esac
14202         ;;
14203 esac
14204 case "$d_uname$d_gethname" in
14205 *define*) ;;
14206 *)
14207         case "$phostname" in
14208         '')
14209                 echo "There will be no way for $package to get your hostname." >&4;;
14210         *)
14211         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14212                 ;;
14213         esac;;
14214 esac
14215 case "$d_phostname" in
14216 '') d_phostname="$undef";;
14217 esac
14218
14219 : see if gethostbyaddr_r exists
14220 set gethostbyaddr_r d_gethostbyaddr_r
14221 eval $inlibc
14222 case "$d_gethostbyaddr_r" in
14223 "$define")
14224         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14225         case "$d_gethostbyaddr_r_proto:$usethreads" in
14226         ":define")      d_gethostbyaddr_r_proto=define
14227                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14228                 eval $hasproto ;;
14229         *)      ;;
14230         esac
14231         case "$d_gethostbyaddr_r_proto" in
14232         define)
14233         case "$gethostbyaddr_r_proto" in
14234         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14235         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14236         esac
14237         case "$gethostbyaddr_r_proto" in
14238         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14239         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14240         esac
14241         case "$gethostbyaddr_r_proto" in
14242         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14243         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14244         esac
14245         case "$gethostbyaddr_r_proto" in
14246         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14247         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14248         esac
14249         case "$gethostbyaddr_r_proto" in
14250         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14251         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14252         esac
14253         case "$gethostbyaddr_r_proto" in
14254         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14255         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14256         esac
14257         case "$gethostbyaddr_r_proto" in
14258         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14259         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14260         esac
14261         case "$gethostbyaddr_r_proto" in
14262         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14263         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14264         esac
14265         case "$gethostbyaddr_r_proto" in
14266         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14267         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14268         esac
14269         case "$gethostbyaddr_r_proto" in
14270         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14271         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14272         esac
14273         case "$gethostbyaddr_r_proto" in
14274         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14275         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14276         esac
14277         case "$gethostbyaddr_r_proto" in
14278         ''|0)   d_gethostbyaddr_r=undef
14279                 gethostbyaddr_r_proto=0
14280                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14281         * )     case "$gethostbyaddr_r_proto" in
14282                 REENTRANT_PROTO*) ;;
14283                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14284                 esac
14285                 echo "Prototype: $try" ;;
14286         esac
14287         ;;
14288         *)      case "$usethreads" in
14289                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14290                 esac
14291                 d_gethostbyaddr_r=undef
14292                 gethostbyaddr_r_proto=0
14293                 ;;
14294         esac
14295         ;;
14296 *)      gethostbyaddr_r_proto=0
14297         ;;
14298 esac
14299
14300 : see if gethostbyname_r exists
14301 set gethostbyname_r d_gethostbyname_r
14302 eval $inlibc
14303 case "$d_gethostbyname_r" in
14304 "$define")
14305         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14306         case "$d_gethostbyname_r_proto:$usethreads" in
14307         ":define")      d_gethostbyname_r_proto=define
14308                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14309                 eval $hasproto ;;
14310         *)      ;;
14311         esac
14312         case "$d_gethostbyname_r_proto" in
14313         define)
14314         case "$gethostbyname_r_proto" in
14315         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14316         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14317         esac
14318         case "$gethostbyname_r_proto" in
14319         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14320         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14321         esac
14322         case "$gethostbyname_r_proto" in
14323         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14324         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14325         esac
14326         case "$gethostbyname_r_proto" in
14327         ''|0)   d_gethostbyname_r=undef
14328                 gethostbyname_r_proto=0
14329                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14330         * )     case "$gethostbyname_r_proto" in
14331                 REENTRANT_PROTO*) ;;
14332                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14333                 esac
14334                 echo "Prototype: $try" ;;
14335         esac
14336         ;;
14337         *)      case "$usethreads" in
14338                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14339                 esac
14340                 d_gethostbyname_r=undef
14341                 gethostbyname_r_proto=0
14342                 ;;
14343         esac
14344         ;;
14345 *)      gethostbyname_r_proto=0
14346         ;;
14347 esac
14348
14349 : see if gethostent_r exists
14350 set gethostent_r d_gethostent_r
14351 eval $inlibc
14352 case "$d_gethostent_r" in
14353 "$define")
14354         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14355         case "$d_gethostent_r_proto:$usethreads" in
14356         ":define")      d_gethostent_r_proto=define
14357                 set d_gethostent_r_proto gethostent_r $hdrs
14358                 eval $hasproto ;;
14359         *)      ;;
14360         esac
14361         case "$d_gethostent_r_proto" in
14362         define)
14363         case "$gethostent_r_proto" in
14364         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14365         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14366         esac
14367         case "$gethostent_r_proto" in
14368         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14369         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14370         esac
14371         case "$gethostent_r_proto" in
14372         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14373         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14374         esac
14375         case "$gethostent_r_proto" in
14376         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14377         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14378         esac
14379         case "$gethostent_r_proto" in
14380         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14381         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14382         esac
14383         case "$gethostent_r_proto" in
14384         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14385         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14386         esac
14387         case "$gethostent_r_proto" in
14388         ''|0)   d_gethostent_r=undef
14389                 gethostent_r_proto=0
14390                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14391         * )     case "$gethostent_r_proto" in
14392                 REENTRANT_PROTO*) ;;
14393                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14394                 esac
14395                 echo "Prototype: $try" ;;
14396         esac
14397         ;;
14398         *)      case "$usethreads" in
14399                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14400                 esac
14401                 d_gethostent_r=undef
14402                 gethostent_r_proto=0
14403                 ;;
14404         esac
14405         ;;
14406 *)      gethostent_r_proto=0
14407         ;;
14408 esac
14409
14410 : see if prototypes for various gethostxxx netdb.h functions are available
14411 echo " "
14412 set d_gethostprotos gethostent $i_netdb netdb.h
14413 eval $hasproto
14414
14415 : see if getitimer exists
14416 set getitimer d_getitimer
14417 eval $inlibc
14418
14419 : see if getlogin exists
14420 set getlogin d_getlogin
14421 eval $inlibc
14422
14423 : see if getlogin_r exists
14424 set getlogin_r d_getlogin_r
14425 eval $inlibc
14426 case "$d_getlogin_r" in
14427 "$define")
14428         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14429         case "$d_getlogin_r_proto:$usethreads" in
14430         ":define")      d_getlogin_r_proto=define
14431                 set d_getlogin_r_proto getlogin_r $hdrs
14432                 eval $hasproto ;;
14433         *)      ;;
14434         esac
14435         case "$d_getlogin_r_proto" in
14436         define)
14437         case "$getlogin_r_proto" in
14438         ''|0) try='int getlogin_r(char*, size_t);'
14439         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14440         esac
14441         case "$getlogin_r_proto" in
14442         ''|0) try='int getlogin_r(char*, int);'
14443         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14444         esac
14445         case "$getlogin_r_proto" in
14446         ''|0) try='char* getlogin_r(char*, size_t);'
14447         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14448         esac
14449         case "$getlogin_r_proto" in
14450         ''|0) try='char* getlogin_r(char*, int);'
14451         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14452         esac
14453         case "$getlogin_r_proto" in
14454         ''|0)   d_getlogin_r=undef
14455                 getlogin_r_proto=0
14456                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14457         * )     case "$getlogin_r_proto" in
14458                 REENTRANT_PROTO*) ;;
14459                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14460                 esac
14461                 echo "Prototype: $try" ;;
14462         esac
14463         ;;
14464         *)      case "$usethreads" in
14465                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14466                 esac
14467                 d_getlogin_r=undef
14468                 getlogin_r_proto=0
14469                 ;;
14470         esac
14471         ;;
14472 *)      getlogin_r_proto=0
14473         ;;
14474 esac
14475
14476 : see if getmnt exists
14477 set getmnt d_getmnt
14478 eval $inlibc
14479
14480 : see if getmntent exists
14481 set getmntent d_getmntent
14482 eval $inlibc
14483
14484 : see if getnameinfo exists
14485 set getnameinfo d_getnameinfo
14486 eval $inlibc
14487
14488 : see if getnetbyaddr exists
14489 set getnetbyaddr d_getnbyaddr
14490 eval $inlibc
14491
14492 : see if getnetbyname exists
14493 set getnetbyname d_getnbyname
14494 eval $inlibc
14495
14496 : see if getnetent exists
14497 set getnetent d_getnent
14498 eval $inlibc
14499
14500 : see if getnetbyaddr_r exists
14501 set getnetbyaddr_r d_getnetbyaddr_r
14502 eval $inlibc
14503 case "$d_getnetbyaddr_r" in
14504 "$define")
14505         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14506         case "$d_getnetbyaddr_r_proto:$usethreads" in
14507         ":define")      d_getnetbyaddr_r_proto=define
14508                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14509                 eval $hasproto ;;
14510         *)      ;;
14511         esac
14512         case "$d_getnetbyaddr_r_proto" in
14513         define)
14514         case "$getnetbyaddr_r_proto" in
14515         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14516         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14517         esac
14518         case "$getnetbyaddr_r_proto" in
14519         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14520         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14521         esac
14522         case "$getnetbyaddr_r_proto" in
14523         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14524         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14525         esac
14526         case "$getnetbyaddr_r_proto" in
14527         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14528         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14529         esac
14530         case "$getnetbyaddr_r_proto" in
14531         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14532         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14533         esac
14534         case "$getnetbyaddr_r_proto" in
14535         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14536         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14537         esac
14538         case "$getnetbyaddr_r_proto" in
14539         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14540         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14541         esac
14542         case "$getnetbyaddr_r_proto" in
14543         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14544         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14545         esac
14546         case "$getnetbyaddr_r_proto" in
14547         ''|0)   d_getnetbyaddr_r=undef
14548                 getnetbyaddr_r_proto=0
14549                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14550         * )     case "$getnetbyaddr_r_proto" in
14551                 REENTRANT_PROTO*) ;;
14552                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14553                 esac
14554                 echo "Prototype: $try" ;;
14555         esac
14556         ;;
14557         *)      case "$usethreads" in
14558                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14559                 esac
14560                 d_getnetbyaddr_r=undef
14561                 getnetbyaddr_r_proto=0
14562                 ;;
14563         esac
14564         ;;
14565 *)      getnetbyaddr_r_proto=0
14566         ;;
14567 esac
14568
14569 : see if getnetbyname_r exists
14570 set getnetbyname_r d_getnetbyname_r
14571 eval $inlibc
14572 case "$d_getnetbyname_r" in
14573 "$define")
14574         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14575         case "$d_getnetbyname_r_proto:$usethreads" in
14576         ":define")      d_getnetbyname_r_proto=define
14577                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14578                 eval $hasproto ;;
14579         *)      ;;
14580         esac
14581         case "$d_getnetbyname_r_proto" in
14582         define)
14583         case "$getnetbyname_r_proto" in
14584         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14585         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14586         esac
14587         case "$getnetbyname_r_proto" in
14588         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14589         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14590         esac
14591         case "$getnetbyname_r_proto" in
14592         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14593         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14594         esac
14595         case "$getnetbyname_r_proto" in
14596         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14597         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14598         esac
14599         case "$getnetbyname_r_proto" in
14600         ''|0)   d_getnetbyname_r=undef
14601                 getnetbyname_r_proto=0
14602                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14603         * )     case "$getnetbyname_r_proto" in
14604                 REENTRANT_PROTO*) ;;
14605                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14606                 esac
14607                 echo "Prototype: $try" ;;
14608         esac
14609         ;;
14610         *)      case "$usethreads" in
14611                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14612                 esac
14613                 d_getnetbyname_r=undef
14614                 getnetbyname_r_proto=0
14615                 ;;
14616         esac
14617         ;;
14618 *)      getnetbyname_r_proto=0
14619         ;;
14620 esac
14621
14622 : see if getnetent_r exists
14623 set getnetent_r d_getnetent_r
14624 eval $inlibc
14625 case "$d_getnetent_r" in
14626 "$define")
14627         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14628         case "$d_getnetent_r_proto:$usethreads" in
14629         ":define")      d_getnetent_r_proto=define
14630                 set d_getnetent_r_proto getnetent_r $hdrs
14631                 eval $hasproto ;;
14632         *)      ;;
14633         esac
14634         case "$d_getnetent_r_proto" in
14635         define)
14636         case "$getnetent_r_proto" in
14637         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14638         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14639         esac
14640         case "$getnetent_r_proto" in
14641         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14642         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14643         esac
14644         case "$getnetent_r_proto" in
14645         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14646         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14647         esac
14648         case "$getnetent_r_proto" in
14649         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14650         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14651         esac
14652         case "$getnetent_r_proto" in
14653         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14654         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14655         esac
14656         case "$getnetent_r_proto" in
14657         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14658         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14659         esac
14660         case "$getnetent_r_proto" in
14661         ''|0)   d_getnetent_r=undef
14662                 getnetent_r_proto=0
14663                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14664         * )     case "$getnetent_r_proto" in
14665                 REENTRANT_PROTO*) ;;
14666                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14667                 esac
14668                 echo "Prototype: $try" ;;
14669         esac
14670         ;;
14671         *)      case "$usethreads" in
14672                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14673                 esac
14674                 d_getnetent_r=undef
14675                 getnetent_r_proto=0
14676                 ;;
14677         esac
14678         ;;
14679 *)      getnetent_r_proto=0
14680         ;;
14681 esac
14682
14683 : see if prototypes for various getnetxxx netdb.h functions are available
14684 echo " "
14685 set d_getnetprotos getnetent $i_netdb netdb.h
14686 eval $hasproto
14687
14688 : see if getpagesize exists
14689 set getpagesize d_getpagsz
14690 eval $inlibc
14691
14692 : Optional checks for getprotobyname and getprotobynumber
14693
14694 : see if getprotobyname exists
14695 set getprotobyname d_getpbyname
14696 eval $inlibc
14697
14698 : see if getprotobynumber exists
14699 set getprotobynumber d_getpbynumber
14700 eval $inlibc
14701
14702 : see if getprotoent exists
14703 set getprotoent d_getpent
14704 eval $inlibc
14705
14706 : see if getpgid exists
14707 set getpgid d_getpgid
14708 eval $inlibc
14709
14710 : see if getpgrp2 exists
14711 set getpgrp2 d_getpgrp2
14712 eval $inlibc
14713
14714 : see if getppid exists
14715 set getppid d_getppid
14716 eval $inlibc
14717
14718 : see if getpriority exists
14719 set getpriority d_getprior
14720 eval $inlibc
14721
14722 : see if getprotobyname_r exists
14723 set getprotobyname_r d_getprotobyname_r
14724 eval $inlibc
14725 case "$d_getprotobyname_r" in
14726 "$define")
14727         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14728         case "$d_getprotobyname_r_proto:$usethreads" in
14729         ":define")      d_getprotobyname_r_proto=define
14730                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14731                 eval $hasproto ;;
14732         *)      ;;
14733         esac
14734         case "$d_getprotobyname_r_proto" in
14735         define)
14736         case "$getprotobyname_r_proto" in
14737         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14738         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14739         esac
14740         case "$getprotobyname_r_proto" in
14741         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14742         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14743         esac
14744         case "$getprotobyname_r_proto" in
14745         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14746         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14747         esac
14748         case "$getprotobyname_r_proto" in
14749         ''|0)   d_getprotobyname_r=undef
14750                 getprotobyname_r_proto=0
14751                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14752         * )     case "$getprotobyname_r_proto" in
14753                 REENTRANT_PROTO*) ;;
14754                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14755                 esac
14756                 echo "Prototype: $try" ;;
14757         esac
14758         ;;
14759         *)      case "$usethreads" in
14760                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14761                 esac
14762                 d_getprotobyname_r=undef
14763                 getprotobyname_r_proto=0
14764                 ;;
14765         esac
14766         ;;
14767 *)      getprotobyname_r_proto=0
14768         ;;
14769 esac
14770
14771 : see if getprotobynumber_r exists
14772 set getprotobynumber_r d_getprotobynumber_r
14773 eval $inlibc
14774 case "$d_getprotobynumber_r" in
14775 "$define")
14776         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14777         case "$d_getprotobynumber_r_proto:$usethreads" in
14778         ":define")      d_getprotobynumber_r_proto=define
14779                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14780                 eval $hasproto ;;
14781         *)      ;;
14782         esac
14783         case "$d_getprotobynumber_r_proto" in
14784         define)
14785         case "$getprotobynumber_r_proto" in
14786         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14787         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14788         esac
14789         case "$getprotobynumber_r_proto" in
14790         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14791         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14792         esac
14793         case "$getprotobynumber_r_proto" in
14794         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14795         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14796         esac
14797         case "$getprotobynumber_r_proto" in
14798         ''|0)   d_getprotobynumber_r=undef
14799                 getprotobynumber_r_proto=0
14800                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14801         * )     case "$getprotobynumber_r_proto" in
14802                 REENTRANT_PROTO*) ;;
14803                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14804                 esac
14805                 echo "Prototype: $try" ;;
14806         esac
14807         ;;
14808         *)      case "$usethreads" in
14809                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14810                 esac
14811                 d_getprotobynumber_r=undef
14812                 getprotobynumber_r_proto=0
14813                 ;;
14814         esac
14815         ;;
14816 *)      getprotobynumber_r_proto=0
14817         ;;
14818 esac
14819
14820 : see if getprotoent_r exists
14821 set getprotoent_r d_getprotoent_r
14822 eval $inlibc
14823 case "$d_getprotoent_r" in
14824 "$define")
14825         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14826         case "$d_getprotoent_r_proto:$usethreads" in
14827         ":define")      d_getprotoent_r_proto=define
14828                 set d_getprotoent_r_proto getprotoent_r $hdrs
14829                 eval $hasproto ;;
14830         *)      ;;
14831         esac
14832         case "$d_getprotoent_r_proto" in
14833         define)
14834         case "$getprotoent_r_proto" in
14835         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14836         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14837         esac
14838         case "$getprotoent_r_proto" in
14839         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14840         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14841         esac
14842         case "$getprotoent_r_proto" in
14843         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14844         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14845         esac
14846         case "$getprotoent_r_proto" in
14847         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14848         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14849         esac
14850         case "$getprotoent_r_proto" in
14851         ''|0)   d_getprotoent_r=undef
14852                 getprotoent_r_proto=0
14853                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14854         * )     case "$getprotoent_r_proto" in
14855                 REENTRANT_PROTO*) ;;
14856                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14857                 esac
14858                 echo "Prototype: $try" ;;
14859         esac
14860         ;;
14861         *)      case "$usethreads" in
14862                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14863                 esac
14864                 d_getprotoent_r=undef
14865                 getprotoent_r_proto=0
14866                 ;;
14867         esac
14868         ;;
14869 *)      getprotoent_r_proto=0
14870         ;;
14871 esac
14872
14873 : see if prototypes for various getprotoxxx netdb.h functions are available
14874 echo " "
14875 set d_getprotoprotos getprotoent $i_netdb netdb.h
14876 eval $hasproto
14877
14878 : see if getprpwnam exists
14879 set getprpwnam d_getprpwnam
14880 eval $inlibc
14881
14882 : see if getpwent exists
14883 set getpwent d_getpwent
14884 eval $inlibc
14885
14886 : see if getpwent_r exists
14887 set getpwent_r d_getpwent_r
14888 eval $inlibc
14889 case "$d_getpwent_r" in
14890 "$define")
14891         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14892         case "$d_getpwent_r_proto:$usethreads" in
14893         ":define")      d_getpwent_r_proto=define
14894                 set d_getpwent_r_proto getpwent_r $hdrs
14895                 eval $hasproto ;;
14896         *)      ;;
14897         esac
14898         case "$d_getpwent_r_proto" in
14899         define)
14900         case "$getpwent_r_proto" in
14901         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14902         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14903         esac
14904         case "$getpwent_r_proto" in
14905         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14906         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14907         esac
14908         case "$getpwent_r_proto" in
14909         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14910         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14911         esac
14912         case "$getpwent_r_proto" in
14913         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14914         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14915         esac
14916         case "$getpwent_r_proto" in
14917         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14918         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14919         esac
14920         case "$getpwent_r_proto" in
14921         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14922         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14923         esac
14924         case "$getpwent_r_proto" in
14925         ''|0)   d_getpwent_r=undef
14926                 getpwent_r_proto=0
14927                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14928         * )     case "$getpwent_r_proto" in
14929                 REENTRANT_PROTO*) ;;
14930                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14931                 esac
14932                 echo "Prototype: $try" ;;
14933         esac
14934         ;;
14935         *)      case "$usethreads" in
14936                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14937                 esac
14938                 d_getpwent_r=undef
14939                 getpwent_r_proto=0
14940                 ;;
14941         esac
14942         ;;
14943 *)      getpwent_r_proto=0
14944         ;;
14945 esac
14946
14947 : see if getpwnam_r exists
14948 set getpwnam_r d_getpwnam_r
14949 eval $inlibc
14950 case "$d_getpwnam_r" in
14951 "$define")
14952         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14953         case "$d_getpwnam_r_proto:$usethreads" in
14954         ":define")      d_getpwnam_r_proto=define
14955                 set d_getpwnam_r_proto getpwnam_r $hdrs
14956                 eval $hasproto ;;
14957         *)      ;;
14958         esac
14959         case "$d_getpwnam_r_proto" in
14960         define)
14961         case "$getpwnam_r_proto" in
14962         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14963         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14964         esac
14965         case "$getpwnam_r_proto" in
14966         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14967         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14968         esac
14969         case "$getpwnam_r_proto" in
14970         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14971         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14972         esac
14973         case "$getpwnam_r_proto" in
14974         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14975         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14976         esac
14977         case "$getpwnam_r_proto" in
14978         ''|0)   d_getpwnam_r=undef
14979                 getpwnam_r_proto=0
14980                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14981         * )     case "$getpwnam_r_proto" in
14982                 REENTRANT_PROTO*) ;;
14983                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14984                 esac
14985                 echo "Prototype: $try" ;;
14986         esac
14987         ;;
14988         *)      case "$usethreads" in
14989                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14990                 esac
14991                 d_getpwnam_r=undef
14992                 getpwnam_r_proto=0
14993                 ;;
14994         esac
14995         ;;
14996 *)      getpwnam_r_proto=0
14997         ;;
14998 esac
14999
15000 : see if getpwuid_r exists
15001 set getpwuid_r d_getpwuid_r
15002 eval $inlibc
15003 case "$d_getpwuid_r" in
15004 "$define")
15005         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15006         case "$d_getpwuid_r_proto:$usethreads" in
15007         ":define")      d_getpwuid_r_proto=define
15008                 set d_getpwuid_r_proto getpwuid_r $hdrs
15009                 eval $hasproto ;;
15010         *)      ;;
15011         esac
15012         case "$d_getpwuid_r_proto" in
15013         define)
15014         case "$getpwuid_r_proto" in
15015         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15016         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15017         esac
15018         case "$getpwuid_r_proto" in
15019         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15020         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15021         esac
15022         case "$getpwuid_r_proto" in
15023         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15024         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15025         esac
15026         case "$getpwuid_r_proto" in
15027         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15028         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15029         esac
15030         case "$getpwuid_r_proto" in
15031         ''|0)   d_getpwuid_r=undef
15032                 getpwuid_r_proto=0
15033                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15034         * )     case "$getpwuid_r_proto" in
15035                 REENTRANT_PROTO*) ;;
15036                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15037                 esac
15038                 echo "Prototype: $try" ;;
15039         esac
15040         ;;
15041         *)      case "$usethreads" in
15042                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15043                 esac
15044                 d_getpwuid_r=undef
15045                 getpwuid_r_proto=0
15046                 ;;
15047         esac
15048         ;;
15049 *)      getpwuid_r_proto=0
15050         ;;
15051 esac
15052
15053 : Optional checks for getsbyname and getsbyport
15054
15055 : see if getservbyname exists
15056 set getservbyname d_getsbyname
15057 eval $inlibc
15058
15059 : see if getservbyport exists
15060 set getservbyport d_getsbyport
15061 eval $inlibc
15062
15063 : see if getservent exists
15064 set getservent d_getsent
15065 eval $inlibc
15066
15067 : see if getservbyname_r exists
15068 set getservbyname_r d_getservbyname_r
15069 eval $inlibc
15070 case "$d_getservbyname_r" in
15071 "$define")
15072         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15073         case "$d_getservbyname_r_proto:$usethreads" in
15074         ":define")      d_getservbyname_r_proto=define
15075                 set d_getservbyname_r_proto getservbyname_r $hdrs
15076                 eval $hasproto ;;
15077         *)      ;;
15078         esac
15079         case "$d_getservbyname_r_proto" in
15080         define)
15081         case "$getservbyname_r_proto" in
15082         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15083         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15084         esac
15085         case "$getservbyname_r_proto" in
15086         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15087         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15088         esac
15089         case "$getservbyname_r_proto" in
15090         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15091         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15092         esac
15093         case "$getservbyname_r_proto" in
15094         ''|0)   d_getservbyname_r=undef
15095                 getservbyname_r_proto=0
15096                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15097         * )     case "$getservbyname_r_proto" in
15098                 REENTRANT_PROTO*) ;;
15099                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15100                 esac
15101                 echo "Prototype: $try" ;;
15102         esac
15103         ;;
15104         *)      case "$usethreads" in
15105                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15106                 esac
15107                 d_getservbyname_r=undef
15108                 getservbyname_r_proto=0
15109                 ;;
15110         esac
15111         ;;
15112 *)      getservbyname_r_proto=0
15113         ;;
15114 esac
15115
15116 : see if getservbyport_r exists
15117 set getservbyport_r d_getservbyport_r
15118 eval $inlibc
15119 case "$d_getservbyport_r" in
15120 "$define")
15121         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15122         case "$d_getservbyport_r_proto:$usethreads" in
15123         ":define")      d_getservbyport_r_proto=define
15124                 set d_getservbyport_r_proto getservbyport_r $hdrs
15125                 eval $hasproto ;;
15126         *)      ;;
15127         esac
15128         case "$d_getservbyport_r_proto" in
15129         define)
15130         case "$getservbyport_r_proto" in
15131         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15132         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15133         esac
15134         case "$getservbyport_r_proto" in
15135         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15136         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15137         esac
15138         case "$getservbyport_r_proto" in
15139         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15140         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15141         esac
15142         case "$getservbyport_r_proto" in
15143         ''|0)   d_getservbyport_r=undef
15144                 getservbyport_r_proto=0
15145                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15146         * )     case "$getservbyport_r_proto" in
15147                 REENTRANT_PROTO*) ;;
15148                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15149                 esac
15150                 echo "Prototype: $try" ;;
15151         esac
15152         ;;
15153         *)      case "$usethreads" in
15154                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15155                 esac
15156                 d_getservbyport_r=undef
15157                 getservbyport_r_proto=0
15158                 ;;
15159         esac
15160         ;;
15161 *)      getservbyport_r_proto=0
15162         ;;
15163 esac
15164
15165 : see if getservent_r exists
15166 set getservent_r d_getservent_r
15167 eval $inlibc
15168 case "$d_getservent_r" in
15169 "$define")
15170         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15171         case "$d_getservent_r_proto:$usethreads" in
15172         ":define")      d_getservent_r_proto=define
15173                 set d_getservent_r_proto getservent_r $hdrs
15174                 eval $hasproto ;;
15175         *)      ;;
15176         esac
15177         case "$d_getservent_r_proto" in
15178         define)
15179         case "$getservent_r_proto" in
15180         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15181         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15182         esac
15183         case "$getservent_r_proto" in
15184         ''|0) try='int getservent_r(struct servent*, char*, int);'
15185         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15186         esac
15187         case "$getservent_r_proto" in
15188         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15189         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15190         esac
15191         case "$getservent_r_proto" in
15192         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15193         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15194         esac
15195         case "$getservent_r_proto" in
15196         ''|0)   d_getservent_r=undef
15197                 getservent_r_proto=0
15198                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15199         * )     case "$getservent_r_proto" in
15200                 REENTRANT_PROTO*) ;;
15201                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15202                 esac
15203                 echo "Prototype: $try" ;;
15204         esac
15205         ;;
15206         *)      case "$usethreads" in
15207                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15208                 esac
15209                 d_getservent_r=undef
15210                 getservent_r_proto=0
15211                 ;;
15212         esac
15213         ;;
15214 *)      getservent_r_proto=0
15215         ;;
15216 esac
15217
15218 : see if prototypes for various getservxxx netdb.h functions are available
15219 echo " "
15220 set d_getservprotos getservent $i_netdb netdb.h
15221 eval $hasproto
15222
15223 : see if getspnam exists
15224 set getspnam d_getspnam
15225 eval $inlibc
15226
15227 : see if this is a shadow.h system
15228 set shadow.h i_shadow
15229 eval $inhdr
15230
15231 : see if getspnam_r exists
15232 set getspnam_r d_getspnam_r
15233 eval $inlibc
15234 case "$d_getspnam_r" in
15235 "$define")
15236         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15237         case "$d_getspnam_r_proto:$usethreads" in
15238         ":define")      d_getspnam_r_proto=define
15239                 set d_getspnam_r_proto getspnam_r $hdrs
15240                 eval $hasproto ;;
15241         *)      ;;
15242         esac
15243         case "$d_getspnam_r_proto" in
15244         define)
15245         case "$getspnam_r_proto" in
15246         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15247         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15248         esac
15249         case "$getspnam_r_proto" in
15250         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15251         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15252         esac
15253         case "$getspnam_r_proto" in
15254         ''|0)   d_getspnam_r=undef
15255                 getspnam_r_proto=0
15256                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15257         * )     case "$getspnam_r_proto" in
15258                 REENTRANT_PROTO*) ;;
15259                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15260                 esac
15261                 echo "Prototype: $try" ;;
15262         esac
15263         ;;
15264         *)      case "$usethreads" in
15265                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15266                 esac
15267                 d_getspnam_r=undef
15268                 getspnam_r_proto=0
15269                 ;;
15270         esac
15271         ;;
15272 *)      getspnam_r_proto=0
15273         ;;
15274 esac
15275
15276 : see if gettimeofday or ftime exists
15277 set gettimeofday d_gettimeod
15278 eval $inlibc
15279 case "$d_gettimeod" in
15280 "$undef")
15281         set ftime d_ftime 
15282         eval $inlibc
15283         ;;
15284 *)
15285         val="$undef"; set d_ftime; eval $setvar
15286         ;;
15287 esac
15288 case "$d_gettimeod$d_ftime" in
15289 "$undef$undef")
15290         echo " "
15291         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15292         ;;
15293 esac
15294
15295 : see if gmtime_r exists
15296 set gmtime_r d_gmtime_r
15297 eval $inlibc
15298 case "$d_gmtime_r" in
15299 "$define")
15300         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15301         case "$d_gmtime_r_proto:$usethreads" in
15302         ":define")      d_gmtime_r_proto=define
15303                 set d_gmtime_r_proto gmtime_r $hdrs
15304                 eval $hasproto ;;
15305         *)      ;;
15306         esac
15307         case "$d_gmtime_r_proto" in
15308         define)
15309         case "$gmtime_r_proto" in
15310         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15311         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15312         esac
15313         case "$gmtime_r_proto" in
15314         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15315         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15316         esac
15317         case "$gmtime_r_proto" in
15318         ''|0)   d_gmtime_r=undef
15319                 gmtime_r_proto=0
15320                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15321         * )     case "$gmtime_r_proto" in
15322                 REENTRANT_PROTO*) ;;
15323                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15324                 esac
15325                 echo "Prototype: $try" ;;
15326         esac
15327         ;;
15328         *)      case "$usethreads" in
15329                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15330                 esac
15331                 d_gmtime_r=undef
15332                 gmtime_r_proto=0
15333                 ;;
15334         esac
15335         ;;
15336 *)      gmtime_r_proto=0
15337         ;;
15338 esac
15339
15340 : see if hasmntopt exists
15341 set hasmntopt d_hasmntopt
15342 eval $inlibc
15343
15344 : see if this is a netinet/in.h or sys/in.h system
15345 set netinet/in.h i_niin sys/in.h i_sysin
15346 eval $inhdr
15347
15348 : see if arpa/inet.h has to be included
15349 set arpa/inet.h i_arpainet
15350 eval $inhdr
15351
15352 : see if htonl --and friends-- exists
15353 val=''
15354 set htonl val
15355 eval $inlibc
15356
15357 : Maybe they are macros.
15358 case "$val" in
15359 $undef)
15360         $cat >htonl.c <<EOM
15361 #include <stdio.h>
15362 #include <sys/types.h>
15363 #$i_niin I_NETINET_IN
15364 #$i_sysin I_SYS_IN
15365 #$i_arpainet I_ARPA_INET
15366 #ifdef I_NETINET_IN
15367 #include <netinet/in.h>
15368 #endif
15369 #ifdef I_SYS_IN
15370 #include <sys/in.h>
15371 #endif
15372 #ifdef I_ARPA_INET
15373 #include <arpa/inet.h>
15374 #endif
15375 #ifdef htonl
15376 printf("Defined as a macro.");
15377 #endif
15378 EOM
15379         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15380         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15381                 val="$define"
15382                 echo "But it seems to be defined as a macro." >&4
15383         fi
15384         $rm -f htonl.?
15385         ;;
15386 esac
15387 set d_htonl
15388 eval $setvar
15389
15390 : see if ilogbl exists
15391 set ilogbl d_ilogbl
15392 eval $inlibc
15393
15394 : index or strchr
15395 echo " "
15396 if set index val -f; eval $csym; $val; then
15397         if set strchr val -f d_strchr; eval $csym; $val; then
15398                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15399                         val="$define"
15400                         vali="$undef"
15401                         echo "strchr() found." >&4
15402                 else
15403                         val="$undef"
15404                         vali="$define"
15405                         echo "index() found." >&4
15406                 fi
15407         else
15408                 val="$undef"
15409                 vali="$define"
15410                 echo "index() found." >&4
15411         fi
15412 else
15413         if set strchr val -f d_strchr; eval $csym; $val; then
15414                 val="$define"
15415                 vali="$undef"
15416                 echo "strchr() found." >&4
15417         else
15418                 echo "No index() or strchr() found!" >&4
15419                 val="$undef"
15420                 vali="$undef"
15421         fi
15422 fi
15423 set d_strchr; eval $setvar
15424 val="$vali"
15425 set d_index; eval $setvar
15426
15427 : check whether inet_aton exists
15428 set inet_aton d_inetaton
15429 eval $inlibc
15430
15431 : see if inet_ntop exists
15432 set inet_ntop d_inetntop
15433 eval $inlibc
15434
15435 : see if inet_pton exists
15436 set inet_pton d_inetpton
15437 eval $inlibc
15438
15439 : Look for isascii
15440 echo " "
15441 $cat >isascii.c <<EOCP
15442 #include <stdio.h>
15443 #include <ctype.h>
15444 #$i_stdlib I_STDLIB
15445 #ifdef I_STDLIB
15446 #include <stdlib.h>
15447 #endif
15448 int main() {
15449         int c = 'A';
15450         if (isascii(c))
15451                 exit(0);
15452         else
15453                 exit(1);
15454 }
15455 EOCP
15456 set isascii
15457 if eval $compile; then
15458         echo "isascii() found." >&4
15459         val="$define"
15460 else
15461         echo "isascii() NOT found." >&4
15462         val="$undef"
15463 fi
15464 set d_isascii
15465 eval $setvar
15466 $rm -f isascii*
15467
15468 : Look for isblank
15469 echo " "
15470 $cat >isblank.c <<'EOCP'
15471 #include <stdio.h>
15472 #include <ctype.h>
15473 int main() {
15474         int c = ' ';
15475         if (isblank(c))
15476                 return 0 ;
15477         else
15478                 return 1 ;
15479 }
15480 EOCP
15481 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15482         echo "isblank() found." >&4
15483         val="$define"
15484 else
15485         echo "isblank() NOT found." >&4
15486         val="$undef"
15487 fi
15488 set d_isblank
15489 eval $setvar
15490 $rm -f isblank*
15491
15492 : check for isfinite
15493 echo "Checking to see if you have isfinite..." >&4
15494 $cat >try.c <<EOCP
15495 #$i_math I_MATH
15496 #ifdef I_MATH
15497 #include <math.h>
15498 #endif
15499 int main() { return isfinite(0.0); }
15500 EOCP
15501 set try
15502 if eval $compile; then
15503         val="$define"
15504         echo "You have isfinite."
15505 else
15506         val="$undef"
15507         echo "You do not have isfinite."
15508 fi
15509 $rm_try
15510 set d_isfinite
15511 eval $setvar
15512
15513 : see if isfinitel exists
15514 set isfinitel d_isfinitel
15515 eval $inlibc
15516
15517 : check for isinf
15518 echo "Checking to see if you have isinf..." >&4
15519 $cat >try.c <<EOCP
15520 #$i_math I_MATH
15521 #ifdef I_MATH
15522 #include <math.h>
15523 #endif
15524 int main() { return isinf(0.0); }
15525 EOCP
15526 set try
15527 if eval $compile; then
15528         val="$define"
15529         echo "You have isinf."
15530 else
15531         val="$undef"
15532         echo "You do not have isinf."
15533 fi
15534 $rm_try
15535 set d_isinf
15536 eval $setvar
15537
15538 : see if isinfl exists
15539 set isinfl d_isinfl
15540 eval $inlibc
15541
15542 : check for isnan
15543 echo "Checking to see if you have isnan..." >&4
15544 $cat >try.c <<EOCP
15545 #$i_math I_MATH
15546 #ifdef I_MATH
15547 #include <math.h>
15548 #endif
15549 int main() { return isnan(0.0); }
15550 EOCP
15551 set try
15552 if eval $compile; then
15553         val="$define"
15554         echo "You have isnan."
15555 else
15556         val="$undef"
15557         echo "You do not have isnan."
15558 fi
15559 $rm_try
15560 set d_isnan
15561 eval $setvar
15562
15563 : see if isnanl exists
15564 set isnanl d_isnanl
15565 eval $inlibc
15566
15567 : see if j0 exists
15568 set j0 d_j0
15569 eval $inlibc
15570
15571 : see if j0l exists
15572 set j0l d_j0l
15573 eval $inlibc
15574
15575 : see if killpg exists
15576 set killpg d_killpg
15577 eval $inlibc
15578
15579 : see if lchown exists
15580 echo " "
15581 $cat > try.c <<'EOCP'
15582 /* System header to define __stub macros and hopefully few prototypes,
15583     which can conflict with char lchown(); below.  */
15584 #include <assert.h>
15585 /* Override any gcc2 internal prototype to avoid an error.  */
15586 /* We use char because int might match the return type of a gcc2
15587    builtin and then its argument prototype would still apply.  */
15588 char lchown();
15589 int main() {
15590     /*  The GNU C library defines this for functions which it implements
15591         to always fail with ENOSYS.  Some functions are actually named
15592         something starting with __ and the normal name is an alias.  */
15593 #if defined (__stub_lchown) || defined (__stub___lchown)
15594 choke me
15595 #else
15596 lchown();
15597 #endif
15598 ; return 0; }
15599 EOCP
15600 set try
15601 if eval $compile; then
15602     $echo "lchown() found." >&4
15603     val="$define"
15604 else
15605     $echo "lchown() NOT found." >&4
15606     val="$undef"
15607 fi
15608 set d_lchown
15609 eval $setvar
15610
15611 : See if number of significant digits in a double precision number is known
15612 echo " "
15613 $cat >ldbl_dig.c <<EOM
15614 #$i_limits I_LIMITS
15615 #$i_float I_FLOAT
15616 #ifdef I_LIMITS
15617 #include <limits.h>
15618 #endif
15619 #ifdef I_FLOAT
15620 #include <float.h>
15621 #endif
15622 #ifdef LDBL_DIG
15623 printf("Contains LDBL_DIG");
15624 #endif
15625 EOM
15626 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15627 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15628         echo "LDBL_DIG found." >&4
15629         val="$define"
15630 else
15631         echo "LDBL_DIG NOT found." >&4
15632         val="$undef"
15633 fi
15634 $rm -f ldbl_dig.?
15635 set d_ldbl_dig
15636 eval $setvar
15637
15638 : check to see if math.h defines _LIB_VERSION
15639 d_libm_lib_version="$undef"
15640 case $i_math in
15641     $define)
15642         echo " "
15643         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15644         $cat >try.c <<EOCP
15645 #include <unistd.h>
15646 #include <math.h>
15647 int main (int argc, char *argv[])
15648 {
15649     printf ("%d\n", _LIB_VERSION);
15650     return (0);
15651     } /* main */
15652 EOCP
15653         set try
15654         if eval $compile; then
15655             foo=`$run ./try`
15656             echo "Yes, it does ($foo)" >&4
15657             d_libm_lib_version="$define"
15658         else
15659             echo "No, it does not (probably harmless)" >&4
15660             fi
15661         $rm_try
15662         ;;
15663
15664     esac
15665
15666 : see if link exists
15667 set link d_link
15668 eval $inlibc
15669
15670 : see if localtime_r exists
15671 set localtime_r d_localtime_r
15672 eval $inlibc
15673 case "$d_localtime_r" in
15674 "$define")
15675         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15676         case "$d_localtime_r_proto:$usethreads" in
15677         ":define")      d_localtime_r_proto=define
15678                 set d_localtime_r_proto localtime_r $hdrs
15679                 eval $hasproto ;;
15680         *)      ;;
15681         esac
15682         case "$d_localtime_r_proto" in
15683         define)
15684         case "$localtime_r_proto" in
15685         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15686         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15687         esac
15688         case "$localtime_r_proto" in
15689         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15690         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15691         esac
15692         case "$localtime_r_proto" in
15693         ''|0)   d_localtime_r=undef
15694                 localtime_r_proto=0
15695                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15696         * )     case "$localtime_r_proto" in
15697                 REENTRANT_PROTO*) ;;
15698                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15699                 esac
15700                 echo "Prototype: $try" ;;
15701         esac
15702         ;;
15703         *)      case "$usethreads" in
15704                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15705                 esac
15706                 d_localtime_r=undef
15707                 localtime_r_proto=0
15708                 ;;
15709         esac
15710         ;;
15711 *)      localtime_r_proto=0
15712         ;;
15713 esac
15714
15715 : see if localtime_r calls tzset
15716 case "$localtime_r_proto" in
15717 REENTRANT_PROTO*)
15718         $cat >try.c <<EOCP
15719 /*  Does our libc's localtime_r call tzset ?
15720  *  return 0 if so, 1 otherwise.
15721  */
15722 #$i_systypes    I_SYS_TYPES
15723 #$i_unistd      I_UNISTD
15724 #$i_time        I_TIME
15725 #$i_stdlib      I_STDLIB
15726 #$i_string      I_STRING
15727 #$i_malloc      I_MALLOC
15728 #ifdef I_SYS_TYPES
15729 #  include <sys/types.h>
15730 #endif
15731 #ifdef I_UNISTD
15732 #  include <unistd.h>
15733 #endif
15734 #ifdef I_TIME
15735 #  include <time.h>
15736 #endif
15737 #ifdef I_STDLIB
15738 #include <stdlib.h>
15739 #endif
15740 #ifdef I_STRING
15741 #  include <string.h>
15742 #else
15743 #  include <strings.h>
15744 #endif
15745 #ifdef I_MALLOC
15746 #  include <malloc.h>
15747 #endif
15748 int main()
15749 {
15750     time_t t = time(0L);
15751     char w_tz[]="TZ" "=GMT+5",
15752          e_tz[]="TZ" "=GMT-5",
15753         *tz_e = (char*)malloc(16),
15754         *tz_w = (char*)malloc(16);
15755     struct tm tm_e, tm_w;
15756     memset(&tm_e,'\0',sizeof(struct tm));
15757     memset(&tm_w,'\0',sizeof(struct tm));
15758     strcpy(tz_e,e_tz);
15759     strcpy(tz_w,w_tz);
15760
15761     putenv(tz_e);
15762     localtime_r(&t, &tm_e);
15763
15764     putenv(tz_w);
15765     localtime_r(&t, &tm_w);
15766
15767     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15768         return 1;
15769     return 0;
15770 }
15771 EOCP
15772         set try
15773         if eval $compile; then
15774             if $run ./try; then
15775                 d_localtime_r_needs_tzset=undef;
15776             else
15777                 d_localtime_r_needs_tzset=define;
15778             fi;
15779         else
15780             d_localtime_r_needs_tzset=undef;
15781         fi;
15782      ;;
15783   *)
15784      d_localtime_r_needs_tzset=undef;
15785      ;;
15786 esac
15787 $rm_try
15788
15789 : see if localeconv exists
15790 set localeconv d_locconv
15791 eval $inlibc
15792
15793 : see if lockf exists
15794 set lockf d_lockf
15795 eval $inlibc
15796
15797 : see if prototype for lseek is available
15798 echo " "
15799 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15800 eval $hasproto
15801
15802 : see if lstat exists
15803 set lstat d_lstat
15804 eval $inlibc
15805
15806 : see if madvise exists
15807 set madvise d_madvise
15808 eval $inlibc
15809
15810 : see if malloc_size exists
15811 set malloc_size d_malloc_size
15812 eval $inlibc
15813
15814 : see if malloc_size_good exists
15815 set malloc_good_size d_malloc_good_size
15816 eval $inlibc
15817
15818 : see if mblen exists
15819 set mblen d_mblen
15820 eval $inlibc
15821
15822 : see if mbstowcs exists
15823 set mbstowcs d_mbstowcs
15824 eval $inlibc
15825
15826 : see if mbtowc exists
15827 set mbtowc d_mbtowc
15828 eval $inlibc
15829
15830 : see if memchr exists
15831 set memchr d_memchr
15832 eval $inlibc
15833
15834 : see if memcmp exists
15835 set memcmp d_memcmp
15836 eval $inlibc
15837
15838 : see if memcpy exists
15839 set memcpy d_memcpy
15840 eval $inlibc
15841
15842 : see if memmove exists
15843 set memmove d_memmove
15844 eval $inlibc
15845
15846 : see if memset exists
15847 set memset d_memset
15848 eval $inlibc
15849
15850 : see if mkdir exists
15851 set mkdir d_mkdir
15852 eval $inlibc
15853
15854 : see if mkdtemp exists
15855 set mkdtemp d_mkdtemp
15856 eval $inlibc
15857
15858 : see if mkfifo exists
15859 set mkfifo d_mkfifo
15860 eval $inlibc
15861
15862 : see if mkstemp exists
15863 set mkstemp d_mkstemp
15864 eval $inlibc
15865
15866 : see if mkstemps exists
15867 set mkstemps d_mkstemps
15868 eval $inlibc
15869
15870 : see if mktime exists
15871 set mktime d_mktime
15872 eval $inlibc
15873
15874 : see if this is a sys/mman.h system
15875 set sys/mman.h i_sysmman
15876 eval $inhdr
15877
15878 : see if mmap exists
15879 set mmap d_mmap
15880 eval $inlibc
15881 : see what shmat returns
15882 : default to something harmless
15883 mmaptype='void *'
15884 case "$i_sysmman$d_mmap" in
15885 "$define$define")
15886         $cat >mmap.c <<'END'
15887 #include <sys/mman.h>
15888 void *mmap();
15889 END
15890         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15891                 mmaptype='void *'
15892         else
15893                 mmaptype='caddr_t'
15894         fi
15895         echo "and it returns ($mmaptype)." >&4
15896         ;;
15897 esac
15898
15899
15900
15901 : see if sqrtl exists
15902 set sqrtl d_sqrtl
15903 eval $inlibc
15904
15905 : see if scalbnl exists
15906 set scalbnl d_scalbnl
15907 eval $inlibc
15908
15909 : see if modfl exists
15910 set modfl d_modfl
15911 eval $inlibc
15912
15913 : see if prototype for modfl is available
15914 echo " "
15915 set d_modflproto modfl $i_math math.h
15916 eval $hasproto
15917
15918 d_modfl_pow32_bug="$undef"
15919
15920 case "$d_longdbl$d_modfl" in
15921 $define$define)
15922         $cat <<EOM
15923 Checking to see whether your modfl() is okay for large values...
15924 EOM
15925 $cat >try.c <<EOCP
15926 #include <math.h>
15927 #include <stdio.h>
15928 EOCP
15929 if $test "X$d_modflproto" != "X$define"; then
15930         $cat >>try.c <<EOCP
15931 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15932 long double modfl (long double, long double *);
15933 EOCP
15934 fi
15935 $cat >>try.c <<EOCP
15936 int main() {
15937     long double nv = 4294967303.15;
15938     long double v, w;
15939     v = modfl(nv, &w);
15940 #ifdef __GLIBC__
15941     printf("glibc");
15942 #endif
15943     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15944     return 0;
15945 }
15946 EOCP
15947         case "$osname:$gccversion" in
15948         aix:)   saveccflags="$ccflags"
15949                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15950         esac
15951         set try
15952         if eval $compile; then
15953                 foo=`$run ./try`
15954                 case "$foo" in
15955                 *" 4294967303.150000 1.150000 4294967302.000000")
15956                         echo >&4 "Your modfl() is broken for large values."
15957                         d_modfl_pow32_bug="$define"
15958                         case "$foo" in
15959                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15960                         ;;
15961                         esac
15962                         ;;
15963                 *" 4294967303.150000 0.150000 4294967303.000000")
15964                         echo >&4 "Your modfl() seems okay for large values."
15965                         ;;
15966                 *)      echo >&4 "I don't understand your modfl() at all."
15967                         d_modfl="$undef"
15968                         ;;
15969                 esac
15970                 $rm_try
15971         else
15972                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15973                 d_modfl="$undef"
15974         fi
15975         case "$osname:$gccversion" in
15976         aix:)   ccflags="$saveccflags" ;; # restore
15977         esac
15978         ;;
15979 esac
15980
15981 if $test "$uselongdouble" = "$define"; then
15982     message=""
15983     if $test "$d_sqrtl" != "$define"; then
15984         message="$message sqrtl"
15985     fi
15986     if $test "$d_modfl" != "$define"; then
15987         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15988             echo "You have both aintl and copysignl, so I can emulate modfl."
15989         else
15990             message="$message modfl"
15991         fi
15992     fi
15993     if $test "$d_frexpl" != "$define"; then
15994         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15995             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15996         else
15997             message="$message frexpl"
15998         fi
15999     fi
16000     if $test "$d_ldexpl" != "$define"; then
16001         message="$message ldexpl"
16002     fi
16003
16004     if $test "$message" != ""; then
16005         $cat <<EOM >&4
16006
16007 *** You requested the use of long doubles but you do not seem to have
16008 *** the following mathematical functions needed for long double support:
16009 ***    $message
16010 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16011 *** Cannot continue, aborting.
16012
16013 EOM
16014
16015         exit 1
16016     fi
16017 fi
16018
16019 : see if mprotect exists
16020 set mprotect d_mprotect
16021 eval $inlibc
16022
16023 : see if msgctl exists
16024 set msgctl d_msgctl
16025 eval $inlibc
16026
16027 : see if msgget exists
16028 set msgget d_msgget
16029 eval $inlibc
16030
16031 : see if msgsnd exists
16032 set msgsnd d_msgsnd
16033 eval $inlibc
16034
16035 : see if msgrcv exists
16036 set msgrcv d_msgrcv
16037 eval $inlibc
16038
16039 : see how much of the 'msg*(2)' library is present.
16040 h_msg=true
16041 echo " "
16042 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16043 *"$undef"*) h_msg=false;;
16044 esac
16045 case "$osname" in
16046 freebsd)
16047     case "`ipcs 2>&1`" in
16048     "SVID messages"*"not configured"*)
16049         echo "Your $osname does not have the msg*(2) configured." >&4
16050         h_msg=false
16051         val="$undef"
16052         set msgctl d_msgctl
16053         eval $setvar
16054         set msgget d_msgget
16055         eval $setvar
16056         set msgsnd d_msgsnd
16057         eval $setvar
16058         set msgrcv d_msgrcv
16059         eval $setvar
16060         ;;
16061     esac
16062     ;;
16063 esac
16064 : we could also check for sys/ipc.h ...
16065 if $h_msg && $test `./findhdr sys/msg.h`; then
16066         echo "You have the full msg*(2) library." >&4
16067         val="$define"
16068 else
16069         echo "You don't have the full msg*(2) library." >&4
16070         val="$undef"
16071 fi
16072 set d_msg
16073 eval $setvar
16074
16075 : Check for msghdr_s
16076 echo " "
16077 echo "Checking to see if your system supports struct msghdr..." >&4
16078 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16079 eval $hasstruct
16080 case "$d_msghdr_s" in
16081 "$define")      echo "Yes, it does."   ;;
16082 *)              echo "No, it doesn't." ;;
16083 esac
16084
16085
16086 : see if msync exists
16087 set msync d_msync
16088 eval $inlibc
16089
16090 : see if munmap exists
16091 set munmap d_munmap
16092 eval $inlibc
16093
16094 : see if nice exists
16095 set nice d_nice
16096 eval $inlibc
16097
16098 : see if this is a langinfo.h system
16099 set langinfo.h i_langinfo
16100 eval $inhdr
16101
16102 : see if nl_langinfo exists
16103 set nl_langinfo d_nl_langinfo
16104 eval $inlibc
16105
16106 : check for volatile keyword
16107 echo " "
16108 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
16109 $cat >try.c <<'EOCP'
16110 int main()
16111 {
16112         typedef struct _goo_struct goo_struct;
16113         goo_struct * volatile goo = ((goo_struct *)0);
16114         struct _goo_struct {
16115                 long long_int;
16116                 int reg_int;
16117                 char char_var;
16118         };
16119         typedef unsigned short foo_t;
16120         char *volatile foo;
16121         volatile int bar;
16122         volatile foo_t blech;
16123         foo = foo;
16124 }
16125 EOCP
16126 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
16127         val="$define"
16128         echo "Yup, it does."
16129 else
16130         val="$undef"
16131         echo "Nope, it doesn't."
16132 fi
16133 set d_volatile
16134 eval $setvar
16135 $rm_try
16136
16137 : Check basic sizes
16138 echo " "
16139 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16140
16141 case "$use64bitint:$d_quad:$quadtype" in
16142 define:define:?*)
16143         ivtype="$quadtype"
16144         uvtype="$uquadtype"
16145         ivsize=8
16146         uvsize=8
16147         ;;
16148 *)      ivtype="long"
16149         uvtype="unsigned long"
16150         ivsize=$longsize
16151         uvsize=$longsize
16152         ;;
16153 esac
16154
16155 case "$uselongdouble:$d_longdbl" in
16156 define:define)
16157         nvtype="long double"
16158         nvsize=$longdblsize
16159         ;;
16160 *)      nvtype=double
16161         nvsize=$doublesize
16162         ;;
16163 esac
16164
16165 $echo "(IV will be "$ivtype", $ivsize bytes)"
16166 $echo "(UV will be "$uvtype", $uvsize bytes)"
16167 $echo "(NV will be "$nvtype", $nvsize bytes)"
16168
16169 $cat >try.c <<EOCP
16170 #$i_inttypes I_INTTYPES
16171 #ifdef I_INTTYPES
16172 #include <inttypes.h>
16173 #endif
16174 #include <stdio.h>
16175 int main() {
16176 #ifdef INT8
16177    int8_t i =  INT8_MAX;
16178   uint8_t u = UINT8_MAX;
16179   printf("int8_t\n");
16180 #endif
16181 #ifdef INT16
16182    int16_t i =  INT16_MAX;
16183   uint16_t u = UINT16_MAX;
16184   printf("int16_t\n");
16185 #endif
16186 #ifdef INT32
16187    int32_t i =  INT32_MAX;
16188   uint32_t u = UINT32_MAX;
16189   printf("int32_t\n");
16190 #endif
16191 }
16192 EOCP
16193
16194 i8type="signed char"
16195 u8type="unsigned char"
16196 i8size=1
16197 u8size=1
16198
16199 case "$i16type" in
16200 '')     case "$shortsize" in
16201         2)      i16type=short
16202                 u16type="unsigned short"
16203                 i16size=$shortsize
16204                 u16size=$shortsize
16205                 ;;
16206         esac
16207         ;;
16208 esac
16209 case "$i16type" in
16210 '')     set try -DINT16
16211         if eval $compile; then
16212                 case "`$run ./try`" in
16213                 int16_t)
16214                         i16type=int16_t
16215                         u16type=uint16_t
16216                         i16size=2
16217                         u16size=2
16218                         ;;
16219                 esac
16220         fi
16221         ;;
16222 esac
16223 case "$i16type" in
16224 '')     if $test $shortsize -ge 2; then
16225                 i16type=short
16226                 u16type="unsigned short"
16227                 i16size=$shortsize
16228                 u16size=$shortsize
16229         fi
16230         ;;
16231 esac
16232
16233 case "$i32type" in
16234 '')     case "$longsize" in
16235         4)      i32type=long
16236                 u32type="unsigned long"
16237                 i32size=$longsize
16238                 u32size=$longsize
16239                 ;;
16240         *)      case "$intsize" in
16241                 4)      i32type=int
16242                         u32type="unsigned int"
16243                         i32size=$intsize
16244                         u32size=$intsize
16245                         ;;
16246                 esac
16247                 ;;
16248         esac
16249         ;;
16250 esac
16251 case "$i32type" in
16252 '')     set try -DINT32
16253         if eval $compile; then
16254                 case "`$run ./try`" in
16255                 int32_t)
16256                         i32type=int32_t
16257                         u32type=uint32_t
16258                         i32size=4
16259                         u32size=4
16260                         ;;
16261                 esac
16262         fi
16263         ;;
16264 esac
16265 case "$i32type" in
16266 '')     if $test $intsize -ge 4; then
16267                 i32type=int
16268                 u32type="unsigned int"
16269                 i32size=$intsize
16270                 u32size=$intsize
16271         fi
16272         ;;
16273 esac
16274
16275 case "$i64type" in
16276 '')     case "$d_quad:$quadtype" in
16277         define:?*)
16278                 i64type="$quadtype"
16279                 u64type="$uquadtype"
16280                 i64size=8
16281                 u64size=8
16282                 ;;
16283         esac
16284         ;;
16285 esac
16286
16287 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16288 : volatile so that the compiler has to store it out to memory.
16289 if test X"$d_volatile" = X"$define"; then
16290         volatile=volatile
16291 fi
16292 $cat <<EOP >try.c
16293 #include <stdio.h>
16294 #$i_stdlib I_STDLIB
16295 #ifdef I_STDLIB
16296 #include <stdlib.h>
16297 #endif
16298 #include <sys/types.h>
16299 #include <signal.h>
16300 #ifdef SIGFPE
16301 $volatile int bletched = 0;
16302 $signal_t blech(int s) { bletched = 1; }
16303 #endif
16304 int main() {
16305     $uvtype u = 0;
16306     $nvtype d;
16307     int     n = 8 * $uvsize;
16308     int     i;
16309 #ifdef SIGFPE
16310     signal(SIGFPE, blech);
16311 #endif
16312
16313     for (i = 0; i < n; i++) {
16314       u = u << 1 | ($uvtype)1;
16315       d = ($nvtype)u;
16316       if (($uvtype)d != u)
16317         break;
16318       if (d <= 0)
16319         break;
16320       d = ($nvtype)(u - 1);
16321       if (($uvtype)d != (u - 1))
16322         break;
16323 #ifdef SIGFPE
16324       if (bletched)
16325         break;
16326 #endif
16327     }
16328     printf("%d\n", ((i == n) ? -n : i));
16329     exit(0);
16330 }
16331 EOP
16332 set try
16333
16334 d_nv_preserves_uv="$undef"
16335 if eval $compile; then
16336         nv_preserves_uv_bits="`$run ./try`"
16337 fi
16338 case "$nv_preserves_uv_bits" in
16339 \-[1-9]*)
16340         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16341         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16342         d_nv_preserves_uv="$define"
16343         ;;
16344 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16345         d_nv_preserves_uv="$undef" ;;
16346 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16347         nv_preserves_uv_bits="0" ;;
16348 esac
16349 $rm_try
16350
16351 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16352 : volatile so that the compiler has to store it out to memory.
16353 if test X"$d_volatile" = X"$define"; then
16354         volatile=volatile
16355 fi
16356 $cat <<EOP >try.c
16357 #include <stdio.h>
16358
16359 typedef $nvtype NV;
16360
16361 int
16362 main() {
16363   NV value = 2;
16364   int count = 1;
16365
16366   while(count < 256) {
16367     $volatile NV up = value + 1.0;
16368     $volatile NV negated = -value;
16369     $volatile NV down = negated - 1.0;
16370     $volatile NV got_up = up - value;
16371     int up_good = got_up == 1.0;
16372     int got_down = down - negated;
16373     int down_good = got_down == -1.0;
16374
16375     if (down_good != up_good) {
16376       fprintf(stderr,
16377               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16378               up_good, (double) got_up, down_good, (double) got_down,
16379               count, (double) value);
16380       return 1;
16381     }
16382     if (!up_good) {
16383       while (1) {
16384         if (count > 8) {
16385           count -= 8;
16386           fputs("256.0", stdout);
16387         } else {
16388           count--;
16389           fputs("2.0", stdout);
16390         }
16391         if (!count) {
16392           puts("");
16393           return 0;
16394         }
16395         fputs("*", stdout);
16396       }
16397     }
16398     value *= 2;
16399     ++count;
16400   }
16401   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16402           count, (double) value);
16403   return 1;
16404 }
16405 EOP
16406 set try
16407
16408 nv_overflows_integers_at='0'
16409 if eval $compile; then
16410     xxx="`$run ./try`"
16411     case "$?" in
16412         0)
16413             case "$xxx" in
16414                 2*)  cat >&4 <<EOM
16415 The largest integer your NVs can preserve is equal to $xxx
16416 EOM
16417                     nv_overflows_integers_at="$xxx"
16418                     ;;
16419                 *)  cat >&4 <<EOM
16420 Cannot determine the largest integer value your NVs can hold, unexpected output
16421 '$xxx'
16422 EOM
16423                     ;;
16424             esac
16425             ;;
16426         *)  cat >&4 <<EOM
16427 Cannot determine the largest integer value your NVs can hold
16428 EOM
16429             ;;
16430     esac
16431 fi
16432 $rm_try
16433
16434 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16435 : volatile so that the compiler has to store it out to memory.
16436 if test X"$d_volatile" = X"$define"; then
16437         volatile=volatile
16438 fi
16439 $cat <<EOP >try.c
16440 #include <stdio.h>
16441 #$i_stdlib I_STDLIB
16442 #ifdef I_STDLIB
16443 #include <stdlib.h>
16444 #endif
16445 #$i_string I_STRING
16446 #ifdef I_STRING
16447 #  include <string.h>
16448 #else
16449 #  include <strings.h>
16450 #endif
16451 #include <sys/types.h>
16452 #include <signal.h>
16453 #ifdef SIGFPE
16454 $volatile int bletched = 0;
16455 $signal_t blech(int s) { bletched = 1; }
16456 #endif
16457
16458 int checkit($nvtype d, char *where) {
16459     unsigned char *p = (char *)&d;
16460     unsigned char *end = p + sizeof(d);
16461     int fail = 0;
16462
16463     while (p < end)
16464         fail += *p++;
16465
16466     if (!fail)
16467         return 0;
16468
16469     p = (char *)&d;
16470     printf("No - %s: 0x", where);
16471     while (p < end)
16472         printf ("%02X", *p++);
16473     printf("\n");
16474     return 1;
16475 }
16476
16477 int main(int argc, char **argv) {
16478     $nvtype d = 0.0;
16479     int fail = 0;
16480     fail += checkit(d, "0.0");
16481
16482     /* The compiler shouldn't be assuming that bletched is 0  */
16483     d = bletched;
16484
16485     fail += checkit(d, "bleched");
16486
16487 #ifdef SIGFPE
16488     signal(SIGFPE, blech);
16489 #endif
16490
16491     /* Paranoia - the compiler should have no way of knowing that ANSI says
16492        that argv[argc] will always be NULL.  Actually, if it did assume this it
16493        would be buggy, as this is C and main() can be called from elsewhere in
16494        the program.  */
16495     d = argv[argc] ? 1 : 0;
16496
16497     if (d) {
16498         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16499     }
16500
16501     fail += checkit(d, "ternary");
16502
16503     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16504
16505     if (d != 0.0) {
16506         printf("No - memset doesn't give 0.0\n");
16507         /* This might just blow up:  */
16508         printf("(gives %g)\n", d);
16509         return 1;
16510     }
16511
16512 #ifdef SIGFPE
16513     if (bletched) {
16514         printf("No - something bleched\n");
16515         return 1;
16516     }
16517 #endif
16518     if (fail) {
16519       printf("No - %d fail(s)\n", fail);
16520       return 1;
16521     }
16522     printf("Yes\n");
16523     return 0;
16524 }
16525 EOP
16526 set try
16527
16528 d_nv_zero_is_allbits_zero="$undef"
16529 if eval $compile; then
16530     xxx="`$run ./try`"
16531     case "$?" in
16532         0)
16533             case "$xxx" in
16534                 Yes)  cat >&4 <<EOM
16535 0.0 is represented as all bits zero in memory
16536 EOM
16537                     d_nv_zero_is_allbits_zero="$define"
16538                     ;;
16539                 *)  cat >&4 <<EOM
16540 0.0 is not represented as all bits zero in memory
16541 EOM
16542                     d_nv_zero_is_allbits_zero="$undef"
16543                     ;;
16544             esac
16545             ;;
16546         *)  cat >&4 <<EOM
16547 0.0 is not represented as all bits zero in memory
16548 EOM
16549             d_nv_zero_is_allbits_zero="$undef"
16550             ;;
16551     esac
16552 fi
16553 $rm_try
16554
16555 : check for off64_t
16556 echo " "
16557 echo "Checking to see if you have off64_t..." >&4
16558 $cat >try.c <<EOCP
16559 #include <sys/types.h>
16560 #include <unistd.h>
16561 int main() { off64_t x = 7; }
16562 EOCP
16563 set try
16564 if eval $compile; then
16565         val="$define"
16566         echo "You have off64_t."
16567 else
16568         val="$undef"
16569         echo "You do not have off64_t."
16570         case "$lseeksize" in
16571         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16572         esac
16573 fi
16574 $rm_try
16575 set d_off64_t
16576 eval $setvar
16577
16578 : how to create joinable pthreads
16579 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16580         echo " "
16581         echo "Checking what constant to use for creating joinable pthreads..." >&4
16582         $cat >try.c <<'EOCP'
16583 #include <pthread.h>
16584 int main() {
16585     int detachstate = JOINABLE;
16586 }
16587 EOCP
16588         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16589         if eval $compile; then
16590                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16591                 val="$undef" # Yes, undef.
16592                 set d_old_pthread_create_joinable
16593                 eval $setvar
16594                 val=""
16595                 set old_pthread_create_joinable
16596                 eval $setvar
16597         else
16598                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16599                 if eval $compile; then
16600                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16601                         val="$define"
16602                         set d_old_pthread_create_joinable
16603                         eval $setvar
16604                         val=PTHREAD_CREATE_UNDETACHED
16605                         set old_pthread_create_joinable
16606                         eval $setvar
16607                 else
16608                         set try -DJOINABLE=__UNDETACHED
16609                         if eval $compile; then
16610                                 echo "You seem to use __UNDETACHED." >&4
16611                                 val="$define"
16612                                 set d_old_pthread_create_joinable
16613                                 eval $setvar
16614                                 val=__UNDETACHED
16615                                 set old_pthread_create_joinable
16616                                 eval $setvar
16617                         else
16618                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16619                                 val="$define"
16620                                 set d_old_pthread_create_joinable
16621                                 eval $setvar
16622                                 val=0
16623                                 set old_pthread_create_joinable
16624                                 eval $setvar
16625                         fi
16626                 fi
16627         fi
16628         $rm_try
16629 else
16630     d_old_pthread_create_joinable="$undef"
16631     old_pthread_create_joinable=""
16632 fi
16633
16634 : see if pause exists
16635 set pause d_pause
16636 eval $inlibc
16637
16638 : see if poll exists
16639 set poll d_poll
16640 eval $inlibc
16641
16642 : see if prctl exists
16643 set prctl d_prctl
16644 eval $inlibc
16645
16646 : see if prctl supports PR_SET_NAME
16647 d_prctl_set_name=$undef
16648 case $d_prctl in
16649     $define)
16650         $cat >try.c <<EOM
16651 #ifdef __ANDROID__
16652 #include <unistd.h>
16653 #endif
16654 #include <sys/prctl.h>
16655
16656 int main (int argc, char *argv[])
16657 {
16658     return (prctl (PR_SET_NAME, "Test"));
16659     } /* main */
16660 EOM
16661         set try
16662         if eval $compile_ok && $run ./try; then
16663             echo "Your prctl (PR_SET_NAME, ...) works"
16664             d_prctl_set_name=$define
16665             fi
16666         $rm_try
16667         ;;
16668     esac
16669
16670 : see if readlink exists
16671 set readlink d_readlink
16672 eval $inlibc
16673
16674 : Check if exe is symlink to abs path of executing program
16675 echo " "
16676 procselfexe=''
16677 val="$undef"
16678 case "$d_readlink" in
16679     "$define")
16680         : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
16681         : more tidy to avoid an extra level of symlink
16682         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
16683         while test $# -gt 0; do
16684             type=$1; try=$2
16685             shift; shift
16686             if $issymlink $try; then
16687                 $ls -l $try > reflect
16688                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16689                     echo "You have $type-like $try."
16690                     procselfexe='"'$try'"'
16691                     val="$define"
16692                     : This will break out of the loop
16693                     set X; shift
16694                 fi
16695             fi
16696         done
16697         ;;
16698 esac
16699 $rm -f reflect
16700 set d_procselfexe
16701 eval $setvar
16702
16703 : backward compatibility for d_hvfork
16704 if test X$d_hvfork != X; then
16705         d_vfork="$d_hvfork"
16706         d_hvfork=''
16707 fi
16708 : see if there is a vfork
16709 val=''
16710 set vfork val
16711 eval $inlibc
16712
16713 d_pseudofork=$undef
16714
16715 : Ok, but do we want to use it. vfork is reportedly unreliable in
16716 : perl on Solaris 2.x, and probably elsewhere.
16717 case "$val" in
16718 $define)
16719         echo " "
16720         case "$usevfork" in
16721         false) dflt='n';;
16722         *) dflt='y';;
16723         esac
16724         cat <<'EOM'
16725
16726 Perl can only use a vfork() that doesn't suffer from strict
16727 restrictions on calling functions or modifying global data in
16728 the child.  For example, glibc-2.1 contains such a vfork()
16729 that is unsuitable.  If your system provides a proper fork()
16730 call, chances are that you do NOT want perl to use vfork().
16731
16732 EOM
16733         rp="Do you still want to use vfork()?"
16734         . ./myread
16735         case "$ans" in
16736         y|Y) ;;
16737         *)
16738                 echo "Ok, we won't use vfork()."
16739                 val="$undef"
16740                 ;;
16741         esac
16742         ;;
16743 esac
16744 set d_vfork
16745 eval $setvar
16746 case "$d_vfork" in
16747 $define) usevfork='true';;
16748 *) usevfork='false';;
16749 esac
16750
16751 : see whether the pthread_atfork exists
16752 $cat >try.c <<EOP
16753 #include <pthread.h>
16754 #include <stdio.h>
16755 int main() {
16756 #ifdef  PTHREAD_ATFORK
16757         pthread_atfork(NULL,NULL,NULL);
16758 #endif
16759 }
16760 EOP
16761
16762 : see if pthread_atfork exists
16763 set try -DPTHREAD_ATFORK
16764 if eval $compile; then
16765     val="$define"
16766 else
16767     val="$undef"
16768 fi
16769 case "$usethreads" in
16770 $define)
16771         case "$val" in
16772         $define) echo 'pthread_atfork found.' >&4        ;;
16773         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16774         esac
16775 esac
16776 set d_pthread_atfork
16777 eval $setvar
16778
16779 : see if pthread_attr_setscope exists
16780 set pthread_attr_setscope d_pthread_attr_setscope
16781 eval $inlibc
16782
16783 : see whether the various POSIXish _yields exist
16784 $cat >try.c <<EOP
16785 #include <pthread.h>
16786 #include <stdio.h>
16787 int main() {
16788 #ifdef SCHED_YIELD
16789         sched_yield();
16790 #else
16791 #ifdef PTHREAD_YIELD
16792         pthread_yield();
16793 #else
16794 #ifdef PTHREAD_YIELD_NULL
16795         pthread_yield(NULL);
16796 #endif
16797 #endif
16798 #endif
16799 }
16800 EOP
16801 : see if sched_yield exists
16802 set try -DSCHED_YIELD
16803 if eval $compile; then
16804     val="$define"
16805     sched_yield='sched_yield()'
16806 else
16807     val="$undef"
16808 fi
16809 case "$usethreads" in
16810 $define)
16811         case "$val" in
16812         $define) echo 'sched_yield() found.' >&4        ;;
16813         *)       echo 'sched_yield() NOT found.' >&4    ;;
16814         esac
16815 esac
16816 set d_sched_yield
16817 eval $setvar
16818
16819 : see if pthread_yield exists
16820 set try -DPTHREAD_YIELD
16821 if eval $compile; then
16822     val="$define"
16823     case "$sched_yield" in
16824     '') sched_yield='pthread_yield()' ;;
16825     esac
16826 else
16827     set try -DPTHREAD_YIELD_NULL
16828     if eval $compile; then
16829         val="$define"
16830         case "$sched_yield" in
16831         '') sched_yield='pthread_yield(NULL)' ;;
16832         esac
16833     else
16834         val="$undef"
16835     fi
16836 fi
16837 case "$usethreads" in
16838 $define)
16839         case "$val" in
16840         $define) echo 'pthread_yield() found.' >&4      ;;
16841         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16842         esac
16843         ;;
16844 esac
16845 set d_pthread_yield
16846 eval $setvar
16847 case "$sched_yield" in
16848 '') sched_yield=undef ;;
16849 esac
16850 $rm_try
16851
16852 : check for ptrdiff_t
16853 echo " "
16854 echo "Checking to see if you have ptrdiff_t..." >&4
16855 $cat >try.c <<EOCP
16856 #include <stddef.h>
16857 int main() { ptrdiff_t x = 7; }
16858 EOCP
16859 set try
16860 if eval $compile; then
16861         val="$define"
16862         echo "You have ptrdiff_t."
16863 else
16864         val="$undef"
16865         echo "You do not have ptrdiff_t."
16866 fi
16867 $rm_try
16868 set d_ptrdiff_t
16869 eval $setvar
16870
16871 : see if random_r exists
16872 set random_r d_random_r
16873 eval $inlibc
16874 case "$d_random_r" in
16875 "$define")
16876         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16877         case "$d_random_r_proto:$usethreads" in
16878         ":define")      d_random_r_proto=define
16879                 set d_random_r_proto random_r $hdrs
16880                 eval $hasproto ;;
16881         *)      ;;
16882         esac
16883         case "$d_random_r_proto" in
16884         define)
16885         case "$random_r_proto" in
16886         ''|0) try='int random_r(int*, struct random_data*);'
16887         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16888         esac
16889         case "$random_r_proto" in
16890         ''|0) try='int random_r(long*, struct random_data*);'
16891         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16892         esac
16893         case "$random_r_proto" in
16894         ''|0) try='int random_r(struct random_data*, int32_t*);'
16895         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16896         esac
16897         case "$random_r_proto" in
16898         ''|0)   d_random_r=undef
16899                 random_r_proto=0
16900                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16901         * )     case "$random_r_proto" in
16902                 REENTRANT_PROTO*) ;;
16903                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16904                 esac
16905                 echo "Prototype: $try" ;;
16906         esac
16907         ;;
16908         *)      case "$usethreads" in
16909                 define) echo "random_r has no prototype, not using it." >&4 ;;
16910                 esac
16911                 d_random_r=undef
16912                 random_r_proto=0
16913                 ;;
16914         esac
16915         ;;
16916 *)      random_r_proto=0
16917         ;;
16918 esac
16919
16920 : see if readdir and friends exist
16921 set readdir d_readdir
16922 eval $inlibc
16923 set seekdir d_seekdir
16924 eval $inlibc
16925 set telldir d_telldir
16926 eval $inlibc
16927 set rewinddir d_rewinddir
16928 eval $inlibc
16929
16930 : see if readdir64_r exists
16931 set readdir64_r d_readdir64_r
16932 eval $inlibc
16933 case "$d_readdir64_r" in
16934 "$define")
16935         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16936         case "$d_readdir64_r_proto:$usethreads" in
16937         ":define")      d_readdir64_r_proto=define
16938                 set d_readdir64_r_proto readdir64_r $hdrs
16939                 eval $hasproto ;;
16940         *)      ;;
16941         esac
16942         case "$d_readdir64_r_proto" in
16943         define)
16944         case "$readdir64_r_proto" in
16945         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16946         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16947         esac
16948         case "$readdir64_r_proto" in
16949         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16950         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16951         esac
16952         case "$readdir64_r_proto" in
16953         ''|0)   d_readdir64_r=undef
16954                 readdir64_r_proto=0
16955                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16956         * )     case "$readdir64_r_proto" in
16957                 REENTRANT_PROTO*) ;;
16958                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16959                 esac
16960                 echo "Prototype: $try" ;;
16961         esac
16962         ;;
16963         *)      case "$usethreads" in
16964                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16965                 esac
16966                 d_readdir64_r=undef
16967                 readdir64_r_proto=0
16968                 ;;
16969         esac
16970         ;;
16971 *)      readdir64_r_proto=0
16972         ;;
16973 esac
16974
16975 : see if readdir_r exists
16976 set readdir_r d_readdir_r
16977 eval $inlibc
16978 case "$d_readdir_r" in
16979 "$define")
16980         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16981         case "$d_readdir_r_proto:$usethreads" in
16982         ":define")      d_readdir_r_proto=define
16983                 set d_readdir_r_proto readdir_r $hdrs
16984                 eval $hasproto ;;
16985         *)      ;;
16986         esac
16987         case "$d_readdir_r_proto" in
16988         define)
16989         case "$readdir_r_proto" in
16990         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16991         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16992         esac
16993         case "$readdir_r_proto" in
16994         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16995         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16996         esac
16997         case "$readdir_r_proto" in
16998         ''|0)   d_readdir_r=undef
16999                 readdir_r_proto=0
17000                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17001         * )     case "$readdir_r_proto" in
17002                 REENTRANT_PROTO*) ;;
17003                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17004                 esac
17005                 echo "Prototype: $try" ;;
17006         esac
17007         ;;
17008         *)      case "$usethreads" in
17009                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17010                 esac
17011                 d_readdir_r=undef
17012                 readdir_r_proto=0
17013                 ;;
17014         esac
17015         ;;
17016 *)      readdir_r_proto=0
17017         ;;
17018 esac
17019
17020 : see if readv exists
17021 set readv d_readv
17022 eval $inlibc
17023
17024 : see if recvmsg exists
17025 set recvmsg d_recvmsg
17026 eval $inlibc
17027
17028 : see if rename exists
17029 set rename d_rename
17030 eval $inlibc
17031
17032 : see if rmdir exists
17033 set rmdir d_rmdir
17034 eval $inlibc
17035
17036 : see if memory.h is available.
17037 val=''
17038 set memory.h val
17039 eval $inhdr
17040
17041 : See if it conflicts with string.h
17042 case "$val" in
17043 $define)
17044         case "$strings" in
17045         '') ;;
17046         *)
17047                 $cppstdin $cppflags $cppminus < $strings > mem.h
17048                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
17049                         echo " "
17050                         echo "We won't be including <memory.h>."
17051                         val="$undef"
17052                 fi
17053                 $rm -f mem.h
17054                 ;;
17055         esac
17056 esac
17057 set i_memory
17058 eval $setvar
17059
17060 : can bcopy handle overlapping blocks?
17061 echo " "
17062 val="$undef"
17063 case "$d_memmove" in
17064 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
17065 *)      case "$d_bcopy" in
17066         "$define")
17067                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
17068                 $cat >try.c <<EOCP
17069 #$i_memory I_MEMORY
17070 #$i_stdlib I_STDLIB
17071 #$i_string I_STRING
17072 #$i_unistd I_UNISTD
17073 EOCP
17074         $cat >>try.c <<'EOCP'
17075 #include <stdio.h>
17076 #ifdef I_MEMORY
17077 #  include <memory.h>
17078 #endif
17079 #ifdef I_STDLIB
17080 #  include <stdlib.h>
17081 #endif
17082 #ifdef I_STRING
17083 #  include <string.h>
17084 #else
17085 #  include <strings.h>
17086 #endif
17087 #ifdef I_UNISTD
17088 #  include <unistd.h>  /* Needed for NetBSD */
17089 #endif
17090 int main()
17091 {
17092 char buf[128], abc[128];
17093 char *b;
17094 int len;
17095 int off;
17096 int align;
17097
17098 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17099    try to store the string in read-only memory. */
17100 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
17101
17102 for (align = 7; align >= 0; align--) {
17103         for (len = 36; len; len--) {
17104                 b = buf+align;
17105                 bcopy(abc, b, len);
17106                 for (off = 1; off <= len; off++) {
17107                         bcopy(b, b+off, len);
17108                         bcopy(b+off, b, len);
17109                         if (bcmp(b, abc, len))
17110                                 exit(1);
17111                 }
17112         }
17113 }
17114 exit(0);
17115 }
17116 EOCP
17117                 set try
17118                 if eval $compile_ok; then
17119                         if $run ./try 2>/dev/null; then
17120                                 echo "Yes, it can."
17121                                 val="$define"
17122                         else
17123                                 echo "It can't, sorry."
17124                         fi
17125                 else
17126                         echo "(I can't compile the test program, so we'll assume not...)"
17127                 fi
17128                 ;;
17129         esac
17130         $rm_try
17131         ;;
17132 esac
17133 set d_safebcpy
17134 eval $setvar
17135
17136 : can memcpy handle overlapping blocks?
17137 echo " "
17138 val="$undef"
17139 case "$d_memmove" in
17140 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
17141 *)      case "$d_memcpy" in
17142         "$define")
17143                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
17144                 $cat >try.c <<EOCP
17145 #$i_memory I_MEMORY
17146 #$i_stdlib I_STDLIB
17147 #$i_string I_STRING
17148 #$i_unistd I_UNISTD
17149 EOCP
17150         $cat >>try.c <<'EOCP'
17151 #include <stdio.h>
17152 #ifdef I_MEMORY
17153 #  include <memory.h>
17154 #endif
17155 #ifdef I_STDLIB
17156 #  include <stdlib.h>
17157 #endif
17158 #ifdef I_STRING
17159 #  include <string.h>
17160 #else
17161 #  include <strings.h>
17162 #endif
17163 #ifdef I_UNISTD
17164 #  include <unistd.h>  /* Needed for NetBSD */
17165 #endif
17166 int main()
17167 {
17168 char buf[128], abc[128];
17169 char *b;
17170 int len;
17171 int off;
17172 int align;
17173
17174 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17175    try to store the string in read-only memory. */
17176 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
17177
17178 for (align = 7; align >= 0; align--) {
17179         for (len = 36; len; len--) {
17180                 b = buf+align;
17181                 memcpy(b, abc, len);
17182                 for (off = 1; off <= len; off++) {
17183                         memcpy(b+off, b, len);
17184                         memcpy(b, b+off, len);
17185                         if (memcmp(b, abc, len))
17186                                 exit(1);
17187                 }
17188         }
17189 }
17190 exit(0);
17191 }
17192 EOCP
17193                 set try
17194                 if eval $compile_ok; then
17195                         if $run ./try 2>/dev/null; then
17196                                 echo "Yes, it can."
17197                                 val="$define"
17198                         else
17199                                 echo "It can't, sorry."
17200                         fi
17201                 else
17202                         echo "(I can't compile the test program, so we'll assume not...)"
17203                 fi
17204                 ;;
17205         esac
17206         $rm_try
17207         ;;
17208 esac
17209 set d_safemcpy
17210 eval $setvar
17211
17212 : can memcmp be trusted to compare relative magnitude?
17213 val="$undef"
17214 case "$d_memcmp" in
17215 "$define")
17216         echo " "
17217         echo "Checking if your memcmp() can compare relative magnitude..." >&4
17218         $cat >try.c <<EOCP
17219 #$i_memory I_MEMORY
17220 #$i_stdlib I_STDLIB
17221 #$i_string I_STRING
17222 #$i_unistd I_UNISTD
17223 EOCP
17224         $cat >>try.c <<'EOCP'
17225 #include <stdio.h>
17226 #ifdef I_MEMORY
17227 #  include <memory.h>
17228 #endif
17229 #ifdef I_STDLIB
17230 #  include <stdlib.h>
17231 #endif
17232 #ifdef I_STRING
17233 #  include <string.h>
17234 #else
17235 #  include <strings.h>
17236 #endif
17237 #ifdef I_UNISTD
17238 #  include <unistd.h>  /* Needed for NetBSD */
17239 #endif
17240 int main()
17241 {
17242 char a = -1;
17243 char b = 0;
17244 if ((a < b) && memcmp(&a, &b, 1) < 0)
17245         exit(1);
17246 exit(0);
17247 }
17248 EOCP
17249         set try
17250         if eval $compile_ok; then
17251                 if $run ./try 2>/dev/null; then
17252                         echo "Yes, it can."
17253                         val="$define"
17254                 else
17255                         echo "No, it can't (it uses signed chars)."
17256                 fi
17257         else
17258                 echo "(I can't compile the test program, so we'll assume not...)"
17259         fi
17260         ;;
17261 esac
17262 $rm_try
17263 set d_sanemcmp
17264 eval $setvar
17265
17266 : see if prototype for sbrk is available
17267 echo " "
17268 set d_sbrkproto sbrk $i_unistd unistd.h
17269 eval $hasproto
17270
17271 : see if select exists
17272 set select d_select
17273 eval $inlibc
17274
17275 : see if semctl exists
17276 set semctl d_semctl
17277 eval $inlibc
17278
17279 : see if semget exists
17280 set semget d_semget
17281 eval $inlibc
17282
17283 : see if semop exists
17284 set semop d_semop
17285 eval $inlibc
17286
17287 : see how much of the 'sem*(2)' library is present.
17288 h_sem=true
17289 echo " "
17290 case "$d_semctl$d_semget$d_semop" in
17291 *"$undef"*) h_sem=false;;
17292 esac
17293 case "$osname" in
17294 freebsd)
17295     case "`ipcs 2>&1`" in
17296     "SVID messages"*"not configured"*)
17297         echo "Your $osname does not have the sem*(2) configured." >&4
17298         h_sem=false
17299         val="$undef"
17300         set semctl d_semctl
17301         eval $setvar
17302         set semget d_semget
17303         eval $setvar
17304         set semop d_semop
17305         eval $setvar
17306         ;;
17307     esac
17308     ;;
17309 esac
17310 : we could also check for sys/ipc.h ...
17311 if $h_sem && $test `./findhdr sys/sem.h`; then
17312         echo "You have the full sem*(2) library." >&4
17313         val="$define"
17314 else
17315         echo "You don't have the full sem*(2) library." >&4
17316         val="$undef"
17317 fi
17318 set d_sem
17319 eval $setvar
17320
17321 : see whether sys/sem.h defines union semun
17322 echo " "
17323 $cat > try.c <<'END'
17324 #include <sys/types.h>
17325 #include <sys/ipc.h>
17326 #include <sys/sem.h>
17327 int main () { union semun semun; semun.buf = 0; }
17328 END
17329 set try
17330 if eval $compile; then
17331     echo "You have union semun in <sys/sem.h>." >&4
17332     val="$define"
17333 else
17334     echo "You do not have union semun in <sys/sem.h>." >&4
17335     val="$undef"
17336 fi
17337 $rm_try
17338 set d_union_semun
17339 eval $setvar
17340
17341 : see how to do semctl IPC_STAT
17342 case "$d_sem" in
17343 $define)
17344     echo " "
17345     $cat > tryh.h <<END
17346 #ifndef S_IRUSR
17347 #   ifdef S_IREAD
17348 #       define S_IRUSR S_IREAD
17349 #       define S_IWUSR S_IWRITE
17350 #       define S_IXUSR S_IEXEC
17351 #   else
17352 #       define S_IRUSR 0400
17353 #       define S_IWUSR 0200
17354 #       define S_IXUSR 0100
17355 #   endif
17356 #   define S_IRGRP (S_IRUSR>>3)
17357 #   define S_IWGRP (S_IWUSR>>3)
17358 #   define S_IXGRP (S_IXUSR>>3)
17359 #   define S_IROTH (S_IRUSR>>6)
17360 #   define S_IWOTH (S_IWUSR>>6)
17361 #   define S_IXOTH (S_IXUSR>>6)
17362 #endif
17363 #ifndef S_IRWXU
17364 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17365 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17366 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17367 #endif
17368 END
17369     : see whether semctl IPC_STAT can use union semun
17370     case "$d_semctl_semun" in
17371     '')
17372       val="$undef"
17373       $cat > try.c <<END
17374 #include <sys/types.h>
17375 #include <sys/ipc.h>
17376 #include <sys/sem.h>
17377 #include <sys/stat.h>
17378 #include <stdio.h>
17379 #include <errno.h>
17380 #include "tryh.h"
17381 #ifndef errno
17382 extern int errno;
17383 #endif
17384 #$d_union_semun HAS_UNION_SEMUN
17385 int main() {
17386     union semun
17387 #ifndef HAS_UNION_SEMUN
17388     {
17389         int val;
17390         struct semid_ds *buf;
17391         unsigned short *array;
17392     }
17393 #endif
17394     arg;
17395     int sem, st;
17396
17397 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17398     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17399     if (sem > -1) {
17400         struct semid_ds argbuf;
17401         arg.buf = &argbuf;
17402 #       ifdef IPC_STAT
17403         st = semctl(sem, 0, IPC_STAT, arg);
17404         if (st == 0)
17405             printf("semun\n");
17406         else
17407 #       endif /* IPC_STAT */
17408             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17409 #       ifdef IPC_RMID
17410         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17411 #       endif /* IPC_RMID */
17412             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17413     } else
17414 #endif /* IPC_PRIVATE && ... */
17415         printf("semget failed: errno = %d\n", errno);
17416   return 0;
17417 }
17418 END
17419       set try
17420       if eval $compile; then
17421           xxx=`$run ./try`
17422           case "$xxx" in
17423           semun) val="$define" ;;
17424           esac
17425       fi
17426       $rm_try
17427       set d_semctl_semun
17428       eval $setvar
17429       ;;
17430     esac
17431     case "$d_semctl_semun" in
17432     $define)
17433         echo "You can use union semun for semctl IPC_STAT." >&4
17434         also='also'
17435         ;;
17436     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17437         also=''
17438         ;;
17439     esac
17440
17441     : see whether semctl IPC_STAT can use struct semid_ds pointer
17442     case "$d_semctl_semid_ds" in
17443     '')
17444       val="$undef"
17445       $cat > try.c <<'END'
17446 #include <sys/types.h>
17447 #include <sys/ipc.h>
17448 #include <sys/sem.h>
17449 #include <sys/stat.h>
17450 #include "tryh.h"
17451 #include <stdio.h>
17452 #include <errno.h>
17453 #ifndef errno
17454 extern int errno;
17455 #endif
17456 int main() {
17457     struct semid_ds arg;
17458     int sem, st;
17459
17460 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17461     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17462     if (sem > -1) {
17463 #       ifdef IPC_STAT
17464         st = semctl(sem, 0, IPC_STAT, &arg);
17465         if (st == 0)
17466             printf("semid_ds\n");
17467         else
17468 #       endif /* IPC_STAT */
17469             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17470 #       ifdef IPC_RMID
17471         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
17472 #       endif /* IPC_RMID */
17473             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17474     } else
17475 #endif /* IPC_PRIVATE && ... */
17476         printf("semget failed: errno = %d\n", errno);
17477
17478     return 0;
17479 }
17480 END
17481       set try
17482       if eval $compile; then
17483           xxx=`$run ./try`
17484           case "$xxx" in
17485           semid_ds) val="$define" ;;
17486           esac
17487       fi
17488       $rm_try
17489       set d_semctl_semid_ds
17490       eval $setvar
17491       ;;
17492     esac
17493     case "$d_semctl_semid_ds" in
17494     $define)
17495         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17496         ;;
17497     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17498         ;;
17499     esac
17500     ;;
17501 *)  val="$undef"
17502
17503     # We do not have the full sem*(2) library, so assume we can not
17504     # use either.
17505
17506     set d_semctl_semun
17507     eval $setvar
17508
17509     set d_semctl_semid_ds
17510     eval $setvar
17511     ;;
17512 esac
17513 $rm_try tryh.h
17514
17515 : see if sendmsg exists
17516 set sendmsg d_sendmsg
17517 eval $inlibc
17518
17519 : see if setegid exists
17520 set setegid d_setegid
17521 eval $inlibc
17522
17523 : see if seteuid exists
17524 set seteuid d_seteuid
17525 eval $inlibc
17526
17527 : see if setgrent exists
17528 set setgrent d_setgrent
17529 eval $inlibc
17530
17531 : see if setgrent_r exists
17532 set setgrent_r d_setgrent_r
17533 eval $inlibc
17534 case "$d_setgrent_r" in
17535 "$define")
17536         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17537         case "$d_setgrent_r_proto:$usethreads" in
17538         ":define")      d_setgrent_r_proto=define
17539                 set d_setgrent_r_proto setgrent_r $hdrs
17540                 eval $hasproto ;;
17541         *)      ;;
17542         esac
17543         case "$d_setgrent_r_proto" in
17544         define)
17545         case "$setgrent_r_proto" in
17546         ''|0) try='int setgrent_r(FILE**);'
17547         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17548         esac
17549         case "$setgrent_r_proto" in
17550         ''|0) try='void setgrent_r(FILE**);'
17551         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17552         esac
17553         case "$setgrent_r_proto" in
17554         ''|0)   d_setgrent_r=undef
17555                 setgrent_r_proto=0
17556                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17557         * )     case "$setgrent_r_proto" in
17558                 REENTRANT_PROTO*) ;;
17559                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17560                 esac
17561                 echo "Prototype: $try" ;;
17562         esac
17563         ;;
17564         *)      case "$usethreads" in
17565                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17566                 esac
17567                 d_setgrent_r=undef
17568                 setgrent_r_proto=0
17569                 ;;
17570         esac
17571         ;;
17572 *)      setgrent_r_proto=0
17573         ;;
17574 esac
17575
17576 : see if sethostent exists
17577 set sethostent d_sethent
17578 eval $inlibc
17579
17580 : see if sethostent_r exists
17581 set sethostent_r d_sethostent_r
17582 eval $inlibc
17583 case "$d_sethostent_r" in
17584 "$define")
17585         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17586         case "$d_sethostent_r_proto:$usethreads" in
17587         ":define")      d_sethostent_r_proto=define
17588                 set d_sethostent_r_proto sethostent_r $hdrs
17589                 eval $hasproto ;;
17590         *)      ;;
17591         esac
17592         case "$d_sethostent_r_proto" in
17593         define)
17594         case "$sethostent_r_proto" in
17595         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17596         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17597         esac
17598         case "$sethostent_r_proto" in
17599         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17600         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17601         esac
17602         case "$sethostent_r_proto" in
17603         ''|0)   d_sethostent_r=undef
17604                 sethostent_r_proto=0
17605                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17606         * )     case "$sethostent_r_proto" in
17607                 REENTRANT_PROTO*) ;;
17608                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17609                 esac
17610                 echo "Prototype: $try" ;;
17611         esac
17612         ;;
17613         *)      case "$usethreads" in
17614                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17615                 esac
17616                 d_sethostent_r=undef
17617                 sethostent_r_proto=0
17618                 ;;
17619         esac
17620         ;;
17621 *)      sethostent_r_proto=0
17622         ;;
17623 esac
17624
17625 : see if setitimer exists
17626 set setitimer d_setitimer
17627 eval $inlibc
17628
17629 : see if setlinebuf exists
17630 set setlinebuf d_setlinebuf
17631 eval $inlibc
17632
17633 : see if setlocale exists
17634 set setlocale d_setlocale
17635 eval $inlibc
17636
17637 : see if locale.h is available
17638 set locale.h i_locale
17639 eval $inhdr
17640
17641 : see if setlocale_r exists
17642 set setlocale_r d_setlocale_r
17643 eval $inlibc
17644 case "$d_setlocale_r" in
17645 "$define")
17646         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17647         case "$d_setlocale_r_proto:$usethreads" in
17648         ":define")      d_setlocale_r_proto=define
17649                 set d_setlocale_r_proto setlocale_r $hdrs
17650                 eval $hasproto ;;
17651         *)      ;;
17652         esac
17653         case "$d_setlocale_r_proto" in
17654         define)
17655         case "$setlocale_r_proto" in
17656         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17657         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17658         esac
17659         case "$setlocale_r_proto" in
17660         ''|0)   d_setlocale_r=undef
17661                 setlocale_r_proto=0
17662                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17663         * )     case "$setlocale_r_proto" in
17664                 REENTRANT_PROTO*) ;;
17665                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17666                 esac
17667                 echo "Prototype: $try" ;;
17668         esac
17669         ;;
17670         *)      case "$usethreads" in
17671                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17672                 esac
17673                 d_setlocale_r=undef
17674                 setlocale_r_proto=0
17675                 ;;
17676         esac
17677         ;;
17678 *)      setlocale_r_proto=0
17679         ;;
17680 esac
17681
17682 : see if setnetent exists
17683 set setnetent d_setnent
17684 eval $inlibc
17685
17686 : see if setnetent_r exists
17687 set setnetent_r d_setnetent_r
17688 eval $inlibc
17689 case "$d_setnetent_r" in
17690 "$define")
17691         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17692         case "$d_setnetent_r_proto:$usethreads" in
17693         ":define")      d_setnetent_r_proto=define
17694                 set d_setnetent_r_proto setnetent_r $hdrs
17695                 eval $hasproto ;;
17696         *)      ;;
17697         esac
17698         case "$d_setnetent_r_proto" in
17699         define)
17700         case "$setnetent_r_proto" in
17701         ''|0) try='int setnetent_r(int, struct netent_data*);'
17702         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17703         esac
17704         case "$setnetent_r_proto" in
17705         ''|0) try='void setnetent_r(int, struct netent_data*);'
17706         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17707         esac
17708         case "$setnetent_r_proto" in
17709         ''|0)   d_setnetent_r=undef
17710                 setnetent_r_proto=0
17711                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17712         * )     case "$setnetent_r_proto" in
17713                 REENTRANT_PROTO*) ;;
17714                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17715                 esac
17716                 echo "Prototype: $try" ;;
17717         esac
17718         ;;
17719         *)      case "$usethreads" in
17720                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17721                 esac
17722                 d_setnetent_r=undef
17723                 setnetent_r_proto=0
17724                 ;;
17725         esac
17726         ;;
17727 *)      setnetent_r_proto=0
17728         ;;
17729 esac
17730
17731 : see if setprotoent exists
17732 set setprotoent d_setpent
17733 eval $inlibc
17734
17735 : see if setpgid exists
17736 set setpgid d_setpgid
17737 eval $inlibc
17738
17739 : see if setpgrp2 exists
17740 set setpgrp2 d_setpgrp2
17741 eval $inlibc
17742
17743 : see if setpriority exists
17744 set setpriority d_setprior
17745 eval $inlibc
17746
17747 : see if setproctitle exists
17748 set setproctitle d_setproctitle
17749 eval $inlibc
17750
17751 : see if setprotoent_r exists
17752 set setprotoent_r d_setprotoent_r
17753 eval $inlibc
17754 case "$d_setprotoent_r" in
17755 "$define")
17756         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17757         case "$d_setprotoent_r_proto:$usethreads" in
17758         ":define")      d_setprotoent_r_proto=define
17759                 set d_setprotoent_r_proto setprotoent_r $hdrs
17760                 eval $hasproto ;;
17761         *)      ;;
17762         esac
17763         case "$d_setprotoent_r_proto" in
17764         define)
17765         case "$setprotoent_r_proto" in
17766         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17767         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17768         esac
17769         case "$setprotoent_r_proto" in
17770         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17771         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17772         esac
17773         case "$setprotoent_r_proto" in
17774         ''|0)   d_setprotoent_r=undef
17775                 setprotoent_r_proto=0
17776                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17777         * )     case "$setprotoent_r_proto" in
17778                 REENTRANT_PROTO*) ;;
17779                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17780                 esac
17781                 echo "Prototype: $try" ;;
17782         esac
17783         ;;
17784         *)      case "$usethreads" in
17785                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17786                 esac
17787                 d_setprotoent_r=undef
17788                 setprotoent_r_proto=0
17789                 ;;
17790         esac
17791         ;;
17792 *)      setprotoent_r_proto=0
17793         ;;
17794 esac
17795
17796 : see if setpwent exists
17797 set setpwent d_setpwent
17798 eval $inlibc
17799
17800 : see if setpwent_r exists
17801 set setpwent_r d_setpwent_r
17802 eval $inlibc
17803 case "$d_setpwent_r" in
17804 "$define")
17805         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17806         case "$d_setpwent_r_proto:$usethreads" in
17807         ":define")      d_setpwent_r_proto=define
17808                 set d_setpwent_r_proto setpwent_r $hdrs
17809                 eval $hasproto ;;
17810         *)      ;;
17811         esac
17812         case "$d_setpwent_r_proto" in
17813         define)
17814         case "$setpwent_r_proto" in
17815         ''|0) try='int setpwent_r(FILE**);'
17816         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17817         esac
17818         case "$setpwent_r_proto" in
17819         ''|0) try='void setpwent_r(FILE**);'
17820         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17821         esac
17822         case "$setpwent_r_proto" in
17823         ''|0)   d_setpwent_r=undef
17824                 setpwent_r_proto=0
17825                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17826         * )     case "$setpwent_r_proto" in
17827                 REENTRANT_PROTO*) ;;
17828                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17829                 esac
17830                 echo "Prototype: $try" ;;
17831         esac
17832         ;;
17833         *)      case "$usethreads" in
17834                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17835                 esac
17836                 d_setpwent_r=undef
17837                 setpwent_r_proto=0
17838                 ;;
17839         esac
17840         ;;
17841 *)      setpwent_r_proto=0
17842         ;;
17843 esac
17844
17845 : see if setregid exists
17846 set setregid d_setregid
17847 eval $inlibc
17848 set setresgid d_setresgid
17849 eval $inlibc
17850
17851 : see if setreuid exists
17852 set setreuid d_setreuid
17853 eval $inlibc
17854 set setresuid d_setresuid
17855 eval $inlibc
17856
17857 : see if setrgid exists
17858 set setrgid d_setrgid
17859 eval $inlibc
17860
17861 : see if setruid exists
17862 set setruid d_setruid
17863 eval $inlibc
17864
17865 : see if setservent exists
17866 set setservent d_setsent
17867 eval $inlibc
17868
17869 : see if setservent_r exists
17870 set setservent_r d_setservent_r
17871 eval $inlibc
17872 case "$d_setservent_r" in
17873 "$define")
17874         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17875         case "$d_setservent_r_proto:$usethreads" in
17876         ":define")      d_setservent_r_proto=define
17877                 set d_setservent_r_proto setservent_r $hdrs
17878                 eval $hasproto ;;
17879         *)      ;;
17880         esac
17881         case "$d_setservent_r_proto" in
17882         define)
17883         case "$setservent_r_proto" in
17884         ''|0) try='int setservent_r(int, struct servent_data*);'
17885         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17886         esac
17887         case "$setservent_r_proto" in
17888         ''|0) try='void setservent_r(int, struct servent_data*);'
17889         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17890         esac
17891         case "$setservent_r_proto" in
17892         ''|0)   d_setservent_r=undef
17893                 setservent_r_proto=0
17894                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17895         * )     case "$setservent_r_proto" in
17896                 REENTRANT_PROTO*) ;;
17897                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17898                 esac
17899                 echo "Prototype: $try" ;;
17900         esac
17901         ;;
17902         *)      case "$usethreads" in
17903                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17904                 esac
17905                 d_setservent_r=undef
17906                 setservent_r_proto=0
17907                 ;;
17908         esac
17909         ;;
17910 *)      setservent_r_proto=0
17911         ;;
17912 esac
17913
17914 : see if setsid exists
17915 set setsid d_setsid
17916 eval $inlibc
17917
17918 : see if setvbuf exists
17919 set setvbuf d_setvbuf
17920 eval $inlibc
17921
17922 : see if shmctl exists
17923 set shmctl d_shmctl
17924 eval $inlibc
17925
17926 : see if shmget exists
17927 set shmget d_shmget
17928 eval $inlibc
17929
17930 : see if shmat exists
17931 set shmat d_shmat
17932 eval $inlibc
17933 : see what shmat returns
17934 case "$d_shmat" in
17935 "$define")
17936         $cat >shmat.c <<'END'
17937 #include <sys/shm.h>
17938 void *shmat();
17939 END
17940         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17941                 shmattype='void *'
17942         else
17943                 shmattype='char *'
17944         fi
17945         echo "and it returns ($shmattype)." >&4
17946         : see if a prototype for shmat is available
17947         xxx=`./findhdr sys/shm.h`
17948         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17949         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17950                 val="$define"
17951         else
17952                 val="$undef"
17953         fi
17954         $rm -f shmat.[co]
17955         ;;
17956 *)
17957         val="$undef"
17958         ;;
17959 esac
17960 set d_shmatprototype
17961 eval $setvar
17962
17963 : see if shmdt exists
17964 set shmdt d_shmdt
17965 eval $inlibc
17966
17967 : see how much of the 'shm*(2)' library is present.
17968 h_shm=true
17969 echo " "
17970 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17971 *"$undef"*) h_shm=false;;
17972 esac
17973 case "$osname" in
17974 freebsd)
17975     case "`ipcs 2>&1`" in
17976     "SVID shared memory"*"not configured"*)
17977         echo "Your $osname does not have the shm*(2) configured." >&4
17978         h_shm=false
17979         val="$undef"
17980         set shmctl d_shmctl
17981         eval $setvar
17982         set shmget d_shmget
17983         eval $setvar
17984         set shmat d_shmat
17985         eval $setvar
17986         set shmdt d_shmdt
17987         eval $setvar
17988         ;;
17989     esac
17990     ;;
17991 esac
17992 : we could also check for sys/ipc.h ...
17993 if $h_shm && $test `./findhdr sys/shm.h`; then
17994         echo "You have the full shm*(2) library." >&4
17995         val="$define"
17996 else
17997         echo "You don't have the full shm*(2) library." >&4
17998         val="$undef"
17999 fi
18000 set d_shm
18001 eval $setvar
18002
18003 : see if we have sigaction
18004 echo " "
18005 if set sigaction val -f d_sigaction; eval $csym; $val; then
18006         echo 'sigaction() found.' >&4
18007         $cat > try.c <<EOP
18008 #include <stdio.h>
18009 #include <sys/types.h>
18010 #include <signal.h>
18011 #$i_stdlib I_STDLIB
18012 #ifdef I_STDLIB
18013 #include <stdlib.h>
18014 #endif
18015 int main()
18016 {
18017     struct sigaction act, oact;
18018     act.sa_flags = 0;
18019     oact.sa_handler = 0;
18020     /* so that act and oact are used */
18021     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18022 }
18023 EOP
18024         set try
18025         if eval $compile_ok; then
18026                 val="$define"
18027         else
18028                 echo "But you don't seem to have a usable struct sigaction." >&4
18029                 val="$undef"
18030         fi
18031 else
18032         echo 'sigaction NOT found.' >&4
18033         val="$undef"
18034 fi
18035 set d_sigaction; eval $setvar
18036 $rm_try
18037
18038 : see if this is a sunmath.h system
18039 set sunmath.h i_sunmath
18040 eval $inhdr
18041
18042 : see if signbit exists
18043 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18044 $cat >try.c <<EOCP
18045 #$i_math I_MATH
18046 #$i_sunmath I_SUNMATH
18047 #ifdef I_MATH
18048 #  include <math.h>
18049 #endif
18050 #ifdef I_SUNMATH  /* Solaris special math library */
18051 #  include <sunmath.h>
18052 #endif
18053 #define NV $nvtype
18054 int main(int argc, char **argv)
18055 {
18056     NV x = 0.0;
18057     NV y = -0.0;
18058     if ((signbit(x) == 0) && (signbit(y) != 0))
18059         return 0;
18060     else
18061         return 1;
18062 }
18063 EOCP
18064 val="$undef"
18065 set try
18066 if eval $compile; then
18067     if $run ./try; then
18068         $echo "Yes." >&4
18069         val="$define"
18070     else
18071         $echo "Signbit seems to be available, but doesn't work as I expected."
18072         $echo "I won't use it." >&4
18073         val="$undef"
18074     fi
18075 else
18076     $echo "Nope." >&4
18077     dflt="$undef"
18078 fi
18079 set d_signbit
18080 eval $setvar
18081 $rm_try
18082
18083 : see if sigprocmask exists
18084 set sigprocmask d_sigprocmask
18085 eval $inlibc
18086
18087 : see if sigsetjmp exists
18088 echo " "
18089 case "$d_sigsetjmp" in
18090 '')
18091         $cat >try.c <<EOP
18092 #include <setjmp.h>
18093 #$i_stdlib I_STDLIB
18094 #ifdef I_STDLIB
18095 #include <stdlib.h>
18096 #endif
18097 sigjmp_buf env;
18098 int set = 1;
18099 int main()
18100 {
18101         if (sigsetjmp(env,1))
18102                 exit(set);
18103         set = 0;
18104         siglongjmp(env, 1);
18105         exit(1);
18106 }
18107 EOP
18108         set try
18109         if eval $compile; then
18110                 if $run ./try >/dev/null 2>&1; then
18111                         echo "POSIX sigsetjmp found." >&4
18112                         val="$define"
18113                 else
18114                         $cat >&4 <<EOM
18115 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18116 I'll ignore them.
18117 EOM
18118                         val="$undef"
18119                 fi
18120         else
18121                 echo "sigsetjmp not found." >&4
18122                 val="$undef"
18123         fi
18124         ;;
18125 *) val="$d_sigsetjmp"
18126         case "$d_sigsetjmp" in
18127         $define) echo "POSIX sigsetjmp found." >&4;;
18128         $undef) echo "sigsetjmp not found." >&4;;
18129         esac
18130         ;;
18131 esac
18132 set d_sigsetjmp
18133 eval $setvar
18134 $rm_try
18135
18136 : see if snprintf exists
18137 set snprintf d_snprintf
18138 eval $inlibc
18139
18140 : see if vsnprintf exists
18141 set vsnprintf d_vsnprintf
18142 eval $inlibc
18143
18144 case "$d_snprintf-$d_vsnprintf" in
18145 "$define-$define")
18146     $cat <<EOM
18147 Checking whether your snprintf() and vsnprintf() work okay...
18148 EOM
18149     $cat >try.c <<'EOCP'
18150 /* v?snprintf testing logic courtesy of Russ Allbery.
18151  * According to C99:
18152  * - if the buffer is too short it still must be \0-terminated
18153  * - if the buffer is too short the potentially required length
18154  *   must be returned and not -1
18155  * - if the buffer is NULL the potentially required length
18156  *   must be returned and not -1 or core dump
18157  */
18158 #include <stdio.h>
18159 #include <stdarg.h>
18160
18161 char buf[2];
18162
18163 int test (char *format, ...)
18164 {
18165     va_list args;
18166     int count;
18167
18168     va_start (args, format);
18169     count = vsnprintf (buf, sizeof buf, format, args);
18170     va_end (args);
18171     return count;
18172 }
18173
18174 int main ()
18175 {
18176     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18177              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18178 }
18179 EOCP
18180     set try
18181     if eval $compile; then
18182         `$run ./try`
18183         case "$?" in
18184         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18185         *) cat <<EOM >&4
18186 Your snprintf() and snprintf() don't seem to be working okay.
18187 EOM
18188            d_snprintf="$undef"
18189            d_vsnprintf="$undef"
18190            ;;
18191         esac
18192     else
18193         echo "(I can't seem to compile the test program--assuming they don't)"
18194         d_snprintf="$undef"
18195         d_vsnprintf="$undef"
18196     fi
18197     $rm_try
18198     ;;
18199 esac
18200
18201 : see if sockatmark exists
18202 set sockatmark d_sockatmark
18203 eval $inlibc
18204
18205 : see if prototype for sockatmark is available
18206 echo " "
18207 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18208 eval $hasproto
18209
18210 : see if socks5_init exists
18211 set socks5_init d_socks5_init
18212 eval $inlibc
18213
18214 : see if sprintf returns the length of the string in the buffer as per ANSI
18215 $echo "Checking whether sprintf returns the length of the string..." >&4
18216 $cat <<EOP >try.c
18217 #include <stdio.h>
18218 #$i_stdlib I_STDLIB
18219 #ifdef I_STDLIB
18220 #include <stdlib.h>
18221 #endif
18222 #$i_string I_STRING
18223 #ifdef I_STRING
18224 #  include <string.h>
18225 #else
18226 #  include <strings.h>
18227 #endif
18228 #$i_math I_MATH
18229 #ifdef I_MATH
18230 #include <math.h>
18231 #endif
18232
18233 char buffer[256];
18234
18235 int check (size_t expect, int test) {
18236   size_t got = strlen(buffer);
18237   if (expect == got)
18238     return 0;
18239
18240   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
18241        test, buffer);
18242   exit (test);
18243 }
18244
18245 int main(int argc, char **argv) {
18246   int test = 0;
18247
18248   check(sprintf(buffer, ""), ++test);
18249   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
18250   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
18251
18252   return 0;
18253 }
18254 EOP
18255 set try
18256
18257 if eval $compile; then
18258     xxx="`$run ./try`"
18259     case "$?" in
18260         0) cat >&4 <<EOM
18261 sprintf returns the length of the string (as ANSI says it should)
18262 EOM
18263         d_sprintf_returns_strlen="$define"
18264         ;;
18265         *) cat >&4 <<EOM
18266 sprintf does not return the length of the string (how old is this system?)
18267 EOM
18268         d_sprintf_returns_strlen="$undef"
18269         ;;
18270     esac
18271 else
18272     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
18273     d_sprintf_returns_strlen="$undef"
18274 fi
18275 $rm_try
18276
18277 : see if srand48_r exists
18278 set srand48_r d_srand48_r
18279 eval $inlibc
18280 case "$d_srand48_r" in
18281 "$define")
18282         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18283         case "$d_srand48_r_proto:$usethreads" in
18284         ":define")      d_srand48_r_proto=define
18285                 set d_srand48_r_proto srand48_r $hdrs
18286                 eval $hasproto ;;
18287         *)      ;;
18288         esac
18289         case "$d_srand48_r_proto" in
18290         define)
18291         case "$srand48_r_proto" in
18292         ''|0) try='int srand48_r(long, struct drand48_data*);'
18293         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18294         esac
18295         case "$srand48_r_proto" in
18296         ''|0)   d_srand48_r=undef
18297                 srand48_r_proto=0
18298                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18299         * )     case "$srand48_r_proto" in
18300                 REENTRANT_PROTO*) ;;
18301                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18302                 esac
18303                 echo "Prototype: $try" ;;
18304         esac
18305         ;;
18306         *)      case "$usethreads" in
18307                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18308                 esac
18309                 d_srand48_r=undef
18310                 srand48_r_proto=0
18311                 ;;
18312         esac
18313         ;;
18314 *)      srand48_r_proto=0
18315         ;;
18316 esac
18317
18318 : see if srandom_r exists
18319 set srandom_r d_srandom_r
18320 eval $inlibc
18321 case "$d_srandom_r" in
18322 "$define")
18323         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18324         case "$d_srandom_r_proto:$usethreads" in
18325         ":define")      d_srandom_r_proto=define
18326                 set d_srandom_r_proto srandom_r $hdrs
18327                 eval $hasproto ;;
18328         *)      ;;
18329         esac
18330         case "$d_srandom_r_proto" in
18331         define)
18332         case "$srandom_r_proto" in
18333         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18334         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18335         esac
18336         case "$srandom_r_proto" in
18337         ''|0)   d_srandom_r=undef
18338                 srandom_r_proto=0
18339                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18340         * )     case "$srandom_r_proto" in
18341                 REENTRANT_PROTO*) ;;
18342                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18343                 esac
18344                 echo "Prototype: $try" ;;
18345         esac
18346         ;;
18347         *)      case "$usethreads" in
18348                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18349                 esac
18350                 d_srandom_r=undef
18351                 srandom_r_proto=0
18352                 ;;
18353         esac
18354         ;;
18355 *)      srandom_r_proto=0
18356         ;;
18357 esac
18358
18359 : see if prototype for setresgid is available
18360 echo " "
18361 set d_sresgproto setresgid $i_unistd unistd.h
18362 eval $hasproto
18363
18364 : see if prototype for setresuid is available
18365 echo " "
18366 set d_sresuproto setresuid $i_unistd unistd.h
18367 eval $hasproto
18368
18369 : see if sys/stat.h is available
18370 set sys/stat.h i_sysstat
18371 eval $inhdr
18372
18373 : see if stat knows about block sizes
18374 echo " "
18375 echo "Checking to see if your struct stat has st_blocks field..." >&4
18376 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18377 eval $hasfield
18378
18379 : see if this is a sys/vfs.h system
18380 set sys/vfs.h i_sysvfs
18381 eval $inhdr
18382
18383 : see if this is a sys/statfs.h system
18384 set sys/statfs.h i_sysstatfs
18385 eval $inhdr
18386
18387 : Check for statfs_s
18388 echo " "
18389 echo "Checking to see if your system supports struct statfs..." >&4
18390 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
18391 eval $hasstruct
18392 case "$d_statfs_s" in
18393 "$define")      echo "Yes, it does."   ;;
18394 *)              echo "No, it doesn't." ;;
18395 esac
18396
18397
18398 : see if struct statfs knows about f_flags
18399 case "$d_statfs_s" in
18400 define)
18401         echo " "
18402         echo "Checking to see if your struct statfs has f_flags field..." >&4
18403         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
18404         eval $hasfield
18405         ;;
18406 *)      val="$undef"
18407         set d_statfs_f_flags
18408         eval $setvar
18409         ;;
18410 esac
18411 case "$d_statfs_f_flags" in
18412 "$define")      echo "Yes, it does."   ;;
18413 *)              echo "No, it doesn't." ;;
18414 esac
18415
18416 : see what flavor, if any, of static inline is supported
18417 echo " "
18418 echo "Checking to see if your system supports static inline..."
18419 $cat > try.c <<'EOCP'
18420 #include <stdlib.h>
18421 extern int f_via_a(int x);
18422 extern int f_via_b(int x);
18423 int main(int argc, char **argv)
18424 {
18425     int y;
18426
18427     y = f_via_a(0);
18428 #ifdef USE_B
18429     y = f_via_b(0);
18430 #endif
18431     if (y == 42) {
18432         return EXIT_SUCCESS;
18433     }
18434     else {
18435         return EXIT_FAILURE;
18436     }
18437 }
18438 EOCP
18439 $cat > a.c <<'EOCP'
18440 static INLINE int f(int x) {
18441     int y;
18442     y = x + 42;
18443     return y;
18444 }
18445
18446 int f_via_a(int x)
18447 {
18448     return f(x);
18449 }
18450 EOCP
18451 $cat > b.c <<'EOCP'
18452 extern int f(int x);
18453
18454 int f_via_b(int x)
18455 {
18456     return f(x);
18457 }
18458 EOCP
18459
18460 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18461 case "$perl_static_inline" in
18462 '')     # Check the various possibilities, and break out on success.
18463         # For gcc, prefer __inline__, which will still permit
18464         # cflags.SH to add in -ansi.
18465         case "$gccversion" in
18466                 '') xxx="inline __inline__ __inline _inline";;
18467                 *)  xxx="__inline__ inline __inline _inline";;
18468         esac
18469         for inline in $xxx; do
18470                 set try -DINLINE=$inline a.c
18471                 if eval $compile && $run ./try; then
18472                         # Now make sure there is no external linkage of static
18473                         # functions
18474                         set try -DINLINE=$inline -DUSE_B a.c b.c
18475                         if eval $compile && $run ./try; then
18476                                 $echo "Your compiler supports static $inline, " >&4
18477                                 $echo "but it also creates an external definition," >&4
18478                                 $echo "so I won't use it." >&4
18479                                 val=$undef
18480                         else
18481                                 $echo "Your compiler supports static $inline." >&4
18482                                 val=$define
18483                                 perl_static_inline="static $inline";
18484                                 break;
18485                         fi
18486                 else
18487                         $echo "Your compiler does NOT support static $inline." >&4
18488                         val="$undef"
18489                 fi
18490         done
18491         ;;
18492 *inline*) # Some variant of inline exists.
18493         echo "Keeping your $hint value of $perl_static_inline."
18494         val=$define
18495         ;;
18496 static)  # No inline capabilities
18497         echo "Keeping your $hint value of $perl_static_inline."
18498         val=$undef
18499         ;;
18500 *)  # Unrecognized previous value -- blindly trust the supplied
18501         # value and hope it makes sense.  Use old value for
18502         # d_static_inline, if there is one.
18503         echo "Keeping your $hint value of $perl_static_inline."
18504         case "$d_static_inline" in
18505                 '') val=$define ;;
18506                 *)  val=$d_static_inline ;;
18507         esac
18508         ;;
18509 esac
18510 # Fallback to plain 'static' if nothing worked.
18511 case "$perl_static_inline" in
18512 '')
18513         perl_static_inline="static"
18514         val=$undef
18515         ;;
18516 esac
18517 set d_static_inline
18518 eval $setvar
18519 $rm -f a.[co] b.[co]
18520 $rm_try
18521
18522 : Check stream access
18523 $cat >&4 <<EOM
18524 Checking how to access stdio streams by file descriptor number...
18525 EOM
18526 case "$stdio_stream_array" in
18527 '')     $cat >try.c <<EOCP
18528 #include <stdio.h>
18529 int main() {
18530   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18531     printf("yes\n");
18532 }
18533 EOCP
18534         for s in _iob __iob __sF
18535         do
18536                 set try -DSTDIO_STREAM_ARRAY=$s
18537                 if eval $compile; then
18538                         case "`$run ./try`" in
18539                         yes)    stdio_stream_array=$s; break ;;
18540                         esac
18541                 fi
18542         done
18543         $rm_try
18544 esac
18545 case "$stdio_stream_array" in
18546 '')     $cat >&4 <<EOM
18547 I can't figure out how to access stdio streams by file descriptor number.
18548 EOM
18549         d_stdio_stream_array="$undef"
18550         ;;
18551 *)      $cat >&4 <<EOM
18552 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18553 EOM
18554         d_stdio_stream_array="$define"
18555         ;;
18556 esac
18557
18558 : see if strcoll exists
18559 set strcoll d_strcoll
18560 eval $inlibc
18561
18562 : check for structure copying
18563 echo " "
18564 echo "Checking to see if your C compiler can copy structs..." >&4
18565 $cat >try.c <<'EOCP'
18566 int main()
18567 {
18568         struct blurfl {
18569                 int dyick;
18570         } foo, bar;
18571
18572         foo = bar;
18573 }
18574 EOCP
18575 if $cc -c try.c >/dev/null 2>&1 ; then
18576         val="$define"
18577         echo "Yup, it can."
18578 else
18579         val="$undef"
18580         echo "Nope, it can't."
18581 fi
18582 set d_strctcpy
18583 eval $setvar
18584 $rm_try
18585
18586 : see if strerror and/or sys_errlist[] exist
18587 echo " "
18588 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18589     if set strerror val -f d_strerror; eval $csym; $val; then
18590                 echo 'strerror() found.' >&4
18591                 d_strerror="$define"
18592                 d_strerrm='strerror(e)'
18593                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18594                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
18595                         d_syserrlst="$define"
18596                 else
18597                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
18598                         d_syserrlst="$undef"
18599                 fi
18600     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18601                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18602                 echo 'strerror() found in string header.' >&4
18603                 d_strerror="$define"
18604                 d_strerrm='strerror(e)'
18605                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18606                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18607                                 d_syserrlst="$define"
18608                 else
18609                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
18610                         d_syserrlst="$undef"
18611                 fi
18612     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18613                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18614                 d_strerror="$undef"
18615                 d_syserrlst="$define"
18616                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18617     else
18618                 echo 'strerror() and sys_errlist[] NOT found.' >&4
18619                 d_strerror="$undef"
18620                 d_syserrlst="$undef"
18621                 d_strerrm='"unknown"'
18622     fi
18623 fi
18624
18625 : see if strerror_r exists
18626 set strerror_r d_strerror_r
18627 eval $inlibc
18628 case "$d_strerror_r" in
18629 "$define")
18630         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18631         case "$d_strerror_r_proto:$usethreads" in
18632         ":define")      d_strerror_r_proto=define
18633                 set d_strerror_r_proto strerror_r $hdrs
18634                 eval $hasproto ;;
18635         *)      ;;
18636         esac
18637         case "$d_strerror_r_proto" in
18638         define)
18639         case "$strerror_r_proto" in
18640         ''|0) try='int strerror_r(int, char*, size_t);'
18641         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18642         esac
18643         case "$strerror_r_proto" in
18644         ''|0) try='int strerror_r(int, char*, int);'
18645         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18646         esac
18647         case "$strerror_r_proto" in
18648         ''|0) try='char* strerror_r(int, char*, size_t);'
18649         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18650         esac
18651         case "$strerror_r_proto" in
18652         ''|0)   d_strerror_r=undef
18653                 strerror_r_proto=0
18654                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18655         * )     case "$strerror_r_proto" in
18656                 REENTRANT_PROTO*) ;;
18657                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18658                 esac
18659                 echo "Prototype: $try" ;;
18660         esac
18661         ;;
18662         *)      case "$usethreads" in
18663                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18664                 esac
18665                 d_strerror_r=undef
18666                 strerror_r_proto=0
18667                 ;;
18668         esac
18669         ;;
18670 *)      strerror_r_proto=0
18671         ;;
18672 esac
18673
18674 : see if strftime exists
18675 set strftime d_strftime
18676 eval $inlibc
18677
18678 : see if strlcat exists
18679 set strlcat d_strlcat
18680 eval $inlibc
18681
18682 : see if strlcpy exists
18683 set strlcpy d_strlcpy
18684 eval $inlibc
18685
18686 : see if strtod exists
18687 set strtod d_strtod
18688 eval $inlibc
18689
18690 : see if strtol exists
18691 set strtol d_strtol
18692 eval $inlibc
18693
18694 : see if strtold exists
18695 set strtold d_strtold
18696 eval $inlibc
18697
18698 : see if strtoll exists
18699 set strtoll d_strtoll
18700 eval $inlibc
18701
18702 case "$d_longlong-$d_strtoll" in
18703 "$define-$define")
18704         $cat <<EOM
18705 Checking whether your strtoll() works okay...
18706 EOM
18707         $cat >try.c <<'EOCP'
18708 #include <errno.h>
18709 #ifdef __hpux
18710 #define strtoll __strtoll
18711 #endif
18712 #ifdef __EMX__
18713 #define strtoll _strtoll
18714 #endif
18715 #include <stdio.h>
18716 extern long long int strtoll(char *s, char **, int);
18717 static int bad = 0;
18718 int check(char *s, long long ell, int een) {
18719         long long gll;
18720         errno = 0;
18721         gll = strtoll(s, 0, 10);
18722         if (!((gll == ell) && (errno == een)))
18723                 bad++;
18724 }
18725 int main() {
18726         check(" 1",                                      1LL, 0);
18727         check(" 0",                                      0LL, 0);
18728         check("-1",                                     -1LL, 0);
18729         check("-9223372036854775808", -9223372036854775808LL, 0);
18730         check("-9223372036854775808", -9223372036854775808LL, 0);
18731         check(" 9223372036854775807",  9223372036854775807LL, 0);
18732         check("-9223372036854775808", -9223372036854775808LL, 0);
18733         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18734         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18735         if (!bad)
18736                 printf("ok\n");
18737 }
18738 EOCP
18739         set try
18740         if eval $compile; then
18741                 yyy=`$run ./try`
18742                 case "$yyy" in
18743                 ok) echo "Your strtoll() seems to be working okay." ;;
18744                 *) cat <<EOM >&4
18745 Your strtoll() doesn't seem to be working okay.
18746 EOM
18747                    d_strtoll="$undef"
18748                    ;;
18749                 esac
18750         else
18751                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18752                 d_strtoll="$undef"
18753         fi
18754         ;;
18755 esac
18756
18757 : see if strtoq exists
18758 set strtoq d_strtoq
18759 eval $inlibc
18760
18761 : see if strtoul exists
18762 set strtoul d_strtoul
18763 eval $inlibc
18764
18765 case "$d_strtoul" in
18766 "$define")
18767         $cat <<EOM
18768 Checking whether your strtoul() works okay...
18769 EOM
18770         $cat >try.c <<'EOCP'
18771 #include <errno.h>
18772 #include <stdio.h>
18773 extern unsigned long int strtoul(char *s, char **, int);
18774 static int bad = 0;
18775 void check(char *s, unsigned long eul, int een) {
18776         unsigned long gul;
18777         errno = 0;
18778         gul = strtoul(s, 0, 10);
18779         if (!((gul == eul) && (errno == een)))
18780                 bad++;
18781 }
18782 int main() {
18783         check(" 1", 1L, 0);
18784         check(" 0", 0L, 0);
18785 EOCP
18786         case "$longsize" in
18787         8)
18788             $cat >>try.c <<'EOCP'
18789         check("18446744073709551615", 18446744073709551615UL, 0);
18790         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18791 #if 0 /* strtoul() for /^-/ strings is undefined. */
18792         check("-1", 18446744073709551615UL, 0);
18793         check("-18446744073709551614", 2, 0);
18794         check("-18446744073709551615", 1, 0);
18795         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18796         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18797 #endif
18798 EOCP
18799                 ;;
18800         4)
18801                     $cat >>try.c <<'EOCP'
18802         check("4294967295", 4294967295UL, 0);
18803         check("4294967296", 4294967295UL, ERANGE);
18804 #if 0 /* strtoul() for /^-/ strings is undefined. */
18805         check("-1", 4294967295UL, 0);
18806         check("-4294967294", 2, 0);
18807         check("-4294967295", 1, 0);
18808         check("-4294967296", 4294967295UL, ERANGE);
18809         check("-4294967297", 4294967295UL, ERANGE);
18810 #endif
18811 EOCP
18812                 ;;
18813         *)
18814 : Should we write these tests to be more portable by sprintf-ing
18815 : ~0 and then manipulating that char string as input for strtol?
18816                 ;;
18817         esac
18818         $cat >>try.c <<'EOCP'
18819         if (!bad)
18820                 printf("ok\n");
18821         return 0;
18822 }
18823 EOCP
18824         set try
18825         if eval $compile; then
18826                 case "`$run ./try`" in
18827                 ok) echo "Your strtoul() seems to be working okay." ;;
18828                 *) cat <<EOM >&4
18829 Your strtoul() doesn't seem to be working okay.
18830 EOM
18831                    d_strtoul="$undef"
18832                    ;;
18833                 esac
18834         else
18835                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18836                 d_strtoul="$undef"
18837         fi
18838         ;;
18839 esac
18840
18841 : see if strtoull exists
18842 set strtoull d_strtoull
18843 eval $inlibc
18844
18845 case "$d_longlong-$d_strtoull" in
18846 "$define-$define")
18847         $cat <<EOM
18848 Checking whether your strtoull() works okay...
18849 EOM
18850         $cat >try.c <<'EOCP'
18851 #include <errno.h>
18852 #ifdef __hpux
18853 #define strtoull __strtoull
18854 #endif
18855 #include <stdio.h>
18856 extern unsigned long long int strtoull(char *s, char **, int);
18857 static int bad = 0;
18858 int check(char *s, long long eull, int een) {
18859         long long gull;
18860         errno = 0;
18861         gull = strtoull(s, 0, 10);
18862         if (!((gull == eull) && (errno == een)))
18863                 bad++;
18864 }
18865 int main() {
18866         check(" 1",                                        1LL, 0);
18867         check(" 0",                                        0LL, 0);
18868         check("18446744073709551615",  18446744073709551615ULL, 0);
18869         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18870 #if 0 /* strtoull() for /^-/ strings is undefined. */
18871         check("-1",                    18446744073709551615ULL, 0);
18872         check("-18446744073709551614",                     2LL, 0);
18873         check("-18446744073709551615",                     1LL, 0);
18874         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18875         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18876 #endif
18877         if (!bad)
18878                 printf("ok\n");
18879 }
18880 EOCP
18881         set try
18882         if eval $compile; then
18883                 case "`$run ./try`" in
18884                 ok) echo "Your strtoull() seems to be working okay." ;;
18885                 *) cat <<EOM >&4
18886 Your strtoull() doesn't seem to be working okay.
18887 EOM
18888                    d_strtoull="$undef"
18889                    ;;
18890                 esac
18891         else
18892                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18893                 d_strtoull="$undef"
18894         fi
18895         ;;
18896 esac
18897
18898 : see if strtouq exists
18899 set strtouq d_strtouq
18900 eval $inlibc
18901
18902 case "$d_strtouq" in
18903 "$define")
18904         $cat <<EOM
18905 Checking whether your strtouq() works okay...
18906 EOM
18907         $cat >try.c <<'EOCP'
18908 #include <errno.h>
18909 #include <stdio.h>
18910 extern unsigned long long int strtouq(char *s, char **, int);
18911 static int bad = 0;
18912 void check(char *s, unsigned long long eull, int een) {
18913         unsigned long long gull;
18914         errno = 0;
18915         gull = strtouq(s, 0, 10);
18916         if (!((gull == eull) && (errno == een)))
18917                 bad++;
18918 }
18919 int main() {
18920         check(" 1",                                        1LL, 0);
18921         check(" 0",                                        0LL, 0);
18922         check("18446744073709551615",  18446744073709551615ULL, 0);
18923         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18924 #if 0 /* strtouq() for /^-/ strings is undefined. */
18925         check("-1",                    18446744073709551615ULL, 0);
18926         check("-18446744073709551614",                     2LL, 0);
18927         check("-18446744073709551615",                     1LL, 0);
18928         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18929         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18930 #endif
18931         if (!bad)
18932                 printf("ok\n");
18933         return 0;
18934 }
18935 EOCP
18936         set try
18937         if eval $compile; then
18938                 case "`$run ./try`" in
18939                 ok) echo "Your strtouq() seems to be working okay." ;;
18940                 *) cat <<EOM >&4
18941 Your strtouq() doesn't seem to be working okay.
18942 EOM
18943                    d_strtouq="$undef"
18944                    ;;
18945                 esac
18946         else
18947                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18948                 d_strtouq="$undef"
18949         fi
18950         ;;
18951 esac
18952
18953 : see if strxfrm exists
18954 set strxfrm d_strxfrm
18955 eval $inlibc
18956
18957 : see if symlink exists
18958 set symlink d_symlink
18959 eval $inlibc
18960
18961 : see if syscall exists
18962 set syscall d_syscall
18963 eval $inlibc
18964
18965 : see if prototype for syscall is available
18966 echo " "
18967 set d_syscallproto syscall $i_unistd unistd.h
18968 eval $hasproto
18969
18970 : see if sysconf exists
18971 set sysconf d_sysconf
18972 eval $inlibc
18973
18974 : see if system exists
18975 set system d_system
18976 eval $inlibc
18977
18978 : see if tcgetpgrp exists
18979 set tcgetpgrp d_tcgetpgrp
18980 eval $inlibc
18981
18982 : see if tcsetpgrp exists
18983 set tcsetpgrp d_tcsetpgrp
18984 eval $inlibc
18985
18986 : see if prototype for telldir is available
18987 echo " "
18988 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18989 eval $hasproto
18990
18991 : see if time exists
18992 echo " "
18993 if test "X$d_time" = X -o X"$timetype" = X; then
18994     if set time val -f d_time; eval $csym; $val; then
18995                 echo 'time() found.' >&4
18996                 val="$define"
18997                 rp="What is the type returned by time() on this system?"
18998                 set time_t timetype long stdio.h sys/types.h
18999                 eval $typedef_ask
19000     else
19001                 echo 'time() not found, hope that will do.' >&4
19002                 val="$undef"
19003                 timetype='int';
19004     fi
19005     set d_time
19006     eval $setvar
19007 fi
19008
19009 : see if timegm exists
19010 set timegm d_timegm
19011 eval $inlibc
19012
19013 : see if this is a sys/times.h system
19014 set sys/times.h i_systimes
19015 eval $inhdr
19016
19017 : see if times exists
19018 echo " "
19019 if set times val -f d_times; eval $csym; $val; then
19020         echo 'times() found.' >&4
19021         d_times="$define"
19022         inc=''
19023         case "$i_systimes" in
19024         "$define") inc='sys/times.h';;
19025         esac
19026         rp="What is the type returned by times() on this system?"
19027         set clock_t clocktype long stdio.h sys/types.h $inc
19028         eval $typedef_ask
19029 else
19030         echo 'times() NOT found, hope that will do.' >&4
19031         d_times="$undef"
19032         clocktype='int'
19033 fi
19034
19035 : see if tmpnam_r exists
19036 set tmpnam_r d_tmpnam_r
19037 eval $inlibc
19038 case "$d_tmpnam_r" in
19039 "$define")
19040         hdrs="$i_systypes sys/types.h define stdio.h "
19041         case "$d_tmpnam_r_proto:$usethreads" in
19042         ":define")      d_tmpnam_r_proto=define
19043                 set d_tmpnam_r_proto tmpnam_r $hdrs
19044                 eval $hasproto ;;
19045         *)      ;;
19046         esac
19047         case "$d_tmpnam_r_proto" in
19048         define)
19049         case "$tmpnam_r_proto" in
19050         ''|0) try='char* tmpnam_r(char*);'
19051         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19052         esac
19053         case "$tmpnam_r_proto" in
19054         ''|0)   d_tmpnam_r=undef
19055                 tmpnam_r_proto=0
19056                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19057         * )     case "$tmpnam_r_proto" in
19058                 REENTRANT_PROTO*) ;;
19059                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19060                 esac
19061                 echo "Prototype: $try" ;;
19062         esac
19063         ;;
19064         *)      case "$usethreads" in
19065                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19066                 esac
19067                 d_tmpnam_r=undef
19068                 tmpnam_r_proto=0
19069                 ;;
19070         esac
19071         ;;
19072 *)      tmpnam_r_proto=0
19073         ;;
19074 esac
19075
19076 : see if truncate exists
19077 set truncate d_truncate
19078 eval $inlibc
19079
19080 : see if ttyname_r exists
19081 set ttyname_r d_ttyname_r
19082 eval $inlibc
19083 case "$d_ttyname_r" in
19084 "$define")
19085         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19086         case "$d_ttyname_r_proto:$usethreads" in
19087         ":define")      d_ttyname_r_proto=define
19088                 set d_ttyname_r_proto ttyname_r $hdrs
19089                 eval $hasproto ;;
19090         *)      ;;
19091         esac
19092         case "$d_ttyname_r_proto" in
19093         define)
19094         case "$ttyname_r_proto" in
19095         ''|0) try='int ttyname_r(int, char*, size_t);'
19096         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19097         esac
19098         case "$ttyname_r_proto" in
19099         ''|0) try='int ttyname_r(int, char*, int);'
19100         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19101         esac
19102         case "$ttyname_r_proto" in
19103         ''|0) try='char* ttyname_r(int, char*, int);'
19104         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19105         esac
19106         case "$ttyname_r_proto" in
19107         ''|0)   d_ttyname_r=undef
19108                 ttyname_r_proto=0
19109                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19110         * )     case "$ttyname_r_proto" in
19111                 REENTRANT_PROTO*) ;;
19112                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19113                 esac
19114                 echo "Prototype: $try" ;;
19115         esac
19116         ;;
19117         *)      case "$usethreads" in
19118                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19119                 esac
19120                 d_ttyname_r=undef
19121                 ttyname_r_proto=0
19122                 ;;
19123         esac
19124         ;;
19125 *)      ttyname_r_proto=0
19126         ;;
19127 esac
19128
19129 : see if tzname[] exists
19130 echo " "
19131 if set tzname val -a d_tzname; eval $csym; $val; then
19132         val="$define"
19133         echo 'tzname[] found.' >&4
19134 else
19135         val="$undef"
19136         echo 'tzname[] NOT found.' >&4
19137 fi
19138 set d_tzname
19139 eval $setvar
19140
19141 : Check if is a multiplatform env
19142 case "$osname" in
19143 darwin) multiarch="$define" ;;
19144 esac
19145 case "$multiarch" in
19146 ''|[nN]*) multiarch="$undef" ;;
19147 esac
19148
19149 : check for ordering of bytes in a UV
19150 echo " "
19151 case "$multiarch" in
19152 *$define*)
19153         $cat <<EOM
19154 You seem to be doing a multiarchitecture build,
19155 skipping the byteorder check.
19156
19157 EOM
19158         byteorder='ffff'
19159         ;;
19160 *)
19161         case "$byteorder" in
19162         '')
19163                 $cat <<'EOM'
19164 In the following, larger digits indicate more significance.  A big-endian
19165 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19166 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19167 machines may have weird orders like 3412.  A Cray will report 87654321,
19168 an Alpha will report 12345678. If the test program works the default is
19169 probably right.
19170 I'm now running the test program...
19171 EOM
19172                 $cat >try.c <<EOCP
19173 #include <stdio.h>
19174 #$i_stdlib I_STDLIB
19175 #ifdef I_STDLIB
19176 #include <stdlib.h>
19177 #endif
19178 #include <sys/types.h>
19179 typedef $uvtype UV;
19180 int main()
19181 {
19182         int i;
19183         union {
19184                 UV l;
19185                 char c[$uvsize];
19186         } u;
19187
19188         if ($uvsize > 4)
19189                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19190         else
19191                 u.l = (UV)0x04030201;
19192         for (i = 0; i < $uvsize; i++)
19193                 printf("%c", u.c[i]+'0');
19194         printf("\n");
19195         exit(0);
19196 }
19197 EOCP
19198                 xxx_prompt=y
19199                 set try
19200                 if eval $compile && $run ./try > /dev/null; then
19201                         dflt=`$run ./try`
19202                         case "$dflt" in
19203                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19204                                 echo "(The test program ran ok.)"
19205                                 echo "byteorder=$dflt"
19206                                 xxx_prompt=n
19207                         ;;
19208                         ????|????????) echo "(The test program ran ok.)" ;;
19209                         *) echo "(The test program didn't run right for some reason.)" ;;
19210                         esac
19211                 else
19212                         dflt='4321'
19213                         cat <<'EOM'
19214 (I can't seem to compile the test program.  Guessing big-endian...)
19215 EOM
19216                 fi
19217                 case "$xxx_prompt" in
19218                 y)
19219                         rp="What is the order of bytes in $uvtype?"
19220                         . ./myread
19221                         byteorder="$ans"
19222                         ;;
19223                 *)      byteorder=$dflt
19224                         ;;
19225                 esac
19226                 ;;
19227         esac
19228         $rm_try
19229         ;;
19230 esac
19231
19232 : Checking 32bit alignedness
19233 $cat <<EOM
19234
19235 Checking to see whether you can access character data unalignedly...
19236 EOM
19237 case "$d_u32align" in
19238 '')   $cat >try.c <<EOCP
19239 #include <stdio.h>
19240 #$i_stdlib I_STDLIB
19241 #ifdef I_STDLIB
19242 #include <stdlib.h>
19243 #endif
19244 #define U32 $u32type
19245 #define BYTEORDER 0x$byteorder
19246 #define U8 $u8type
19247 #include <signal.h>
19248 #ifdef SIGBUS
19249 $signal_t bletch(int s) { exit(4); }
19250 #endif
19251 int main() {
19252 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19253     volatile U8 buf[8];
19254     volatile U32 *up;
19255     int i;
19256
19257     if (sizeof(U32) != 4) {
19258         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19259         exit(1);
19260     }
19261
19262     fflush(stdout);
19263
19264 #ifdef SIGBUS
19265     signal(SIGBUS, bletch);
19266 #endif
19267
19268     buf[0] = 0;
19269     buf[1] = 0;
19270     buf[2] = 0;
19271     buf[3] = 1;
19272     buf[4] = 0;
19273     buf[5] = 0;
19274     buf[6] = 0;
19275     buf[7] = 1;
19276
19277     for (i = 0; i < 4; i++) {
19278         up = (U32*)(buf + i);
19279         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19280                (*up == 1 << (8*(3-i)))  /* little-endian */
19281               )
19282            )
19283         {
19284             printf("read failed (%x)\n", *up);
19285             exit(2);
19286         }
19287     }
19288
19289     /* write test */
19290     for (i = 0; i < 4; i++) {
19291         up = (U32*)(buf + i);
19292         *up = 0xBeef;
19293         if (*up != 0xBeef) {
19294             printf("write failed (%x)\n", *up);
19295             exit(3);
19296         }
19297     }
19298
19299     exit(0);
19300 #else
19301     printf("1\n");
19302     exit(1);
19303 #endif
19304     return 0;
19305 }
19306 EOCP
19307 set try
19308 if eval $compile_ok; then
19309         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19310         $run ./try 2>&1 >/dev/null
19311         case "$?" in
19312         0)      cat >&4 <<EOM
19313 You can access character data pretty unalignedly.
19314 EOM
19315                 d_u32align="$undef"
19316                 ;;
19317         *)      cat >&4 <<EOM
19318 It seems that you must access character data in an aligned manner.
19319 EOM
19320                 d_u32align="$define"
19321                 ;;
19322         esac
19323 else
19324         rp='Can you access character data at unaligned addresses?'
19325         dflt='n'
19326         . ./myread
19327         case "$ans" in
19328         [yY]*)  d_u32align="$undef"  ;;
19329         *)      d_u32align="$define" ;;
19330         esac
19331 fi
19332 $rm_try
19333 ;;
19334 esac
19335
19336 : see if ualarm exists
19337 set ualarm d_ualarm
19338 eval $inlibc
19339
19340 : see if umask exists
19341 set umask d_umask
19342 eval $inlibc
19343
19344 : see if unordered exists
19345 set unordered d_unordered
19346 eval $inlibc
19347
19348 : see if unsetenv exists
19349 set unsetenv d_unsetenv
19350 eval $inlibc
19351
19352 : see if usleep exists
19353 set usleep d_usleep
19354 eval $inlibc
19355
19356 : see if prototype for usleep is available
19357 echo " "
19358 set d_usleepproto usleep $i_unistd unistd.h
19359 eval $hasproto
19360
19361 : see if ustat exists
19362 set ustat d_ustat
19363 eval $inlibc
19364
19365 : see if closedir exists
19366 set closedir d_closedir
19367 eval $inlibc
19368
19369 case "$d_closedir" in
19370 "$define")
19371         echo " "
19372         echo "Checking whether closedir() returns a status..." >&4
19373         cat > try.c <<EOM
19374 #$i_dirent I_DIRENT             /**/
19375 #$i_sysdir I_SYS_DIR            /**/
19376 #$i_sysndir I_SYS_NDIR          /**/
19377 #$i_systypes I_SYS_TYPES        /**/
19378
19379 #if defined(I_SYS_TYPES)
19380 #include <sys/types.h>
19381 #endif
19382 #if defined(I_DIRENT)
19383 #include <dirent.h>
19384 #else
19385 #ifdef I_SYS_NDIR
19386 #include <sys/ndir.h>
19387 #else
19388 #ifdef I_SYS_DIR
19389 #ifdef hp9000s500
19390 #include <ndir.h>       /* may be wrong in the future */
19391 #else
19392 #include <sys/dir.h>
19393 #endif
19394 #endif
19395 #endif
19396 #endif
19397 int main() { return closedir(opendir(".")); }
19398 EOM
19399         set try
19400         if eval $compile_ok; then
19401                 if $run ./try > /dev/null 2>&1 ; then
19402                         echo "Yes, it does."
19403                         val="$undef"
19404                 else
19405                         echo "No, it doesn't."
19406                         val="$define"
19407                 fi
19408         else
19409                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19410                 val="$define"
19411         fi
19412         ;;
19413 *)
19414         val="$undef";
19415         ;;
19416 esac
19417 set d_void_closedir
19418 eval $setvar
19419 $rm_try
19420
19421 : see if there is a wait4
19422 set wait4 d_wait4
19423 eval $inlibc
19424
19425 : see if waitpid exists
19426 set waitpid d_waitpid
19427 eval $inlibc
19428
19429 : look for wcscmp
19430 echo " "
19431 $cat >try.c <<'EOCP'
19432 #include <stdio.h>
19433 #include <wchar.h>
19434 int main ()
19435 {
19436     wchar_t *s = L" ";
19437     return (wcscmp (s, s) ? 1 : 0);
19438     }
19439 EOCP
19440 set try
19441 val="$undef"
19442 if eval $compile; then
19443     `$run ./try`
19444     case "$?" in
19445         0)  echo "A working wcscmp() found." >&4
19446             val="$define" ;;
19447         *)  echo "wcscmp() found, but it doesn't work" >&4
19448             ;;
19449         esac
19450 else
19451     echo "wcscmp() NOT found." >&4
19452     fi
19453 set d_wcscmp
19454 eval $setvar
19455 $rm_try
19456
19457 : see if wcstombs exists
19458 set wcstombs d_wcstombs
19459 eval $inlibc
19460
19461 : look for wcsxfrm
19462 echo " "
19463 $cat >try.c <<'EOCP'
19464 #include <errno.h>
19465 #include <wchar.h>
19466 int main ()
19467 {
19468     wchar_t dst[4], *src = L" ";
19469     errno = 0;
19470     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
19471     }
19472 EOCP
19473 set try
19474 val="$undef"
19475 if eval $compile; then
19476     `$run ./try`
19477     case "$?" in
19478         0)  echo "A working wcsxfrm() found." >&4
19479             val="$define" ;;
19480         *)  echo "wcsxfrm() found, but it doesn't work" >&4
19481             ;;
19482         esac
19483 else
19484     echo "wcsxfrm() NOT found." >&4
19485     fi
19486 set d_wcsxfrm
19487 eval $setvar
19488 $rm_try
19489
19490 : see if wctomb exists
19491 set wctomb d_wctomb
19492 eval $inlibc
19493
19494 : see if writev exists
19495 set writev d_writev
19496 eval $inlibc
19497
19498 : check for alignment requirements
19499 echo " "
19500 case "$alignbytes" in
19501     '') echo "Checking alignment constraints..." >&4
19502         if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
19503             $cat >try.c <<'EOCP'
19504 typedef long double NV;
19505 EOCP
19506         else
19507             $cat >try.c <<'EOCP'
19508 typedef double NV;
19509 EOCP
19510         fi
19511         $cat >>try.c <<'EOCP'
19512 #include <stdio.h>
19513 struct foobar {
19514     char foo;
19515     NV bar;
19516 } try_algn;
19517 int main()
19518 {
19519     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19520     return(0);
19521 }
19522 EOCP
19523         set try
19524         if eval $compile_ok; then
19525             dflt=`$run ./try`
19526         else
19527             dflt='8'
19528             echo "(I can't seem to compile the test program...)"
19529         fi
19530         case "$multiarch" in
19531             *$define*)
19532                 : The usual safe value is 8, but Darwin with -Duselongdouble
19533                 : needs 16.  Hence, we will take 8 as a minimum, but allow
19534                 : Configure to pick a larger value if needed.
19535                 if $test "$dflt" -lt 8; then
19536                     dflt='8'
19537                     echo "Setting alignment to 8 for multiarch support.">&4
19538                 fi
19539                 ;;
19540         esac
19541         ;;
19542     *) dflt="$alignbytes"
19543         ;;
19544 esac
19545 rp="Doubles must be aligned on a how-many-byte boundary?"
19546 . ./myread
19547 alignbytes="$ans"
19548 $rm_try
19549
19550 : set the base revision
19551 baserev=5.0
19552
19553 : length of character in bytes. Is always 1, otherwise it is not C
19554 : This used to be a test using sizeof
19555 charsize=1
19556
19557 : Check for the number of bits in a character
19558 case "$charbits" in
19559 '')     echo "Checking how long a character is (in bits)..." >&4
19560         $cat >try.c <<EOCP
19561 #include <stdio.h>
19562 int main ()
19563 {
19564     int n;
19565     unsigned char c;
19566     for (c = 1, n = 0; c; c <<= 1, n++) ;
19567     printf ("%d\n", n);
19568     return (0);
19569     }
19570 EOCP
19571         set try
19572         if eval $compile_ok; then
19573                 dflt=`$run ./try`
19574         else
19575                 dflt='8'
19576                 echo "(I can't seem to compile the test program.  Guessing...)"
19577         fi
19578         ;;
19579 *)
19580         dflt="$charbits"
19581         ;;
19582 esac
19583 rp="What is the length of a character (in bits)?"
19584 . ./myread
19585 charbits="$ans"
19586 $rm_try
19587 case "$charbits" in
19588 8)      ;;
19589 *)      cat >&4 << EOM
19590 Your system has an unsigned character size of $charbits bits, which
19591 is rather unusual (normally it is 8 bits).  Perl likely will not work
19592 correctly on your system, with subtle bugs in various places.
19593 EOM
19594         rp='Do you really want to continue?'
19595         dflt='n'
19596         . ./myread
19597         case "$ans" in
19598                 [yY])   echo >&4 "Okay, continuing."    ;;
19599                 *)      exit 1                          ;;
19600         esac
19601 esac
19602
19603 : how do we concatenate cpp tokens here?
19604 echo " "
19605 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19606 $cat >cpp_stuff.c <<'EOCP'
19607 #define RCAT(a,b)a/**/b
19608 #define ACAT(a,b)a ## b
19609 RCAT(Rei,ser)
19610 ACAT(Cir,cus)
19611 EOCP
19612 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19613 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19614         echo "Oh!  Smells like ANSI's been here." >&4
19615         echo "We can catify or stringify, separately or together!"
19616         cpp_stuff=42
19617 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19618         echo "Ah, yes!  The good old days!" >&4
19619         echo "However, in the good old days we don't know how to stringify and"
19620         echo "catify at the same time."
19621         cpp_stuff=1
19622 else
19623         $cat >&4 <<EOM
19624 Hmm, I don't seem to be able to concatenate tokens with your cpp.
19625 You're going to have to edit the values of CAT[2-5] in config.h...
19626 EOM
19627         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19628 fi
19629 $rm -f cpp_stuff.*
19630
19631 : see if this is a db.h system
19632 set db.h i_db
19633 eval $inhdr
19634
19635 case "$i_db" in
19636 $define)
19637         : Check db version.
19638         echo " "
19639         echo "Checking Berkeley DB version ..." >&4
19640         $cat >try.c <<EOCP
19641 #$d_const HASCONST
19642 #ifndef HASCONST
19643 #define const
19644 #endif
19645 #include <sys/types.h>
19646 #include <stdio.h>
19647 #$i_stdlib I_STDLIB
19648 #ifdef I_STDLIB
19649 #include <stdlib.h>
19650 #endif
19651 #include <db.h>
19652 int main(int argc, char *argv[])
19653 {
19654 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19655     int Major, Minor, Patch ;
19656     unsigned long Version ;
19657     (void)db_version(&Major, &Minor, &Patch) ;
19658     if (argc == 2) {
19659         printf("%d %d %d %d %d %d\n",
19660                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19661                Major, Minor, Patch);
19662         exit(0);
19663     }
19664     printf("You have Berkeley DB Version 2 or greater.\n");
19665
19666     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19667                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19668     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19669                 Major, Minor, Patch) ;
19670
19671     /* check that db.h & libdb are compatible */
19672     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19673         printf("db.h and libdb are incompatible.\n") ;
19674         exit(3);
19675     }
19676
19677     printf("db.h and libdb are compatible.\n") ;
19678
19679     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19680                 + DB_VERSION_PATCH ;
19681
19682     /* needs to be >= 2.3.4 */
19683     if (Version < 2003004) {
19684     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19685         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19686         exit(2);
19687     }
19688
19689     exit(0);
19690 #else
19691 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19692     if (argc == 2) {
19693         printf("1 0 0\n");
19694         exit(0);
19695     }
19696     printf("You have Berkeley DB Version 1.\n");
19697     exit(0);    /* DB version < 2: the coast is clear. */
19698 #else
19699     exit(1);    /* <db.h> not Berkeley DB? */
19700 #endif
19701 #endif
19702 }
19703 EOCP
19704         set try
19705         if eval $compile_ok && $run ./try; then
19706                 echo 'Looks OK.' >&4
19707                 set `$run ./try 1`
19708                 db_version_major=$1
19709                 db_version_minor=$2
19710                 db_version_patch=$3
19711         else
19712                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19713                 i_db=$undef
19714                 case " $libs " in
19715                 *"-ldb "*)
19716                         : Remove db from list of libraries to use
19717                         echo "Removing unusable -ldb from library list" >&4
19718                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19719                         shift
19720                         libs="$*"
19721                         echo "libs = $libs" >&4
19722                         ;;
19723                 esac
19724         fi
19725         $rm_try
19726         ;;
19727 esac
19728
19729 case "$i_db" in
19730 define)
19731         : Check the return type needed for hash
19732         echo " "
19733         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19734         $cat >try.c <<EOCP
19735 #$d_const HASCONST
19736 #ifndef HASCONST
19737 #define const
19738 #endif
19739 #include <sys/types.h>
19740 #include <db.h>
19741
19742 #ifndef DB_VERSION_MAJOR
19743 u_int32_t hash_cb (const void* ptr, size_t size)
19744 {
19745 }
19746 HASHINFO info;
19747 int main()
19748 {
19749         info.hash = hash_cb;
19750 }
19751 #endif
19752 EOCP
19753         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19754                 if $contains warning try.out >>/dev/null 2>&1 ; then
19755                         db_hashtype='int'
19756                 else
19757                         db_hashtype='u_int32_t'
19758                 fi
19759         else
19760                 : XXX Maybe we should just give up here.
19761                 db_hashtype=u_int32_t
19762                 $cat try.out >&4
19763                 echo "Help:  I can't seem to compile the db test program." >&4
19764                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19765         fi
19766         $rm_try
19767         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19768         ;;
19769 *)      db_hashtype=u_int32_t
19770         ;;
19771 esac
19772 case "$i_db" in
19773 define)
19774         : Check the return type needed for prefix
19775         echo " "
19776         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19777         cat >try.c <<EOCP
19778 #$d_const HASCONST
19779 #ifndef HASCONST
19780 #define const
19781 #endif
19782 #include <sys/types.h>
19783 #include <db.h>
19784
19785 #ifndef DB_VERSION_MAJOR
19786 size_t prefix_cb (const DBT *key1, const DBT *key2)
19787 {
19788 }
19789 BTREEINFO info;
19790 int main()
19791 {
19792         info.prefix = prefix_cb;
19793 }
19794 #endif
19795 EOCP
19796         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19797                 if $contains warning try.out >>/dev/null 2>&1 ; then
19798                         db_prefixtype='int'
19799                 else
19800                         db_prefixtype='size_t'
19801                 fi
19802         else
19803                 db_prefixtype='size_t'
19804                 : XXX Maybe we should just give up here.
19805                 $cat try.out >&4
19806                 echo "Help:  I can't seem to compile the db test program." >&4
19807                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19808         fi
19809         $rm_try
19810         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19811         ;;
19812 *)      db_prefixtype='size_t'
19813         ;;
19814 esac
19815
19816 : How can we generate normalized random numbers ?
19817 echo " "
19818 echo "Using our internal random number implementation..." >&4
19819
19820 case "$ccflags" in
19821 *-Dmy_rand=*|*-Dmy_srand=*)
19822         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19823         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19824         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19825         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19826         ;;
19827 esac
19828
19829 randfunc=Perl_drand48
19830 drand01="Perl_drand48()"
19831 seedfunc="Perl_drand48_init"
19832 randbits=48
19833 randseedtype=U32
19834
19835 : Determine if this is an EBCDIC system
19836 echo " "
19837 echo "Determining whether or not we are on an EBCDIC system..." >&4
19838 $cat >try.c <<'EOM'
19839 int main()
19840 {
19841   if ('M'==0xd4) return 0;
19842   return 1;
19843 }
19844 EOM
19845
19846 val=$undef
19847 set try
19848 if eval $compile_ok; then
19849         if $run ./try; then
19850                 echo "You seem to speak EBCDIC." >&4
19851                 val="$define"
19852         else
19853                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19854         fi
19855 else
19856         echo "I'm unable to compile the test program." >&4
19857         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19858 fi
19859 $rm_try
19860 set ebcdic
19861 eval $setvar
19862
19863 : Check how to flush
19864 echo " "
19865 $cat >&4 <<EOM
19866 Checking how to flush all pending stdio output...
19867 EOM
19868 # I only know how to find the first 32 possibly open files on SunOS.
19869 # See also hints/sunos_4_1.sh and util.c  --AD
19870 case "$osname" in
19871 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19872 esac
19873 $cat >>try.c <<EOCP
19874 #include <stdio.h>
19875 #$i_stdlib I_STDLIB
19876 #ifdef I_STDLIB
19877 #include <stdlib.h>
19878 #endif
19879 #$i_unistd I_UNISTD
19880 #ifdef I_UNISTD
19881 # include <unistd.h>
19882 #endif
19883 #$d_sysconf HAS_SYSCONF
19884 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19885 #ifdef HAS_STDIO_STREAM_ARRAY
19886 # define STDIO_STREAM_ARRAY $stdio_stream_array
19887 #endif
19888 int main() {
19889   FILE* p;
19890   unlink("try.out");
19891   p = fopen("try.out", "w");
19892 #ifdef TRY_FPUTC
19893   fputc('x', p);
19894 #else
19895 # ifdef TRY_FPRINTF
19896   fprintf(p, "x");
19897 # endif
19898 #endif
19899 #ifdef TRY_FFLUSH_NULL
19900   fflush(NULL);
19901 #endif
19902 #ifdef TRY_FFLUSH_ALL
19903   {
19904     long open_max = -1;
19905 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19906     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19907 # else
19908 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19909     open_max = sysconf(_SC_OPEN_MAX);
19910 #  else
19911 #   ifdef FOPEN_MAX
19912     open_max = FOPEN_MAX;
19913 #   else
19914 #    ifdef OPEN_MAX
19915     open_max = OPEN_MAX;
19916 #    else
19917 #     ifdef _NFILE
19918     open_max = _NFILE;
19919 #     endif
19920 #    endif
19921 #   endif
19922 #  endif
19923 # endif
19924 # ifdef HAS_STDIO_STREAM_ARRAY
19925     if (open_max > 0) {
19926       long i;
19927       for (i = 0; i < open_max; i++)
19928             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19929                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19930                 STDIO_STREAM_ARRAY[i]._flag)
19931                 fflush(&STDIO_STREAM_ARRAY[i]);
19932     }
19933   }
19934 # endif
19935 #endif
19936   _exit(42);
19937 }
19938 EOCP
19939 : first we have to find out how _not_ to flush
19940 $to try.c
19941 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19942     output=''
19943     set try -DTRY_FPUTC
19944     if eval $compile; then
19945             $run ./try 2>/dev/null
19946             code="$?"
19947             $from try.out
19948             if $test ! -s try.out -a "X$code" = X42; then
19949                 output=-DTRY_FPUTC
19950             fi
19951     fi
19952     case "$output" in
19953     '')
19954             set try -DTRY_FPRINTF
19955             if eval $compile; then
19956                     $run ./try 2>/dev/null
19957                     code="$?"
19958                     $from try.out
19959                     if $test ! -s try.out -a "X$code" = X42; then
19960                         output=-DTRY_FPRINTF
19961                     fi
19962             fi
19963         ;;
19964     esac
19965 fi
19966 : check for fflush NULL behavior
19967 case "$fflushNULL" in
19968 '')     set try -DTRY_FFLUSH_NULL $output
19969         if eval $compile; then
19970                 $run ./try 2>/dev/null
19971                 code="$?"
19972                 $from try.out
19973                 if $test -s try.out -a "X$code" = X42; then
19974                         fflushNULL="`$cat try.out`"
19975                 else
19976                         if $test "X$code" != X42; then
19977                                 $cat >&4 <<EOM
19978 (If this test failed, don't worry, we'll try another method shortly.)
19979 EOM
19980                         fi
19981                 fi
19982         fi
19983         $rm -f core try.core core.try.*
19984         case "$fflushNULL" in
19985         x)      $cat >&4 <<EOM
19986 Your fflush(NULL) works okay for output streams.
19987 Let's see if it clobbers input pipes...
19988 EOM
19989 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19990 # bug that improperly flushes the input end of pipes.  So we avoid the
19991 # autoflush on fork/system/exec support for now. :-(
19992 $cat >tryp.c <<EOCP
19993 #include <stdio.h>
19994 int
19995 main(int argc, char **argv)
19996 {
19997     char buf[1024];
19998     int i;
19999     char *bp = buf;
20000     while (1) {
20001         while ((i = getc(stdin)) != -1
20002                && (*bp++ = i) != '\n'
20003                && bp < &buf[1024])
20004         /* DO NOTHING */ ;
20005         *bp = '\0';
20006         fprintf(stdout, "%s", buf);
20007         fflush(NULL);
20008         if (i == -1)
20009             return 0;
20010         bp = buf;
20011     }
20012 }
20013 EOCP
20014                 fflushNULL="$define"
20015                 set tryp
20016                 if eval $compile; then
20017                     $rm -f tryp.out
20018                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
20019                     if $test "X$targethost" != X; then
20020                         $to tryp.c
20021                         $to tryp
20022                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20023                     else
20024                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20025                     fi
20026                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
20027                        $cat >&4 <<EOM
20028 fflush(NULL) seems to behave okay with input streams.
20029 EOM
20030                         fflushNULL="$define"
20031                     else
20032                         $cat >&4 <<EOM
20033 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
20034 EOM
20035                         fflushNULL="$undef"
20036                     fi
20037                 fi
20038                 $rm -f core tryp.c tryp.core core.tryp.*
20039                 ;;
20040         '')     $cat >&4 <<EOM
20041 Your fflush(NULL) isn't working (contrary to ANSI C).
20042 EOM
20043                 fflushNULL="$undef"
20044                 ;;
20045         *)      $cat >&4 <<EOM
20046 Cannot figure out whether your fflush(NULL) works or not.
20047 I'm assuming it doesn't (contrary to ANSI C).
20048 EOM
20049                 fflushNULL="$undef"
20050                 ;;
20051         esac
20052         ;;
20053 $define|true|[yY]*)
20054         fflushNULL="$define"
20055         ;;
20056 *)
20057         fflushNULL="$undef"
20058         ;;
20059 esac
20060 : check explicit looping only if NULL did not work, and if the pipe
20061 : bug does not show up on an explicit flush too
20062 case "$fflushNULL" in
20063 "$undef")
20064         $cat >tryp.c <<EOCP
20065 #include <stdio.h>
20066 int
20067 main(int argc, char **argv)
20068 {
20069     char buf[1024];
20070     int i;
20071     char *bp = buf;
20072     while (1) {
20073         while ((i = getc(stdin)) != -1
20074                && (*bp++ = i) != '\n'
20075                && bp < &buf[1024])
20076         /* DO NOTHING */ ;
20077         *bp = '\0';
20078         fprintf(stdout, "%s", buf);
20079         fflush(stdin);
20080         if (i == -1)
20081             return 0;
20082         bp = buf;
20083     }
20084 }
20085 EOCP
20086         set tryp
20087         if eval $compile; then
20088             $rm -f tryp.out
20089             if $test "X$targethost" != X; then
20090                 $to tryp.c
20091                 $to tryp
20092                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20093             else
20094                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20095             fi
20096             if cmp tryp.c tryp.out >/dev/null 2>&1; then
20097                $cat >&4 <<EOM
20098 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
20099 EOM
20100                 : now check for fflushall behaviour
20101                 case "$fflushall" in
20102                 '')     set try -DTRY_FFLUSH_ALL $output
20103                         if eval $compile; then
20104                                 $cat >&4 <<EOM
20105 (Now testing the other method--but note that this also may fail.)
20106 EOM
20107                                 $run ./try 2>/dev/null
20108                                 code=$?
20109                                 $from try.out
20110                                 if $test -s try.out -a "X$code" = X42; then
20111                                         fflushall="`$cat try.out`"
20112                                 fi
20113                         fi
20114                         $rm_try
20115                         case "$fflushall" in
20116                         x)      $cat >&4 <<EOM
20117 Whew. Flushing explicitly all the stdio streams works.
20118 EOM
20119                                 fflushall="$define"
20120                                 ;;
20121                         '')     $cat >&4 <<EOM
20122 Sigh. Flushing explicitly all the stdio streams doesn't work.
20123 EOM
20124                                 fflushall="$undef"
20125                                 ;;
20126                         *)      $cat >&4 <<EOM
20127 Cannot figure out whether flushing stdio streams explicitly works or not.
20128 I'm assuming it doesn't.
20129 EOM
20130                                 fflushall="$undef"
20131                                 ;;
20132                         esac
20133                         ;;
20134                 "$define"|true|[yY]*)
20135                         fflushall="$define"
20136                         ;;
20137                 *)
20138                         fflushall="$undef"
20139                         ;;
20140                 esac
20141             else
20142                 $cat >&4 <<EOM
20143 All is futile.  Even fflush(stdin) clobbers input pipes!
20144 EOM
20145                 fflushall="$undef"
20146             fi
20147         else
20148             fflushall="$undef"
20149         fi
20150         $rm -f core tryp.c tryp.core core.tryp.*
20151         ;;
20152 *)      fflushall="$undef"
20153         ;;
20154 esac
20155
20156 case "$fflushNULL$fflushall" in
20157 undefundef)
20158         $cat <<EOM
20159 OK, I give up.  I cannot figure out how to flush pending stdio output.
20160 We won't be flushing handles at all before fork/exec/popen.
20161 EOM
20162         ;;
20163 esac
20164 $rm_try tryp
20165
20166 : Store the full pathname to the ar program for use in the C program
20167 : Respect a hint or command line value for full_ar.
20168 case "$full_ar" in
20169 '') full_ar=$ar ;;
20170 esac
20171
20172 : Store the full pathname to the sed program for use in the C program
20173 full_sed=$sed
20174
20175 : see what type gids are declared as in the kernel
20176 echo " "
20177 echo "Looking for the type for group ids returned by getgid()."
20178 set gid_t gidtype xxx stdio.h sys/types.h
20179 eval $typedef
20180 case "$gidtype" in
20181 xxx)
20182         xxx=`./findhdr sys/user.h`
20183         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
20184         case $1 in
20185         unsigned) dflt="$1 $2" ;;
20186         *) dflt="$1" ;;
20187         esac
20188         ;;
20189 *) dflt="$gidtype";;
20190 esac
20191 case "$gidtype" in
20192 gid_t) echo "gid_t found." ;;
20193 *)      rp="What is the type for group ids returned by getgid()?"
20194         . ./myread
20195         gidtype="$ans"
20196         ;;
20197 esac
20198
20199 : Check the size of GID
20200 echo " "
20201 case "$gidtype" in
20202 *_t) zzz="$gidtype"     ;;
20203 *)   zzz="gid"          ;;
20204 esac
20205 echo "Checking the size of $zzz..." >&4
20206 cat > try.c <<EOCP
20207 #include <sys/types.h>
20208 #include <stdio.h>
20209 #$i_stdlib I_STDLIB
20210 #ifdef I_STDLIB
20211 #include <stdlib.h>
20212 #endif
20213 int main() {
20214     printf("%d\n", (int)sizeof($gidtype));
20215     exit(0);
20216 }
20217 EOCP
20218 set try
20219 if eval $compile_ok; then
20220         yyy=`$run ./try`
20221         case "$yyy" in
20222         '')     gidsize=4
20223                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
20224                 ;;
20225         *)      gidsize=$yyy
20226                 echo "Your $zzz is $gidsize bytes long."
20227                 ;;
20228         esac
20229 else
20230         gidsize=4
20231         echo "(I can't compile the test program--guessing $gidsize.)" >&4
20232 fi
20233
20234
20235 : Check if GID is signed
20236 echo " "
20237 case "$gidtype" in
20238 *_t) zzz="$gidtype"     ;;
20239 *)   zzz="gid"          ;;
20240 esac
20241 echo "Checking the sign of $zzz..." >&4
20242 cat > try.c <<EOCP
20243 #include <sys/types.h>
20244 #include <stdio.h>
20245 int main() {
20246         $gidtype foo = -1;
20247         if (foo < 0)
20248                 printf("-1\n");
20249         else
20250                 printf("1\n");
20251 }
20252 EOCP
20253 set try
20254 if eval $compile; then
20255         yyy=`$run ./try`
20256         case "$yyy" in
20257         '')     gidsign=1
20258                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20259                 ;;
20260         *)      gidsign=$yyy
20261                 case "$gidsign" in
20262                  1) echo "Your $zzz is unsigned." ;;
20263                 -1) echo "Your $zzz is signed."   ;;
20264                 esac
20265                 ;;
20266         esac
20267 else
20268         gidsign=1
20269         echo "(I can't compile the test program--guessing unsigned.)" >&4
20270 fi
20271
20272
20273 : Check 64bit sizes
20274 echo " "
20275
20276 if $test X"$quadtype" != X; then
20277
20278 echo "Checking how to print 64-bit integers..." >&4
20279
20280 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
20281         $cat >try.c <<'EOCP'
20282 #include <sys/types.h>
20283 #include <stdio.h>
20284 int main() {
20285   int q = 12345678901;
20286   printf("%ld\n", q);
20287 }
20288 EOCP
20289         set try
20290         if eval $compile; then
20291                 yyy=`$run ./try`
20292                 case "$yyy" in
20293                 12345678901)
20294                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
20295                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
20296                         echo "We will use %d."
20297                         ;;
20298                 esac
20299         fi
20300 fi
20301
20302 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
20303         $cat >try.c <<'EOCP'
20304 #include <sys/types.h>
20305 #include <stdio.h>
20306 int main() {
20307   long q = 12345678901;
20308   printf("%ld\n", q);
20309 }
20310 EOCP
20311         set try
20312         if eval $compile; then
20313                 yyy=`$run ./try`
20314                 case "$yyy" in
20315                 12345678901)
20316                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
20317                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
20318                         echo "We will use %ld."
20319                         ;;
20320                 esac
20321         fi
20322 fi
20323
20324 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
20325         $cat >try.c <<'EOCP'
20326 #include <sys/types.h>
20327 #include <inttypes.h>
20328 #include <stdio.h>
20329 int main() {
20330   int64_t q = 12345678901;
20331   printf("%" PRId64 "\n", q);
20332 }
20333 EOCP
20334         set try
20335         if eval $compile; then
20336                 yyy=`$run ./try`
20337                 case "$yyy" in
20338                 12345678901)
20339                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
20340                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
20341                         echo "We will use the C9X style."
20342                         ;;
20343                 esac
20344         fi
20345 fi
20346
20347 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20348         $cat >try.c <<EOCP
20349 #include <sys/types.h>
20350 #include <stdio.h>
20351 int main() {
20352   $quadtype q = 12345678901;
20353   printf("%Ld\n", q);
20354 }
20355 EOCP
20356         set try
20357         if eval $compile; then
20358                 yyy=`$run ./try`
20359                 case "$yyy" in
20360                 12345678901)
20361                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
20362                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
20363                         echo "We will use %Ld."
20364                         ;;
20365                 esac
20366         fi
20367 fi
20368
20369 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
20370         $cat >try.c <<'EOCP'
20371 #include <sys/types.h>
20372 #include <stdio.h>
20373 int main() {
20374   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
20375   printf("%lld\n", q);
20376 }
20377 EOCP
20378         set try
20379         if eval $compile; then
20380                 yyy=`$run ./try`
20381                 case "$yyy" in
20382                 12345678901)
20383                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
20384                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
20385                         echo "We will use the %lld style."
20386                         ;;
20387                 esac
20388         fi
20389 fi
20390
20391 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20392         $cat >try.c <<EOCP
20393 #include <sys/types.h>
20394 #include <stdio.h>
20395 int main() {
20396   $quadtype q = 12345678901;
20397   printf("%qd\n", q);
20398 }
20399 EOCP
20400         set try
20401         if eval $compile; then
20402                 yyy=`$run ./try`
20403                 case "$yyy" in
20404                 12345678901)
20405                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
20406                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
20407                         echo "We will use %qd."
20408                         ;;
20409                 esac
20410         fi
20411 fi
20412
20413 if $test X"$sPRId64" = X; then
20414         echo "Cannot figure out how to print 64-bit integers." >&4
20415 fi
20416 $rm_try
20417
20418 fi
20419
20420 case "$sPRId64" in
20421 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
20422         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
20423         ;;
20424 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
20425         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
20426         ;;
20427 esac
20428
20429 : Check format strings for internal types
20430 echo " "
20431 $echo "Checking the format strings to be used for Perl's internal types..." >&4
20432
20433 if $test X"$ivsize" = X8; then
20434         ivdformat="$sPRId64"
20435         uvuformat="$sPRIu64"
20436         uvoformat="$sPRIo64"
20437         uvxformat="$sPRIx64"
20438         uvXUformat="$sPRIXU64"
20439 else
20440         if $test X"$ivsize" = X"$longsize"; then
20441                 ivdformat='"ld"'
20442                 uvuformat='"lu"'
20443                 uvoformat='"lo"'
20444                 uvxformat='"lx"'
20445                 uvXUformat='"lX"'
20446         else
20447                 if $test X"$ivsize" = X"$intsize"; then
20448                         ivdformat='"d"'
20449                         uvuformat='"u"'
20450                         uvoformat='"o"'
20451                         uvxformat='"x"'
20452                         uvXUformat='"X"'
20453                 else
20454                         : far out
20455                         if $test X"$ivsize" = X"$shortsize"; then
20456                                 ivdformat='"hd"'
20457                                 uvuformat='"hu"'
20458                                 uvoformat='"ho"'
20459                                 uvxformat='"hx"'
20460                                 uvXUformat='"hX"'
20461                         fi
20462                 fi
20463         fi
20464 fi
20465
20466 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
20467         nveformat="$sPRIeldbl"
20468         nvfformat="$sPRIfldbl"
20469         nvgformat="$sPRIgldbl"
20470         nvEUformat="$sPRIEUldbl"
20471         nvFUformat="$sPRIFUldbl"
20472         nvGUformat="$sPRIGUldbl"
20473 else
20474         nveformat='"e"'
20475         nvfformat='"f"'
20476         nvgformat='"g"'
20477         nvEUformat='"E"'
20478         nvFUformat='"F"'
20479         nvGUformat='"G"'
20480 fi
20481
20482 case "$ivdformat" in
20483 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
20484     exit 1
20485     ;;
20486 esac
20487
20488 : Check format string for GID
20489
20490 echo " "
20491 $echo "Checking the format string to be used for gids..." >&4
20492
20493 case "$gidsign" in
20494 -1)     if $test X"$gidsize" = X"$ivsize"; then
20495                 gidformat="$ivdformat"
20496         else
20497                 if $test X"$gidsize" = X"$longsize"; then
20498                         gidformat='"ld"'
20499                 else
20500                         if $test X"$gidsize" = X"$intsize"; then
20501                                 gidformat='"d"'
20502                         else
20503                                 if $test X"$gidsize" = X"$shortsize"; then
20504                                         gidformat='"hd"'
20505                                 fi
20506                         fi
20507                 fi
20508         fi
20509         ;;
20510 *)      if $test X"$gidsize" = X"$uvsize"; then
20511                 gidformat="$uvuformat"
20512         else
20513                 if $test X"$gidsize" = X"$longsize"; then
20514                         gidformat='"lu"'
20515                 else
20516                         if $test X"$gidsize" = X"$intsize"; then
20517                                 gidformat='"u"'
20518                         else
20519                                 if $test X"$gidsize" = X"$shortsize"; then
20520                                         gidformat='"hu"'
20521                                 fi
20522                         fi
20523                 fi
20524         fi
20525         ;;
20526 esac
20527
20528 : see if getgroups exists
20529 set getgroups d_getgrps
20530 eval $inlibc
20531
20532 : see if setgroups exists
20533 set setgroups d_setgrps
20534 eval $inlibc
20535
20536 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20537 echo " "
20538 case "$d_getgrps$d_setgrps" in
20539 *define*)
20540         case "$groupstype" in
20541         '') dflt="$gidtype" ;;
20542         *)  dflt="$groupstype" ;;
20543         esac
20544         $cat <<EOM
20545 What type of pointer is the second argument to getgroups() and setgroups()?
20546 Usually this is the same as group ids, $gidtype, but not always.
20547
20548 EOM
20549         rp='What type pointer is the second argument to getgroups() and setgroups()?'
20550         . ./myread
20551         groupstype="$ans"
20552         ;;
20553 *)  groupstype="$gidtype";;
20554 esac
20555
20556 : check whether make sets MAKE
20557 echo " "
20558 echo "Checking if your $make program sets \$(MAKE)..." >&4
20559 case "$make_set_make" in
20560 '')
20561         $sed 's/^X //' > testmake.mak << 'EOF'
20562 Xall:
20563 X       @echo 'maketemp="$(MAKE)"'
20564 EOF
20565         case "`$make -f testmake.mak 2>/dev/null`" in
20566         *maketemp=*) make_set_make='#' ;;
20567         *)      make_set_make="MAKE=$make" ;;
20568         esac
20569         $rm -f testmake.mak
20570         ;;
20571 esac
20572 case "$make_set_make" in
20573 '#') echo "Yup, it does.";;
20574 *) echo "Nope, it doesn't.";;
20575 esac
20576
20577 : see what type is used for mode_t
20578 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20579 set mode_t modetype int stdio.h sys/types.h
20580 eval $typedef_ask
20581
20582 : see if we need va_copy
20583 echo " "
20584 case "$i_stdarg" in
20585 "$define")
20586         $cat >try.c <<EOCP
20587 #include <stdarg.h>
20588 #include <stdio.h>
20589 #$i_stdlib I_STDLIB
20590 #ifdef I_STDLIB
20591 #include <stdlib.h>
20592 #endif
20593 #include <signal.h>
20594
20595 int
20596 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20597 {
20598   return vfprintf(f, fmt, *valp);
20599 }
20600
20601 int
20602 myvfprintf(FILE *f, const  char *fmt, va_list val)
20603 {
20604   return ivfprintf(f, fmt, &val);
20605 }
20606
20607 int
20608 myprintf(char *fmt, ...)
20609 {
20610   va_list val;
20611   va_start(val, fmt);
20612   return myvfprintf(stdout, fmt, val);
20613 }
20614
20615 int
20616 main(int ac, char **av)
20617 {
20618   signal(SIGSEGV, exit);
20619
20620   myprintf("%s%cs all right, then\n", "that", '\'');
20621   exit(0);
20622 }
20623 EOCP
20624         set try
20625         if eval $compile && $run ./try 2>&1 >/dev/null; then
20626                 case "`$run ./try`" in
20627                 "that's all right, then")
20628                         okay=yes
20629                         ;;
20630                 esac
20631         fi
20632         case "$okay" in
20633         yes)    echo "It seems that you don't need va_copy()." >&4
20634                 need_va_copy="$undef"
20635                 ;;
20636         *)      echo "It seems that va_copy() or similar will be needed." >&4
20637                 need_va_copy="$define"
20638                 ;;
20639         esac
20640         $rm_try
20641         ;;
20642 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20643         need_va_copy="$undef"
20644         ;;
20645 esac
20646
20647 : see what type is used for size_t
20648 rp="What is the type used for the length parameter for string functions?"
20649 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20650 eval $typedef_ask
20651
20652 : check for type of arguments to gethostbyaddr.
20653 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20654         case "$d_gethbyaddr" in
20655         $define)
20656                 $cat <<EOM
20657
20658 Checking to see what type of arguments are accepted by gethostbyaddr().
20659 EOM
20660                 hdrs="$define sys/types.h
20661                         $d_socket sys/socket.h
20662                         $i_niin netinet/in.h
20663                         $i_netdb netdb.h
20664                         $i_unistd unistd.h"
20665                 : The first arg can 'char *' or 'void *'
20666                 : The second arg is some of integral type
20667                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20668                         for yyy in size_t long int; do
20669                                 case "$netdb_host_type" in
20670                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20671                                         if ./protochk "$try" $hdrs; then
20672                                                 echo "Your system accepts $xxx for the first arg."
20673                                                 echo "...and $yyy for the second arg."
20674                                                 netdb_host_type="$xxx"
20675                                                 netdb_hlen_type="$yyy"
20676                                         fi
20677                                         ;;
20678                                 esac
20679                         done
20680                 done
20681                 : In case none of those worked, prompt the user.
20682                 case "$netdb_host_type" in
20683                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20684                         dflt='char *'
20685                         . ./myread
20686                         netdb_host_type=$ans
20687                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20688                         dflt="$sizetype"
20689                         . ./myread
20690                         netdb_hlen_type=$ans
20691                         ;;
20692                 esac
20693                 ;;
20694         *)      : no gethostbyaddr, so pick harmless defaults
20695                 netdb_host_type='char *'
20696                 netdb_hlen_type="$sizetype"
20697                 ;;
20698         esac
20699         # Remove the "const" if needed. -- but then we'll have a
20700         # prototype clash!
20701         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20702 fi
20703
20704 : check for type of argument to gethostbyname.
20705 if test "X$netdb_name_type" = X ; then
20706         case "$d_gethbyname" in
20707         $define)
20708                 $cat <<EOM
20709
20710 Checking to see what type of argument is accepted by gethostbyname().
20711 EOM
20712                 hdrs="$define sys/types.h
20713                         $d_socket sys/socket.h
20714                         $i_niin netinet/in.h
20715                         $i_netdb netdb.h
20716                         $i_unistd unistd.h"
20717                 for xxx in "const char *" "char *"; do
20718                         case "$netdb_name_type" in
20719                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20720                                 if ./protochk "$try" $hdrs; then
20721                                         echo "Your system accepts $xxx."
20722                                         netdb_name_type="$xxx"
20723                                 fi
20724                                 ;;
20725                         esac
20726                 done
20727                 : In case none of those worked, prompt the user.
20728                 case "$netdb_name_type" in
20729                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20730                         dflt='char *'
20731                         . ./myread
20732                         netdb_name_type=$ans
20733                         ;;
20734                 esac
20735                 ;;
20736         *)      : no gethostbyname, so pick harmless default
20737                 netdb_name_type='char *'
20738                 ;;
20739         esac
20740 fi
20741
20742 : check for type of 1st argument to getnetbyaddr.
20743 if test "X$netdb_net_type" = X ; then
20744         case "$d_getnbyaddr" in
20745         $define)
20746                 $cat <<EOM
20747
20748 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20749 EOM
20750                 hdrs="$define sys/types.h
20751                         $d_socket sys/socket.h
20752                         $i_niin netinet/in.h
20753                         $i_netdb netdb.h
20754                         $i_unistd unistd.h"
20755                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20756                         case "$netdb_net_type" in
20757                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20758                                 if ./protochk "$try" $hdrs; then
20759                                         echo "Your system accepts $xxx."
20760                                         netdb_net_type="$xxx"
20761                                 fi
20762                                 ;;
20763                         esac
20764                 done
20765                 : In case none of those worked, prompt the user.
20766                 case "$netdb_net_type" in
20767                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20768                         dflt='long'
20769                         . ./myread
20770                         netdb_net_type=$ans
20771                         ;;
20772                 esac
20773                 ;;
20774         *)      : no getnetbyaddr, so pick harmless default
20775                 netdb_net_type='long'
20776                 ;;
20777         esac
20778 fi
20779 : locate the preferred pager for this system
20780 fn=f/
20781 case "$pager" in
20782 '')
20783         dflt=''
20784         case "$pg" in
20785         /*) dflt=$pg;;
20786         [a-zA-Z]:/*) dflt=$pg;;
20787         esac
20788         case "$more" in
20789         /*) dflt=$more;;
20790         [a-zA-Z]:/*) dflt=$more;;
20791         esac
20792         case "$less" in
20793         /*) dflt=$less;;
20794         [a-zA-Z]:/*) dflt=$less;;
20795         esac
20796         case "$dflt" in
20797         '') dflt=/usr/ucb/more;;
20798         esac
20799         ;;
20800 *)      dflt="$pager"
20801         ;;
20802 esac
20803 fn="f/($dflt)"
20804 echo " "
20805 rp='What pager is used on your system?'
20806 . ./getfile
20807 pager="$ans"
20808
20809 : see what type pids are declared as in the kernel
20810 rp="What is the type of process ids on this system?"
20811 set pid_t pidtype int stdio.h sys/types.h
20812 eval $typedef_ask
20813
20814 : see if ar generates random libraries by itself
20815 echo " "
20816 echo "Checking how to generate random libraries on your machine..." >&4
20817 echo 'int bar1() { return bar2(); }' > bar1.c
20818 echo 'int bar2() { return 2; }' > bar2.c
20819 $cat > foo.c <<EOP
20820 #$i_stdlib I_STDLIB
20821 #ifdef I_STDLIB
20822 #include <stdlib.h>
20823 #endif
20824 int main() { printf("%d\n", bar1()); exit(0); }
20825 EOP
20826 $cc $ccflags -c bar1.c >/dev/null 2>&1
20827 $cc $ccflags -c bar2.c >/dev/null 2>&1
20828 $cc $ccflags -c foo.c >/dev/null 2>&1
20829 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20830 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20831         $run ./foobar >/dev/null 2>&1; then
20832         echo "$ar appears to generate random libraries itself."
20833         orderlib=false
20834         if [ "X$ranlib" = "X" ]; then
20835             ranlib=":"
20836         fi
20837 elif $ar s bar$_a >/dev/null 2>&1 &&
20838         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20839         $run ./foobar >/dev/null 2>&1; then
20840                 echo "a table of contents needs to be added with '$ar s'."
20841                 orderlib=false
20842                 ranlib="$ar s"
20843 elif $ar ts bar$_a >/dev/null 2>&1 &&
20844         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20845         $run ./foobar >/dev/null 2>&1; then
20846                 echo "a table of contents needs to be added with '$ar ts'."
20847                 orderlib=false
20848                 ranlib="$ar ts"
20849 else
20850         case "$ranlib" in
20851         :) ranlib='';;
20852         '')
20853                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20854                 $test -f $ranlib || ranlib=''
20855                 ;;
20856         esac
20857         if $test -n "$ranlib"; then
20858                 echo "your system has '$ranlib'; we'll use that."
20859                 orderlib=false
20860         else
20861                 echo "your system doesn't seem to support random libraries"
20862                 echo "so we'll use lorder and tsort to order the libraries."
20863                 orderlib=true
20864                 ranlib=":"
20865         fi
20866 fi
20867 $rm -f foo* bar*
20868
20869 : see if this is a values.h system
20870 set values.h i_values
20871 eval $inhdr
20872
20873 : Check the max offset that gmtime and localtime accept
20874 echo "Checking max offsets that gmtime () accepts"
20875
20876 case $i_values in
20877     define) yyy="#include <values.h>" ;;
20878     *)      yyy="" ;;
20879     esac
20880
20881 case "$sGMTIME_min/$sGMTIME_max" in
20882     0/0|/)
20883         $cat >try.c <<EOCP
20884 #include <sys/types.h>
20885 #include <stdio.h>
20886 #include <time.h>
20887 $yyy
20888
20889 int i;
20890 struct tm *tmp;
20891 time_t pt;
20892
20893 void gm_check (time_t t, int min_year, int max_year)
20894 {
20895     tmp = gmtime (&t);
20896     if ( tmp == NULL ||
20897         /* Check tm_year overflow */
20898          tmp->tm_year < min_year || tmp->tm_year > max_year)
20899         tmp = NULL;
20900     else
20901         pt = t;
20902     } /* gm_check */
20903
20904 int check_max ()
20905 {
20906     tmp = NULL;
20907     pt  = 0;
20908 #ifdef MAXLONG
20909     gm_check (MAXLONG, 69, 0x7fffffff);
20910 #endif
20911     if (tmp == NULL || tmp->tm_year < 0) {
20912         for (i = 63; i >= 0; i--) {
20913             time_t x = pt | ((time_t)1 << i);
20914             if (x < 0 || x < pt) continue;
20915             gm_check (x, 69, 0x7fffffff);
20916             }
20917         }
20918     printf ("sGMTIME_max=%ld\n", pt);
20919     return (0);
20920     } /* check_max */
20921
20922 int check_min ()
20923 {
20924     tmp = NULL;
20925     pt  = 0;
20926 #ifdef MINLONG
20927     gm_check (MINLONG, -1900, 70);
20928 #endif
20929     if (tmp == NULL) {
20930         for (i = 36; i >= 0; i--) {
20931             time_t x = pt - ((time_t)1 << i);
20932             if (x > 0) continue;
20933             gm_check (x, -1900, 70);
20934             }
20935         }
20936     printf ("sGMTIME_min=%ld\n", pt);
20937     return (0);
20938     } /* check_min */
20939
20940 int main (int argc, char *argv[])
20941 {
20942     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20943     check_max ();
20944     check_min ();
20945     return (0);
20946     } /* main */
20947 EOCP
20948         set try
20949         if eval $compile; then
20950             eval `$run ./try`
20951         else
20952             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20953             fi
20954         $rm_try
20955         ;;
20956     esac
20957
20958 echo "Checking max offsets that localtime () accepts"
20959
20960 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20961     0/0|/)
20962         $cat >try.c <<EOCP
20963 #include <sys/types.h>
20964 #include <stdio.h>
20965 #include <time.h>
20966 $yyy
20967
20968 int i;
20969 struct tm *tmp;
20970 time_t pt;
20971
20972 void local_check (time_t t, int min_year, int max_year)
20973 {
20974     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20975         tmp = NULL;
20976     else
20977         tmp = localtime (&t);
20978     if ( tmp == NULL ||
20979         /* Check tm_year overflow */
20980          tmp->tm_year < min_year || tmp->tm_year > max_year)
20981         tmp = NULL;
20982     else
20983         pt = t;
20984     } /* local_check */
20985
20986 int check_max ()
20987 {
20988     tmp = NULL;
20989     pt  = 0;
20990 #ifdef MAXLONG
20991     local_check (MAXLONG, 69, 0x7fffffff);
20992 #endif
20993     if (tmp == NULL || tmp->tm_year < 0) {
20994         for (i = 63; i >= 0; i--) {
20995             time_t x = pt | ((time_t)1 << i);
20996             if (x < 0 || x < pt) continue;
20997             local_check (x, 69, 0x7fffffff);
20998             }
20999         }
21000     printf ("sLOCALTIME_max=%ld\n", pt);
21001     return (0);
21002    } /* check_max */
21003
21004 int check_min ()
21005 {
21006     tmp = NULL;
21007     pt  = 0;
21008 #ifdef MINLONG
21009     local_check (MINLONG, -1900, 70);
21010 #endif
21011     if (tmp == NULL) {
21012         for (i = 36; i >= 0; i--) {
21013             time_t x = pt - ((time_t)1 << i);
21014             if (x > 0) continue;
21015             local_check (x, -1900, 70);
21016             }
21017         }
21018     printf ("sLOCALTIME_min=%ld\n", pt);
21019     return (0);
21020     } /* check_min */
21021
21022 int main (int argc, char *argv[])
21023 {
21024     check_max ();
21025     check_min ();
21026     return (0);
21027     } /* main */
21028 EOCP
21029         set try
21030         if eval $compile; then
21031             eval `$run ./try`
21032         else
21033             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
21034             fi
21035         $rm_try
21036         ;;
21037     esac
21038
21039 : check for type of arguments to select.
21040 case "$selecttype" in
21041 '') case "$d_select" in
21042         $define)
21043                 echo " "
21044                 $cat <<EOM
21045 Checking to see what type of arguments are accepted by select().
21046 EOM
21047                 hdrs="$define sys/types.h
21048                         $i_systime sys/time.h
21049                         $i_sysselct sys/select.h
21050                         $d_socket sys/socket.h"
21051                 : The first arg can be int, unsigned, or size_t
21052                 : The last arg may or may not be 'const'
21053                 val=''
21054                 : void pointer has been seen but using that
21055                 : breaks the selectminbits test
21056                 for xxx in 'fd_set *' 'int *'; do
21057                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
21058                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
21059                                         case "$val" in
21060                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
21061                                                 if ./protochk "$try" $hdrs; then
21062                                                         echo "Your system accepts $xxx."
21063                                                         val="$xxx"
21064                                                 fi
21065                                                 ;;
21066                                         esac
21067                                 done
21068                         done
21069                 done
21070                 case "$val" in
21071                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
21072                         case "$d_fd_set" in
21073                                 $define) dflt="fd_set *" ;;
21074                                 *)              dflt="int *" ;;
21075                         esac
21076                         . ./myread
21077                         val=$ans
21078                         ;;
21079                 esac
21080                 selecttype="$val"
21081                 ;;
21082         *)      : no select, so pick a harmless default
21083                 selecttype='int *'
21084                 ;;
21085         esac
21086         ;;
21087 esac
21088
21089 : check for the select 'width'
21090 case "$selectminbits" in
21091 '') safebits=`expr $ptrsize \* 8`
21092     case "$d_select" in
21093         $define)
21094                 $cat <<EOM
21095
21096 Checking to see on how many bits at a time your select() operates...
21097 EOM
21098                 $cat >try.c <<EOCP
21099 #include <sys/types.h>
21100 #$i_time I_TIME
21101 #$i_systime I_SYS_TIME
21102 #$i_systimek I_SYS_TIME_KERNEL
21103 #ifdef I_TIME
21104 #   include <time.h>
21105 #endif
21106 #ifdef I_SYS_TIME
21107 #   ifdef I_SYS_TIME_KERNEL
21108 #       define KERNEL
21109 #   endif
21110 #   include <sys/time.h>
21111 #   ifdef I_SYS_TIME_KERNEL
21112 #       undef KERNEL
21113 #   endif
21114 #endif
21115 #$i_sysselct I_SYS_SELECT
21116 #ifdef I_SYS_SELECT
21117 #include <sys/select.h>
21118 #endif
21119 #$d_socket HAS_SOCKET
21120 #ifdef HAS_SOCKET
21121 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
21122 #endif
21123 #include <stdio.h>
21124 #$i_stdlib I_STDLIB
21125 #ifdef I_STDLIB
21126 #include <stdlib.h>
21127 #endif
21128 $selecttype b;
21129 #define S sizeof(*(b))
21130 #define MINBITS 64
21131 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
21132 #define NBITS  (NBYTES * 8)
21133 int main() {
21134     char *s = (char *)malloc(NBYTES);
21135     struct timeval t;
21136     int i;
21137     FILE* fp;
21138     int fd;
21139
21140     if (!s)
21141         exit(1);
21142     fclose(stdin);
21143     fp = fopen("try.c", "r");
21144     if (fp == 0)
21145       exit(2);
21146     fd = fileno(fp);
21147     if (fd < 0)
21148       exit(3);
21149     b = ($selecttype)s;
21150     for (i = 0; i < NBITS; i++)
21151         FD_SET(i, b);
21152     t.tv_sec  = 0;
21153     t.tv_usec = 0;
21154     select(fd + 1, b, 0, 0, &t);
21155     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
21156     free(s);
21157     printf("%d\n", i + 1);
21158     return 0;
21159 }
21160 EOCP
21161                 set try
21162                 if eval $compile_ok; then
21163                         selectminbits=`$run ./try`
21164                         case "$selectminbits" in
21165                         '')     cat >&4 <<EOM
21166 Cannot figure out on how many bits at a time your select() operates.
21167 I'll play safe and guess it is $safebits bits.
21168 EOM
21169                                 selectminbits=$safebits
21170                                 bits="$safebits bits"
21171                                 ;;
21172                         1)      bits="1 bit" ;;
21173                         *)      bits="$selectminbits bits" ;;
21174                         esac
21175                         echo "Your select() operates on $bits at a time." >&4
21176                 else
21177                         rp='What is the minimum number of bits your select() operates on?'
21178                         case "$byteorder" in
21179                         12345678)       dflt=64 ;;
21180                         1234)           dflt=32 ;;
21181                         *)              dflt=1  ;;
21182                         esac
21183                         . ./myread
21184                         val=$ans
21185                         selectminbits="$val"
21186                 fi
21187                 $rm_try
21188                 ;;
21189         *)      : no select, so pick a harmless default
21190                 selectminbits=$safebits
21191                 ;;
21192         esac
21193         ;;
21194 esac
21195
21196 : Trace out the files included by signal.h, then look for SIGxxx names.
21197 if [ "X$fieldn" = X ]; then
21198         : Just make some guesses.  We check them later.
21199         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
21200 else
21201         xxx=`echo '#include <signal.h>' |
21202         $cppstdin $cppminus $cppflags 2>/dev/null |
21203         $grep '^[       ]*#.*include' |
21204         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
21205                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
21206 fi
21207 xxxfiles=''
21208 for xx in $xxx /dev/null ; do
21209         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
21210 done
21211 case "$xxxfiles" in
21212 '')     xxxfiles=`./findhdr signal.h` ;;
21213 esac
21214 xxx=`awk '
21215 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
21216         print substr($2, 4, 20)
21217 }
21218 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
21219         print substr($3, 4, 20)
21220 }' $xxxfiles`
21221 : Append some common names just in case the awk scan failed.
21222 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
21223 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
21224 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
21225 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
21226 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
21227
21228 : generate a few handy files for later
21229 $cat > signal.c <<EOCP
21230 #include <sys/types.h>
21231 #include <signal.h>
21232 #$i_stdlib I_STDLIB
21233 #ifdef I_STDLIB
21234 #include <stdlib.h>
21235 #endif
21236 #include <stdio.h>
21237 int main() {
21238
21239 /* Strange style to avoid deeply-nested #if/#else/#endif */
21240 #ifndef NSIG
21241 #  ifdef _NSIG
21242 #    define NSIG (_NSIG)
21243 #  endif
21244 #endif
21245
21246 #ifndef NSIG
21247 #  ifdef SIGMAX
21248 #    define NSIG (SIGMAX+1)
21249 #  endif
21250 #endif
21251
21252 #ifndef NSIG
21253 #  ifdef SIG_MAX
21254 #    define NSIG (SIG_MAX+1)
21255 #  endif
21256 #endif
21257
21258 #ifndef NSIG
21259 #  ifdef _SIG_MAX
21260 #    define NSIG (_SIG_MAX+1)
21261 #  endif
21262 #endif
21263
21264 #ifndef NSIG
21265 #  ifdef MAXSIG
21266 #    define NSIG (MAXSIG+1)
21267 #  endif
21268 #endif
21269
21270 #ifndef NSIG
21271 #  ifdef MAX_SIG
21272 #    define NSIG (MAX_SIG+1)
21273 #  endif
21274 #endif
21275
21276 #ifndef NSIG
21277 #  ifdef SIGARRAYSIZE
21278 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
21279 #  endif
21280 #endif
21281
21282 #ifndef NSIG
21283 #  ifdef _sys_nsig
21284 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
21285 #  endif
21286 #endif
21287
21288 /* Default to some arbitrary number that's big enough to get most
21289    of the common signals.
21290 */
21291 #ifndef NSIG
21292 #    define NSIG 50
21293 #endif
21294
21295 printf("NSIG %d\n", NSIG);
21296
21297 #ifndef JUST_NSIG
21298
21299 EOCP
21300
21301 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
21302 {
21303         printf "#ifdef SIG"; printf $1; printf "\n"
21304         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
21305         printf $1; printf ");\n"
21306         printf "#endif\n"
21307 }
21308 END {
21309         printf "#endif /* JUST_NSIG */\n";
21310         printf "exit(0);\n}\n";
21311 }
21312 ' >>signal.c
21313 $cat >signal.awk <<'EOP'
21314 BEGIN { ndups = 0 }
21315 $1 ~ /^NSIG$/ { nsig = $2 }
21316 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
21317     if ($2 > maxsig) { maxsig = $2 }
21318     if (sig_name[$2]) {
21319         dup_name[ndups] = $1
21320         dup_num[ndups] = $2
21321         ndups++
21322     }
21323     else {
21324         sig_name[$2] = $1
21325         sig_num[$2] = $2
21326     }
21327 }
21328 END {
21329     if (nsig == 0) {
21330         nsig = maxsig + 1
21331     }
21332     printf("NSIG %d\n", nsig);
21333     for (n = 1; n < nsig; n++) {
21334         if (sig_name[n]) {
21335             printf("%s %d\n", sig_name[n], sig_num[n])
21336         }
21337         else {
21338             printf("NUM%d %d\n", n, n)
21339         }
21340     }
21341     for (n = 0; n < ndups; n++) {
21342         printf("%s %d\n", dup_name[n], dup_num[n])
21343     }
21344 }
21345 EOP
21346 $cat >signal_cmd <<EOS
21347 $startsh
21348 if $test -s signal.lst; then
21349     echo "Using your existing signal.lst file"
21350         exit 0
21351 fi
21352 xxx="$xxx"
21353 EOS
21354 $cat >>signal_cmd <<'EOS'
21355
21356 set signal
21357 if eval $compile_ok; then
21358         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
21359                 $uniq | $awk -f signal.awk >signal.lst
21360 else
21361         echo "(I can't seem be able to compile the whole test program)" >&4
21362         echo "(I'll try it in little pieces.)" >&4
21363         set signal -DJUST_NSIG
21364         if eval $compile_ok; then
21365                 $run ./signal$_exe > signal.nsg
21366                 $cat signal.nsg
21367         else
21368                 echo "I can't seem to figure out how many signals you have." >&4
21369                 echo "Guessing 50." >&4
21370                 echo 'NSIG 50' > signal.nsg
21371         fi
21372         : Now look at all the signal names, one at a time.
21373         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
21374                 $cat > signal.c <<EOCP
21375 #include <sys/types.h>
21376 #include <signal.h>
21377 #include <stdio.h>
21378 int main() {
21379 printf("$xx %d\n", SIG${xx});
21380 return 0;
21381 }
21382 EOCP
21383                 set signal
21384                 if eval $compile; then
21385                         echo "SIG${xx} found."
21386                         $run ./signal$_exe  >> signal.ls1
21387                 else
21388                         echo "SIG${xx} NOT found."
21389                 fi
21390         done
21391         if $test -s signal.ls1; then
21392                 $cat signal.nsg signal.ls1 |
21393                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
21394         fi
21395
21396 fi
21397 if $test -s signal.lst; then
21398         :
21399 else
21400         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
21401         echo 'kill -l' >signal
21402         set X `csh -f <signal`
21403         $rm -f signal
21404         shift
21405         case $# in
21406         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
21407         esac
21408         echo $@ | $tr ' ' $trnl | \
21409             $awk '{ printf "%s %d\n", $1, ++s; }
21410                   END { printf "NSIG %d\n", ++s }' >signal.lst
21411 fi
21412 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
21413 EOS
21414 chmod a+x signal_cmd
21415 $eunicefix signal_cmd
21416
21417 : generate list of signal names
21418 echo " "
21419 case "$sig_name_init" in
21420 '') doinit=yes ;;
21421 *)  case "$sig_num_init" in
21422     ''|*,*) doinit=yes ;;
21423     esac ;;
21424 esac
21425 case "$doinit" in
21426 yes)
21427         echo "Generating a list of signal names and numbers..." >&4
21428         . ./signal_cmd
21429         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21430         sig_name=`$awk 'BEGIN { printf "ZERO " }
21431                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
21432         sig_num=`$awk  'BEGIN { printf "0 " }
21433                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
21434         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
21435                              !/^NSIG/   { printf "\"%s\", ", $1 }
21436                              END        { printf "0\n" }' signal.lst`
21437         sig_num_init=`$awk  'BEGIN      { printf "0, " }
21438                              !/^NSIG/   { printf "%d, ", $2}
21439                              END        { printf "0\n"}' signal.lst`
21440         ;;
21441 esac
21442 echo "The following $sig_count signals are available:"
21443 echo " "
21444 echo $sig_name | $awk \
21445 'BEGIN { linelen = 0 }
21446 {
21447         for (i = 1; i <= NF; i++) {
21448                 name = "SIG" $i " "
21449                 linelen = linelen + length(name)
21450                 if (linelen > 70) {
21451                         printf "\n"
21452                         linelen = length(name)
21453                 }
21454                 printf "%s", name
21455         }
21456         printf "\n"
21457 }'
21458 sig_size=`echo $sig_name | awk '{print NF}'`
21459 $rm -f signal signal.c signal.awk signal.lst signal_cmd
21460
21461 : Check size of size
21462 echo " "
21463 case "$sizetype" in
21464 *_t) zzz="$sizetype"    ;;
21465 *)   zzz="filesize"     ;;
21466 esac
21467 echo "Checking the size of $zzz..." >&4
21468 cat > try.c <<EOCP
21469 #include <sys/types.h>
21470 #include <stdio.h>
21471 #$i_stdlib I_STDLIB
21472 #ifdef I_STDLIB
21473 #include <stdlib.h>
21474 #endif
21475 int main() {
21476     printf("%d\n", (int)sizeof($sizetype));
21477     exit(0);
21478 }
21479 EOCP
21480 set try
21481 if eval $compile_ok; then
21482         yyy=`$run ./try`
21483         case "$yyy" in
21484         '')     sizesize=4
21485                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21486                 ;;
21487         *)      sizesize=$yyy
21488                 echo "Your $zzz size is $sizesize bytes."
21489                 ;;
21490         esac
21491 else
21492         sizesize=4
21493         echo "(I can't compile the test program--guessing $sizesize.)" >&4
21494 fi
21495
21496
21497 : check for socklen_t
21498 echo " "
21499 echo "Checking to see if you have socklen_t..." >&4
21500 $cat >try.c <<EOCP
21501 #include <sys/types.h>
21502 #$d_socket HAS_SOCKET
21503 #ifdef HAS_SOCKET
21504 #include <sys/socket.h>
21505 #endif
21506 int main() { socklen_t x = 16; }
21507 EOCP
21508 set try
21509 if eval $compile; then
21510         val="$define"
21511         echo "You have socklen_t."
21512 else
21513         val="$undef"
21514         echo "You do not have socklen_t."
21515         case "$sizetype" in
21516         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21517         esac
21518 fi
21519 $rm_try
21520 set d_socklen_t
21521 eval $setvar
21522
21523 : see if this is a socks.h system
21524 set socks.h i_socks
21525 eval $inhdr
21526
21527 : check for type of the size argument to socket calls
21528 case "$d_socket" in
21529 "$define")
21530         $cat <<EOM
21531
21532 Checking to see what type is the last argument of accept().
21533 EOM
21534         yyy=''
21535         case "$d_socklen_t" in
21536         "$define") yyy="$yyy socklen_t"
21537         esac
21538         yyy="$yyy $sizetype int long unsigned"
21539         for xxx in $yyy; do
21540                 case "$socksizetype" in
21541                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21542                         case "$usesocks" in
21543                         "$define")
21544                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21545                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21546                                         socksizetype="$xxx"
21547                                 fi
21548                                 ;;
21549                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21550                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21551                                         socksizetype="$xxx"
21552                                 fi
21553                                 ;;
21554                         esac
21555                         ;;
21556                 esac
21557         done
21558 : In case none of those worked, prompt the user.
21559         case "$socksizetype" in
21560         '')     rp='What is the type for socket address structure sizes?'
21561                 dflt='int'
21562                 . ./myread
21563                 socksizetype=$ans
21564                 ;;
21565         esac
21566         ;;
21567 *)      : no sockets, so pick relatively harmless default
21568         socksizetype='int'
21569         ;;
21570 esac
21571
21572 : see what type is used for signed size_t
21573 set ssize_t ssizetype int stdio.h sys/types.h
21574 eval $typedef
21575 dflt="$ssizetype"
21576 $cat > try.c <<EOM
21577 #include <stdio.h>
21578 #$i_stdlib I_STDLIB
21579 #ifdef I_STDLIB
21580 #include <stdlib.h>
21581 #endif
21582 #include <sys/types.h>
21583 #define Size_t $sizetype
21584 #define SSize_t $dflt
21585 int main()
21586 {
21587         if (sizeof(Size_t) == sizeof(SSize_t))
21588                 printf("$dflt\n");
21589         else if (sizeof(Size_t) == sizeof(int))
21590                 printf("int\n");
21591         else
21592                 printf("long\n");
21593         exit(0);
21594 }
21595 EOM
21596 echo " "
21597 set try
21598 if eval $compile_ok && $run ./try > /dev/null; then
21599         ssizetype=`$run ./try`
21600         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21601 else
21602         $cat >&4 <<EOM
21603 Help! I can't compile and run the ssize_t test program: please enlighten me!
21604 (This is probably a misconfiguration in your system or libraries, and
21605 you really ought to fix it.  Still, I'll try anyway.)
21606
21607 I need a type that is the same size as $sizetype, but is guaranteed to
21608 be signed.  Common values are ssize_t, int and long.
21609
21610 EOM
21611         rp="What signed type is the same size as $sizetype?"
21612         . ./myread
21613         ssizetype="$ans"
21614 fi
21615 $rm_try
21616
21617 : Check the size of st_ino
21618 $echo " "
21619 $echo "Checking the size of st_ino..." >&4
21620 $cat > try.c <<EOCP
21621 #include <sys/stat.h>
21622 #include <stdio.h>
21623 #$i_stdlib I_STDLIB
21624 #ifdef I_STDLIB
21625 #include <stdlib.h>
21626 #endif
21627 int main() {
21628     struct stat st;
21629     printf("%d\n", (int)sizeof(st.st_ino));
21630     exit(0);
21631 }
21632 EOCP
21633 set try
21634 if eval $compile_ok; then
21635         val=`$run ./try`
21636         case "$val" in
21637         '')     st_ino_size=4
21638                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21639                 ;;
21640         *)      st_ino_size=$val
21641                 $echo "Your st_ino is $st_ino_size bytes long."
21642                 ;;
21643         esac
21644 else
21645         st_ino_size=4
21646         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21647 fi
21648 $rm_try
21649
21650 : Check if st_ino is signed
21651 $echo " "
21652 $echo "Checking the sign of st_ino..." >&4
21653 $cat > try.c <<EOCP
21654 #include <sys/stat.h>
21655 #include <stdio.h>
21656 int main() {
21657         struct stat foo;
21658         foo.st_ino = -1;
21659         if (foo.st_ino < 0)
21660                 printf("-1\n");
21661         else
21662                 printf("1\n");
21663 }
21664 EOCP
21665 set try
21666 if eval $compile; then
21667         val=`$run ./try`
21668         case "$val" in
21669         '')     st_ino_sign=1
21670                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
21671                 ;;
21672         *)      st_ino_sign=$val
21673                 case "$st_ino_sign" in
21674                  1) $echo "Your st_ino is unsigned." ;;
21675                 -1) $echo "Your st_ino is signed."   ;;
21676                 esac
21677                 ;;
21678         esac
21679 else
21680         st_ino_sign=1
21681         $echo "(I can't compile the test program--guessing unsigned.)" >&4
21682 fi
21683 $rm_try
21684
21685 : see what type of char stdio uses.
21686 echo " "
21687 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21688 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21689         echo "Your stdio uses unsigned chars." >&4
21690         stdchar="unsigned char"
21691 else
21692         echo "Your stdio uses signed chars." >&4
21693         stdchar="char"
21694 fi
21695 $rm -f stdioh
21696
21697 : see what type uids are declared as in the kernel
21698 echo " "
21699 echo "Looking for the type for user ids returned by getuid()."
21700 set uid_t uidtype xxx stdio.h sys/types.h
21701 eval $typedef
21702 case "$uidtype" in
21703 xxx)
21704         xxx=`./findhdr sys/user.h`
21705         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21706         case $1 in
21707         unsigned) dflt="$1 $2" ;;
21708         *) dflt="$1" ;;
21709         esac
21710         ;;
21711 *) dflt="$uidtype";;
21712 esac
21713 case "$uidtype" in
21714 uid_t)  echo "uid_t found." ;;
21715 *)      rp="What is the type for user ids returned by getuid()?"
21716         . ./myread
21717         uidtype="$ans"
21718         ;;
21719 esac
21720
21721 : Check size of UID
21722 echo " "
21723 case "$uidtype" in
21724 *_t) zzz="$uidtype"     ;;
21725 *)   zzz="uid"          ;;
21726 esac
21727 echo "Checking the size of $zzz..." >&4
21728 cat > try.c <<EOCP
21729 #include <sys/types.h>
21730 #include <stdio.h>
21731 #$i_stdlib I_STDLIB
21732 #ifdef I_STDLIB
21733 #include <stdlib.h>
21734 #endif
21735 int main() {
21736     printf("%d\n", (int)sizeof($uidtype));
21737     exit(0);
21738 }
21739 EOCP
21740 set try
21741 if eval $compile_ok; then
21742         yyy=`$run ./try`
21743         case "$yyy" in
21744         '')     uidsize=4
21745                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21746                 ;;
21747         *)      uidsize=$yyy
21748                 echo "Your $zzz is $uidsize bytes long."
21749                 ;;
21750         esac
21751 else
21752         uidsize=4
21753         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21754 fi
21755
21756 : Check if UID is signed
21757 echo " "
21758 case "$uidtype" in
21759 *_t) zzz="$uidtype"     ;;
21760 *)   zzz="uid"          ;;
21761 esac
21762 echo "Checking the sign of $zzz..." >&4
21763 cat > try.c <<EOCP
21764 #include <sys/types.h>
21765 #include <stdio.h>
21766 int main() {
21767         $uidtype foo = -1;
21768         if (foo < 0)
21769                 printf("-1\n");
21770         else
21771                 printf("1\n");
21772 }
21773 EOCP
21774 set try
21775 if eval $compile; then
21776         yyy=`$run ./try`
21777         case "$yyy" in
21778         '')     uidsign=1
21779                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21780                 ;;
21781         *)      uidsign=$yyy
21782                 case "$uidsign" in
21783                  1) echo "Your $zzz is unsigned." ;;
21784                 -1) echo "Your $zzz is signed."   ;;
21785                 esac
21786                 ;;
21787         esac
21788 else
21789         uidsign=1
21790         echo "(I can't compile the test program--guessing unsigned.)" >&4
21791 fi
21792
21793
21794 : Check format string for UID
21795 echo " "
21796 $echo "Checking the format string to be used for uids..." >&4
21797
21798 case "$uidsign" in
21799 -1)     if $test X"$uidsize" = X"$ivsize"; then
21800                 uidformat="$ivdformat"
21801         else
21802                 if $test X"$uidsize" = X"$longsize"; then
21803                         uidformat='"ld"'
21804                 else
21805                         if $test X"$uidsize" = X"$intsize"; then
21806                                 uidformat='"d"'
21807                         else
21808                                 if $test X"$uidsize" = X"$shortsize"; then
21809                                         uidformat='"hd"'
21810                                 fi
21811                         fi
21812                 fi
21813         fi
21814         ;;
21815 *)      if $test X"$uidsize" = X"$uvsize"; then
21816                 uidformat="$uvuformat"
21817         else
21818                 if $test X"$uidsize" = X"$longsize"; then
21819                         uidformat='"lu"'
21820                 else
21821                         if $test X"$uidsize" = X"$intsize"; then
21822                                 uidformat='"u"'
21823                         else
21824                                 if $test X"$uidsize" = X"$shortsize"; then
21825                                         uidformat='"hu"'
21826                                 fi
21827                         fi
21828                 fi
21829         fi
21830         ;;
21831 esac
21832
21833 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
21834 echo " "
21835 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
21836 $cat >try.c <<'EOM'
21837 /* Intentionally a long probe as I'd like to sanity check that the exact
21838    approach is going to work, as thinking it will work, but only having it
21839    part working at runtime is worse than not having it.  */
21840
21841 #include <sys/types.h>
21842 #include <sys/sysctl.h>
21843 #include <sys/param.h>
21844 #include <stdio.h>
21845 #include <string.h>
21846 #include <stdlib.h>
21847 #include <unistd.h>
21848
21849 int
21850 main(int argc, char **argv) {
21851     char *buffer;
21852     char *argv_leaf = strrchr(argv[0], '/');
21853     char *buffer_leaf;
21854     size_t size = 0;
21855     int mib[4];
21856
21857     mib[0] = CTL_KERN;
21858     mib[1] = KERN_PROC;
21859     mib[2] = KERN_PROC_PATHNAME;
21860     mib[3] = -1;
21861
21862     if (!argv_leaf) {
21863         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21864         return 1;
21865     }
21866
21867     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
21868         perror("sysctl");
21869         return 2;
21870     }
21871
21872     if (size < strlen(argv_leaf) + 1) {
21873         fprintf(stderr, "size %lu is too short for a path\n",
21874                 (unsigned long) size);
21875         return 3;
21876     }
21877
21878     if (size > MAXPATHLEN * MAXPATHLEN) {
21879         fprintf(stderr, "size %lu is too long for a path\n",
21880                 (unsigned long) size);
21881         return 4;
21882     }
21883
21884     buffer = malloc(size);
21885     if (!buffer) {
21886         perror("malloc");
21887         return 5;
21888     }
21889
21890     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
21891         perror("sysctl");
21892         return 6;
21893     }
21894
21895     if (strlen(buffer) + 1 != size) {
21896         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
21897                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
21898         return 7;
21899     }
21900
21901
21902     if (*buffer != '/') {
21903         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
21904         return 8;
21905     }
21906
21907     if (strstr(buffer, "/./")) {
21908         fprintf(stderr, "Contains /./: '%s'\n", buffer);
21909         return 9;
21910     }
21911
21912     if (strstr(buffer, "/../")) {
21913         fprintf(stderr, "Contains /../: '%s'\n", buffer);
21914         return 10;
21915     }
21916
21917     buffer_leaf = strrchr(buffer, '/');
21918     if (strcmp(buffer_leaf, argv_leaf) != 0) {
21919         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
21920         return 11;
21921     }
21922
21923     free(buffer);
21924
21925     return 0;
21926 }
21927 EOM
21928
21929 val=$undef
21930 set try
21931 if eval $compile; then
21932         if $run ./try; then
21933                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
21934                 val="$define"
21935         else
21936                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
21937                 val="$undef"
21938         fi
21939 else
21940         echo "I'm unable to compile the test program." >&4
21941         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
21942         val="$undef"
21943 fi
21944 $rm_try
21945 set usekernprocpathname
21946 eval $setvar
21947
21948 : Determine if we can use _NSGetExecutablePath to find executing program
21949 echo " "
21950 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
21951 $cat >try.c <<'EOM'
21952 /* Intentionally a long probe as I'd like to sanity check that the exact
21953    approach is going to work, as thinking it will work, but only having it
21954    part working at runtime is worse than not having it.  */
21955 #include <mach-o/dyld.h>
21956 #include <stdio.h>
21957 #include <stdlib.h>
21958 #include <sys/param.h>
21959 #include <string.h>
21960
21961 int
21962 main(int argc, char **argv) {
21963     char buf[1];
21964     uint32_t size = sizeof(buf);
21965     int result;
21966     char *buffer;
21967     char *tidied;
21968     char *argv_leaf = strrchr(argv[0], '/');
21969     char *tidied_leaf;
21970
21971     if (!argv_leaf) {
21972         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21973         return 1;
21974     }
21975
21976     _NSGetExecutablePath(buf, &size);
21977     if (size > MAXPATHLEN * MAXPATHLEN) {
21978         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
21979                 (unsigned int) size);
21980         return 2;
21981     }
21982
21983     buffer = malloc(size);
21984     if (!buffer) {
21985         perror("malloc");
21986         return 3;
21987     }
21988
21989     result = _NSGetExecutablePath(buffer, &size);
21990     if (result != 0) {
21991         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
21992                 result, (unsigned int) size);
21993         return 4;
21994     }
21995
21996     tidied = realpath(buffer, NULL);
21997     if (!tidied) {
21998         perror("realpath");
21999         return 5;
22000     }
22001
22002     free(buffer);
22003
22004     if (*tidied != '/') {
22005         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22006         return 6;
22007     }
22008
22009     if (strstr(tidied, "/./")) {
22010         fprintf(stderr, "Contains /./: '%s'\n", tidied);
22011         return 7;
22012     }
22013
22014     if (strstr(tidied, "/../")) {
22015         fprintf(stderr, "Contains /../: '%s'\n", tidied);
22016         return 8;
22017     }
22018
22019     tidied_leaf = strrchr(tidied, '/');
22020     if (strcmp(tidied_leaf, argv_leaf) != 0) {
22021         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
22022         return 9;
22023     }
22024
22025     free(tidied);
22026
22027     return 0;
22028 }
22029 EOM
22030
22031 val=$undef
22032 set try
22033 if eval $compile; then
22034         if $run ./try; then
22035                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
22036                 val="$define"
22037         else
22038                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
22039         fi
22040 else
22041         echo "I'm unable to compile the test program." >&4
22042         echo "I'll assume no _NSGetExecutablePath here." >&4
22043 fi
22044 $rm_try
22045 set usensgetexecutablepath
22046 eval $setvar
22047
22048 : Check if site customization support was requested
22049 case "$usesitecustomize" in
22050     $define|true|[Yy]*)
22051         usesitecustomize="$define"
22052         ;;
22053     *)
22054         usesitecustomize="$undef"
22055         ;;
22056     esac
22057
22058 : see if prototypes support variable argument declarations
22059 echo " "
22060 case "$prototype$i_stdarg" in
22061 $define$define)
22062         echo "It appears we'll be able to prototype varargs functions." >&4
22063         val="$define"
22064         ;;
22065 *)
22066         echo "Too bad... We won't be using prototyped varargs functions..." >&4
22067         val="$undef"
22068         ;;
22069 esac
22070 set vaproto
22071 eval $setvar
22072
22073 : determine compiler compiler
22074 case "$yacc" in
22075 '')
22076         dflt=yacc;;
22077 *)
22078         dflt="$yacc";;
22079 esac
22080 echo " "
22081 comp='yacc'
22082 if $test -f "$byacc$_exe"; then
22083         dflt="$byacc"
22084         comp="byacc or $comp"
22085 fi
22086 if $test -f "$bison$_exe"; then
22087         comp="$comp or bison -y"
22088 fi
22089 rp="Which compiler compiler ($comp) shall I use?"
22090 . ./myread
22091 yacc="$ans"
22092 case "$yacc" in
22093 *bis*)
22094         case "$yacc" in
22095         *-y*) ;;
22096         *)
22097                 yacc="$yacc -y"
22098                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
22099                 ;;
22100         esac
22101         ;;
22102 esac
22103
22104 : see if this is a assert.h system
22105 set assert.h i_assert
22106 eval $inhdr
22107
22108 : see if this is a bfd.h system
22109 set bfd.h i_bfd
22110 eval $inhdr
22111
22112 : see if this is an execinfo.h system
22113 set execinfo.h i_execinfo
22114 eval $inhdr
22115
22116 : see if this is a fenv.h system
22117 set fenv.h i_fenv
22118 eval $inhdr
22119
22120 : see if this is a fp.h system
22121 set fp.h i_fp
22122 eval $inhdr
22123
22124 : see if this is a fp_class.h system
22125 set fp_class.h i_fp_class
22126 eval $inhdr
22127
22128 : see if gdbm.h is available
22129 set gdbm.h t_gdbm
22130 eval $inhdr
22131 case "$t_gdbm" in
22132 $define)
22133         : see if gdbm_open exists
22134         set gdbm_open d_gdbm_open
22135         eval $inlibc
22136         case "$d_gdbm_open" in
22137         $undef)
22138                 t_gdbm="$undef"
22139                 echo "We won't be including <gdbm.h>"
22140                 ;;
22141         esac
22142         ;;
22143 esac
22144 val="$t_gdbm"
22145 set i_gdbm
22146 eval $setvar
22147
22148 : see if this is a ieeefp.h system
22149 case "$i_ieeefp" in
22150 '' ) set ieeefp.h i_ieeefp
22151      eval $inhdr
22152      ;;
22153 esac
22154
22155 : see if this is a libutil.h system
22156 set libutil.h i_libutil
22157 eval $inhdr
22158
22159 : see if mach cthreads are available
22160 if test "X$usethreads" = "X$define"; then
22161         set mach/cthreads.h i_machcthr
22162         eval $inhdr
22163 else
22164         i_machcthr="$undef"
22165 fi
22166
22167 : see if this is a mntent.h system
22168 set mntent.h i_mntent
22169 eval $inhdr
22170
22171 : see if net/errno.h is available
22172 val=''
22173 set net/errno.h val
22174 eval $inhdr
22175
22176 : Unfortunately, it causes problems on some systems.  Arrgh.
22177 case "$val" in
22178 $define)
22179         cat > try.c <<'EOM'
22180 #include <stdio.h>
22181 #include <errno.h>
22182 #include <net/errno.h>
22183 int func()
22184 {
22185         return ENOTSOCK;
22186 }
22187 EOM
22188         if $cc $ccflags -c try.c >/dev/null 2>&1; then
22189                 echo "We'll be including <net/errno.h>." >&4
22190         else
22191                 echo "We won't be including <net/errno.h>." >&4
22192                 val="$undef"
22193         fi
22194         $rm_try
22195         ;;
22196 esac
22197 set i_neterrno
22198 eval $setvar
22199
22200 : see if netinet/tcp.h is available
22201 set netinet/tcp.h i_netinettcp
22202 eval $inhdr
22203
22204 : see if this is a poll.h system
22205 set poll.h i_poll
22206 eval $inhdr
22207
22208 : see if this is a prot.h system
22209 set prot.h i_prot
22210 eval $inhdr
22211
22212 : Preprocessor symbols
22213 echo " "
22214 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
22215 $cat <<'EOSH' > Cppsym.know
22216 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
22217 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
22218 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
22219 arch_pwr ardent ARM ARM32 atarist att386 att3b
22220 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
22221 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
22222 byteorder byte_order
22223 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
22224 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
22225 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
22226 ELF encore EPI EXTENSIONS
22227 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
22228 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
22229 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
22230 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
22231 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400 hp9000s500
22232 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
22233 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
22234 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
22235 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
22236 ksr1
22237 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
22238 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
22239 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
22240 luna88k Lynx
22241 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
22242 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
22243 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
22244 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
22245 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS
22246 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
22247 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
22248 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
22249 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
22250 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
22251 ns32000 ns32016 ns32332 ns32k nsc32000
22252 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
22253 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
22254 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
22255 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
22256 QK_USER QNX
22257 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
22258 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
22259 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
22260 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
22261 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
22262 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
22263 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
22264 SYSV4 SYSV5 sysV68 sysV88
22265 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
22266 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
22267 tower32_800 tower32_850 tss
22268 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
22269 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
22270 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
22271 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
22272 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
22273 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
22274 uxpm uxps
22275 vax venix VMESA vms
22276 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
22277 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
22278 z8000 zarch
22279 EOSH
22280 # Maybe put other stuff here too.
22281 ./tr '-' '_' <<EOSH >>Cppsym.know
22282 $osname
22283 EOSH
22284 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
22285 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
22286 $cat Cppsym.know > Cppsym.c
22287 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
22288 $rm -f Cppsym.a Cppsym.b Cppsym.c
22289 cat <<EOSH > Cppsym
22290 $startsh
22291 if $test \$# -gt 0; then
22292     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
22293     if $test -s Cppsym.got; then
22294         $rm -f Cppsym.got
22295         exit 0
22296     fi
22297     $rm -f Cppsym.got
22298     exit 1
22299 else
22300     $tr " " "$trnl" | ./Cppsym.try
22301     exit 0
22302 fi
22303 EOSH
22304 chmod +x Cppsym
22305 $eunicefix Cppsym
22306 cat <<EOSH > Cppsym.try
22307 $startsh
22308 cat <<'EOCP' > try.c
22309 #include <stdio.h>
22310 #if cpp_stuff == 1
22311 #define STRINGIFY(a)    "a"
22312 #endif
22313 #if cpp_stuff == 42
22314 #define StGiFy(a)  #a
22315 #define STRINGIFY(a)    StGiFy(a)
22316 #endif
22317 #if $cpp_stuff != 1 && $cpp_stuff != 42
22318 #   include "Bletch: How does this C preprocessor stringify macros?"
22319 #endif
22320 int main() {
22321 EOCP
22322 $awk \\
22323 EOSH
22324 cat <<'EOSH' >> Cppsym.try
22325 'length($1) > 0 {
22326     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
22327     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
22328     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
22329     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
22330 }'       >> try.c
22331 echo 'return 0;}' >> try.c
22332 EOSH
22333 cat <<EOSH >> Cppsym.try
22334 ccflags="$ccflags"
22335 case "$osname-$gccversion" in
22336 irix-) ccflags="\$ccflags -woff 1178" ;;
22337 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
22338 esac
22339 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
22340 EOSH
22341 chmod +x Cppsym.try
22342 $eunicefix Cppsym.try
22343 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
22344 : Add in any Linux cpp "predefined macros":
22345 case "$osname::$gccversion" in
22346   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
22347     tHdrH=_tmpHdr
22348     rm -f $tHdrH'.h' $tHdrH
22349     touch $tHdrH'.h'
22350     # Filter out macro arguments, such as Linux's __INT8_C(c)
22351     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
22352        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
22353        if [ -s $tHdrH'_cppsym.real' ]; then
22354           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
22355        fi
22356     fi
22357     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
22358   ;;
22359 esac
22360 : now check the C compiler for additional symbols
22361 postprocess_cc_v=''
22362 case "$osname" in
22363 aix) postprocess_cc_v="|$tr , ' '" ;;
22364 esac
22365 $cat >ccsym <<EOS
22366 $startsh
22367 $cat >tmp.c <<EOF
22368 extern int foo;
22369 EOF
22370 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
22371 do
22372         case "\$i" in
22373         -D*) echo "\$i" | $sed 's/^-D//';;
22374         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
22375         esac
22376 done
22377 $rm_try
22378 EOS
22379 postprocess_cc_v=''
22380 chmod +x ccsym
22381 $eunicefix ccsym
22382 ./ccsym > ccsym1.raw
22383 if $test -s ccsym1.raw; then
22384     $sort ccsym1.raw | $uniq >ccsym.raw
22385 else
22386     mv ccsym1.raw ccsym.raw
22387 fi
22388
22389 $awk '/\=/ { print $0; next }
22390         { print $0"=1" }' ccsym.raw >ccsym.list
22391 $comm -13 Cppsym.true ccsym.list >ccsym.own
22392 $comm -12 Cppsym.true ccsym.list >ccsym.com
22393 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
22394 also=''
22395 if $test -z ccsym.raw; then
22396         echo "Your C compiler doesn't seem to define any symbols!" >&4
22397         echo " "
22398         echo "However, your C preprocessor defines the following symbols:"
22399         $cat Cppsym.true
22400         ccsymbols=''
22401         cppsymbols=`$cat Cppsym.true`
22402         cppsymbols=`echo $cppsymbols`
22403         cppccsymbols="$cppsymbols"
22404 else
22405         if $test -s ccsym.com; then
22406                 echo "Your C compiler and pre-processor define these symbols:"
22407                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
22408                 also='also '
22409                 symbols='ones'
22410                 cppccsymbols=`$cat ccsym.com`
22411                 cppccsymbols=`echo $cppccsymbols`
22412                 $test "$silent" || sleep 1
22413         fi
22414         if $test -s ccsym.cpp; then
22415                 $test "$also" && echo " "
22416                 echo "Your C pre-processor ${also}defines the following symbols:"
22417                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22418                 also='further '
22419                 cppsymbols=`$cat ccsym.cpp`
22420                 cppsymbols=`echo $cppsymbols`
22421                 $test "$silent" || sleep 1
22422         fi
22423         if $test -s ccsym.own; then
22424                 $test "$also" && echo " "
22425                 echo "Your C compiler ${also}defines the following cpp symbols:"
22426                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
22427                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22428                 ccsymbols=`$cat ccsym.own`
22429                 ccsymbols=`echo $ccsymbols`
22430                 $test "$silent" || sleep 1
22431         fi
22432 fi
22433
22434 : add -D_FORTIFY_SOURCE if feasible and not already there
22435 case "$gccversion" in
22436 4.*)    case "$optimize$ccflags" in
22437         *-O*)   case "$ccflags$cppsymbols" in
22438                 *_FORTIFY_SOURCE=*) # Don't add it again.
22439                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
22440                         ;;
22441                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
22442                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
22443                         ;;
22444                 esac
22445                 ;;
22446         *)      echo "You have gcc 4.* but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
22447                 ;;
22448         esac
22449         ;;
22450 *)      echo "You seem not to have gcc 4.*, not adding -D_FORTIFY_SOURCE." >&4
22451         ;;
22452 esac
22453
22454 : see if this is a termio system
22455 val="$undef"
22456 val2="$undef"
22457 val3="$undef"
22458 if $test `./findhdr termios.h`; then
22459     set tcsetattr i_termios
22460     eval $inlibc
22461     val3="$i_termios"
22462 fi
22463 echo " "
22464 case "$val3" in
22465     "$define") echo "You have POSIX termios.h... good!" >&4;;
22466     *)  if ./Cppsym pyr; then
22467             case "`$run /bin/universe`" in
22468                 ucb) if $test `./findhdr sgtty.h`; then
22469                         val2="$define"
22470                         echo "<sgtty.h> found." >&4
22471                     else
22472                         echo "System is pyramid with BSD universe."
22473                         ./warn "<sgtty.h> not found--you could have problems."
22474                     fi;;
22475                 *)  if $test `./findhdr termio.h`; then
22476                         val="$define"
22477                         echo "<termio.h> found." >&4
22478                     else
22479                         echo "System is pyramid with USG universe."
22480                         ./warn "<termio.h> not found--you could have problems."
22481                     fi;;
22482             esac
22483         elif ./usg; then
22484             if $test `./findhdr termio.h`; then
22485                 echo "<termio.h> found." >&4
22486                 val="$define"
22487             elif $test `./findhdr sgtty.h`; then
22488                 echo "<sgtty.h> found." >&4
22489                 val2="$define"
22490             else
22491                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
22492             fi
22493         else
22494             if $test `./findhdr sgtty.h`; then
22495                 echo "<sgtty.h> found." >&4
22496                 val2="$define"
22497             elif $test `./findhdr termio.h`; then
22498                 echo "<termio.h> found." >&4
22499                 val="$define"
22500             else
22501                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
22502             fi
22503         fi;;
22504 esac
22505 set i_termio; eval $setvar
22506 val=$val2; set i_sgtty; eval $setvar
22507 val=$val3; set i_termios; eval $setvar
22508
22509 : see if stdbool is available
22510 : we want a real compile instead of Inhdr because some Solaris systems
22511 : have stdbool.h, but it can only be used if the compiler indicates it
22512 : is sufficiently c99-compliant.
22513 echo " "
22514 $cat >try.c <<EOCP
22515 #include <stdio.h>
22516 #include <stdbool.h>
22517 int func(bool x)
22518 {
22519     return x ? 1 : 0;
22520 }
22521 int main(int argc, char **argv)
22522 {
22523     return func(0);
22524 }
22525 EOCP
22526 set try
22527 if eval $compile; then
22528         echo "<stdbool.h> found." >&4
22529         val="$define"
22530 else
22531         echo "<stdbool.h> NOT found." >&4
22532         val="$undef"
22533 fi
22534 $rm_try
22535 set i_stdbool
22536 eval $setvar
22537
22538 : see if stddef is available
22539 set stddef.h i_stddef
22540 eval $inhdr
22541
22542 : see if stdint is available
22543 set stdint.h i_stdint
22544 eval $inhdr
22545
22546 : see if sys/access.h is available
22547 set sys/access.h i_sysaccess
22548 eval $inhdr
22549
22550 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
22551 set sys/filio.h i_sysfilio
22552 eval $inhdr
22553 echo " "
22554 if $test `./findhdr sys/ioctl.h`; then
22555         val="$define"
22556         echo '<sys/ioctl.h> found.' >&4
22557 else
22558         val="$undef"
22559         if $test $i_sysfilio = "$define"; then
22560             echo '<sys/ioctl.h> NOT found.' >&4
22561         else
22562                 $test $i_sgtty = "$define" && xxx="sgtty.h"
22563                 $test $i_termio = "$define" && xxx="termio.h"
22564                 $test $i_termios = "$define" && xxx="termios.h"
22565 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
22566         fi
22567 fi
22568 set i_sysioctl
22569 eval $setvar
22570
22571 : see if socket ioctl defs are in sys/sockio.h
22572 echo " "
22573 xxx=`./findhdr sys/sockio.h`
22574 if $test "$xxx"; then
22575         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
22576                 val="$define"
22577                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
22578         else
22579                 val="$undef"
22580                 echo "No socket ioctls found in <sys/sockio.h>." >&4
22581         fi
22582 else
22583         val="$undef"
22584         $cat <<EOM
22585 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
22586 EOM
22587 fi
22588 set i_syssockio
22589 eval $setvar
22590
22591 : see if this is a syslog.h system
22592 set syslog.h i_syslog
22593 eval $inhdr
22594
22595 : see if this is a sys/mode.h system
22596 set sys/mode.h i_sysmode
22597 eval $inhdr
22598
22599 : see if there is a sys/poll.h file
22600 set sys/poll.h i_syspoll
22601 eval $inhdr
22602
22603 : see if sys/resource.h has to be included
22604 set sys/resource.h i_sysresrc
22605 eval $inhdr
22606
22607 : see if sys/security.h is available
22608 set sys/security.h i_syssecrt
22609 eval $inhdr
22610
22611 : see if this is a sys/statvfs.h system
22612 set sys/statvfs.h i_sysstatvfs
22613 eval $inhdr
22614
22615 : see if this is a sys/un.h system
22616 set sys/un.h i_sysun
22617 eval $inhdr
22618
22619 : see if this is a sys/utsname.h system
22620 set sys/utsname.h i_sysutsname
22621 eval $inhdr
22622
22623 : see if this is a syswait system
22624 set sys/wait.h i_syswait
22625 eval $inhdr
22626
22627 : see if this is a ustat.h system
22628 set ustat.h i_ustat
22629 eval $inhdr
22630
22631 : see if this is an utime system
22632 set utime.h i_utime
22633 eval $inhdr
22634
22635 : see if this is a vfork system
22636 case "$d_vfork" in
22637 "$define")
22638         set vfork.h i_vfork
22639         eval $inhdr
22640         ;;
22641 *)
22642         i_vfork="$undef"
22643         ;;
22644 esac
22645
22646 : Check extensions
22647 echo " "
22648 echo "Looking for extensions..." >&4
22649 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
22650 : contain old or inaccurate or duplicate values.
22651 nonxs_extensions=''
22652 xs_extensions=''
22653 : We do not use find because it might not be available.
22654 : We do not just use MANIFEST because the user may have dropped
22655 : some additional extensions into the source tree and expect them
22656 : to be built.
22657
22658 : Function to recursively find available extensions, ignoring DynaLoader
22659 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
22660 : In 5.10.1 and later, extensions are stored in directories
22661 : like File-Glob instead of the older File/Glob/.
22662 find_extensions='
22663     for xxx in *; do
22664         case "$xxx" in
22665             DynaLoader|dynaload) ;;
22666             *)
22667             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
22668             case "$this_ext" in
22669                 Scalar/List/Utils) this_ext="List/Util" ;;
22670                 PathTools)         this_ext="Cwd"       ;;
22671             esac;
22672             echo " $xs_extensions $nonxs_extensions" > $tdir/$$.tmp;
22673             if $contains " $this_ext " $tdir/$$.tmp; then
22674                 echo >&4;
22675                 echo "Duplicate directories detected for extension $xxx" >&4;
22676                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
22677                 case "$knowitall" in
22678                 "") dflt=y;;
22679                 *) dflt=n;;
22680                 esac;
22681                 . ../UU/myread;
22682                 case "$ans" in
22683                 n*|N*) ;;
22684                 *) echo >&4;
22685                     echo "Ok.  Stopping Configure." >&4;
22686                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
22687                     exit 1;;
22688                 esac;
22689                 echo "Ok.  You will need to correct config.sh before running make." >&4;
22690             fi;
22691             $ls -1 $xxx > $tdir/$$.tmp;
22692             if   $contains "\.xs$" $tdir/$$.tmp > /dev/null 2>&1; then
22693                 xs_extensions="$xs_extensions $this_ext";
22694             elif $contains "\.c$"  $tdir/$$.tmp > /dev/null 2>&1; then
22695                 xs_extensions="$xs_extensions $this_ext";
22696             elif $test -d $xxx; then
22697                 nonxs_extensions="$nonxs_extensions $this_ext";
22698             fi;
22699             $rm -f $tdir/$$.tmp;
22700             ;;
22701         esac;
22702     done'
22703 tdir=`pwd`
22704 cd "$rsrc/cpan"
22705 set X
22706 shift
22707 eval $find_extensions
22708 cd "$rsrc/dist"
22709 set X
22710 shift
22711 eval $find_extensions
22712 cd "$rsrc/ext"
22713 set X
22714 shift
22715 eval $find_extensions
22716 set X $xs_extensions
22717 shift
22718 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22719 set X $nonxs_extensions
22720 shift
22721 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22722 cd "$tdir"
22723 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
22724
22725 : Now see which are supported on this system.
22726 avail_ext=''
22727 for xxx in $xs_extensions ; do
22728         case "$xxx" in
22729         DB_File|db_file)
22730                 case "$i_db" in
22731                 $define) avail_ext="$avail_ext $xxx" ;;
22732                 esac
22733                 ;;
22734         GDBM_File|gdbm_fil)
22735                 case "$i_gdbm" in
22736                 $define) avail_ext="$avail_ext $xxx" ;;
22737                 esac
22738                 ;;
22739         I18N/Langinfo|i18n_lan)
22740                 case "$i_langinfo$d_nl_langinfo" in
22741                 $define$define) avail_ext="$avail_ext $xxx" ;;
22742                 esac
22743                 ;;
22744         IPC/SysV|ipc/sysv)
22745                 : XXX Do we need a useipcsysv variable here
22746                 case "${d_msg}${d_sem}${d_shm}" in
22747                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
22748                 esac
22749                 ;;
22750         NDBM_File|ndbm_fil)
22751                 case "$d_ndbm" in
22752                 $define)
22753                     case "$osname-$use64bitint" in
22754                     hpux-define)
22755                         case "$libs" in
22756                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
22757                         esac
22758                         ;;
22759                     *) avail_ext="$avail_ext $xxx" ;;
22760                     esac
22761                     ;;
22762                 esac
22763                 ;;
22764         ODBM_File|odbm_fil)
22765                 case "${i_dbm}${i_rpcsvcdbm}" in
22766                 *"${define}"*)
22767                     case "$d_cplusplus" in
22768                     define) ;; # delete as a function name will not work
22769                     *)  case "$osname-$use64bitint" in
22770                         hpux-define)
22771                             case "$libs" in
22772                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22773                             esac
22774                             ;;
22775                         *) avail_ext="$avail_ext $xxx" ;;
22776                         esac
22777                         ;;
22778                     esac
22779                     ;;
22780                 esac
22781                 ;;
22782         Opcode|opcode)
22783                 case "$useopcode" in
22784                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22785                 esac
22786                 ;;
22787         POSIX|posix)
22788                 case "$useposix" in
22789                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22790                 esac
22791                 ;;
22792         Socket|socket)
22793                 case "$d_socket" in
22794                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22795                 esac
22796                 ;;
22797         Sys/Syslog|sys/syslog)
22798                 : XXX syslog requires socket
22799                 case "$d_socket" in
22800                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22801                 esac
22802                 ;;
22803         Thread|thread)
22804                 case "$usethreads" in
22805                 true|$define|y)
22806                         case "$use5005threads" in
22807                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
22808                         esac
22809                 esac
22810                 ;;
22811         threads|threads/shared)
22812                 # threads and threads::shared are special cases.
22813                 # To stop people from asking "Perl 5.8.0 was supposed
22814                 # to have this new fancy threads implementation but my
22815                 # perl doesn't have it" and from people trying to
22816                 # (re)install the threads module using CPAN.pm and
22817                 # CPAN.pm then offering to reinstall Perl 5.8.0,
22818                 # the threads.pm and threads/shared.pm will always be
22819                 # there, croaking informatively ("you need to rebuild
22820                 # all of Perl with threads, sorry") when threads haven't
22821                 # been compiled in.
22822                 # --jhi
22823                 avail_ext="$avail_ext $xxx"
22824                 ;;
22825         VMS*)
22826                 ;;
22827         Win32*)
22828                 case "$osname" in
22829                 cygwin) avail_ext="$avail_ext $xxx" ;;
22830                 esac
22831                 ;;
22832         XS/APItest|xs/apitest)
22833                 # This is just for testing.  Skip it unless we have dynamic loading.
22834
22835                 case "$usedl" in
22836                 $define) avail_ext="$avail_ext $xxx" ;;
22837                 esac
22838                 ;;
22839         XS/Typemap|xs/typemap)
22840                 # This is just for testing.  Skip it unless we have dynamic loading.
22841                 case "$usedl" in
22842                 $define) avail_ext="$avail_ext $xxx" ;;
22843                 esac
22844                 ;;
22845         *)      avail_ext="$avail_ext $xxx"
22846                 ;;
22847         esac
22848 done
22849
22850 set X $avail_ext
22851 shift
22852 avail_ext="$*"
22853
22854 case "$onlyextensions" in
22855 '') ;;
22856 *)  keepextensions=''
22857     echo "You have requested that only certain extensions be included..." >&4
22858     for i in $onlyextensions; do
22859         case " $avail_ext " in
22860         *" $i "*)
22861             echo "Keeping extension $i."
22862             keepextensions="$keepextensions $i"
22863             ;;
22864         *) echo "Ignoring extension $i." ;;
22865         esac
22866     done
22867     avail_ext="$keepextensions"
22868     ;;
22869 esac
22870
22871 case "$noextensions" in
22872 '') ;;
22873 *)  keepextensions=''
22874     echo "You have requested that certain extensions be ignored..." >&4
22875     for i in $avail_ext; do
22876         case " $noextensions " in
22877         *" $i "*) echo "Ignoring extension $i." ;;
22878         *) echo "Keeping extension $i.";
22879            keepextensions="$keepextensions $i"
22880            ;;
22881         esac
22882     done
22883     avail_ext="$keepextensions"
22884     ;;
22885 esac
22886
22887 : Now see which nonxs extensions are supported on this system.
22888 : For now assume all are.
22889 nonxs_ext=''
22890 for xxx in $nonxs_extensions ; do
22891         case "$xxx" in
22892         VMS*)
22893                 ;;
22894         *)      nonxs_ext="$nonxs_ext $xxx"
22895                 ;;
22896         esac
22897 done
22898
22899 set X $nonxs_ext
22900 shift
22901 nonxs_ext="$*"
22902
22903 case $usedl in
22904 $define)
22905         $cat <<EOM
22906 A number of extensions are supplied with $package.  You may choose to
22907 compile these extensions for dynamic loading (the default), compile
22908 them into the $package executable (static loading), or not include
22909 them at all.  Answer "none" to include no extensions.
22910 Note that DynaLoader is always built and need not be mentioned here.
22911
22912 EOM
22913         case "$dynamic_ext" in
22914         '')
22915                 : Exclude those listed in static_ext
22916                 dflt=''
22917                 for xxx in $avail_ext; do
22918                         case " $static_ext " in
22919                         *" $xxx "*) ;;
22920                         *) dflt="$dflt $xxx" ;;
22921                         esac
22922                 done
22923                 set X $dflt
22924                 shift
22925                 dflt="$*"
22926                 ;;
22927         *)      dflt="$dynamic_ext"
22928                 # Perhaps we are reusing an old out-of-date config.sh.
22929                 case "$hint" in
22930                 previous)
22931                         if test X"$dynamic_ext" != X"$avail_ext"; then
22932                                 $cat <<EOM
22933 NOTICE:  Your previous config.sh list may be incorrect.
22934 The extensions now available to you are
22935         ${avail_ext}
22936 but the default list from your previous config.sh is
22937         ${dynamic_ext}
22938
22939 EOM
22940                         fi
22941                         ;;
22942                 esac
22943                 ;;
22944         esac
22945         case "$dflt" in
22946         '')     dflt=none;;
22947         esac
22948         rp="What extensions do you wish to load dynamically?"
22949         . ./myread
22950         case "$ans" in
22951         none) dynamic_ext=' ' ;;
22952         *) dynamic_ext="$ans" ;;
22953         esac
22954
22955         case "$static_ext" in
22956         '')
22957                 : Exclude those already listed in dynamic linking
22958                 dflt=''
22959                 for xxx in $avail_ext; do
22960                         case " $dynamic_ext " in
22961                         *" $xxx "*) ;;
22962                         *) dflt="$dflt $xxx" ;;
22963                         esac
22964                 done
22965                 set X $dflt
22966                 shift
22967                 dflt="$*"
22968                 ;;
22969         *)  dflt="$static_ext"
22970                 ;;
22971         esac
22972
22973         case "$dflt" in
22974         '')     dflt=none;;
22975         esac
22976         rp="What extensions do you wish to load statically?"
22977         . ./myread
22978         case "$ans" in
22979         none) static_ext=' ' ;;
22980         *) static_ext="$ans" ;;
22981         esac
22982         ;;
22983 *)
22984         $cat <<EOM
22985 A number of extensions are supplied with $package.  Answer "none"
22986 to include no extensions.
22987 Note that DynaLoader is always built and need not be mentioned here.
22988
22989 EOM
22990         case "$static_ext" in
22991         '') dflt="$avail_ext" ;;
22992         *)      dflt="$static_ext"
22993                 # Perhaps we are reusing an old out-of-date config.sh.
22994                 case "$hint" in
22995                 previous)
22996                         if test X"$static_ext" != X"$avail_ext"; then
22997                                 $cat <<EOM
22998 NOTICE:  Your previous config.sh list may be incorrect.
22999 The extensions now available to you are
23000         ${avail_ext}
23001 but the default list from your previous config.sh is
23002         ${static_ext}
23003
23004 EOM
23005                         fi
23006                         ;;
23007                 esac
23008                 ;;
23009         esac
23010         : Exclude those that are not xs extensions
23011         case "$dflt" in
23012         '')     dflt=none;;
23013         esac
23014         rp="What extensions do you wish to include?"
23015         . ./myread
23016         case "$ans" in
23017         none) static_ext=' ' ;;
23018         *) static_ext="$ans" ;;
23019         esac
23020         ;;
23021 esac
23022 #
23023 # Encode is a special case.  If we are building Encode as a static
23024 # extension, we need to explicitly list its subextensions as well.
23025 # For other nested extensions, this is handled automatically by
23026 # the appropriate Makefile.PL.
23027 case " $static_ext " in
23028         *" Encode "*) # Add the subextensions of Encode
23029         cd "$rsrc/cpan"
23030         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
23031                 static_ext="$static_ext Encode/$xxx"
23032                 known_extensions="$known_extensions Encode/$xxx"
23033         done
23034         cd "$tdir"
23035         ;;
23036 esac
23037
23038 set X $dynamic_ext $static_ext $nonxs_ext
23039 shift
23040 extensions="$*"
23041
23042 # Sanity check:  We require an extension suitable for use with
23043 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
23044 # should show up as failures in the test suite, but it's helpful to
23045 # catch them now.) The 'extensions' list is normally sorted
23046 # alphabetically, so we need to accept either
23047 #    DB_File ... Fcntl ... IO  ....
23048 # or something like
23049 #    Fcntl ... NDBM_File ... IO  ....
23050 case " $extensions"  in
23051 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
23052 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
23053 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
23054 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
23055    echo "WARNING: The Perl you are building will be quite crippled." >& 4
23056    ;;
23057 esac
23058
23059 : Remove libraries needed only for extensions
23060 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
23061 : The exception is SunOS 4.x, which needs them.
23062 case "${osname}X${osvers}" in
23063 sunos*X4*)
23064     perllibs="$libs"
23065     ;;
23066 *) case "$usedl" in
23067     $define|true|[yY]*)
23068             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
23069             shift
23070             perllibs="$*"
23071             ;;
23072     *)  perllibs="$libs"
23073             ;;
23074     esac
23075     ;;
23076 esac
23077
23078 : Remove build directory name from cppstdin so it can be used from
23079 : either the present location or the final installed location.
23080 echo " "
23081 : Get out of the UU directory to get correct path name.
23082 cd ..
23083 case "$cppstdin" in
23084 `pwd`/cppstdin)
23085         echo "Stripping down cppstdin path name"
23086         cppstdin=cppstdin
23087         ;;
23088 esac
23089 cd UU
23090
23091 : end of configuration questions
23092 echo " "
23093 echo "End of configuration questions."
23094 echo " "
23095
23096 : back to where it started
23097 if test -d ../UU; then
23098         cd ..
23099 fi
23100
23101 : configuration may be unconditionally patched via a 'config.arch' file
23102 if $test -f config.arch; then
23103         echo "I see a config.arch file, loading it." >&4
23104         . ./config.arch
23105 fi
23106
23107 : configuration may be patched via a 'config.over' file
23108 if $test -f config.over; then
23109         echo " "
23110         dflt=y
23111         rp='I see a config.over file.  Do you wish to load it?'
23112         . UU/myread
23113         case "$ans" in
23114         n*) echo "OK, I'll ignore it.";;
23115         *)      . ./config.over
23116                 echo "Configuration override changes have been loaded."
23117                 ;;
23118         esac
23119 fi
23120
23121 : in case they want portability, strip down executable paths
23122 case "$d_portable" in
23123 "$define")
23124         echo " "
23125         echo "Stripping down executable paths..." >&4
23126         for file in $loclist $trylist; do
23127                 eval temp=\$$file
23128                 eval $file=`basename $temp`
23129         done
23130         ;;
23131 esac
23132
23133 : create config.sh file
23134 echo " "
23135 echo "Creating config.sh..." >&4
23136 $spitshell <<EOT >config.sh
23137 $startsh
23138 #
23139 # This file was produced by running the Configure script. It holds all the
23140 # definitions figured out by Configure. Should you modify one of these values,
23141 # do not forget to propagate your changes by running "Configure -der". You may
23142 # instead choose to run each of the .SH files by yourself, or "Configure -S".
23143 #
23144
23145 # Package name      : $package
23146 # Source directory  : $src
23147 # Configuration time: $cf_time
23148 # Configured by     : $cf_by
23149 # Target system     : $myuname
23150
23151 EOT
23152 : Add in command line options if available
23153 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23154
23155 $spitshell <<EOT >>config.sh
23156
23157 Author='$Author'
23158 Date='$Date'
23159 Header='$Header'
23160 Id='$Id'
23161 Locker='$Locker'
23162 Log='$Log'
23163 RCSfile='$RCSfile'
23164 Revision='$Revision'
23165 Source='$Source'
23166 State='$State'
23167 _a='$_a'
23168 _exe='$_exe'
23169 _o='$_o'
23170 afs='$afs'
23171 afsroot='$afsroot'
23172 alignbytes='$alignbytes'
23173 ansi2knr='$ansi2knr'
23174 aphostname='$aphostname'
23175 api_revision='$api_revision'
23176 api_subversion='$api_subversion'
23177 api_version='$api_version'
23178 api_versionstring='$api_versionstring'
23179 ar='$ar'
23180 archlib='$archlib'
23181 archlibexp='$archlibexp'
23182 archname64='$archname64'
23183 archname='$archname'
23184 archobjs='$archobjs'
23185 asctime_r_proto='$asctime_r_proto'
23186 awk='$awk'
23187 baserev='$baserev'
23188 bash='$bash'
23189 bin='$bin'
23190 bin_ELF='$bin_ELF'
23191 binexp='$binexp'
23192 bison='$bison'
23193 byacc='$byacc'
23194 byteorder='$byteorder'
23195 c='$c'
23196 castflags='$castflags'
23197 cat='$cat'
23198 cc='$cc'
23199 cccdlflags='$cccdlflags'
23200 ccdlflags='$ccdlflags'
23201 ccflags='$ccflags'
23202 ccflags_uselargefiles='$ccflags_uselargefiles'
23203 ccname='$ccname'
23204 ccsymbols='$ccsymbols'
23205 ccversion='$ccversion'
23206 cf_by='$cf_by'
23207 cf_email='$cf_email'
23208 cf_time='$cf_time'
23209 charbits='$charbits'
23210 charsize='$charsize'
23211 chgrp='$chgrp'
23212 chmod='$chmod'
23213 chown='$chown'
23214 clocktype='$clocktype'
23215 comm='$comm'
23216 compress='$compress'
23217 contains='$contains'
23218 cp='$cp'
23219 cpio='$cpio'
23220 cpp='$cpp'
23221 cpp_stuff='$cpp_stuff'
23222 cppccsymbols='$cppccsymbols'
23223 cppflags='$cppflags'
23224 cpplast='$cpplast'
23225 cppminus='$cppminus'
23226 cpprun='$cpprun'
23227 cppstdin='$cppstdin'
23228 cppsymbols='$cppsymbols'
23229 crypt_r_proto='$crypt_r_proto'
23230 cryptlib='$cryptlib'
23231 csh='$csh'
23232 ctermid_r_proto='$ctermid_r_proto'
23233 ctime_r_proto='$ctime_r_proto'
23234 d_Gconvert='$d_Gconvert'
23235 d_PRIEUldbl='$d_PRIEUldbl'
23236 d_PRIFUldbl='$d_PRIFUldbl'
23237 d_PRIGUldbl='$d_PRIGUldbl'
23238 d_PRIXU64='$d_PRIXU64'
23239 d_PRId64='$d_PRId64'
23240 d_PRIeldbl='$d_PRIeldbl'
23241 d_PRIfldbl='$d_PRIfldbl'
23242 d_PRIgldbl='$d_PRIgldbl'
23243 d_PRIi64='$d_PRIi64'
23244 d_PRIo64='$d_PRIo64'
23245 d_PRIu64='$d_PRIu64'
23246 d_PRIx64='$d_PRIx64'
23247 d_SCNfldbl='$d_SCNfldbl'
23248 d__fwalk='$d__fwalk'
23249 d_access='$d_access'
23250 d_accessx='$d_accessx'
23251 d_acosh='$d_acosh'
23252 d_aintl='$d_aintl'
23253 d_alarm='$d_alarm'
23254 d_archlib='$d_archlib'
23255 d_asctime64='$d_asctime64'
23256 d_asctime_r='$d_asctime_r'
23257 d_atolf='$d_atolf'
23258 d_atoll='$d_atoll'
23259 d_attribute_deprecated='$d_attribute_deprecated'
23260 d_attribute_format='$d_attribute_format'
23261 d_attribute_malloc='$d_attribute_malloc'
23262 d_attribute_nonnull='$d_attribute_nonnull'
23263 d_attribute_noreturn='$d_attribute_noreturn'
23264 d_attribute_pure='$d_attribute_pure'
23265 d_attribute_unused='$d_attribute_unused'
23266 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
23267 d_backtrace='$d_backtrace'
23268 d_bcmp='$d_bcmp'
23269 d_bcopy='$d_bcopy'
23270 d_bsd='$d_bsd'
23271 d_bsdgetpgrp='$d_bsdgetpgrp'
23272 d_bsdsetpgrp='$d_bsdsetpgrp'
23273 d_builtin_choose_expr='$d_builtin_choose_expr'
23274 d_builtin_expect='$d_builtin_expect'
23275 d_bzero='$d_bzero'
23276 d_c99_variadic_macros='$d_c99_variadic_macros'
23277 d_casti32='$d_casti32'
23278 d_castneg='$d_castneg'
23279 d_charvspr='$d_charvspr'
23280 d_chown='$d_chown'
23281 d_chroot='$d_chroot'
23282 d_chsize='$d_chsize'
23283 d_class='$d_class'
23284 d_clearenv='$d_clearenv'
23285 d_closedir='$d_closedir'
23286 d_cmsghdr_s='$d_cmsghdr_s'
23287 d_const='$d_const'
23288 d_copysignl='$d_copysignl'
23289 d_cplusplus='$d_cplusplus'
23290 d_crypt='$d_crypt'
23291 d_crypt_r='$d_crypt_r'
23292 d_csh='$d_csh'
23293 d_ctermid='$d_ctermid'
23294 d_ctermid_r='$d_ctermid_r'
23295 d_ctime64='$d_ctime64'
23296 d_ctime_r='$d_ctime_r'
23297 d_cuserid='$d_cuserid'
23298 d_dbl_dig='$d_dbl_dig'
23299 d_dbminitproto='$d_dbminitproto'
23300 d_difftime64='$d_difftime64'
23301 d_difftime='$d_difftime'
23302 d_dir_dd_fd='$d_dir_dd_fd'
23303 d_dirfd='$d_dirfd'
23304 d_dirnamlen='$d_dirnamlen'
23305 d_dladdr='$d_dladdr'
23306 d_dlerror='$d_dlerror'
23307 d_dlopen='$d_dlopen'
23308 d_dlsymun='$d_dlsymun'
23309 d_dosuid='$d_dosuid'
23310 d_drand48_r='$d_drand48_r'
23311 d_drand48proto='$d_drand48proto'
23312 d_dup2='$d_dup2'
23313 d_eaccess='$d_eaccess'
23314 d_endgrent='$d_endgrent'
23315 d_endgrent_r='$d_endgrent_r'
23316 d_endhent='$d_endhent'
23317 d_endhostent_r='$d_endhostent_r'
23318 d_endnent='$d_endnent'
23319 d_endnetent_r='$d_endnetent_r'
23320 d_endpent='$d_endpent'
23321 d_endprotoent_r='$d_endprotoent_r'
23322 d_endpwent='$d_endpwent'
23323 d_endpwent_r='$d_endpwent_r'
23324 d_endsent='$d_endsent'
23325 d_endservent_r='$d_endservent_r'
23326 d_eofnblk='$d_eofnblk'
23327 d_eunice='$d_eunice'
23328 d_faststdio='$d_faststdio'
23329 d_fchdir='$d_fchdir'
23330 d_fchmod='$d_fchmod'
23331 d_fchown='$d_fchown'
23332 d_fcntl='$d_fcntl'
23333 d_fcntl_can_lock='$d_fcntl_can_lock'
23334 d_fd_macros='$d_fd_macros'
23335 d_fd_set='$d_fd_set'
23336 d_fds_bits='$d_fds_bits'
23337 d_fegetround='$d_fegetround'
23338 d_fgetpos='$d_fgetpos'
23339 d_finite='$d_finite'
23340 d_finitel='$d_finitel'
23341 d_flexfnam='$d_flexfnam'
23342 d_flock='$d_flock'
23343 d_flockproto='$d_flockproto'
23344 d_fork='$d_fork'
23345 d_fp_class='$d_fp_class'
23346 d_fp_classify='$d_fp_classify'
23347 d_fp_classl='$d_fp_classl'
23348 d_fpathconf='$d_fpathconf'
23349 d_fpclass='$d_fpclass'
23350 d_fpclassify='$d_fpclassify'
23351 d_fpclassl='$d_fpclassl'
23352 d_fpgetround='$d_fpgetround'
23353 d_fpos64_t='$d_fpos64_t'
23354 d_frexpl='$d_frexpl'
23355 d_fs_data_s='$d_fs_data_s'
23356 d_fseeko='$d_fseeko'
23357 d_fsetpos='$d_fsetpos'
23358 d_fstatfs='$d_fstatfs'
23359 d_fstatvfs='$d_fstatvfs'
23360 d_fsync='$d_fsync'
23361 d_ftello='$d_ftello'
23362 d_ftime='$d_ftime'
23363 d_futimes='$d_futimes'
23364 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
23365 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
23366 d_getaddrinfo='$d_getaddrinfo'
23367 d_getcwd='$d_getcwd'
23368 d_getespwnam='$d_getespwnam'
23369 d_getfsstat='$d_getfsstat'
23370 d_getgrent='$d_getgrent'
23371 d_getgrent_r='$d_getgrent_r'
23372 d_getgrgid_r='$d_getgrgid_r'
23373 d_getgrnam_r='$d_getgrnam_r'
23374 d_getgrps='$d_getgrps'
23375 d_gethbyaddr='$d_gethbyaddr'
23376 d_gethbyname='$d_gethbyname'
23377 d_gethent='$d_gethent'
23378 d_gethname='$d_gethname'
23379 d_gethostbyaddr_r='$d_gethostbyaddr_r'
23380 d_gethostbyname_r='$d_gethostbyname_r'
23381 d_gethostent_r='$d_gethostent_r'
23382 d_gethostprotos='$d_gethostprotos'
23383 d_getitimer='$d_getitimer'
23384 d_getlogin='$d_getlogin'
23385 d_getlogin_r='$d_getlogin_r'
23386 d_getmnt='$d_getmnt'
23387 d_getmntent='$d_getmntent'
23388 d_getnameinfo='$d_getnameinfo'
23389 d_getnbyaddr='$d_getnbyaddr'
23390 d_getnbyname='$d_getnbyname'
23391 d_getnent='$d_getnent'
23392 d_getnetbyaddr_r='$d_getnetbyaddr_r'
23393 d_getnetbyname_r='$d_getnetbyname_r'
23394 d_getnetent_r='$d_getnetent_r'
23395 d_getnetprotos='$d_getnetprotos'
23396 d_getpagsz='$d_getpagsz'
23397 d_getpbyname='$d_getpbyname'
23398 d_getpbynumber='$d_getpbynumber'
23399 d_getpent='$d_getpent'
23400 d_getpgid='$d_getpgid'
23401 d_getpgrp2='$d_getpgrp2'
23402 d_getpgrp='$d_getpgrp'
23403 d_getppid='$d_getppid'
23404 d_getprior='$d_getprior'
23405 d_getprotobyname_r='$d_getprotobyname_r'
23406 d_getprotobynumber_r='$d_getprotobynumber_r'
23407 d_getprotoent_r='$d_getprotoent_r'
23408 d_getprotoprotos='$d_getprotoprotos'
23409 d_getprpwnam='$d_getprpwnam'
23410 d_getpwent='$d_getpwent'
23411 d_getpwent_r='$d_getpwent_r'
23412 d_getpwnam_r='$d_getpwnam_r'
23413 d_getpwuid_r='$d_getpwuid_r'
23414 d_getsbyname='$d_getsbyname'
23415 d_getsbyport='$d_getsbyport'
23416 d_getsent='$d_getsent'
23417 d_getservbyname_r='$d_getservbyname_r'
23418 d_getservbyport_r='$d_getservbyport_r'
23419 d_getservent_r='$d_getservent_r'
23420 d_getservprotos='$d_getservprotos'
23421 d_getspnam='$d_getspnam'
23422 d_getspnam_r='$d_getspnam_r'
23423 d_gettimeod='$d_gettimeod'
23424 d_gmtime64='$d_gmtime64'
23425 d_gmtime_r='$d_gmtime_r'
23426 d_gnulibc='$d_gnulibc'
23427 d_grpasswd='$d_grpasswd'
23428 d_hasmntopt='$d_hasmntopt'
23429 d_htonl='$d_htonl'
23430 d_ilogbl='$d_ilogbl'
23431 d_inc_version_list='$d_inc_version_list'
23432 d_index='$d_index'
23433 d_inetaton='$d_inetaton'
23434 d_inetntop='$d_inetntop'
23435 d_inetpton='$d_inetpton'
23436 d_int64_t='$d_int64_t'
23437 d_ip_mreq='$d_ip_mreq'
23438 d_ip_mreq_source='$d_ip_mreq_source'
23439 d_ipv6_mreq='$d_ipv6_mreq'
23440 d_ipv6_mreq_source='$d_ipv6_mreq_source'
23441 d_isascii='$d_isascii'
23442 d_isblank='$d_isblank'
23443 d_isfinite='$d_isfinite'
23444 d_isfinitel='$d_isfinitel'
23445 d_isinf='$d_isinf'
23446 d_isinfl='$d_isinfl'
23447 d_isnan='$d_isnan'
23448 d_isnanl='$d_isnanl'
23449 d_j0='$d_j0'
23450 d_j0l='$d_j0l'
23451 d_killpg='$d_killpg'
23452 d_lchown='$d_lchown'
23453 d_ldbl_dig='$d_ldbl_dig'
23454 d_ldexpl='$d_ldexpl'
23455 d_libm_lib_version='$d_libm_lib_version'
23456 d_libname_unique='$d_libname_unique'
23457 d_link='$d_link'
23458 d_localtime64='$d_localtime64'
23459 d_localtime_r='$d_localtime_r'
23460 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
23461 d_locconv='$d_locconv'
23462 d_lockf='$d_lockf'
23463 d_longdbl='$d_longdbl'
23464 d_longlong='$d_longlong'
23465 d_lseekproto='$d_lseekproto'
23466 d_lstat='$d_lstat'
23467 d_madvise='$d_madvise'
23468 d_malloc_good_size='$d_malloc_good_size'
23469 d_malloc_size='$d_malloc_size'
23470 d_mblen='$d_mblen'
23471 d_mbstowcs='$d_mbstowcs'
23472 d_mbtowc='$d_mbtowc'
23473 d_memchr='$d_memchr'
23474 d_memcmp='$d_memcmp'
23475 d_memcpy='$d_memcpy'
23476 d_memmove='$d_memmove'
23477 d_memset='$d_memset'
23478 d_mkdir='$d_mkdir'
23479 d_mkdtemp='$d_mkdtemp'
23480 d_mkfifo='$d_mkfifo'
23481 d_mkstemp='$d_mkstemp'
23482 d_mkstemps='$d_mkstemps'
23483 d_mktime64='$d_mktime64'
23484 d_mktime='$d_mktime'
23485 d_mmap='$d_mmap'
23486 d_modfl='$d_modfl'
23487 d_modfl_pow32_bug='$d_modfl_pow32_bug'
23488 d_modflproto='$d_modflproto'
23489 d_mprotect='$d_mprotect'
23490 d_msg='$d_msg'
23491 d_msg_ctrunc='$d_msg_ctrunc'
23492 d_msg_dontroute='$d_msg_dontroute'
23493 d_msg_oob='$d_msg_oob'
23494 d_msg_peek='$d_msg_peek'
23495 d_msg_proxy='$d_msg_proxy'
23496 d_msgctl='$d_msgctl'
23497 d_msgget='$d_msgget'
23498 d_msghdr_s='$d_msghdr_s'
23499 d_msgrcv='$d_msgrcv'
23500 d_msgsnd='$d_msgsnd'
23501 d_msync='$d_msync'
23502 d_munmap='$d_munmap'
23503 d_mymalloc='$d_mymalloc'
23504 d_ndbm='$d_ndbm'
23505 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
23506 d_nice='$d_nice'
23507 d_nl_langinfo='$d_nl_langinfo'
23508 d_nv_preserves_uv='$d_nv_preserves_uv'
23509 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
23510 d_off64_t='$d_off64_t'
23511 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
23512 d_oldpthreads='$d_oldpthreads'
23513 d_oldsock='$d_oldsock'
23514 d_open3='$d_open3'
23515 d_pathconf='$d_pathconf'
23516 d_pause='$d_pause'
23517 d_perl_otherlibdirs='$d_perl_otherlibdirs'
23518 d_phostname='$d_phostname'
23519 d_pipe='$d_pipe'
23520 d_poll='$d_poll'
23521 d_portable='$d_portable'
23522 d_prctl='$d_prctl'
23523 d_prctl_set_name='$d_prctl_set_name'
23524 d_printf_format_null='$d_printf_format_null'
23525 d_procselfexe='$d_procselfexe'
23526 d_pseudofork='$d_pseudofork'
23527 d_pthread_atfork='$d_pthread_atfork'
23528 d_pthread_attr_setscope='$d_pthread_attr_setscope'
23529 d_pthread_yield='$d_pthread_yield'
23530 d_ptrdiff_t='$d_ptrdiff_t'
23531 d_pwage='$d_pwage'
23532 d_pwchange='$d_pwchange'
23533 d_pwclass='$d_pwclass'
23534 d_pwcomment='$d_pwcomment'
23535 d_pwexpire='$d_pwexpire'
23536 d_pwgecos='$d_pwgecos'
23537 d_pwpasswd='$d_pwpasswd'
23538 d_pwquota='$d_pwquota'
23539 d_qgcvt='$d_qgcvt'
23540 d_quad='$d_quad'
23541 d_random_r='$d_random_r'
23542 d_readdir64_r='$d_readdir64_r'
23543 d_readdir='$d_readdir'
23544 d_readdir_r='$d_readdir_r'
23545 d_readlink='$d_readlink'
23546 d_readv='$d_readv'
23547 d_recvmsg='$d_recvmsg'
23548 d_rename='$d_rename'
23549 d_rewinddir='$d_rewinddir'
23550 d_rmdir='$d_rmdir'
23551 d_safebcpy='$d_safebcpy'
23552 d_safemcpy='$d_safemcpy'
23553 d_sanemcmp='$d_sanemcmp'
23554 d_sbrkproto='$d_sbrkproto'
23555 d_scalbnl='$d_scalbnl'
23556 d_sched_yield='$d_sched_yield'
23557 d_scm_rights='$d_scm_rights'
23558 d_seekdir='$d_seekdir'
23559 d_select='$d_select'
23560 d_sem='$d_sem'
23561 d_semctl='$d_semctl'
23562 d_semctl_semid_ds='$d_semctl_semid_ds'
23563 d_semctl_semun='$d_semctl_semun'
23564 d_semget='$d_semget'
23565 d_semop='$d_semop'
23566 d_sendmsg='$d_sendmsg'
23567 d_setegid='$d_setegid'
23568 d_seteuid='$d_seteuid'
23569 d_setgrent='$d_setgrent'
23570 d_setgrent_r='$d_setgrent_r'
23571 d_setgrps='$d_setgrps'
23572 d_sethent='$d_sethent'
23573 d_sethostent_r='$d_sethostent_r'
23574 d_setitimer='$d_setitimer'
23575 d_setlinebuf='$d_setlinebuf'
23576 d_setlocale='$d_setlocale'
23577 d_setlocale_r='$d_setlocale_r'
23578 d_setnent='$d_setnent'
23579 d_setnetent_r='$d_setnetent_r'
23580 d_setpent='$d_setpent'
23581 d_setpgid='$d_setpgid'
23582 d_setpgrp2='$d_setpgrp2'
23583 d_setpgrp='$d_setpgrp'
23584 d_setprior='$d_setprior'
23585 d_setproctitle='$d_setproctitle'
23586 d_setprotoent_r='$d_setprotoent_r'
23587 d_setpwent='$d_setpwent'
23588 d_setpwent_r='$d_setpwent_r'
23589 d_setregid='$d_setregid'
23590 d_setresgid='$d_setresgid'
23591 d_setresuid='$d_setresuid'
23592 d_setreuid='$d_setreuid'
23593 d_setrgid='$d_setrgid'
23594 d_setruid='$d_setruid'
23595 d_setsent='$d_setsent'
23596 d_setservent_r='$d_setservent_r'
23597 d_setsid='$d_setsid'
23598 d_setvbuf='$d_setvbuf'
23599 d_shm='$d_shm'
23600 d_shmat='$d_shmat'
23601 d_shmatprototype='$d_shmatprototype'
23602 d_shmctl='$d_shmctl'
23603 d_shmdt='$d_shmdt'
23604 d_shmget='$d_shmget'
23605 d_sigaction='$d_sigaction'
23606 d_signbit='$d_signbit'
23607 d_sigprocmask='$d_sigprocmask'
23608 d_sigsetjmp='$d_sigsetjmp'
23609 d_sin6_scope_id='$d_sin6_scope_id'
23610 d_sitearch='$d_sitearch'
23611 d_snprintf='$d_snprintf'
23612 d_sockaddr_in6='$d_sockaddr_in6'
23613 d_sockaddr_sa_len='$d_sockaddr_sa_len'
23614 d_sockatmark='$d_sockatmark'
23615 d_sockatmarkproto='$d_sockatmarkproto'
23616 d_socket='$d_socket'
23617 d_socklen_t='$d_socklen_t'
23618 d_sockpair='$d_sockpair'
23619 d_socks5_init='$d_socks5_init'
23620 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
23621 d_sqrtl='$d_sqrtl'
23622 d_srand48_r='$d_srand48_r'
23623 d_srandom_r='$d_srandom_r'
23624 d_sresgproto='$d_sresgproto'
23625 d_sresuproto='$d_sresuproto'
23626 d_statblks='$d_statblks'
23627 d_statfs_f_flags='$d_statfs_f_flags'
23628 d_statfs_s='$d_statfs_s'
23629 d_static_inline='$d_static_inline'
23630 d_statvfs='$d_statvfs'
23631 d_stdio_cnt_lval='$d_stdio_cnt_lval'
23632 d_stdio_ptr_lval='$d_stdio_ptr_lval'
23633 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
23634 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
23635 d_stdio_stream_array='$d_stdio_stream_array'
23636 d_stdiobase='$d_stdiobase'
23637 d_stdstdio='$d_stdstdio'
23638 d_strchr='$d_strchr'
23639 d_strcoll='$d_strcoll'
23640 d_strctcpy='$d_strctcpy'
23641 d_strerrm='$d_strerrm'
23642 d_strerror='$d_strerror'
23643 d_strerror_r='$d_strerror_r'
23644 d_strftime='$d_strftime'
23645 d_strlcat='$d_strlcat'
23646 d_strlcpy='$d_strlcpy'
23647 d_strtod='$d_strtod'
23648 d_strtol='$d_strtol'
23649 d_strtold='$d_strtold'
23650 d_strtoll='$d_strtoll'
23651 d_strtoq='$d_strtoq'
23652 d_strtoul='$d_strtoul'
23653 d_strtoull='$d_strtoull'
23654 d_strtouq='$d_strtouq'
23655 d_strxfrm='$d_strxfrm'
23656 d_suidsafe='$d_suidsafe'
23657 d_symlink='$d_symlink'
23658 d_syscall='$d_syscall'
23659 d_syscallproto='$d_syscallproto'
23660 d_sysconf='$d_sysconf'
23661 d_sysernlst='$d_sysernlst'
23662 d_syserrlst='$d_syserrlst'
23663 d_system='$d_system'
23664 d_tcgetpgrp='$d_tcgetpgrp'
23665 d_tcsetpgrp='$d_tcsetpgrp'
23666 d_telldir='$d_telldir'
23667 d_telldirproto='$d_telldirproto'
23668 d_time='$d_time'
23669 d_timegm='$d_timegm'
23670 d_times='$d_times'
23671 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
23672 d_tm_tm_zone='$d_tm_tm_zone'
23673 d_tmpnam_r='$d_tmpnam_r'
23674 d_truncate='$d_truncate'
23675 d_ttyname_r='$d_ttyname_r'
23676 d_tzname='$d_tzname'
23677 d_u32align='$d_u32align'
23678 d_ualarm='$d_ualarm'
23679 d_umask='$d_umask'
23680 d_uname='$d_uname'
23681 d_union_semun='$d_union_semun'
23682 d_unordered='$d_unordered'
23683 d_unsetenv='$d_unsetenv'
23684 d_usleep='$d_usleep'
23685 d_usleepproto='$d_usleepproto'
23686 d_ustat='$d_ustat'
23687 d_vendorarch='$d_vendorarch'
23688 d_vendorbin='$d_vendorbin'
23689 d_vendorlib='$d_vendorlib'
23690 d_vendorscript='$d_vendorscript'
23691 d_vfork='$d_vfork'
23692 d_void_closedir='$d_void_closedir'
23693 d_voidsig='$d_voidsig'
23694 d_voidtty='$d_voidtty'
23695 d_volatile='$d_volatile'
23696 d_vprintf='$d_vprintf'
23697 d_vsnprintf='$d_vsnprintf'
23698 d_wait4='$d_wait4'
23699 d_waitpid='$d_waitpid'
23700 d_wcscmp='$d_wcscmp'
23701 d_wcstombs='$d_wcstombs'
23702 d_wcsxfrm='$d_wcsxfrm'
23703 d_wctomb='$d_wctomb'
23704 d_writev='$d_writev'
23705 d_xenix='$d_xenix'
23706 date='$date'
23707 db_hashtype='$db_hashtype'
23708 db_prefixtype='$db_prefixtype'
23709 db_version_major='$db_version_major'
23710 db_version_minor='$db_version_minor'
23711 db_version_patch='$db_version_patch'
23712 direntrytype='$direntrytype'
23713 dlext='$dlext'
23714 dlsrc='$dlsrc'
23715 doublesize='$doublesize'
23716 drand01='$drand01'
23717 drand48_r_proto='$drand48_r_proto'
23718 dtrace='$dtrace'
23719 dynamic_ext='$dynamic_ext'
23720 eagain='$eagain'
23721 ebcdic='$ebcdic'
23722 echo='$echo'
23723 egrep='$egrep'
23724 emacs='$emacs'
23725 endgrent_r_proto='$endgrent_r_proto'
23726 endhostent_r_proto='$endhostent_r_proto'
23727 endnetent_r_proto='$endnetent_r_proto'
23728 endprotoent_r_proto='$endprotoent_r_proto'
23729 endpwent_r_proto='$endpwent_r_proto'
23730 endservent_r_proto='$endservent_r_proto'
23731 eunicefix='$eunicefix'
23732 exe_ext='$exe_ext'
23733 expr='$expr'
23734 extensions='$extensions'
23735 extern_C='$extern_C'
23736 extras='$extras'
23737 fflushNULL='$fflushNULL'
23738 fflushall='$fflushall'
23739 find='$find'
23740 firstmakefile='$firstmakefile'
23741 flex='$flex'
23742 fpossize='$fpossize'
23743 fpostype='$fpostype'
23744 freetype='$freetype'
23745 from='$from'
23746 full_ar='$full_ar'
23747 full_csh='$full_csh'
23748 full_sed='$full_sed'
23749 gccansipedantic='$gccansipedantic'
23750 gccosandvers='$gccosandvers'
23751 gccversion='$gccversion'
23752 getgrent_r_proto='$getgrent_r_proto'
23753 getgrgid_r_proto='$getgrgid_r_proto'
23754 getgrnam_r_proto='$getgrnam_r_proto'
23755 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
23756 gethostbyname_r_proto='$gethostbyname_r_proto'
23757 gethostent_r_proto='$gethostent_r_proto'
23758 getlogin_r_proto='$getlogin_r_proto'
23759 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
23760 getnetbyname_r_proto='$getnetbyname_r_proto'
23761 getnetent_r_proto='$getnetent_r_proto'
23762 getprotobyname_r_proto='$getprotobyname_r_proto'
23763 getprotobynumber_r_proto='$getprotobynumber_r_proto'
23764 getprotoent_r_proto='$getprotoent_r_proto'
23765 getpwent_r_proto='$getpwent_r_proto'
23766 getpwnam_r_proto='$getpwnam_r_proto'
23767 getpwuid_r_proto='$getpwuid_r_proto'
23768 getservbyname_r_proto='$getservbyname_r_proto'
23769 getservbyport_r_proto='$getservbyport_r_proto'
23770 getservent_r_proto='$getservent_r_proto'
23771 getspnam_r_proto='$getspnam_r_proto'
23772 gidformat='$gidformat'
23773 gidsign='$gidsign'
23774 gidsize='$gidsize'
23775 gidtype='$gidtype'
23776 glibpth='$glibpth'
23777 gmake='$gmake'
23778 gmtime_r_proto='$gmtime_r_proto'
23779 gnulibc_version='$gnulibc_version'
23780 grep='$grep'
23781 groupcat='$groupcat'
23782 groupstype='$groupstype'
23783 gzip='$gzip'
23784 h_fcntl='$h_fcntl'
23785 h_sysfile='$h_sysfile'
23786 hint='$hint'
23787 hostcat='$hostcat'
23788 hostgenerate='$hostgenerate'
23789 hostosname='$hostosname'
23790 hostperl='$hostperl'
23791 html1dir='$html1dir'
23792 html1direxp='$html1direxp'
23793 html3dir='$html3dir'
23794 html3direxp='$html3direxp'
23795 i16size='$i16size'
23796 i16type='$i16type'
23797 i32size='$i32size'
23798 i32type='$i32type'
23799 i64size='$i64size'
23800 i64type='$i64type'
23801 i8size='$i8size'
23802 i8type='$i8type'
23803 i_arpainet='$i_arpainet'
23804 i_assert='$i_assert'
23805 i_bfd='$i_bfd'
23806 i_bsdioctl='$i_bsdioctl'
23807 i_crypt='$i_crypt'
23808 i_db='$i_db'
23809 i_dbm='$i_dbm'
23810 i_dirent='$i_dirent'
23811 i_dlfcn='$i_dlfcn'
23812 i_execinfo='$i_execinfo'
23813 i_fcntl='$i_fcntl'
23814 i_fenv='$i_fenv'
23815 i_float='$i_float'
23816 i_fp='$i_fp'
23817 i_fp_class='$i_fp_class'
23818 i_gdbm='$i_gdbm'
23819 i_gdbm_ndbm='$i_gdbm_ndbm'
23820 i_gdbmndbm='$i_gdbmndbm'
23821 i_grp='$i_grp'
23822 i_ieeefp='$i_ieeefp'
23823 i_inttypes='$i_inttypes'
23824 i_langinfo='$i_langinfo'
23825 i_libutil='$i_libutil'
23826 i_limits='$i_limits'
23827 i_locale='$i_locale'
23828 i_machcthr='$i_machcthr'
23829 i_malloc='$i_malloc'
23830 i_mallocmalloc='$i_mallocmalloc'
23831 i_math='$i_math'
23832 i_memory='$i_memory'
23833 i_mntent='$i_mntent'
23834 i_ndbm='$i_ndbm'
23835 i_netdb='$i_netdb'
23836 i_neterrno='$i_neterrno'
23837 i_netinettcp='$i_netinettcp'
23838 i_niin='$i_niin'
23839 i_poll='$i_poll'
23840 i_prot='$i_prot'
23841 i_pthread='$i_pthread'
23842 i_pwd='$i_pwd'
23843 i_rpcsvcdbm='$i_rpcsvcdbm'
23844 i_sgtty='$i_sgtty'
23845 i_shadow='$i_shadow'
23846 i_socks='$i_socks'
23847 i_stdarg='$i_stdarg'
23848 i_stdbool='$i_stdbool'
23849 i_stddef='$i_stddef'
23850 i_stdint='$i_stdint'
23851 i_stdlib='$i_stdlib'
23852 i_string='$i_string'
23853 i_sunmath='$i_sunmath'
23854 i_sysaccess='$i_sysaccess'
23855 i_sysdir='$i_sysdir'
23856 i_sysfile='$i_sysfile'
23857 i_sysfilio='$i_sysfilio'
23858 i_sysin='$i_sysin'
23859 i_sysioctl='$i_sysioctl'
23860 i_syslog='$i_syslog'
23861 i_sysmman='$i_sysmman'
23862 i_sysmode='$i_sysmode'
23863 i_sysmount='$i_sysmount'
23864 i_sysndir='$i_sysndir'
23865 i_sysparam='$i_sysparam'
23866 i_syspoll='$i_syspoll'
23867 i_sysresrc='$i_sysresrc'
23868 i_syssecrt='$i_syssecrt'
23869 i_sysselct='$i_sysselct'
23870 i_syssockio='$i_syssockio'
23871 i_sysstat='$i_sysstat'
23872 i_sysstatfs='$i_sysstatfs'
23873 i_sysstatvfs='$i_sysstatvfs'
23874 i_systime='$i_systime'
23875 i_systimek='$i_systimek'
23876 i_systimes='$i_systimes'
23877 i_systypes='$i_systypes'
23878 i_sysuio='$i_sysuio'
23879 i_sysun='$i_sysun'
23880 i_sysutsname='$i_sysutsname'
23881 i_sysvfs='$i_sysvfs'
23882 i_syswait='$i_syswait'
23883 i_termio='$i_termio'
23884 i_termios='$i_termios'
23885 i_time='$i_time'
23886 i_unistd='$i_unistd'
23887 i_ustat='$i_ustat'
23888 i_utime='$i_utime'
23889 i_values='$i_values'
23890 i_varargs='$i_varargs'
23891 i_varhdr='$i_varhdr'
23892 i_vfork='$i_vfork'
23893 ignore_versioned_solibs='$ignore_versioned_solibs'
23894 inc_version_list='$inc_version_list'
23895 inc_version_list_init='$inc_version_list_init'
23896 incpath='$incpath'
23897 incpth='$incpth'
23898 inews='$inews'
23899 initialinstalllocation='$initialinstalllocation'
23900 installarchlib='$installarchlib'
23901 installbin='$installbin'
23902 installhtml1dir='$installhtml1dir'
23903 installhtml3dir='$installhtml3dir'
23904 installman1dir='$installman1dir'
23905 installman3dir='$installman3dir'
23906 installprefix='$installprefix'
23907 installprefixexp='$installprefixexp'
23908 installprivlib='$installprivlib'
23909 installscript='$installscript'
23910 installsitearch='$installsitearch'
23911 installsitebin='$installsitebin'
23912 installsitehtml1dir='$installsitehtml1dir'
23913 installsitehtml3dir='$installsitehtml3dir'
23914 installsitelib='$installsitelib'
23915 installsiteman1dir='$installsiteman1dir'
23916 installsiteman3dir='$installsiteman3dir'
23917 installsitescript='$installsitescript'
23918 installstyle='$installstyle'
23919 installusrbinperl='$installusrbinperl'
23920 installvendorarch='$installvendorarch'
23921 installvendorbin='$installvendorbin'
23922 installvendorhtml1dir='$installvendorhtml1dir'
23923 installvendorhtml3dir='$installvendorhtml3dir'
23924 installvendorlib='$installvendorlib'
23925 installvendorman1dir='$installvendorman1dir'
23926 installvendorman3dir='$installvendorman3dir'
23927 installvendorscript='$installvendorscript'
23928 intsize='$intsize'
23929 issymlink='$issymlink'
23930 ivdformat='$ivdformat'
23931 ivsize='$ivsize'
23932 ivtype='$ivtype'
23933 known_extensions='$known_extensions'
23934 ksh='$ksh'
23935 ld='$ld'
23936 ld_can_script='$ld_can_script'
23937 lddlflags='$lddlflags'
23938 ldflags='$ldflags'
23939 ldflags_uselargefiles='$ldflags_uselargefiles'
23940 ldlibpthname='$ldlibpthname'
23941 less='$less'
23942 lib_ext='$lib_ext'
23943 libc='$libc'
23944 libperl='$libperl'
23945 libpth='$libpth'
23946 libs='$libs'
23947 libsdirs='$libsdirs'
23948 libsfiles='$libsfiles'
23949 libsfound='$libsfound'
23950 libspath='$libspath'
23951 libswanted='$libswanted'
23952 libswanted_uselargefiles='$libswanted_uselargefiles'
23953 line='$line'
23954 lint='$lint'
23955 lkflags='$lkflags'
23956 ln='$ln'
23957 lns='$lns'
23958 localtime_r_proto='$localtime_r_proto'
23959 locincpth='$locincpth'
23960 loclibpth='$loclibpth'
23961 longdblkind='$longdblkind'
23962 longdblsize='$longdblsize'
23963 longlongsize='$longlongsize'
23964 longsize='$longsize'
23965 lp='$lp'
23966 lpr='$lpr'
23967 ls='$ls'
23968 lseeksize='$lseeksize'
23969 lseektype='$lseektype'
23970 mail='$mail'
23971 mailx='$mailx'
23972 make='$make'
23973 make_set_make='$make_set_make'
23974 mallocobj='$mallocobj'
23975 mallocsrc='$mallocsrc'
23976 malloctype='$malloctype'
23977 man1dir='$man1dir'
23978 man1direxp='$man1direxp'
23979 man1ext='$man1ext'
23980 man3dir='$man3dir'
23981 man3direxp='$man3direxp'
23982 man3ext='$man3ext'
23983 mips_type='$mips_type'
23984 mistrustnm='$mistrustnm'
23985 mkdir='$mkdir'
23986 mmaptype='$mmaptype'
23987 modetype='$modetype'
23988 more='$more'
23989 multiarch='$multiarch'
23990 mv='$mv'
23991 myarchname='$myarchname'
23992 mydomain='$mydomain'
23993 myhostname='$myhostname'
23994 myuname='$myuname'
23995 n='$n'
23996 need_va_copy='$need_va_copy'
23997 netdb_hlen_type='$netdb_hlen_type'
23998 netdb_host_type='$netdb_host_type'
23999 netdb_name_type='$netdb_name_type'
24000 netdb_net_type='$netdb_net_type'
24001 nm='$nm'
24002 nm_opt='$nm_opt'
24003 nm_so_opt='$nm_so_opt'
24004 nonxs_ext='$nonxs_ext'
24005 nroff='$nroff'
24006 nvEUformat='$nvEUformat'
24007 nvFUformat='$nvFUformat'
24008 nvGUformat='$nvGUformat'
24009 nv_overflows_integers_at='$nv_overflows_integers_at'
24010 nv_preserves_uv_bits='$nv_preserves_uv_bits'
24011 nveformat='$nveformat'
24012 nvfformat='$nvfformat'
24013 nvgformat='$nvgformat'
24014 nvsize='$nvsize'
24015 nvtype='$nvtype'
24016 o_nonblock='$o_nonblock'
24017 obj_ext='$obj_ext'
24018 old_pthread_create_joinable='$old_pthread_create_joinable'
24019 optimize='$optimize'
24020 orderlib='$orderlib'
24021 osname='$osname'
24022 osvers='$osvers'
24023 otherlibdirs='$otherlibdirs'
24024 package='$package'
24025 pager='$pager'
24026 passcat='$passcat'
24027 patchlevel='$patchlevel'
24028 path_sep='$path_sep'
24029 perl5='$perl5'
24030 perl='$perl'
24031 perl_patchlevel='$perl_patchlevel'
24032 perl_static_inline='$perl_static_inline'
24033 perladmin='$perladmin'
24034 perllibs='$perllibs'
24035 perlpath='$perlpath'
24036 pg='$pg'
24037 phostname='$phostname'
24038 pidtype='$pidtype'
24039 plibpth='$plibpth'
24040 pmake='$pmake'
24041 pr='$pr'
24042 prefix='$prefix'
24043 prefixexp='$prefixexp'
24044 privlib='$privlib'
24045 privlibexp='$privlibexp'
24046 procselfexe='$procselfexe'
24047 prototype='$prototype'
24048 ptrsize='$ptrsize'
24049 quadkind='$quadkind'
24050 quadtype='$quadtype'
24051 randbits='$randbits'
24052 randfunc='$randfunc'
24053 random_r_proto='$random_r_proto'
24054 randseedtype='$randseedtype'
24055 ranlib='$ranlib'
24056 rd_nodata='$rd_nodata'
24057 readdir64_r_proto='$readdir64_r_proto'
24058 readdir_r_proto='$readdir_r_proto'
24059 revision='$revision'
24060 rm='$rm'
24061 rm_try='$rm_try'
24062 rmail='$rmail'
24063 run='$run'
24064 runnm='$runnm'
24065 sGMTIME_max='$sGMTIME_max'
24066 sGMTIME_min='$sGMTIME_min'
24067 sLOCALTIME_max='$sLOCALTIME_max'
24068 sLOCALTIME_min='$sLOCALTIME_min'
24069 sPRIEUldbl='$sPRIEUldbl'
24070 sPRIFUldbl='$sPRIFUldbl'
24071 sPRIGUldbl='$sPRIGUldbl'
24072 sPRIXU64='$sPRIXU64'
24073 sPRId64='$sPRId64'
24074 sPRIeldbl='$sPRIeldbl'
24075 sPRIfldbl='$sPRIfldbl'
24076 sPRIgldbl='$sPRIgldbl'
24077 sPRIi64='$sPRIi64'
24078 sPRIo64='$sPRIo64'
24079 sPRIu64='$sPRIu64'
24080 sPRIx64='$sPRIx64'
24081 sSCNfldbl='$sSCNfldbl'
24082 sched_yield='$sched_yield'
24083 scriptdir='$scriptdir'
24084 scriptdirexp='$scriptdirexp'
24085 sed='$sed'
24086 seedfunc='$seedfunc'
24087 selectminbits='$selectminbits'
24088 selecttype='$selecttype'
24089 sendmail='$sendmail'
24090 setgrent_r_proto='$setgrent_r_proto'
24091 sethostent_r_proto='$sethostent_r_proto'
24092 setlocale_r_proto='$setlocale_r_proto'
24093 setnetent_r_proto='$setnetent_r_proto'
24094 setprotoent_r_proto='$setprotoent_r_proto'
24095 setpwent_r_proto='$setpwent_r_proto'
24096 setservent_r_proto='$setservent_r_proto'
24097 sh='$sh'
24098 shar='$shar'
24099 sharpbang='$sharpbang'
24100 shmattype='$shmattype'
24101 shortsize='$shortsize'
24102 shrpenv='$shrpenv'
24103 shsharp='$shsharp'
24104 sig_count='$sig_count'
24105 sig_name='$sig_name'
24106 sig_name_init='$sig_name_init'
24107 sig_num='$sig_num'
24108 sig_num_init='$sig_num_init'
24109 sig_size='$sig_size'
24110 signal_t='$signal_t'
24111 sitearch='$sitearch'
24112 sitearchexp='$sitearchexp'
24113 sitebin='$sitebin'
24114 sitebinexp='$sitebinexp'
24115 sitehtml1dir='$sitehtml1dir'
24116 sitehtml1direxp='$sitehtml1direxp'
24117 sitehtml3dir='$sitehtml3dir'
24118 sitehtml3direxp='$sitehtml3direxp'
24119 sitelib='$sitelib'
24120 sitelib_stem='$sitelib_stem'
24121 sitelibexp='$sitelibexp'
24122 siteman1dir='$siteman1dir'
24123 siteman1direxp='$siteman1direxp'
24124 siteman3dir='$siteman3dir'
24125 siteman3direxp='$siteman3direxp'
24126 siteprefix='$siteprefix'
24127 siteprefixexp='$siteprefixexp'
24128 sitescript='$sitescript'
24129 sitescriptexp='$sitescriptexp'
24130 sizesize='$sizesize'
24131 sizetype='$sizetype'
24132 sleep='$sleep'
24133 smail='$smail'
24134 so='$so'
24135 sockethdr='$sockethdr'
24136 socketlib='$socketlib'
24137 socksizetype='$socksizetype'
24138 sort='$sort'
24139 spackage='$spackage'
24140 spitshell='$spitshell'
24141 srand48_r_proto='$srand48_r_proto'
24142 srandom_r_proto='$srandom_r_proto'
24143 src='$src'
24144 ssizetype='$ssizetype'
24145 st_ino_sign='$st_ino_sign'
24146 st_ino_size='$st_ino_size'
24147 startperl='$startperl'
24148 startsh='$startsh'
24149 static_ext='$static_ext'
24150 stdchar='$stdchar'
24151 stdio_base='$stdio_base'
24152 stdio_bufsiz='$stdio_bufsiz'
24153 stdio_cnt='$stdio_cnt'
24154 stdio_filbuf='$stdio_filbuf'
24155 stdio_ptr='$stdio_ptr'
24156 stdio_stream_array='$stdio_stream_array'
24157 strerror_r_proto='$strerror_r_proto'
24158 strings='$strings'
24159 submit='$submit'
24160 subversion='$subversion'
24161 sysman='$sysman'
24162 sysroot='$sysroot'
24163 tail='$tail'
24164 tar='$tar'
24165 targetarch='$targetarch'
24166 targetdir='$targetdir'
24167 targetenv='$targetenv'
24168 targethost='$targethost'
24169 targetmkdir='$targetmkdir'
24170 targetport='$targetport'
24171 targetsh='$targetsh'
24172 tbl='$tbl'
24173 tee='$tee'
24174 test='$test'
24175 timeincl='$timeincl'
24176 timetype='$timetype'
24177 tmpnam_r_proto='$tmpnam_r_proto'
24178 to='$to'
24179 touch='$touch'
24180 tr='$tr'
24181 trnl='$trnl'
24182 troff='$troff'
24183 ttyname_r_proto='$ttyname_r_proto'
24184 u16size='$u16size'
24185 u16type='$u16type'
24186 u32size='$u32size'
24187 u32type='$u32type'
24188 u64size='$u64size'
24189 u64type='$u64type'
24190 u8size='$u8size'
24191 u8type='$u8type'
24192 uidformat='$uidformat'
24193 uidsign='$uidsign'
24194 uidsize='$uidsize'
24195 uidtype='$uidtype'
24196 uname='$uname'
24197 uniq='$uniq'
24198 uquadtype='$uquadtype'
24199 use5005threads='$use5005threads'
24200 use64bitall='$use64bitall'
24201 use64bitint='$use64bitint'
24202 usecbacktrace='$usecbacktrace'
24203 usecrosscompile='$usecrosscompile'
24204 usedevel='$usedevel'
24205 usedl='$usedl'
24206 usedtrace='$usedtrace'
24207 usefaststdio='$usefaststdio'
24208 useithreads='$useithreads'
24209 usekernprocpathname='$usekernprocpathname'
24210 uselargefiles='$uselargefiles'
24211 uselongdouble='$uselongdouble'
24212 usemallocwrap='$usemallocwrap'
24213 usemorebits='$usemorebits'
24214 usemultiplicity='$usemultiplicity'
24215 usemymalloc='$usemymalloc'
24216 usenm='$usenm'
24217 usensgetexecutablepath='$usensgetexecutablepath'
24218 useopcode='$useopcode'
24219 useperlio='$useperlio'
24220 useposix='$useposix'
24221 usereentrant='$usereentrant'
24222 userelocatableinc='$userelocatableinc'
24223 useshrplib='$useshrplib'
24224 usesitecustomize='$usesitecustomize'
24225 usesocks='$usesocks'
24226 usethreads='$usethreads'
24227 usevendorprefix='$usevendorprefix'
24228 useversionedarchname='$useversionedarchname'
24229 usevfork='$usevfork'
24230 usrinc='$usrinc'
24231 uuname='$uuname'
24232 uvXUformat='$uvXUformat'
24233 uvoformat='$uvoformat'
24234 uvsize='$uvsize'
24235 uvtype='$uvtype'
24236 uvuformat='$uvuformat'
24237 uvxformat='$uvxformat'
24238 vaproto='$vaproto'
24239 vendorarch='$vendorarch'
24240 vendorarchexp='$vendorarchexp'
24241 vendorbin='$vendorbin'
24242 vendorbinexp='$vendorbinexp'
24243 vendorhtml1dir='$vendorhtml1dir'
24244 vendorhtml1direxp='$vendorhtml1direxp'
24245 vendorhtml3dir='$vendorhtml3dir'
24246 vendorhtml3direxp='$vendorhtml3direxp'
24247 vendorlib='$vendorlib'
24248 vendorlib_stem='$vendorlib_stem'
24249 vendorlibexp='$vendorlibexp'
24250 vendorman1dir='$vendorman1dir'
24251 vendorman1direxp='$vendorman1direxp'
24252 vendorman3dir='$vendorman3dir'
24253 vendorman3direxp='$vendorman3direxp'
24254 vendorprefix='$vendorprefix'
24255 vendorprefixexp='$vendorprefixexp'
24256 vendorscript='$vendorscript'
24257 vendorscriptexp='$vendorscriptexp'
24258 version='$version'
24259 version_patchlevel_string='$version_patchlevel_string'
24260 versiononly='$versiononly'
24261 vi='$vi'
24262 xlibpth='$xlibpth'
24263 yacc='$yacc'
24264 yaccflags='$yaccflags'
24265 zcat='$zcat'
24266 zip='$zip'
24267 EOT
24268
24269 : add special variables
24270 $test -f $src/patchlevel.h && \
24271 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
24272 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
24273 echo "PERL_CONFIG_SH=true" >>config.sh
24274
24275 : propagate old symbols
24276 if $test -f UU/config.sh; then
24277         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
24278         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
24279                 config.sh config.sh UU/oldconfig.sh |\
24280                 $sort | $uniq -u >UU/oldsyms
24281         set X `$cat UU/oldsyms`
24282         shift
24283         case $# in
24284         0) ;;
24285         *)
24286                 $cat <<EOM
24287 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
24288 EOM
24289                 echo ": Variables propagated from previous config.sh file." >>config.sh
24290                 for sym in `$cat UU/oldsyms`; do
24291                         echo "    Propagating $hint variable "'$'"$sym..."
24292                         eval 'tmp="$'"${sym}"'"'
24293                         echo "$tmp" | \
24294                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
24295                 done
24296                 ;;
24297         esac
24298 fi
24299
24300 : preserve RCS keywords in files with variable substitution, grrr
24301 Id='$Id'
24302
24303 : Finish up by extracting the .SH files
24304 case "$alldone" in
24305 exit)
24306         $rm -rf UU
24307         echo "Extraction done."
24308         exit 0
24309         ;;
24310 cont)
24311         ;;
24312 '')
24313         dflt=''
24314         nostick=true
24315         $cat <<EOM
24316
24317 If you'd like to make any changes to the config.sh file before I begin
24318 to configure things, do it as a shell escape now (e.g. !vi config.sh).
24319
24320 EOM
24321         rp="Press return or use a shell escape to edit config.sh:"
24322         . UU/myread
24323         nostick=''
24324         case "$ans" in
24325         '') ;;
24326         *) : in case they cannot read
24327                 sh 1>&4 -c "$ans";;
24328         esac
24329         ;;
24330 esac
24331
24332 : if this fails, just run all the .SH files by hand
24333 . ./config.sh
24334
24335 echo " "
24336 exec 1>&4
24337 pwd=`pwd`
24338 . ./UU/extract
24339 cd "$pwd"
24340
24341 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
24342         dflt=y
24343         case "$silent" in
24344         true) ;;
24345         *)
24346                 $cat <<EOM
24347
24348 Now you need to generate make dependencies by running "$make depend".
24349 You might prefer to run it in background: "$make depend > makedepend.out &"
24350 It can take a while, so you might not want to run it right now.
24351
24352 EOM
24353                 ;;
24354         esac
24355         rp="Run $make depend now?"
24356         . UU/myread
24357         case "$ans" in
24358         y*)
24359                 $make depend && echo "Now you must run '$make'."
24360                 ;;
24361         *)
24362                 echo "You must run '$make depend' then '$make'."
24363                 ;;
24364         esac
24365 elif test -f [Mm]akefile; then
24366         echo " "
24367         echo "Now you must run a $make."
24368 else
24369         echo "Configure done."
24370 fi
24371
24372 if $test -f Policy.sh; then
24373     $cat <<EOM
24374
24375 If you compile $package on a different machine or from a different object
24376 directory, copy the Policy.sh file from this object directory to the
24377 new one before you run Configure -- this will help you with most of
24378 the policy defaults.
24379
24380 EOM
24381 fi
24382 if $test -f config.msg; then
24383     echo "Hmm.  I also noted the following information while running:"
24384     echo " "
24385     $cat config.msg >&4
24386     $rm -f config.msg
24387 fi
24388 $rm -f kit*isdone ark*isdone
24389 $rm -rf UU
24390
24391 : End of Configure
24392