This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
f0b0ad8d173323e63c0180539ad6f327e33de910
[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_aintl=''
376 d_alarm=''
377 asctime_r_proto=''
378 d_asctime_r=''
379 d_attribute_deprecated=''
380 d_attribute_format=''
381 d_attribute_malloc=''
382 d_attribute_nonnull=''
383 d_attribute_noreturn=''
384 d_attribute_pure=''
385 d_attribute_unused=''
386 d_attribute_warn_unused_result=''
387 d_printf_format_null=''
388 d_backtrace=''
389 d_bcmp=''
390 d_bcopy=''
391 d_builtin_choose_expr=''
392 d_builtin_expect=''
393 d_bzero=''
394 d_c99_variadic_macros=''
395 d_casti32=''
396 castflags=''
397 d_castneg=''
398 d_chown=''
399 d_chroot=''
400 d_chsize=''
401 d_class=''
402 d_clearenv=''
403 d_closedir=''
404 d_void_closedir=''
405 d_cmsghdr_s=''
406 d_const=''
407 d_copysignl=''
408 d_cplusplus=''
409 cryptlib=''
410 d_crypt=''
411 crypt_r_proto=''
412 d_crypt_r=''
413 d_csh=''
414 full_csh=''
415 d_ctermid=''
416 ctermid_r_proto=''
417 d_ctermid_r=''
418 ctime_r_proto=''
419 d_ctime_r=''
420 d_cuserid=''
421 d_dbl_dig=''
422 d_dbminitproto=''
423 d_difftime=''
424 d_dir_dd_fd=''
425 d_dirfd=''
426 d_dladdr=''
427 d_dlerror=''
428 d_dlopen=''
429 d_dlsymun=''
430 d_dosuid=''
431 d_suidsafe=''
432 d_drand48_r=''
433 drand48_r_proto=''
434 d_drand48proto=''
435 d_dup2=''
436 d_eaccess=''
437 d_endgrent=''
438 d_endgrent_r=''
439 endgrent_r_proto=''
440 d_endhent=''
441 d_endhostent_r=''
442 endhostent_r_proto=''
443 d_endnent=''
444 d_endnetent_r=''
445 endnetent_r_proto=''
446 d_endpent=''
447 d_endprotoent_r=''
448 endprotoent_r_proto=''
449 d_endpwent=''
450 d_endpwent_r=''
451 endpwent_r_proto=''
452 d_endsent=''
453 d_endservent_r=''
454 endservent_r_proto=''
455 d_faststdio=''
456 d_fchdir=''
457 d_fchmod=''
458 d_fchown=''
459 d_fcntl=''
460 d_fcntl_can_lock=''
461 d_fd_macros=''
462 d_fd_set=''
463 d_fds_bits=''
464 d_fgetpos=''
465 d_finite=''
466 d_finitel=''
467 d_flexfnam=''
468 d_flock=''
469 d_flockproto=''
470 d_fork=''
471 d_fp_class=''
472 d_fpclass=''
473 d_fpclassify=''
474 d_fpclassl=''
475 d_fpos64_t=''
476 d_frexpl=''
477 d_fs_data_s=''
478 d_fseeko=''
479 d_fsetpos=''
480 d_fstatfs=''
481 d_fsync=''
482 d_ftello=''
483 d_ftime=''
484 d_gettimeod=''
485 d_futimes=''
486 d_Gconvert=''
487 d_getaddrinfo=''
488 d_getcwd=''
489 d_getespwnam=''
490 d_getfsstat=''
491 d_getgrent=''
492 d_getgrent_r=''
493 getgrent_r_proto=''
494 d_getgrgid_r=''
495 getgrgid_r_proto=''
496 d_getgrnam_r=''
497 getgrnam_r_proto=''
498 d_getgrps=''
499 d_gethbyaddr=''
500 d_gethbyname=''
501 d_gethent=''
502 aphostname=''
503 d_gethname=''
504 d_phostname=''
505 d_uname=''
506 d_gethostbyaddr_r=''
507 gethostbyaddr_r_proto=''
508 d_gethostbyname_r=''
509 gethostbyname_r_proto=''
510 d_gethostent_r=''
511 gethostent_r_proto=''
512 d_gethostprotos=''
513 d_getitimer=''
514 d_getlogin=''
515 d_getlogin_r=''
516 getlogin_r_proto=''
517 d_getmnt=''
518 d_getmntent=''
519 d_getnameinfo=''
520 d_getnbyaddr=''
521 d_getnbyname=''
522 d_getnent=''
523 d_getnetbyaddr_r=''
524 getnetbyaddr_r_proto=''
525 d_getnetbyname_r=''
526 getnetbyname_r_proto=''
527 d_getnetent_r=''
528 getnetent_r_proto=''
529 d_getnetprotos=''
530 d_getpagsz=''
531 d_getpent=''
532 d_getpgid=''
533 d_getpgrp2=''
534 d_bsdgetpgrp=''
535 d_getpgrp=''
536 d_getppid=''
537 d_getprior=''
538 d_getpbyname=''
539 d_getpbynumber=''
540 d_getprotobyname_r=''
541 getprotobyname_r_proto=''
542 d_getprotobynumber_r=''
543 getprotobynumber_r_proto=''
544 d_getprotoent_r=''
545 getprotoent_r_proto=''
546 d_getprotoprotos=''
547 d_getprpwnam=''
548 d_getpwent=''
549 d_getpwent_r=''
550 getpwent_r_proto=''
551 d_getpwnam_r=''
552 getpwnam_r_proto=''
553 d_getpwuid_r=''
554 getpwuid_r_proto=''
555 d_getsent=''
556 d_getservbyname_r=''
557 getservbyname_r_proto=''
558 d_getservbyport_r=''
559 getservbyport_r_proto=''
560 d_getservent_r=''
561 getservent_r_proto=''
562 d_getservprotos=''
563 d_getspnam=''
564 d_getspnam_r=''
565 getspnam_r_proto=''
566 d_getsbyname=''
567 d_getsbyport=''
568 d_gmtime_r=''
569 gmtime_r_proto=''
570 d_gnulibc=''
571 gnulibc_version=''
572 d_hasmntopt=''
573 d_htonl=''
574 d_ilogbl=''
575 d_inetaton=''
576 d_inetntop=''
577 d_inetpton=''
578 d_int64_t=''
579 d_isascii=''
580 d_isblank=''
581 d_isfinite=''
582 d_isinf=''
583 d_isnan=''
584 d_isnanl=''
585 d_killpg=''
586 d_lchown=''
587 d_ldbl_dig=''
588 d_libm_lib_version=''
589 d_link=''
590 d_localtime_r=''
591 d_localtime_r_needs_tzset=''
592 localtime_r_proto=''
593 d_locconv=''
594 d_lockf=''
595 d_longdbl=''
596 longdblsize=''
597 d_longlong=''
598 longlongsize=''
599 d_lseekproto=''
600 d_lstat=''
601 d_madvise=''
602 d_malloc_good_size=''
603 d_malloc_size=''
604 d_mblen=''
605 d_mbstowcs=''
606 d_mbtowc=''
607 d_memchr=''
608 d_memcmp=''
609 d_memcpy=''
610 d_memmove=''
611 d_memset=''
612 d_mkdir=''
613 d_mkdtemp=''
614 d_mkfifo=''
615 d_mkstemp=''
616 d_mkstemps=''
617 d_mktime=''
618 d_mmap=''
619 mmaptype=''
620 d_modfl=''
621 d_modfl_pow32_bug=''
622 d_modflproto=''
623 d_mprotect=''
624 d_msg=''
625 d_msgctl=''
626 d_msgget=''
627 d_msghdr_s=''
628 d_msgrcv=''
629 d_msgsnd=''
630 d_msync=''
631 d_munmap=''
632 d_nice=''
633 d_nl_langinfo=''
634 d_off64_t=''
635 d_open3=''
636 d_fpathconf=''
637 d_pathconf=''
638 d_pause=''
639 d_pipe=''
640 d_poll=''
641 d_portable=''
642 d_prctl=''
643 d_prctl_set_name=''
644 d_procselfexe=''
645 procselfexe=''
646 d_old_pthread_create_joinable=''
647 old_pthread_create_joinable=''
648 d_pthread_atfork=''
649 d_pthread_attr_setscope=''
650 d_pthread_yield=''
651 d_sched_yield=''
652 sched_yield=''
653 d_qgcvt=''
654 d_random_r=''
655 random_r_proto=''
656 d_readdir64_r=''
657 readdir64_r_proto=''
658 d_readdir=''
659 d_rewinddir=''
660 d_seekdir=''
661 d_telldir=''
662 d_readdir_r=''
663 readdir_r_proto=''
664 d_readlink=''
665 d_readv=''
666 d_recvmsg=''
667 d_rename=''
668 d_rmdir=''
669 d_safebcpy=''
670 d_safemcpy=''
671 d_sanemcmp=''
672 d_sbrkproto=''
673 d_scalbnl=''
674 d_select=''
675 d_sem=''
676 d_semctl=''
677 d_semget=''
678 d_semop=''
679 d_sendmsg=''
680 d_setegid=''
681 d_seteuid=''
682 d_setgrent=''
683 d_setgrent_r=''
684 setgrent_r_proto=''
685 d_setgrps=''
686 d_sethent=''
687 d_sethostent_r=''
688 sethostent_r_proto=''
689 d_setitimer=''
690 d_setlinebuf=''
691 d_setlocale=''
692 d_setlocale_r=''
693 setlocale_r_proto=''
694 d_setnent=''
695 d_setnetent_r=''
696 setnetent_r_proto=''
697 d_setpent=''
698 d_setpgid=''
699 d_setpgrp2=''
700 d_bsdsetpgrp=''
701 d_setpgrp=''
702 d_setprior=''
703 d_setproctitle=''
704 d_setprotoent_r=''
705 setprotoent_r_proto=''
706 d_setpwent=''
707 d_setpwent_r=''
708 setpwent_r_proto=''
709 d_setregid=''
710 d_setresgid=''
711 d_setresuid=''
712 d_setreuid=''
713 d_setrgid=''
714 d_setruid=''
715 d_setsent=''
716 d_setservent_r=''
717 setservent_r_proto=''
718 d_setsid=''
719 d_setvbuf=''
720 d_shm=''
721 d_shmat=''
722 d_shmatprototype=''
723 shmattype=''
724 d_shmctl=''
725 d_shmdt=''
726 d_shmget=''
727 d_sigaction=''
728 d_signbit=''
729 d_sigprocmask=''
730 d_sigsetjmp=''
731 usesitecustomize=''
732 d_snprintf=''
733 d_vsnprintf=''
734 d_sockatmark=''
735 d_sockatmarkproto=''
736 d_ip_mreq=''
737 d_ip_mreq_source=''
738 d_ipv6_mreq=''
739 d_ipv6_mreq_source=''
740 d_msg_ctrunc=''
741 d_msg_dontroute=''
742 d_msg_oob=''
743 d_msg_peek=''
744 d_msg_proxy=''
745 d_oldsock=''
746 d_scm_rights=''
747 d_sin6_scope_id=''
748 d_sockaddr_in6=''
749 d_sockaddr_sa_len=''
750 d_socket=''
751 d_sockpair=''
752 sockethdr=''
753 socketlib=''
754 d_socklen_t=''
755 d_socks5_init=''
756 d_sprintf_returns_strlen=''
757 d_sqrtl=''
758 d_srand48_r=''
759 srand48_r_proto=''
760 d_srandom_r=''
761 srandom_r_proto=''
762 d_sresgproto=''
763 d_sresuproto=''
764 d_statblks=''
765 d_statfs_f_flags=''
766 d_statfs_s=''
767 d_static_inline=''
768 perl_static_inline=''
769 d_fstatvfs=''
770 d_statvfs=''
771 d_stdio_cnt_lval=''
772 d_stdio_ptr_lval=''
773 d_stdio_ptr_lval_nochange_cnt=''
774 d_stdio_ptr_lval_sets_cnt=''
775 d_stdiobase=''
776 d_stdstdio=''
777 stdio_base=''
778 stdio_bufsiz=''
779 stdio_cnt=''
780 stdio_filbuf=''
781 stdio_ptr=''
782 d_index=''
783 d_strchr=''
784 d_strcoll=''
785 d_strctcpy=''
786 d_strerrm=''
787 d_strerror=''
788 d_sysernlst=''
789 d_syserrlst=''
790 d_strerror_r=''
791 strerror_r_proto=''
792 d_strftime=''
793 d_strlcat=''
794 d_strlcpy=''
795 d_strtod=''
796 d_strtol=''
797 d_strtold=''
798 d_strtoll=''
799 d_strtoq=''
800 d_strtoul=''
801 d_strtoull=''
802 d_strtouq=''
803 d_strxfrm=''
804 d_symlink=''
805 d_syscall=''
806 d_syscallproto=''
807 d_sysconf=''
808 d_system=''
809 d_tcgetpgrp=''
810 d_tcsetpgrp=''
811 d_telldirproto=''
812 d_time=''
813 timetype=''
814 d_asctime64=''
815 d_ctime64=''
816 d_difftime64=''
817 d_gmtime64=''
818 d_localtime64=''
819 d_mktime64=''
820 d_timegm=''
821 clocktype=''
822 d_times=''
823 d_tmpnam_r=''
824 tmpnam_r_proto=''
825 d_truncate=''
826 d_ttyname_r=''
827 ttyname_r_proto=''
828 d_tzname=''
829 d_u32align=''
830 d_ualarm=''
831 d_umask=''
832 d_semctl_semid_ds=''
833 d_semctl_semun=''
834 d_union_semun=''
835 d_unordered=''
836 d_unsetenv=''
837 d_usleep=''
838 d_usleepproto=''
839 d_ustat=''
840 d_pseudofork=''
841 d_vfork=''
842 usevfork=''
843 d_voidsig=''
844 signal_t=''
845 d_volatile=''
846 d_charvspr=''
847 d_vprintf=''
848 d_wait4=''
849 d_waitpid=''
850 d_wcscmp=''
851 d_wcstombs=''
852 d_wcsxfrm=''
853 d_wctomb=''
854 d_writev=''
855 dlext=''
856 bin_ELF=''
857 cccdlflags=''
858 ccdlflags=''
859 dlsrc=''
860 ld=''
861 ld_can_script=''
862 lddlflags=''
863 usedl=''
864 doublesize=''
865 ebcdic=''
866 fflushNULL=''
867 fflushall=''
868 fpossize=''
869 fpostype=''
870 gccansipedantic=''
871 gccosandvers=''
872 gccversion=''
873 gidformat=''
874 gidsign=''
875 gidsize=''
876 gidtype=''
877 groupstype=''
878 h_fcntl=''
879 h_sysfile=''
880 html1dir=''
881 html1direxp=''
882 installhtml1dir=''
883 html3dir=''
884 html3direxp=''
885 installhtml3dir=''
886 i_arpainet=''
887 i_assert=''
888 i_bfd=''
889 i_crypt=''
890 db_hashtype=''
891 db_prefixtype=''
892 db_version_major=''
893 db_version_minor=''
894 db_version_patch=''
895 i_db=''
896 i_dbm=''
897 i_rpcsvcdbm=''
898 d_dirnamlen=''
899 direntrytype=''
900 i_dirent=''
901 i_dlfcn=''
902 i_execinfo=''
903 i_fcntl=''
904 i_float=''
905 i_fp=''
906 i_fp_class=''
907 i_gdbm=''
908 d_grpasswd=''
909 i_grp=''
910 i_ieeefp=''
911 i_inttypes=''
912 i_langinfo=''
913 i_libutil=''
914 i_limits=''
915 i_locale=''
916 i_machcthr=''
917 i_malloc=''
918 i_mallocmalloc=''
919 i_math=''
920 i_memory=''
921 i_mntent=''
922 d_gdbm_ndbm_h_uses_prototypes=''
923 d_gdbmndbm_h_uses_prototypes=''
924 d_ndbm=''
925 d_ndbm_h_uses_prototypes=''
926 i_gdbm_ndbm=''
927 i_gdbmndbm=''
928 i_ndbm=''
929 i_netdb=''
930 i_neterrno=''
931 i_netinettcp=''
932 i_niin=''
933 i_sysin=''
934 i_poll=''
935 i_prot=''
936 i_pthread=''
937 d_pwage=''
938 d_pwchange=''
939 d_pwclass=''
940 d_pwcomment=''
941 d_pwexpire=''
942 d_pwgecos=''
943 d_pwpasswd=''
944 d_pwquota=''
945 i_pwd=''
946 i_shadow=''
947 i_socks=''
948 i_stdbool=''
949 i_stddef=''
950 i_stdlib=''
951 i_string=''
952 strings=''
953 i_sunmath=''
954 i_sysaccess=''
955 i_sysdir=''
956 i_sysfile=''
957 d_voidtty=''
958 i_bsdioctl=''
959 i_sysfilio=''
960 i_sysioctl=''
961 i_syssockio=''
962 i_syslog=''
963 i_sysmman=''
964 i_sysmode=''
965 i_sysmount=''
966 i_sysndir=''
967 i_sysparam=''
968 i_syspoll=''
969 i_sysresrc=''
970 i_syssecrt=''
971 i_sysselct=''
972 i_sysstat=''
973 i_sysstatfs=''
974 i_sysstatvfs=''
975 i_systimes=''
976 i_systypes=''
977 i_sysuio=''
978 i_sysun=''
979 i_sysutsname=''
980 i_sysvfs=''
981 i_syswait=''
982 i_sgtty=''
983 i_termio=''
984 i_termios=''
985 d_tm_tm_gmtoff=''
986 d_tm_tm_zone=''
987 i_systime=''
988 i_systimek=''
989 i_time=''
990 timeincl=''
991 i_unistd=''
992 i_ustat=''
993 i_utime=''
994 i_values=''
995 i_stdarg=''
996 i_varargs=''
997 i_varhdr=''
998 i_vfork=''
999 d_inc_version_list=''
1000 inc_version_list=''
1001 inc_version_list_init=''
1002 installprefix=''
1003 installprefixexp=''
1004 installstyle=''
1005 installusrbinperl=''
1006 intsize=''
1007 longsize=''
1008 shortsize=''
1009 issymlink=''
1010 libc=''
1011 ldlibpthname=''
1012 libperl=''
1013 shrpenv=''
1014 useshrplib=''
1015 glibpth=''
1016 incpth=''
1017 libpth=''
1018 loclibpth=''
1019 plibpth=''
1020 xlibpth=''
1021 ignore_versioned_solibs=''
1022 libs=''
1023 libsdirs=''
1024 libsfiles=''
1025 libsfound=''
1026 libspath=''
1027 lns=''
1028 d_PRIEUldbl=''
1029 d_PRIFUldbl=''
1030 d_PRIGUldbl=''
1031 d_PRIeldbl=''
1032 d_PRIfldbl=''
1033 d_PRIgldbl=''
1034 d_SCNfldbl=''
1035 sPRIEUldbl=''
1036 sPRIFUldbl=''
1037 sPRIGUldbl=''
1038 sPRIeldbl=''
1039 sPRIfldbl=''
1040 sPRIgldbl=''
1041 sSCNfldbl=''
1042 lseeksize=''
1043 lseektype=''
1044 mad=''
1045 madlyh=''
1046 madlyobj=''
1047 madlysrc=''
1048 make_set_make=''
1049 d_mymalloc=''
1050 freetype=''
1051 mallocobj=''
1052 mallocsrc=''
1053 malloctype=''
1054 usemallocwrap=''
1055 usemymalloc=''
1056 installman1dir=''
1057 man1dir=''
1058 man1direxp=''
1059 man1ext=''
1060 installman3dir=''
1061 man3dir=''
1062 man3direxp=''
1063 man3ext=''
1064 modetype=''
1065 multiarch=''
1066 mydomain=''
1067 myhostname=''
1068 phostname=''
1069 c=''
1070 n=''
1071 d_eofnblk=''
1072 eagain=''
1073 o_nonblock=''
1074 rd_nodata=''
1075 need_va_copy=''
1076 netdb_hlen_type=''
1077 netdb_host_type=''
1078 netdb_name_type=''
1079 netdb_net_type=''
1080 groupcat=''
1081 hostcat=''
1082 passcat=''
1083 orderlib=''
1084 ranlib=''
1085 d_perl_otherlibdirs=''
1086 otherlibdirs=''
1087 package=''
1088 spackage=''
1089 pager=''
1090 api_revision=''
1091 api_subversion=''
1092 api_version=''
1093 api_versionstring=''
1094 patchlevel=''
1095 perl_patchlevel=''
1096 revision=''
1097 subversion=''
1098 version=''
1099 version_patchlevel_string=''
1100 perl5=''
1101 perladmin=''
1102 perlpath=''
1103 d_nv_preserves_uv=''
1104 d_nv_zero_is_allbits_zero=''
1105 i16size=''
1106 i16type=''
1107 i32size=''
1108 i32type=''
1109 i64size=''
1110 i64type=''
1111 i8size=''
1112 i8type=''
1113 ivsize=''
1114 ivtype=''
1115 nv_overflows_integers_at=''
1116 nv_preserves_uv_bits=''
1117 nvsize=''
1118 nvtype=''
1119 u16size=''
1120 u16type=''
1121 u32size=''
1122 u32type=''
1123 u64size=''
1124 u64type=''
1125 u8size=''
1126 u8type=''
1127 uvsize=''
1128 uvtype=''
1129 ivdformat=''
1130 nvEUformat=''
1131 nvFUformat=''
1132 nvGUformat=''
1133 nveformat=''
1134 nvfformat=''
1135 nvgformat=''
1136 uvXUformat=''
1137 uvoformat=''
1138 uvuformat=''
1139 uvxformat=''
1140 pidtype=''
1141 prefix=''
1142 prefixexp=''
1143 installprivlib=''
1144 privlib=''
1145 privlibexp=''
1146 prototype=''
1147 ptrsize=''
1148 d_PRIXU64=''
1149 d_PRId64=''
1150 d_PRIi64=''
1151 d_PRIo64=''
1152 d_PRIu64=''
1153 d_PRIx64=''
1154 sPRIXU64=''
1155 sPRId64=''
1156 sPRIi64=''
1157 sPRIo64=''
1158 sPRIu64=''
1159 sPRIx64=''
1160 d_quad=''
1161 quadkind=''
1162 quadtype=''
1163 uquadtype=''
1164 drand01=''
1165 randbits=''
1166 randfunc=''
1167 randseedtype=''
1168 seedfunc=''
1169 installscript=''
1170 scriptdir=''
1171 scriptdirexp=''
1172 selectminbits=''
1173 selecttype=''
1174 sh=''
1175 targetsh=''
1176 sig_count=''
1177 sig_name=''
1178 sig_name_init=''
1179 sig_num=''
1180 sig_num_init=''
1181 sig_size=''
1182 d_sitearch=''
1183 installsitearch=''
1184 sitearch=''
1185 sitearchexp=''
1186 installsitebin=''
1187 sitebin=''
1188 sitebinexp=''
1189 installsitehtml1dir=''
1190 sitehtml1dir=''
1191 sitehtml1direxp=''
1192 installsitehtml3dir=''
1193 sitehtml3dir=''
1194 sitehtml3direxp=''
1195 installsitelib=''
1196 sitelib=''
1197 sitelib_stem=''
1198 sitelibexp=''
1199 installsiteman1dir=''
1200 siteman1dir=''
1201 siteman1direxp=''
1202 installsiteman3dir=''
1203 siteman3dir=''
1204 siteman3direxp=''
1205 siteprefix=''
1206 siteprefixexp=''
1207 installsitescript=''
1208 sitescript=''
1209 sitescriptexp=''
1210 sizesize=''
1211 sizetype=''
1212 d_libname_unique=''
1213 so=''
1214 socksizetype=''
1215 sharpbang=''
1216 shsharp=''
1217 spitshell=''
1218 src=''
1219 ssizetype=''
1220 st_ino_sign=''
1221 st_ino_size=''
1222 startperl=''
1223 startsh=''
1224 stdchar=''
1225 d_stdio_stream_array=''
1226 stdio_stream_array=''
1227 sysman=''
1228 sGMTIME_max=''
1229 sGMTIME_min=''
1230 sLOCALTIME_max=''
1231 sLOCALTIME_min=''
1232 trnl=''
1233 uidformat=''
1234 uidsign=''
1235 uidsize=''
1236 uidtype=''
1237 archname64=''
1238 use64bitall=''
1239 use64bitint=''
1240 usecbacktrace=''
1241 dtrace=''
1242 usedtrace=''
1243 usefaststdio=''
1244 usekernprocpathname=''
1245 ccflags_uselargefiles=''
1246 ldflags_uselargefiles=''
1247 libswanted_uselargefiles=''
1248 uselargefiles=''
1249 uselongdouble=''
1250 usemorebits=''
1251 usemultiplicity=''
1252 nm_opt=''
1253 nm_so_opt=''
1254 runnm=''
1255 usenm=''
1256 usensgetexecutablepath=''
1257 useperlio=''
1258 usesocks=''
1259 d_oldpthreads=''
1260 use5005threads=''
1261 useithreads=''
1262 usereentrant=''
1263 usethreads=''
1264 incpath=''
1265 mips_type=''
1266 usrinc=''
1267 vaproto=''
1268 d_vendorarch=''
1269 installvendorarch=''
1270 vendorarch=''
1271 vendorarchexp=''
1272 d_vendorbin=''
1273 installvendorbin=''
1274 vendorbin=''
1275 vendorbinexp=''
1276 installvendorhtml1dir=''
1277 vendorhtml1dir=''
1278 vendorhtml1direxp=''
1279 installvendorhtml3dir=''
1280 vendorhtml3dir=''
1281 vendorhtml3direxp=''
1282 d_vendorlib=''
1283 installvendorlib=''
1284 vendorlib=''
1285 vendorlib_stem=''
1286 vendorlibexp=''
1287 installvendorman1dir=''
1288 vendorman1dir=''
1289 vendorman1direxp=''
1290 installvendorman3dir=''
1291 vendorman3dir=''
1292 vendorman3direxp=''
1293 usevendorprefix=''
1294 vendorprefix=''
1295 vendorprefixexp=''
1296 d_vendorscript=''
1297 installvendorscript=''
1298 vendorscript=''
1299 vendorscriptexp=''
1300 versiononly=''
1301 yacc=''
1302 yaccflags=''
1303 CONFIG=''
1304
1305 : Detect odd OSs
1306 define='define'
1307 undef='undef'
1308 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1309 rmlist=''
1310
1311 : We must find out about Eunice early
1312 eunicefix=':'
1313 if test -f /etc/unixtovms; then
1314         eunicefix=/etc/unixtovms
1315 fi
1316 if test -f /etc/unixtovms.exe; then
1317         eunicefix=/etc/unixtovms.exe
1318 fi
1319
1320 : Set executable suffix now -- needed before hints available
1321 if test -f "/libs/version.library"; then
1322 : Amiga OS
1323     _exe=""
1324 elif test -f "/system/gnu_library/bin/ar.pm"; then
1325 : Stratus VOS
1326     _exe=".pm"
1327 elif test -n "$DJGPP"; then
1328 : DOS DJGPP
1329     _exe=".exe"
1330 elif test -f /kern/cookiejar; then
1331 : MiNT
1332     _exe=""
1333 elif test -d c:/. -o -n "$is_os2" ; then
1334 : OS/2 or cygwin
1335     _exe=".exe"
1336 fi
1337
1338 groupstype=''
1339 i_whoami=''
1340 : Trailing extension.  Override this in a hint file, if needed.
1341 : Extra object files, if any, needed on this platform.
1342 archobjs=''
1343 archname=''
1344 : Possible local include directories to search.
1345 : Set locincpth to "" in a hint file to defeat local include searches.
1346 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1347 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1348 :
1349 : no include file wanted by default
1350 inclwanted=''
1351
1352 : Enable -DEBUGGING and -DDEBUGGING from the command line
1353 EBUGGING=''
1354 DEBUGGING=''
1355
1356 libnames=''
1357 : change the next line if compiling for Xenix/286 on Xenix/386
1358 xlibpth='/usr/lib/386 /lib/386'
1359 : Possible local library directories to search.
1360 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1361 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1362
1363 : general looking path for locating libraries
1364 glibpth="/lib /usr/lib $xlibpth"
1365 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1366 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1367 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1368 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1369
1370 : Private path used by Configure to find libraries.  Its value
1371 : is prepended to libpth. This variable takes care of special
1372 : machines, like the mips.  Usually, it should be empty.
1373 plibpth=''
1374
1375 : default library list
1376 libswanted=''
1377 : some systems want to use only the non-versioned libso:s
1378 ignore_versioned_solibs=''
1379 : set usethreads on the Configure command line to enable threads.
1380 usereentrant='undef'
1381 ccname=''
1382 ccversion=''
1383 perllibs=''
1384 : set useposix=false in your hint file to disable the POSIX extension.
1385 useposix=true
1386 : set useopcode=false in your hint file to disable the Opcode extension.
1387 useopcode=true
1388 archname64=''
1389 ccflags_uselargefiles=''
1390 ldflags_uselargefiles=''
1391 libswanted_uselargefiles=''
1392 : set usemultiplicity on the Configure command line to enable multiplicity.
1393 : set usesocks on the Configure command line to enable socks.
1394 : List of libraries we want.
1395 : If anyone needs extra -lxxx, put those in a hint file.
1396 libswanted="socket bind inet nsl nm ndbm gdbm dbm db malloc dl ld sun"
1397 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1398 : We probably want to search /usr/shlib before most other libraries.
1399 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1400 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1401 glibpth="/usr/shlib $glibpth"
1402 : Do not use vfork unless overridden by a hint file.
1403 usevfork=false
1404
1405 : Find the basic shell for Bourne shell scripts
1406 case "$sh" in
1407 '')
1408         case "$SYSTYPE" in
1409         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1410         *) xxx='/bin/sh';;
1411         esac
1412         if test -f "$xxx"; then
1413                 sh="$xxx"
1414         else
1415                 : Build up a list and do a single loop so we can 'break' out.
1416                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1417                 for xxx in sh bash ksh pdksh ash; do
1418                         for p in $pth; do
1419                                 try="$try ${p}/${xxx}"
1420                         done
1421                 done
1422                 for xxx in $try; do
1423                         if test -f "$xxx"; then
1424                                 sh="$xxx";
1425                                 break
1426                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1427                                 sh="$xxx";
1428                                 break
1429                         elif test -f "$xxx.exe"; then
1430                                 sh="$xxx";
1431                                 break
1432                         fi
1433                 done
1434         fi
1435         ;;
1436 esac
1437
1438 case "$sh" in
1439 '')     cat >&2 <<EOM
1440 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1441
1442 Usually it's in /bin/sh.  How did you even get this far?
1443 Please contact me (Perl Maintainers) at perlbug@perl.org and
1444 we'll try to straighten this all out.
1445 EOM
1446         exit 1
1447         ;;
1448 esac
1449
1450 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1451 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1452 targetsh=$sh
1453
1454 : see if sh knows # comments
1455 if `$sh -c '#' >/dev/null 2>&1`; then
1456         shsharp=true
1457         spitshell=cat
1458         xcat=/bin/cat
1459         test -f $xcat$_exe || xcat=/usr/bin/cat
1460         if test ! -f $xcat$_exe; then
1461                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1462                         if test -f $p/cat$_exe; then
1463                                 xcat=$p/cat
1464                                 break
1465                         fi
1466                 done
1467                 if test ! -f $xcat$_exe; then
1468                         echo "Can't find cat anywhere!"
1469                         exit 1
1470                 fi
1471         fi
1472         echo "#!$xcat" >sharp
1473         $eunicefix sharp
1474         chmod +x sharp
1475         ./sharp > today 2>/dev/null
1476         if test -s today; then
1477                 sharpbang='#!'
1478         else
1479                 echo "#! $xcat" > sharp
1480                 $eunicefix sharp
1481                 chmod +x sharp
1482                 ./sharp > today 2>/dev/null
1483                 if test -s today; then
1484                         sharpbang='#! '
1485                 else
1486                         sharpbang=': use '
1487                 fi
1488         fi
1489 else
1490         echo " "
1491         echo "Your $sh doesn't grok # comments--I will strip them later on."
1492         shsharp=false
1493         cd ..
1494         echo "exec grep -v '^[  ]*#'" >spitshell
1495         chmod +x spitshell
1496         $eunicefix spitshell
1497         spitshell=`pwd`/spitshell
1498         cd UU
1499         echo "I presume that if # doesn't work, #! won't work either!"
1500         sharpbang=': use '
1501 fi
1502 rm -f sharp today
1503
1504 : figure out how to guarantee sh startup
1505 case "$startsh" in
1506 '') startsh=${sharpbang}${sh} ;;
1507 *)
1508 esac
1509 cat >sharp <<EOSS
1510 $startsh
1511 set abc
1512 test "$?abc" != 1
1513 EOSS
1514
1515 chmod +x sharp
1516 $eunicefix sharp
1517 if ./sharp; then
1518         : echo "Yup, it does."
1519 else
1520         echo "Hmm... '$startsh' does not guarantee sh startup..."
1521         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1522 fi
1523 rm -f sharp
1524
1525 : Save command line options in file UU/cmdline.opt for later use in
1526 : generating config.sh.
1527 cat > cmdline.opt <<EOSH
1528 : Configure command line arguments.
1529 config_arg0='$0'
1530 config_args='$*'
1531 config_argc=$#
1532 EOSH
1533 argn=1
1534 args_exp=''
1535 args_sep=''
1536 for arg in "$@"; do
1537         cat >>cmdline.opt <<EOSH
1538 config_arg$argn='$arg'
1539 EOSH
1540         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1541 $arg
1542 EOC
1543         arg_exp=`cat cmdl.opt`
1544         args_exp="$args_exp$args_sep'$arg_exp'"
1545         argn=`expr $argn + 1`
1546         args_sep=' '
1547 done
1548 rm -f cmdl.opt
1549
1550 : produce awk script to parse command line options
1551 cat >options.awk <<'EOF'
1552 BEGIN {
1553         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1554
1555         len = length(optstr);
1556         for (i = 1; i <= len; i++) {
1557                 c = substr(optstr, i, 1);
1558                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1559                 if (a == ":") {
1560                         arg[c] = 1;
1561                         i++;
1562                 }
1563                 opt[c] = 1;
1564         }
1565 }
1566 {
1567         expect = 0;
1568         str = $0;
1569         if (substr(str, 1, 1) != "-") {
1570                 printf("'%s'\n", str);
1571                 next;
1572         }
1573         len = length($0);
1574         for (i = 2; i <= len; i++) {
1575                 c = substr(str, i, 1);
1576                 if (!opt[c]) {
1577                         printf("-%s\n", substr(str, i));
1578                         next;
1579                 }
1580                 printf("-%s\n", c);
1581                 if (arg[c]) {
1582                         if (i < len)
1583                                 printf("'%s'\n", substr(str, i + 1));
1584                         else
1585                                 expect = 1;
1586                         next;
1587                 }
1588         }
1589 }
1590 END {
1591         if (expect)
1592                 print "?";
1593 }
1594 EOF
1595
1596 : process the command line options
1597 set X `for arg in "$@"; do echo "X$arg"; done |
1598         sed -e s/X// | awk -f options.awk`
1599 eval "set $*"
1600 shift
1601 rm -f options.awk
1602
1603 : set up default values
1604 fastread=''
1605 reuseval=false
1606 config_sh=''
1607 alldone=''
1608 error=''
1609 silent=''
1610 extractsh=''
1611 override=''
1612 knowitall=''
1613 rm -f optdef.sh posthint.sh
1614 cat >optdef.sh <<EOS
1615 $startsh
1616 EOS
1617
1618
1619 : option parsing
1620 while test $# -gt 0; do
1621         case "$1" in
1622         -d) shift; fastread=yes;;
1623         -e) shift; alldone=cont;;
1624         -f)
1625                 shift
1626                 cd ..
1627                 if test -r "$1"; then
1628                         config_sh="$1"
1629                 else
1630                         echo "$me: cannot read config file $1." >&2
1631                         error=true
1632                 fi
1633                 cd UU
1634                 shift;;
1635         --help|\
1636         -h) shift; error=true;;
1637         -r) shift; reuseval=true;;
1638         -s) shift; silent=true; realsilent=true;;
1639         -E) shift; alldone=exit;;
1640         -K) shift; knowitall=true;;
1641         -O) shift; override=true;;
1642         -S) shift; silent=true; extractsh=true;;
1643         -D)
1644                 shift
1645                 case "$1" in
1646                 *=)
1647                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1648                         echo "$me: ignoring -D $1" >&2
1649                         ;;
1650                 *=*) echo "$1" | \
1651                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1652                 *) echo "$1='define'" >> optdef.sh;;
1653                 esac
1654                 shift
1655                 ;;
1656         -U)
1657                 shift
1658                 case "$1" in
1659                 *=) echo "$1" >> optdef.sh;;
1660                 *=*)
1661                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1662                         echo "$me: ignoring -U $1" >&2
1663                         ;;
1664                 *) echo "$1='undef'" >> optdef.sh;;
1665                 esac
1666                 shift
1667                 ;;
1668         -A)
1669             shift
1670             xxx=''
1671             yyy="$1"
1672             zzz=''
1673             uuu=undef
1674             case "$yyy" in
1675             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1676                  case "$zzz" in
1677                  *:*) zzz='' ;;
1678                  *)   xxx=append
1679                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1680                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1681                  esac
1682                  ;;
1683             esac
1684             case "$xxx" in
1685             '')  case "$yyy" in
1686                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1687                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1688                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1689                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1690                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1691                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1692                  esac
1693                  ;;
1694             esac
1695             case "$xxx" in
1696             append)
1697                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1698             clear)
1699                 echo "$yyy=''"                  >> posthint.sh ;;
1700             define)
1701                 case "$zzz" in
1702                 '') zzz=define ;;
1703                 esac
1704                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1705             eval)
1706                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1707             prepend)
1708                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1709             undef)
1710                 case "$zzz" in
1711                 '') zzz="$uuu" ;;
1712                 esac
1713                 echo "$yyy=$zzz"                >> posthint.sh ;;
1714             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1715             esac
1716             shift
1717             ;;
1718         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1719             exit 0;;
1720         --) break;;
1721         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1722         *) break;;
1723         esac
1724 done
1725
1726 case "$error" in
1727 true)
1728         cat >&2 <<EOM
1729 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1730                  [-U symbol] [-U symbol=] [-A command:symbol...]
1731   -d : use defaults for all answers.
1732   -e : go on without questioning past the production of config.sh.
1733   -f : specify an alternate default configuration file.
1734   -h : print this help message and exit (with an error status).
1735   -r : reuse C symbols value if possible (skips costly nm extraction).
1736   -s : silent mode, only echoes questions and essential information.
1737   -D : define symbol to have some value:
1738          -D symbol         symbol gets the value 'define'
1739          -D symbol=value   symbol gets the value 'value'
1740        common used examples (see INSTALL for more info):
1741          -Duse64bitint            use 64bit integers
1742          -Duse64bitall            use 64bit integers and pointers
1743          -Dusethreads             use thread support
1744          -Dinc_version_list=none  do not include older perl trees in @INC
1745          -DEBUGGING=none          DEBUGGING options
1746          -Dcc=gcc                 choose your compiler
1747          -Dprefix=/opt/perl5      choose your destination
1748   -E : stop at the end of questions, after having produced config.sh.
1749   -K : do not use unless you know what you are doing.
1750   -O : let -D and -U override definitions from loaded configuration file.
1751   -S : perform variable substitutions on all .SH files (can mix with -f)
1752   -U : undefine symbol:
1753          -U symbol    symbol gets the value 'undef'
1754          -U symbol=   symbol gets completely empty
1755        e.g.:  -Uversiononly
1756   -A : manipulate symbol after the platform specific hints have been applied:
1757          -A append:symbol=value   append value to symbol
1758          -A symbol=value          like append:, but with a separating space
1759          -A define:symbol=value   define symbol to have value
1760          -A clear:symbol          define symbol to be ''
1761          -A define:symbol         define symbol to be 'define'
1762          -A eval:symbol=value     define symbol to be eval of value
1763          -A prepend:symbol=value  prepend value to symbol
1764          -A undef:symbol          define symbol to be 'undef'
1765          -A undef:symbol=         define symbol to be ''
1766        e.g.:  -A prepend:libswanted='cl pthread '
1767               -A ccflags=-DSOME_MACRO
1768   -V : print version number and exit (with a zero status).
1769 EOM
1770         exit 1
1771         ;;
1772 esac
1773
1774 : Sanity checks
1775 case "$fastread$alldone" in
1776 yescont|yesexit) ;;
1777 *)
1778         case "$extractsh" in
1779         true) ;;
1780         *)
1781                 if test ! -t 0; then
1782                         echo "Say 'sh Configure', not 'sh <Configure'"
1783                         exit 1
1784                 fi
1785                 ;;
1786         esac
1787         ;;
1788 esac
1789
1790 exec 4>&1
1791 case "$silent" in
1792 true) exec 1>/dev/null;;
1793 esac
1794
1795 : run the defines and the undefines, if any, but leave the file out there...
1796 touch optdef.sh
1797 . ./optdef.sh
1798 : create the posthint manipulation script and leave the file out there...
1799 touch posthint.sh
1800
1801 : set package name
1802 package='perl5'
1803 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1804 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1805 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1806 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1807 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1808 esac
1809
1810 : Some greps do not return status, grrr.
1811 echo "grimblepritz" >grimble
1812 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1813         contains=contains
1814 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1815         contains=grep
1816 else
1817         contains=contains
1818 fi
1819 rm -f grimble
1820 : the following should work in any shell
1821 case "$contains" in
1822 contains*)
1823         echo " "
1824         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1825         cat >contains <<'EOSS'
1826 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1827 EOSS
1828 chmod +x contains
1829 esac
1830
1831 : Find the path to the source tree
1832 case "$src" in
1833 '') case "$0" in
1834     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1835          case "$src" in
1836          /*)    ;;
1837          .)     ;;
1838          *)     src=`cd ../$src && pwd` ;;
1839          esac
1840          ;;
1841     *)   src='.';;
1842     esac;;
1843 esac
1844 case "$src" in
1845 '')     src=/
1846         rsrc=/
1847         ;;
1848 /*)     rsrc="$src";;
1849 *)      rsrc="../$src";;
1850 esac
1851 if test -f $rsrc/Configure && \
1852         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1853 then
1854    : found it, so we are ok.
1855 else
1856         rsrc=''
1857         for src in . .. ../.. ../../.. ../../../..; do
1858                 if test -f ../$src/Configure && \
1859                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1860                 then
1861                         rsrc=../$src
1862                         break
1863                 fi
1864         done
1865 fi
1866 case "$rsrc" in
1867 '')
1868         cat <<EOM >&4
1869
1870 Sorry, I can't seem to locate the source dir for $package.  Please start
1871 Configure with an explicit path -- i.e. /some/path/Configure.
1872
1873 EOM
1874         exit 1
1875         ;;
1876 ../.)   rsrc='..';;
1877 *)
1878         echo " "
1879         echo "Sources for $package found in \"$src\"." >&4
1880         ;;
1881 esac
1882
1883 : script used to extract .SH files with variable substitutions
1884 cat >extract <<'EOS'
1885 PERL_CONFIG_SH=true
1886 echo "Doing variable substitutions on .SH files..."
1887 if test -f MANIFEST; then
1888         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1889 else
1890         echo "(Looking for .SH files under the source directory.)"
1891         set x `(cd "$src"; find . -name "*.SH" -print)`
1892 fi
1893 shift
1894 case $# in
1895 0) set x `(cd "$src"; echo *.SH)`; shift;;
1896 esac
1897 if test ! -f "$src/$1"; then
1898         shift
1899 fi
1900 mkdir_p='
1901 name=$1;
1902 create="";
1903 while test $name; do
1904         if test ! -d "$name"; then
1905                 create="$name $create";
1906                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1907                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1908         else
1909                 name="";
1910         fi;
1911 done;
1912 for file in $create; do
1913         mkdir $file;
1914 done
1915 '
1916 for file in $*; do
1917         case "$src" in
1918         ".")
1919                 case "$file" in
1920                 */*)
1921                         dir=`expr X$file : 'X\(.*\)/'`
1922                         file=`expr X$file : 'X.*/\(.*\)'`
1923                         (cd "$dir" && . ./$file)
1924                         ;;
1925                 *)
1926                         . ./$file
1927                         ;;
1928                 esac
1929                 ;;
1930         *)
1931                 case "$file" in
1932                 */*)
1933                         dir=`expr X$file : 'X\(.*\)/'`
1934                         file=`expr X$file : 'X.*/\(.*\)'`
1935                         (set x $dir; shift; eval $mkdir_p)
1936                         sh <"$src/$dir/$file"
1937                         ;;
1938                 *)
1939                         sh <"$src/$file"
1940                         ;;
1941                 esac
1942                 ;;
1943         esac
1944 done
1945 if test -f "$src/config_h.SH"; then
1946         if test ! -f config.h; then
1947         : oops, they left it out of MANIFEST, probably, so do it anyway.
1948         . "$src/config_h.SH"
1949         fi
1950 fi
1951 EOS
1952
1953 : extract files and exit if asked to do so
1954 case "$extractsh" in
1955 true)
1956         case "$realsilent" in
1957         true) ;;
1958         *) exec 1>&4;;
1959         esac
1960         case "$config_sh" in
1961         '') config_sh='config.sh';;
1962         esac
1963         echo " "
1964         echo "Fetching answers from $config_sh..."
1965         cd ..
1966         . $config_sh
1967         test "$override" && . ./optdef.sh
1968         echo " "
1969         . UU/extract
1970         rm -rf UU
1971         echo "Extraction done."
1972         exit 0
1973         ;;
1974 esac
1975
1976 : Eunice requires " " instead of "", can you believe it
1977 echo " "
1978 : Here we go...
1979 echo "Beginning of configuration questions for $package."
1980
1981 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1982
1983 : first determine how to suppress newline on echo command
1984 echo " "
1985 echo "Checking echo to see how to suppress newlines..."
1986 (echo "hi there\c" ; echo " ") >.echotmp
1987 if $contains c .echotmp >/dev/null 2>&1 ; then
1988         echo "...using -n."
1989         n='-n'
1990         c=''
1991 else
1992         cat <<'EOM'
1993 ...using \c
1994 EOM
1995         n=''
1996         c='\c'
1997 fi
1998 echo $n "The star should be here-->$c"
1999 echo '*'
2000 rm -f .echotmp
2001
2002 : Now test for existence of everything in MANIFEST
2003 echo " "
2004 if test -f "$rsrc/MANIFEST"; then
2005         echo "First let's make sure your kit is complete.  Checking..." >&4
2006         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2007                 (split -l 50 2>/dev/null || split -50)
2008         rm -f missing
2009         tmppwd=`pwd`
2010         for filelist in x??; do
2011                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2012                         >/dev/null 2>>"$tmppwd/missing")
2013         done
2014         if test -s missing; then
2015                 cat missing >&4
2016                 cat >&4 <<'EOM'
2017
2018 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2019
2020 You have the option of continuing the configuration process, despite the
2021 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2022 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2023 and contact the author (perlbug@perl.org).
2024
2025 EOM
2026                 echo $n "Continue? [n] $c" >&4
2027                 read ans
2028                 case "$ans" in
2029                 y*)
2030                         echo "Continuing..." >&4
2031                         rm -f missing
2032                         ;;
2033                 *)
2034                         echo "ABORTING..." >&4
2035                         kill $$
2036                         ;;
2037                 esac
2038         else
2039                 echo "Looks good..."
2040         fi
2041 else
2042         echo "There is no MANIFEST file.  I hope your kit is complete !"
2043 fi
2044 rm -f missing x??
2045
2046 : Find the appropriate value for a newline for tr
2047 echo " "
2048 if test -n "$DJGPP"; then
2049        trnl='\012'
2050 fi
2051 if test X"$trnl" = X; then
2052         case "`echo foo|tr '\n' x 2>/dev/null`" in
2053         foox) trnl='\n' ;;
2054         esac
2055 fi
2056 if test X"$trnl" = X; then
2057         case "`echo foo|tr '\012' x 2>/dev/null`" in
2058         foox) trnl='\012' ;;
2059         esac
2060 fi
2061 if test X"$trnl" = X; then
2062        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2063        fooxy) trnl='\n\r' ;;
2064        esac
2065 fi
2066 if test X"$trnl" = X; then
2067         cat <<EOM >&2
2068
2069 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2070
2071 EOM
2072         exit 1
2073 fi
2074
2075 : compute the number of columns on the terminal for proper question formatting
2076 case "$COLUMNS" in
2077 '') COLUMNS='80';;
2078 esac
2079
2080 : set up the echo used in my read
2081 myecho="case \"\$xxxm\" in
2082 '') echo $n \"\$rp $c\" >&4;;
2083 *) case \"\$rp\" in
2084         '') echo $n \"[\$xxxm] $c\";;
2085         *)
2086                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2087                         echo \"\$rp\" >&4
2088                         echo $n \"[\$xxxm] $c\" >&4
2089                 else
2090                         echo $n \"\$rp [\$xxxm] $c\" >&4
2091                 fi
2092                 ;;
2093         esac;;
2094 esac"
2095
2096 : now set up to do reads with possible shell escape and default assignment
2097 cat <<EOSC >myread
2098 $startsh
2099 xxxm=\$dflt
2100 $myecho
2101 ans='!'
2102 case "\$fastread" in
2103 yes) case "\$dflt" in
2104         '') ;;
2105         *) ans='';
2106                 case "\$silent-\$rp" in
2107                 true-) ;;
2108                 *) echo " " >&4;;
2109                 esac;;
2110         esac;;
2111 *) case "\$silent" in
2112         true) case "\$rp" in
2113                 '') ans='';;
2114                 esac;;
2115         esac;;
2116 esac
2117 while expr "X\$ans" : "X!" >/dev/null; do
2118         read answ
2119         set x \$xxxm
2120         shift
2121         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2122         case  "\$answ" in
2123         "!")
2124                 sh 1>&4
2125                 echo " "
2126                 $myecho
2127                 ;;
2128         !*)
2129                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2130                 shift
2131                 sh 1>&4 -c "\$*"
2132                 echo " "
2133                 $myecho
2134                 ;;
2135         "\$ans")
2136                 case "\$ans" in
2137                 \\&*)
2138                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2139                         shift
2140                         case "\$1" in
2141                         -d)
2142                                 fastread=yes
2143                                 echo "(OK, I'll run with -d after this question.)" >&4
2144                                 ;;
2145                         -*)
2146                                 echo "*** Sorry, \$1 not supported yet." >&4
2147                                 ;;
2148                         esac
2149                         $myecho
2150                         ans=!
2151                         ;;
2152                 esac;;
2153         *)
2154                 case "\$aok" in
2155                 y)
2156                         echo "*** Substitution done -- please confirm."
2157                         xxxm="\$ans"
2158                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2159                         xxxm="\$ans"
2160                         ans=!
2161                         ;;
2162                 *)
2163                         echo "*** Error -- try again."
2164                         ans=!
2165                         ;;
2166                 esac
2167                 $myecho
2168                 ;;
2169         esac
2170         case "\$ans\$xxxm\$nostick" in
2171         '')
2172                 ans=!
2173                 $myecho
2174                 ;;
2175         esac
2176 done
2177 case "\$ans" in
2178 '') ans="\$xxxm";;
2179 esac
2180 EOSC
2181
2182 : create .config dir to save info across Configure sessions
2183 test -d ../.config || mkdir ../.config
2184 cat >../.config/README <<EOF
2185 This directory created by Configure to save information that should
2186 persist across sessions for $package.
2187
2188 You may safely delete it if you wish.
2189 EOF
2190
2191 : See if we are using a devel version and want that
2192 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2193 case "$usedevel" in
2194 $define|true|[yY]*)
2195     usedevel="$define" ;;
2196 *) case "$xversion" in
2197    *[13579])
2198         cat >&4 <<EOH
2199 *** WHOA THERE!!! ***
2200
2201     This is an UNSTABLE DEVELOPMENT release.
2202     The version of this $package distribution is $xversion, that is, odd,
2203     (as opposed to even) and that signifies a development release.
2204     If you want a maintenance release, you want an even-numbered version.
2205
2206     Do ***NOT*** install this into production use.
2207     Data corruption and crashes are possible.
2208
2209     It is most seriously suggested that you do not continue any further
2210     unless you want to help in developing and debugging Perl.
2211
2212     If you *still* want to build perl, you can answer 'y' now,
2213     or pass -Dusedevel to Configure.
2214
2215 EOH
2216         rp='Do you really want to continue?'
2217         dflt='n'
2218         . ./myread
2219         case "$ans" in
2220         [yY]) echo >&4 "Okay, continuing."
2221               usedevel="$define" ;;
2222         *) echo >&4 "Okay, bye."
2223            exit 1
2224            ;;
2225         esac
2226         ;;
2227     esac
2228     usedevel="$undef"
2229     ;;
2230 esac
2231 case "$usedevel" in
2232 $define|true|[yY]*)
2233         case "$versiononly" in
2234         '') versiononly="$define" ;;
2235         esac
2236         case "$installusrbinperl" in
2237         '') installusrbinperl="$undef" ;;
2238         esac
2239         ;;
2240 esac
2241
2242 : general instructions
2243 needman=true
2244 firsttime=true
2245 user=`(logname) 2>/dev/null`
2246 case "$user" in
2247 '') user=`whoami 2>&1`;;
2248 esac
2249 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2250         firsttime=false
2251         echo " "
2252         rp='Would you like to see the instructions?'
2253         dflt=n
2254         . ./myread
2255         case "$ans" in
2256         [yY]*) ;;
2257         *) needman=false;;
2258         esac
2259 fi
2260 if $needman; then
2261         cat <<EOH
2262
2263 This installation shell script will examine your system and ask you questions
2264 to determine how the perl5 package should be installed. If you get
2265 stuck on a question, you may use a ! shell escape to start a subshell or
2266 execute a command.  Many of the questions will have default answers in square
2267 brackets; typing carriage return will give you the default.
2268
2269 On some of the questions which ask for file or directory names you are allowed
2270 to use the ~name construct to specify the login directory belonging to "name",
2271 even if you don't have a shell which knows about that.  Questions where this is
2272 allowed will be marked "(~name ok)".
2273
2274 EOH
2275         rp=''
2276         dflt='Type carriage return to continue'
2277         . ./myread
2278         cat <<'EOH'
2279
2280 The prompter used in this script allows you to use shell variables and
2281 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2282 in the default answer, as if the default line was a set of arguments given to a
2283 script shell.  This means you may also use $* to repeat the whole default line,
2284 so you do not have to re-type everything to add something to the default.
2285
2286 Every time there is a substitution, you will have to confirm.  If there is an
2287 error (e.g. an unmatched backtick), the default answer will remain unchanged
2288 and you will be prompted again.
2289
2290 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2291 the questions and use the computed defaults (or the previous answers if there
2292 was already a config.sh file). Type 'Configure -h' for a list of options.
2293 You may also start interactively and then answer '& -d' at any prompt to turn
2294 on the non-interactive behaviour for the remainder of the execution.
2295
2296 EOH
2297         . ./myread
2298         cat <<EOH
2299
2300 Much effort has been expended to ensure that this shell script will run on any
2301 Unix system.  If despite that it blows up on yours, your best bet is to edit
2302 Configure and run it again.  If you can't run Configure for some reason,
2303 you'll have to generate a config.sh file by hand.  Whatever problems you
2304 have, let me (perlbug@perl.org) know how I blew it.
2305
2306 This installation script affects things in two ways:
2307
2308 1) it may do direct variable substitutions on some of the files included
2309    in this kit.
2310 2) it builds a config.h file for inclusion in C programs.  You may edit
2311    any of these files as the need arises after running this script.
2312
2313 If you make a mistake on a question, there is no easy way to back up to it
2314 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2315 files.  Configure will offer to let you do this before it runs the SH files.
2316
2317 EOH
2318         dflt='Type carriage return to continue'
2319         . ./myread
2320         case "$firsttime" in
2321         true) echo $user >>../.config/instruct;;
2322         esac
2323 fi
2324
2325 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2326 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2327 if test "X$sysroot" = X; then
2328     sysroot=""
2329 else
2330     case "$cc" in
2331         *gcc*|*g++*)
2332             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2333             # _sysroot is used in places where we need --sysroot=foo
2334             # but using the rest of the flags could cause issues.
2335             _sysroot="--sysroot=$sysroot";
2336             case "$ccflags" in
2337                 *sysroot*) ;;
2338                 'undef'|*)
2339                 ccflags="$ccflags $_sysroot"
2340             esac
2341             case "$ldflags" in
2342                 *sysroot*) ;;
2343                 'undef'|*)
2344                 ldflags="$ldflags $_sysroot"
2345             esac
2346             case "$cppflags" in
2347                 *sysroot*) ;;
2348                 'undef'|*)
2349                 cppflags="$cppflags $_sysroot"
2350             esac
2351             # lddlflags updated below in lddlflags section;
2352             # same with cccdlflags
2353             ;;
2354     esac
2355
2356     # Adjust some defaults to also use $sysroot
2357     for var in xlibpth loclibpth locincpth glibpth; do
2358         eval xxx=\$$var
2359         eval $var=''
2360         for path in $xxx; do
2361             eval $var=\"\$$var $sysroot$path\"
2362         done
2363     done
2364
2365 fi
2366
2367 : find out where common programs are
2368 echo " "
2369 echo "Locating common programs..." >&4
2370 cat <<EOSC >loc
2371 $startsh
2372 case \$# in
2373 0) exit 1;;
2374 esac
2375 thing=\$1
2376 shift
2377 dflt=\$1
2378 shift
2379 for dir in \$*; do
2380         case "\$thing" in
2381         .)
2382         if test -d \$dir/\$thing; then
2383                 echo \$dir
2384                 exit 0
2385         fi
2386         ;;
2387         *)
2388         for thisthing in \$dir/\$thing; do
2389                 : just loop through to pick last item
2390         done
2391         if test -f \$thisthing; then
2392                 echo \$thisthing
2393                 exit 0
2394         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2395                 echo \$thisthing
2396                 exit 0
2397         elif test -f \$dir/\$thing.exe; then
2398                 if test -n "$DJGPP"; then
2399                         echo \$dir/\$thing.exe
2400                 elif test "$eunicefix" != ":"; then
2401                         : on Eunice apparently
2402                         echo \$dir/\$thing
2403                 fi
2404                 exit 0
2405         fi
2406         ;;
2407         esac
2408 done
2409 echo \$dflt
2410 exit 1
2411 EOSC
2412 chmod +x loc
2413 $eunicefix loc
2414 loclist="
2415 awk
2416 cat
2417 chmod
2418 comm
2419 cp
2420 echo
2421 expr
2422 grep
2423 ls
2424 mkdir
2425 rm
2426 sed
2427 sort
2428 touch
2429 tr
2430 uniq
2431 "
2432 trylist="
2433 ar
2434 bison
2435 byacc
2436 cpp
2437 csh
2438 date
2439 egrep
2440 gmake
2441 gzip
2442 less
2443 ln
2444 make
2445 more
2446 nm
2447 nroff
2448 perl
2449 pg
2450 test
2451 uname
2452 zip
2453 "
2454 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2455 pth="$pth $sysroot/lib $sysroot/usr/lib"
2456 for file in $loclist; do
2457         eval xxx=\$$file
2458         case "$xxx" in
2459         /*|?:[\\/]*)
2460                 if test -f "$xxx"; then
2461                         : ok
2462                 else
2463                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2464                         xxx=`./loc $file $file $pth`
2465                 fi
2466                 ;;
2467         '') xxx=`./loc $file $file $pth`;;
2468         *) xxx=`./loc $xxx $xxx $pth`;;
2469         esac
2470         eval $file=$xxx$_exe
2471         eval _$file=$xxx
2472         case "$xxx" in
2473         /*)
2474                 echo $file is in $xxx.
2475                 ;;
2476         ?:[\\/]*)
2477                 echo $file is in $xxx.
2478                 ;;
2479         *)
2480                 echo "I don't know where '$file' is, and my life depends on it." >&4
2481                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2482                 exit 1
2483                 ;;
2484         esac
2485 done
2486 echo " "
2487 echo "Don't worry if any of the following aren't found..."
2488 say=offhand
2489 for file in $trylist; do
2490         eval xxx=\$$file
2491         case "$xxx" in
2492         /*|?:[\\/]*)
2493                 if test -f "$xxx"; then
2494                         : ok
2495                 else
2496                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2497                         xxx=`./loc $file $file $pth`
2498                 fi
2499                 ;;
2500         '') xxx=`./loc $file $file $pth`;;
2501         *) xxx=`./loc $xxx $xxx $pth`;;
2502         esac
2503         eval $file=$xxx$_exe
2504         eval _$file=$xxx
2505         case "$xxx" in
2506         /*)
2507                 echo $file is in $xxx.
2508                 ;;
2509         ?:[\\/]*)
2510                 echo $file is in $xxx.
2511                 ;;
2512         *)
2513                 echo "I don't see $file out there, $say."
2514                 say=either
2515                 ;;
2516         esac
2517 done
2518 case "$egrep" in
2519 egrep)
2520         echo "Substituting grep for egrep."
2521         egrep=$grep
2522         _egrep=$grep
2523         ;;
2524 esac
2525 case "$less" in
2526 '')     ;;
2527 *)      if $less -R </dev/null >/dev/null; then
2528                echo "Substituting less -R for less."
2529                less="$less -R"
2530                _less=$less
2531         fi
2532         ;;
2533 esac
2534 case "$ln" in
2535 ln)
2536         echo "Substituting cp for ln."
2537         ln=$cp
2538         _ln=$cp
2539         ;;
2540 esac
2541 case "$make" in
2542 make)
2543         case "$gmake" in
2544         gmake)
2545         echo "I can't find make or gmake, and my life depends on it." >&4
2546         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2547         exit 1
2548         ;;
2549         esac
2550         ;;
2551 esac
2552 case "$gmake" in
2553 gmake)  ;;
2554 *)      # We can't have osname yet.
2555         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2556                 # Assume that gmake, if found, is definitely GNU make
2557                 # and prefer it over the system make.
2558                 echo "Substituting gmake for make."
2559                 make=$gmake
2560                 _make=$gmake
2561         fi
2562         ;;
2563 esac
2564 case "$test" in
2565 test)
2566         echo "Hopefully test is built into your sh."
2567         ;;
2568 *)
2569         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2570                 echo "Using the test built into your sh."
2571                 test=test
2572                 _test=test
2573         fi
2574         ;;
2575 esac
2576 case "$echo" in
2577 echo)
2578         echo "Hopefully echo is built into your sh."
2579         ;;
2580 '') ;;
2581 *)
2582         echo " "
2583 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2584         $echo $n "hi there$c" >foo1
2585         echo $n "hi there$c" >foo2
2586         if cmp foo1 foo2 >/dev/null 2>&1; then
2587                 echo "They are compatible.  In fact, they may be identical."
2588         else
2589                 case "$n" in
2590                 '-n') n='' c='\c';;
2591                 *) n='-n' c='';;
2592                 esac
2593                 cat <<FOO
2594 They are not compatible!  You are probably running ksh on a non-USG system.
2595 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2596 have echo built in and we may have to run some Bourne shell scripts.  That
2597 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2598
2599 FOO
2600                 $echo $n "The star should be here-->$c"
2601                 $echo "*"
2602         fi
2603         $rm -f foo1 foo2
2604         ;;
2605 esac
2606
2607 # This question was auctioned at YAPC::Europe-2007 in Vienna
2608 # I never promised you could answer it. I only auctioned the question.
2609 cat <<FOO
2610 The following message is sponsored by
2611
2612   Dresden.pm<--The stars should be here.
2613
2614 Dear Perl user, system administrator or package
2615 maintainer, the Perl community sends greetings to
2616 you. Do you (emblematical) greet back [Y/n]? n
2617
2618 FOO
2619
2620 : Check what type of C compiler we use
2621 cat <<EOS >trygcc
2622 $startsh
2623 EOS
2624 cat <<'EOSC' >>trygcc
2625 case "$cc" in
2626 '') ;;
2627 *)  $rm -f try try.*
2628     $cat >try.c <<EOM
2629 int main(int argc, char *argv[]) {
2630   return 0;
2631 }
2632 EOM
2633     if $cc -o try $ccflags $ldflags try.c; then
2634        :
2635     else
2636         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2637         despair=yes
2638         trygcc=yes
2639         case "$cc" in
2640         *gcc*) trygcc=no ;;
2641         esac
2642         # Skip this test because it gives a false match on output like:
2643         #    ./trygcc: line 23: cc: command not found
2644         # case "`$cc -v -c try.c 2>&1`" in
2645         # *gcc*) trygcc=no ;;
2646         # esac
2647         if $test X"$trygcc" = Xyes; then
2648             if gcc -o try -c try.c; then
2649                 echo " "
2650                 echo "You seem to have a working gcc, though." >&4
2651                 # Switching compilers may undo the work of hints files.
2652                 # The most common problem is -D_REENTRANT for threads.
2653                 # This heuristic catches that case, but gets false positives
2654                 # if -Dusethreads was not actually specified.  Better to
2655                 # bail out here with a useful message than fail 
2656                 # mysteriously later. Should we perhaps just try to
2657                 # re-invoke Configure -Dcc=gcc config_args ?
2658                 if $test -f usethreads.cbu; then
2659                         $cat >&4 <<EOM 
2660
2661 *** However, any setting of the C compiler flags (e.g. for thread support)
2662 *** will be lost.  It may be necessary for you to restart Configure and
2663 *** add -Dcc=gcc to your Configure command line.
2664
2665 EOM
2666                         rp="Would you like to go ahead and try gcc anyway?"
2667                         dflt=n
2668                 else
2669                         rp="Would you like to use it?"
2670                         dflt=y
2671                 fi
2672                 if $test -f myread; then
2673                     . ./myread
2674                 else
2675                     if $test -f UU/myread; then
2676                         . ./UU/myread
2677                     else
2678                         echo "Cannot find myread, sorry.  Aborting." >&2
2679                         exit 1
2680                     fi
2681                 fi  
2682                 case "$ans" in
2683                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2684                 esac
2685             fi
2686         fi
2687     fi
2688     $rm -f try try.*
2689     ;;
2690 esac
2691 EOSC
2692
2693 cat <<EOS >checkcc
2694 $startsh
2695 EOS
2696 cat <<'EOSC' >>checkcc
2697 case "$cc" in        
2698 '') ;;
2699 *)  $rm -f try try.*              
2700     $cat >try.c <<EOM
2701 int main(int argc, char *argv[]) {
2702   return 0;
2703 }
2704 EOM
2705     if $cc -o try $ccflags $ldflags try.c; then
2706        :
2707     else
2708         if $test X"$despair" = Xyes; then
2709            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2710         fi
2711         $cat >&4 <<EOM         
2712 You need to find a working C compiler.
2713 Either (purchase and) install the C compiler supplied by your OS vendor,
2714 or for a free C compiler try http://gcc.gnu.org/
2715 I cannot continue any further, aborting.
2716 EOM
2717         exit 1
2718     fi
2719     $rm -f try try.*
2720     ;;
2721 esac
2722 EOSC
2723
2724 : determine whether symbolic links are supported
2725 echo " "
2726 $touch blurfl
2727 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2728         echo "Symbolic links are supported." >&4
2729         lns="$ln -s"
2730 else
2731         echo "Symbolic links are NOT supported." >&4
2732         lns="$ln"
2733 fi
2734 $rm -f blurfl sym
2735
2736 : determine whether symbolic links are supported
2737 echo " "
2738 case "$lns" in
2739 *"ln"*" -s")
2740         echo "Checking how to test for symbolic links..." >&4
2741         $lns blurfl sym
2742         if $test "X$issymlink" = X; then
2743                 case "$newsh" in
2744                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2745                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2746                 esac
2747                 if test $? = 0; then
2748                         issymlink="test -h"
2749                 else
2750                         echo "Your builtin 'test -h' may be broken." >&4
2751                         case "$test" in
2752                         /*)     ;;
2753                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2754                                 for p in $pth
2755                                 do
2756                                         if test -f "$p/$test"; then
2757                                                 test="$p/$test"
2758                                                 break
2759                                         fi
2760                                 done
2761                                 ;;
2762                         esac
2763                         case "$test" in
2764                         /*)
2765                                 echo "Trying external '$test -h'." >&4
2766                                 issymlink="$test -h"
2767                                 if $test ! -h sym >/dev/null 2>&1; then
2768                                         echo "External '$test -h' is broken, too." >&4
2769                                         issymlink=''
2770                                 fi
2771                                 ;;
2772                         *)      issymlink='' ;;
2773                         esac
2774                 fi
2775         fi
2776         if $test "X$issymlink" = X; then
2777                 if $test -L sym 2>/dev/null; then
2778                         issymlink="$test -L"
2779                         echo "The builtin '$test -L' worked." >&4
2780                 fi
2781         fi
2782         if $test "X$issymlink" != X; then
2783                 echo "You can test for symbolic links with '$issymlink'." >&4
2784         else
2785                 echo "I do not know how you can test for symbolic links." >&4
2786         fi
2787         $rm -f blurfl sym
2788         ;;
2789 *)      echo "No symbolic links, so not testing for their testing..." >&4
2790         ;;
2791 esac
2792 echo " "
2793
2794 : Make symlinks util
2795 case "$mksymlinks" in
2796 $define|true|[yY]*)
2797         case "$src" in
2798         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2799                 exit 1
2800                 ;;
2801         *)      case "$lns:$issymlink" in
2802                 *"ln"*" -s:"*"test -"?)
2803                         echo "Creating the symbolic links..." >&4
2804                         echo "(First creating the subdirectories...)" >&4
2805                         cd ..
2806                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2807                                 read directory
2808                                 test -z "$directory" && break
2809                                 mkdir -p $directory
2810                         done
2811                         # Sanity check 1.
2812                         if test ! -d t/base; then
2813                                 echo "Failed to create the subdirectories.  Aborting." >&4
2814                                 exit 1
2815                         fi
2816                         echo "(Then creating the symlinks...)" >&4
2817                         awk '{print $1}' $src/MANIFEST | while true; do
2818                                 read filename
2819                                 test -z "$filename" && break
2820                                 if test -f $filename; then
2821                                         if $issymlink $filename; then
2822                                                 rm -f $filename
2823                                         fi
2824                                 fi
2825                                 if test -f $filename; then
2826                                         echo "$filename already exists, not symlinking."
2827                                 else
2828                                         ln -s $src/$filename $filename
2829                                 fi
2830                         done
2831                         # Sanity check 2.
2832                         if test ! -f t/base/lex.t; then
2833                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2834                                 exit 1
2835                         fi
2836                         cd UU
2837                         ;;
2838                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2839                         ;;
2840                 esac
2841                 ;;
2842         esac
2843         ;;
2844 esac
2845
2846 : Check for Cross-Compilation
2847 if $test "X$targethost" = "X"; then
2848     targethost=""
2849 fi
2850 if $test "X$targetenv" = "X"; then
2851     targetenv=""
2852 fi
2853 case "$usecrosscompile" in
2854 $define|true|[yY]*)
2855         $echo "Cross-compiling..."
2856         croak=''
2857         case "$cc" in
2858         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2859             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2860             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2861             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2862             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2863             # leave out ld, choosing it is more complex
2864             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2865             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2866             # We are in a weird spot. Just before us, some values
2867             # were 'saved', to be restored after the hints are
2868             # run.  This means that the changes we made to ar,
2869             # nm and ranlib will get reverted.
2870             # To avoid that, we hijack the saving mechanism and
2871             # have it save our new values.
2872             for file in ar nm ranlib; do
2873                 eval xxx=\$$file
2874                 eval $file=$xxx$_exe
2875                 eval _$file=$xxx
2876             done
2877         ;;
2878         esac
2879         case "$targetarch" in
2880         '') echo "Targetarch not defined." >&4; croak=y ;;
2881         *)  echo "Using targetarch $targetarch." >&4 ;;
2882         esac
2883         case "$targethost" in
2884         '') echo "Targethost not defined." >&4; croak=y ;;
2885         *)  echo "Using targethost $targethost." >&4
2886         esac
2887         locincpth=' '
2888         loclibpth=' '
2889         case "$croak" in
2890         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2891         esac
2892     : compile a host miniperl and generate_uudmap, unless we got passed them
2893     if $test "X$hostperl" = X; then
2894       echo "Building host miniperl and generate_uudmap binaries" >&4
2895       before_host=`pwd`
2896       cd ..
2897       cd $src
2898       src=`pwd`
2899       rm -rf $src/host
2900       mkdir $src/host
2901       cd $src/host
2902       $src/Configure -des -Dusedevel -Dmksymlinks
2903       $make miniperl
2904       case "$hostgenerate" in
2905       '') $make generate_uudmap
2906           hostgenerate=$src/host/generate_uudmap
2907           ;;
2908        "$undef") hostgenerate=''
2909           ;;
2910       esac
2911       hostperl=$src/host/miniperl
2912       cd $before_host
2913     fi
2914     hostosname=`$hostperl -le 'print $^O'`
2915     ;;
2916 *)
2917     usecrosscompile="$undef"
2918     ;;
2919 esac
2920
2921 : Define -Dtargethost=somecomputer to run compiled tests on another machine
2922 case "$targethost" in
2923     '') echo "Checking for cross-compile" >&4
2924     case "$usecrosscompile$multiarch" in
2925        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
2926          if [ -f Makefile ]; then
2927            echo " "
2928            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
2929          else
2930            echo "Configure done."
2931          fi
2932        exit 0
2933        ;;
2934      *) echo "No targethost for running compiler tests against defined, running locally" >&4
2935         run=''
2936         to=:
2937         from=:
2938         ;;
2939     esac
2940     ;;
2941     *) echo "Using targethost $targethost." >&4
2942         case "$src" in
2943         /*) run=$src/Cross/run
2944             targetmkdir=$src/Cross/mkdir
2945             to=$src/Cross/to
2946             from=$src/Cross/from
2947             ;;
2948         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2949             run=$pwd/Cross/run
2950             targetmkdir=$pwd/Cross/mkdir
2951             to=$pwd/Cross/to
2952             from=$pwd/Cross/from
2953             ;;
2954         esac
2955         case "$targetrun" in
2956         '') targetrun=ssh ;;
2957         esac
2958         case "$targetto" in
2959         '') targetto=scp ;;
2960         esac
2961         case "$targetfrom" in
2962         '') targetfrom=scp ;;
2963         esac
2964         run=$run-$targetrun
2965         to=$to-$targetto
2966         from=$from-$targetfrom
2967         case "$targetdir" in
2968         '')  targetdir=/tmp
2969              echo "Guessing targetdir $targetdir." >&4
2970              ;;
2971         esac
2972         case "$targetuser" in
2973         '')  targetuser=root
2974              echo "Guessing targetuser $targetuser." >&4
2975              ;;
2976         esac
2977         case "$targetport" in
2978         '')  targetport=22
2979              echo "Guessing targetport $targetport." >&4
2980              ;;
2981         esac
2982         case "$targetfrom" in
2983         scp)    q=-q ;;
2984         *)      q='' ;;
2985         esac
2986         case "$targetrun" in
2987         ssh|rsh)
2988             cat >$run <<EOF
2989 #!/bin/sh
2990 env=''
2991 case "\$1" in
2992 -cwd)
2993   shift
2994   cwd=\$1
2995   shift
2996   ;;
2997 esac
2998 case "\$1" in
2999 -env)
3000   shift
3001   env=\$1
3002   shift
3003   ;;
3004 esac
3005 case "\$cwd" in
3006 '') cwd=$targetdir ;;
3007 esac
3008 exe=\$1
3009 shift
3010 $to \$exe
3011 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3012 EOF
3013             ;;
3014         adb)
3015             $touch $run
3016             ;;
3017         *)  echo "Unknown targetrun '$targetrun'" >&4
3018             exit 1
3019             ;;
3020         esac
3021         case "$targetmkdir" in
3022         */Cross/mkdir)
3023             cat >$targetmkdir <<EOF
3024 #!/bin/sh
3025 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3026 EOF
3027             $chmod a+rx $targetmkdir
3028             ;;
3029         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3030             exit 1
3031             ;;
3032         esac
3033         case "$targetto" in
3034         scp|rcp)
3035             cat >$to <<EOF
3036 #!/bin/sh
3037 for f in \$@
3038 do
3039   case "\$f" in
3040   /*)
3041     $targetmkdir \`dirname \$f\`
3042     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3043     ;;
3044   *)
3045     $targetmkdir $targetdir/\`dirname \$f\`
3046     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3047     ;;
3048   esac
3049 done
3050 exit 0
3051 EOF
3052             ;;
3053         cp) cat >$to <<EOF
3054 #!/bin/sh
3055 for f in \$@
3056 do
3057   case "\$f" in
3058   /*)
3059     $mkdir -p $targetdir/\`dirname \$f\`
3060     $cp \$f $targetdir/\$f || exit 1
3061     ;;
3062   *)
3063     $targetmkdir $targetdir/\`dirname \$f\`
3064     $cp \$f $targetdir/\$f || exit 1
3065     ;;
3066   esac
3067 done
3068 exit 0
3069 EOF
3070             ;;
3071         *)  echo "Unknown targetto '$targetto'" >&4
3072             exit 1
3073             ;;
3074         esac
3075         case "$targetfrom" in
3076         scp|rcp)
3077           cat >$from <<EOF
3078 #!/bin/sh
3079 for f in \$@
3080 do
3081   $rm -f \$f
3082   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3083 done
3084 exit 0
3085 EOF
3086             ;;
3087         cp) cat >$from <<EOF
3088 #!/bin/sh
3089 for f in \$@
3090 do
3091   $rm -f \$f
3092   cp $targetdir/\$f . || exit 1
3093 done
3094 exit 0
3095 EOF
3096             ;;
3097         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3098             exit 1
3099             ;;
3100         esac
3101         if $test ! -f $run; then
3102             echo "Target 'run' script '$run' not found." >&4
3103         else
3104             $chmod a+rx $run
3105         fi
3106         if $test ! -f $to; then
3107             echo "Target 'to' script '$to' not found." >&4
3108         else
3109             $chmod a+rx $to
3110         fi
3111         if $test ! -f $from; then
3112             echo "Target 'from' script '$from' not found." >&4
3113         else
3114             $chmod a+rx $from
3115         fi
3116         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3117             exit 1
3118         fi
3119         cat >&4 <<EOF
3120 Using '$run' for remote execution,
3121 and '$from' and '$to'
3122 for remote file transfer.
3123 EOF
3124         ;;
3125 *)      run=''
3126         to=:
3127         from=:
3128         usecrosscompile="$undef"
3129         targetarch=''
3130         ;;
3131 esac
3132
3133 : see whether [:lower:] and [:upper:] are supported character classes
3134 echo " "
3135 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3136 ABYZ)
3137         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3138         up='[:upper:]'
3139         low='[:lower:]'
3140         ;;
3141 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3142         # (0xd9 and 0xe2), therefore that is a nice testing point.
3143         if test "X$up" = X -o "X$low" = X; then
3144             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3145             rs) up='[A-Z]'
3146                 low='[a-z]'
3147                 ;;
3148             esac
3149         fi
3150         if test "X$up" = X -o "X$low" = X; then
3151             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3152             rs) up='A-Z'
3153                 low='a-z'
3154                 ;;
3155             esac
3156         fi
3157         if test "X$up" = X -o "X$low" = X; then
3158             case "`echo RS | od -x 2>/dev/null`" in
3159             *D9E2*|*d9e2*)
3160                 echo "Hey, this might be EBCDIC." >&4
3161                 if test "X$up" = X -o "X$low" = X; then
3162                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3163                     rs) up='[A-IJ-RS-Z]'
3164                         low='[a-ij-rs-z]'
3165                         ;;
3166                     esac
3167                 fi
3168                 if test "X$up" = X -o "X$low" = X; then
3169                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3170                     rs) up='A-IJ-RS-Z'
3171                         low='a-ij-rs-z'
3172                         ;;
3173                     esac
3174                 fi
3175                 ;;
3176             esac
3177         fi
3178 esac
3179 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3180 rs)
3181     echo "Using $up and $low to convert case." >&4
3182     ;;
3183 *)
3184     echo "I don't know how to translate letters from upper to lower case." >&4
3185     echo "Your tr is not acting any way I know of." >&4
3186     exit 1
3187     ;;
3188 esac
3189 : set up the translation script tr, must be called with ./tr of course
3190 cat >tr <<EOSC
3191 $startsh
3192 case "\$1\$2" in
3193 '[A-Z][a-z]') exec $tr '$up' '$low';;
3194 '[a-z][A-Z]') exec $tr '$low' '$up';;
3195 esac
3196 exec $tr "\$@"
3197 EOSC
3198 chmod +x tr
3199 $eunicefix tr
3200
3201 : Try to determine whether config.sh was made on this system
3202 case "$config_sh" in
3203 '')
3204 myuname=`$uname -a 2>/dev/null`
3205 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3206 # Downcase everything to avoid ambiguity.
3207 # Remove slashes and single quotes so we can use parts of this in
3208 # directory and file names.
3209 # Remove newlines so myuname is sane to use elsewhere.
3210 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3211 # because the A-Z/a-z are not consecutive.
3212 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3213         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3214 newmyuname="$myuname"
3215 dflt=n
3216 case "$knowitall" in
3217 '')
3218         if test -f ../config.sh; then
3219                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3220                         eval "`grep myuname= ../config.sh`"
3221                 fi
3222                 if test "X$myuname" = "X$newmyuname"; then
3223                         dflt=y
3224                 fi
3225         fi
3226         ;;
3227 *) dflt=y;;
3228 esac
3229
3230 : Get old answers from old config file if Configure was run on the
3231 : same system, otherwise use the hints.
3232 hint=default
3233 cd ..
3234 if test -f config.sh; then
3235         echo " "
3236         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3237         . UU/myread
3238         case "$ans" in
3239         n*|N*) echo "OK, I'll ignore it."
3240                 mv config.sh config.sh.old
3241                 myuname="$newmyuname"
3242                 ;;
3243         *)  echo "Fetching default answers from your old config.sh file..." >&4
3244                 tmp_n="$n"
3245                 tmp_c="$c"
3246                 tmp_sh="$sh"
3247                 . ./config.sh
3248                 cp config.sh UU
3249                 n="$tmp_n"
3250                 c="$tmp_c"
3251                 : Older versions did not always set $sh.  Catch re-use of such
3252                 : an old config.sh.
3253                 case "$sh" in
3254                 '') sh="$tmp_sh" ;;
3255                 esac
3256                 hint=previous
3257                 ;;
3258         esac
3259 fi
3260 . ./UU/checkcc
3261 if test ! -f config.sh; then
3262         $cat <<EOM
3263
3264 First time through, eh?  I have some defaults handy for some systems
3265 that need some extra help getting the Configure answers right:
3266
3267 EOM
3268         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3269         dflt=''
3270         : Half the following guesses are probably wrong... If you have better
3271         : tests or hints, please send them to perlbug@perl.org
3272         : The metaconfig authors would also appreciate a copy...
3273         $test -f /irix && osname=irix
3274         $test -f /xenix && osname=sco_xenix
3275         $test -f /dynix && osname=dynix
3276         $test -f /dnix && osname=dnix
3277         $test -f /lynx.os && osname=lynxos
3278         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3279         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3280         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3281         $test -f /bin/mips && /bin/mips && osname=mips
3282         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3283                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3284         $test -d /usr/apollo/bin && osname=apollo
3285         $test -f /etc/saf/_sactab && osname=svr4
3286         $test -d /usr/include/minix && osname=minix
3287         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3288         if $test -d /MachTen -o -d /MachTen_Folder; then
3289                 osname=machten
3290                 if $test -x /sbin/version; then
3291                         osvers=`/sbin/version | $awk '{print $2}' |
3292                         $sed -e 's/[A-Za-z]$//'`
3293                 elif $test -x /usr/etc/version; then
3294                         osvers=`/usr/etc/version | $awk '{print $2}' |
3295                         $sed -e 's/[A-Za-z]$//'`
3296                 else
3297                         osvers="$2.$3"
3298                 fi
3299         fi
3300
3301         $test -f /sys/posix.dll &&
3302                 $test -f /usr/bin/what &&
3303                 set X `/usr/bin/what /sys/posix.dll` &&
3304                 $test "$3" = UWIN &&
3305                 osname=uwin &&
3306                 osvers="$5"
3307
3308         if $test -f $uname; then
3309                 set X $myuname
3310                 shift
3311
3312                 case "$5" in
3313                 fps*) osname=fps ;;
3314                 mips*)
3315                         case "$4" in
3316                         umips) osname=umips ;;
3317                         *) osname=mips ;;
3318                         esac;;
3319                 [23]100) osname=mips ;;
3320                 next*) osname=next ;;
3321                 i386*)
3322                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3323                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3324                                 osname='sco'
3325                                 osvers=$tmp
3326                         elif $test -f /etc/kconfig; then
3327                                 osname=isc
3328                                 if test "$lns" = "$ln -s"; then
3329                                         osvers=4
3330                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3331                                         osvers=3
3332                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3333                                         osvers=2
3334                                 fi
3335                         fi
3336                         tmp=''
3337                         ;;
3338                 pc*)
3339                         if test -n "$DJGPP"; then
3340                                 osname=dos
3341                                 osvers=djgpp
3342                         fi
3343                         ;;
3344                 esac
3345
3346                 case "$1" in
3347                 aix) osname=aix
3348                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3349                         case "$tmp" in
3350                         # oslevel can fail with:
3351                         # oslevel: Unable to acquire lock.
3352                         *not\ found) osvers="$4"."$3" ;;
3353                         '<3240'|'<>3240') osvers=3.2.0 ;;
3354                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3355                         '=3250'|'>3250') osvers=3.2.5 ;;
3356                         *) osvers=$tmp;;
3357                         esac
3358                         ;;
3359                 bitrig) osname=bitrig
3360                         osvers="$3"
3361                         ;;
3362                 bsd386) osname=bsd386
3363                         osvers=`$uname -r`
3364                         ;;
3365                 cygwin*) osname=cygwin
3366                         osvers="$3"
3367                         ;;
3368                 *dc.osx) osname=dcosx
3369                         osvers="$3"
3370                         ;;
3371                 dnix) osname=dnix
3372                         osvers="$3"
3373                         ;;
3374                 domainos) osname=apollo
3375                         osvers="$3"
3376                         ;;
3377                 dgux)   osname=dgux
3378                         osvers="$3"
3379                         ;;
3380                 dragonfly) osname=dragonfly
3381                         osvers="$3"
3382                         ;;
3383                 dynixptx*) osname=dynixptx
3384                         osvers=`echo "$4"|sed 's/^v//'`
3385                         ;;
3386                 freebsd) osname=freebsd
3387                         osvers="$3" ;;
3388                 genix)  osname=genix ;;
3389                 gnu)    osname=gnu
3390                         osvers="$3" ;;
3391                 hp*)    osname=hpux
3392                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3393                         ;;
3394                 irix*)  osname=irix
3395                         case "$3" in
3396                         4*) osvers=4 ;;
3397                         5*) osvers=5 ;;
3398                         *)      osvers="$3" ;;
3399                         esac
3400                         ;;
3401                 linux)  osname=linux
3402                         case "$3" in
3403                         *)      osvers="$3" ;;
3404                         esac
3405                         $test -f /system/lib/libandroid.so && osname=linux-android
3406                         ;;
3407                 MiNT)   osname=mint
3408                         ;;
3409                 netbsd*) osname=netbsd
3410                         osvers="$3"
3411                         ;;
3412                 news-os) osvers="$3"
3413                         case "$3" in
3414                         4*) osname=newsos4 ;;
3415                         *) osname=newsos ;;
3416                         esac
3417                         ;;
3418                 next*) osname=next ;;
3419                 nonstop-ux) osname=nonstopux ;;
3420                 openbsd) osname=openbsd
3421                         osvers="$3"
3422                         ;;
3423                 os2)    osname=os2
3424                         osvers="$4"
3425                         ;;
3426                 POSIX-BC | posix-bc ) osname=posix-bc
3427                         osvers="$3"
3428                         ;;
3429                 powerux | power_ux | powermax_os | powermaxos | \
3430                 powerunix | power_unix) osname=powerux
3431                         osvers="$3"
3432                         ;;
3433                 qnx) osname=qnx
3434                         osvers="$4"
3435                         ;;
3436                 solaris) osname=solaris
3437                         case "$3" in
3438                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3439                         *)      osvers="$3" ;;
3440                         esac
3441                         ;;
3442                 sunos) osname=sunos
3443                         case "$3" in
3444                         5*) osname=solaris
3445                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3446                         *)      osvers="$3" ;;
3447                         esac
3448                         ;;
3449                 titanos) osname=titanos
3450                         case "$3" in
3451                         1*) osvers=1 ;;
3452                         2*) osvers=2 ;;
3453                         3*) osvers=3 ;;
3454                         4*) osvers=4 ;;
3455                         *)      osvers="$3" ;;
3456                         esac
3457                         ;;
3458                 ultrix) osname=ultrix
3459                         osvers="$3"
3460                         ;;
3461                 osf1|mls+)      case "$5" in
3462                                 alpha)
3463                                         osname=dec_osf
3464                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3465                                         case "$osvers" in
3466                                         [1-9].[0-9]*) ;;
3467                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3468                                         esac
3469                                         ;;
3470                         hp*)    osname=hp_osf1  ;;
3471                         mips)   osname=mips_osf1 ;;
3472                         esac
3473                         ;;
3474                 # UnixWare 7.1.2 is known as Open UNIX 8
3475                 openunix|unixware) osname=svr5
3476                         osvers="$4"
3477                         ;;
3478                 uts)    osname=uts
3479                         osvers="$3"
3480                         ;;
3481                 vos) osvers="$3"
3482                         ;;
3483                 $2) case "$osname" in
3484                         *isc*) ;;
3485                         *freebsd*) ;;
3486                         svr*)
3487                                 : svr4.x or possibly later
3488                                 case "svr$3" in
3489                                 ${osname}*)
3490                                         osname=svr$3
3491                                         osvers=$4
3492                                         ;;
3493                                 esac
3494                                 case "$osname" in
3495                                 svr4.0)
3496                                         : Check for ESIX
3497                                         if test -f /stand/boot ; then
3498                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3499                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3500                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3501                                                         if test -n "$isesix"; then
3502                                                                 osname=esix4
3503                                                         fi
3504                                                 fi
3505                                         fi
3506                                         ;;
3507                                 esac
3508                                 ;;
3509                         *)      if test -f /etc/systemid; then
3510                                         osname=sco
3511                                         set `echo $3 | $sed 's/\./ /g'` $4
3512                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3513                                                 osvers=$1.$2.$3
3514                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3515                                                 osvers=$1.$2
3516                                         elif $test -f $src/hints/sco_$1.sh; then
3517                                                 osvers=$1
3518                                         fi
3519                                 else
3520                                         case "$osname" in
3521                                         '') : Still unknown.  Probably a generic Sys V.
3522                                                 osname="sysv"
3523                                                 osvers="$3"
3524                                                 ;;
3525                                         esac
3526                                 fi
3527                                 ;;
3528                         esac
3529                         ;;
3530                 *)      case "$osname" in
3531                         '') : Still unknown.  Probably a generic BSD.
3532                                 osname="$1"
3533                                 osvers="$3"
3534                                 ;;
3535                         esac
3536                         ;;
3537                 esac
3538         else
3539                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3540                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3541                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3542                                 osname=news_os
3543                         fi
3544                         $rm -f UU/kernel.what
3545                 elif test -d c:/. -o -n "$is_os2" ; then
3546                         set X $myuname
3547                         osname=os2
3548                         osvers="$5"
3549                 fi
3550         fi
3551
3552         case "$targetarch" in
3553         '') ;;
3554         *)  hostarch=$osname
3555             case "$targetarch" in
3556                 nto*|*-nto-*)
3557                     # Will load qnx.sh, which should change osname to nto
3558                     osname=qnx
3559                     osvers=''
3560                     ;;
3561                 *linux-android*)
3562                     # Catch arm-linux-androideabi, mipsel-linux-android,
3563                     # and i686-linux-android
3564                     osname=linux-android
3565                     osvers=''
3566                     ;;
3567                 *linux*)
3568                     # Something like arm-linux-gnueabihf is really just
3569                     # plain linux.
3570                     osname=linux
3571                     osvers=''
3572                     ;;
3573                 *solaris*|*sunos*)
3574                     osname=solaris
3575                     # XXX perhaps we should just assume
3576                     # osvers to be 2, or maybe take the value
3577                     # from targetarch. Using $run before the
3578                     # hints are run is somewhat icky.
3579                     set X `$run $uname -a 2>/dev/null`
3580                     shift
3581                     case "$3" in
3582                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3583                         *)  osvers="$3" ;;
3584                     esac
3585                     ;;
3586                 *)
3587                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3588                     osvers=''
3589                 ;;
3590             esac
3591             ;;
3592         esac
3593
3594         : Now look for a hint file osname_osvers, unless one has been
3595         : specified already.
3596         case "$hintfile" in
3597         ''|' ')
3598                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3599                 : Also try without trailing minor version numbers.
3600                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3601                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3602                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3603                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3604                 case "$file" in
3605                 '') dflt=none ;;
3606                 *)  case "$osvers" in
3607                         '') dflt=$file
3608                                 ;;
3609                         *)  if $test -f $src/hints/$file.sh ; then
3610                                         dflt=$file
3611                                 elif $test -f $src/hints/$xfile.sh ; then
3612                                         dflt=$xfile
3613                                 elif $test -f $src/hints/$xxfile.sh ; then
3614                                         dflt=$xxfile
3615                                 elif $test -f $src/hints/$xxxfile.sh ; then
3616                                         dflt=$xxxfile
3617                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3618                                         dflt=$xxxxfile
3619                                 elif $test -f "$src/hints/${osname}.sh" ; then
3620                                         dflt="${osname}"
3621                                 else
3622                                         dflt=none
3623                                 fi
3624                                 ;;
3625                         esac
3626                         ;;
3627                 esac
3628                 if $test -f Policy.sh ; then
3629                         case "$dflt" in
3630                         *Policy*) ;;
3631                         none) dflt="Policy" ;;
3632                         *) dflt="Policy $dflt" ;;
3633                         esac
3634                 fi
3635                 ;;
3636         *)
3637                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3638                 ;;
3639         esac
3640
3641         if $test -f Policy.sh ; then
3642                 $cat <<EOM
3643
3644 There's also a Policy hint file available, which should make the
3645 site-specific (policy) questions easier to answer.
3646 EOM
3647
3648         fi
3649
3650         $cat <<EOM
3651
3652 You may give one or more space-separated answers, or "none" if appropriate.
3653 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3654 previous run of Configure, you may specify it as well as or instead of
3655 OS-specific hints.  If hints are provided for your OS, you should use them:
3656 although Perl can probably be built without hints on many platforms, using
3657 hints often improve performance and may enable features that Configure can't
3658 set up on its own. If there are no hints that match your OS, specify "none";
3659 DO NOT give a wrong version or a wrong OS.
3660
3661 EOM
3662
3663         rp="Which of these apply, if any?"
3664         . UU/myread
3665         tans=$ans
3666         for file in $tans; do
3667                 if $test X$file = XPolicy -a -f Policy.sh; then
3668                         . Policy.sh
3669                         $cat Policy.sh >> UU/config.sh
3670                 elif $test -f $src/hints/$file.sh; then
3671                         . $src/hints/$file.sh
3672                         $cat $src/hints/$file.sh >> UU/config.sh
3673                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3674                         : nothing
3675                 else
3676                         : Give one chance to correct a possible typo.
3677                         echo "$file.sh does not exist"
3678                         dflt=$file
3679                         rp="hint to use instead?"
3680                         . UU/myread
3681                         for file in $ans; do
3682                                 if $test -f "$src/hints/$file.sh"; then
3683                                         . $src/hints/$file.sh
3684                                         $cat $src/hints/$file.sh >> UU/config.sh
3685                                 elif $test X$ans = X -o X$ans = Xnone ; then
3686                                         : nothing
3687                                 else
3688                                         echo "$file.sh does not exist -- ignored."
3689                                 fi
3690                         done
3691                 fi
3692         done
3693
3694         hint=recommended
3695         : Remember our hint file for later.
3696         if $test -f "$src/hints/$file.sh" ; then
3697                 hintfile="$file"
3698         else
3699                 hintfile=''
3700         fi
3701 fi
3702 cd UU
3703 ;;
3704 *)
3705         echo " "
3706         echo "Fetching default answers from $config_sh..." >&4
3707         tmp_n="$n"
3708         tmp_c="$c"
3709         cd ..
3710         cp $config_sh config.sh 2>/dev/null
3711         chmod +w config.sh
3712         . ./config.sh
3713         cd UU
3714         cp ../config.sh .
3715         n="$tmp_n"
3716         c="$tmp_c"
3717         hint=previous
3718         ;;
3719 esac
3720 test "$override" && . ./optdef.sh
3721
3722 : Restore computed paths
3723 for file in $loclist $trylist; do
3724         eval $file="\$_$file"
3725 done
3726
3727 cat << EOM
3728
3729 Configure uses the operating system name and version to set some defaults.
3730 The default value is probably right if the name rings a bell. Otherwise,
3731 since spelling matters for me, either accept the default or answer "none"
3732 to leave it blank.
3733
3734 EOM
3735 case "$osname" in
3736         ''|' ')
3737                 case "$hintfile" in
3738                 ''|' '|none) dflt=none ;;
3739                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3740                 esac
3741                 ;;
3742         *) dflt="$osname" ;;
3743 esac
3744 rp="Operating system name?"
3745 . ./myread
3746 case "$ans" in
3747 none)  osname='' ;;
3748 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3749 esac
3750 echo " "
3751 case "$osvers" in
3752         ''|' ')
3753                 case "$hintfile" in
3754                 ''|' '|none) dflt=none ;;
3755                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3756                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3757                         case "$dflt" in
3758                         ''|' ') dflt=none ;;
3759                         esac
3760                         ;;
3761                 esac
3762                 ;;
3763         *) dflt="$osvers" ;;
3764 esac
3765 rp="Operating system version?"
3766 . ./myread
3767 case "$ans" in
3768 none)  osvers='' ;;
3769 *) osvers="$ans" ;;
3770 esac
3771
3772
3773 . ./posthint.sh
3774
3775 : who configured the system
3776 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3777 case "$cf_by" in
3778 "")
3779         cf_by=`(logname) 2>/dev/null`
3780         case "$cf_by" in
3781         "")
3782                 cf_by=`(whoami) 2>/dev/null`
3783                 case "$cf_by" in
3784                 "") cf_by=unknown ;;
3785                 esac ;;
3786         esac ;;
3787 esac
3788
3789 : decide how portable to be.  Allow command line overrides.
3790 case "$d_portable" in
3791 "$undef") ;;
3792 *)      d_portable="$define" ;;
3793 esac
3794
3795 : set up shell script to do ~ expansion
3796 cat >filexp <<EOSS
3797 $startsh
3798 : expand filename
3799 case "\$1" in
3800  \~/*|\~)
3801         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3802         ;;
3803  \~*)
3804         if $test -f /bin/csh; then
3805                 /bin/csh -f -c "glob \$1"
3806                 failed=\$?
3807                 echo ""
3808                 exit \$failed
3809         else
3810                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3811                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3812                 if $test ! -d "\$dir"; then
3813                         me=\`basename \$0\`
3814                         echo "\$me: can't locate home directory for: \$name" >&2
3815                         exit 1
3816                 fi
3817                 case "\$1" in
3818                 */*)
3819                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3820                         ;;
3821                 *)
3822                         echo \$dir
3823                         ;;
3824                 esac
3825         fi
3826         ;;
3827 *)
3828         echo \$1
3829         ;;
3830 esac
3831 EOSS
3832 chmod +x filexp
3833 $eunicefix filexp
3834
3835 : now set up to get a file name
3836 cat <<EOS >getfile
3837 $startsh
3838 EOS
3839 cat <<'EOSC' >>getfile
3840 tilde=''
3841 fullpath=''
3842 already=''
3843 skip=''
3844 none_ok=''
3845 exp_file=''
3846 nopath_ok=''
3847 orig_rp="$rp"
3848 orig_dflt="$dflt"
3849 case "$gfpth" in
3850 '') gfpth='.' ;;
3851 esac
3852
3853 case "$fn" in
3854 *\(*)
3855         : getfile will accept an answer from the comma-separated list
3856         : enclosed in parentheses even if it does not meet other criteria.
3857         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3858         fn=`echo $fn | sed 's/(.*)//'`
3859         ;;
3860 esac
3861
3862 case "$fn" in
3863 *:*)
3864         loc_file=`expr $fn : '.*:\(.*\)'`
3865         fn=`expr $fn : '\(.*\):.*'`
3866         ;;
3867 esac
3868
3869 case "$fn" in
3870 *~*) tilde=true;;
3871 esac
3872 case "$fn" in
3873 */*) fullpath=true;;
3874 esac
3875 case "$fn" in
3876 *+*) skip=true;;
3877 esac
3878 case "$fn" in
3879 *n*) none_ok=true;;
3880 esac
3881 case "$fn" in
3882 *e*) exp_file=true;;
3883 esac
3884 case "$fn" in
3885 *p*) nopath_ok=true;;
3886 esac
3887
3888 case "$fn" in
3889 *f*) type='File';;
3890 *d*) type='Directory';;
3891 *l*) type='Locate';;
3892 esac
3893
3894 what="$type"
3895 case "$what" in
3896 Locate) what='File';;
3897 esac
3898
3899 case "$exp_file" in
3900 '')
3901         case "$d_portable" in
3902         "$define") ;;
3903         *) exp_file=true;;
3904         esac
3905         ;;
3906 esac
3907
3908 cd ..
3909 while test "$type"; do
3910         redo=''
3911         rp="$orig_rp"
3912         dflt="$orig_dflt"
3913         case "$tilde" in
3914         true) rp="$rp (~name ok)";;
3915         esac
3916         . UU/myread
3917         if test -f UU/getfile.ok && \
3918                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3919         then
3920                 value="$ans"
3921                 ansexp="$ans"
3922                 break
3923         fi
3924         case "$ans" in
3925         none)
3926                 value=''
3927                 ansexp=''
3928                 case "$none_ok" in
3929                 true) type='';;
3930                 esac
3931                 ;;
3932         *)
3933                 case "$tilde" in
3934                 '') value="$ans"
3935                         ansexp="$ans";;
3936                 *)
3937                         value=`UU/filexp $ans`
3938                         case $? in
3939                         0)
3940                                 if test "$ans" != "$value"; then
3941                                         echo "(That expands to $value on this system.)"
3942                                 fi
3943                                 ;;
3944                         *) value="$ans";;
3945                         esac
3946                         ansexp="$value"
3947                         case "$exp_file" in
3948                         '') value="$ans";;
3949                         esac
3950                         ;;
3951                 esac
3952                 case "$fullpath" in
3953                 true)
3954                         case "$ansexp" in
3955                         /*) value="$ansexp" ;;
3956                         [a-zA-Z]:/*) value="$ansexp" ;;
3957                         *)
3958                                 redo=true
3959                                 case "$already" in
3960                                 true)
3961                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3962                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3963                                         ;;
3964                                 *)
3965                                 echo "Please give a full path name, starting with slash." >&4
3966                                         case "$tilde" in
3967                                         true)
3968                                 echo "Note that using ~name is ok provided it expands well." >&4
3969                                                 already=true
3970                                                 ;;
3971                                         esac
3972                                 esac
3973                                 ;;
3974                         esac
3975                         ;;
3976                 esac
3977                 case "$redo" in
3978                 '')
3979                         case "$type" in
3980                         File)
3981                                 for fp in $gfpth; do
3982                                         if test "X$fp" = X.; then
3983                                             pf="$ansexp"
3984                                         else    
3985                                             pf="$fp/$ansexp"
3986                                         fi
3987                                         if test -f "$pf"; then
3988                                                 type=''
3989                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3990                                         then
3991                                                 echo "($value is not a plain file, but that's ok.)"
3992                                                 type=''
3993                                         fi
3994                                         if test X"$type" = X; then
3995                                             value="$pf"
3996                                             break
3997                                         fi
3998                                 done
3999                                 ;;
4000                         Directory)
4001                                 for fp in $gfpth; do
4002                                         if test "X$fp" = X.; then
4003                                             dir="$ans"
4004                                             direxp="$ansexp"
4005                                         else    
4006                                             dir="$fp/$ansexp"
4007                                             direxp="$fp/$ansexp"
4008                                         fi
4009                                         if test -d "$direxp"; then
4010                                                 type=''
4011                                                 value="$dir"
4012                                                 break
4013                                         fi
4014                                 done
4015                                 ;;
4016                         Locate)
4017                                 if test -d "$ansexp"; then
4018                                         echo "(Looking for $loc_file in directory $value.)"
4019                                         value="$value/$loc_file"
4020                                         ansexp="$ansexp/$loc_file"
4021                                 fi
4022                                 if test -f "$ansexp"; then
4023                                         type=''
4024                                 fi
4025                                 case "$nopath_ok" in
4026                                 true)   case "$value" in
4027                                         */*) ;;
4028                                         *)      echo "Assuming $value will be in people's path."
4029                                                 type=''
4030                                                 ;;
4031                                         esac
4032                                         ;;
4033                                 esac
4034                                 ;;
4035                         esac
4036
4037                         case "$skip" in
4038                         true) type='';
4039                         esac
4040
4041                         case "$type" in
4042                         '') ;;
4043                         *)
4044                                 if test "$fastread" = yes; then
4045                                         dflt=y
4046                                 else
4047                                         dflt=n
4048                                 fi
4049                                 rp="$what $value doesn't exist.  Use that name anyway?"
4050                                 . UU/myread
4051                                 dflt=''
4052                                 case "$ans" in
4053                                 y*) type='';;
4054                                 *) echo " ";;
4055                                 esac
4056                                 ;;
4057                         esac
4058                         ;;
4059                 esac
4060                 ;;
4061         esac
4062 done
4063 cd UU
4064 ans="$value"
4065 rp="$orig_rp"
4066 dflt="$orig_dflt"
4067 rm -f getfile.ok
4068 test "X$gfpthkeep" != Xy && gfpth=""
4069 EOSC
4070
4071 : determine root of directory hierarchy where package will be installed.
4072 case "$prefix" in
4073 '')
4074         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4075         ;;
4076 *?/)
4077         dflt=`echo "$prefix" | sed 's/.$//'`
4078         ;;
4079 *)
4080         dflt="$prefix"
4081         ;;
4082 esac
4083 $cat <<EOM
4084
4085 By default, $package will be installed in $dflt/bin, manual pages
4086 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4087 installation directories. Typically this is something like /usr/local.
4088 If you wish to have binaries under /usr/bin but other parts of the
4089 installation under /usr/local, that's ok: you will be prompted
4090 separately for each of the installation directories, the prefix being
4091 only used to set the defaults.
4092
4093 EOM
4094 fn=d~
4095 rp='Installation prefix to use?'
4096 . ./getfile
4097 oldprefix=''
4098 case "$prefix" in
4099 '') ;;
4100 *)
4101         case "$ans" in
4102         "$prefix") ;;
4103         *) oldprefix="$prefix";;
4104         esac
4105         ;;
4106 esac
4107 prefix="$ans"
4108 prefixexp="$ansexp"
4109
4110 : allow them to override the AFS root
4111 case "$afsroot" in
4112 '')     afsroot=/afs ;;
4113 *)      afsroot=$afsroot ;;
4114 esac
4115
4116 : is AFS running?
4117 echo " "
4118 case "$afs" in
4119 $define|true)   afs=true ;;
4120 $undef|false)   afs=false ;;
4121 *)      if $test -d $afsroot; then
4122                 afs=true
4123         else
4124                 afs=false
4125         fi
4126         ;;
4127 esac
4128 if $afs; then
4129         echo "AFS may be running... I'll be extra cautious then..." >&4
4130 else
4131         echo "AFS does not seem to be running..." >&4
4132 fi
4133
4134 : determine installation prefix for where package is to be installed.
4135 if $afs; then
4136 $cat <<EOM
4137
4138 Since you are running AFS, I need to distinguish the directory in which
4139 files will reside from the directory in which they are installed (and from
4140 which they are presumably copied to the former directory by occult means).
4141
4142 EOM
4143         case "$installprefix" in
4144         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4145         *) dflt="$installprefix";;
4146         esac
4147 else
4148 $cat <<EOM
4149
4150 In some special cases, particularly when building $package for distribution,
4151 it is convenient to distinguish the directory in which files should be
4152 installed from the directory ($prefix) in which they will
4153 eventually reside.  For most users, these two directories are the same.
4154
4155 EOM
4156         case "$installprefix" in
4157         '') dflt=$prefix ;;
4158         *) dflt=$installprefix;;
4159         esac
4160 fi
4161 fn=d~
4162 rp='What installation prefix should I use for installing files?'
4163 . ./getfile
4164 installprefix="$ans"
4165 installprefixexp="$ansexp"
4166
4167 : Perform the prefixexp/installprefixexp correction if necessary
4168 cat <<EOS >installprefix
4169 $startsh
4170 EOS
4171 cat <<'EOSC' >>installprefix
4172 : Change installation prefix, if necessary.
4173 if $test X"$prefix" != X"$installprefix"; then
4174     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4175 else
4176     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4177 fi
4178 EOSC
4179 chmod +x installprefix
4180 $eunicefix installprefix
4181
4182 : Set variables such as privlib and privlibexp from the output of ./getfile
4183 : performing the prefixexp/installprefixexp correction if necessary.
4184 cat <<EOS >setprefixvar
4185 $startsh
4186 EOS
4187 cat <<'EOSC' >>setprefixvar
4188 eval "${prefixvar}=\"\$ans\""
4189 eval "${prefixvar}exp=\"\$ansexp\""
4190 . ./installprefix
4191 EOSC
4192 chmod +x setprefixvar
4193 $eunicefix setprefixvar
4194
4195 : set up the script used to warn in case of inconsistency
4196 cat <<EOS >whoa
4197 $startsh
4198 EOS
4199 cat <<'EOSC' >>whoa
4200 dflt=y
4201 case "$hint" in
4202     recommended)
4203         case "$hintfile" in
4204         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4205                 ;;
4206         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4207                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4208                 ;;
4209         esac
4210         ;;
4211     *)  echo " "
4212         echo "*** WHOA THERE!!! ***" >&4
4213         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4214         ;;
4215 esac
4216 rp="    Keep the $hint value?"
4217 . ./myread
4218 case "$ans" in
4219 y) td=$was; tu=$was;;
4220 esac
4221 EOSC
4222
4223 : function used to set '$1' to '$val'
4224 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4225 case "$val$was" in
4226 $define$undef) . ./whoa; eval "$var=\$td";;
4227 $undef$define) . ./whoa; eval "$var=\$tu";;
4228 *) eval "$var=$val";;
4229 esac'
4230
4231 : get the patchlevel
4232 echo " "
4233 echo "Getting the current patchlevel..." >&4
4234 if $test -r $rsrc/patchlevel.h;then
4235         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4236         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4237         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4238         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4239         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4240         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4241         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4242 else
4243         revision=0
4244         patchlevel=0
4245         subversion=0
4246         api_revision=0
4247         api_version=0
4248         api_subversion=0
4249         perl_patchlevel=0
4250         $echo "(You do not have patchlevel.h.  Eek.)"
4251 fi
4252 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4253 version_patchlevel_string="version $patchlevel subversion $subversion"
4254 case "$perl_patchlevel" in
4255 0|'') ;;
4256 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4257     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4258     ;;
4259 esac
4260
4261 $echo "(You have $package $version_patchlevel_string.)"
4262
4263 case "$osname" in
4264 dos|vms)
4265         : XXX Should be a Configure test for double-dots in filenames.
4266         version=`echo $revision $patchlevel $subversion | \
4267                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4268         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4269                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4270         ;;
4271 *)
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 esac
4278 : Special case the 5.005_xx maintenance series, which used 5.005
4279 : without any subversion label as a subdirectory in $sitelib
4280 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4281         api_versionstring='5.005'
4282 fi
4283
4284 : Do we want threads support and if so, what type
4285 case "$usethreads" in
4286 $define|true|[yY]*)     dflt='y';;
4287 *)     # Catch case where user specified ithreads or 5005threads but
4288        # forgot -Dusethreads (A.D. 4/2002)
4289        case "$useithreads$use5005threads" in
4290        *$define*)       dflt='y';;
4291        *)               dflt='n';;
4292        esac
4293        ;;
4294 esac
4295 cat <<EOM
4296
4297 Perl can be built to offer a form of threading support on some systems
4298 To do so, Configure can be run with -Dusethreads.
4299
4300 Note that Perl built with threading support runs slightly slower
4301 and uses slightly more memory than plain Perl.
4302
4303 If this doesn't make any sense to you, just accept the default '$dflt'.
4304 EOM
4305 rp='Build a threading Perl?'
4306 . ./myread
4307 case "$ans" in
4308 y|Y)    val="$define" ;;
4309 *)      val="$undef" ;;
4310 esac
4311 set usethreads
4312 eval $setvar
4313
4314 if $test $patchlevel -lt 9; then
4315     case "$usethreads" in
4316     $define)
4317         : Default to ithreads unless overridden on command line or with
4318         : old config.sh
4319         dflt='y'
4320         case "$use5005threads" in
4321                 $define|true|[yY]*)
4322                         echo "5.005 threads are no longer supported"
4323                         exit 1
4324                 ;;
4325         esac
4326         case "$useithreads" in
4327                 $undef|false|[nN]*) dflt='n';;
4328         esac
4329         rp='Use the newer interpreter-based ithreads?'
4330         . ./myread
4331         case "$ans" in
4332         y|Y)    val="$define" ;;
4333         *)      val="$undef" ;;
4334         esac
4335         set useithreads
4336         eval $setvar
4337         : Now set use5005threads to the opposite value.
4338         case "$useithreads" in
4339         $define) val="$undef" ;;
4340         *) val="$define" ;;
4341         esac
4342         set use5005threads
4343         eval $setvar
4344         ;;
4345     *)
4346         useithreads="$undef"
4347         use5005threads="$undef"
4348         ;;
4349     esac
4350
4351     case "$useithreads$use5005threads" in
4352     "$define$define")
4353         $cat >&4 <<EOM
4354
4355 You cannot have both the ithreads and the 5.005 threads enabled
4356 at the same time.  Disabling the 5.005 threads since they are
4357 much less stable than the ithreads.
4358
4359 EOM
4360         use5005threads="$undef"
4361         ;;
4362     esac
4363
4364 else
4365 : perl-5.9.x and later
4366
4367     if test X"$usethreads" = "X$define"; then
4368         case "$use5005threads" in
4369             $define|true|[yY]*)
4370                 $cat >&4 <<EOM
4371
4372 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4373
4374 EOM
4375             ;;
4376         esac
4377     fi
4378
4379     use5005threads="$undef"
4380     useithreads="$usethreads"
4381 fi
4382
4383 case "$d_oldpthreads" in
4384 '')     : Configure tests would be welcome here.  For now, assume undef.
4385         val="$undef" ;;
4386 *)      val="$d_oldpthreads" ;;
4387 esac
4388 set d_oldpthreads
4389 eval $setvar
4390
4391
4392 : Look for a hint-file generated 'call-back-unit'.  If the
4393 : user has specified that a threading perl is to be built,
4394 : we may need to set or change some other defaults.
4395 if $test -f usethreads.cbu; then
4396     echo "Your platform has some specific hints regarding threaded builds, using them..."
4397     . ./usethreads.cbu
4398 else
4399     case "$usethreads" in
4400         "$define"|true|[yY]*)
4401                 $cat <<EOM
4402 (Your platform does not have any specific hints for threaded builds.
4403  Assuming POSIX threads, then.)
4404 EOM
4405         ;;
4406     esac
4407 fi
4408
4409 : Check if multiplicity is required
4410 cat <<EOM
4411
4412 Perl can be built so that multiple Perl interpreters can coexist
4413 within the same Perl executable.
4414 EOM
4415
4416 case "$useithreads" in
4417 $define)
4418         cat <<EOM
4419 This multiple interpreter support is required for interpreter-based threads.
4420 EOM
4421         val="$define"
4422         ;;
4423 *)      case "$usemultiplicity" in
4424         $define|true|[yY]*)     dflt='y';;
4425         *) dflt='n';;
4426         esac
4427         echo " "
4428         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4429         rp='Build Perl for multiplicity?'
4430         . ./myread
4431         case "$ans" in
4432         y|Y)    val="$define" ;;
4433         *)      val="$undef" ;;
4434         esac
4435         ;;
4436 esac
4437 set usemultiplicity
4438 eval $setvar
4439
4440 : Check if morebits is requested
4441 case "$usemorebits" in
4442 "$define"|true|[yY]*)
4443         use64bitint="$define"
4444         uselongdouble="$define"
4445         usemorebits="$define"
4446         ;;
4447 *)      usemorebits="$undef"
4448         ;;
4449 esac
4450
4451 : Determine the C compiler to be used
4452 echo " "
4453 case "$cc" in
4454 '') dflt=cc;;
4455 *) dflt="$cc";;
4456 esac
4457 rp="Use which C compiler?"
4458 . ./myread
4459 cc="$ans"
4460
4461 : See whether they have no cc but they do have gcc
4462 . ./trygcc
4463 if $test -f cc.cbu; then
4464     . ./cc.cbu
4465 fi
4466 . ./checkcc
4467
4468 : make some quick guesses about what we are up against
4469 echo " "
4470 $echo $n "Hmm...  $c"
4471 echo exit 1 >bsd
4472 echo exit 1 >usg
4473 echo exit 1 >v7
4474 echo exit 1 >osf1
4475 echo exit 1 >eunice
4476 echo exit 1 >xenix
4477 echo exit 1 >venix
4478 echo exit 1 >os2
4479 d_bsd="$undef"
4480 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4481 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4482 then
4483         echo "Looks kind of like an OSF/1 system, but we'll see..."
4484         echo exit 0 >osf1
4485 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4486         xxx=`./loc addbib blurfl $pth`
4487         if $test -f $xxx; then
4488         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4489                 echo exit 0 >bsd
4490                 echo exit 0 >usg
4491         else
4492                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4493                         echo "Looks kind of like an extended USG system, but we'll see..."
4494                 else
4495                         echo "Looks kind of like a USG system, but we'll see..."
4496                 fi
4497                 echo exit 0 >usg
4498         fi
4499 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4500         echo "Looks kind of like a BSD system, but we'll see..."
4501         d_bsd="$define"
4502         echo exit 0 >bsd
4503 else
4504         echo "Looks kind of like a Version 7 system, but we'll see..."
4505         echo exit 0 >v7
4506 fi
4507 case "$eunicefix" in
4508 *unixtovms*)
4509         $cat <<'EOI'
4510 There is, however, a strange, musty smell in the air that reminds me of
4511 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4512 EOI
4513         echo exit 0 >eunice
4514         d_eunice="$define"
4515 : it so happens the Eunice I know will not run shell scripts in Unix format
4516         ;;
4517 *)
4518         echo " "
4519         echo "Congratulations.  You aren't running Eunice."
4520         d_eunice="$undef"
4521         ;;
4522 esac
4523 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4524 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4525 : semicolon as a patch separator
4526 case "$p_" in
4527 :) ;;
4528 *)
4529         $cat <<'EOI'
4530 I have the feeling something is not exactly right, however...don't tell me...
4531 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4532 (Or you may be running DOS with DJGPP.)
4533 EOI
4534         echo exit 0 >os2
4535         ;;
4536 esac
4537 if test -f /xenix; then
4538         echo "Actually, this looks more like a XENIX system..."
4539         echo exit 0 >xenix
4540         d_xenix="$define"
4541 else
4542         echo " "
4543         echo "It's not Xenix..."
4544         d_xenix="$undef"
4545 fi
4546 chmod +x xenix
4547 $eunicefix xenix
4548 if test -f /venix; then
4549         echo "Actually, this looks more like a VENIX system..."
4550         echo exit 0 >venix
4551 else
4552         echo " "
4553         if ./xenix; then
4554                 : null
4555         else
4556                 echo "Nor is it Venix..."
4557         fi
4558 fi
4559 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4560 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4561 $rm -f foo
4562
4563 : Check if we are using GNU gcc and what its version is
4564 echo " "
4565 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4566 $cat >try.c <<EOM
4567 #include <stdio.h>
4568 int main() {
4569 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4570 #ifdef __VERSION__
4571         printf("%s\n", __VERSION__);
4572 #else
4573         printf("%s\n", "1");
4574 #endif
4575 #endif
4576         return(0);
4577 }
4578 EOM
4579 if $cc -o try $ccflags $ldflags try.c; then
4580         gccversion=`$run ./try`
4581         case "$gccversion" in
4582         '') echo "You are not using GNU cc." ;;
4583         *)  echo "You are using GNU cc $gccversion."
4584             ccname=gcc
4585             ;;
4586         esac
4587 else
4588         echo " "
4589         echo "*** WHOA THERE!!! ***" >&4
4590         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4591         case "$knowitall" in
4592         '')
4593         echo "    You'd better start hunting for one and let me know about it." >&4
4594                 exit 1
4595                 ;;
4596         esac
4597 fi
4598 $rm -f try try.*
4599 case "$gccversion" in
4600 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4601 esac
4602 case "$gccversion" in
4603 '') gccosandvers='' ;;
4604 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4605    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4606    gccshortvers=''
4607    case "$gccosandvers" in
4608    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4609    $osname$osvers) ;; # looking good
4610    $osname*) cat <<EOM >&4
4611
4612 *** WHOA THERE!!! ***
4613
4614     Your gcc has not been compiled for the exact release of
4615     your operating system ($gccosandvers versus $osname$osvers).
4616
4617     In general it is a good idea to keep gcc synchronized with
4618     the operating system because otherwise serious problems
4619     may ensue when trying to compile software, like Perl.
4620
4621     I'm trying to be optimistic here, though, and will continue.
4622     If later during the configuration and build icky compilation
4623     problems appear (headerfile conflicts being the most common
4624     manifestation), I suggest reinstalling the gcc to match
4625     your operating system release.
4626
4627 EOM
4628       ;;
4629    *) gccosandvers='' ;; # failed to parse, better be silent
4630    esac
4631    ;;
4632 esac
4633 case "$ccname" in
4634 '') ccname="$cc" ;;
4635 esac
4636
4637 # gcc 3.* complain about adding -Idirectories that they already know about,
4638 # so we will take those off from locincpth.
4639 case "$gccversion" in
4640 3*)
4641     echo "main(){}">try.c
4642     for incdir in $locincpth; do
4643        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4644              grep '^c[cp]p*[01]: warning: changing search order '`
4645        if test "X$warn" != X; then
4646            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4647        fi
4648     done
4649     $rm -f try try.*
4650 esac
4651
4652 # gcc 4.9 by default does some optimizations that break perl.
4653 # see ticket 121505.
4654 #
4655 # The -fwrapv disables those optimizations (and probably others,) so
4656 # for gcc 4.9 (and later, since the optimizations probably won't go
4657 # away), add -fwrapv unless the user requests -fno-wrapv, which
4658 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4659 # which turns the overflows -fwrapv ignores into runtime errors.
4660 case "$gccversion" in
4661 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4662     case "$ccflags" in
4663     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4664     *) ccflags="$ccflags -fwrapv" ;;
4665     esac
4666 esac
4667
4668 : What should the include directory be ?
4669 : Use sysroot if set, so findhdr looks in the right place.
4670 echo " "
4671 $echo $n "Hmm...  $c"
4672 dflt="$sysroot/usr/include"
4673 incpath=''
4674 mips_type=''
4675 if $test -f /bin/mips && /bin/mips; then
4676         echo "Looks like a MIPS system..."
4677         $cat >usr.c <<'EOCP'
4678 #ifdef SYSTYPE_BSD43
4679 /bsd43
4680 #endif
4681 EOCP
4682         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4683                 dflt='/bsd43/usr/include'
4684                 incpath='/bsd43'
4685                 mips_type='BSD 4.3'
4686         else
4687                 mips_type='System V'
4688         fi
4689         $rm -f usr.c usr.out
4690         echo "and you're compiling with the $mips_type compiler and libraries."
4691         xxx_prompt=y
4692         echo "exit 0" >mips
4693 else
4694         echo "Doesn't look like a MIPS system."
4695         xxx_prompt=n
4696         echo "exit 1" >mips
4697 fi
4698 chmod +x mips
4699 $eunicefix mips
4700 case "$usrinc" in
4701 '') ;;
4702 *) dflt="$usrinc";;
4703 esac
4704 case "$xxx_prompt" in
4705 y)      fn=d/
4706         echo " "
4707         rp='Where are the include files you want to use?'
4708         . ./getfile
4709         usrinc="$ans"
4710         ;;
4711 *)      usrinc="$dflt"
4712         ;;
4713 esac
4714
4715 : see how we invoke the C preprocessor
4716 echo " "
4717 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4718 cat <<'EOT' >testcpp.c
4719 #define ABC abc
4720 #define XYZ xyz
4721 ABC.XYZ
4722 EOT
4723 cd ..
4724 if test ! -f cppstdin; then
4725         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4726                 # AIX cc -E doesn't show the absolute headerfile
4727                 # locations but we'll cheat by using the -M flag.
4728                 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
4729         else
4730                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4731         fi
4732 else
4733         echo "Keeping your $hint cppstdin wrapper."
4734 fi
4735 chmod 755 cppstdin
4736 wrapper=`pwd`/cppstdin
4737 ok='false'
4738 cd UU
4739
4740 if $test "X$cppstdin" != "X" && \
4741         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4742         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4743 then
4744         echo "You used to use $cppstdin $cppminus so we'll use that again."
4745         case "$cpprun" in
4746         '') echo "But let's see if we can live without a wrapper..." ;;
4747         *)
4748                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4749                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4750                 then
4751                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4752                         ok='true'
4753                 else
4754                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4755                 fi
4756                 ;;
4757         esac
4758 else
4759         case "$cppstdin" in
4760         '') ;;
4761         *)
4762                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4763                 ;;
4764         esac
4765 fi
4766
4767 if $ok; then
4768         : nothing
4769 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4770         $cc -E <testcpp.c >testcpp.out 2>&1; \
4771         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4772         echo "Yup, it does."
4773         x_cpp="$cc $cppflags -E"
4774         x_minus='';
4775 elif echo 'Nope...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"' -P" will work...'; \
4782         $cc -P <testcpp.c >testcpp.out 2>&1; \
4783         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4784         echo "Yipee, that works!"
4785         x_cpp="$cc $cppflags -P"
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 "At long last!"
4791         x_cpp="$cc $cppflags -P"
4792         x_minus='-';
4793 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4794         $cpp <testcpp.c >testcpp.out 2>&1; \
4795         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4796         echo "It works!"
4797         x_cpp="$cpp $cppflags"
4798         x_minus='';
4799 elif echo 'Nixed again...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 "Hooray, it works!  I was beginning to wonder."
4803         x_cpp="$cpp $cppflags"
4804         x_minus='-';
4805 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4806         $wrapper <testcpp.c >testcpp.out 2>&1; \
4807         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4808         x_cpp="$wrapper"
4809         x_minus=''
4810         echo "Eureka!"
4811 else
4812         dflt=''
4813         rp="No dice.  I can't find a C preprocessor.  Name one:"
4814         . ./myread
4815         x_cpp="$ans"
4816         x_minus=''
4817         $x_cpp <testcpp.c >testcpp.out 2>&1
4818         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4819                 echo "OK, that will do." >&4
4820         else
4821 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4822                 exit 1
4823         fi
4824 fi
4825
4826 case "$ok" in
4827 false)
4828         cppstdin="$x_cpp"
4829         cppminus="$x_minus"
4830         cpprun="$x_cpp"
4831         cpplast="$x_minus"
4832         set X $x_cpp
4833         shift
4834         case "$1" in
4835         "$cpp")
4836                 echo "Perhaps can we force $cc -E using a wrapper..."
4837                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4838                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4839                 then
4840                         echo "Yup, we can."
4841                         cppstdin="$wrapper"
4842                         cppminus='';
4843                 else
4844                         echo "Nope, we'll have to live without it..."
4845                 fi
4846                 ;;
4847         esac
4848         case "$cpprun" in
4849         "$wrapper")
4850                 cpprun=''
4851                 cpplast=''
4852                 ;;
4853         esac
4854         ;;
4855 esac
4856
4857 case "$cppstdin" in
4858 "$wrapper"|'cppstdin') ;;
4859 *) $rm -f $wrapper;;
4860 esac
4861 $rm -f testcpp.c testcpp.out
4862
4863 : Adjust cppfilter for path component separator
4864 case "$osname" in
4865 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4866 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4867 *)   cppfilter='' ;;
4868 esac
4869
4870 : Use gcc to determine libpth and incpth
4871 # If using gcc or clang, we can get better values for libpth, incpth
4872 # and usrinc directly from the compiler.
4873 # Note that ccname for clang is also gcc.
4874 case "$ccname" in
4875     gcc)
4876         $echo 'extern int foo;' > try.c
4877         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4878         shift
4879         if $test $# -gt 0; then
4880             incpth="$incpth $*"
4881             incpth="`$echo $incpth|$sed 's/^ //'`"
4882             for i in $*; do
4883                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4884                 if $test -d $j; then
4885                     libpth="$libpth $j"
4886                 fi
4887             done
4888             libpth="`$echo $libpth|$sed 's/^ //'`"
4889             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4890                 if $test -d $xxx; then
4891                     case " $libpth " in
4892                     *" $xxx "*) ;;
4893                     *) libpth="$libpth $xxx";;
4894                     esac
4895                 fi
4896             done
4897         fi
4898         $rm -f try.c
4899         case "$usrinc" in
4900         '') for i in $incpth; do
4901                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4902                     usrinc="$i"
4903                     break
4904                 fi
4905             done
4906             ;;
4907         esac
4908
4909         case "$usecrosscompile" in
4910         $define|true|[yY]*)
4911             case "$incpth" in
4912                 '') echo "Incpth not defined." >&4; croak=y ;;
4913                 *)  echo "Using incpth '$incpth'." >&4 ;;
4914             esac
4915             case "$libpth" in
4916                 '') echo "Libpth not defined." >&4; croak=y ;;
4917                 *)  echo "Using libpth '$libpth'." >&4 ;;
4918             esac
4919             case "$usrinc" in
4920                 '') echo "Usrinc not defined." >&4; croak=y ;;
4921                 *)  echo "Using usrinc $usrinc." >&4 ;;
4922             esac
4923             case "$croak" in
4924                 y)
4925                 if test "X$sysroot" = X; then
4926                     echo "Cannot continue, aborting." >&4; exit 1
4927                 else
4928                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
4929                 fi
4930                 ;;
4931             esac
4932             ;;
4933         esac
4934     ;;
4935 esac
4936
4937 : Default value for incpth is just usrinc
4938 case "$incpth" in
4939 '') incpth="$usrinc";;
4940 esac
4941
4942 : Set private lib path
4943 case "$plibpth" in
4944 '') if ./mips; then
4945         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
4946     fi;;
4947 esac
4948 case "$libpth" in
4949 ' ') dlist='';;
4950 '') dlist="$loclibpth $plibpth $glibpth";;
4951 *) dlist="$libpth";;
4952 esac
4953
4954 : Now check and see which directories actually exist, avoiding duplicates
4955 for xxx in $dlist
4956 do
4957     if $test -d $xxx; then
4958                 case " $libpth " in
4959                 *" $xxx "*) ;;
4960                 *) libpth="$libpth $xxx";;
4961                 esac
4962     fi
4963 done
4964 $cat <<'EOM'
4965
4966 Some systems have incompatible or broken versions of libraries.  Among
4967 the directories listed in the question below, please remove any you
4968 know not to be holding relevant libraries, and add any that are needed.
4969 Say "none" for none.
4970
4971 EOM
4972
4973 if test "X$sysroot" != X; then
4974     $cat <<EOM
4975 You have set sysroot to $sysroot, please supply the directories excluding sysroot
4976
4977 EOM
4978 fi
4979
4980 case "$libpth" in
4981 '') dflt='none';;
4982 *)
4983         set X $libpth
4984         shift
4985         dflt=${1+"$@"}
4986         ;;
4987 esac
4988 rp="Directories to use for library searches?"
4989 . ./myread
4990 case "$ans" in
4991 none) libpth=' ';;
4992 *) libpth="$ans";;
4993 esac
4994
4995 : compute shared library extension
4996 case "$so" in
4997 '')
4998         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4999                 dflt='sl'
5000         else
5001                 dflt='so'
5002         fi
5003         ;;
5004 *) dflt="$so";;
5005 esac
5006 $cat <<EOM
5007
5008 On some systems, shared libraries may be available.  Answer 'none' if
5009 you want to suppress searching of shared libraries for the remainder
5010 of this configuration.
5011
5012 EOM
5013 rp='What is the file extension used for shared libraries?'
5014 . ./myread
5015 so="$ans"
5016
5017 : Does target system insist that shared library basenames are unique
5018 $cat << EOM
5019
5020 Some dynamic loaders assume that the *basename* of shared library filenames
5021 are globally unique.  We'll default this to undef as we assume your system
5022 is not this weird. Set to defined if you're on one of them.
5023
5024 EOM
5025
5026 dflt='n'
5027 rp='Make shared library basenames unique?'
5028 . ./myread
5029 case "$ans" in
5030 y|Y) val="$define" ;;
5031 *)   val="$undef"  ;;
5032 esac
5033 set d_libname_unique
5034 eval $setvar
5035
5036 : Define several unixisms.
5037 : Hints files or command line option can be used to override them.
5038 : The convoluted testing is in case hints files set either the old
5039 : or the new name.
5040 case "$_exe" in
5041 '')     case "$exe_ext" in
5042         '')     ;;
5043         *)      _exe="$exe_ext" ;;
5044         esac
5045         ;;
5046 esac
5047 case "$_a" in
5048 '')     case "$lib_ext" in
5049     '') _a='.a';;
5050         *)      _a="$lib_ext" ;;
5051         esac
5052         ;;
5053 esac
5054 case "$_o" in
5055 '') case "$obj_ext" in
5056         '')     _o='.o';;
5057         *)      _o="$obj_ext";;
5058         esac
5059         ;;
5060 esac
5061 case "$p_" in
5062 '') case "$path_sep" in
5063         '')     p_=':';;
5064         *)      p_="$path_sep";;
5065         esac
5066         ;;
5067 esac
5068 exe_ext=$_exe
5069 lib_ext=$_a
5070 obj_ext=$_o
5071 path_sep=$p_
5072
5073 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5074
5075 : Which makefile gets called first.  This is used by make depend.
5076 case "$firstmakefile" in
5077 '') firstmakefile='makefile';;
5078 esac
5079
5080 : Check is we will use socks
5081 case "$usesocks" in
5082 $define|true|[yY]*)     dflt='y';;
5083 *) dflt='n';;
5084 esac
5085 cat <<EOM
5086
5087 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5088 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5089 to use the PerlIO abstraction layer, this will be implicitly selected.
5090
5091 If this doesn't make any sense to you, just accept the default '$dflt'.
5092 EOM
5093 rp='Build Perl for SOCKS?'
5094 . ./myread
5095 case "$ans" in
5096 y|Y)    val="$define" ;;
5097 *)      val="$undef" ;;
5098 esac
5099 set usesocks
5100 eval $setvar
5101
5102 : Check for uselongdouble support
5103 case "$ccflags" in
5104 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5105 esac
5106
5107 case "$uselongdouble" in
5108 $define|true|[yY]*)     dflt='y';;
5109 *) dflt='n';;
5110 esac
5111 cat <<EOM
5112
5113 Perl can be built to take advantage of long doubles which
5114 (if available) may give more accuracy and range for floating point numbers.
5115
5116 If this doesn't make any sense to you, just accept the default '$dflt'.
5117 EOM
5118 rp='Try to use long doubles if available?'
5119 . ./myread
5120 case "$ans" in
5121 y|Y)    val="$define"   ;;
5122 *)      val="$undef"    ;;
5123 esac
5124 set uselongdouble
5125 eval $setvar
5126
5127 case "$uselongdouble" in
5128 true|[yY]*) uselongdouble="$define" ;;
5129 esac
5130
5131 : Look for a hint-file generated 'call-back-unit'.  If the
5132 : user has specified that long doubles should be used,
5133 : we may need to set or change some other defaults.
5134 if $test -f uselongdouble.cbu; then
5135     echo "Your platform has some specific hints regarding long doubles, using them..."
5136     . ./uselongdouble.cbu
5137 else
5138     case "$uselongdouble" in
5139         $define)
5140                 $cat <<EOM
5141 (Your platform does not have any specific hints for long doubles.)
5142 EOM
5143         ;;
5144     esac
5145 fi
5146
5147 : Looking for optional libraries
5148 echo " "
5149 echo "Checking for optional libraries..." >&4
5150 case "$libs" in
5151 ' '|'') dflt='';;
5152 *) dflt="$libs";;
5153 esac
5154 case "$libswanted" in
5155 '') libswanted='c_s';;
5156 esac
5157 case "$usesocks" in
5158 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5159 esac
5160 case "$usecbacktrace" in
5161 "$define") libswanted="$libswanted bfd" ;;
5162 esac
5163 libsfound=''
5164 libsfiles=''
5165 libsdirs=''
5166 libspath=''
5167 for thisdir in $libpth $xlibpth; do
5168   test -d $thisdir && libspath="$libspath $thisdir"
5169 done
5170 for thislib in $libswanted; do
5171         for thisdir in $libspath; do
5172             xxx=''
5173             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5174                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5175                 $test -f "$xxx" && eval $libscheck
5176                 $test -f "$xxx" && libstyle=shared
5177             fi
5178             if test ! -f "$xxx"; then
5179                 xxx=$thisdir/lib$thislib.$so
5180                 $test -f "$xxx" && eval $libscheck
5181                 $test -f "$xxx" && libstyle=shared
5182             fi
5183             if test ! -f "$xxx"; then
5184                 xxx=$thisdir/lib$thislib$_a
5185                 $test -f "$xxx" && eval $libscheck
5186                 $test -f "$xxx" && libstyle=static
5187             fi
5188             if test ! -f "$xxx"; then
5189                 xxx=$thisdir/$thislib$_a
5190                 $test -f "$xxx" && eval $libscheck
5191                 $test -f "$xxx" && libstyle=static
5192             fi
5193             if test ! -f "$xxx"; then
5194                 xxx=$thisdir/lib${thislib}_s$_a
5195                 $test -f "$xxx" && eval $libscheck
5196                 $test -f "$xxx" && libstyle=static
5197                 $test -f "$xxx" && thislib=${thislib}_s
5198             fi
5199             if test ! -f "$xxx"; then
5200                 xxx=$thisdir/Slib$thislib$_a
5201                 $test -f "$xxx" && eval $libscheck
5202                 $test -f "$xxx" && libstyle=static
5203             fi
5204             if $test -f "$xxx"; then
5205                 case "$libstyle" in
5206                 shared) echo "Found -l$thislib (shared)." ;;
5207                 static) echo "Found -l$thislib." ;;
5208                 *)      echo "Found -l$thislib ($libstyle)." ;;
5209                 esac
5210                 case " $dflt " in
5211                 *"-l$thislib "*);;
5212                 *) dflt="$dflt -l$thislib"
5213                    libsfound="$libsfound $xxx"
5214                    yyy=`basename $xxx`
5215                    libsfiles="$libsfiles $yyy"
5216                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5217                    case " $libsdirs " in
5218                    *" $yyy "*) ;;
5219                    *) libsdirs="$libsdirs $yyy" ;;
5220                    esac
5221                    ;;
5222                 esac
5223                 break
5224             fi
5225         done
5226         if $test ! -f "$xxx"; then
5227             echo "No -l$thislib."
5228         fi
5229 done
5230 set X $dflt
5231 shift
5232 dflt="$*"
5233 case "$libs" in
5234 '') dflt="$dflt";;
5235 *) dflt="$libs";;
5236 esac
5237 case "$dflt" in
5238 ' '|'') dflt='none';;
5239 esac
5240
5241 $cat <<EOM
5242
5243 In order to compile $package on your machine, a number of libraries
5244 are usually needed.  Include any other special libraries here as well.
5245 Say "none" for none.  The default list is almost always right.
5246 EOM
5247
5248 echo " "
5249 rp="What libraries to use?"
5250 . ./myread
5251 case "$ans" in
5252 none) libs=' ';;
5253 *) libs="$ans";;
5254 esac
5255
5256 : determine optimization, if desired, or use for debug flag also
5257 case "$optimize" in
5258 ' '|$undef) dflt='none';;
5259 '') dflt='-O';;
5260 *) dflt="$optimize";;
5261 esac
5262 $cat <<EOH
5263
5264 By default, $package compiles with the -O flag to use the optimizer.
5265 Alternately, you might want to use the symbolic debugger, which uses
5266 the -g flag (on traditional Unix systems).  Either flag can be
5267 specified here.  To use neither flag, specify the word "none".
5268
5269 EOH
5270 rp="What optimizer/debugger flag should be used?"
5271 . ./myread
5272 optimize="$ans"
5273 case "$optimize" in
5274 'none') optimize=" ";;
5275 esac
5276
5277 : Check what DEBUGGING is required from the command line
5278 : -DEBUGGING      or -DDEBUGGING or
5279 : -DEBUGGING=both                       = -g + -DDEBUGGING
5280 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5281 : -DEBUGGING=none or -UDEBUGGING        =
5282 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5283 case "$EBUGGING" in
5284 '')     ;;
5285 *)      DEBUGGING=$EBUGGING ;;
5286 esac
5287
5288 case "$DEBUGGING" in
5289 -g|both|$define)
5290     case "$optimize" in
5291         *-g*) ;;
5292         *)    optimize="$optimize -g" ;;
5293     esac ;;
5294 none|$undef)
5295     case "$optimize" in
5296         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5297                 shift
5298                 optimize="$*"
5299                 ;;
5300     esac ;;
5301 esac
5302
5303 dflt=''
5304 case "$DEBUGGING" in
5305 both|$define) dflt='-DDEBUGGING'
5306 esac
5307
5308 : argument order is deliberate, as the flag will start with - which set could
5309 : think is an option
5310 checkccflag='check=$1; flag=$2; callback=$3;
5311 echo " ";
5312 echo "Checking if your compiler accepts $flag" 2>&1;
5313 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5314 echo "int main(void) { return 0; }" > gcctest.c;
5315 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5316     echo "Yes, it does." 2>&1;
5317     if $test -s gcctest.out ; then
5318         echo "But your platform does not like it:";
5319         cat gcctest.out;
5320     else
5321         case "$ccflags" in
5322         *$check*)
5323             echo "Leaving current flags $ccflags alone." 2>&1
5324             ;;
5325         *) dflt="$dflt $flag";
5326             eval $callback
5327             ;;
5328         esac
5329     fi
5330 else
5331     echo "Nope, it does not, but that is ok." 2>&1;
5332 fi
5333 '
5334
5335 : We will not override a previous value, but we might want to
5336 : augment a hint file
5337 case "$hint" in
5338 default|recommended)
5339         case "$gccversion" in
5340         1*) dflt="$dflt -fpcc-struct-return" ;;
5341         esac
5342         case "$optimize:$DEBUGGING" in
5343         *-g*:old) dflt="$dflt -DDEBUGGING";;
5344         esac
5345         case "$gccversion" in
5346         2*) if $test -d /etc/conf/kconfig.d &&
5347                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5348                 then
5349                         # Interactive Systems (ISC) POSIX mode.
5350                         dflt="$dflt -posix"
5351                 fi
5352                 ;;
5353         esac
5354         case "$gccversion" in
5355         1*) ;;
5356         2.[0-8]*) ;;
5357         ?*)     set strict-aliasing -fno-strict-aliasing
5358                 eval $checkccflag
5359                 ;;
5360         esac
5361         # For gcc, adding -pipe speeds up compilations for some, but apparently
5362         # some assemblers can't read from stdin.  (It also slows down compilations
5363         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5364         case "$gccversion" in
5365         ?*)     set pipe -pipe
5366                 eval $checkccflag
5367                 ;;
5368         esac
5369
5370         # on x86_64 (at least) we require an extra library (libssp) in the
5371         # link command line. This library is not named, so I infer that it is
5372         # an implementation detail that may change. Hence the safest approach
5373         # is to add the flag to the flags passed to the compiler at link time,
5374         # as that way the compiler can do the right implementation dependant
5375         # thing. (NWC)
5376         case "$gccversion" in
5377         ?*)     set stack-protector -fstack-protector
5378                 eval $checkccflag
5379                 ;;
5380         esac
5381         ;;
5382 esac
5383
5384 case "$mips_type" in
5385 *BSD*|'') inclwanted="$locincpth $usrinc";;
5386 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5387 esac
5388 for thisincl in $inclwanted; do
5389         if $test -d $thisincl; then
5390                 if $test x$thisincl != x$usrinc; then
5391                         case "$dflt" in
5392                         *" -I$thisincl "*);;
5393                         *) dflt="$dflt -I$thisincl ";;
5394                         esac
5395                 fi
5396         fi
5397 done
5398
5399 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5400         xxx=true;
5401 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5402         xxx=true;
5403 else
5404         xxx=false;
5405 fi;
5406 if $xxx; then
5407         case "$dflt" in
5408         *$2*);;
5409         *) dflt="$dflt -D$2";;
5410         esac;
5411 fi'
5412
5413 set signal.h LANGUAGE_C; eval $inctest
5414
5415 case "$usesocks" in
5416 $define)
5417         ccflags="$ccflags -DSOCKS"
5418         ;;
5419 esac
5420
5421 case "$hint" in
5422 default|recommended) dflt="$ccflags $dflt" ;;
5423 *) dflt="$ccflags";;
5424 esac
5425
5426 case "$dflt" in
5427 ''|' ') dflt=none;;
5428 esac
5429
5430 $cat <<EOH
5431
5432 Your C compiler may want other flags.  For this question you should include
5433 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5434 but you should NOT include libraries or ld flags like -lwhatever.  If you
5435 want $package to honor its debug switch, you should include -DDEBUGGING here.
5436 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5437
5438 To use no flags, specify the word "none".
5439
5440 EOH
5441 set X $dflt
5442 shift
5443 dflt=${1+"$@"}
5444 rp="Any additional cc flags?"
5445 . ./myread
5446 case "$ans" in
5447 none) ccflags='';;
5448 *) ccflags="$ans";;
5449 esac
5450
5451 : the following weeds options from ccflags that are of no interest to cpp
5452 case "$cppflags" in
5453 '') cppflags="$ccflags" ;;
5454 *)  cppflags="$cppflags $ccflags" ;;
5455 esac
5456 case "$gccversion" in
5457 1*) cppflags="$cppflags -D__GNUC__"
5458 esac
5459 case "$mips_type" in
5460 '');;
5461 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5462 esac
5463 case "$cppflags" in
5464 '');;
5465 *)
5466         echo " "
5467         echo "Let me guess what the preprocessor flags are..." >&4
5468         set X $cppflags
5469         shift
5470         cppflags=''
5471         $cat >cpp.c <<'EOM'
5472 #define BLURFL foo
5473
5474 BLURFL xx LFRULB
5475 EOM
5476         previous=''
5477         for flag in $*
5478         do
5479                 case "$flag" in
5480                 -*) ftry="$flag";;
5481                 *) ftry="$previous $flag";;
5482                 esac
5483                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5484                         >cpp1.out 2>/dev/null && \
5485                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5486                         >cpp2.out 2>/dev/null && \
5487                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5488                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5489                 then
5490                         cppflags="$cppflags $ftry"
5491                         previous=''
5492                 else
5493                         previous="$flag"
5494                 fi
5495         done
5496         set X $cppflags
5497         shift
5498         cppflags=${1+"$@"}
5499         case "$cppflags" in
5500         *-*)  echo "They appear to be: $cppflags";;
5501         esac
5502         $rm -f cpp.c cpp?.out
5503         ;;
5504 esac
5505
5506 : flags used in final linking phase
5507 case "$ldflags" in
5508 '') if ./venix; then
5509                 dflt='-i -z'
5510         else
5511                 dflt=''
5512         fi
5513         case "$ccflags" in
5514         *-posix*) dflt="$dflt -posix" ;;
5515         esac
5516         ;;
5517 *) dflt="$ldflags";;
5518 esac
5519 # See note above about -fstack-protector
5520 case "$ccflags" in
5521 *-fstack-protector*)
5522         case "$dflt" in
5523         *-fstack-protector*) ;; # Don't add it again
5524         *) dflt="$dflt -fstack-protector" ;;
5525         esac
5526         ;;
5527 esac
5528
5529 : Try to guess additional flags to pick up local libraries.
5530 for thislibdir in $libpth; do
5531         case " $loclibpth " in
5532         *" $thislibdir "*)
5533                 case "$dflt " in
5534                 *"-L$thislibdir "*) ;;
5535                 *)  dflt="$dflt -L$thislibdir" ;;
5536                 esac
5537                 ;;
5538         esac
5539 done
5540
5541 case "$dflt" in
5542 '') dflt='none' ;;
5543 esac
5544
5545 $cat <<EOH
5546
5547 Your C linker may need flags.  For this question you should
5548 include -L/whatever and any other flags used by the C linker, but you
5549 should NOT include libraries like -lwhatever.
5550
5551 Make sure you include the appropriate -L/path flags if your C linker
5552 does not normally search all of the directories you specified above,
5553 namely
5554         $libpth
5555 To use no flags, specify the word "none".
5556
5557 EOH
5558
5559 rp="Any additional ld flags (NOT including libraries)?"
5560 . ./myread
5561 case "$ans" in
5562 none) ldflags='';;
5563 *) ldflags="$ans";;
5564 esac
5565 rmlist="$rmlist pdp11"
5566
5567 : coherency check
5568 echo " "
5569 echo "Checking your choice of C compiler and flags for coherency..." >&4
5570 $cat > try.c <<'EOF'
5571 #include <stdio.h>
5572 int main() { printf("Ok\n"); return(0); }
5573 EOF
5574 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5575 shift
5576 $cat >try.msg <<'EOM'
5577 I've tried to compile and run the following simple program:
5578
5579 EOM
5580 $cat try.c >> try.msg
5581
5582 $cat >> try.msg <<EOM
5583
5584 I used the command:
5585
5586         $*
5587         $run ./try
5588
5589 and I got the following output:
5590
5591 EOM
5592 dflt=y
5593 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5594         if $sh -c "$run ./try " >>try.msg 2>&1; then
5595                 xxx=`$run ./try`
5596                 case "$xxx" in
5597                 "Ok") dflt=n ;;
5598                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5599                 esac
5600         else
5601                 echo "The program compiled OK, but exited with status $?." >>try.msg
5602                 rp="You have a problem.  Shall I abort Configure"
5603                 dflt=y
5604         fi
5605 else
5606         echo "I can't compile the test program." >>try.msg
5607         rp="You have a BIG problem.  Shall I abort Configure"
5608         dflt=y
5609 fi
5610 case "$dflt" in
5611 y)
5612         $cat try.msg >&4
5613         case "$knowitall" in
5614         '')
5615                 echo "(The supplied flags or libraries might be incorrect.)"
5616                 ;;
5617         *) dflt=n;;
5618         esac
5619         echo " "
5620         . ./myread
5621         case "$ans" in
5622         n*|N*) ;;
5623         *)      echo "Ok.  Stopping Configure." >&4
5624                 exit 1
5625                 ;;
5626         esac
5627         ;;
5628 n) echo "OK, that should do.";;
5629 esac
5630 $rm_try gcctest gcctest.out
5631
5632 : define a shorthand compile call
5633 compile='
5634 mc_file=$1;
5635 shift;
5636 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5637 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5638 exit 1;
5639 fi;
5640 esac;
5641 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5642 : define a shorthand compile call for compilations that should be ok.
5643 compile_ok='
5644 mc_file=$1;
5645 shift;
5646 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5647
5648 : determine filename position in cpp output
5649 echo " "
5650 echo "Computing filename position in cpp output for #include directives..." >&4
5651 case "$osname" in
5652 vos) testaccess=-e ;;
5653 *)   testaccess=-r ;;
5654 esac
5655 echo '#include <stdio.h>' > foo.c
5656 $cat >fieldn <<EOF
5657 $startsh
5658 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5659 $grep '^[       ]*#.*stdio\.h' | \
5660 while read cline; do
5661         pos=1
5662         set \$cline
5663         while $test \$# -gt 0; do
5664                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5665                         echo "\$pos"
5666                         exit 0
5667                 fi
5668                 shift
5669                 pos=\`expr \$pos + 1\`
5670         done
5671 done
5672 EOF
5673 chmod +x fieldn
5674 fieldn=`./fieldn`
5675 $rm -f foo.c fieldn
5676 case $fieldn in
5677 '') pos='???';;
5678 1) pos=first;;
5679 2) pos=second;;
5680 3) pos=third;;
5681 *) pos="${fieldn}th";;
5682 esac
5683 echo "Your cpp writes the filename in the $pos field of the line."
5684
5685 : locate header file
5686 $cat >findhdr <<EOF
5687 $startsh
5688 wanted=\$1
5689 name=''
5690 for usrincdir in $incpth
5691 do
5692         if test -f \$usrincdir/\$wanted; then
5693                 echo "\$usrincdir/\$wanted"
5694                 exit 0
5695         fi
5696 done
5697 awkprg='{ print \$$fieldn }'
5698 echo "#include <\$wanted>" > foo\$\$.c
5699 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5700 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5701 while read cline; do
5702         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5703         case "\$name" in
5704         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5705         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5706         *) exit 2;;
5707         esac;
5708 done;
5709 #
5710 # status = 0: grep returned 0 lines, case statement not executed
5711 # status = 1: headerfile found
5712 # status = 2: while loop executed, no headerfile found
5713 #
5714 status=\$?
5715 $rm -f foo\$\$.c;
5716 if test \$status -eq 1; then
5717         exit 0;
5718 fi
5719 exit 1
5720 EOF
5721 chmod +x findhdr
5722
5723 : define an alternate in-header-list? function
5724 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5725 cont=true; xxf="echo \"<\$1> found.\" >&4";
5726 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5727 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5728 esac;
5729 case $# in 4) instead=instead;; *) instead="at last";; esac;
5730 while $test "$cont"; do
5731         xxx=`./findhdr $1`
5732         var=$2; eval "was=\$$2";
5733         if $test "$xxx" && $test -r "$xxx";
5734         then eval $xxf;
5735         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5736                 cont="";
5737         else eval $xxnf;
5738         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5739         set $yyy; shift; shift; yyy=$@;
5740         case $# in 0) cont="";;
5741         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5742                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5743         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5744                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5745         esac;
5746 done;
5747 while $test "$yyy";
5748 do set $yyy; var=$2; eval "was=\$$2";
5749         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5750         set $yyy; shift; shift; yyy=$@;
5751 done'
5752
5753 : see if stdlib is available
5754 set stdlib.h i_stdlib
5755 eval $inhdr
5756
5757 : check for lengths of integral types
5758 echo " "
5759 case "$intsize" in
5760 '')
5761         echo "Checking to see how big your integers are..." >&4
5762         $cat >try.c <<EOCP
5763 #include <stdio.h>
5764 #$i_stdlib I_STDLIB
5765 #ifdef I_STDLIB
5766 #include <stdlib.h>
5767 #endif
5768 int main()
5769 {
5770         printf("intsize=%d;\n", (int)sizeof(int));
5771         printf("longsize=%d;\n", (int)sizeof(long));
5772         printf("shortsize=%d;\n", (int)sizeof(short));
5773         exit(0);
5774 }
5775 EOCP
5776         set try
5777         if eval $compile_ok && $run ./try > /dev/null; then
5778                 eval `$run ./try`
5779                 echo "Your integers are $intsize bytes long."
5780                 echo "Your long integers are $longsize bytes long."
5781                 echo "Your short integers are $shortsize bytes long."
5782         else
5783                 $cat >&4 <<EOM
5784 !
5785 Help! I can't compile and run the intsize test program: please enlighten me!
5786 (This is probably a misconfiguration in your system or libraries, and
5787 you really ought to fix it.  Still, I'll try anyway.)
5788 !
5789 EOM
5790                 dflt=4
5791                 rp="What is the size of an integer (in bytes)?"
5792                 . ./myread
5793                 intsize="$ans"
5794                 dflt=$intsize
5795                 rp="What is the size of a long integer (in bytes)?"
5796                 . ./myread
5797                 longsize="$ans"
5798                 dflt=2
5799                 rp="What is the size of a short integer (in bytes)?"
5800                 . ./myread
5801                 shortsize="$ans"
5802         fi
5803         ;;
5804 esac
5805 $rm_try
5806
5807 : check for long long
5808 echo " "
5809 echo "Checking to see if you have long long..." >&4
5810 echo 'int main() { long long x = 7; return 0; }' > try.c
5811 set try
5812 if eval $compile; then
5813         val="$define"
5814         echo "You have long long."
5815 else
5816         val="$undef"
5817         echo "You do not have long long."
5818 fi
5819 $rm_try
5820 set d_longlong
5821 eval $setvar
5822
5823 : check for length of long long
5824 case "${d_longlong}${longlongsize}" in
5825 $define)
5826         echo " "
5827         echo "Checking to see how big your long longs are..." >&4
5828         $cat >try.c <<'EOCP'
5829 #include <stdio.h>
5830 int main()
5831 {
5832     printf("%d\n", (int)sizeof(long long));
5833     return(0);
5834 }
5835 EOCP
5836         set try
5837         if eval $compile_ok; then
5838                 longlongsize=`$run ./try`
5839                 echo "Your long longs are $longlongsize bytes long."
5840         else
5841                 dflt='8'
5842                 echo " "
5843                 echo "(I can't seem to compile the test program.  Guessing...)"
5844                 rp="What is the size of a long long (in bytes)?"
5845                 . ./myread
5846                 longlongsize="$ans"
5847         fi
5848         if $test "X$longsize" = "X$longlongsize"; then
5849                 echo "(That isn't any different from an ordinary long.)"
5850         fi
5851         ;;
5852 esac
5853 $rm_try
5854
5855 : see if inttypes.h is available
5856 : we want a real compile instead of Inhdr because some systems
5857 : have an inttypes.h which includes non-existent headers
5858 echo " "
5859 $cat >try.c <<EOCP
5860 #include <inttypes.h>
5861 int main() {
5862         static int32_t foo32 = 0x12345678;
5863 }
5864 EOCP
5865 set try
5866 if eval $compile; then
5867         echo "<inttypes.h> found." >&4
5868         val="$define"
5869 else
5870         echo "<inttypes.h> NOT found." >&4
5871         val="$undef"
5872 fi
5873 $rm_try
5874 set i_inttypes
5875 eval $setvar
5876
5877 : check for int64_t
5878 echo " "
5879 echo "Checking to see if you have int64_t..." >&4
5880 $cat >try.c <<EOCP
5881 #include <sys/types.h>
5882 #$i_inttypes I_INTTYPES
5883 #ifdef I_INTTYPES
5884 #include <inttypes.h>
5885 #endif
5886 int main() { int64_t x = 7; }
5887 EOCP
5888 set try
5889 if eval $compile; then
5890         val="$define"
5891         echo "You have int64_t."
5892 else
5893         val="$undef"
5894         echo "You do not have int64_t."
5895 fi
5896 $rm_try
5897 set d_int64_t
5898 eval $setvar
5899
5900 : Check if 64bit ints have a quad type
5901 echo " "
5902 echo "Checking which 64-bit integer type we could use..." >&4
5903
5904 case "$intsize" in
5905 8) val=int
5906    set quadtype
5907    eval $setvar
5908    val='"unsigned int"'
5909    set uquadtype
5910    eval $setvar
5911    quadkind=1
5912    ;;
5913 *) case "$longsize" in
5914    8) val=long
5915       set quadtype
5916       eval $setvar
5917       val='"unsigned long"'
5918       set uquadtype
5919       eval $setvar
5920       quadkind=2
5921       ;;
5922    *) case "$d_longlong:$longlongsize" in
5923       define:8)
5924         val='"long long"'
5925         set quadtype
5926         eval $setvar
5927         val='"unsigned long long"'
5928         set uquadtype
5929         eval $setvar
5930         quadkind=3
5931         ;;
5932       *) case "$d_int64_t" in
5933          define)
5934            val=int64_t
5935            set quadtype
5936            eval $setvar
5937            val=uint64_t
5938            set uquadtype
5939            eval $setvar
5940            quadkind=4
5941            ;;
5942          esac
5943          ;;
5944       esac
5945       ;;
5946    esac
5947    ;;
5948 esac
5949
5950 case "$quadtype" in
5951 '')     echo "Alas, no 64-bit integer types in sight." >&4
5952         d_quad="$undef"
5953         ;;
5954 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5955         d_quad="$define"
5956         ;;
5957 esac
5958
5959 : Do we want 64bit support
5960 case "$uselonglong" in
5961 "$define"|true|[yY]*)
5962         cat <<EOM >&4
5963
5964 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5965 EOM
5966         use64bitint="$define"
5967         ;;
5968 esac
5969 case "$use64bits" in
5970 "$define"|true|[yY]*)
5971         cat <<EOM >&4
5972
5973 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5974 EOM
5975         use64bitint="$define"
5976         ;;
5977 esac
5978 case "$use64bitints" in
5979 "$define"|true|[yY]*)
5980         cat <<EOM >&4
5981
5982 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5983 EOM
5984         use64bitint="$define"
5985         ;;
5986 esac
5987 case "$use64bitsint" in
5988 "$define"|true|[yY]*)
5989         cat <<EOM >&4
5990
5991 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5992 EOM
5993         use64bitint="$define"
5994         ;;
5995 esac
5996 case "$uselonglongs" in
5997 "$define"|true|[yY]*)
5998         cat <<EOM >&4
5999
6000 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6001 EOM
6002         use64bitint="$define"
6003         ;;
6004 esac
6005 case "$use64bitsall" in
6006 "$define"|true|[yY]*)
6007         cat <<EOM >&4
6008
6009 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6010 EOM
6011         use64bitall="$define"
6012         ;;
6013 esac
6014
6015 case "$ccflags" in
6016 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6017 esac
6018 case "$use64bitall" in
6019 "$define"|true|[yY]*) use64bitint="$define" ;;
6020 esac
6021
6022 case "$longsize" in
6023 8) cat <<EOM
6024
6025 You have natively 64-bit long integers.
6026 EOM
6027    val="$define"
6028    ;;
6029 *) case "$use64bitint" in
6030    "$define"|true|[yY]*) dflt='y';;
6031    *) dflt='n';;
6032    esac
6033    case "$d_quad" in
6034    "$define") ;;
6035    *) dflt='n' ;;
6036    esac
6037    cat <<EOM
6038
6039 Perl can be built to take advantage of 64-bit integer types
6040 on some systems.  To do so, Configure can be run with -Duse64bitint.
6041 Choosing this option will most probably introduce binary incompatibilities.
6042
6043 If this doesn't make any sense to you, just accept the default '$dflt'.
6044 (The default has been chosen based on your configuration.)
6045 EOM
6046    rp='Try to use 64-bit integers, if available?'
6047    . ./myread
6048    case "$ans" in
6049    [yY]*) val="$define" ;;
6050    *)     val="$undef"  ;;
6051    esac
6052    ;;
6053 esac
6054 set use64bitint
6055 eval $setvar
6056
6057 case "$use64bitall" in
6058 "$define"|true|[yY]*) dflt='y' ;;
6059 *) case "$longsize" in
6060    8) dflt='y' ;;
6061    *) dflt='n' ;;
6062    esac
6063    ;;
6064 esac
6065 cat <<EOM
6066
6067 You may also choose to try maximal 64-bitness.  It means using as much
6068 64-bitness as possible on the platform.  This in turn means even more
6069 binary incompatibilities.  On the other hand, your platform may not
6070 have any more 64-bitness available than what you already have chosen.
6071
6072 If this doesn't make any sense to you, just accept the default '$dflt'.
6073 (The default has been chosen based on your configuration.)
6074 EOM
6075 rp='Try to use maximal 64-bit support, if available?'
6076 . ./myread
6077 case "$ans" in
6078 [yY]*) val="$define" ;;
6079 *)     val="$undef"  ;;
6080 esac
6081 set use64bitall
6082 eval $setvar
6083 case "$use64bitall" in
6084 "$define")
6085         case "$use64bitint" in
6086         "$undef")
6087                 cat <<EOM
6088
6089 Since you have chosen a maximally 64-bit build, I'm also turning on
6090 the use of 64-bit integers.
6091 EOM
6092                 use64bitint="$define" ;;
6093         esac
6094         ;;
6095 esac
6096
6097 : Look for a hint-file generated 'call-back-unit'.  If the
6098 : user has specified that a 64-bit perl is to be built,
6099 : we may need to set or change some other defaults.
6100 if $test -f use64bitint.cbu; then
6101         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6102         . ./use64bitint.cbu
6103 fi
6104 case "$use64bitint" in
6105 "$define"|true|[yY]*)
6106         : This test was common to all the OpenBSD forks, and seems harmless for
6107         : other platforms:
6108         echo " "
6109         echo "Checking if your C library has broken 64-bit functions..." >&4
6110         cat >try.c <<EOCP
6111 #include <stdio.h>
6112 typedef $uquadtype myULL;
6113 int main (void)
6114 {
6115     struct {
6116         double d;
6117         myULL  u;
6118     } *p, test[] = {
6119         {4294967303.15, 4294967303ULL},
6120         {4294967294.2,  4294967294ULL},
6121         {4294967295.7,  4294967295ULL},
6122         {0.0, 0ULL}
6123     };
6124     for (p = test; p->u; p++) {
6125         myULL x = (myULL)p->d;
6126         if (x != p->u) {
6127             printf("buggy\n");
6128             return 0;
6129         }
6130     }
6131     printf("ok\n");
6132     return 0;
6133 }
6134 EOCP
6135         set try
6136         if eval $compile_ok; then
6137             libcquad=`$run ./try`
6138             echo "Your C library's 64-bit functions are $libcquad."
6139         else
6140             echo "(I can't seem to compile the test program.)"
6141             echo "Assuming that your C library's 64-bit functions are ok."
6142             libcquad="ok"
6143         fi
6144         $rm_try
6145
6146         case "$libcquad" in
6147             buggy*)
6148                 cat >&4 <<EOM
6149
6150 *** You have a C library with broken 64-bit functions.
6151 *** 64-bit support does not work reliably in this configuration.
6152 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6153 *** Cannot continue, aborting.
6154
6155 EOM
6156                 exit 1
6157                 ;;
6158         esac
6159         case "$longsize" in
6160         4) case "$archname64" in
6161            '') archname64=64int ;;
6162            esac
6163            ;;
6164         esac
6165         ;;
6166 esac
6167
6168 : Look for a hint-file generated 'call-back-unit'.  If the
6169 : user has specified that a maximally 64-bit perl is to be built,
6170 : we may need to set or change some other defaults.
6171 if $test -f use64bitall.cbu; then
6172         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6173         . ./use64bitall.cbu
6174 fi
6175 case "$use64bitall" in
6176 "$define"|true|[yY]*)
6177         case "$longsize" in
6178         4) case "$archname64" in
6179            ''|64int) archname64=64all ;;
6180            esac
6181            ;;
6182         esac
6183         ;;
6184 esac
6185
6186 case "$d_quad:$use64bitint" in
6187 $undef:$define)
6188         cat >&4 <<EOF
6189
6190 *** You have chosen to use 64-bit integers,
6191 *** but none can be found.
6192 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6193 *** Cannot continue, aborting.
6194
6195 EOF
6196         exit 1
6197         ;;
6198 esac
6199
6200 : check for length of double
6201 echo " "
6202 case "$doublesize" in
6203 '')
6204         echo "Checking to see how big your double precision numbers are..." >&4
6205         $cat >try.c <<EOCP
6206 #include <stdio.h>
6207 #$i_stdlib I_STDLIB
6208 #ifdef I_STDLIB
6209 #include <stdlib.h>
6210 #endif
6211 int main()
6212 {
6213     printf("%d\n", (int)sizeof(double));
6214     exit(0);
6215 }
6216 EOCP
6217         set try
6218         if eval $compile_ok; then
6219                 doublesize=`$run ./try`
6220                 echo "Your double is $doublesize bytes long."
6221         else
6222                 dflt='8'
6223                 echo "(I can't seem to compile the test program.  Guessing...)"
6224                 rp="What is the size of a double precision number (in bytes)?"
6225                 . ./myread
6226                 doublesize="$ans"
6227         fi
6228         ;;
6229 esac
6230 $rm_try
6231
6232 : check for long doubles
6233 echo " "
6234 echo "Checking to see if you have long double..." >&4
6235 echo 'int main() { long double x = 7.0; }' > try.c
6236 set try
6237 if eval $compile; then
6238         val="$define"
6239         echo "You have long double."
6240 else
6241         val="$undef"
6242         echo "You do not have long double."
6243 fi
6244 $rm_try
6245 set d_longdbl
6246 eval $setvar
6247
6248 : check for length of long double
6249 case "${d_longdbl}${longdblsize}" in
6250 $define)
6251         echo " "
6252         echo "Checking to see how big your long doubles are..." >&4
6253         $cat >try.c <<'EOCP'
6254 #include <stdio.h>
6255 int main()
6256 {
6257         printf("%d\n", sizeof(long double));
6258 }
6259 EOCP
6260         set try
6261         set try
6262         if eval $compile; then
6263                 longdblsize=`$run ./try`
6264                 echo "Your long doubles are $longdblsize bytes long."
6265         else
6266                 dflt='8'
6267                 echo " "
6268                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6269                 rp="What is the size of a long double (in bytes)?"
6270                 . ./myread
6271                 longdblsize="$ans"
6272         fi
6273         if $test "X$doublesize" = "X$longdblsize"; then
6274                 echo "That isn't any different from an ordinary double."
6275                 echo "I'll keep your setting anyway, but you may see some"
6276                 echo "harmless compilation warnings."
6277         fi
6278         ;;
6279 esac
6280 $rm_try
6281
6282 : determine the architecture name
6283 echo " "
6284 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6285         tarch=`arch`"-$osname"
6286 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6287         if uname -m > tmparch 2>&1 ; then
6288                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6289                         -e 's/$/'"-$osname/" tmparch`
6290         else
6291                 tarch="$osname"
6292         fi
6293         $rm -f tmparch
6294 else
6295         tarch="$osname"
6296 fi
6297 case "$myarchname" in
6298 ''|"$tarch") ;;
6299 *)
6300         echo "(Your architecture name used to be $myarchname.)"
6301         archname=''
6302         ;;
6303 esac
6304 case "$targetarch" in
6305 '') ;;
6306 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6307 esac
6308 myarchname="$tarch"
6309 case "$archname" in
6310 '') dflt="$tarch";;
6311 *) dflt="$archname";;
6312 esac
6313 rp='What is your architecture name'
6314 . ./myread
6315 archname="$ans"
6316
6317 : optionally add API version to the architecture for versioned archlibs
6318 case "$useversionedarchname" in
6319 $define|true|[yY]*) dflt='y';;
6320 *)                  dflt='n';;
6321 esac
6322 rp='Add the Perl API version to your archname?'
6323 . ./myread
6324 case "$ans" in
6325 y|Y)    useversionedarchname="$define" ;;
6326 *)      useversionedarchname="$undef" ;;
6327 esac
6328 case "$useversionedarchname" in
6329 $define)
6330         case "$archname" in
6331         *-$api_versionstring)
6332                 echo "...and architecture name already has -$api_versionstring" >&4
6333                 ;;
6334         *)
6335                 archname="$archname-$api_versionstring"
6336                 echo "...setting architecture name to $archname." >&4
6337                 ;;
6338         esac
6339         ;;
6340 esac
6341
6342 case "$usethreads" in
6343 $define)
6344         echo "Threads selected." >&4
6345         case "$archname" in
6346         *-thread*) echo "...and architecture name already has -thread." >&4
6347                 ;;
6348         *)      archname="$archname-thread"
6349                 echo "...setting architecture name to $archname." >&4
6350                 ;;
6351         esac
6352         ;;
6353 esac
6354 case "$usemultiplicity" in
6355 $define)
6356         echo "Multiplicity selected." >&4
6357         case "$archname" in
6358         *-multi*) echo "...and architecture name already has -multi." >&4
6359                 ;;
6360         *)      archname="$archname-multi"
6361                 echo "...setting architecture name to $archname." >&4
6362                 ;;
6363         esac
6364         ;;
6365 esac
6366 case "$use64bitint$use64bitall" in
6367 *"$define"*)
6368         case "$archname64" in
6369         '')
6370                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6371                 ;;
6372         *)
6373                 case "$use64bitint" in
6374                 "$define") echo "64 bit integers selected." >&4 ;;
6375                 esac
6376                 case "$use64bitall" in
6377                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6378                 esac
6379                 case "$archname" in
6380                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6381                         ;;
6382                 *)      archname="$archname-$archname64"
6383                         echo "...setting architecture name to $archname." >&4
6384                         ;;
6385                 esac
6386                 ;;
6387         esac
6388 esac
6389 case "$uselongdouble" in
6390 $define)
6391         echo "Long doubles selected." >&4
6392         case "$longdblsize" in
6393         $doublesize)
6394                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6395                 ;;
6396         *)
6397                 case "$archname" in
6398                 *-ld*) echo "...and architecture name already has -ld." >&4
6399                         ;;
6400                 *)      archname="$archname-ld"
6401                         echo "...setting architecture name to $archname." >&4
6402                         ;;
6403                 esac
6404                 ;;
6405         esac
6406         ;;
6407 esac
6408 if $test -f archname.cbu; then
6409         echo "Your platform has some specific hints for architecture name, using them..."
6410         . ./archname.cbu
6411 fi
6412
6413 : set the prefixit variable, to compute a suitable default value
6414 prefixit='case "$3" in
6415 ""|none)
6416         case "$oldprefix" in
6417         "") eval "$1=\"\$$2\"";;
6418         *)
6419                 case "$3" in
6420                 "") eval "$1=";;
6421                 none)
6422                         eval "tp=\"\$$2\"";
6423                         case "$tp" in
6424                         ""|" ") eval "$1=\"\$$2\"";;
6425                         *) eval "$1=";;
6426                         esac;;
6427                 esac;;
6428         esac;;
6429 *)
6430         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6431         case "$tp" in
6432         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6433         /*-$oldprefix/*|\~*-$oldprefix/*)
6434                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6435         *) eval "$1=\"\$$2\"";;
6436         esac;;
6437 esac'
6438
6439 : determine installation style
6440 : For now, try to deduce it from prefix unless it is already set.
6441 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6442 case "$installstyle" in
6443 '')     case "$prefix" in
6444                 *perl*) dflt='lib';;
6445                 *) dflt='lib/perl5' ;;
6446         esac
6447         ;;
6448 *)      dflt="$installstyle" ;;
6449 esac
6450 : Probably not worth prompting for this since we prompt for all
6451 : the directories individually, and the prompt would be too long and
6452 : confusing anyway.
6453 installstyle=$dflt
6454
6455 : determine where public executables go
6456 echo " "
6457 set dflt bin bin
6458 eval $prefixit
6459 fn=d~
6460 rp='Pathname where the public executables will reside?'
6461 . ./getfile
6462 if $test "X$ansexp" != "X$binexp"; then
6463         installbin=''
6464 fi
6465 prefixvar=bin
6466 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6467 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6468 :     this via initialinstalllocation
6469 . ./setprefixvar
6470
6471 case "$userelocatableinc" in
6472 $define|true|[yY]*)     dflt='y' ;;
6473 *)                      dflt='n' ;;
6474 esac
6475 cat <<EOM
6476
6477 Would you like to build Perl so that the installation is relocatable, so that
6478 library paths in @INC are determined relative to the path of the perl binary?
6479 This is not advised for system Perl installs, or if you need to run setid
6480 scripts or scripts under taint mode.
6481
6482 If this doesn't make any sense to you, just accept the default '$dflt'.
6483 EOM
6484 rp='Use relocatable @INC?'
6485 . ./myread
6486 case "$ans" in
6487 y|Y)    val="$define" ;;
6488 *)      val="$undef"  ;;
6489 esac
6490 set userelocatableinc
6491 eval $setvar
6492
6493 initialinstalllocation="$binexp"
6494 : Default prefix is now "up one level from where the binaries are"
6495 case "$userelocatableinc" in
6496 $define|true|[yY]*)
6497     bin=".../"
6498     binexp=".../"
6499     prefix=".../.."
6500     prefixexp=".../.."
6501     installprefixexp=".../.."
6502     ;;
6503 esac
6504
6505 : determine where private library files go
6506 : Usual default is /usr/local/lib/perl5/$version.
6507 : Also allow things like /opt/perl/lib/$version, since
6508 : /opt/perl/lib/perl5... would be redundant.
6509 : The default "style" setting is made in installstyle.U
6510 case "$installstyle" in
6511 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6512 *)       set dflt privlib lib/$version ;;
6513 esac
6514 eval $prefixit
6515 $cat <<EOM
6516
6517 There are some auxiliary files for $package that need to be put into a
6518 private library directory that is accessible by everyone.
6519
6520 EOM
6521 fn=$binexp
6522 fn=d~+
6523 rp='Pathname where the private library files will reside?'
6524 . ./getfile
6525 prefixvar=privlib
6526 . ./setprefixvar
6527
6528 : set the prefixup variable, to restore leading tilda escape
6529 prefixup='case "$prefixexp" in
6530 "$prefix") ;;
6531 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6532 esac'
6533
6534 : determine where public architecture dependent libraries go
6535 set archlib archlib
6536 eval $prefixit
6537 : privlib default is /usr/local/lib/$package/$version
6538 : archlib default is /usr/local/lib/$package/$version/$archname
6539 : privlib may have an optional trailing /share.
6540 tdflt=`echo $privlib | $sed 's,/share$,,'`
6541 tdflt=$tdflt/$archname
6542 case "$archlib" in
6543 '')     dflt=$tdflt
6544         ;;
6545 *)      dflt="$archlib"
6546     ;;
6547 esac
6548 $cat <<EOM
6549
6550 $spackage contains architecture-dependent library files.  If you are
6551 sharing libraries in a heterogeneous environment, you might store
6552 these files in a separate location.  Otherwise, you can just include
6553 them with the rest of the public library files.
6554
6555 EOM
6556 fn=$binexp
6557 fn=d+~
6558 rp='Where do you want to put the public architecture-dependent libraries?'
6559 . ./getfile
6560 prefixvar=archlib
6561 . ./setprefixvar
6562 if $test X"$archlib" = X"$privlib"; then
6563         d_archlib="$undef"
6564 else
6565         d_archlib="$define"
6566 fi
6567
6568 : see if setuid scripts can be secure
6569 $cat <<EOM
6570
6571 Some kernels have a bug that prevents setuid #! scripts from being
6572 secure.  Some sites have disabled setuid #! scripts because of this.
6573
6574 First let's decide if your kernel supports secure setuid #! scripts.
6575 (If setuid #! scripts would be secure but have been disabled anyway,
6576 don't say that they are secure if asked.)
6577
6578 EOM
6579
6580 val="$undef"
6581 if $test -d /dev/fd; then
6582         echo "#!$ls" >reflect
6583         chmod +x,u+s reflect
6584         ./reflect >flect 2>&1
6585         if $contains "/dev/fd" flect >/dev/null; then
6586                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6587                 val="$define"
6588         else
6589                 $cat <<EOM
6590 If you are not sure if they are secure, I can check but I'll need a
6591 username and password different from the one you are using right now.
6592 If you don't have such a username or don't want me to test, simply
6593 enter 'none'.
6594
6595 EOM
6596                 rp='Other username to test security of setuid scripts with?'
6597                 dflt='none'
6598                 . ./myread
6599                 case "$ans" in
6600                 n|none)
6601                         case "$d_suidsafe" in
6602                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6603                                 dflt=n;;
6604                         "$undef")
6605                                 echo "Well, the $hint value is *not* secure." >&4
6606                                 dflt=n;;
6607                         *)      echo "Well, the $hint value *is* secure." >&4
6608                                 dflt=y;;
6609                         esac
6610                         ;;
6611                 *)
6612                         $rm -f reflect flect
6613                         echo "#!$ls" >reflect
6614                         chmod +x,u+s reflect
6615                         echo >flect
6616                         chmod a+w flect
6617                         echo '"su" will (probably) prompt you for '"$ans's password."
6618                         su $ans -c './reflect >flect'
6619                         if $contains "/dev/fd" flect >/dev/null; then
6620                                 echo "Okay, it looks like setuid scripts are secure." >&4
6621                                 dflt=y
6622                         else
6623                                 echo "I don't think setuid scripts are secure." >&4
6624                                 dflt=n
6625                         fi
6626                         ;;
6627                 esac
6628                 rp='Does your kernel have *secure* setuid scripts?'
6629                 . ./myread
6630                 case "$ans" in
6631                 [yY]*)  val="$define";;
6632                 *)      val="$undef";;
6633                 esac
6634         fi
6635 else
6636         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6637         echo "(That's for file descriptors, not floppy disks.)"
6638         val="$undef"
6639 fi
6640 set d_suidsafe
6641 eval $setvar
6642
6643 $rm -f reflect flect
6644
6645 : now see if they want to do setuid emulation
6646 if $test $patchlevel -lt 11; then
6647 echo " "
6648 val="$undef"
6649 case "$d_suidsafe" in
6650 "$define")
6651         val="$undef"
6652         echo "No need to emulate SUID scripts since they are secure here." >&4
6653         ;;
6654 *)
6655         $cat <<EOM
6656 Some systems have disabled setuid scripts, especially systems where
6657 setuid scripts cannot be secure.  On systems where setuid scripts have
6658 been disabled, the setuid/setgid bits on scripts are currently
6659 useless.  It is possible for $package to detect those bits and emulate
6660 setuid/setgid in a secure fashion.  This emulation will only work if
6661 setuid scripts have been disabled in your kernel.
6662
6663 EOM
6664         case "$d_dosuid" in
6665         "$define") dflt=y ;;
6666         *) dflt=n ;;
6667         esac
6668         rp="Do you want to do setuid/setgid emulation?"
6669         . ./myread
6670         case "$ans" in
6671         [yY]*)  val="$define";;
6672         *)      val="$undef";;
6673         esac
6674         ;;
6675 esac
6676 set d_dosuid
6677 eval $setvar
6678 else
6679     case "$d_dosuid" in
6680         "$define")
6681         cat >&4 <<EOH
6682
6683 SUID emulation has been removed for 5.12
6684 Please re-run Configure without -Dd_dosuid
6685
6686 EOH
6687         exit 1;
6688         ;;
6689     esac
6690     d_dosuid=undef
6691 fi
6692
6693 : Find perl5.005 or later.
6694 echo "Looking for a previously installed perl5.005 or later... "
6695 case "$perl5" in
6696 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6697                 : Check if this perl is recent and can load a simple module
6698                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6699                         perl5=$tdir/perl
6700                         break;
6701                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6702                         perl5=$tdir/perl5
6703                         break;
6704                 fi
6705         done
6706         ;;
6707 *)      perl5="$perl5"
6708         ;;
6709 esac
6710 case "$perl5" in
6711 '')     echo "None found.  That's ok.";;
6712 *)      echo "Using $perl5." ;;
6713 esac
6714
6715 : Set the siteprefix variables
6716 $cat <<EOM
6717
6718 After $package is installed, you may wish to install various
6719 add-on modules and utilities.  Typically, these add-ons will
6720 be installed under $prefix with the rest
6721 of this package.  However, you may wish to install such add-ons
6722 elsewhere under a different prefix.
6723
6724 If you do not wish to put everything under a single prefix, that's
6725 ok.  You will be prompted for the individual locations; this siteprefix
6726 is only used to suggest the defaults.
6727
6728 The default should be fine for most people.
6729
6730 EOM
6731 fn=d~+
6732 rp='Installation prefix to use for add-on modules and utilities?'
6733 : XXX Here might be another good place for an installstyle setting.
6734 case "$siteprefix" in
6735 '') dflt=$prefix ;;
6736 *)  dflt=$siteprefix ;;
6737 esac
6738 . ./getfile
6739 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6740 oldsiteprefix=''
6741 case "$siteprefix" in
6742 '') ;;
6743 *)      case "$ans" in
6744         "$prefix") ;;
6745         *) oldsiteprefix="$prefix";;
6746         esac
6747         ;;
6748 esac
6749 siteprefix="$ans"
6750 siteprefixexp="$ansexp"
6751
6752 : determine where site specific libraries go.
6753 : Usual default is /usr/local/lib/perl5/site_perl/$version
6754 : The default "style" setting is made in installstyle.U
6755 : XXX No longer works with Prefixit stuff.
6756 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6757 case "$sitelib" in
6758 '') case "$installstyle" in
6759         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6760         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6761         esac
6762         ;;
6763 *)      dflt="$sitelib"
6764         ;;
6765 esac
6766 $cat <<EOM
6767
6768 The installation process will create a directory for
6769 site-specific extensions and modules.  Most users find it convenient
6770 to place all site-specific files in this directory rather than in the
6771 main distribution directory.
6772
6773 EOM
6774 fn=d~+
6775 rp='Pathname for the site-specific library files?'
6776 . ./getfile
6777 prefixvar=sitelib
6778 . ./setprefixvar
6779 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6780
6781 : Determine list of previous versions to include in @INC
6782 $cat > getverlist <<EOPL
6783 #!$perl5 -w
6784 use File::Basename;
6785 \$api_versionstring = "$api_versionstring";
6786 \$version = "$version";
6787 \$stem = "$sitelib_stem";
6788 \$archname = "$archname";
6789 EOPL
6790         $cat >> getverlist <<'EOPL'
6791 # The list found is store twice for each entry: the original name, and
6792 # the binary broken down version as pack "sss", so sorting is easy and
6793 # unambiguous. This will work for all versions that have a maximum of
6794 # three digit groups, separate by '.'s or '_'s. Names are extended with
6795 # ".0.0" to ensure at least three elements for the pack.
6796 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6797
6798 # Can't have leading @ because metaconfig interprets it as a command!
6799 ;@inc_version_list=();
6800 # XXX Redo to do opendir/readdir?
6801 if (-d $stem) {
6802     chdir($stem);
6803     ;@candidates = map {
6804         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6805     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6806 }
6807 else {
6808     ;@candidates = ();
6809 }
6810
6811 ($pversion, $aversion, $vsn5005) = map {
6812     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6813 foreach $d (@candidates) {
6814     if ($d->[1] lt $pversion) {
6815         if ($d->[1] ge $aversion) {
6816             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6817         }
6818         elsif ($d->[1] ge $vsn5005) {
6819             unshift(@inc_version_list, grep { -d } $d->[0]);
6820         }
6821     }
6822     else {
6823         # Skip newer version.  I.e. don't look in
6824         # 5.7.0 if we're installing 5.6.1.
6825     }
6826 }
6827
6828 if (@inc_version_list) {
6829     print join(' ', @inc_version_list);
6830 }
6831 else {
6832     # Blank space to preserve value for next Configure run.
6833     print " ";
6834 }
6835 EOPL
6836 chmod +x getverlist
6837 case "$inc_version_list" in
6838 '')     if test -x "$perl5$exe_ext"; then
6839                 dflt=`$perl5 getverlist`
6840         else
6841                 dflt='none'
6842         fi
6843         ;;
6844 $undef) dflt='none' ;;
6845 *)  eval dflt=\"$inc_version_list\" ;;
6846 esac
6847 case "$dflt" in
6848 ''|' ') dflt=none ;;
6849 esac
6850 case "$dflt" in
6851 5.005) dflt=none ;;
6852 esac
6853 $cat <<EOM
6854
6855 In order to ease the process of upgrading, this version of perl
6856 can be configured to use modules built and installed with earlier
6857 versions of perl that were installed under $prefix.  Specify here
6858 the list of earlier versions that this version of perl should check.
6859 If Configure detected no earlier versions of perl installed under
6860 $prefix, then the list will be empty.  Answer 'none' to tell perl
6861 to not search earlier versions.
6862
6863 The default should almost always be sensible, so if you're not sure,
6864 just accept the default.
6865 EOM
6866
6867 rp='List of earlier versions to include in @INC?'
6868 . ./myread
6869 case "$ans" in
6870 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6871 *) inc_version_list="$ans" ;;
6872 esac
6873 case "$inc_version_list" in
6874 ''|' ')
6875         inc_version_list_init='0'
6876         d_inc_version_list="$undef"
6877         ;;
6878 *)      inc_version_list_init=`echo $inc_version_list |
6879                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6880         d_inc_version_list="$define"
6881         ;;
6882 esac
6883 $rm -f getverlist
6884
6885 : see if malloc/malloc.h has to be included
6886 set malloc/malloc.h i_mallocmalloc
6887 eval $inhdr
6888
6889 : see if this is a malloc.h system
6890 : we want a real compile instead of Inhdr because some systems have a
6891 : malloc.h that just gives a compile error saying to use stdlib.h instead
6892 echo " "
6893 $cat >try.c <<EOCP
6894 #include <stdlib.h>
6895 #include <malloc.h>
6896 #$i_mallocmalloc I_MALLOCMALLOC
6897 #ifdef I_MALLOCMALLOC
6898 # include <malloc/malloc.h>
6899 #endif
6900
6901 int main () { return 0; }
6902 EOCP
6903 set try
6904 if eval $compile; then
6905     echo "<malloc.h> found." >&4
6906     val="$define"
6907 else
6908     echo "<malloc.h> NOT found." >&4
6909     val="$undef"
6910 fi
6911 $rm_try
6912 set i_malloc
6913 eval $setvar
6914
6915 : check for length of pointer
6916 echo " "
6917 case "$ptrsize" in
6918 '')
6919         echo "Checking to see how big your pointers are..." >&4
6920         $cat >>try.c <<EOCP
6921 #include <stdio.h>
6922 #$i_stdlib I_STDLIB
6923 #ifdef I_STDLIB
6924 #include <stdlib.h>
6925 #endif
6926 int main()
6927 {
6928     printf("%d\n", (int)sizeof(void *));
6929     exit(0);
6930 }
6931 EOCP
6932         set try
6933         if eval $compile_ok; then
6934                 ptrsize=`$run ./try`
6935                 echo "Your pointers are $ptrsize bytes long."
6936         else
6937                 dflt='4'
6938                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6939                 rp="What is the size of a pointer (in bytes)?"
6940                 . ./myread
6941                 ptrsize="$ans"
6942         fi
6943         ;;
6944 esac
6945 $rm_try
6946 case "$use64bitall" in
6947 "$define"|true|[yY]*)
6948         case "$ptrsize" in
6949         4)      cat <<EOM >&4
6950
6951 *** You have chosen a maximally 64-bit build,
6952 *** but your pointers are only 4 bytes wide.
6953 *** Please rerun Configure without -Duse64bitall.
6954 EOM
6955                 case "$d_quad" in
6956                 define)
6957                         cat <<EOM >&4
6958 *** Since you have quads, you could possibly try with -Duse64bitint.
6959 EOM
6960                         ;;
6961                 esac
6962                 cat <<EOM >&4
6963 *** Cannot continue, aborting.
6964
6965 EOM
6966
6967                 exit 1
6968                 ;;
6969         esac
6970         ;;
6971 esac
6972
6973
6974 : determine whether to use malloc wrapping
6975 echo " "
6976 case "$usemallocwrap" in
6977 [yY]*|true|$define)     dflt='y' ;;
6978 [nN]*|false|$undef)     dflt='n' ;;
6979 *)      case "$usedevel" in
6980         [yY]*|true|$define)     dflt='y' ;;
6981         *) dflt='n' ;;
6982         esac
6983         ;;
6984 esac
6985 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6986 . ./myread
6987 usemallocwrap="$ans"
6988 case "$ans" in
6989 y*|true)
6990         usemallocwrap="$define" ;;
6991 *)
6992         usemallocwrap="$undef" ;;
6993 esac
6994
6995 : determine which malloc to compile in
6996 echo " "
6997 case "$usemymalloc" in
6998 [yY]*|true|$define)     dflt='y' ;;
6999 [nN]*|false|$undef)     dflt='n' ;;
7000 *)      case "$ptrsize" in
7001         4) dflt='y' ;;
7002         *) dflt='n' ;;
7003         esac
7004         if test "$useithreads" = "$define"; then dflt='n'; fi
7005         ;;
7006 esac
7007 rp="Do you wish to attempt to use the malloc that comes with $package?"
7008 . ./myread
7009 usemymalloc="$ans"
7010 case "$ans" in
7011 y*|true)
7012         usemymalloc='y'
7013         mallocsrc='malloc.c'
7014         mallocobj="malloc$_o"
7015         d_mymalloc="$define"
7016         case "$libs" in
7017         *-lmalloc*)
7018                 : Remove malloc from list of libraries to use
7019                 echo "Removing unneeded -lmalloc from library list" >&4
7020                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7021                 shift
7022                 libs="$*"
7023                 echo "libs = $libs" >&4
7024                 ;;
7025         esac
7026         ;;
7027 *)
7028         usemymalloc='n'
7029         mallocsrc=''
7030         mallocobj=''
7031         d_mymalloc="$undef"
7032         ;;
7033 esac
7034
7035 : compute the return types of malloc and free
7036 echo " "
7037 $cat >malloc.c <<END
7038 #$i_malloc I_MALLOC
7039 #$i_stdlib I_STDLIB
7040 #include <stdio.h>
7041 #include <sys/types.h>
7042 #ifdef I_MALLOC
7043 #include <malloc.h>
7044 #endif
7045 #ifdef I_STDLIB
7046 #include <stdlib.h>
7047 #endif
7048 #ifdef TRY_MALLOC
7049 void *malloc();
7050 #endif
7051 #ifdef TRY_FREE
7052 void free();
7053 #endif
7054 END
7055 case "$malloctype" in
7056 '')
7057         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7058                 malloctype='void *'
7059         else
7060                 malloctype='char *'
7061         fi
7062         ;;
7063 esac
7064 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7065
7066 case "$freetype" in
7067 '')
7068         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7069                 freetype='void'
7070         else
7071                 freetype='int'
7072         fi
7073         ;;
7074 esac
7075 echo "Your system uses $freetype free(), it would seem." >&4
7076 $rm -f malloc.[co]
7077 : determine where site specific architecture-dependent libraries go.
7078 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7079 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7080 : sitelib may have an optional trailing /share.
7081 case "$sitearch" in
7082 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7083         dflt="$dflt/$archname"
7084         ;;
7085 *)      dflt="$sitearch"
7086         ;;
7087 esac
7088 set sitearch sitearch none
7089 eval $prefixit
7090 $cat <<EOM
7091
7092 The installation process will also create a directory for
7093 architecture-dependent site-specific extensions and modules.
7094
7095 EOM
7096 fn=d~+
7097 rp='Pathname for the site-specific architecture-dependent library files?'
7098 . ./getfile
7099 prefixvar=sitearch
7100 . ./setprefixvar
7101 if $test X"$sitearch" = X"$sitelib"; then
7102         d_sitearch="$undef"
7103 else
7104         d_sitearch="$define"
7105 fi
7106
7107 : Set the vendorprefix variables
7108 $cat <<EOM
7109
7110 The installation process will also create a directory for
7111 vendor-supplied add-ons.  Vendors who supply perl with their system
7112 may find it convenient to place all vendor-supplied files in this
7113 directory rather than in the main distribution directory.  This will
7114 ease upgrades between binary-compatible maintenance versions of perl.
7115
7116 Of course you may also use these directories in whatever way you see
7117 fit.  For example, you might use them to access modules shared over a
7118 company-wide network.
7119
7120 The default answer should be fine for most people.
7121 This causes further questions about vendor add-ons to be skipped
7122 and no vendor-specific directories will be configured for perl.
7123
7124 EOM
7125 rp='Do you want to configure vendor-specific add-on directories?'
7126 case "$usevendorprefix" in
7127 define|true|[yY]*) dflt=y ;;
7128 *)      : User may have set vendorprefix directly on Configure command line.
7129         case "$vendorprefix" in
7130         ''|' ') dflt=n ;;
7131         *)      dflt=y ;;
7132         esac
7133         ;;
7134 esac
7135 . ./myread
7136 case "$ans" in
7137 [yY]*)  fn=d~+
7138         rp='Installation prefix to use for vendor-supplied add-ons?'
7139         case "$vendorprefix" in
7140         '') dflt="$prefix" ;;
7141         *)  dflt=$vendorprefix ;;
7142         esac
7143         . ./getfile
7144         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7145         oldvendorprefix=''
7146         case "$vendorprefix" in
7147         '') ;;
7148         *)      case "$ans" in
7149                 "$prefix") ;;
7150                 *) oldvendorprefix="$prefix";;
7151                 esac
7152                 ;;
7153         esac
7154         usevendorprefix="$define"
7155         vendorprefix="$ans"
7156         vendorprefixexp="$ansexp"
7157         ;;
7158 *)      usevendorprefix="$undef"
7159         vendorprefix=''
7160         vendorprefixexp=''
7161         ;;
7162 esac
7163
7164 : Set the vendorlib variables
7165 case "$vendorprefix" in
7166 '')     d_vendorlib="$undef"
7167         vendorlib=''
7168         vendorlibexp=''
7169         ;;
7170 *)      d_vendorlib="$define"
7171         : determine where vendor-supplied modules go.
7172         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7173         case "$vendorlib" in
7174         '')
7175                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7176                 case "$installstyle" in
7177                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7178                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7179                 esac
7180                 ;;
7181         *)      dflt="$vendorlib"
7182                 ;;
7183         esac
7184         fn=d~+
7185         rp='Pathname for the vendor-supplied library files?'
7186         . ./getfile
7187         vendorlib="$ans"
7188         vendorlibexp="$ansexp"
7189         ;;
7190 esac
7191 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7192 prefixvar=vendorlib
7193 . ./installprefix
7194
7195 : Set the vendorarch variables
7196 case "$vendorprefix" in
7197 '')     d_vendorarch="$undef"
7198         vendorarch=''
7199         vendorarchexp=''
7200         ;;
7201 *)      d_vendorarch="$define"
7202         : determine where vendor-supplied architecture-dependent libraries go.
7203         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7204         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7205         : vendorlib may have an optional trailing /share.
7206         case "$vendorarch" in
7207         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7208                 dflt="$dflt/$archname"
7209                 ;;
7210         *)      dflt="$vendorarch" ;;
7211         esac
7212         fn=d~+
7213         rp='Pathname for vendor-supplied architecture-dependent files?'
7214         . ./getfile
7215         vendorarch="$ans"
7216         vendorarchexp="$ansexp"
7217         ;;
7218 esac
7219 prefixvar=vendorarch
7220 . ./installprefix
7221 if $test X"$vendorarch" = X"$vendorlib"; then
7222         d_vendorarch="$undef"
7223 else
7224         d_vendorarch="$define"
7225 fi
7226
7227 : Final catch-all directories to search
7228 $cat <<EOM
7229
7230 Lastly, you can have perl look in other directories for extensions and
7231 modules in addition to those already specified.
7232 These directories will be searched after
7233         $sitearch
7234         $sitelib
7235 EOM
7236 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7237 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7238 echo ' '
7239 case "$otherlibdirs" in
7240 ''|' ') dflt='none' ;;
7241 *)      dflt="$otherlibdirs" ;;
7242 esac
7243 $cat <<EOM
7244 Enter a colon-separated set of extra paths to include in perl's @INC
7245 search path, or enter 'none' for no extra paths.
7246
7247 EOM
7248
7249 rp='Colon-separated list of additional directories for perl to search?'
7250 . ./myread
7251 case "$ans" in
7252 ' '|''|none)    otherlibdirs=' ' ;;
7253 *)      otherlibdirs="$ans" ;;
7254 esac
7255 case "$otherlibdirs" in
7256 ' ') val=$undef ;;
7257 *)      val=$define ;;
7258 esac
7259 set d_perl_otherlibdirs
7260 eval $setvar
7261
7262 : Cruising for prototypes
7263 echo " "
7264 echo "Checking out function prototypes..." >&4
7265 $cat >prototype.c <<EOCP
7266 #$i_stdlib I_STDLIB
7267 #ifdef I_STDLIB
7268 #include <stdlib.h>
7269 #endif
7270 int main(int argc, char *argv[]) {
7271         exit(0);}
7272 EOCP
7273 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7274         echo "Your C compiler appears to support function prototypes."
7275         val="$define"
7276 else
7277         echo "Your C compiler doesn't seem to understand function prototypes."
7278         val="$undef"
7279 fi
7280 set prototype
7281 eval $setvar
7282 $rm -f prototype*
7283
7284 : Check if ansi2knr is required
7285 case "$prototype" in
7286 "$define") ;;
7287 *)      ansi2knr='ansi2knr'
7288         echo " "
7289         cat <<EOM >&4
7290
7291 $me:  FATAL ERROR:
7292 This version of $package can only be compiled by a compiler that 
7293 understands function prototypes.  Unfortunately, your C compiler 
7294         $cc $ccflags
7295 doesn't seem to understand them.  Sorry about that.
7296
7297 If GNU cc is available for your system, perhaps you could try that instead.  
7298
7299 Eventually, we hope to support building Perl with pre-ANSI compilers.
7300 If you would like to help in that effort, please contact <perlbug@perl.org>.
7301
7302 Aborting Configure now.
7303 EOM
7304         exit 2
7305         ;;
7306 esac
7307
7308 : DTrace support
7309 dflt_dtrace='/usr/sbin/dtrace'
7310 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7311
7312 cat <<EOM
7313
7314 Perl can be built to support DTrace on platforms that support it.
7315 DTrace is a diagnosis and performance analysis tool from Sun.
7316
7317 If this doesn't make any sense to you, just accept the default '$dflt'.
7318 EOM
7319
7320 while $test 1 ; do
7321         case "$usedtrace" in
7322         $define|true|[yY]*)
7323                 dflt='y'
7324                 ;;
7325         ?*)
7326                 dflt='y'
7327                 dflt_dtrace=$usedtrace
7328                 ;;
7329         *)
7330                 dflt='n'
7331                 ;;
7332         esac
7333
7334         rp='Support DTrace if available?'
7335         . ./myread
7336         case "$ans" in
7337         y|Y)    val="$define" ;;
7338         *)      val="$undef" ;;
7339         esac
7340         set usedtrace
7341         eval $setvar
7342
7343         test "X$usedtrace" != "X$define" && break
7344
7345         echo " "
7346         rp='Where is the dtrace executable?'
7347         dflt=$dflt_dtrace
7348         . ./getfile
7349         val="$ans"
7350         set dtrace
7351         eval $setvar
7352
7353         if $test -f $dtrace
7354         then
7355                 if $dtrace -h -s ../perldtrace.d \
7356                         -o perldtrace.tmp >/dev/null 2>&1 \
7357                         && rm -f perldtrace.tmp
7358                 then
7359                         echo " "
7360                         echo "Good: your $dtrace knows about the -h flag."
7361                 else
7362                         cat >&2 <<EOM
7363
7364 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7365 ***
7366 *** Your installed dtrace doesn't support the -h switch to compile a D
7367 *** program into a C header. Can't continue.
7368
7369 EOM
7370                         exit 1
7371                 fi
7372                 break;
7373         fi
7374
7375         case "$fastread" in
7376         yes)
7377                 cat >&2 <<EOM
7378
7379 *** $me:  Fatal Error:  $dtrace not found.
7380 *** Can't continue.
7381
7382 EOM
7383                 exit 1
7384                 ;;
7385         *)
7386                 echo "*** $dtrace was not found."
7387                 echo " "
7388                 ;;
7389         esac
7390 done
7391
7392 : See if we want extra modules installed
7393 echo " "
7394 case "$extras" in
7395 '') dflt='n';;
7396 *) dflt='y';;
7397 esac
7398 cat <<EOM
7399 Perl can be built with extra modules or bundles of modules which
7400 will be fetched from the CPAN and installed alongside Perl.
7401
7402 Notice that you will need access to the CPAN; either via the Internet,
7403 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7404 be asked later to configure the CPAN.pm module which will in turn do
7405 the installation of the rest of the extra modules or bundles.)
7406
7407 Notice also that if the modules require any external software such as
7408 libraries and headers (the libz library and the zlib.h header for the
7409 Compress::Zlib module, for example) you MUST have any such software
7410 already installed, this configuration process will NOT install such
7411 things for you.
7412
7413 If this doesn't make any sense to you, just accept the default '$dflt'.
7414 EOM
7415 rp='Install any extra modules (y or n)?'
7416 . ./myread
7417 case "$ans" in
7418 y|Y)
7419         cat <<EOM
7420
7421 Please list any extra modules or bundles to be installed from CPAN,
7422 with spaces between the names.  The names can be in any format the
7423 'install' command of CPAN.pm will understand.  (Answer 'none',
7424 without the quotes, to install no extra modules or bundles.)
7425 EOM
7426         rp='Extras?'
7427         dflt="$extras"
7428         . ./myread
7429         extras="$ans"
7430 esac
7431 case "$extras" in
7432 ''|'none')
7433         val=''
7434         $rm -f ../extras.lst
7435         ;;
7436 *)      echo "(Saving the list of extras for later...)"
7437         echo "$extras" > ../extras.lst
7438         val="'$extras'"
7439         ;;
7440 esac
7441 set extras
7442 eval $setvar
7443 echo " "
7444
7445 : determine where html pages for programs go
7446 set html1dir html1dir none
7447 eval $prefixit
7448 $cat <<EOM
7449
7450 If you wish to install html files for programs in $spackage, indicate
7451 the appropriate directory here.  To skip installing html files,
7452 answer "none".
7453 EOM
7454 case "$html1dir" in
7455 ''|none|$undef|' ') dflt=none ;;
7456 *) dflt=$html1dir ;;
7457 esac
7458 fn=dn+~
7459 rp="Directory for the main $spackage html pages?"
7460 . ./getfile
7461 prefixvar=html1dir
7462 . ./setprefixvar
7463 : Use ' ' for none so value is preserved next time through Configure
7464 $test X"$html1dir" = "X" && html1dir=' '
7465
7466 : determine where html pages for libraries and modules go
7467 set html3dir html3dir none
7468 eval $prefixit
7469 $cat <<EOM
7470
7471 If you wish to install html files for modules associated with $spackage,
7472 indicate the appropriate directory here.  To skip installing html files,
7473 answer "none".
7474 EOM
7475 : There is no obvious default.  If they have specified html1dir, then
7476 : try to key off that, possibly changing .../html1 into .../html3.
7477 case "$html3dir" in
7478 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7479 *) dflt=$html3dir ;;
7480 esac
7481 fn=dn+~
7482 rp="Directory for the $spackage module html pages?"
7483 . ./getfile
7484 prefixvar=html3dir
7485 . ./setprefixvar
7486 : Use ' ' for none so value is preserved next time through Configure
7487 $test X"$html3dir" = "X" && html3dir=' '
7488
7489 : determine whether to install perl also as /usr/bin/perl
7490
7491 echo " "
7492 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7493         $cat <<EOM
7494 Many scripts expect perl to be installed as /usr/bin/perl.
7495
7496 If you want to, I can install the perl you are about to compile
7497 as /usr/bin/perl (in addition to $bin/perl).
7498 EOM
7499         if test -f /usr/bin/perl; then
7500             $cat <<EOM
7501
7502 However, please note that because you already have a /usr/bin/perl,
7503 overwriting that with a new Perl would very probably cause problems.
7504 Therefore I'm assuming you don't want to do that (unless you insist).
7505
7506 EOM
7507             case "$installusrbinperl" in
7508             "$define"|[yY]*)    dflt='y';;
7509             *)                  dflt='n';;
7510             esac
7511         else
7512             $cat <<EOM
7513
7514 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7515
7516 EOM
7517             case "$installusrbinperl" in
7518             "$undef"|[nN]*)     dflt='n';;
7519             *)                  dflt='y';;
7520             esac
7521         fi
7522         rp="Do you want to install perl as /usr/bin/perl?"
7523         . ./myread
7524         case "$ans" in
7525         [yY]*)  val="$define";;
7526         *)      val="$undef" ;;
7527         esac
7528 else
7529         val="$undef"
7530 fi
7531 set installusrbinperl
7532 eval $setvar
7533
7534 : Check if we are using the GNU C library
7535 echo " "
7536 echo "Checking for GNU C Library..." >&4
7537 cat >try.c <<'EOCP'
7538 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7539    alone are insufficient to distinguish different versions, such as
7540    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7541    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7542 */
7543 #include <stdio.h>
7544 int main(void)
7545 {
7546 #ifdef __GLIBC__
7547 #   ifdef __GLIBC_MINOR__
7548 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7549 #           include <gnu/libc-version.h>
7550             printf("%s\n",  gnu_get_libc_version());
7551 #       else
7552             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7553 #       endif
7554 #   else
7555         printf("%d\n",  __GLIBC__);
7556 #   endif
7557     return 0;
7558 #else
7559     return 1;
7560 #endif
7561 }
7562 EOCP
7563 set try
7564 if eval $compile_ok && $run ./try > glibc.ver; then
7565         val="$define"
7566         gnulibc_version=`$cat glibc.ver`
7567         echo "You are using the GNU C Library version $gnulibc_version"
7568 else
7569         val="$undef"
7570         gnulibc_version=''
7571         echo "You are not using the GNU C Library"
7572 fi
7573 $rm_try glibc.ver
7574 set d_gnulibc
7575 eval $setvar
7576
7577 : see if nm is to be used to determine whether a symbol is defined or not
7578 case "$usenm" in
7579 '')
7580         dflt=''
7581         case "$d_gnulibc" in
7582         "$define")
7583                 echo " "
7584                 echo "nm probably won't work on the GNU C Library." >&4
7585                 dflt=n
7586                 ;;
7587         esac
7588         case "$dflt" in
7589         '')
7590                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7591                         echo " "
7592                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7593                         echo "'nm' won't be sufficient on this system." >&4
7594                         dflt=n
7595                 fi
7596                 ;;
7597         esac
7598         case "$dflt" in
7599         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7600                 if $test $dflt -gt 20; then
7601                         dflt=y
7602                 else
7603                         dflt=n
7604                 fi
7605                 ;;
7606         esac
7607         ;;
7608 *)
7609         case "$usenm" in
7610         true|$define) dflt=y;;
7611         *) dflt=n;;
7612         esac
7613         ;;
7614 esac
7615 $cat <<EOM
7616
7617 I can use $nm to extract the symbols from your C libraries. This
7618 is a time consuming task which may generate huge output on the disk (up
7619 to 3 megabytes) but that should make the symbols extraction faster. The
7620 alternative is to skip the 'nm' extraction part and to compile a small
7621 test program instead to determine whether each symbol is present. If
7622 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7623 this may be the best solution.
7624
7625 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7626
7627 EOM
7628 rp="Shall I use $nm to extract C symbols from the libraries?"
7629 . ./myread
7630 case "$ans" in
7631 [Nn]*) usenm=false;;
7632 *) usenm=true;;
7633 esac
7634
7635 runnm=$usenm
7636 case "$reuseval" in
7637 true) runnm=false;;
7638 esac
7639
7640 : nm options which may be necessary
7641 case "$nm_opt" in
7642 '') if $test -f /mach_boot; then
7643                 nm_opt=''       # Mach
7644         elif $test -d /usr/ccs/lib; then
7645                 nm_opt='-p'     # Solaris (and SunOS?)
7646         elif $test -f /dgux; then
7647                 nm_opt='-p'     # DG-UX
7648         elif $test -f /lib64/rld; then
7649                 nm_opt='-p'     # 64-bit Irix
7650         else
7651                 nm_opt=''
7652         fi;;
7653 esac
7654
7655 : nm options which may be necessary for shared libraries but illegal
7656 : for archive libraries.  Thank you, Linux.
7657 case "$nm_so_opt" in
7658 '')     case "$myuname" in
7659         *linux*|gnu*)
7660                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7661                         nm_so_opt='--dynamic'
7662                 fi
7663                 ;;
7664         esac
7665         ;;
7666 esac
7667
7668 : Figure out where the libc is located
7669 case "$runnm" in
7670 true)
7671 : get list of predefined functions in a handy place
7672 echo " "
7673 case "$libc" in
7674 '') libc=unknown
7675         case "$libs" in
7676         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7677         esac
7678         ;;
7679 esac
7680 case "$libs" in
7681 '') ;;
7682 *)  for thislib in $libs; do
7683         case "$thislib" in
7684         -lc|-lc_s)
7685                 : Handle C library specially below.
7686                 ;;
7687         -l*)
7688                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7689                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7690                         :
7691                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7692                         :
7693                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7694                         :
7695                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7696                         :
7697                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7698                         :
7699                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7700                         :
7701                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7702                         :
7703                 else
7704                         try=''
7705                 fi
7706                 libnames="$libnames $try"
7707                 ;;
7708         *) libnames="$libnames $thislib" ;;
7709         esac
7710         done
7711         ;;
7712 esac
7713 xxx=normal
7714 case "$libc" in
7715 unknown)
7716         set /lib/libc.$so
7717         for xxx in $libpth; do
7718                 $test -r $1 || set $xxx/libc.$so
7719                 : The messy sed command sorts on library version numbers.
7720                 $test -r $1 || \
7721                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7722                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7723                                 h
7724                                 s/[0-9][0-9]*/0000&/g
7725                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7726                                 G
7727                                 s/\n/ /' | \
7728                          $sort | $sed -e 's/^.* //'`
7729                 eval set \$$#
7730         done
7731         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
7732         $test -r $1 || set $sysroot/lib/libsys_s$_a
7733         ;;
7734 *)
7735         set blurfl
7736         ;;
7737 esac
7738 if $test -r "$1"; then
7739         echo "Your (shared) C library seems to be in $1."
7740         libc="$1"
7741 elif $test -r /lib/libc && $test -r /lib/clib; then
7742         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7743         xxx=apollo
7744         libc='/lib/clib /lib/libc'
7745         if $test -r /lib/syslib; then
7746                 echo "(Your math library is in /lib/syslib.)"
7747                 libc="$libc /lib/syslib"
7748         fi
7749 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7750         echo "Your C library seems to be in $libc, as you said before."
7751 elif $test -r $incpath/usr/lib/libc$_a; then
7752         libc=$incpath/usr/lib/libc$_a;
7753         echo "Your C library seems to be in $libc.  That's fine."
7754 elif $test -r /lib/libc$_a; then
7755         libc=/lib/libc$_a;
7756         echo "Your C library seems to be in $libc.  You're normal."
7757 else
7758         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7759                 :
7760         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7761                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7762         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7763                 :
7764         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7765                 :
7766         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7767                 :
7768         else
7769                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7770         fi
7771         if $test -r "$tans"; then
7772                 echo "Your C library seems to be in $tans, of all places."
7773                 libc=$tans
7774         else
7775                 libc='blurfl'
7776         fi
7777 fi
7778 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7779         dflt="$libc"
7780         cat <<EOM
7781
7782 If the guess above is wrong (which it might be if you're using a strange
7783 compiler, or your machine supports multiple models), you can override it here.
7784
7785 EOM
7786 else
7787         dflt=''
7788         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7789         cat >&4 <<EOM
7790 I can't seem to find your C library.  I've looked in the following places:
7791
7792 EOM
7793         $sed 's/^/      /' libpath
7794         cat <<EOM
7795
7796 None of these seems to contain your C library. I need to get its name...
7797
7798 EOM
7799 fi
7800 fn=f
7801 rp='Where is your C library?'
7802 . ./getfile
7803 libc="$ans"
7804
7805 echo " "
7806 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7807 set X `cat libnames`
7808 shift
7809 xxx=files
7810 case $# in 1) xxx=file; esac
7811 echo "Extracting names from the following $xxx for later perusal:" >&4
7812 echo " "
7813 $sed 's/^/      /' libnames >&4
7814 echo " "
7815 $echo $n "This may take a while...$c" >&4
7816
7817 for file in $*; do
7818         case $file in
7819         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7820         *) $nm $nm_opt $file 2>/dev/null;;
7821         esac
7822 done >libc.tmp
7823
7824 $echo $n ".$c"
7825 $grep fprintf libc.tmp > libc.ptf
7826 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7827 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7828 xxx='[ADTSIWi]'
7829 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7830         eval $xscan;\
7831         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7832                 eval $xrun
7833 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7834         eval $xscan;\
7835         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7836                 eval $xrun
7837 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7838         eval $xscan;\
7839         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7840                 eval $xrun
7841 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7842         eval $xscan;\
7843         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7844                 eval $xrun
7845 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7846         eval $xscan;\
7847         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7848                 eval $xrun
7849 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7850         eval $xscan;\
7851         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7852                 eval $xrun
7853 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7854                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7855         eval $xscan;\
7856         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7857                 eval $xrun
7858 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7859         eval $xscan;\
7860         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7861                 eval $xrun
7862 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7863         eval $xscan;\
7864         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7865                 eval $xrun
7866 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7867         eval $xscan;\
7868         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7869                 eval $xrun
7870 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7871         eval $xscan;\
7872         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7873                 eval $xrun
7874 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7875         eval $xscan;\
7876         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7877                 eval $xrun
7878 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7879         eval $xscan;\
7880         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7881                 eval $xrun
7882 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7883         eval $xscan;\
7884         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7885                 eval $xrun
7886 else
7887         $nm -p $* 2>/dev/null >libc.tmp
7888         $grep fprintf libc.tmp > libc.ptf
7889         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7890                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7891         then
7892                 nm_opt='-p'
7893                 eval $xrun
7894         else
7895                 echo " "
7896                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7897                 com=''
7898                 if $ar t $libc > libc.tmp && \
7899                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7900                 then
7901                         for thisname in $libnames $libc; do
7902                                 $ar t $thisname >>libc.tmp
7903                         done
7904                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7905                         echo "Ok." >&4
7906                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7907                         for thisname in $libnames $libc; do
7908                                 $ar tv $thisname >>libc.tmp
7909                                 emximp -o tmp.imp $thisname \
7910                                     2>/dev/null && \
7911                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7912                                     < tmp.imp >>libc.tmp
7913                                 $rm -f tmp.imp
7914                         done
7915                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7916                         echo "Ok." >&4
7917                 else
7918                         echo "$ar didn't seem to work right." >&4
7919                         echo "Maybe this is a Cray...trying bld instead..." >&4
7920                         if  bld t $libc | \
7921                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7922                                 $test -s libc.list
7923                         then
7924                                 for thisname in $libnames; do
7925                                         bld t $libnames | \
7926                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7927                                         $ar t $thisname >>libc.tmp
7928                                 done
7929                                 echo "Ok." >&4
7930                         else
7931                                 echo "That didn't work either.  Giving up." >&4
7932                                 exit 1
7933                         fi
7934                 fi
7935         fi
7936 fi
7937 nm_extract="$com"
7938 case "$PASE" in
7939 define)
7940     echo " "
7941     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7942     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7943     ;;
7944 *)  if $test -f /lib/syscalls.exp; then
7945         echo " "
7946         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7947         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7948                 /lib/syscalls.exp >>libc.list
7949     fi
7950     ;;
7951 esac
7952 ;;
7953 esac
7954 $rm -f libnames libpath
7955
7956 : Check if we are using C++
7957 echo " "
7958 echo "Checking for C++..." >&4
7959 $cat >try.c <<'EOCP'
7960 #include <stdio.h>
7961 int main(void)
7962 {
7963 #ifdef __cplusplus
7964     return 0;
7965 #else
7966     return 1;
7967 #endif
7968 }
7969 EOCP
7970 set try
7971 if eval $compile_ok && $run ./try; then
7972         val="$define"
7973         echo "You are using a C++ compiler."
7974 else
7975         val="$undef"
7976         echo "You are not using a C++ compiler."
7977 fi
7978 $rm_try cplusplus$$
7979 set d_cplusplus
7980 eval $setvar
7981
7982 : is a C symbol defined?
7983 csym='tlook=$1;
7984 case "$3" in
7985 -v) tf=libc.tmp; tdc="";;
7986 -a) tf=libc.tmp; tdc="[]";;
7987 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7988 esac;
7989 case "$d_cplusplus" in
7990     $define)    extern_C="extern \"C\"" ;;
7991     *)          extern_C="extern"       ;;
7992 esac;
7993 tx=yes;
7994 case "$reuseval-$4" in
7995 true-) ;;
7996 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7997 esac;
7998 case "$tx" in
7999 yes)
8000         tval=false;
8001         if $test "$runnm" = true; then
8002                 if $contains $tlook $tf >/dev/null 2>&1; then
8003                         tval=true;
8004                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
8005                         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;
8006                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
8007                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
8008                         $rm_try;
8009                 fi;
8010         else
8011                 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;
8012                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
8013                 $rm_try;
8014         fi;
8015         ;;
8016 *)
8017         case "$tval" in
8018         $define) tval=true;;
8019         *) tval=false;;
8020         esac;
8021         ;;
8022 esac;
8023 eval "$2=$tval"'
8024
8025 : define an is-in-libc? function
8026 inlibc='echo " "; td=$define; tu=$undef;
8027 sym=$1; var=$2; eval "was=\$$2";
8028 tx=yes;
8029 case "$reuseval$was" in
8030 true) ;;
8031 true*) tx=no;;
8032 esac;
8033 case "$tx" in
8034 yes)
8035         set $sym tres -f;
8036         eval $csym;
8037         case "$tres" in
8038         true)
8039                 echo "$sym() found." >&4;
8040                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
8041         *)
8042                 echo "$sym() NOT found." >&4;
8043                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
8044         esac;;
8045 *)
8046         case "$was" in
8047         $define) echo "$sym() found." >&4;;
8048         *) echo "$sym() NOT found." >&4;;
8049         esac;;
8050 esac'
8051
8052 : see if dlopen exists
8053 xxx_runnm="$runnm"
8054 xxx_ccflags="$ccflags"
8055 runnm=false
8056 : with g++ one needs -shared to get is-in-libc to work for dlopen
8057 case "$gccversion" in
8058 '')     ;;
8059 *)      case "$d_cplusplus" in
8060         "$define") ccflags="$ccflags -shared" ;;
8061         esac
8062         ;;
8063 esac
8064 set dlopen d_dlopen
8065 eval $inlibc
8066 runnm="$xxx_runnm"
8067 ccflags="$xxx_ccflags"
8068
8069 : see if this is a unistd.h system
8070 set unistd.h i_unistd
8071 eval $inhdr
8072
8073 : determine which dynamic loading, if any, to compile in
8074 echo " "
8075 dldir="ext/DynaLoader"
8076 case "$usedl" in
8077     $define|y|true)
8078         dflt='y'
8079         usedl="$define"
8080         ;;
8081     $undef|n|false)
8082         dflt='n'
8083         usedl="$undef"
8084         ;;
8085     *)
8086         dflt='n'
8087         case "$d_dlopen" in
8088             $define) dflt='y' ;;
8089         esac
8090         : Does a dl_xxx.xs file exist for this operating system
8091         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8092         ;;
8093 esac
8094 rp="Do you wish to use dynamic loading?"
8095 . ./myread
8096 usedl="$ans"
8097 bin_ELF="$undef"
8098 case "$ans" in
8099     y*) usedl="$define"
8100         case "$dlsrc" in
8101             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8102                     dflt="$dldir/dl_${osname}.xs"
8103                 elif $test "$d_dlopen" = "$define" ; then
8104                     dflt="$dldir/dl_dlopen.xs"
8105                 else
8106                     dflt=''
8107                 fi
8108                 ;;
8109             *)  dflt="$dldir/$dlsrc"
8110                 ;;
8111         esac
8112         echo "The following dynamic loading files are available:"
8113         : Can not go over to $dldir because getfile has path hard-coded in.
8114         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8115         rp="Source file to use for dynamic loading"
8116         fn="fne"
8117         gfpth="$src"
8118         . ./getfile
8119         usedl="$define"
8120         : emulate basename
8121         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8122
8123         $cat << EOM
8124
8125 Some systems may require passing special flags to $cc -c to
8126 compile modules that will be used to create a shared library.
8127 To use no flags, say "none".
8128
8129 EOM
8130         case "$cccdlflags" in
8131             '') case "$gccversion" in
8132                 '') case "$osname" in
8133                         hpux)   dflt='+z' ;;
8134                         next)   dflt='none' ;;
8135                         irix*)  dflt='-KPIC' ;;
8136                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8137                         sunos)  dflt='-pic' ;;
8138                         *)      dflt='none' ;;
8139                     esac
8140                     ;;
8141                 *)  case "$osname" in
8142                         darwin) dflt='none' ;;
8143                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8144                         *)      dflt='-fpic' ;;
8145                     esac ;;
8146                 esac ;;
8147             ' ') dflt='none' ;;
8148             *)   dflt="$cccdlflags" ;;
8149         esac
8150
8151         case "$dflt" in
8152             none) dflt='' ;;
8153         esac
8154
8155         # If -Dsysroot was specified, now's the time to add it
8156         # to cccdlflags
8157         if test "X$sysroot" != X; then
8158             case "$gccversion" in
8159                 '') ;;
8160                 *)  case "$dflt" in
8161                         *sysroot*) ;;
8162                         'undef'|*)
8163                             dflt="$dflt --sysroot=$sysroot" ;;
8164                     esac
8165                     ;;
8166             esac
8167         fi
8168
8169         case "$dflt" in
8170             '') dflt='none';;
8171         esac
8172
8173         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8174         . ./myread
8175         case "$ans" in
8176             none) cccdlflags=' ' ;;
8177             *)    cccdlflags="$ans" ;;
8178         esac
8179
8180         cat << EOM
8181
8182 Some systems use ld to create libraries that can be dynamically loaded,
8183 while other systems (such as those using ELF) use $cc.
8184
8185 EOM
8186
8187 : Determine if this is ELF
8188         $cat >try.c <<EOM
8189 /* Test for whether ELF binaries are produced */
8190 #include <fcntl.h>
8191 #$i_stdlib I_STDLIB
8192 #ifdef I_STDLIB
8193 #include <stdlib.h>
8194 #endif
8195 #$i_unistd I_UNISTD
8196 #ifdef I_UNISTD
8197 #include <unistd.h>
8198 #endif
8199 int main() {
8200     char b[4];
8201     int i = open("a.out",O_RDONLY);
8202     if(i == -1)
8203         exit(1); /* fail */
8204     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8205         exit(0); /* succeed (yes, it is ELF) */
8206     exit(1); /* fail */
8207 }
8208 EOM
8209         if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8210             bin_ELF="$define"
8211         fi
8212         $rm_try
8213
8214         case "$ld" in
8215             '') if $test $bin_ELF = "$define"; then
8216                     cat <<EOM
8217 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8218 EOM
8219                     dflt="$cc"
8220                 else
8221                     echo "I'll use ld to build dynamic libraries."
8222                     dflt='ld'
8223                 fi
8224                 ;;
8225             *)  dflt="$ld"
8226                 ;;
8227         esac
8228
8229         rp="What command should be used to create dynamic libraries?"
8230         . ./myread
8231         ld="$ans"
8232
8233         cat << EOM
8234
8235 Some systems may require passing special flags to $ld to create a
8236 library that can be dynamically loaded.  If your ld flags include
8237 -L/other/path options to locate libraries outside your loader's normal
8238 search path, you may need to specify those -L options here as well.  To
8239 use no flags, say "none".
8240
8241 EOM
8242         case "$lddlflags" in
8243             '') case "$osname" in
8244                     haiku) dflt='-shared' ;;
8245                     hpux) dflt='-b';
8246                           case "$gccversion" in
8247                               '') dflt="$dflt +vnocompatwarnings" ;;
8248                           esac
8249                           ;;
8250                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8251                     next)  dflt='none' ;;
8252                     solaris) # See [perl #66604].
8253                             # On Solaris 11, gcc -m64 on amd64
8254                             # appears not to understand -G.  gcc versions at
8255                             # least as old as 3.4.3 support -shared, so just
8256                             # use that with Solaris 11 and later, but keep
8257                             # the old behavior for older Solaris versions.
8258                             case "$gccversion" in
8259                                 '') dflt='-G' ;;
8260                                 *)  case "$osvers" in
8261                                         2.?|2.10) dflt='-G' ;;
8262                                         *) dflt='-shared' ;;
8263                                     esac
8264                                     ;;
8265                             esac
8266                             ;;
8267                     sunos) dflt='-assert nodefinitions' ;;
8268                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8269                     *)     dflt='none' ;;
8270                 esac
8271                 ;;
8272             *) dflt="$lddlflags" ;;
8273         esac
8274
8275         : Only do this for gcc, since, for example, qcc has no concept
8276         : of --sysroot.
8277         if $test "X$sysroot" != X; then
8278             case "$gccversion" in
8279                 '') ;;
8280                 *)  dflt="$dflt --sysroot $sysroot" ;;
8281             esac
8282         fi
8283
8284         : Try to guess additional flags to pick up local libraries.
8285         : Be careful not to append to a plain 'none'
8286         case "$dflt" in
8287             none) dflt='' ;;
8288         esac
8289         for thisflag in $ldflags; do
8290             case "$thisflag" in
8291                 -L*|-R*|-Wl,-R*)
8292                     case " $dflt " in
8293                         *" $thisflag "*) ;;
8294                         *) dflt="$dflt $thisflag" ;;
8295                     esac
8296                     ;;
8297             esac
8298         done
8299
8300         case "$dflt" in
8301             ''|' ') dflt='none' ;;
8302         esac
8303
8304         case "$ldflags" in
8305             *-fstack-protector*)
8306                 case "$dflt" in
8307                     *-fstack-protector*) ;; # Don't add it again
8308                     *) dflt="$dflt -fstack-protector" ;;
8309                 esac
8310                 ;;
8311         esac
8312
8313         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8314         . ./myread
8315         case "$ans" in
8316             none) lddlflags=' ' ;;
8317             *) lddlflags="$ans" ;;
8318         esac
8319
8320         cat <<EOM
8321
8322 Some systems may require passing special flags to $cc to indicate that
8323 the resulting executable will use dynamic linking.  To use no flags,
8324 say "none".
8325
8326 EOM
8327         case "$ccdlflags" in
8328             '') case "$osname" in
8329                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8330                     next|sunos)      dflt='none'   ;;
8331                     *)               dflt='none'   ;;
8332                 esac ;;
8333             ' ') dflt='none' ;;
8334             *)   dflt="$ccdlflags" ;;
8335         esac
8336         rp="Any special flags to pass to $cc to use dynamic linking?"
8337         . ./myread
8338         case "$ans" in
8339             none) ccdlflags=' ' ;;
8340             *)    ccdlflags="$ans" ;;
8341         esac
8342         ;;
8343
8344     *)  usedl="$undef"
8345         ld='ld'
8346         dlsrc='dl_none.xs'
8347         lddlflags=''
8348         ccdlflags=''
8349         ;;
8350 esac
8351
8352 ld_can_script="$undef"
8353 case "$bin_ELF$usedl" in
8354     $define$define)
8355         # Abuse try.h and a.out names for neat cleanup
8356         $cat >try.c <<EOM
8357 void foo() {}
8358 void bar() {}
8359 EOM
8360         $cat >try.h <<EOM
8361 LIBTEST_42 {
8362  global:
8363   foo;
8364  local: *;
8365  };
8366 EOM
8367         if $cc $cccdlflags $ccdlflags $ccflags \
8368                $ldflags $lddlflags -o a.out try.c \
8369                -Wl,--version-script=try.h >/dev/null 2>&1 \
8370            &&  $test -s a.out ; then
8371             echo "ld supports scripting" >&4
8372             ld_can_script="$define"
8373         else
8374             echo "ld does not support scripting" >&4
8375         fi
8376         $rm_try
8377         ;;
8378 esac
8379
8380 : Do we want a shared libperl?
8381 also=''
8382 case "$usedl" in
8383 $undef)
8384         # No dynamic loading being used, so don't bother even to prompt.
8385         useshrplib='false'
8386         ;;
8387 *)      case "$useshrplib" in
8388         '')     case "$osname" in
8389                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8390                         dflt=y
8391                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8392                         ;;
8393                 next*)
8394                         case "$osvers" in
8395                         4*)     dflt=y
8396                                 also='Building a shared libperl is needed for MAB support.'
8397                                 ;;
8398                         *)      dflt=n
8399                                 ;;
8400                         esac
8401                         ;;
8402                 *)      dflt=n
8403                         ;;
8404                 esac
8405                 ;;
8406         $define|true|[Yy]*)
8407                 dflt=y
8408                 ;;
8409         *)      dflt=n
8410                 ;;
8411         esac
8412         $cat << EOM
8413
8414 The perl executable is normally obtained by linking perlmain.c with
8415 libperl${_a}, any static extensions (usually just DynaLoader), and
8416 any other libraries needed on this system (such as -lm, etc.).  Since
8417 your system supports dynamic loading, it is probably possible to build
8418 a shared libperl.$so.  If you will have more than one executable linked
8419 to libperl.$so, this will significantly reduce the size of each
8420 executable, but it may have a noticeable effect on performance.  The
8421 default is probably sensible for your system.
8422 $also
8423
8424 EOM
8425         rp="Build a shared libperl.$so (y/n)"
8426         . ./myread
8427         case "$ans" in
8428         true|$define|[Yy]*)
8429                 useshrplib='true'  ;;
8430         *)      useshrplib='false' ;;
8431         esac
8432         ;;
8433 esac
8434
8435 case "$useshrplib" in
8436 true)
8437         case "$userelocatableinc" in
8438         true|define)
8439                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8440                 echo "See INSTALL for an explanation why that won't work." >&4
8441                 exit 4
8442                 ;;
8443         esac
8444         case "$libperl" in
8445         '')
8446                 # Figure out a good name for libperl.so.  Since it gets stored in
8447                 # a version-specific architecture-dependent library, the version
8448                 # number isn't really that important, except for making cc/ld happy.
8449                 #
8450                 # A name such as libperl.so.10.1
8451                 majmin="libperl.$so.$patchlevel.$subversion"
8452                 # A name such as libperl.so.100
8453                 majonly=`echo $patchlevel $subversion |
8454                         $awk '{printf "%d%02d", $1, $2}'`
8455                 majonly=libperl.$so.$majonly
8456                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8457                 # rely on figuring it out from the naming of libc.
8458                 case "${osname}${osvers}" in
8459                 next4*)
8460                         dflt=libperl.5.$so
8461                         # XXX How handle the --version stuff for MAB?
8462                         ;;
8463                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8464                         dflt=libperl.$so
8465                         ;;
8466                 cygwin*) # ld links now against the dll directly
8467                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8468                         majonly=`echo $patchlevel $subversion |
8469                                 $awk '{printf "%03d%03d", $1, $2}'`
8470                         majonly=cygperl5.$majonly.$so
8471                         dflt=$majmin
8472                         ;;
8473                 *)      # Try to guess based on whether libc has major.minor.
8474                         case "$libc" in
8475                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8476                         *libc.$so.[0-9]*) dflt=$majonly ;;
8477                         *)      dflt=libperl.$so ;;
8478                         esac
8479                         ;;
8480                 esac
8481                 ;;
8482         *)      dflt=$libperl
8483                 ;;
8484         esac
8485         cat << EOM
8486
8487 I need to select a good name for the shared libperl.  If your system uses
8488 library names with major and minor numbers, then you might want something
8489 like $majmin.  Alternatively, if your system uses a single version
8490 number for shared libraries, then you might want to use $majonly.
8491 Or, your system might be quite happy with a simple libperl.$so.
8492
8493 Since the shared libperl will get installed into a version-specific
8494 architecture-dependent directory, the version number of the shared perl
8495 library probably isn't important, so the default should be o.k.
8496
8497 EOM
8498         rp='What name do you want to give to the shared libperl?'
8499         . ./myread
8500         libperl=$ans
8501         echo "Ok, I'll use $libperl"
8502         ;;
8503 *)
8504         libperl="libperl${_a}"
8505         ;;
8506 esac
8507
8508 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8509 case "$shrpdir" in
8510 '') ;;
8511 *)      $cat >&4 <<EOM
8512 WARNING:  Use of the shrpdir variable for the installation location of
8513 the shared $libperl is not supported.  It was never documented and
8514 will not work in this version.  Let me (perlbug@perl.org)
8515 know of any problems this may cause.
8516
8517 EOM
8518         case "$shrpdir" in
8519         "$archlibexp/CORE")
8520                 $cat >&4 <<EOM
8521 But your current setting of $shrpdir is
8522 the default anyway, so it's harmless.
8523 EOM
8524                 ;;
8525         *)
8526                 $cat >&4 <<EOM
8527 Further, your current attempted setting of $shrpdir
8528 conflicts with the value of $archlibexp/CORE
8529 that installperl will use.
8530 EOM
8531                 ;;
8532         esac
8533         ;;
8534 esac
8535
8536 # How will the perl executable find the installed shared $libperl?
8537 # Add $xxx to ccdlflags.
8538 # If we can't figure out a command-line option, use $shrpenv to
8539 # set env LD_RUN_PATH.  The main perl makefile uses this.
8540 shrpdir=$archlibexp/CORE
8541 xxx=''
8542 tmp_shrpenv=''
8543 if "$useshrplib"; then
8544     case "$osname" in
8545         aix)
8546                 # We'll set it in Makefile.SH...
8547                 ;;
8548         solaris)
8549                 xxx="-R $shrpdir"
8550                 ;;
8551         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8552                 xxx="-Wl,-R$shrpdir"
8553                 ;;
8554         bsdos|linux|irix*|dec_osf|gnu*)
8555                 xxx="-Wl,-rpath,$shrpdir"
8556                 ;;
8557         next)
8558                 # next doesn't like the default...
8559                 ;;
8560         haiku)
8561                 # Haiku doesn't like the default, either.
8562                 ;;
8563         hpux*)
8564                 # hpux doesn't like the default, either.
8565                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8566                 ;;
8567         cygwin)
8568                 # cygwin needs only ldlibpth
8569                 ;;
8570         *)
8571                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8572                 ;;
8573         esac
8574         case "$xxx" in
8575         '') ;;
8576         *)
8577                 # Only add $xxx if it isn't already in ccdlflags.
8578                 case " $ccdlflags " in
8579                 *" $xxx "*)     ;;
8580                 *)      ccdlflags="$ccdlflags $xxx"
8581                         cat <<EOM >&4
8582
8583 Adding $xxx to the flags
8584 passed to $ld so that the perl executable will find the
8585 installed shared $libperl.
8586
8587 EOM
8588                         ;;
8589                 esac
8590                 ;;
8591         esac
8592 fi
8593 # Fix ccdlflags in AIX for building external extensions.
8594 # (For building Perl itself bare -bE:perl.exp is needed,
8595 #  Makefile.SH takes care of this.)
8596 case "$osname" in
8597 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8598 esac
8599 # Respect a hint or command-line value.
8600 case "$shrpenv" in
8601 '') shrpenv="$tmp_shrpenv" ;;
8602 esac
8603 case "$ldlibpthname" in
8604 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8605 none)   ldlibpthname='' ;;
8606 esac
8607
8608 : determine where manual pages are on this system
8609 echo " "
8610 case "$sysman" in
8611 '')
8612         syspath='/usr/share/man/man1 /usr/man/man1'
8613         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8614         syspath="$syspath /usr/man/u_man/man1"
8615         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8616         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8617         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8618         sysman=`./loc . /usr/man/man1 $syspath`
8619         ;;
8620 esac
8621 if $test -d "$sysman"; then
8622         echo "System manual is in $sysman." >&4
8623 else
8624         echo "Could not find manual pages in source form." >&4
8625 fi
8626
8627 : determine where manual pages go
8628 set man1dir man1dir none
8629 eval $prefixit
8630 $cat <<EOM
8631
8632 $spackage has manual pages available in source form.
8633 EOM
8634 case "$nroff" in
8635 nroff)
8636         echo "However, you don't have nroff, so they're probably useless to you."
8637         case "$man1dir" in
8638         '') man1dir="none";;
8639         esac;;
8640 esac
8641 echo "If you don't want the manual sources installed, answer 'none'."
8642 case "$man1dir" in
8643 ' ') dflt=none
8644         ;;
8645 '')
8646         lookpath="$prefixexp/share/man/man1"
8647         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8648         lookpath="$lookpath $prefixexp/man/p_man/man1"
8649         lookpath="$lookpath $prefixexp/man/u_man/man1"
8650         lookpath="$lookpath $prefixexp/man/man.1"
8651         case "$sysman" in
8652         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8653         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8654         esac
8655         set dflt
8656         eval $prefixup
8657         ;;
8658 *)  dflt="$man1dir"
8659         ;;
8660 esac
8661 echo " "
8662 fn=dn+~
8663 rp="Where do the main $spackage manual pages (source) go?"
8664 . ./getfile
8665 if $test "X$man1direxp" != "X$ansexp"; then
8666         installman1dir=''
8667 fi
8668 prefixvar=man1dir
8669 . ./setprefixvar
8670
8671 case "$man1dir" in
8672 '')     man1dir=' '
8673         installman1dir='';;
8674 esac
8675
8676 : What suffix to use on installed man pages
8677
8678 case "$man1dir" in
8679 ' ')
8680         man1ext='0'
8681         ;;
8682 *)
8683         rp="What suffix should be used for the main $spackage man pages?"
8684         case "$man1ext" in
8685         '')     case "$man1dir" in
8686                 *1)  dflt=1 ;;
8687                 *1p) dflt=1p ;;
8688                 *1pm) dflt=1pm ;;
8689                 *l) dflt=l;;
8690                 *n) dflt=n;;
8691                 *o) dflt=o;;
8692                 *p) dflt=p;;
8693                 *C) dflt=C;;
8694                 *L) dflt=L;;
8695                 *L1) dflt=L1;;
8696                 *) dflt=1;;
8697                 esac
8698                 ;;
8699         *)      dflt="$man1ext";;
8700         esac
8701         . ./myread
8702         man1ext="$ans"
8703         ;;
8704 esac
8705
8706 : see if we can have long filenames
8707 echo " "
8708 first=123456789abcdef
8709 $rm -f $first
8710 if (echo hi >$first) 2>/dev/null; then
8711         if $test -f 123456789abcde; then
8712                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8713                 val="$undef"
8714         else
8715                 echo 'You can have filenames longer than 14 characters.'>&4
8716                 val="$define"
8717         fi
8718 else
8719         $cat <<'EOM'
8720 You can't have filenames longer than 14 chars.
8721 You can't even think about them!
8722 EOM
8723         val="$undef"
8724 fi
8725 set d_flexfnam
8726 eval $setvar
8727 $rm -rf 123456789abcde*
8728
8729 : determine where library module manual pages go
8730 set man3dir man3dir none
8731 eval $prefixit
8732 $cat <<EOM
8733
8734 $spackage has manual pages for many of the library modules.
8735 EOM
8736
8737 case "$nroff" in
8738 nroff)
8739         $cat <<'EOM'
8740 However, you don't have nroff, so they're probably useless to you.
8741 EOM
8742         case "$man3dir" in
8743         '') man3dir="none";;
8744         esac;;
8745 esac
8746
8747 case "$d_flexfnam" in
8748 undef)
8749         $cat <<'EOM'
8750 However, your system can't handle the long file names like File::Basename.3.
8751 EOM
8752         case "$man3dir" in
8753         '') man3dir="none";;
8754         esac;;
8755 esac
8756
8757 echo "If you don't want the manual sources installed, answer 'none'."
8758 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8759 case "$man3dir" in
8760 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8761         if $test -d "$privlib/man/man3"; then
8762                 cat <<EOM >&4
8763
8764 WARNING:  Previous versions of perl installed man3 pages into
8765 $privlib/man/man3.  This version will suggest a
8766 new default of $dflt.
8767 EOM
8768                 tdflt=$dflt
8769                 dflt='n'
8770                 rp='Do you wish to preserve the old behavior?(y/n)'
8771                 . ./myread
8772                 case "$ans" in
8773                 y*) dflt="$privlib/man/man3" ;;
8774                 *)  dflt=$tdflt ;;
8775                 esac
8776     fi
8777         ;;
8778 *)      dflt="$man3dir" ;;
8779 esac
8780 case "$dflt" in
8781 ' ') dflt=none ;;
8782 esac
8783 echo " "
8784 fn=dn+~
8785 rp="Where do the $package library man pages (source) go?"
8786 . ./getfile
8787 prefixvar=man3dir
8788 . ./setprefixvar
8789
8790 case "$man3dir" in
8791 '')     man3dir=' '
8792         installman3dir='';;
8793 esac
8794
8795 : What suffix to use on installed man pages
8796 case "$man3dir" in
8797 ' ')
8798         man3ext='0'
8799         ;;
8800 *)
8801         rp="What suffix should be used for the $package library man pages?"
8802         case "$man3ext" in
8803         '')     case "$man3dir" in
8804                 *3)  dflt=3 ;;
8805                 *3p) dflt=3p ;;
8806                 *3pm) dflt=3pm ;;
8807                 *l) dflt=l;;
8808                 *n) dflt=n;;
8809                 *o) dflt=o;;
8810                 *p) dflt=p;;
8811                 *C) dflt=C;;
8812                 *L) dflt=L;;
8813                 *L3) dflt=L3;;
8814                 *) dflt=3;;
8815                 esac
8816                 ;;
8817         *)      dflt="$man3ext";;
8818         esac
8819         . ./myread
8820         man3ext="$ans"
8821         ;;
8822 esac
8823
8824 : see if we have to deal with yellow pages, now NIS.
8825 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8826         if $test -f /usr/etc/nibindd; then
8827                 echo " "
8828                 echo "I'm fairly confident you're on a NeXT."
8829                 echo " "
8830                 rp='Do you get the hosts file via NetInfo?'
8831                 dflt=y
8832                 case "$hostcat" in
8833                 nidump*) ;;
8834                 '') ;;
8835                 *) dflt=n;;
8836                 esac
8837                 . ./myread
8838                 case "$ans" in
8839                 y*) hostcat='nidump hosts .';;
8840                 *)      case "$hostcat" in
8841                         nidump*) hostcat='';;
8842                         esac
8843                         ;;
8844                 esac
8845         fi
8846         case "$hostcat" in
8847         nidump*) ;;
8848         *)
8849                 case "$hostcat" in
8850                 *ypcat*) dflt=y;;
8851                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8852                                 dflt=y
8853                         else
8854                                 dflt=n
8855                         fi;;
8856                 *) dflt=n;;
8857                 esac
8858                 echo " "
8859                 rp='Are you getting the hosts file via yellow pages?'
8860                 . ./myread
8861                 case "$ans" in
8862                 y*) hostcat='ypcat hosts';;
8863                 *) hostcat='cat /etc/hosts';;
8864                 esac
8865                 ;;
8866         esac
8867 fi
8868 case "$hostcat" in
8869 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8870 esac
8871 case "$groupcat" in
8872 '') test -f /etc/group && groupcat='cat /etc/group';;
8873 esac
8874 case "$passcat" in
8875 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8876 esac
8877
8878 : now get the host name
8879 echo " "
8880 echo "Figuring out host name..." >&4
8881 case "$myhostname" in
8882 '') cont=true
8883         echo 'Maybe "hostname" will work...'
8884         if tans=`sh -c hostname 2>&1` ; then
8885                 myhostname=$tans
8886                 phostname=hostname
8887                 cont=''
8888         fi
8889         ;;
8890 *) cont='';;
8891 esac
8892 if $test "$cont"; then
8893         if ./xenix; then
8894                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8895                 if tans=`cat /etc/systemid 2>&1` ; then
8896                         myhostname=$tans
8897                         phostname='cat /etc/systemid'
8898                         echo "Whadyaknow.  Xenix always was a bit strange..."
8899                         cont=''
8900                 fi
8901         elif $test -r /etc/systemid; then
8902                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8903         fi
8904 fi
8905 if $test "$cont"; then
8906         echo 'No, maybe "uuname -l" will work...'
8907         if tans=`sh -c 'uuname -l' 2>&1` ; then
8908                 myhostname=$tans
8909                 phostname='uuname -l'
8910         else
8911                 echo 'Strange.  Maybe "uname -n" will work...'
8912                 if tans=`sh -c 'uname -n' 2>&1` ; then
8913                         myhostname=$tans
8914                         phostname='uname -n'
8915                 else
8916                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8917                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8918                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8919                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8920                         else
8921                                 case "$myhostname" in
8922                                 '') echo "Does this machine have an identity crisis or something?"
8923                                         phostname='';;
8924                                 *)
8925                                         echo "Well, you said $myhostname before..."
8926                                         phostname='echo $myhostname';;
8927                                 esac
8928                         fi
8929                 fi
8930         fi
8931 fi
8932 case "$myhostname" in
8933 '') myhostname=noname ;;
8934 esac
8935 : you do not want to know about this
8936 set $myhostname
8937 myhostname=$1
8938
8939 : verify guess
8940 if $test "$myhostname" ; then
8941         dflt=y
8942         rp='Your host name appears to be "'$myhostname'".'" Right?"
8943         . ./myread
8944         case "$ans" in
8945         y*) ;;
8946         *) myhostname='';;
8947         esac
8948 fi
8949
8950 : bad guess or no guess
8951 while $test "X$myhostname" = X ; do
8952         dflt=''
8953         rp="Please type the (one word) name of your host:"
8954         . ./myread
8955         myhostname="$ans"
8956 done
8957
8958 : translate upper to lower if necessary
8959 case "$myhostname" in
8960 *[A-Z]*)
8961         echo "(Normalizing case in your host name)"
8962         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8963         ;;
8964 esac
8965
8966 case "$myhostname" in
8967 *.*)
8968         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8969         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8970         echo "(Trimming domain name from host name--host name is now $myhostname)"
8971         ;;
8972 *) case "$mydomain" in
8973         '')
8974                 {
8975                         test "X$hostcat" = "Xypcat hosts" &&
8976                         ypmatch "$myhostname" hosts 2>/dev/null |\
8977                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8978                         $test -s hosts
8979                 } || {
8980                         test "X$hostcat" != "X" &&
8981                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8982                                         /[       ]$myhostname[  . ]/p" > hosts
8983                 }
8984                 tmp_re="[       . ]"
8985                 if $test -f hosts; then
8986                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8987                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8988                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8989                                 hosts | $sort | $uniq | \
8990                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8991                         case `$echo X$dflt` in
8992                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8993                                 dflt=.
8994                                 ;;
8995                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8996                                 ;;
8997                         esac
8998                 else
8999                         echo "(I cannot locate a hosts database anywhere)"
9000                         dflt=.
9001                 fi
9002                 case "$dflt" in
9003                 .)
9004                         tans=`./loc resolv.conf X /etc /usr/etc`
9005                         if $test -f "$tans"; then
9006                                 echo "(Attempting domain name extraction from $tans)"
9007                                 dflt=.`$sed -n -e 's/   / /g' \
9008                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9009                                   -e 1q 2>/dev/null`
9010                                 case "$dflt" in
9011                                 .) dflt=.`$sed -n -e 's/        / /g' \
9012                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9013                                      -e 1q 2>/dev/null`
9014                                         ;;
9015                                 esac
9016                         fi
9017                         ;;
9018                 esac
9019                 case "$dflt" in
9020                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9021                         dflt=.`sh -c domainname 2>/dev/null`
9022                         case "$dflt" in
9023                         '') dflt='.';;
9024                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9025                         esac
9026                         ;;
9027                 esac
9028                 case "$dflt$osname" in
9029                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9030                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9031                         ;;
9032                 esac
9033                 case "$dflt" in
9034                 .) echo "(Lost all hope -- silly guess then)"
9035                         dflt='.nonet'
9036                         ;;
9037                 esac
9038                 $rm -f hosts
9039                 ;;
9040         *) dflt="$mydomain";;
9041         esac;;
9042 esac
9043 echo " "
9044 rp="What is your domain name?"
9045 . ./myread
9046 tans="$ans"
9047 case "$ans" in
9048 '') ;;
9049 .*) ;;
9050 *) tans=".$tans";;
9051 esac
9052 mydomain="$tans"
9053
9054 : translate upper to lower if necessary
9055 case "$mydomain" in
9056 *[A-Z]*)
9057         echo "(Normalizing case in your domain name)"
9058         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9059         ;;
9060 esac
9061
9062 : a little sanity check here
9063 case "$phostname" in
9064 '') ;;
9065 *)
9066         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9067         $myhostname$mydomain|$myhostname) ;;
9068         *)
9069                 case "$phostname" in
9070                 sed*)
9071                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9072                         ;;
9073                 *)
9074                         echo "(That doesn't agree with your $phostname command, by the way.)"
9075                         ;;
9076                 esac
9077         ;;
9078         esac
9079         ;;
9080 esac
9081
9082 : determine the e-mail address of the user who is running us
9083 $cat <<EOM
9084
9085 I need to get your e-mail address in Internet format if possible, i.e.
9086 something like user@host.domain. Please answer accurately since I have
9087 no easy means to double check it. The default value provided below
9088 is most probably close to reality but may not be valid from outside
9089 your organization...
9090
9091 EOM
9092 cont=x
9093 while test "$cont"; do
9094         case "$MAILDOMAIN" in
9095         '')
9096                 if $test -s /etc/mailname; then
9097                         maildomain=`$cat /etc/mailname`
9098                 else
9099                         maildomain="$myhostname$mydomain"
9100                 fi
9101                 ;;
9102         *)  maildomain="$MAILDOMAIN";;
9103         esac
9104         case "$cf_email" in
9105         '') dflt="$cf_by@$maildomain";;
9106         *)  dflt="$cf_email";;
9107         esac
9108         rp='What is your e-mail address?'
9109         . ./myread
9110         cf_email="$ans"
9111         case "$cf_email" in
9112         *@*.*) cont='' ;;
9113         *)
9114                 rp='Address does not look like an Internet one.  Use it anyway?'
9115                 case "$fastread" in
9116                 yes) dflt=y ;;
9117                 *) dflt=n ;;
9118                 esac
9119                 . ./myread
9120                 case "$ans" in
9121                 y*) cont='' ;;
9122                 *) echo " " ;;
9123                 esac
9124                 ;;
9125         esac
9126 done
9127
9128 : Ask e-mail of administrator
9129 $cat <<EOM
9130
9131 If you or somebody else will be maintaining perl at your site, please
9132 fill in the correct e-mail address here so that they may be contacted
9133 if necessary. Currently, the "perlbug" program included with perl
9134 will send mail to this address in addition to perlbug@perl.org. You may
9135 enter "none" for no administrator.
9136
9137 EOM
9138 case "$perladmin" in
9139 '') dflt="$cf_email";;
9140 *) dflt="$perladmin";;
9141 esac
9142 rp='Perl administrator e-mail address'
9143 . ./myread
9144 perladmin="$ans"
9145
9146 : determine whether to only install version-specific parts.
9147 echo " "
9148 $cat <<EOM
9149 Do you want to install only the version-specific parts of the perl
9150 distribution?  Usually you do *not* want to do this.
9151 EOM
9152 case "$versiononly" in
9153 "$define"|[Yy]*|true) dflt='y' ;;
9154 *) dflt='n';
9155 esac
9156 rp="Do you want to install only the version-specific parts of perl?"
9157 . ./myread
9158 case "$ans" in
9159 [yY]*)  val="$define";;
9160 *)      val="$undef" ;;
9161 esac
9162 set versiononly
9163 eval $setvar
9164
9165 case "$versiononly" in
9166 "$define") inc_version_list=''
9167            inc_version_list_init=0
9168            ;;
9169 esac
9170
9171 : figure out how to guarantee perl startup
9172 : XXX Note that this currently takes advantage of the bug that binexp ignores
9173 :     the Configure -Dinstallprefix setting, which in turn means that under
9174 :     relocatable @INC, initialinstalllocation is what binexp started as.
9175 case "$startperl" in
9176 '')
9177         case "$sharpbang" in
9178         *!)
9179                 $cat <<EOH
9180
9181 I can use the #! construct to start perl on your system. This will
9182 make startup of perl scripts faster, but may cause problems if you
9183 want to share those scripts and perl is not in a standard place
9184 ($initialinstalllocation/perl) on all your platforms. The alternative
9185 is to force a shell by starting the script with a single ':' character.
9186
9187 EOH
9188                 case "$versiononly" in
9189                 "$define")      dflt="$initialinstalllocation/perl$version";;
9190                 *)              dflt="$initialinstalllocation/perl";;
9191                 esac
9192                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9193                 . ./myread
9194                 case "$ans" in
9195                 none)   startperl=": # use perl";;
9196                 *)      startperl="#!$ans"
9197                         if $test 30 -lt `echo "$ans" | wc -c`; then
9198                                 $cat >&4 <<EOM
9199
9200 WARNING:  Some systems limit the #! command to 32 characters.
9201 If you experience difficulty running Perl scripts with #!, try
9202 installing Perl in a directory with a shorter pathname.
9203
9204 EOM
9205                         fi ;;
9206                 esac
9207                 ;;
9208         *) startperl=": # use perl"
9209                 ;;
9210         esac
9211         ;;
9212 esac
9213 echo "I'll use $startperl to start perl scripts."
9214
9215 : figure best path for perl in scripts
9216 case "$perlpath" in
9217 '')
9218         case "$versiononly" in
9219         "$define")      perlpath="$initialinstalllocation/perl$version";;
9220         *)              perlpath="$initialinstalllocation/perl";;
9221         esac
9222         case "$startperl" in
9223         *!*) ;;
9224         *)
9225                 $cat <<EOH
9226
9227 I will use the "eval 'exec'" idiom to start Perl on your system.
9228 I can use the full path of your Perl binary for this purpose, but
9229 doing so may cause problems if you want to share those scripts and
9230 Perl is not always in a standard place ($initialinstalllocation/perl).
9231
9232 EOH
9233                 dflt="$initialinstalllocation/perl"
9234                 rp="What path shall I use in \"eval 'exec'\"?"
9235                 . ./myread
9236                 perlpath="$ans"
9237                 ;;
9238         esac
9239         ;;
9240 esac
9241 case "$startperl" in
9242 *!*)    ;;
9243 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9244 esac
9245
9246 : determine where public executable scripts go
9247 set scriptdir scriptdir
9248 eval $prefixit
9249 case "$scriptdir" in
9250 '')
9251         dflt="$bin"
9252         : guess some guesses
9253         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9254         $test -d /usr/share/bin     && dflt=/usr/share/bin
9255         $test -d /usr/local/script  && dflt=/usr/local/script
9256         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9257         $test -d $prefixexp/script  && dflt=$prefixexp/script
9258         set dflt
9259         eval $prefixup
9260         ;;
9261 *)  dflt="$scriptdir"
9262         ;;
9263 esac
9264 $cat <<EOM
9265
9266 Some installations have a separate directory just for executable scripts so
9267 that they can mount it across multiple architectures but keep the scripts in
9268 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9269 Or you might just lump your scripts in with all your other executables.
9270
9271 EOM
9272 fn=d~
9273 rp='Where do you keep publicly executable scripts?'
9274 . ./getfile
9275 if $test "X$ansexp" != "X$scriptdirexp"; then
9276         installscript=''
9277 fi
9278 installscriptdir=''
9279 prefixvar=scriptdir
9280 . ./setprefixvar
9281 : A little fix up for an irregularly named variable.
9282 installscript="$installscriptdir"
9283
9284 : determine where add-on public executables go
9285 case "$sitebin" in
9286 '')     dflt=$siteprefix/bin ;;
9287 *)      dflt=$sitebin ;;
9288 esac
9289 fn=d~
9290 rp='Pathname where the add-on public executables should be installed?'
9291 . ./getfile
9292 prefixvar=sitebin
9293 . ./setprefixvar
9294
9295 : determine where add-on html pages go
9296 : There is no standard location, so try to copy the previously-selected
9297 : directory structure for the core html pages.
9298 case "$sitehtml1dir" in
9299 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9300 *)     dflt=$sitehtml1dir ;;
9301 esac
9302 case "$dflt" in
9303 ''|' ') dflt=none ;;
9304 esac
9305 fn=dn+~
9306 rp='Pathname where the site-specific html pages should be installed?'
9307 . ./getfile
9308 prefixvar=sitehtml1dir
9309 . ./setprefixvar
9310
9311 : determine where add-on library html pages go
9312 : There is no standard location, so try to copy the previously-selected
9313 : directory structure for the core html pages.
9314 case "$sitehtml3dir" in
9315 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9316 *)     dflt=$sitehtml3dir ;;
9317 esac
9318 case "$dflt" in
9319 ''|' ') dflt=none ;;
9320 esac
9321 fn=dn+~
9322 rp='Pathname where the site-specific library html pages should be installed?'
9323 . ./getfile
9324 prefixvar=sitehtml3dir
9325 . ./setprefixvar
9326
9327 : determine where add-on manual pages go
9328 case "$siteman1dir" in
9329 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9330 *)      dflt=$siteman1dir ;;
9331 esac
9332 case "$dflt" in
9333 ''|' ') dflt=none ;;
9334 esac
9335 fn=dn+~
9336 rp='Pathname where the site-specific manual pages should be installed?'
9337 . ./getfile
9338 prefixvar=siteman1dir
9339 . ./setprefixvar
9340
9341 : determine where add-on library man pages go
9342 case "$siteman3dir" in
9343 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9344 *)      dflt=$siteman3dir ;;
9345 esac
9346 case "$dflt" in
9347 ''|' ') dflt=none ;;
9348 esac
9349 fn=dn+~
9350 rp='Pathname where the site-specific library manual pages should be installed?'
9351 . ./getfile
9352 prefixvar=siteman3dir
9353 . ./setprefixvar
9354
9355 : determine where add-on public executable scripts go
9356 case "$sitescript" in
9357 '')     dflt=$siteprefix/script
9358         $test -d $dflt || dflt=$sitebin ;;
9359 *)  dflt="$sitescript" ;;
9360 esac
9361 fn=d~+
9362 rp='Pathname where add-on public executable scripts should be installed?'
9363 . ./getfile
9364 prefixvar=sitescript
9365 . ./setprefixvar
9366
9367 : see if backtrace exists
9368 set backtrace d_backtrace
9369 eval $inlibc
9370
9371 : add flags if using c backtrace
9372 case "$usecbacktrace" in
9373   "") usecbacktrace=$undef ;;
9374   [yY]*|true|$define)
9375     case "$d_backtrace" in
9376       [yY]*|true|$define)
9377         case " $ccflags " in
9378           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9379           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9380           esac
9381         ;;
9382       *)
9383         echo "This system does not support backtrace" >&4
9384         usecbacktrace=$undef
9385         ;;
9386       esac
9387     ;;
9388   esac
9389
9390 : Check if faststdio is requested and available
9391 case "$usefaststdio" in
9392 $define|true|[yY]*|'')
9393         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9394         case "$xversion" in
9395         [68])   dflt='y' ;;
9396         *)      dflt='n' ;;
9397         esac
9398         ;;
9399 *) dflt='n';;
9400 esac
9401 cat <<EOM
9402
9403 Perl can be built to use 'fast stdio', which means using the stdio
9404 library but also directly manipulating the stdio buffers to enable
9405 faster I/O.  Using stdio is better for backward compatibility (especially
9406 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9407 interface has been preferred instead of stdio.
9408
9409 If this doesn't make any sense to you, just accept the default '$dflt'.
9410 EOM
9411 rp='Use the "fast stdio" if available?'
9412 . ./myread
9413 case "$ans" in
9414 y|Y)    val="$define" ;;
9415 *)      val="$undef" ;;
9416 esac
9417 set usefaststdio
9418 eval $setvar
9419
9420
9421 : define an is-a-typedef? function
9422 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9423 case "$inclist" in
9424 "") inclist="sys/types.h";;
9425 esac;
9426 eval "varval=\$$var";
9427 case "$varval" in
9428 "")
9429         $rm -f temp.c;
9430         for inc in $inclist; do
9431                 echo "#include <$inc>" >>temp.c;
9432         done;
9433         echo "#ifdef $type" >> temp.c;
9434         echo "printf(\"We have $type\");" >> temp.c;
9435         echo "#endif" >> temp.c;
9436         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9437         if $contains $type temp.E >/dev/null 2>&1; then
9438                 eval "$var=\$type";
9439         else
9440                 eval "$var=\$def";
9441         fi;
9442         $rm -f temp.?;;
9443 *) eval "$var=\$varval";;
9444 esac'
9445
9446 : define an is-a-typedef? function that prompts if the type is not available.
9447 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9448 case "$inclist" in
9449 "") inclist="sys/types.h";;
9450 esac;
9451 eval "varval=\$$var";
9452 case "$varval" in
9453 "")
9454         $rm -f temp.c;
9455         for inc in $inclist; do
9456                 echo "#include <$inc>" >>temp.c;
9457         done;
9458         echo "#ifdef $type" >> temp.c;
9459         echo "printf(\"We have $type\");" >> temp.c;
9460         echo "#endif" >> temp.c;
9461         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9462         echo " " ;
9463         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9464         if $contains $type temp.E >/dev/null 2>&1; then
9465                 echo "$type found." >&4;
9466                 eval "$var=\$type";
9467         else
9468                 echo "$type NOT found." >&4;
9469                 dflt="$def";
9470                 . ./myread ;
9471                 eval "$var=\$ans";
9472         fi;
9473         $rm -f temp.?;;
9474 *) eval "$var=\$varval";;
9475 esac'
9476
9477 : see what type lseek is declared as in the kernel
9478 rp="What is the type used for lseek's offset on this system?"
9479 set off_t lseektype long stdio.h sys/types.h
9480 eval $typedef_ask
9481
9482 echo " "
9483 echo "Checking to see how big your file offsets are..." >&4
9484 $cat >try.c <<EOCP
9485 #include <sys/types.h>
9486 #include <stdio.h>
9487 int main()
9488 {
9489     printf("%d\n", (int)sizeof($lseektype));
9490     return(0);
9491 }
9492 EOCP
9493 set try
9494 if eval $compile_ok; then
9495         lseeksize=`$run ./try`
9496         echo "Your file offsets are $lseeksize bytes long."
9497 else
9498         dflt=$longsize
9499         echo " "
9500         echo "(I can't seem to compile the test program.  Guessing...)"
9501         rp="What is the size of your file offsets (in bytes)?"
9502         . ./myread
9503         lseeksize="$ans"
9504 fi
9505 $rm_try
9506
9507 : see what type file positions are declared as in the library
9508 rp="What is the type for file position used by fsetpos()?"
9509 set fpos_t fpostype long stdio.h sys/types.h
9510 eval $typedef_ask
9511
9512 : Check size for Fpos_t
9513 echo " "
9514 case "$fpostype" in
9515 *_t) zzz="$fpostype"    ;;
9516 *)   zzz="fpos_t"       ;;
9517 esac
9518 echo "Checking the size of $zzz..." >&4
9519 cat > try.c <<EOCP
9520 #include <sys/types.h>
9521 #include <stdio.h>
9522 #$i_stdlib I_STDLIB
9523 #ifdef I_STDLIB
9524 #include <stdlib.h>
9525 #endif
9526 int main() {
9527     printf("%d\n", (int)sizeof($fpostype));
9528     exit(0);
9529 }
9530 EOCP
9531 set try
9532 if eval $compile_ok; then
9533         yyy=`$run ./try`
9534         case "$yyy" in
9535         '')     fpossize=4
9536                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9537                 ;;
9538         *)      fpossize=$yyy
9539                 echo "Your $zzz is $fpossize bytes long."
9540                 ;;
9541         esac
9542 else
9543         dflt="$longsize"
9544         echo " " >&4
9545         echo "(I can't compile the test program.  Guessing...)" >&4
9546         rp="What is the size of your file positions (in bytes)?"
9547         . ./myread
9548         fpossize="$ans"
9549 fi
9550
9551 : Check for large file support
9552 # Backward compatibility (uselfs is deprecated).
9553 case "$uselfs" in
9554 "$define"|true|[yY]*)
9555         cat <<EOM >&4
9556
9557 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9558 EOM
9559         uselargefiles="$define"
9560         ;;
9561 esac
9562
9563 case "$lseeksize:$fpossize" in
9564 8:8) cat <<EOM
9565
9566 You can have files larger than 2 gigabytes.
9567 EOM
9568    val="$define" ;;
9569 *)    case "$uselargefiles" in
9570    "$undef"|false|[nN]*) dflt='n' ;;
9571    *)   dflt='y' ;;
9572    esac
9573    cat <<EOM
9574
9575 Perl can be built to understand large files (files larger than 2 gigabytes)
9576 on some systems.  To do so, Configure can be run with -Duselargefiles.
9577
9578 If this doesn't make any sense to you, just accept the default '$dflt'.
9579 EOM
9580    rp='Try to understand large files, if available?'
9581    . ./myread
9582    case "$ans" in
9583    y|Y)         val="$define" ;;
9584    *)           val="$undef"  ;;
9585    esac
9586    ;;
9587 esac
9588 set uselargefiles
9589 eval $setvar
9590 : Look for a hint-file generated 'call-back-unit'.  If the
9591 : user has specified that a large files perl is to be built,
9592 : we may need to set or change some other defaults.
9593 if $test -f uselargefiles.cbu; then
9594         echo "Your platform has some specific hints regarding large file builds, using them..."
9595         . ./uselargefiles.cbu
9596 fi
9597 case "$uselargefiles" in
9598 "$define")
9599         if $test -f uselargefiles.cbu; then
9600                 echo " "
9601                 echo "Rechecking to see how big your file offsets are..." >&4
9602                 $cat >try.c <<EOCP
9603 #include <sys/types.h>
9604 #include <stdio.h>
9605 int main()
9606 {
9607     printf("%d\n", (int)sizeof($lseektype));
9608     return(0);
9609 }
9610 EOCP
9611                 set try
9612                 if eval $compile_ok; then
9613                         lseeksize=`$run ./try`
9614                         $echo "Your file offsets are now $lseeksize bytes long."
9615                 else
9616                         dflt="$lseeksize"
9617                         echo " "
9618                         echo "(I can't seem to compile the test program.  Guessing...)"
9619                         rp="What is the size of your file offsets (in bytes)?"
9620                         . ./myread
9621                         lseeksize="$ans"
9622                 fi
9623                 case "$fpostype" in
9624                 *_t) zzz="$fpostype"    ;;
9625                 *)   zzz="fpos_t"       ;;
9626                 esac
9627                 $echo $n "Rechecking the size of $zzz...$c" >&4
9628                 $cat > try.c <<EOCP
9629 #include <sys/types.h>
9630 #include <stdio.h>
9631 #$i_stdlib I_STDLIB
9632 #ifdef I_STDLIB
9633 #include <stdlib.h>
9634 #endif
9635 int main() {
9636     printf("%d\n", (int)sizeof($fpostype));
9637     return(0);
9638 }
9639 EOCP
9640                 set try
9641                 if eval $compile_ok; then
9642                         yyy=`$run ./try`
9643                         dflt="$lseeksize"
9644                         case "$yyy" in
9645                         '')     echo " "
9646                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9647                                 ;;
9648                         *)      fpossize=$yyy
9649                                 echo " $fpossize bytes." >&4
9650                                 ;;
9651                         esac
9652                 else
9653                         dflt="$fpossize"
9654                         echo " "
9655                         echo "(I can't compile the test program.  Guessing...)" >&4
9656                         rp="What is the size of your file positions (in bytes)?"
9657                         . ./myread
9658                         fpossize="$ans"
9659                 fi
9660                 $rm_try
9661         fi
9662         ;;
9663 esac
9664
9665 : Check if we want perlio
9666 useperlio="$define"
9667
9668 : Set the vendorbin variables
9669 case "$vendorprefix" in
9670 '')     d_vendorbin="$undef"
9671         vendorbin=''
9672         vendorbinexp=''
9673         ;;
9674 *)      d_vendorbin="$define"
9675         : determine where vendor-supplied executables go.
9676         case "$vendorbin" in
9677         '') dflt=$vendorprefix/bin ;;
9678         *)      dflt="$vendorbin" ;;
9679         esac
9680         fn=d~+
9681         rp='Pathname for the vendor-supplied executables directory?'
9682         . ./getfile
9683         vendorbin="$ans"
9684         vendorbinexp="$ansexp"
9685         ;;
9686 esac
9687 prefixvar=vendorbin
9688 . ./installprefix
9689
9690 : Set the vendorhtml1dir variables
9691 case "$vendorprefix" in
9692 '')     vendorhtml1dir=''
9693         vendorhtml1direxp=''
9694         ;;
9695 *)      : determine where vendor-supplied html pages go.
9696         : There is no standard location, so try to copy the previously-selected
9697         : directory structure for the core html pages.
9698         : XXX Better default suggestions would be welcome.
9699         case "$vendorhtml1dir" in
9700         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9701         *)      dflt=$vendorhtml1dir ;;
9702         esac
9703         case "$dflt" in
9704         ''|' ') dflt=none ;;
9705         esac
9706         fn=dn+~
9707         rp='Pathname for the vendor-supplied html pages?'
9708         . ./getfile
9709         vendorhtml1dir="$ans"
9710         vendorhtml1direxp="$ansexp"
9711         ;;
9712 esac
9713 : Use ' ' for none so value is preserved next time through Configure
9714 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9715 prefixvar=vendorhtml1dir
9716 . ./installprefix
9717
9718 : Set the vendorhtml3dir variables
9719 case "$vendorprefix" in
9720 '')     vendorhtml3dir=''
9721         vendorhtml3direxp=''
9722         ;;
9723 *)      : determine where vendor-supplied module html pages go.
9724         : There is no standard location, so try to copy the previously-selected
9725         : directory structure for the core html pages.
9726         : XXX Better default suggestions would be welcome.
9727         case "$vendorhtml3dir" in
9728         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9729         *)      dflt=$vendorhtml3dir ;;
9730         esac
9731         case "$dflt" in
9732         ''|' ') dflt=none ;;
9733         esac
9734         fn=dn+~
9735         rp='Pathname for the vendor-supplied html pages?'
9736         . ./getfile
9737         vendorhtml3dir="$ans"
9738         vendorhtml3direxp="$ansexp"
9739         ;;
9740 esac
9741 : Use ' ' for none so value is preserved next time through Configure
9742 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9743 prefixvar=vendorhtml3dir
9744 . ./installprefix
9745
9746 : Set the vendorman1dir variables
9747 case "$vendorprefix" in
9748 '')     vendorman1dir=''
9749         vendorman1direxp=''
9750         ;;
9751 *)      : determine where vendor-supplied manual pages go.
9752         case "$vendorman1dir" in
9753         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9754         *)      dflt=$vendorman1dir ;;
9755         esac
9756         case "$dflt" in
9757         ''|' ') dflt=none ;;
9758         esac
9759         fn=nd~+
9760         rp='Pathname for the vendor-supplied manual section 1 pages?'
9761         . ./getfile
9762         vendorman1dir="$ans"
9763         vendorman1direxp="$ansexp"
9764         ;;
9765 esac
9766 : Use ' ' for none so value is preserved next time through Configure
9767 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9768 prefixvar=vendorman1dir
9769 . ./installprefix
9770
9771 : Set the vendorman3dir variables
9772 case "$vendorprefix" in
9773 '')     vendorman3dir=''
9774         vendorman3direxp=''
9775         ;;
9776 *)      : determine where vendor-supplied module manual pages go.
9777         case "$vendorman3dir" in
9778         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9779         *)      dflt=$vendorman3dir ;;
9780         esac
9781         case "$dflt" in
9782         ''|' ') dflt=none ;;
9783         esac
9784         fn=nd~+
9785         rp='Pathname for the vendor-supplied manual section 3 pages?'
9786         . ./getfile
9787         vendorman3dir="$ans"
9788         vendorman3direxp="$ansexp"
9789         ;;
9790 esac
9791 : Use ' ' for none so value is preserved next time through Configure
9792 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9793 prefixvar=vendorman3dir
9794 . ./installprefix
9795
9796 : Set the vendorscript variables
9797 case "$vendorprefix" in
9798 '')     d_vendorscript="$undef"
9799         vendorscript=''
9800         vendorscriptexp=''
9801         ;;
9802 *)      d_vendorscript="$define"
9803         : determine where vendor-supplied scripts go.
9804         case "$vendorscript" in
9805         '')     dflt=$vendorprefix/script
9806                 $test -d $dflt || dflt=$vendorbin ;;
9807         *)  dflt="$vendorscript" ;;
9808         esac
9809         $cat <<EOM
9810
9811 The installation process will create a directory for
9812 vendor-supplied scripts.
9813
9814 EOM
9815         fn=d~+
9816         rp='Pathname for the vendor-supplied scripts directory?'
9817         . ./getfile
9818         vendorscript="$ans"
9819         vendorscriptexp="$ansexp"
9820         ;;
9821 esac
9822 prefixvar=vendorscript
9823 . ./installprefix
9824
9825 : script used to emit important warnings
9826 cat >warn <<EOS
9827 $startsh
9828 if test \$# -gt 0; then
9829         echo "\$@" >msg
9830 else
9831         cat >msg
9832 fi
9833 echo "*** WARNING:" >&4
9834 sed -e 's/^/*** /' <msg >&4
9835 echo "*** " >&4
9836 cat msg >>config.msg
9837 echo " " >>config.msg
9838 rm -f msg
9839 EOS
9840 chmod +x warn
9841 $eunicefix warn
9842
9843 : see which of string.h or strings.h is needed
9844 echo " "
9845 strings=`./findhdr string.h`
9846 if $test "$strings" && $test -r "$strings"; then
9847         echo "Using <string.h> instead of <strings.h>." >&4
9848         val="$define"
9849 else
9850         val="$undef"
9851         strings=`./findhdr strings.h`
9852         if $test "$strings" && $test -r "$strings"; then
9853                 echo "Using <strings.h> instead of <string.h>." >&4
9854         else
9855                 ./warn "No string header found -- You'll surely have problems."
9856         fi
9857 fi
9858 set i_string
9859 eval $setvar
9860 case "$i_string" in
9861 "$undef") strings=`./findhdr strings.h`;;
9862 *)        strings=`./findhdr string.h`;;
9863 esac
9864
9865 : see if qgcvt exists
9866 set qgcvt d_qgcvt
9867 eval $inlibc
9868
9869 : Check print/scan long double stuff
9870 echo " "
9871
9872 if $test X"$d_longdbl" = X"$define"; then
9873
9874 echo "Checking how to print long doubles..." >&4
9875
9876 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9877         $cat >try.c <<'EOCP'
9878 #include <sys/types.h>
9879 #include <stdio.h>
9880 int main() {
9881   double d = 123.456;
9882   printf("%.3f\n", d);
9883 }
9884 EOCP
9885         set try
9886         if eval $compile; then
9887                 yyy=`$run ./try`
9888                 case "$yyy" in
9889                 123.456)
9890                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9891                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9892                         echo "We will use %f."
9893                         ;;
9894                 esac
9895         fi
9896 fi
9897
9898 if $test X"$sPRIfldbl" = X; then
9899         $cat >try.c <<'EOCP'
9900 #include <sys/types.h>
9901 #include <stdio.h>
9902 int main() {
9903   long double d = 123.456;
9904   printf("%.3Lf\n", d);
9905 }
9906 EOCP
9907         set try
9908         if eval $compile; then
9909                 yyy=`$run ./try`
9910                 case "$yyy" in
9911                 123.456)
9912                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9913                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9914                         echo "We will use %Lf."
9915                         ;;
9916                 esac
9917         fi
9918 fi
9919
9920 if $test X"$sPRIfldbl" = X; then
9921         $cat >try.c <<'EOCP'
9922 #include <sys/types.h>
9923 #include <stdio.h>
9924 int main() {
9925   long double d = 123.456;
9926   printf("%.3llf\n", d);
9927 }
9928 EOCP
9929         set try
9930         if eval $compile; then
9931                 yyy=`$run ./try`
9932                 case "$yyy" in
9933                 123.456)
9934                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9935                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9936                         echo "We will use %llf."
9937                         ;;
9938                 esac
9939         fi
9940 fi
9941
9942 if $test X"$sPRIfldbl" = X; then
9943         $cat >try.c <<'EOCP'
9944 #include <sys/types.h>
9945 #include <stdio.h>
9946 int main() {
9947   long double d = 123.456;
9948   printf("%.3lf\n", d);
9949 }
9950 EOCP
9951         set try
9952         if eval $compile; then
9953                 yyy=`$run ./try`
9954                 case "$yyy" in
9955                 123.456)
9956                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9957                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9958                         echo "We will use %lf."
9959                         ;;
9960                 esac
9961         fi
9962 fi
9963
9964 if $test X"$sPRIfldbl" = X; then
9965         echo "Cannot figure out how to print long doubles." >&4
9966 else
9967         sSCNfldbl=$sPRIfldbl    # expect consistency
9968 fi
9969
9970 $rm_try
9971
9972 fi # d_longdbl
9973
9974 case "$sPRIfldbl" in
9975 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9976         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9977         d_SCNfldbl="$undef";
9978         ;;
9979 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9980         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9981         d_SCNfldbl="$define";
9982         ;;
9983 esac
9984
9985 : Check how to convert floats to strings.
9986
9987 if test "X$d_Gconvert" = X; then
9988
9989 echo " "
9990 echo "Checking for an efficient way to convert floats to strings."
9991 echo " " > try.c
9992 case "$uselongdouble" in
9993 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9994 esac
9995 case "$d_longdbl" in
9996 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9997 esac
9998 case "$d_PRIgldbl" in
9999 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10000 esac
10001 $cat >>try.c <<EOP
10002 #ifdef TRY_gconvert
10003 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10004 char *myname = "gconvert";
10005 #endif
10006 #ifdef TRY_gcvt
10007 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10008 char *myname = "gcvt";
10009 #endif
10010 #ifdef TRY_qgcvt
10011 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10012 char *myname = "qgcvt";
10013 #define DOUBLETYPE long double
10014 #endif
10015 #ifdef TRY_sprintf
10016 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10017 #ifdef HAS_PRIgldbl
10018 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10019 #else
10020 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10021 #endif
10022 #else
10023 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10024 #endif
10025 char *myname = "sprintf";
10026 #endif
10027
10028 #ifndef DOUBLETYPE
10029 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10030 #define DOUBLETYPE long double
10031 #else
10032 #define DOUBLETYPE double
10033 #endif
10034 #endif
10035
10036 #include <stdio.h>
10037
10038 #$i_stdlib I_STDLIB
10039 #ifdef I_STDLIB
10040 #include <stdlib.h>
10041 #endif
10042 #$i_string I_STRING
10043 #ifdef I_STRING
10044 #  include <string.h>
10045 #else
10046 #  include <strings.h>
10047 #endif
10048
10049 int checkit(char *expect, char *got)
10050 {
10051     if (strcmp(expect, got)) {
10052                 printf("%s oddity:  Expected %s, got %s\n",
10053                         myname, expect, got);
10054                 exit(1);
10055         }
10056 }
10057
10058 int main()
10059 {
10060         char buf[64];
10061         buf[63] = '\0';
10062
10063         /* This must be 1st test on (which?) platform */
10064         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10065         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10066         checkit("0.1", buf);
10067
10068         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10069         checkit("0.01", buf);
10070
10071         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10072         checkit("0.001", buf);
10073
10074         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10075         checkit("0.0001", buf);
10076
10077         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10078         if (strlen(buf) > 5)
10079             checkit("9e-005", buf); /* for Microsoft ?? */
10080         else
10081             checkit("9e-05", buf);
10082
10083         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10084         checkit("1", buf);
10085
10086         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10087         checkit("1.1", buf);
10088
10089         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10090         checkit("1.01", buf);
10091
10092         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10093         checkit("1.001", buf);
10094
10095         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10096         checkit("1.0001", buf);
10097
10098         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10099         checkit("1.00001", buf);
10100
10101         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10102         checkit("1.000001", buf);
10103
10104         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10105         checkit("0", buf);
10106
10107         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10108         checkit("-1", buf);
10109
10110         /* Some Linux gcvt's give 1.e+5 here. */
10111         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10112         checkit("100000", buf);
10113
10114         /* Some Linux gcvt's give -1.e+5 here. */
10115         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10116         checkit("-100000", buf);
10117
10118         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10119         checkit("123.456", buf);
10120
10121         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10122         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10123         /* 34 should be enough to scare even long double
10124          * places into using the e notation. */
10125         if (strlen(buf) > 5)
10126             checkit("1e+034", buf); /* for Microsoft */
10127         else
10128             checkit("1e+34", buf);
10129
10130         /* For Perl, if you add additional tests here, also add them to
10131          * t/base/num.t for benefit of platforms not using Configure or
10132          * overriding d_Gconvert */
10133
10134         exit(0);
10135 }
10136 EOP
10137 : first add preferred functions to our list
10138 xxx_list=""
10139 for xxx_convert in $gconvert_preference; do
10140     case $xxx_convert in
10141     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10142     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10143     esac
10144 done
10145 : then add any others
10146 for xxx_convert in gconvert gcvt sprintf; do
10147     case "$xxx_list" in
10148     *$xxx_convert*) ;;
10149     *) xxx_list="$xxx_list $xxx_convert" ;;
10150     esac
10151 done
10152
10153 case "$d_longdbl$uselongdouble" in
10154 "$define$define")
10155     : again, add preferred functions to our list first
10156     xxx_ld_list=""
10157     for xxx_convert in $gconvert_ld_preference; do
10158         case $xxx_convert in
10159         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10160         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10161         esac
10162     done
10163     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10164     for xxx_convert in qgcvt sprintf $xxx_list; do
10165         case "$xxx_ld_list" in
10166         $xxx_convert*|*" $xxx_convert"*) ;;
10167         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10168         esac
10169     done
10170     : if sprintf cannot do long doubles, move it to the end
10171     if test "$d_PRIgldbl" != "$define"; then
10172         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10173     fi
10174     : if no qgcvt, remove it
10175     if test "$d_qgcvt" != "$define"; then
10176         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10177     fi
10178     : use the ld_list
10179     xxx_list="$xxx_ld_list"
10180     ;;
10181 esac
10182
10183 for xxx_convert in $xxx_list; do
10184         echo "Trying $xxx_convert..."
10185         $rm -f try try$_o core
10186         set try -DTRY_$xxx_convert
10187         if eval $compile; then
10188                 echo "$xxx_convert() found." >&4
10189                 if $run ./try; then
10190                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10191                         break;
10192                 else
10193                         echo "...But $xxx_convert didn't work as I expected."
10194                         xxx_convert=''
10195                 fi
10196         else
10197                 echo "$xxx_convert NOT found." >&4
10198         fi
10199 done
10200
10201 if test X$xxx_convert = X; then
10202     echo "*** WHOA THERE!!! ***" >&4
10203     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10204     xxx_convert=sprintf
10205 fi
10206
10207 case "$xxx_convert" in
10208 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10209 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10210 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10211 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10212    "$define$define$define")
10213       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10214    "$define$define$undef")
10215       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10216    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10217    esac
10218    ;;
10219 esac
10220
10221 fi
10222 $rm_try
10223
10224 : see if _fwalk exists
10225 set fwalk d__fwalk
10226 eval $inlibc
10227
10228 : Initialize h_fcntl
10229 h_fcntl=false
10230
10231 : Initialize h_sysfile
10232 h_sysfile=false
10233
10234 : access call always available on UNIX
10235 set access d_access
10236 eval $inlibc
10237
10238 : locate the flags for 'access()'
10239 case "$d_access" in
10240 "$define")
10241         echo " "
10242         $cat >access.c <<EOCP
10243 #include <sys/types.h>
10244 #ifdef I_FCNTL
10245 #include <fcntl.h>
10246 #endif
10247 #ifdef I_SYS_FILE
10248 #include <sys/file.h>
10249 #endif
10250 #ifdef I_UNISTD
10251 #include <unistd.h>
10252 #endif
10253 #$i_stdlib I_STDLIB
10254 #ifdef I_STDLIB
10255 #include <stdlib.h>
10256 #endif
10257 int main() {
10258         exit(R_OK);
10259 }
10260 EOCP
10261         : check sys/file.h first, no particular reason here
10262         if $test `./findhdr sys/file.h` && \
10263                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10264                 h_sysfile=true;
10265                 echo "<sys/file.h> defines the *_OK access constants." >&4
10266         elif $test `./findhdr fcntl.h` && \
10267                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10268                 h_fcntl=true;
10269                 echo "<fcntl.h> defines the *_OK access constants." >&4
10270         elif $test `./findhdr unistd.h` && \
10271                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10272                 echo "<unistd.h> defines the *_OK access constants." >&4
10273         else
10274                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10275         fi
10276         ;;
10277 esac
10278 $rm -f access*
10279
10280 : see if accessx exists
10281 set accessx d_accessx
10282 eval $inlibc
10283
10284 : see if aintl exists
10285 set aintl d_aintl
10286 eval $inlibc
10287
10288 : see if alarm exists
10289 set alarm d_alarm
10290 eval $inlibc
10291
10292 : see if 64bit time functions exists
10293
10294 set ctime64 d_ctime64
10295 eval $inlibc
10296
10297 set localtime64 d_localtime64
10298 eval $inlibc
10299
10300 set gmtime64 d_gmtime64
10301 eval $inlibc
10302
10303 set mktime64 d_mktime64
10304 eval $inlibc
10305
10306 set difftime64 d_difftime64
10307 eval $inlibc
10308
10309 set asctime64 d_asctime64
10310 eval $inlibc
10311
10312 : see if POSIX threads are available
10313 set pthread.h i_pthread
10314 eval $inhdr
10315
10316 : define a function to check prototypes
10317 $cat > protochk <<EOSH
10318 $startsh
10319 cc="$cc"
10320 optimize="$optimize"
10321 ccflags="$ccflags"
10322 prototype="$prototype"
10323 define="$define"
10324 rm_try="$rm_try"
10325 usethreads=$usethreads
10326 i_pthread=$i_pthread
10327 pthread_h_first=$pthread_h_first
10328 EOSH
10329
10330 $cat >> protochk <<'EOSH'
10331
10332 $rm_try
10333 foo="$1"
10334 shift
10335 while test $# -ge 2; do
10336         case "$1" in
10337                 $define) echo "#include <$2>" >> try.c ;;
10338                 literal) echo "$2" >> try.c ;;
10339         esac
10340     # Extra magic for the benefit of systems that need pthread.h
10341     # to be included early to correctly detect threadsafe functions.
10342     # Such functions must guarantee themselves, though, that the usethreads
10343     # and i_pthread have been defined, before calling protochk.
10344     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10345         echo "#include <pthread.h>" >> try.c
10346         pthread_h_done=yes
10347     fi
10348     shift 2
10349 done
10350 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10351 cat >> try.c <<'EOCP'
10352 #ifdef CAN_PROTOTYPE
10353 #define _(args) args
10354 #else
10355 #define _(args) ()
10356 #endif
10357 EOCP
10358 echo "$foo" >> try.c
10359 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10360 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10361 status=$?
10362 $rm_try
10363 exit $status
10364 EOSH
10365 chmod +x protochk
10366 $eunicefix protochk
10367
10368 : Define hasproto macro for Configure internal use
10369 hasproto='varname=$1; func=$2; shift; shift;
10370 while $test $# -ge 2; do
10371         case "$1" in
10372         $define) echo "#include <$2>";;
10373         esac ;
10374     shift 2;
10375 done > try.c;
10376 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10377 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10378         echo "$func() prototype found.";
10379         val="$define";
10380 else
10381         echo "$func() prototype NOT found.";
10382         val="$undef";
10383 fi;
10384 set $varname;
10385 eval $setvar;
10386 $rm_try tryout.c'
10387
10388 : see if sys/types.h has to be included
10389 set sys/types.h i_systypes
10390 eval $inhdr
10391
10392 : see if sys/select.h has to be included
10393 set sys/select.h i_sysselct
10394 eval $inhdr
10395
10396 : Define hasfield macro for Configure internal use
10397 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10398 while $test $# -ge 2; do
10399         case "$1" in
10400         $define) echo "#include <$2>";;
10401         esac ;
10402     shift 2;
10403 done > try.c;
10404 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10405 set try;
10406 if eval $compile; then
10407         val="$define";
10408 else
10409         val="$undef";
10410 fi;
10411 set $varname;
10412 eval $setvar;
10413 $rm_try'
10414
10415 : see if we should include time.h, sys/time.h, or both
10416 echo " "
10417 if test "X$timeincl" = X; then
10418         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10419         $echo $n "I'm now running the test program...$c"
10420         $cat >try.c <<EOCP
10421 #include <sys/types.h>
10422 #ifdef I_TIME
10423 #include <time.h>
10424 #endif
10425 #ifdef I_SYSTIME
10426 #ifdef SYSTIMEKERNEL
10427 #define KERNEL
10428 #endif
10429 #include <sys/time.h>
10430 #endif
10431 #ifdef I_SYSSELECT
10432 #include <sys/select.h>
10433 #endif
10434 #$i_stdlib I_STDLIB
10435 #ifdef I_STDLIB
10436 #include <stdlib.h>
10437 #endif
10438 int main()
10439 {
10440         struct tm foo;
10441 #ifdef S_TIMEVAL
10442         struct timeval bar;
10443 #endif
10444 #ifdef S_TIMEZONE
10445         struct timezone tzp;
10446 #endif
10447         if (foo.tm_sec == foo.tm_sec)
10448                 exit(0);
10449 #ifdef S_TIMEVAL
10450         if (bar.tv_sec == bar.tv_sec)
10451                 exit(0);
10452 #endif
10453         exit(1);
10454 }
10455 EOCP
10456         flags=''
10457         for s_timezone in '-DS_TIMEZONE' ''; do
10458         sysselect=''
10459         for s_timeval in '-DS_TIMEVAL' ''; do
10460         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10461         for i_time in '' '-DI_TIME'; do
10462         for i_systime in '-DI_SYSTIME' ''; do
10463                 case "$flags" in
10464                 '') $echo $n ".$c"
10465                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10466                         if eval $compile; then
10467                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10468                                 shift
10469                                 flags="$*"
10470                                 echo " "
10471                                 $echo $n "Succeeded with $flags$c"
10472                         fi
10473                         ;;
10474                 esac
10475         done
10476         done
10477         done
10478         done
10479         done
10480         timeincl=''
10481         echo " "
10482         case "$flags" in
10483         *SYSTIMEKERNEL*) i_systimek="$define"
10484                 timeincl=`./findhdr sys/time.h`
10485                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10486         *) i_systimek="$undef";;
10487         esac
10488         case "$flags" in
10489         *I_TIME*) i_time="$define"
10490                 timeincl=`./findhdr time.h`" $timeincl"
10491                 echo "We'll include <time.h>." >&4;;
10492         *) i_time="$undef";;
10493         esac
10494         case "$flags" in
10495         *I_SYSTIME*) i_systime="$define"
10496                 timeincl=`./findhdr sys/time.h`" $timeincl"
10497                 echo "We'll include <sys/time.h>." >&4;;
10498         *) i_systime="$undef";;
10499         esac
10500         $rm_try
10501 fi
10502 : see if struct tm knows about tm_zone
10503 case "$i_systime$i_time" in
10504 *$define*)
10505         echo " "
10506         echo "Checking to see if your struct tm has tm_zone field..." >&4
10507         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10508         eval $hasfield
10509         ;;
10510 *)      val="$undef"
10511         set d_tm_tm_zone
10512         eval $setvar
10513         ;;
10514 esac
10515 case "$d_tm_tm_zone" in
10516 "$define")      echo "Yes, it does."   ;;
10517 *)              echo "No, it doesn't." ;;
10518 esac
10519 : see if struct tm knows about tm_gmtoff
10520 case "$i_systime$i_time" in
10521 *$define*)
10522         echo " "
10523         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10524         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10525         eval $hasfield
10526         ;;
10527 *)      val="$undef"
10528         set d_tm_tm_gmtoff
10529         eval $setvar
10530         ;;
10531 esac
10532 case "$d_tm_tm_gmtoff" in
10533 "$define")      echo "Yes, it does."   ;;
10534 *)              echo "No, it doesn't." ;;
10535 esac
10536
10537 : see if asctime_r exists
10538 set asctime_r d_asctime_r
10539 eval $inlibc
10540 case "$d_asctime_r" in
10541 "$define")
10542         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10543         case "$d_asctime_r_proto:$usethreads" in
10544         ":define")      d_asctime_r_proto=define
10545                 set d_asctime_r_proto asctime_r $hdrs
10546                 eval $hasproto ;;
10547         *)      ;;
10548         esac
10549         case "$d_asctime_r_proto" in
10550         define)
10551         case "$asctime_r_proto" in
10552         ''|0) try='char* asctime_r(const struct tm*, char*);'
10553         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10554         esac
10555         case "$asctime_r_proto" in
10556         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10557         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10558         esac
10559         case "$asctime_r_proto" in
10560         ''|0) try='int asctime_r(const struct tm*, char*);'
10561         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10562         esac
10563         case "$asctime_r_proto" in
10564         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10565         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10566         esac
10567         case "$asctime_r_proto" in
10568         ''|0)   d_asctime_r=undef
10569                 asctime_r_proto=0
10570                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10571         * )     case "$asctime_r_proto" in
10572                 REENTRANT_PROTO*) ;;
10573                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10574                 esac
10575                 echo "Prototype: $try" ;;
10576         esac
10577         ;;
10578         *)      case "$usethreads" in
10579                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10580                 esac
10581                 d_asctime_r=undef
10582                 asctime_r_proto=0
10583                 ;;
10584         esac
10585         ;;
10586 *)      asctime_r_proto=0
10587         ;;
10588 esac
10589
10590 : see if atolf exists
10591 set atolf d_atolf
10592 eval $inlibc
10593
10594 : see if atoll exists
10595 set atoll d_atoll
10596 eval $inlibc
10597
10598 : Look for GCC-style attribute format
10599 case "$d_attribute_format" in
10600 '')
10601 echo " "
10602 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10603 $cat >attrib.c <<'EOCP'
10604 #include <stdio.h>
10605 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10606 EOCP
10607 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10608         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10609                 echo "Your C compiler doesn't support __attribute__((format))."
10610                 val="$undef"
10611         else
10612                 echo "Your C compiler supports __attribute__((format))."
10613                 val="$define"
10614         fi
10615 else
10616         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10617         val="$undef"
10618 fi
10619 ;;
10620 *) val="$d_attribute_format" ;;
10621 esac
10622 set d_attribute_format
10623 eval $setvar
10624 $rm -f attrib*
10625
10626 : Look for GCC-style attribute format with null format allowed
10627 case "$d_printf_format_null" in
10628 '') case "$d_attribute_format" in
10629     $define)
10630         echo " "
10631         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10632 $cat >attrib.c <<EOCP
10633 #include <stdio.h>
10634 #$i_stdlib I_STDLIB
10635 #ifdef I_STDLIB
10636 #include <stdlib.h>
10637 #endif
10638 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10639 int null_printf (char* pat,...) { return (int)pat; }
10640 int main () { exit(null_printf(NULL)); }
10641 EOCP
10642         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10643             : run the executable in case it produces a run-time warning
10644             if $run ./attrib >>attrib.out 2>&1; then
10645                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10646                     echo "Your C compiler doesn't allow __printf__ format to be null."
10647                     val="$undef"
10648                 else
10649                     echo "Your C compiler allows __printf__ format to be null."
10650                     val="$define"
10651                 fi
10652             else
10653             echo "Your C compiler executable failed with __printf__ format null."
10654             val="$undef"
10655         fi
10656     else
10657         echo "Your C compiler fails with __printf__ format null."
10658         val="$undef"
10659     fi
10660     ;;
10661     *)  val="$undef" ;;
10662     esac
10663 ;;
10664 *)  val="$d_printf_format_null" ;;
10665 esac
10666 set d_printf_format_null
10667 eval $setvar
10668 $rm -f attrib*
10669
10670 : Look for GCC-style attribute malloc
10671 case "$d_attribute_malloc" in
10672 '')
10673 echo " "
10674 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10675 $cat >attrib.c <<'EOCP'
10676 #include <stdio.h>
10677 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10678 EOCP
10679 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10680         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10681                 echo "Your C compiler doesn't support __attribute__((malloc))."
10682                 val="$undef"
10683         else
10684                 echo "Your C compiler supports __attribute__((malloc))."
10685                 val="$define"
10686         fi
10687 else
10688         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10689         val="$undef"
10690 fi
10691 ;;
10692 *) val="$d_attribute_malloc" ;;
10693 esac
10694 set d_attribute_malloc
10695 eval $setvar
10696 $rm -f attrib*
10697
10698 : Look for GCC-style attribute nonnull
10699 case "$d_attribute_nonnull" in
10700 '')
10701 echo " "
10702 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10703 $cat >attrib.c <<'EOCP'
10704 #include <stdio.h>
10705 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10706 EOCP
10707 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10708         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10709                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10710                 val="$undef"
10711         else
10712                 echo "Your C compiler supports __attribute__((nonnull))."
10713                 val="$define"
10714         fi
10715 else
10716         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10717         val="$undef"
10718 fi
10719 ;;
10720 *) val="$d_attribute_nonnull" ;;
10721 esac
10722 set d_attribute_nonnull
10723 eval $setvar
10724 $rm -f attrib*
10725
10726 : Look for GCC-style attribute noreturn
10727 case "$d_attribute_noreturn" in
10728 '')
10729 echo " "
10730 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10731 $cat >attrib.c <<'EOCP'
10732 #include <stdio.h>
10733 void fall_over_dead( void ) __attribute__((noreturn));
10734 EOCP
10735 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10736         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10737                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10738                 val="$undef"
10739         else
10740                 echo "Your C compiler supports __attribute__((noreturn))."
10741                 val="$define"
10742         fi
10743 else
10744         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10745         val="$undef"
10746 fi
10747 ;;
10748 *) val="$d_attribute_noreturn" ;;
10749 esac
10750 set d_attribute_noreturn
10751 eval $setvar
10752 $rm -f attrib*
10753
10754 : Look for GCC-style attribute pure
10755 case "$d_attribute_pure" in
10756 '')
10757 echo " "
10758 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10759 $cat >attrib.c <<'EOCP'
10760 #include <stdio.h>
10761 int square( int n ) __attribute__((pure));
10762 EOCP
10763 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10764         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10765                 echo "Your C compiler doesn't support __attribute__((pure))."
10766                 val="$undef"
10767         else
10768                 echo "Your C compiler supports __attribute__((pure))."
10769                 val="$define"
10770         fi
10771 else
10772         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10773         val="$undef"
10774 fi
10775 ;;
10776 *) val="$d_attribute_pure" ;;
10777 esac
10778 set d_attribute_pure
10779 eval $setvar
10780 $rm -f attrib*
10781
10782 : Look for GCC-style attribute unused
10783 case "$d_attribute_unused" in
10784 '')
10785 echo " "
10786 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10787 $cat >attrib.c <<'EOCP'
10788 #include <stdio.h>
10789 int do_something( int dummy __attribute__((unused)), int n );
10790 EOCP
10791 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10792         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10793                 echo "Your C compiler doesn't support __attribute__((unused))."
10794                 val="$undef"
10795         else
10796                 echo "Your C compiler supports __attribute__((unused))."
10797                 val="$define"
10798         fi
10799 else
10800         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10801         val="$undef"
10802 fi
10803 ;;
10804 *) val="$d_attribute_unused" ;;
10805 esac
10806 set d_attribute_unused
10807 eval $setvar
10808 $rm -f attrib*
10809
10810 : Look for GCC-style attribute deprecated
10811 case "$d_attribute_deprecated" in
10812 '')
10813 echo " "
10814 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10815 $cat >attrib.c <<'EOCP'
10816 #include <stdio.h>
10817 int I_am_deprecated(void) __attribute__((deprecated));
10818 EOCP
10819 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10820         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10821                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10822                 val="$undef"
10823         else
10824                 echo "Your C compiler supports __attribute__((deprecated))."
10825                 val="$define"
10826         fi
10827 else
10828         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10829         val="$undef"
10830 fi
10831 ;;
10832 *) val="$d_attribute_deprecated" ;;
10833 esac
10834 set d_attribute_deprecated
10835 eval $setvar
10836 $rm -f attrib*
10837
10838 : Look for GCC-style attribute warn_unused_result
10839 case "$d_attribute_warn_unused_result" in
10840 '')
10841 echo " "
10842 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10843 $cat >attrib.c <<'EOCP'
10844 #include <stdio.h>
10845 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10846 EOCP
10847 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10848         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10849                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10850                 val="$undef"
10851         else
10852                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10853                 val="$define"
10854         fi
10855 else
10856         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10857         val="$undef"
10858 fi
10859 ;;
10860 *) val="$d_attribute_warn_unused_result" ;;
10861 esac
10862 set d_attribute_warn_unused_result
10863 eval $setvar
10864 $rm -f attrib*
10865
10866 : see if bcmp exists
10867 set bcmp d_bcmp
10868 eval $inlibc
10869
10870 : see if bcopy exists
10871 set bcopy d_bcopy
10872 eval $inlibc
10873
10874 : see if getpgrp exists
10875 set getpgrp d_getpgrp
10876 eval $inlibc
10877
10878 case "$d_getpgrp" in
10879 "$define")
10880         echo " "
10881         echo "Checking to see which flavor of getpgrp is in use..."
10882         $cat >try.c <<EOP
10883 #$i_unistd I_UNISTD
10884 #include <sys/types.h>
10885 #ifdef I_UNISTD
10886 #  include <unistd.h>
10887 #endif
10888 #$i_stdlib I_STDLIB
10889 #ifdef I_STDLIB
10890 #include <stdlib.h>
10891 #endif
10892 int main()
10893 {
10894         if (getuid() == 0) {
10895                 printf("(I see you are running Configure as super-user...)\n");
10896                 setuid(1);
10897         }
10898 #ifdef TRY_BSD_PGRP
10899         if (getpgrp(1) == 0)
10900                 exit(0);
10901 #else
10902         if (getpgrp() > 0)
10903                 exit(0);
10904 #endif
10905         exit(1);
10906 }
10907 EOP
10908         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10909                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10910                 val="$define"
10911         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10912                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10913                 val="$undef"
10914         else
10915                 echo "I can't seem to compile and run the test program."
10916                 if ./usg; then
10917                         xxx="a USG one, i.e. you use getpgrp()."
10918                 else
10919                         # SVR4 systems can appear rather BSD-ish.
10920                         case "$i_unistd" in
10921                         $undef)
10922                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10923                                 val="$define"
10924                                 ;;
10925                         $define)
10926                                 xxx="probably a USG one, i.e. you use getpgrp()."
10927                                 val="$undef"
10928                                 ;;
10929                         esac
10930                 fi
10931                 echo "Assuming your getpgrp is $xxx" >&4
10932         fi
10933         ;;
10934 *) val="$undef";;
10935 esac
10936 set d_bsdgetpgrp
10937 eval $setvar
10938 $rm_try
10939
10940 : see if setpgrp exists
10941 set setpgrp d_setpgrp
10942 eval $inlibc
10943
10944 case "$d_setpgrp" in
10945 "$define")
10946         echo " "
10947         echo "Checking to see which flavor of setpgrp is in use..."
10948         $cat >try.c <<EOP
10949 #$i_unistd I_UNISTD
10950 #include <sys/types.h>
10951 #ifdef I_UNISTD
10952 #  include <unistd.h>
10953 #endif
10954 #$i_stdlib I_STDLIB
10955 #ifdef I_STDLIB
10956 #include <stdlib.h>
10957 #endif
10958 int main()
10959 {
10960         if (getuid() == 0) {
10961                 printf("(I see you are running Configure as super-user...)\n");
10962                 setuid(1);
10963         }
10964 #ifdef TRY_BSD_PGRP
10965         if (-1 == setpgrp(1, 1))
10966                 exit(0);
10967 #else
10968         if (setpgrp() != -1)
10969                 exit(0);
10970 #endif
10971         exit(1);
10972 }
10973 EOP
10974         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10975                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10976                 val="$define"
10977         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10978                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10979                 val="$undef"
10980         else
10981                 echo "(I can't seem to compile and run the test program.)"
10982                 if ./usg; then
10983                         xxx="a USG one, i.e. you use setpgrp()."
10984                 else
10985                         # SVR4 systems can appear rather BSD-ish.
10986                         case "$i_unistd" in
10987                         $undef)
10988                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10989                                 val="$define"
10990                                 ;;
10991                         $define)
10992                                 xxx="probably a USG one, i.e. you use setpgrp()."
10993                                 val="$undef"
10994                                 ;;
10995                         esac
10996                 fi
10997                 echo "Assuming your setpgrp is $xxx" >&4
10998         fi
10999         ;;
11000 *) val="$undef";;
11001 esac
11002 set d_bsdsetpgrp
11003 eval $setvar
11004 $rm_try
11005
11006 : Look for GCC-style __builtin_choose_expr
11007 case "$d_builtin_choose_expr" in
11008 '')
11009     echo " "
11010     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11011     $cat >try.c <<'EOCP'
11012 #include <assert.h>
11013 #include <stdlib.h>
11014 #include <stdio.h>
11015
11016 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11017
11018 int main(void) {
11019     assert( SYRINX(1) == 2112 );
11020     assert( SYRINX(1) != 5150 );
11021     assert( SYRINX(0) == 5150 );
11022     assert( SYRINX(0) != 2112 );
11023     puts( "All good!" );
11024     exit(0);
11025 }
11026
11027 EOCP
11028     set try
11029     if eval $compile && $run ./try; then
11030         echo "Your C compiler supports __builtin_choose_expr."
11031         val="$define"
11032     else
11033         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11034         val="$undef"
11035     fi
11036 ;;
11037 *) val="$d_builtin_choose_expr" ;;
11038 esac
11039
11040 set d_builtin_choose_expr
11041 eval $setvar
11042 $rm_try
11043
11044 : Look for GCC-style __builtin_expect
11045 case "$d_builtin_expect" in
11046 '')
11047     echo " "
11048     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11049     $cat >try.c <<'EOCP'
11050 int main(void) {
11051     int n = 50;
11052     if ( __builtin_expect(n, 0) ) n = 1;
11053     /* Remember shell exit code truth is 0, C truth is non-zero */
11054     return !(n == 1);
11055 }
11056 EOCP
11057     set try
11058     if eval $compile && $run ./try; then
11059         echo "Your C compiler supports __builtin_expect."
11060         val="$define"
11061     else
11062         echo "Your C compiler doesn't seem to understand __builtin_expect."
11063         val="$undef"
11064     fi
11065     ;;
11066 *) val="$d_builtin_expect" ;;
11067 esac
11068
11069 set d_builtin_expect
11070 eval $setvar
11071 $rm_try
11072
11073 : see if bzero exists
11074 set bzero d_bzero
11075 eval $inlibc
11076
11077 : see if stdarg is available
11078 echo " "
11079 if $test `./findhdr stdarg.h`; then
11080         echo "<stdarg.h> found." >&4
11081         valstd="$define"
11082 else
11083         echo "<stdarg.h> NOT found." >&4
11084         valstd="$undef"
11085 fi
11086
11087 : see if varargs is available
11088 echo " "
11089 if $test `./findhdr varargs.h`; then
11090         echo "<varargs.h> found." >&4
11091 else
11092         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
11093 fi
11094
11095 : set up the varargs testing programs
11096 $cat > varargs.c <<EOP
11097 #ifdef I_STDARG
11098 #include <stdarg.h>
11099 #endif
11100 #ifdef I_VARARGS
11101 #include <varargs.h>
11102 #endif
11103
11104 #ifdef I_STDARG
11105 int f(char *p, ...)
11106 #else
11107 int f(va_alist)
11108 va_dcl
11109 #endif
11110 {
11111         va_list ap;
11112 #ifndef I_STDARG
11113         char *p;
11114 #endif
11115 #ifdef I_STDARG
11116         va_start(ap,p);
11117 #else
11118         va_start(ap);
11119         p = va_arg(ap, char *);
11120 #endif
11121         va_end(ap);
11122         return 0;
11123 }
11124 EOP
11125 $cat > varargs <<EOP
11126 $startsh
11127 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
11128         echo "true"
11129 else
11130         echo "false"
11131 fi
11132 $rm -f varargs$_o
11133 EOP
11134 chmod +x varargs
11135
11136 : now check which varargs header should be included
11137 echo " "
11138 i_varhdr=''
11139 val=''
11140 case "$valstd" in
11141 "$define")
11142         if `./varargs I_STDARG`; then
11143                 val='stdarg.h'
11144         elif `./varargs I_VARARGS`; then
11145                 val='varargs.h'
11146         fi
11147         ;;
11148 *)
11149         if `./varargs I_VARARGS`; then
11150                 val='varargs.h'
11151         fi
11152         ;;
11153 esac
11154 case "$val" in
11155 '')
11156         echo " "
11157         echo "*** WHOA THERE!!! ***" >&4
11158         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
11159         case "$knowitall" in
11160         '')
11161         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
11162                 exit 1
11163                 ;;
11164         esac
11165 echo "I could not find the definition for va_dcl... You have problems..." >&4
11166         val="$undef"; set i_stdarg; eval $setvar
11167         val="$undef"; set i_varargs; eval $setvar
11168         ;;
11169 *)
11170         set i_varhdr
11171         eval $setvar
11172         case "$i_varhdr" in
11173         stdarg.h)
11174                 val="$define"; set i_stdarg; eval $setvar
11175                 val="$undef"; set i_varargs; eval $setvar
11176                 ;;
11177         varargs.h)
11178                 val="$undef"; set i_stdarg; eval $setvar
11179                 val="$define"; set i_varargs; eval $setvar
11180                 ;;
11181         esac
11182         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
11183 esac
11184 $rm -f varargs*
11185
11186 : see if the Compiler supports C99 variadic macros
11187 case "$i_stdarg$i_stdlib" in
11188     "$define$define")
11189     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
11190     $cat >try.c <<EOCP
11191 #include <stdio.h>
11192 #include <stdarg.h>
11193
11194 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11195
11196 int main() {
11197   char buf[20];
11198   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11199   puts(buf);
11200   return 0;
11201 }
11202 EOCP
11203     set try
11204     if eval $compile && $run ./try 2>&1 >/dev/null; then
11205         case "`$run ./try`" in
11206             "123 456 789")
11207             echo "You have C99 variadic macros." >&4
11208             d_c99_variadic_macros="$define"
11209             ;;
11210             *)
11211             echo "You don't have functional C99 variadic macros." >&4
11212             d_c99_variadic_macros="$undef"
11213             ;;
11214         esac
11215     else
11216         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11217         d_c99_variadic_macros="$undef"
11218     fi
11219     $rm_try
11220     ;;
11221     *)
11222     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
11223     d_c99_variadic_macros="$undef"
11224     ;;
11225 esac
11226
11227 : see if signal is declared as pointer to function returning int or void
11228 echo " "
11229 xxx=`./findhdr signal.h`
11230 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11231 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11232         echo "You have int (*signal())() instead of void." >&4
11233         val="$undef"
11234 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11235         echo "You have void (*signal())()." >&4
11236         val="$define"
11237 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11238         echo "You have int (*signal())() instead of void." >&4
11239         val="$undef"
11240 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11241         echo "You have void (*signal())()." >&4
11242         val="$define"
11243 else
11244         case "$d_voidsig" in
11245         '')
11246         echo "I can't determine whether signal handler returns void or int..." >&4
11247                 dflt=void
11248                 rp="What type does your signal handler return?"
11249                 . ./myread
11250                 case "$ans" in
11251                 v*) val="$define";;
11252                 *) val="$undef";;
11253                 esac;;
11254         "$define")
11255                 echo "As you already told me, signal handler returns void." >&4
11256                 val="$define"
11257                 ;;
11258         *)      echo "As you already told me, signal handler returns int." >&4
11259                 val="$undef"
11260                 ;;
11261         esac
11262 fi
11263 set d_voidsig
11264 eval $setvar
11265 case "$d_voidsig" in
11266 "$define") signal_t="void";;
11267 *) signal_t="int";;
11268 esac
11269 $rm -f $$.tmp
11270
11271 : check for ability to cast large floats to 32-bit ints.
11272 echo " "
11273 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11274 if $test "$intsize" -ge 4; then
11275         xxx=int
11276 else
11277         xxx=long
11278 fi
11279 $cat >try.c <<EOCP
11280 #include <stdio.h>
11281 #$i_stdlib I_STDLIB
11282 #ifdef I_STDLIB
11283 #include <stdlib.h>
11284 #endif
11285 #include <sys/types.h>
11286 #include <signal.h>
11287 $signal_t blech(int s) { exit(3); }
11288 int main()
11289 {
11290         $xxx i32;
11291         double f, g;
11292         int result = 0;
11293         char str[16];
11294         signal(SIGFPE, blech);
11295
11296         /* Don't let compiler optimize the test away.  Store the number
11297            in a writable string for gcc to pass to sscanf under HP-UX.
11298         */
11299         sprintf(str, "2147483647");
11300         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11301         g = 10 * f;
11302         i32  = ($xxx) g;
11303
11304         /* x86 processors will probably give 0x8000 0000, which is a
11305            sign change.  We don't want that.  We want to mimic SPARC
11306            behavior here, which is to preserve the sign and give
11307            back 0x7fff ffff.
11308         */
11309         if (i32 != ($xxx) f)
11310                 result |= 1;
11311         exit(result);
11312 }
11313 EOCP
11314 set try
11315 if eval $compile_ok; then
11316         $run ./try
11317         yyy=$?
11318 else
11319         echo "(I can't seem to compile the test program--assuming it can't)"
11320         yyy=1
11321 fi
11322 case "$yyy" in
11323 0)      val="$define"
11324         echo "Yup, it can."
11325         ;;
11326 *)      val="$undef"
11327         echo "Nope, it can't."
11328         ;;
11329 esac
11330 set d_casti32
11331 eval $setvar
11332 $rm_try
11333
11334 : check for ability to cast negative floats to unsigned
11335 echo " "
11336 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11337 $cat >try.c <<EOCP
11338 #include <stdio.h>
11339 #$i_stdlib I_STDLIB
11340 #ifdef I_STDLIB
11341 #include <stdlib.h>
11342 #endif
11343 #include <sys/types.h>
11344 #include <signal.h>
11345 $signal_t blech(int s) { exit(7); }
11346 $signal_t blech_in_list(int s) { exit(4); }
11347 unsigned long dummy_long(unsigned long p) { return p; }
11348 unsigned int dummy_int(unsigned int p) { return p; }
11349 unsigned short dummy_short(unsigned short p) { return p; }
11350 int main()
11351 {
11352         double f;
11353         unsigned long along;
11354         unsigned int aint;
11355         unsigned short ashort;
11356         int result = 0;
11357         char str[16];
11358
11359         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11360            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11361            optimized the whole file away
11362         */
11363         /* Store the number in a writable string for gcc to pass to
11364            sscanf under HP-UX.
11365         */
11366         sprintf(str, "-123");
11367         sscanf(str, "%lf", &f);  /* f = -123.; */
11368
11369         signal(SIGFPE, blech);
11370         along = (unsigned long)f;
11371         aint = (unsigned int)f;
11372         ashort = (unsigned short)f;
11373         if (along != (unsigned long)-123)
11374                 result |= 1;
11375         if (aint != (unsigned int)-123)
11376                 result |= 1;
11377         if (ashort != (unsigned short)-123)
11378                 result |= 1;
11379         sprintf(str, "1073741824.");
11380         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11381         f = f + f;
11382         along = 0;
11383         along = (unsigned long)f;
11384         if (along != 0x80000000)
11385                 result |= 2;
11386         f -= 1.;
11387         along = 0;
11388         along = (unsigned long)f;
11389         if (along != 0x7fffffff)
11390                 result |= 1;
11391         f += 2.;
11392         along = 0;
11393         along = (unsigned long)f;
11394         if (along != 0x80000001)
11395                 result |= 2;
11396         if (result)
11397                 exit(result);
11398         signal(SIGFPE, blech_in_list);
11399         sprintf(str, "123.");
11400         sscanf(str, "%lf", &f);  /* f = 123.; */
11401         along = dummy_long((unsigned long)f);
11402         aint = dummy_int((unsigned int)f);
11403         ashort = dummy_short((unsigned short)f);
11404         if (along != (unsigned long)123)
11405                 result |= 4;
11406         if (aint != (unsigned int)123)
11407                 result |= 4;
11408         if (ashort != (unsigned short)123)
11409                 result |= 4;
11410         exit(result);
11411
11412 }
11413 EOCP
11414 set try
11415 if eval $compile_ok; then
11416         $run ./try
11417         castflags=$?
11418 else
11419         echo "(I can't seem to compile the test program--assuming it can't)"
11420         castflags=7
11421 fi
11422 case "$castflags" in
11423 0)      val="$define"
11424         echo "Yup, it can."
11425         ;;
11426 *)      val="$undef"
11427         echo "Nope, it can't."
11428         ;;
11429 esac
11430 set d_castneg
11431 eval $setvar
11432 $rm_try
11433
11434 : see if vprintf exists
11435 echo " "
11436 if set vprintf val -f d_vprintf; eval $csym; $val; then
11437         echo 'vprintf() found.' >&4
11438         val="$define"
11439         $cat >try.c <<EOF
11440 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11441 #$i_varargs I_VARARGS
11442
11443 #$i_stdlib I_STDLIB
11444 #$i_unistd I_UNISTD
11445
11446 #ifdef I_STDARG
11447 #  include <stdarg.h>
11448 #else /* I_VARARGS */
11449 #  include <varargs.h>
11450 #endif
11451
11452 #ifdef I_UNISTD
11453 #  include <unistd.h>
11454 #endif
11455
11456 #ifdef I_STDLIB
11457 #  include <stdlib.h>
11458 #endif
11459
11460 #include <stdio.h> /* vsprintf prototype */
11461
11462 #ifdef I_STDARG
11463 void xxx(int n, ...)
11464 {
11465     va_list args;
11466     char buf[10];
11467     va_start(args, n);
11468     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11469 }
11470 int main() { xxx(1, "foo"); }
11471
11472 #else /* I_VARARGS */
11473
11474 xxx(va_alist)
11475 va_dcl
11476 {
11477     va_list args;
11478     char buf[10];
11479     va_start(args);
11480     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11481 }
11482 int main() { xxx("foo"); }
11483
11484 #endif
11485
11486 EOF
11487         set try
11488         if eval $compile_ok; then
11489                 if $run ./try; then
11490                         echo "Your vsprintf() returns (int)." >&4
11491                         val2="$undef"
11492                 else
11493                         echo "Your vsprintf() returns (char*)." >&4
11494                         val2="$define"
11495                 fi
11496         else
11497                 echo 'I am unable to compile the vsprintf() test program.' >&4
11498                 # We shouldn't get here.  If we do, assume the standard signature,
11499                 # not the old BSD one.
11500                 echo 'Guessing that vsprintf() returns (int).' >&4
11501                 val2="$undef"
11502         fi
11503 else
11504         echo 'vprintf() NOT found.' >&4
11505         val="$undef"
11506         val2="$undef"
11507 fi
11508 $rm_try
11509 set d_vprintf
11510 eval $setvar
11511 val=$val2
11512 set d_charvspr
11513 eval $setvar
11514
11515 : see if chown exists
11516 set chown d_chown
11517 eval $inlibc
11518
11519 : see if chroot exists
11520 set chroot d_chroot
11521 eval $inlibc
11522
11523 : see if chsize exists
11524 set chsize d_chsize
11525 eval $inlibc
11526
11527 : see if class exists
11528 set class d_class
11529 eval $inlibc
11530
11531 : see if clearenv exists
11532 set clearenv d_clearenv
11533 eval $inlibc
11534
11535 : Define hasstruct macro for Configure internal use
11536 hasstruct='varname=$1; struct=$2; shift; shift;
11537 while $test $# -ge 2; do
11538         case "$1" in
11539         $define) echo "#include <$2>";;
11540         esac ;
11541     shift 2;
11542 done > try.c;
11543 echo "int main () { struct $struct foo; }" >> try.c;
11544 set try;
11545 if eval $compile; then
11546         val="$define";
11547 else
11548         val="$undef";
11549 fi;
11550 set $varname;
11551 eval $setvar;
11552 $rm_try'
11553
11554 : see whether socket exists
11555 socketlib=''
11556 sockethdr=''
11557 echo " "
11558 $echo $n "Hmm... $c" >&4
11559 if set socket val -f d_socket; eval $csym; $val; then
11560     echo "Looks like you have Berkeley networking support." >&4
11561     d_socket="$define"
11562     if set setsockopt val -f; eval $csym; $val; then
11563         d_oldsock="$undef"
11564     else
11565         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11566         d_oldsock="$define"
11567     fi
11568 else
11569     if $contains socklib libc.list >/dev/null 2>&1; then
11570         echo "Looks like you have Berkeley networking support." >&4
11571         d_socket="$define"
11572         : we will have to assume that it supports the 4.2 BSD interface
11573         d_oldsock="$undef"
11574     else
11575         echo "You don't have Berkeley networking in libc$_a..." >&4
11576         if test "X$d_socket" = "X$define"; then
11577             echo "...but you seem to believe that you have sockets." >&4
11578         else
11579             for net in net socket
11580             do
11581                 if test -f $sysroot/usr/lib/lib$net$_a; then
11582                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11583                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11584                     if $contains socket libc.list >/dev/null 2>&1; then
11585                         d_socket="$define"
11586                         socketlib="-l$net"
11587                         case "$net" in
11588                         net)
11589                             echo "...but the Wollongong group seems to have hacked it in." >&4
11590                             sockethdr="-I$sysroot/usr/netinclude"
11591                             ;;
11592                         esac
11593                         echo "Found Berkeley sockets interface in lib$net." >&4
11594                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11595                             d_oldsock="$undef"
11596                         else
11597                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11598                             d_oldsock="$define"
11599                         fi
11600                         break
11601                     fi
11602                 fi
11603             done
11604             if test "X$d_socket" != "X$define"; then
11605                echo "or anywhere else I see." >&4
11606                d_socket="$undef"
11607                d_oldsock="$undef"
11608             fi
11609         fi
11610     fi
11611 fi
11612
11613 : see if socketpair exists
11614 set socketpair d_sockpair
11615 eval $inlibc
11616
11617
11618 echo " "
11619 echo "Checking the availability sa_len in the sock struct ..." >&4
11620 $cat >try.c <<EOF
11621 #include <sys/types.h>
11622 #include <sys/socket.h>
11623 int main() {
11624 struct sockaddr sa;
11625 return (sa.sa_len);
11626 }
11627 EOF
11628 val="$undef"
11629 set try; if eval $compile; then
11630     val="$define"
11631 fi
11632 set d_sockaddr_sa_len; eval $setvar
11633 $rm_try
11634
11635 echo " "
11636 echo "Checking the availability struct sockaddr_in6 ..." >&4
11637 $cat >try.c <<EOF
11638 #include <sys/types.h>
11639 #include <sys/socket.h>
11640 #include <netinet/in.h>
11641 int main() {
11642 struct sockaddr_in6 sin6;
11643 return (sin6.sin6_family);
11644 }
11645 EOF
11646 val="$undef"
11647 set try; if eval $compile; then
11648     val="$define"
11649 fi
11650 set d_sockaddr_in6; eval $setvar
11651 $rm_try
11652
11653 echo " "
11654 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11655 $cat >try.c <<EOF
11656 #include <sys/types.h>
11657 #include <sys/socket.h>
11658 #include <netinet/in.h>
11659 int main() {
11660 struct sockaddr_in6 sin6;
11661 return (sin6.sin6_scope_id);
11662 }
11663 EOF
11664 val="$undef"
11665 set try; if eval $compile; then
11666     val="$define"
11667 fi
11668 set d_sin6_scope_id; eval $setvar
11669 $rm_try
11670
11671 echo " "
11672 echo "Checking the availability struct ip_mreq ..." >&4
11673 $cat >try.c <<EOF
11674 #include <sys/types.h>
11675 #include <sys/socket.h>
11676 #include <netinet/in.h>
11677 int main() {
11678 struct ip_mreq mreq;
11679 return (mreq.imr_multiaddr.s_addr);
11680 }
11681 EOF
11682 val="$undef"
11683 set try; if eval $compile; then
11684        val="$define"
11685 fi
11686 set d_ip_mreq; eval $setvar
11687 $rm_try
11688
11689 echo " "
11690 echo "Checking the availability struct ip_mreq_source ..." >&4
11691 $cat >try.c <<EOF
11692 #include <sys/types.h>
11693 #include <sys/socket.h>
11694 #include <netinet/in.h>
11695 int main() {
11696 struct ip_mreq_source mreq;
11697 return (mreq.imr_multiaddr.s_addr);
11698 }
11699 EOF
11700 val="$undef"
11701 set try; if eval $compile; then
11702        val="$define"
11703 fi
11704 set d_ip_mreq_source; eval $setvar
11705 $rm_try
11706
11707 echo " "
11708 echo "Checking the availability struct ipv6_mreq ..." >&4
11709 $cat >try.c <<EOF
11710 #include <sys/types.h>
11711 #include <sys/socket.h>
11712 #include <netinet/in.h>
11713 int main() {
11714 struct ipv6_mreq mreq;
11715 return (mreq.ipv6mr_interface);
11716 }
11717 EOF
11718 val="$undef"
11719 set try; if eval $compile; then
11720     val="$define"
11721 fi
11722 set d_ipv6_mreq; eval $setvar
11723 $rm_try
11724
11725 echo " "
11726 echo "Checking the availability struct ipv6_mreq_source ..." >&4
11727 $cat >try.c <<EOF
11728 #include <sys/types.h>
11729 #include <sys/socket.h>
11730 #include <netinet/in.h>
11731 int main() {
11732 struct ipv6_mreq_source mreq;
11733 return (mreq.imr_multiaddr.s_addr);
11734 }
11735 EOF
11736 val="$undef"
11737 set try; if eval $compile; then
11738        val="$define"
11739 fi
11740 set d_ipv6_mreq_source; eval $setvar
11741 $rm_try
11742
11743 echo " "
11744 echo "Checking the availability of certain socket constants..." >&4
11745 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11746     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11747     $cat >try.c <<EOF
11748 #include <sys/types.h>
11749 #include <sys/socket.h>
11750 int main() {
11751     int i = $ENUM;
11752 }
11753 EOF
11754     val="$undef"
11755     set try; if eval $compile; then
11756         val="$define"
11757     fi
11758     set d_${enum}; eval $setvar
11759     $rm_try
11760 done
11761
11762 : see if this is a sys/uio.h system
11763 set sys/uio.h i_sysuio
11764 eval $inhdr
11765
11766 : Check for cmsghdr support
11767 echo " "
11768 echo "Checking to see if your system supports struct cmsghdr..." >&4
11769 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11770 eval $hasstruct
11771 case "$d_cmsghdr_s" in
11772 "$define")      echo "Yes, it does."   ;;
11773 *)              echo "No, it doesn't." ;;
11774 esac
11775
11776
11777 : check for const keyword
11778 echo " "
11779 echo 'Checking to see if your C compiler knows about "const"...' >&4
11780 $cat >const.c <<'EOCP'
11781 typedef struct spug { int drokk; } spug;
11782 int main()
11783 {
11784         const char *foo;
11785         const spug y = { 0 };
11786 }
11787 EOCP
11788 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11789         val="$define"
11790         echo "Yup, it does."
11791 else
11792         val="$undef"
11793         echo "Nope, it doesn't."
11794 fi
11795 set d_const
11796 eval $setvar
11797
11798 : see if copysignl exists
11799 set copysignl d_copysignl
11800 eval $inlibc
11801
11802 : see if crypt exists
11803 echo " "
11804 set crypt d_crypt
11805 eval $inlibc
11806 case "$d_crypt" in
11807 $define) cryptlib='' ;;
11808 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11809                 echo 'crypt() found.' >&4
11810                 val="$define"
11811                 cryptlib=''
11812         else
11813                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11814                 if $test -z "$cryptlib"; then
11815                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11816                 else
11817                         cryptlib=-lcrypt
11818                 fi
11819                 if $test -z "$cryptlib"; then
11820                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11821                 else
11822                         cryptlib=-lcrypt
11823                 fi
11824                 if $test -z "$cryptlib"; then
11825                         cryptlib=`./loc libcrypt$_a "" $libpth`
11826                 else
11827                         cryptlib=-lcrypt
11828                 fi
11829                 if $test -z "$cryptlib"; then
11830                         echo 'crypt() NOT found.' >&4
11831                         val="$undef"
11832                 else
11833                         val="$define"
11834                 fi
11835         fi
11836         set d_crypt
11837         eval $setvar
11838         ;;
11839 esac
11840
11841 : see if this is a crypt.h system
11842 set crypt.h i_crypt
11843 eval $inhdr
11844
11845 : see if crypt_r exists
11846 set crypt_r d_crypt_r
11847 eval $inlibc
11848 case "$d_crypt_r" in
11849 "$define")
11850         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11851         case "$d_crypt_r_proto:$usethreads" in
11852         ":define")      d_crypt_r_proto=define
11853                 set d_crypt_r_proto crypt_r $hdrs
11854                 eval $hasproto ;;
11855         *)      ;;
11856         esac
11857         case "$d_crypt_r_proto" in
11858         define)
11859         case "$crypt_r_proto" in
11860         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11861         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11862         esac
11863         case "$crypt_r_proto" in
11864         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11865         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11866         esac
11867         case "$crypt_r_proto" in
11868         ''|0)   d_crypt_r=undef
11869                 crypt_r_proto=0
11870                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11871         * )     case "$crypt_r_proto" in
11872                 REENTRANT_PROTO*) ;;
11873                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11874                 esac
11875                 echo "Prototype: $try" ;;
11876         esac
11877         ;;
11878         *)      case "$usethreads" in
11879                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11880                 esac
11881                 d_crypt_r=undef
11882                 crypt_r_proto=0
11883                 ;;
11884         esac
11885         ;;
11886 *)      crypt_r_proto=0
11887         ;;
11888 esac
11889
11890 : get csh whereabouts
11891 case "$csh" in
11892 'csh') val="$undef" ;;
11893 *) val="$define" ;;
11894 esac
11895 set d_csh
11896 eval $setvar
11897 : Respect a hint or command line value for full_csh.
11898 case "$full_csh" in
11899 '') full_csh=$csh ;;
11900 esac
11901
11902 : see if ctermid exists
11903 set ctermid d_ctermid
11904 eval $inlibc
11905
11906 : see if ctermid_r exists
11907 set ctermid_r d_ctermid_r
11908 eval $inlibc
11909 case "$d_ctermid_r" in
11910 "$define")
11911         hdrs="$i_systypes sys/types.h define stdio.h "
11912         case "$d_ctermid_r_proto:$usethreads" in
11913         ":define")      d_ctermid_r_proto=define
11914                 set d_ctermid_r_proto ctermid_r $hdrs
11915                 eval $hasproto ;;
11916         *)      ;;
11917         esac
11918         case "$d_ctermid_r_proto" in
11919         define)
11920         case "$ctermid_r_proto" in
11921         ''|0) try='char* ctermid_r(char*);'
11922         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11923         esac
11924         case "$ctermid_r_proto" in
11925         ''|0)   d_ctermid_r=undef
11926                 ctermid_r_proto=0
11927                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11928         * )     case "$ctermid_r_proto" in
11929                 REENTRANT_PROTO*) ;;
11930                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11931                 esac
11932                 echo "Prototype: $try" ;;
11933         esac
11934         ;;
11935         *)      case "$usethreads" in
11936                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11937                 esac
11938                 d_ctermid_r=undef
11939                 ctermid_r_proto=0
11940                 ;;
11941         esac
11942         ;;
11943 *)      ctermid_r_proto=0
11944         ;;
11945 esac
11946
11947 : see if ctime_r exists
11948 set ctime_r d_ctime_r
11949 eval $inlibc
11950 case "$d_ctime_r" in
11951 "$define")
11952         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11953         case "$d_ctime_r_proto:$usethreads" in
11954         ":define")      d_ctime_r_proto=define
11955                 set d_ctime_r_proto ctime_r $hdrs
11956                 eval $hasproto ;;
11957         *)      ;;
11958         esac
11959         case "$d_ctime_r_proto" in
11960         define)
11961         case "$ctime_r_proto" in
11962         ''|0) try='char* ctime_r(const time_t*, char*);'
11963         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11964         esac
11965         case "$ctime_r_proto" in
11966         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11967         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11968         esac
11969         case "$ctime_r_proto" in
11970         ''|0) try='int ctime_r(const time_t*, char*);'
11971         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11972         esac
11973         case "$ctime_r_proto" in
11974         ''|0) try='int ctime_r(const time_t*, char*, int);'
11975         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11976         esac
11977         case "$ctime_r_proto" in
11978         ''|0)   d_ctime_r=undef
11979                 ctime_r_proto=0
11980                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11981         * )     case "$ctime_r_proto" in
11982                 REENTRANT_PROTO*) ;;
11983                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11984                 esac
11985                 echo "Prototype: $try" ;;
11986         esac
11987         ;;
11988         *)      case "$usethreads" in
11989                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11990                 esac
11991                 d_ctime_r=undef
11992                 ctime_r_proto=0
11993                 ;;
11994         esac
11995         ;;
11996 *)      ctime_r_proto=0
11997         ;;
11998 esac
11999
12000 : see if cuserid exists
12001 set cuserid d_cuserid
12002 eval $inlibc
12003
12004 : see if this is a limits.h system
12005 set limits.h i_limits
12006 eval $inhdr
12007
12008 : see if this is a float.h system
12009 set float.h i_float
12010 eval $inhdr
12011
12012 : See if number of significant digits in a double precision number is known
12013 echo " "
12014 $cat >dbl_dig.c <<EOM
12015 #$i_limits I_LIMITS
12016 #$i_float I_FLOAT
12017 #ifdef I_LIMITS
12018 #include <limits.h>
12019 #endif
12020 #ifdef I_FLOAT
12021 #include <float.h>
12022 #endif
12023 #ifdef DBL_DIG
12024 printf("Contains DBL_DIG");
12025 #endif
12026 EOM
12027 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
12028 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
12029         echo "DBL_DIG found." >&4
12030         val="$define"
12031 else
12032         echo "DBL_DIG NOT found." >&4
12033         val="$undef"
12034 fi
12035 $rm -f dbl_dig.?
12036 set d_dbl_dig
12037 eval $setvar
12038
12039 : see if dbm.h is available
12040 : see if dbmclose exists
12041 set dbmclose d_dbmclose
12042 eval $inlibc
12043
12044 case "$d_dbmclose" in
12045 $define)
12046         set dbm.h i_dbm
12047         eval $inhdr
12048         case "$i_dbm" in
12049         $define)
12050                 val="$undef"
12051                 set i_rpcsvcdbm
12052                 eval $setvar
12053                 ;;
12054         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12055                 eval $inhdr
12056                 ;;
12057         esac
12058         ;;
12059 *)      echo "We won't be including <dbm.h>"
12060         val="$undef"
12061         set i_dbm
12062         eval $setvar
12063         val="$undef"
12064         set i_rpcsvcdbm
12065         eval $setvar
12066         ;;
12067 esac
12068
12069 : see if prototype for dbminit is available
12070 echo " "
12071 set d_dbminitproto dbminit $i_dbm dbm.h
12072 eval $hasproto
12073
12074 : see if difftime exists
12075 set difftime d_difftime
12076 eval $inlibc
12077
12078 : see if this is a dirent system
12079 echo " "
12080 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12081         val="$define"
12082         echo "<dirent.h> found." >&4
12083 else
12084         val="$undef"
12085         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12086                 echo "<sys/dir.h> found." >&4
12087                 echo " "
12088         else
12089                 xinc=`./findhdr sys/ndir.h`
12090         fi
12091         echo "<dirent.h> NOT found." >&4
12092 fi
12093 set i_dirent
12094 eval $setvar
12095
12096 : Look for type of directory structure.
12097 echo " "
12098 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12099
12100 case "$direntrytype" in
12101 ''|' ')
12102         case "$i_dirent" in
12103         $define) guess1='struct dirent' ;;
12104         *) guess1='struct direct'  ;;
12105         esac
12106         ;;
12107 *)      guess1="$direntrytype"
12108         ;;
12109 esac
12110
12111 case "$guess1" in
12112 'struct dirent') guess2='struct direct' ;;
12113 *) guess2='struct dirent' ;;
12114 esac
12115
12116 if $contains "$guess1" try.c >/dev/null 2>&1; then
12117         direntrytype="$guess1"
12118         echo "Your directory entries are $direntrytype." >&4
12119 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12120         direntrytype="$guess2"
12121         echo "Your directory entries seem to be $direntrytype." >&4
12122 else
12123         echo "I don't recognize your system's directory entries." >&4
12124         rp="What type is used for directory entries on this system?"
12125         dflt="$guess1"
12126         . ./myread
12127         direntrytype="$ans"
12128 fi
12129 $rm_try
12130
12131 : see if the directory entry stores field length
12132 echo " "
12133 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12134 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12135         echo "Good, your directory entry keeps length information in d_namlen." >&4
12136         val="$define"
12137 else
12138         echo "Your directory entry does not know about the d_namlen field." >&4
12139         val="$undef"
12140 fi
12141 set d_dirnamlen
12142 eval $setvar
12143 $rm_try
12144
12145 : Look for DIR.dd_fd
12146 case "$i_dirent" in
12147 "$define")
12148     echo "Checking to see if DIR has a dd_fd member variable" >&4
12149     $cat >try.c <<EOCP
12150 #$i_stdlib I_STDLIB
12151 #ifdef I_STDLIB
12152 #include <stdlib.h>
12153 #endif
12154 #include <dirent.h>
12155
12156 int main() {
12157     DIR dir;
12158     dir.dd_fd = 1;
12159     return 0;
12160 }
12161 EOCP
12162     val=$undef
12163     set try
12164     if eval $compile; then
12165         echo "Yes, it does."
12166         val="$define"
12167     else
12168         echo "No, it does not."
12169         val="$undef"
12170     fi
12171     ;;
12172 *)
12173     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12174     val="$undef"
12175     ;;
12176 esac
12177 set d_dir_dd_fd
12178 eval $setvar
12179 $rm_try
12180
12181 : see if this is an sysdir system
12182 set sys/dir.h i_sysdir
12183 eval $inhdr
12184
12185 : see if this is an sysndir system
12186 set sys/ndir.h i_sysndir
12187 eval $inhdr
12188
12189 : Look for dirfd
12190 echo " "
12191 $cat >dirfd.c <<EOM
12192 #include <stdio.h>
12193 #$i_stdlib I_STDLIB
12194 #ifdef I_STDLIB
12195 #include <stdlib.h>
12196 #endif
12197 #$i_dirent I_DIRENT             /**/
12198 #$i_sysdir I_SYS_DIR            /**/
12199 #$i_sysndir I_SYS_NDIR          /**/
12200 #$i_systypes I_SYS_TYPES        /**/
12201 #if defined(I_SYS_TYPES)
12202 #include <sys/types.h>
12203 #endif
12204 #if defined(I_DIRENT)
12205 #include <dirent.h>
12206 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12207 #include <sys/dir.h>
12208 #endif
12209 #else
12210 #ifdef I_SYS_NDIR
12211 #include <sys/ndir.h>
12212 #else
12213 #ifdef I_SYS_DIR
12214 #ifdef hp9000s500
12215 #include <ndir.h>       /* may be wrong in the future */
12216 #else
12217 #include <sys/dir.h>
12218 #endif
12219 #endif
12220 #endif
12221 #endif
12222 int main() {
12223         DIR *dirp = opendir(".");
12224         if (dirfd(dirp) >= 0)
12225                 exit(0);
12226         else
12227                 exit(1);
12228 }
12229 EOM
12230 val=$undef
12231 set dirfd
12232 if eval $compile; then
12233         val="$define"
12234 fi
12235 case "$val" in
12236 $define)        echo "dirfd() found." >&4       ;;
12237 *)              echo "dirfd() NOT found." >&4   ;;
12238 esac
12239 set d_dirfd
12240 eval $setvar
12241 $rm -f dirfd*
12242
12243 : see if dladdr exists
12244 set dladdr d_dladdr
12245 eval $inlibc
12246
12247 : see if dlerror exists
12248 xxx_runnm="$runnm"
12249 runnm=false
12250 set dlerror d_dlerror
12251 eval $inlibc
12252 runnm="$xxx_runnm"
12253
12254 : see if dlfcn is available
12255 set dlfcn.h i_dlfcn
12256 eval $inhdr
12257
12258 : Check what extension to use for shared libs
12259 case "$usedl" in
12260 $define|y|true)
12261         $cat << EOM
12262
12263 On a few systems, the dynamically loaded modules that perl generates and uses
12264 will need a different extension than shared libs. The default will probably
12265 be appropriate.
12266
12267 EOM
12268         case "$dlext" in
12269         '')     dflt="$so" ;;
12270         *)      dflt="$dlext" ;;
12271         esac
12272         rp='What is the extension of dynamically loaded modules'
12273         . ./myread
12274         dlext="$ans"
12275         ;;
12276 *)
12277         dlext="none"
12278         ;;
12279 esac
12280
12281 : Check if dlsym need a leading underscore
12282 echo " "
12283 val="$undef"
12284
12285 case "$dlsrc" in
12286 dl_dlopen.xs)
12287         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12288         $cat >dyna.c <<'EOM'
12289 fred () { }
12290 EOM
12291
12292 $cat >fred.c<<EOM
12293
12294 #include <stdio.h>
12295 #$i_stdlib I_STDLIB
12296 #ifdef I_STDLIB
12297 #include <stdlib.h>
12298 #endif
12299 #$i_dlfcn I_DLFCN
12300 #ifdef I_DLFCN
12301 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12302 #else
12303 #include <sys/types.h>
12304 #include <nlist.h>
12305 #include <link.h>
12306 #endif
12307
12308 extern int fred() ;
12309
12310 int main()
12311 {
12312     void * handle ;
12313     void * symbol ;
12314 #ifndef RTLD_LAZY
12315     int mode = 1 ;
12316 #else
12317     int mode = RTLD_LAZY ;
12318 #endif
12319     handle = dlopen("./dyna.$dlext", mode) ;
12320     if (handle == NULL) {
12321         printf ("1\n") ;
12322         fflush (stdout) ;
12323         exit(0);
12324     }
12325     symbol = dlsym(handle, "fred") ;
12326     if (symbol == NULL) {
12327         /* try putting a leading underscore */
12328         symbol = dlsym(handle, "_fred") ;
12329         if (symbol == NULL) {
12330             printf ("2\n") ;
12331             fflush (stdout) ;
12332             exit(0);
12333         }
12334         printf ("3\n") ;
12335     }
12336     else
12337         printf ("4\n") ;
12338     fflush (stdout) ;
12339     exit(0);
12340 }
12341 EOM
12342         : Call the object file tmp-dyna.o in case dlext=o.
12343         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12344                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12345                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12346                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12347                 xxx=`$run ./fred`
12348                 case $xxx in
12349                 1)      echo "Test program failed using dlopen." >&4
12350                         echo "Perhaps you should not use dynamic loading." >&4;;
12351                 2)      echo "Test program failed using dlsym." >&4
12352                         echo "Perhaps you should not use dynamic loading." >&4;;
12353                 3)      echo "dlsym needs a leading underscore" >&4
12354                         val="$define" ;;
12355                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12356                 esac
12357         else
12358                 echo "I can't compile and run the test program." >&4
12359                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12360         fi
12361         ;;
12362 esac
12363
12364 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12365
12366 set d_dlsymun
12367 eval $setvar
12368
12369 : see if drand48_r exists
12370 set drand48_r d_drand48_r
12371 eval $inlibc
12372 case "$d_drand48_r" in
12373 "$define")
12374         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12375         case "$d_drand48_r_proto:$usethreads" in
12376         ":define")      d_drand48_r_proto=define
12377                 set d_drand48_r_proto drand48_r $hdrs
12378                 eval $hasproto ;;
12379         *)      ;;
12380         esac
12381         case "$d_drand48_r_proto" in
12382         define)
12383         case "$drand48_r_proto" in
12384         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12385         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12386         esac
12387         case "$drand48_r_proto" in
12388         ''|0)   d_drand48_r=undef
12389                 drand48_r_proto=0
12390                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12391         * )     case "$drand48_r_proto" in
12392                 REENTRANT_PROTO*) ;;
12393                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12394                 esac
12395                 echo "Prototype: $try" ;;
12396         esac
12397         ;;
12398         *)      case "$usethreads" in
12399                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12400                 esac
12401                 d_drand48_r=undef
12402                 drand48_r_proto=0
12403                 ;;
12404         esac
12405         ;;
12406 *)      drand48_r_proto=0
12407         ;;
12408 esac
12409
12410 : see if prototype for drand48 is available
12411 echo " "
12412 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12413 eval $hasproto
12414
12415 : see if dup2 exists
12416 set dup2 d_dup2
12417 eval $inlibc
12418
12419 : see if eaccess exists
12420 set eaccess d_eaccess
12421 eval $inlibc
12422
12423 : see if endgrent exists
12424 set endgrent d_endgrent
12425 eval $inlibc
12426
12427 : see if this is an grp system
12428 set grp.h i_grp
12429 eval $inhdr
12430
12431 case "$i_grp" in
12432 $define)
12433         xxx=`./findhdr grp.h`
12434         $cppstdin $cppflags $cppminus < $xxx >$$.h
12435
12436         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12437                 val="$define"
12438         else
12439                 val="$undef"
12440         fi
12441         set d_grpasswd
12442         eval $setvar
12443
12444         $rm -f $$.h
12445         ;;
12446 *)
12447         val="$undef";
12448         set d_grpasswd; eval $setvar
12449         ;;
12450 esac
12451
12452 : see if endgrent_r exists
12453 set endgrent_r d_endgrent_r
12454 eval $inlibc
12455 case "$d_endgrent_r" in
12456 "$define")
12457         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12458         case "$d_endgrent_r_proto:$usethreads" in
12459         ":define")      d_endgrent_r_proto=define
12460                 set d_endgrent_r_proto endgrent_r $hdrs
12461                 eval $hasproto ;;
12462         *)      ;;
12463         esac
12464         case "$d_endgrent_r_proto" in
12465         define)
12466         case "$endgrent_r_proto" in
12467         ''|0) try='int endgrent_r(FILE**);'
12468         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12469         esac
12470         case "$endgrent_r_proto" in
12471         ''|0) try='void endgrent_r(FILE**);'
12472         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12473         esac
12474         case "$endgrent_r_proto" in
12475         ''|0)   d_endgrent_r=undef
12476                 endgrent_r_proto=0
12477                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12478         * )     case "$endgrent_r_proto" in
12479                 REENTRANT_PROTO*) ;;
12480                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12481                 esac
12482                 echo "Prototype: $try" ;;
12483         esac
12484         ;;
12485         *)      case "$usethreads" in
12486                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12487                 esac
12488                 d_endgrent_r=undef
12489                 endgrent_r_proto=0
12490                 ;;
12491         esac
12492         ;;
12493 *)      endgrent_r_proto=0
12494         ;;
12495 esac
12496
12497 : see if endhostent exists
12498 set endhostent d_endhent
12499 eval $inlibc
12500
12501 : see if this is a netdb.h system
12502 set netdb.h i_netdb
12503 eval $inhdr
12504
12505 : see if endhostent_r exists
12506 set endhostent_r d_endhostent_r
12507 eval $inlibc
12508 case "$d_endhostent_r" in
12509 "$define")
12510         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12511         case "$d_endhostent_r_proto:$usethreads" in
12512         ":define")      d_endhostent_r_proto=define
12513                 set d_endhostent_r_proto endhostent_r $hdrs
12514                 eval $hasproto ;;
12515         *)      ;;
12516         esac
12517         case "$d_endhostent_r_proto" in
12518         define)
12519         case "$endhostent_r_proto" in
12520         ''|0) try='int endhostent_r(struct hostent_data*);'
12521         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12522         esac
12523         case "$endhostent_r_proto" in
12524         ''|0) try='void endhostent_r(struct hostent_data*);'
12525         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12526         esac
12527         case "$endhostent_r_proto" in
12528         ''|0)   d_endhostent_r=undef
12529                 endhostent_r_proto=0
12530                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12531         * )     case "$endhostent_r_proto" in
12532                 REENTRANT_PROTO*) ;;
12533                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12534                 esac
12535                 echo "Prototype: $try" ;;
12536         esac
12537         ;;
12538         *)      case "$usethreads" in
12539                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12540                 esac
12541                 d_endhostent_r=undef
12542                 endhostent_r_proto=0
12543                 ;;
12544         esac
12545         ;;
12546 *)      endhostent_r_proto=0
12547         ;;
12548 esac
12549
12550 : see if endnetent exists
12551 set endnetent d_endnent
12552 eval $inlibc
12553
12554 : see if endnetent_r exists
12555 set endnetent_r d_endnetent_r
12556 eval $inlibc
12557 case "$d_endnetent_r" in
12558 "$define")
12559         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12560         case "$d_endnetent_r_proto:$usethreads" in
12561         ":define")      d_endnetent_r_proto=define
12562                 set d_endnetent_r_proto endnetent_r $hdrs
12563                 eval $hasproto ;;
12564         *)      ;;
12565         esac
12566         case "$d_endnetent_r_proto" in
12567         define)
12568         case "$endnetent_r_proto" in
12569         ''|0) try='int endnetent_r(struct netent_data*);'
12570         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12571         esac
12572         case "$endnetent_r_proto" in
12573         ''|0) try='void endnetent_r(struct netent_data*);'
12574         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12575         esac
12576         case "$endnetent_r_proto" in
12577         ''|0)   d_endnetent_r=undef
12578                 endnetent_r_proto=0
12579                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12580         * )     case "$endnetent_r_proto" in
12581                 REENTRANT_PROTO*) ;;
12582                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12583                 esac
12584                 echo "Prototype: $try" ;;
12585         esac
12586         ;;
12587         *)      case "$usethreads" in
12588                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12589                 esac
12590                 d_endnetent_r=undef
12591                 endnetent_r_proto=0
12592                 ;;
12593         esac
12594         ;;
12595 *)      endnetent_r_proto=0
12596         ;;
12597 esac
12598
12599 : see if endprotoent exists
12600 set endprotoent d_endpent
12601 eval $inlibc
12602
12603 : see if endprotoent_r exists
12604 set endprotoent_r d_endprotoent_r
12605 eval $inlibc
12606 case "$d_endprotoent_r" in
12607 "$define")
12608         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12609         case "$d_endprotoent_r_proto:$usethreads" in
12610         ":define")      d_endprotoent_r_proto=define
12611                 set d_endprotoent_r_proto endprotoent_r $hdrs
12612                 eval $hasproto ;;
12613         *)      ;;
12614         esac
12615         case "$d_endprotoent_r_proto" in
12616         define)
12617         case "$endprotoent_r_proto" in
12618         ''|0) try='int endprotoent_r(struct protoent_data*);'
12619         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12620         esac
12621         case "$endprotoent_r_proto" in
12622         ''|0) try='void endprotoent_r(struct protoent_data*);'
12623         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12624         esac
12625         case "$endprotoent_r_proto" in
12626         ''|0)   d_endprotoent_r=undef
12627                 endprotoent_r_proto=0
12628                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12629         * )     case "$endprotoent_r_proto" in
12630                 REENTRANT_PROTO*) ;;
12631                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12632                 esac
12633                 echo "Prototype: $try" ;;
12634         esac
12635         ;;
12636         *)      case "$usethreads" in
12637                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12638                 esac
12639                 d_endprotoent_r=undef
12640                 endprotoent_r_proto=0
12641                 ;;
12642         esac
12643         ;;
12644 *)      endprotoent_r_proto=0
12645         ;;
12646 esac
12647
12648 : see if endpwent exists
12649 set endpwent d_endpwent
12650 eval $inlibc
12651
12652 : see if this is a pwd.h system
12653 set pwd.h i_pwd
12654 eval $inhdr
12655
12656 case "$i_pwd" in
12657 $define)
12658         xxx=`./findhdr pwd.h`
12659         $cppstdin $cppflags $cppminus < $xxx >$$.h
12660
12661         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12662                 val="$define"
12663         else
12664                 val="$undef"
12665         fi
12666         set d_pwquota
12667         eval $setvar
12668
12669         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12670                 val="$define"
12671         else
12672                 val="$undef"
12673         fi
12674         set d_pwage
12675         eval $setvar
12676
12677         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12678                 val="$define"
12679         else
12680                 val="$undef"
12681         fi
12682         set d_pwchange
12683         eval $setvar
12684
12685         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12686                 val="$define"
12687         else
12688                 val="$undef"
12689         fi
12690         set d_pwclass
12691         eval $setvar
12692
12693         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12694                 val="$define"
12695         else
12696                 val="$undef"
12697         fi
12698         set d_pwexpire
12699         eval $setvar
12700
12701         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12702                 val="$define"
12703         else
12704                 val="$undef"
12705         fi
12706         set d_pwcomment
12707         eval $setvar
12708
12709         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12710                 val="$define"
12711         else
12712                 val="$undef"
12713         fi
12714         set d_pwgecos
12715         eval $setvar
12716
12717         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12718                 val="$define"
12719         else
12720                 val="$undef"
12721         fi
12722         set d_pwpasswd
12723         eval $setvar
12724
12725         $rm -f $$.h
12726         ;;
12727 *)
12728         val="$undef";
12729         set d_pwquota; eval $setvar
12730         set d_pwage; eval $setvar
12731         set d_pwchange; eval $setvar
12732         set d_pwclass; eval $setvar
12733         set d_pwexpire; eval $setvar
12734         set d_pwcomment; eval $setvar
12735         set d_pwgecos; eval $setvar
12736         set d_pwpasswd; eval $setvar
12737         ;;
12738 esac
12739
12740 : see if endpwent_r exists
12741 set endpwent_r d_endpwent_r
12742 eval $inlibc
12743 case "$d_endpwent_r" in
12744 "$define")
12745         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12746         case "$d_endpwent_r_proto:$usethreads" in
12747         ":define")      d_endpwent_r_proto=define
12748                 set d_endpwent_r_proto endpwent_r $hdrs
12749                 eval $hasproto ;;
12750         *)      ;;
12751         esac
12752         case "$d_endpwent_r_proto" in
12753         define)
12754         case "$endpwent_r_proto" in
12755         ''|0) try='int endpwent_r(FILE**);'
12756         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12757         esac
12758         case "$endpwent_r_proto" in
12759         ''|0) try='void endpwent_r(FILE**);'
12760         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12761         esac
12762         case "$endpwent_r_proto" in
12763         ''|0)   d_endpwent_r=undef
12764                 endpwent_r_proto=0
12765                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12766         * )     case "$endpwent_r_proto" in
12767                 REENTRANT_PROTO*) ;;
12768                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12769                 esac
12770                 echo "Prototype: $try" ;;
12771         esac
12772         ;;
12773         *)      case "$usethreads" in
12774                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12775                 esac
12776                 d_endpwent_r=undef
12777                 endpwent_r_proto=0
12778                 ;;
12779         esac
12780         ;;
12781 *)      endpwent_r_proto=0
12782         ;;
12783 esac
12784
12785 : see if endservent exists
12786 set endservent d_endsent
12787 eval $inlibc
12788
12789 : see if endservent_r exists
12790 set endservent_r d_endservent_r
12791 eval $inlibc
12792 case "$d_endservent_r" in
12793 "$define")
12794         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12795         case "$d_endservent_r_proto:$usethreads" in
12796         ":define")      d_endservent_r_proto=define
12797                 set d_endservent_r_proto endservent_r $hdrs
12798                 eval $hasproto ;;
12799         *)      ;;
12800         esac
12801         case "$d_endservent_r_proto" in
12802         define)
12803         case "$endservent_r_proto" in
12804         ''|0) try='int endservent_r(struct servent_data*);'
12805         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12806         esac
12807         case "$endservent_r_proto" in
12808         ''|0) try='void endservent_r(struct servent_data*);'
12809         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12810         esac
12811         case "$endservent_r_proto" in
12812         ''|0)   d_endservent_r=undef
12813                 endservent_r_proto=0
12814                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12815         * )     case "$endservent_r_proto" in
12816                 REENTRANT_PROTO*) ;;
12817                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12818                 esac
12819                 echo "Prototype: $try" ;;
12820         esac
12821         ;;
12822         *)      case "$usethreads" in
12823                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12824                 esac
12825                 d_endservent_r=undef
12826                 endservent_r_proto=0
12827                 ;;
12828         esac
12829         ;;
12830 *)      endservent_r_proto=0
12831         ;;
12832 esac
12833
12834 : Locate the flags for 'open()'
12835 echo " "
12836 $cat >try.c <<EOCP
12837 #include <sys/types.h>
12838 #ifdef I_FCNTL
12839 #include <fcntl.h>
12840 #endif
12841 #ifdef I_SYS_FILE
12842 #include <sys/file.h>
12843 #endif
12844 #$i_stdlib I_STDLIB
12845 #ifdef I_STDLIB
12846 #include <stdlib.h>
12847 #endif
12848 int main() {
12849         if(O_RDONLY);
12850 #ifdef O_TRUNC
12851         exit(0);
12852 #else
12853         exit(1);
12854 #endif
12855 }
12856 EOCP
12857 : check sys/file.h first to get FREAD on Sun
12858 if $test `./findhdr sys/file.h` && \
12859                 set try -DI_SYS_FILE && eval $compile; then
12860         h_sysfile=true;
12861         echo "<sys/file.h> defines the O_* constants..." >&4
12862         if $run ./try; then
12863                 echo "and you have the 3 argument form of open()." >&4
12864                 val="$define"
12865         else
12866                 echo "but not the 3 argument form of open().  Oh, well." >&4
12867                 val="$undef"
12868         fi
12869 elif $test `./findhdr fcntl.h` && \
12870                 set try -DI_FCNTL && eval $compile; then
12871         h_fcntl=true;
12872         echo "<fcntl.h> defines the O_* constants..." >&4
12873         if $run ./try; then
12874                 echo "and you have the 3 argument form of open()." >&4
12875                 val="$define"
12876         else
12877                 echo "but not the 3 argument form of open().  Oh, well." >&4
12878                 val="$undef"
12879         fi
12880 else
12881         val="$undef"
12882         echo "I can't find the O_* constant definitions!  You got problems." >&4
12883 fi
12884 set d_open3
12885 eval $setvar
12886 $rm_try
12887
12888 : see if this is a sys/file.h system
12889 val=''
12890 set sys/file.h val
12891 eval $inhdr
12892
12893 : do we need to include sys/file.h ?
12894 case "$val" in
12895 "$define")
12896         echo " "
12897         if $h_sysfile; then
12898                 val="$define"
12899                 echo "We'll be including <sys/file.h>." >&4
12900         else
12901                 val="$undef"
12902                 echo "We won't be including <sys/file.h>." >&4
12903         fi
12904         ;;
12905 *)
12906         h_sysfile=false
12907         ;;
12908 esac
12909 set i_sysfile
12910 eval $setvar
12911
12912 : see if fcntl.h is there
12913 val=''
12914 set fcntl.h val
12915 eval $inhdr
12916
12917 : see if we can include fcntl.h
12918 case "$val" in
12919 "$define")
12920         echo " "
12921         if $h_fcntl; then
12922                 val="$define"
12923                 echo "We'll be including <fcntl.h>." >&4
12924         else
12925                 val="$undef"
12926                 if $h_sysfile; then
12927         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12928                 else
12929                         echo "We won't be including <fcntl.h>." >&4
12930                 fi
12931         fi
12932         ;;
12933 *)
12934         h_fcntl=false
12935         val="$undef"
12936         ;;
12937 esac
12938 set i_fcntl
12939 eval $setvar
12940
12941 : see if fork exists
12942 set fork d_fork
12943 eval $inlibc
12944
12945 : see if pipe exists
12946 set pipe d_pipe
12947 eval $inlibc
12948
12949 : check for non-blocking I/O stuff
12950 case "$h_sysfile" in
12951 true) echo "#include <sys/file.h>" > head.c;;
12952 *)
12953        case "$h_fcntl" in
12954        true) echo "#include <fcntl.h>" > head.c;;
12955        *) echo "#include <sys/fcntl.h>" > head.c;;
12956        esac
12957        ;;
12958 esac
12959 echo " "
12960 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12961 case "$o_nonblock" in
12962 '')
12963         $cat head.c > try.c
12964         $cat >>try.c <<EOCP
12965 #include <stdio.h>
12966 #$i_stdlib I_STDLIB
12967 #ifdef I_STDLIB
12968 #include <stdlib.h>
12969 #endif
12970 #$i_fcntl I_FCNTL
12971 #ifdef I_FCNTL
12972 #include <fcntl.h>
12973 #endif
12974 int main() {
12975 #ifdef O_NONBLOCK
12976         printf("O_NONBLOCK\n");
12977         exit(0);
12978 #endif
12979 #ifdef O_NDELAY
12980         printf("O_NDELAY\n");
12981         exit(0);
12982 #endif
12983 #ifdef FNDELAY
12984         printf("FNDELAY\n");
12985         exit(0);
12986 #endif
12987         exit(0);
12988 }
12989 EOCP
12990         set try
12991         if eval $compile_ok; then
12992                 o_nonblock=`$run ./try`
12993                 case "$o_nonblock" in
12994                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12995                 *) echo "Seems like we can use $o_nonblock.";;
12996                 esac
12997         else
12998                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12999         fi
13000         ;;
13001 *) echo "Using $hint value $o_nonblock.";;
13002 esac
13003 $rm_try
13004
13005 echo " "
13006 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13007 case "$eagain" in
13008 '')
13009         case "$d_fork:$d_pipe" in
13010         define:define)
13011         $cat head.c > try.c
13012         $cat >>try.c <<EOCP
13013 #include <errno.h>
13014 #include <sys/types.h>
13015 #include <signal.h>
13016 #include <stdio.h>
13017 #$i_stdlib I_STDLIB
13018 #ifdef I_STDLIB
13019 #include <stdlib.h>
13020 #endif
13021 #$i_fcntl I_FCNTL
13022 #ifdef I_FCNTL
13023 #include <fcntl.h>
13024 #endif
13025 #define MY_O_NONBLOCK $o_nonblock
13026 #ifndef errno  /* XXX need better Configure test */
13027 extern int errno;
13028 #endif
13029 #$i_unistd I_UNISTD
13030 #ifdef I_UNISTD
13031 #include <unistd.h>
13032 #endif
13033 #$i_string I_STRING
13034 #ifdef I_STRING
13035 #include <string.h>
13036 #else
13037 #include <strings.h>
13038 #endif
13039 $signal_t blech(int x) { exit(3); }
13040 EOCP
13041         $cat >> try.c <<'EOCP'
13042 int main()
13043 {
13044         int pd[2];
13045         int pu[2];
13046         char buf[1];
13047         char string[100];
13048
13049         pipe(pd);       /* Down: child -> parent */
13050         pipe(pu);       /* Up: parent -> child */
13051         if (0 != fork()) {
13052                 int ret;
13053                 close(pd[1]);   /* Parent reads from pd[0] */
13054                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13055 #ifdef F_SETFL
13056                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13057                         exit(1);
13058 #else
13059                 exit(4);
13060 #endif
13061                 signal(SIGALRM, blech);
13062                 alarm(5);
13063                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13064                         exit(2);
13065                 sprintf(string, "%d\n", ret);
13066                 write(2, string, strlen(string));
13067                 alarm(0);
13068 #ifdef EAGAIN
13069                 if (errno == EAGAIN) {
13070                         printf("EAGAIN\n");
13071                         goto ok;
13072                 }
13073 #endif
13074 #ifdef EWOULDBLOCK
13075                 if (errno == EWOULDBLOCK)
13076                         printf("EWOULDBLOCK\n");
13077 #endif
13078         ok:
13079                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
13080                 sleep(2);                               /* Give it time to close our pipe */
13081                 alarm(5);
13082                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13083                 alarm(0);
13084                 sprintf(string, "%d\n", ret);
13085                 write(4, string, strlen(string));
13086                 exit(0);
13087         }
13088
13089         close(pd[0]);                   /* We write to pd[1] */
13090         close(pu[1]);                   /* We read from pu[0] */
13091         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
13092         close(pd[1]);                   /* Pipe pd is now fully closed! */
13093         exit(0);                                /* Bye bye, thank you for playing! */
13094 }
13095 EOCP
13096         set try
13097         if eval $compile_ok; then
13098                 echo "$startsh" >mtry
13099                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13100                 chmod +x mtry
13101                 $run ./mtry >/dev/null 2>&1
13102                 case $? in
13103                 0) eagain=`$cat try.out`;;
13104                 1) echo "Could not perform non-blocking setting!";;
13105                 2) echo "I did a successful read() for something that was not there!";;
13106                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13107                 4) echo "Could not find F_SETFL!";;
13108                 *) echo "Something terribly wrong happened during testing.";;
13109                 esac
13110                 rd_nodata=`$cat try.ret`
13111                 echo "A read() system call with no data present returns $rd_nodata."
13112                 case "$rd_nodata" in
13113                 0|-1) ;;
13114                 *)
13115                         echo "(That's peculiar, fixing that to be -1.)"
13116                         rd_nodata=-1
13117                         ;;
13118                 esac
13119                 case "$eagain" in
13120                 '')
13121                         echo "Forcing errno EAGAIN on read() with no data available."
13122                         eagain=EAGAIN
13123                         ;;
13124                 *)
13125                         echo "Your read() sets errno to $eagain when no data is available."
13126                         ;;
13127                 esac
13128                 status=`$cat try.err`
13129                 case "$status" in
13130                 0) echo "And it correctly returns 0 to signal EOF.";;
13131                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13132                 *) echo "However, your read() returns '$status' on EOF??";;
13133                 esac
13134                 val="$define"
13135                 if test "$status" = "$rd_nodata"; then
13136                         echo "WARNING: you can't distinguish between EOF and no data!"
13137                         val="$undef"
13138                 fi
13139         else
13140                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13141                 eagain=EAGAIN
13142         fi
13143         ;;
13144         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13145                 eagain=EAGAIN
13146                 val="$define"
13147                 ;;
13148         esac
13149         set d_eofnblk
13150         eval $setvar
13151         ;;
13152 *)
13153         echo "Using $hint value $eagain."
13154         echo "Your read() returns $rd_nodata when no data is present."
13155         case "$d_eofnblk" in
13156         "$define") echo "And you can see EOF because read() returns 0.";;
13157         "$undef") echo "But you can't see EOF status from read() returned value.";;
13158         *)
13159                 echo "(Assuming you can't see EOF status from read anyway.)"
13160                 d_eofnblk=$undef
13161                 ;;
13162         esac
13163         ;;
13164 esac
13165 $rm_try head.c mtry
13166
13167 : see if _ptr and _cnt from stdio act std
13168 echo " "
13169
13170 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13171         echo "(Looks like you have stdio.h from BSD.)"
13172         case "$stdio_ptr" in
13173         '') stdio_ptr='((fp)->_p)'
13174                 ptr_lval=$define
13175                 ;;
13176         *)      ptr_lval=$d_stdio_ptr_lval;;
13177         esac
13178         case "$stdio_cnt" in
13179         '') stdio_cnt='((fp)->_r)'
13180                 cnt_lval=$define
13181                 ;;
13182         *)      cnt_lval=$d_stdio_cnt_lval;;
13183         esac
13184         case "$stdio_base" in
13185         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13186         esac
13187         case "$stdio_bufsiz" in
13188         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13189         esac
13190 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13191         echo "(Looks like you have stdio.h from Linux.)"
13192         case "$stdio_ptr" in
13193         '') stdio_ptr='((fp)->_IO_read_ptr)'
13194                 ptr_lval=$define
13195                 ;;
13196         *)      ptr_lval=$d_stdio_ptr_lval;;
13197         esac
13198         case "$stdio_cnt" in
13199         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13200                 cnt_lval=$undef
13201                 ;;
13202         *)      cnt_lval=$d_stdio_cnt_lval;;
13203         esac
13204         case "$stdio_base" in
13205         '') stdio_base='((fp)->_IO_read_base)';;
13206         esac
13207         case "$stdio_bufsiz" in
13208         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13209         esac
13210 else
13211         case "$stdio_ptr" in
13212         '') stdio_ptr='((fp)->_ptr)'
13213                 ptr_lval=$define
13214                 ;;
13215         *)      ptr_lval=$d_stdio_ptr_lval;;
13216         esac
13217         case "$stdio_cnt" in
13218         '') stdio_cnt='((fp)->_cnt)'
13219                 cnt_lval=$define
13220                 ;;
13221         *)      cnt_lval=$d_stdio_cnt_lval;;
13222         esac
13223         case "$stdio_base" in
13224         '') stdio_base='((fp)->_base)';;
13225         esac
13226         case "$stdio_bufsiz" in
13227         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13228         esac
13229 fi
13230
13231 : test whether _ptr and _cnt really work
13232 echo "Checking how std your stdio is..." >&4
13233 $cat >try.c <<EOP
13234 #include <stdio.h>
13235 #$i_stdlib I_STDLIB
13236 #ifdef I_STDLIB
13237 #include <stdlib.h>
13238 #endif
13239 #define FILE_ptr(fp)    $stdio_ptr
13240 #define FILE_cnt(fp)    $stdio_cnt
13241 int main() {
13242         FILE *fp = fopen("try.c", "r");
13243         char c = getc(fp);
13244         if (
13245                 18 <= FILE_cnt(fp) &&
13246                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13247         )
13248                 exit(0);
13249         exit(1);
13250 }
13251 EOP
13252 val="$undef"
13253 set try
13254 if eval $compile && $to try.c; then
13255         if $run ./try; then
13256                 echo "Your stdio acts pretty std."
13257                 val="$define"
13258         else
13259                 echo "Your stdio isn't very std."
13260         fi
13261 else
13262         echo "Your stdio doesn't appear very std."
13263 fi
13264 $rm_try
13265
13266 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13267 # direct buffer manipulation no longer works.  The Configure tests
13268 # should be changed to correctly detect this, but until then,
13269 # the following check should at least let perl compile and run.
13270 # (This quick fix should be updated before 5.8.1.)
13271 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13272 # A. Dougherty, June 3, 2002.
13273 case "$d_gnulibc" in
13274 $define)
13275         case "$gnulibc_version" in
13276         2.[01]*)  ;;
13277         2.2) ;;
13278         2.2.[0-9]) ;;
13279         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13280                 val="$undef"
13281                 ;;
13282         esac
13283         ;;
13284 esac
13285 set d_stdstdio
13286 eval $setvar
13287
13288 : Can _ptr be used as an lvalue?
13289 case "$d_stdstdio$ptr_lval" in
13290 $define$define) val=$define ;;
13291 *) val=$undef ;;
13292 esac
13293 set d_stdio_ptr_lval
13294 eval $setvar
13295
13296 : Can _cnt be used as an lvalue?
13297 case "$d_stdstdio$cnt_lval" in
13298 $define$define) val=$define ;;
13299 *) val=$undef ;;
13300 esac
13301 set d_stdio_cnt_lval
13302 eval $setvar
13303
13304
13305 : test whether setting _ptr sets _cnt as a side effect
13306 d_stdio_ptr_lval_sets_cnt="$undef"
13307 d_stdio_ptr_lval_nochange_cnt="$undef"
13308 case "$d_stdio_ptr_lval$d_stdstdio" in
13309 $define$define)
13310         echo "Checking to see what happens if we set the stdio ptr..." >&4
13311 $cat >try.c <<EOP
13312 #include <stdio.h>
13313 /* Can we scream? */
13314 /* Eat dust sed :-) */
13315 /* In the buffer space, no one can hear you scream. */
13316 #$i_stdlib I_STDLIB
13317 #ifdef I_STDLIB
13318 #include <stdlib.h>
13319 #endif
13320 #define FILE_ptr(fp)    $stdio_ptr
13321 #define FILE_cnt(fp)    $stdio_cnt
13322 #include <sys/types.h>
13323 int main() {
13324         FILE *fp = fopen("try.c", "r");
13325         int c;
13326         char *ptr;
13327         size_t cnt;
13328         if (!fp) {
13329             puts("Fail even to read");
13330             exit(1);
13331         }
13332         c = getc(fp); /* Read away the first # */
13333         if (c == EOF) {
13334             puts("Fail even to read");
13335             exit(1);
13336         }
13337         if (!(
13338                 18 <= FILE_cnt(fp) &&
13339                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13340         )) {
13341                 puts("Fail even to read");
13342                 exit (1);
13343         }
13344         ptr = (char*) FILE_ptr(fp);
13345         cnt = (size_t)FILE_cnt(fp);
13346
13347         FILE_ptr(fp) += 42;
13348
13349         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13350                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13351                 exit (1);
13352         }
13353         if (FILE_cnt(fp) <= 20) {
13354                 printf ("Fail (<20 chars to test)");
13355                 exit (1);
13356         }
13357         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13358                 puts("Fail compare");
13359                 exit (1);
13360         }
13361         if (cnt == FILE_cnt(fp)) {
13362                 puts("Pass_unchanged");
13363                 exit (0);
13364         }
13365         if (FILE_cnt(fp) == (cnt - 42)) {
13366                 puts("Pass_changed");
13367                 exit (0);
13368         }
13369         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13370         return 1;
13371
13372 }
13373 EOP
13374         set try
13375         if eval $compile && $to try.c; then
13376                 case `$run ./try` in
13377                 Pass_changed)
13378                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13379                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13380                 Pass_unchanged)
13381                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13382                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13383                 Fail*)
13384                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13385                 *)
13386                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13387         esac
13388         else
13389                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13390         fi
13391         $rm_try
13392         ;;
13393 esac
13394
13395 : see if _base is also standard
13396 val="$undef"
13397 case "$d_stdstdio" in
13398 $define)
13399         $cat >try.c <<EOP
13400 #include <stdio.h>
13401 #$i_stdlib I_STDLIB
13402 #ifdef I_STDLIB
13403 #include <stdlib.h>
13404 #endif
13405 #define FILE_base(fp)   $stdio_base
13406 #define FILE_bufsiz(fp) $stdio_bufsiz
13407 int main() {
13408         FILE *fp = fopen("try.c", "r");
13409         char c = getc(fp);
13410         if (
13411                 19 <= FILE_bufsiz(fp) &&
13412                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13413         )
13414                 exit(0);
13415         exit(1);
13416 }
13417 EOP
13418         set try
13419         if eval $compile && $to try.c; then
13420                 if $run ./try; then
13421                         echo "And its _base field acts std."
13422                         val="$define"
13423                 else
13424                         echo "But its _base field isn't std."
13425                 fi
13426         else
13427                 echo "However, it seems to be lacking the _base field."
13428         fi
13429         $rm_try
13430         ;;
13431 esac
13432 set d_stdiobase
13433 eval $setvar
13434
13435 : see if fast_stdio exists
13436 val="$undef"
13437 case "$d_stdstdio:$d_stdio_ptr_lval" in
13438 "$define:$define")
13439         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13440         *$define*)
13441                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13442                 val="$define"
13443                 ;;
13444         esac
13445         ;;
13446 esac
13447 set d_faststdio
13448 eval $setvar
13449
13450
13451
13452 : see if fchdir exists
13453 set fchdir d_fchdir
13454 eval $inlibc
13455
13456 : see if fchmod exists
13457 set fchmod d_fchmod
13458 eval $inlibc
13459
13460 : see if fchown exists
13461 set fchown d_fchown
13462 eval $inlibc
13463
13464 : see if this is an fcntl system
13465 set fcntl d_fcntl
13466 eval $inlibc
13467
13468 : See if fcntl-based locking works.
13469 echo " "
13470 $cat >try.c <<EOCP
13471 #$i_stdlib I_STDLIB
13472 #ifdef I_STDLIB
13473 #include <stdlib.h>
13474 #endif
13475 #include <unistd.h>
13476 #include <fcntl.h>
13477 #include <signal.h>
13478 $signal_t blech(int x) { exit(3); }
13479 int main() {
13480 #if defined(F_SETLK) && defined(F_SETLKW)
13481      struct flock flock;
13482      int retval, fd;
13483      fd = open("try.c", O_RDONLY);
13484      flock.l_type = F_RDLCK;
13485      flock.l_whence = SEEK_SET;
13486      flock.l_start = flock.l_len = 0;
13487      signal(SIGALRM, blech);
13488      alarm(10);
13489      retval = fcntl(fd, F_SETLK, &flock);
13490      close(fd);
13491      (retval < 0 ? exit(2) : exit(0));
13492 #else
13493      exit(2);
13494 #endif
13495 }
13496 EOCP
13497 echo "Checking if fcntl-based file locking works... "
13498 case "$d_fcntl" in
13499 "$define")
13500         set try
13501         if eval $compile_ok; then
13502                 if $run ./try; then
13503                         echo "Yes, it seems to work."
13504                         val="$define"
13505                 else
13506                         echo "Nope, it didn't work."
13507                         val="$undef"
13508                         case "$?" in
13509                         3) $cat >&4 <<EOM
13510 ***
13511 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13512 *** This is (almost) impossible.
13513 *** If your NFS lock daemons are not feeling well, something like
13514 *** this may happen, please investigate.  Cannot continue, aborting.
13515 ***
13516 EOM
13517                                 exit 1
13518                                 ;;
13519                         esac
13520                 fi
13521         else
13522                 echo "I'm unable to compile the test program, so I'll assume not."
13523                 val="$undef"
13524         fi
13525         ;;
13526 *) val="$undef";
13527         echo "Nope, since you don't even have fcntl()."
13528         ;;
13529 esac
13530 set d_fcntl_can_lock
13531 eval $setvar
13532 $rm_try
13533
13534 : check for fd_set items
13535 $cat <<EOM
13536
13537 Checking to see how well your C compiler handles fd_set and friends ...
13538 EOM
13539 $cat >try.c <<EOCP
13540 #$i_stdlib I_STDLIB
13541 #ifdef I_STDLIB
13542 #include <stdlib.h>
13543 #endif
13544 #$i_systime I_SYS_TIME
13545 #$i_sysselct I_SYS_SELECT
13546 #$d_socket HAS_SOCKET
13547 #include <sys/types.h>
13548 #ifdef HAS_SOCKET
13549 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13550 #endif
13551 #ifdef I_SYS_TIME
13552 #include <sys/time.h>
13553 #endif
13554 #ifdef I_SYS_SELECT
13555 #include <sys/select.h>
13556 #endif
13557 int main() {
13558         fd_set fds;
13559
13560 #ifdef TRYBITS
13561         if(fds.fds_bits);
13562 #endif
13563
13564 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13565         exit(0);
13566 #else
13567         exit(1);
13568 #endif
13569 }
13570 EOCP
13571 set try -DTRYBITS
13572 if eval $compile; then
13573         d_fds_bits="$define"
13574         d_fd_set="$define"
13575         echo "Well, your system knows about the normal fd_set typedef..." >&4
13576         if $run ./try; then
13577                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13578                 d_fd_macros="$define"
13579         else
13580                 $cat >&4 <<'EOM'
13581 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13582 EOM
13583                 d_fd_macros="$undef"
13584         fi
13585 else
13586         $cat <<'EOM'
13587 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13588 EOM
13589         set try
13590         if eval $compile; then
13591                 d_fds_bits="$undef"
13592                 d_fd_set="$define"
13593                 echo "Well, your system has some sort of fd_set available..." >&4
13594                 if $run ./try; then
13595                         echo "and you have the normal fd_set macros." >&4
13596                         d_fd_macros="$define"
13597                 else
13598                         $cat <<'EOM'
13599 but not the normal fd_set macros!  Gross!  More work for me...
13600 EOM
13601                         d_fd_macros="$undef"
13602                 fi
13603         else
13604         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13605                 d_fd_set="$undef"
13606                 d_fds_bits="$undef"
13607                 d_fd_macros="$undef"
13608         fi
13609 fi
13610 $rm_try
13611
13612 : see if fgetpos exists
13613 set fgetpos d_fgetpos
13614 eval $inlibc
13615
13616 : see if finite exists
13617 set finite d_finite
13618 eval $inlibc
13619
13620 : see if finitel exists
13621 set finitel d_finitel
13622 eval $inlibc
13623
13624 : see if flock exists
13625 set flock d_flock
13626 eval $inlibc
13627
13628 : see if prototype for flock is available
13629 echo " "
13630 set d_flockproto flock $i_sysfile sys/file.h
13631 eval $hasproto
13632
13633 : see if fp_class exists
13634 set fp_class d_fp_class
13635 eval $inlibc
13636
13637 : see if pathconf exists
13638 set pathconf d_pathconf
13639 eval $inlibc
13640
13641 : see if fpathconf exists
13642 set fpathconf d_fpathconf
13643 eval $inlibc
13644
13645 : see if fpclass exists
13646 set fpclass d_fpclass
13647 eval $inlibc
13648
13649 : see if fpclassify exists
13650 set fpclassify d_fpclassify
13651 eval $inlibc
13652
13653 : see if fpclassl exists
13654 set fpclassl d_fpclassl
13655 eval $inlibc
13656
13657 : check for fpos64_t
13658 echo " "
13659 echo "Checking to see if you have fpos64_t..." >&4
13660 $cat >try.c <<EOCP
13661 #include <stdio.h>
13662 int main() { fpos64_t x = 7; }
13663 EOCP
13664 set try
13665 if eval $compile; then
13666         val="$define"
13667         echo "You have fpos64_t."
13668 else
13669         val="$undef"
13670         echo "You do not have fpos64_t."
13671         case "$fpossize" in
13672         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13673         esac
13674 fi
13675 $rm_try
13676 set d_fpos64_t
13677 eval $setvar
13678
13679 : see if frexpl exists
13680 set frexpl d_frexpl
13681 eval $inlibc
13682
13683 : see if this is a sys/param system
13684 set sys/param.h i_sysparam
13685 eval $inhdr
13686
13687 : see if this is a sys/mount.h system
13688 set sys/mount.h i_sysmount
13689 eval $inhdr
13690
13691 : Check for fs_data_s
13692 echo " "
13693 echo "Checking to see if your system supports struct fs_data..." >&4
13694 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13695 eval $hasstruct
13696 case "$d_fs_data_s" in
13697 "$define")      echo "Yes, it does."   ;;
13698 *)              echo "No, it doesn't." ;;
13699 esac
13700
13701 : see if fseeko exists
13702 set fseeko d_fseeko
13703 eval $inlibc
13704 case "$longsize" in
13705 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13706 esac
13707
13708 : see if fsetpos exists
13709 set fsetpos d_fsetpos
13710 eval $inlibc
13711
13712 : see if fstatfs exists
13713 set fstatfs d_fstatfs
13714 eval $inlibc
13715
13716 : see if statvfs exists
13717 set statvfs d_statvfs
13718 eval $inlibc
13719
13720 : see if fstatvfs exists
13721 set fstatvfs d_fstatvfs
13722 eval $inlibc
13723
13724
13725 : see if fsync exists
13726 set fsync d_fsync
13727 eval $inlibc
13728
13729 : see if ftello exists
13730 set ftello d_ftello
13731 eval $inlibc
13732 case "$longsize" in
13733 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13734 esac
13735
13736 : check for a working futimes
13737 d_futimes="$undef"
13738 echo " "
13739 echo "Checking if you have a working futimes()" >&4
13740 $cat >try.c <<EOCP
13741 #include <stdio.h>
13742 #include <sys/time.h>
13743 #include <errno.h>
13744 #include <fcntl.h>
13745
13746 int main ()
13747 {
13748     int fd, rv;
13749     fd = open ("try.c", O_RDWR);
13750     if (-1 == fd) exit (1);
13751     rv = futimes (fd, NULL);
13752     exit (rv == -1 ? errno : 0);
13753 }
13754 EOCP
13755 set try
13756 if eval $compile; then
13757     `$run ./try`
13758     rc=$?
13759     case "$rc" in
13760         0)  echo "Yes, you have" >&4
13761             d_futimes="$define"
13762             ;;
13763         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13764             ;;
13765     esac
13766 else
13767     echo "No, it does not (probably harmless)" >&4
13768 fi
13769 $rm_try
13770
13771 : see if ndbm.h is available
13772 set ndbm.h i_ndbm
13773 eval $inhdr
13774 : Compatibility location for RedHat 7.1
13775 set gdbm/ndbm.h i_gdbmndbm
13776 eval $inhdr
13777 : Compatibility location for Debian 4.0
13778 set gdbm-ndbm.h i_gdbm_ndbm
13779 eval $inhdr
13780
13781 val="$undef"
13782 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13783         : see if dbm_open exists
13784         set dbm_open d_dbm_open
13785         eval $inlibc
13786         case "$d_dbm_open" in
13787         $undef)
13788                 i_ndbm="$undef"
13789                 i_gdbmndbm="$undef"
13790                 i_gdbm_ndbm="$undef"
13791                 echo "We won't be including <ndbm.h>"
13792                 val="$undef"
13793                 ;;
13794         *) val="$define"
13795            ;;
13796         esac
13797 fi
13798 set d_ndbm
13799 eval $setvar
13800
13801 ndbm_hdr_protochk='name=$1; hdr=$2;
13802 eval "ihdr=\$""i_$name";
13803 val="$undef";
13804 if $test "$ihdr" = "$define"; then
13805         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13806         case "$d_cplusplus" in
13807         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13808         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13809         esac;
13810         case "$val" in
13811         $define) $echo "Your <$hdr> seems to have prototypes";;
13812         *) $echo "Your <$hdr> does not seem to have prototypes";;
13813         esac;
13814 fi;
13815 set "d_${name}_h_uses_prototypes";
13816 eval $setvar'
13817
13818 set ndbm ndbm.h
13819 eval $ndbm_hdr_protochk
13820 set gdbmndbm gdbm/ndbm.h
13821 eval $ndbm_hdr_protochk
13822 set gdbm_ndbm gdbm-ndbm.h
13823 eval $ndbm_hdr_protochk
13824
13825 : see if getaddrinfo exists
13826 set getaddrinfo d_getaddrinfo
13827 eval $inlibc
13828
13829 : see if getcwd exists
13830 set getcwd d_getcwd
13831 eval $inlibc
13832
13833 : see if getespwnam exists
13834 set getespwnam d_getespwnam
13835 eval $inlibc
13836
13837 : see if getfsstat exists
13838 set getfsstat d_getfsstat
13839 eval $inlibc
13840
13841 : see if getgrent exists
13842 set getgrent d_getgrent
13843 eval $inlibc
13844
13845 : see if getgrent_r exists
13846 set getgrent_r d_getgrent_r
13847 eval $inlibc
13848 case "$d_getgrent_r" in
13849 "$define")
13850         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13851         case "$d_getgrent_r_proto:$usethreads" in
13852         ":define")      d_getgrent_r_proto=define
13853                 set d_getgrent_r_proto getgrent_r $hdrs
13854                 eval $hasproto ;;
13855         *)      ;;
13856         esac
13857         case "$d_getgrent_r_proto" in
13858         define)
13859         case "$getgrent_r_proto" in
13860         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13861         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13862         esac
13863         case "$getgrent_r_proto" in
13864         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13865         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13866         esac
13867         case "$getgrent_r_proto" in
13868         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13869         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13870         esac
13871         case "$getgrent_r_proto" in
13872         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13873         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13874         esac
13875         case "$getgrent_r_proto" in
13876         ''|0) try='int getgrent_r(struct group*, char*, int);'
13877         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13878         esac
13879         case "$getgrent_r_proto" in
13880         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13881         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13882         esac
13883         case "$getgrent_r_proto" in
13884         ''|0)   d_getgrent_r=undef
13885                 getgrent_r_proto=0
13886                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13887         * )     case "$getgrent_r_proto" in
13888                 REENTRANT_PROTO*) ;;
13889                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13890                 esac
13891                 echo "Prototype: $try" ;;
13892         esac
13893         ;;
13894         *)      case "$usethreads" in
13895                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13896                 esac
13897                 d_getgrent_r=undef
13898                 getgrent_r_proto=0
13899                 ;;
13900         esac
13901         ;;
13902 *)      getgrent_r_proto=0
13903         ;;
13904 esac
13905
13906 : see if getgrgid_r exists
13907 set getgrgid_r d_getgrgid_r
13908 eval $inlibc
13909 case "$d_getgrgid_r" in
13910 "$define")
13911         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13912         case "$d_getgrgid_r_proto:$usethreads" in
13913         ":define")      d_getgrgid_r_proto=define
13914                 set d_getgrgid_r_proto getgrgid_r $hdrs
13915                 eval $hasproto ;;
13916         *)      ;;
13917         esac
13918         case "$d_getgrgid_r_proto" in
13919         define)
13920         case "$getgrgid_r_proto" in
13921         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13922         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13923         esac
13924         case "$getgrgid_r_proto" in
13925         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13926         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13927         esac
13928         case "$getgrgid_r_proto" in
13929         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13930         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13931         esac
13932         case "$getgrgid_r_proto" in
13933         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13934         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13935         esac
13936         case "$getgrgid_r_proto" in
13937         ''|0)   d_getgrgid_r=undef
13938                 getgrgid_r_proto=0
13939                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13940         * )     case "$getgrgid_r_proto" in
13941                 REENTRANT_PROTO*) ;;
13942                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13943                 esac
13944                 echo "Prototype: $try" ;;
13945         esac
13946         ;;
13947         *)      case "$usethreads" in
13948                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13949                 esac
13950                 d_getgrgid_r=undef
13951                 getgrgid_r_proto=0
13952                 ;;
13953         esac
13954         ;;
13955 *)      getgrgid_r_proto=0
13956         ;;
13957 esac
13958
13959 : see if getgrnam_r exists
13960 set getgrnam_r d_getgrnam_r
13961 eval $inlibc
13962 case "$d_getgrnam_r" in
13963 "$define")
13964         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13965         case "$d_getgrnam_r_proto:$usethreads" in
13966         ":define")      d_getgrnam_r_proto=define
13967                 set d_getgrnam_r_proto getgrnam_r $hdrs
13968                 eval $hasproto ;;
13969         *)      ;;
13970         esac
13971         case "$d_getgrnam_r_proto" in
13972         define)
13973         case "$getgrnam_r_proto" in
13974         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13975         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13976         esac
13977         case "$getgrnam_r_proto" in
13978         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13979         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13980         esac
13981         case "$getgrnam_r_proto" in
13982         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13983         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13984         esac
13985         case "$getgrnam_r_proto" in
13986         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13987         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13988         esac
13989         case "$getgrnam_r_proto" in
13990         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13991         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13992         esac
13993         case "$getgrnam_r_proto" in
13994         ''|0)   d_getgrnam_r=undef
13995                 getgrnam_r_proto=0
13996                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13997         * )     case "$getgrnam_r_proto" in
13998                 REENTRANT_PROTO*) ;;
13999                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14000                 esac
14001                 echo "Prototype: $try" ;;
14002         esac
14003         ;;
14004         *)      case "$usethreads" in
14005                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14006                 esac
14007                 d_getgrnam_r=undef
14008                 getgrnam_r_proto=0
14009                 ;;
14010         esac
14011         ;;
14012 *)      getgrnam_r_proto=0
14013         ;;
14014 esac
14015
14016 : see if gethostbyaddr exists
14017 set gethostbyaddr d_gethbyaddr
14018 eval $inlibc
14019
14020 : see if gethostbyname exists
14021 set gethostbyname d_gethbyname
14022 eval $inlibc
14023
14024 : see if gethostent exists
14025 set gethostent d_gethent
14026 eval $inlibc
14027
14028 : see how we will look up host name
14029 echo " "
14030 call=''
14031 if set gethostname val -f d_gethname; eval $csym; $val; then
14032         echo 'gethostname() found.' >&4
14033         d_gethname="$define"
14034         call=gethostname
14035 fi
14036 if set uname val -f d_uname; eval $csym; $val; then
14037         if ./xenix; then
14038                 $cat <<'EOM'
14039 uname() was found, but you're running xenix, and older versions of xenix
14040 have a broken uname(). If you don't really know whether your xenix is old
14041 enough to have a broken system call, use the default answer.
14042
14043 EOM
14044                 dflt=y
14045                 case "$d_uname" in
14046                 "$define") dflt=n;;
14047                 esac
14048                 rp='Is your uname() broken?'
14049                 . ./myread
14050                 case "$ans" in
14051                 n*) d_uname="$define"; call=uname;;
14052                 esac
14053         else
14054                 echo 'uname() found.' >&4
14055                 d_uname="$define"
14056                 case "$call" in
14057                 '') call=uname ;;
14058                 esac
14059         fi
14060 fi
14061 case "$d_gethname" in
14062 '') d_gethname="$undef";;
14063 esac
14064 case "$d_uname" in
14065 '') d_uname="$undef";;
14066 esac
14067 case "$d_uname$d_gethname" in
14068 *define*)
14069         dflt=n
14070         cat <<EOM
14071
14072 Every now and then someone has a $call() that lies about the hostname
14073 but can't be fixed for political or economic reasons.  If you wish, I can
14074 pretend $call() isn't there and maybe compute hostname at run-time
14075 thanks to the '$phostname' command.
14076
14077 EOM
14078         rp="Shall I ignore $call() from now on?"
14079         . ./myread
14080         case "$ans" in
14081         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14082         esac;;
14083 esac
14084 case "$phostname" in
14085 '') aphostname='';;
14086 *) case "$aphostname" in
14087         /*) ;;
14088         *) set X $phostname
14089                 shift
14090                 file=$1
14091                 shift
14092                 file=`./loc $file $file $pth`
14093                 aphostname=`echo $file $*`
14094                 ;;
14095         esac
14096         ;;
14097 esac
14098 case "$d_uname$d_gethname" in
14099 *define*) ;;
14100 *)
14101         case "$phostname" in
14102         '')
14103                 echo "There will be no way for $package to get your hostname." >&4;;
14104         *)
14105         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14106                 ;;
14107         esac;;
14108 esac
14109 case "$d_phostname" in
14110 '') d_phostname="$undef";;
14111 esac
14112
14113 : see if gethostbyaddr_r exists
14114 set gethostbyaddr_r d_gethostbyaddr_r
14115 eval $inlibc
14116 case "$d_gethostbyaddr_r" in
14117 "$define")
14118         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14119         case "$d_gethostbyaddr_r_proto:$usethreads" in
14120         ":define")      d_gethostbyaddr_r_proto=define
14121                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14122                 eval $hasproto ;;
14123         *)      ;;
14124         esac
14125         case "$d_gethostbyaddr_r_proto" in
14126         define)
14127         case "$gethostbyaddr_r_proto" in
14128         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14129         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14130         esac
14131         case "$gethostbyaddr_r_proto" in
14132         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14133         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14134         esac
14135         case "$gethostbyaddr_r_proto" in
14136         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14137         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14138         esac
14139         case "$gethostbyaddr_r_proto" in
14140         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14141         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14142         esac
14143         case "$gethostbyaddr_r_proto" in
14144         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14145         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14146         esac
14147         case "$gethostbyaddr_r_proto" in
14148         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14149         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14150         esac
14151         case "$gethostbyaddr_r_proto" in
14152         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14153         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14154         esac
14155         case "$gethostbyaddr_r_proto" in
14156         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14157         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14158         esac
14159         case "$gethostbyaddr_r_proto" in
14160         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14161         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14162         esac
14163         case "$gethostbyaddr_r_proto" in
14164         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14165         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14166         esac
14167         case "$gethostbyaddr_r_proto" in
14168         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14169         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14170         esac
14171         case "$gethostbyaddr_r_proto" in
14172         ''|0)   d_gethostbyaddr_r=undef
14173                 gethostbyaddr_r_proto=0
14174                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14175         * )     case "$gethostbyaddr_r_proto" in
14176                 REENTRANT_PROTO*) ;;
14177                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14178                 esac
14179                 echo "Prototype: $try" ;;
14180         esac
14181         ;;
14182         *)      case "$usethreads" in
14183                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14184                 esac
14185                 d_gethostbyaddr_r=undef
14186                 gethostbyaddr_r_proto=0
14187                 ;;
14188         esac
14189         ;;
14190 *)      gethostbyaddr_r_proto=0
14191         ;;
14192 esac
14193
14194 : see if gethostbyname_r exists
14195 set gethostbyname_r d_gethostbyname_r
14196 eval $inlibc
14197 case "$d_gethostbyname_r" in
14198 "$define")
14199         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14200         case "$d_gethostbyname_r_proto:$usethreads" in
14201         ":define")      d_gethostbyname_r_proto=define
14202                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14203                 eval $hasproto ;;
14204         *)      ;;
14205         esac
14206         case "$d_gethostbyname_r_proto" in
14207         define)
14208         case "$gethostbyname_r_proto" in
14209         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14210         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14211         esac
14212         case "$gethostbyname_r_proto" in
14213         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14214         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14215         esac
14216         case "$gethostbyname_r_proto" in
14217         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14218         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14219         esac
14220         case "$gethostbyname_r_proto" in
14221         ''|0)   d_gethostbyname_r=undef
14222                 gethostbyname_r_proto=0
14223                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14224         * )     case "$gethostbyname_r_proto" in
14225                 REENTRANT_PROTO*) ;;
14226                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14227                 esac
14228                 echo "Prototype: $try" ;;
14229         esac
14230         ;;
14231         *)      case "$usethreads" in
14232                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14233                 esac
14234                 d_gethostbyname_r=undef
14235                 gethostbyname_r_proto=0
14236                 ;;
14237         esac
14238         ;;
14239 *)      gethostbyname_r_proto=0
14240         ;;
14241 esac
14242
14243 : see if gethostent_r exists
14244 set gethostent_r d_gethostent_r
14245 eval $inlibc
14246 case "$d_gethostent_r" in
14247 "$define")
14248         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14249         case "$d_gethostent_r_proto:$usethreads" in
14250         ":define")      d_gethostent_r_proto=define
14251                 set d_gethostent_r_proto gethostent_r $hdrs
14252                 eval $hasproto ;;
14253         *)      ;;
14254         esac
14255         case "$d_gethostent_r_proto" in
14256         define)
14257         case "$gethostent_r_proto" in
14258         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14259         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14260         esac
14261         case "$gethostent_r_proto" in
14262         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14263         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14264         esac
14265         case "$gethostent_r_proto" in
14266         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14267         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14268         esac
14269         case "$gethostent_r_proto" in
14270         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14271         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14272         esac
14273         case "$gethostent_r_proto" in
14274         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14275         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14276         esac
14277         case "$gethostent_r_proto" in
14278         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14279         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14280         esac
14281         case "$gethostent_r_proto" in
14282         ''|0)   d_gethostent_r=undef
14283                 gethostent_r_proto=0
14284                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14285         * )     case "$gethostent_r_proto" in
14286                 REENTRANT_PROTO*) ;;
14287                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14288                 esac
14289                 echo "Prototype: $try" ;;
14290         esac
14291         ;;
14292         *)      case "$usethreads" in
14293                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14294                 esac
14295                 d_gethostent_r=undef
14296                 gethostent_r_proto=0
14297                 ;;
14298         esac
14299         ;;
14300 *)      gethostent_r_proto=0
14301         ;;
14302 esac
14303
14304 : see if prototypes for various gethostxxx netdb.h functions are available
14305 echo " "
14306 set d_gethostprotos gethostent $i_netdb netdb.h
14307 eval $hasproto
14308
14309 : see if getitimer exists
14310 set getitimer d_getitimer
14311 eval $inlibc
14312
14313 : see if getlogin exists
14314 set getlogin d_getlogin
14315 eval $inlibc
14316
14317 : see if getlogin_r exists
14318 set getlogin_r d_getlogin_r
14319 eval $inlibc
14320 case "$d_getlogin_r" in
14321 "$define")
14322         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14323         case "$d_getlogin_r_proto:$usethreads" in
14324         ":define")      d_getlogin_r_proto=define
14325                 set d_getlogin_r_proto getlogin_r $hdrs
14326                 eval $hasproto ;;
14327         *)      ;;
14328         esac
14329         case "$d_getlogin_r_proto" in
14330         define)
14331         case "$getlogin_r_proto" in
14332         ''|0) try='int getlogin_r(char*, size_t);'
14333         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14334         esac
14335         case "$getlogin_r_proto" in
14336         ''|0) try='int getlogin_r(char*, int);'
14337         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14338         esac
14339         case "$getlogin_r_proto" in
14340         ''|0) try='char* getlogin_r(char*, size_t);'
14341         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14342         esac
14343         case "$getlogin_r_proto" in
14344         ''|0) try='char* getlogin_r(char*, int);'
14345         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14346         esac
14347         case "$getlogin_r_proto" in
14348         ''|0)   d_getlogin_r=undef
14349                 getlogin_r_proto=0
14350                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14351         * )     case "$getlogin_r_proto" in
14352                 REENTRANT_PROTO*) ;;
14353                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14354                 esac
14355                 echo "Prototype: $try" ;;
14356         esac
14357         ;;
14358         *)      case "$usethreads" in
14359                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14360                 esac
14361                 d_getlogin_r=undef
14362                 getlogin_r_proto=0
14363                 ;;
14364         esac
14365         ;;
14366 *)      getlogin_r_proto=0
14367         ;;
14368 esac
14369
14370 : see if getmnt exists
14371 set getmnt d_getmnt
14372 eval $inlibc
14373
14374 : see if getmntent exists
14375 set getmntent d_getmntent
14376 eval $inlibc
14377
14378 : see if getnameinfo exists
14379 set getnameinfo d_getnameinfo
14380 eval $inlibc
14381
14382 : see if getnetbyaddr exists
14383 set getnetbyaddr d_getnbyaddr
14384 eval $inlibc
14385
14386 : see if getnetbyname exists
14387 set getnetbyname d_getnbyname
14388 eval $inlibc
14389
14390 : see if getnetent exists
14391 set getnetent d_getnent
14392 eval $inlibc
14393
14394 : see if getnetbyaddr_r exists
14395 set getnetbyaddr_r d_getnetbyaddr_r
14396 eval $inlibc
14397 case "$d_getnetbyaddr_r" in
14398 "$define")
14399         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14400         case "$d_getnetbyaddr_r_proto:$usethreads" in
14401         ":define")      d_getnetbyaddr_r_proto=define
14402                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14403                 eval $hasproto ;;
14404         *)      ;;
14405         esac
14406         case "$d_getnetbyaddr_r_proto" in
14407         define)
14408         case "$getnetbyaddr_r_proto" in
14409         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14410         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14411         esac
14412         case "$getnetbyaddr_r_proto" in
14413         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14414         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14415         esac
14416         case "$getnetbyaddr_r_proto" in
14417         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14418         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14419         esac
14420         case "$getnetbyaddr_r_proto" in
14421         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14422         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14423         esac
14424         case "$getnetbyaddr_r_proto" in
14425         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14426         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14427         esac
14428         case "$getnetbyaddr_r_proto" in
14429         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14430         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14431         esac
14432         case "$getnetbyaddr_r_proto" in
14433         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14434         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14435         esac
14436         case "$getnetbyaddr_r_proto" in
14437         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14438         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14439         esac
14440         case "$getnetbyaddr_r_proto" in
14441         ''|0)   d_getnetbyaddr_r=undef
14442                 getnetbyaddr_r_proto=0
14443                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14444         * )     case "$getnetbyaddr_r_proto" in
14445                 REENTRANT_PROTO*) ;;
14446                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14447                 esac
14448                 echo "Prototype: $try" ;;
14449         esac
14450         ;;
14451         *)      case "$usethreads" in
14452                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14453                 esac
14454                 d_getnetbyaddr_r=undef
14455                 getnetbyaddr_r_proto=0
14456                 ;;
14457         esac
14458         ;;
14459 *)      getnetbyaddr_r_proto=0
14460         ;;
14461 esac
14462
14463 : see if getnetbyname_r exists
14464 set getnetbyname_r d_getnetbyname_r
14465 eval $inlibc
14466 case "$d_getnetbyname_r" in
14467 "$define")
14468         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14469         case "$d_getnetbyname_r_proto:$usethreads" in
14470         ":define")      d_getnetbyname_r_proto=define
14471                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14472                 eval $hasproto ;;
14473         *)      ;;
14474         esac
14475         case "$d_getnetbyname_r_proto" in
14476         define)
14477         case "$getnetbyname_r_proto" in
14478         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14479         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14480         esac
14481         case "$getnetbyname_r_proto" in
14482         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14483         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14484         esac
14485         case "$getnetbyname_r_proto" in
14486         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14487         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14488         esac
14489         case "$getnetbyname_r_proto" in
14490         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14491         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14492         esac
14493         case "$getnetbyname_r_proto" in
14494         ''|0)   d_getnetbyname_r=undef
14495                 getnetbyname_r_proto=0
14496                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14497         * )     case "$getnetbyname_r_proto" in
14498                 REENTRANT_PROTO*) ;;
14499                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14500                 esac
14501                 echo "Prototype: $try" ;;
14502         esac
14503         ;;
14504         *)      case "$usethreads" in
14505                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14506                 esac
14507                 d_getnetbyname_r=undef
14508                 getnetbyname_r_proto=0
14509                 ;;
14510         esac
14511         ;;
14512 *)      getnetbyname_r_proto=0
14513         ;;
14514 esac
14515
14516 : see if getnetent_r exists
14517 set getnetent_r d_getnetent_r
14518 eval $inlibc
14519 case "$d_getnetent_r" in
14520 "$define")
14521         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14522         case "$d_getnetent_r_proto:$usethreads" in
14523         ":define")      d_getnetent_r_proto=define
14524                 set d_getnetent_r_proto getnetent_r $hdrs
14525                 eval $hasproto ;;
14526         *)      ;;
14527         esac
14528         case "$d_getnetent_r_proto" in
14529         define)
14530         case "$getnetent_r_proto" in
14531         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14532         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14533         esac
14534         case "$getnetent_r_proto" in
14535         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14536         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14537         esac
14538         case "$getnetent_r_proto" in
14539         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14540         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14541         esac
14542         case "$getnetent_r_proto" in
14543         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14544         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14545         esac
14546         case "$getnetent_r_proto" in
14547         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14548         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14549         esac
14550         case "$getnetent_r_proto" in
14551         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14552         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14553         esac
14554         case "$getnetent_r_proto" in
14555         ''|0)   d_getnetent_r=undef
14556                 getnetent_r_proto=0
14557                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14558         * )     case "$getnetent_r_proto" in
14559                 REENTRANT_PROTO*) ;;
14560                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14561                 esac
14562                 echo "Prototype: $try" ;;
14563         esac
14564         ;;
14565         *)      case "$usethreads" in
14566                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14567                 esac
14568                 d_getnetent_r=undef
14569                 getnetent_r_proto=0
14570                 ;;
14571         esac
14572         ;;
14573 *)      getnetent_r_proto=0
14574         ;;
14575 esac
14576
14577 : see if prototypes for various getnetxxx netdb.h functions are available
14578 echo " "
14579 set d_getnetprotos getnetent $i_netdb netdb.h
14580 eval $hasproto
14581
14582 : see if getpagesize exists
14583 set getpagesize d_getpagsz
14584 eval $inlibc
14585
14586 : Optional checks for getprotobyname and getprotobynumber
14587
14588 : see if getprotobyname exists
14589 set getprotobyname d_getpbyname
14590 eval $inlibc
14591
14592 : see if getprotobynumber exists
14593 set getprotobynumber d_getpbynumber
14594 eval $inlibc
14595
14596 : see if getprotoent exists
14597 set getprotoent d_getpent
14598 eval $inlibc
14599
14600 : see if getpgid exists
14601 set getpgid d_getpgid
14602 eval $inlibc
14603
14604 : see if getpgrp2 exists
14605 set getpgrp2 d_getpgrp2
14606 eval $inlibc
14607
14608 : see if getppid exists
14609 set getppid d_getppid
14610 eval $inlibc
14611
14612 : see if getpriority exists
14613 set getpriority d_getprior
14614 eval $inlibc
14615
14616 : see if getprotobyname_r exists
14617 set getprotobyname_r d_getprotobyname_r
14618 eval $inlibc
14619 case "$d_getprotobyname_r" in
14620 "$define")
14621         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14622         case "$d_getprotobyname_r_proto:$usethreads" in
14623         ":define")      d_getprotobyname_r_proto=define
14624                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14625                 eval $hasproto ;;
14626         *)      ;;
14627         esac
14628         case "$d_getprotobyname_r_proto" in
14629         define)
14630         case "$getprotobyname_r_proto" in
14631         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14632         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14633         esac
14634         case "$getprotobyname_r_proto" in
14635         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14636         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14637         esac
14638         case "$getprotobyname_r_proto" in
14639         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14640         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14641         esac
14642         case "$getprotobyname_r_proto" in
14643         ''|0)   d_getprotobyname_r=undef
14644                 getprotobyname_r_proto=0
14645                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14646         * )     case "$getprotobyname_r_proto" in
14647                 REENTRANT_PROTO*) ;;
14648                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14649                 esac
14650                 echo "Prototype: $try" ;;
14651         esac
14652         ;;
14653         *)      case "$usethreads" in
14654                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14655                 esac
14656                 d_getprotobyname_r=undef
14657                 getprotobyname_r_proto=0
14658                 ;;
14659         esac
14660         ;;
14661 *)      getprotobyname_r_proto=0
14662         ;;
14663 esac
14664
14665 : see if getprotobynumber_r exists
14666 set getprotobynumber_r d_getprotobynumber_r
14667 eval $inlibc
14668 case "$d_getprotobynumber_r" in
14669 "$define")
14670         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14671         case "$d_getprotobynumber_r_proto:$usethreads" in
14672         ":define")      d_getprotobynumber_r_proto=define
14673                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14674                 eval $hasproto ;;
14675         *)      ;;
14676         esac
14677         case "$d_getprotobynumber_r_proto" in
14678         define)
14679         case "$getprotobynumber_r_proto" in
14680         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14681         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14682         esac
14683         case "$getprotobynumber_r_proto" in
14684         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14685         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14686         esac
14687         case "$getprotobynumber_r_proto" in
14688         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14689         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14690         esac
14691         case "$getprotobynumber_r_proto" in
14692         ''|0)   d_getprotobynumber_r=undef
14693                 getprotobynumber_r_proto=0
14694                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14695         * )     case "$getprotobynumber_r_proto" in
14696                 REENTRANT_PROTO*) ;;
14697                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14698                 esac
14699                 echo "Prototype: $try" ;;
14700         esac
14701         ;;
14702         *)      case "$usethreads" in
14703                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14704                 esac
14705                 d_getprotobynumber_r=undef
14706                 getprotobynumber_r_proto=0
14707                 ;;
14708         esac
14709         ;;
14710 *)      getprotobynumber_r_proto=0
14711         ;;
14712 esac
14713
14714 : see if getprotoent_r exists
14715 set getprotoent_r d_getprotoent_r
14716 eval $inlibc
14717 case "$d_getprotoent_r" in
14718 "$define")
14719         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14720         case "$d_getprotoent_r_proto:$usethreads" in
14721         ":define")      d_getprotoent_r_proto=define
14722                 set d_getprotoent_r_proto getprotoent_r $hdrs
14723                 eval $hasproto ;;
14724         *)      ;;
14725         esac
14726         case "$d_getprotoent_r_proto" in
14727         define)
14728         case "$getprotoent_r_proto" in
14729         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14730         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14731         esac
14732         case "$getprotoent_r_proto" in
14733         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14734         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14735         esac
14736         case "$getprotoent_r_proto" in
14737         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14738         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14739         esac
14740         case "$getprotoent_r_proto" in
14741         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14742         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14743         esac
14744         case "$getprotoent_r_proto" in
14745         ''|0)   d_getprotoent_r=undef
14746                 getprotoent_r_proto=0
14747                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14748         * )     case "$getprotoent_r_proto" in
14749                 REENTRANT_PROTO*) ;;
14750                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14751                 esac
14752                 echo "Prototype: $try" ;;
14753         esac
14754         ;;
14755         *)      case "$usethreads" in
14756                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14757                 esac
14758                 d_getprotoent_r=undef
14759                 getprotoent_r_proto=0
14760                 ;;
14761         esac
14762         ;;
14763 *)      getprotoent_r_proto=0
14764         ;;
14765 esac
14766
14767 : see if prototypes for various getprotoxxx netdb.h functions are available
14768 echo " "
14769 set d_getprotoprotos getprotoent $i_netdb netdb.h
14770 eval $hasproto
14771
14772 : see if getprpwnam exists
14773 set getprpwnam d_getprpwnam
14774 eval $inlibc
14775
14776 : see if getpwent exists
14777 set getpwent d_getpwent
14778 eval $inlibc
14779
14780 : see if getpwent_r exists
14781 set getpwent_r d_getpwent_r
14782 eval $inlibc
14783 case "$d_getpwent_r" in
14784 "$define")
14785         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14786         case "$d_getpwent_r_proto:$usethreads" in
14787         ":define")      d_getpwent_r_proto=define
14788                 set d_getpwent_r_proto getpwent_r $hdrs
14789                 eval $hasproto ;;
14790         *)      ;;
14791         esac
14792         case "$d_getpwent_r_proto" in
14793         define)
14794         case "$getpwent_r_proto" in
14795         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14796         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14797         esac
14798         case "$getpwent_r_proto" in
14799         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14800         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14801         esac
14802         case "$getpwent_r_proto" in
14803         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14804         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14805         esac
14806         case "$getpwent_r_proto" in
14807         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14808         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14809         esac
14810         case "$getpwent_r_proto" in
14811         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14812         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14813         esac
14814         case "$getpwent_r_proto" in
14815         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14816         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14817         esac
14818         case "$getpwent_r_proto" in
14819         ''|0)   d_getpwent_r=undef
14820                 getpwent_r_proto=0
14821                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14822         * )     case "$getpwent_r_proto" in
14823                 REENTRANT_PROTO*) ;;
14824                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14825                 esac
14826                 echo "Prototype: $try" ;;
14827         esac
14828         ;;
14829         *)      case "$usethreads" in
14830                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14831                 esac
14832                 d_getpwent_r=undef
14833                 getpwent_r_proto=0
14834                 ;;
14835         esac
14836         ;;
14837 *)      getpwent_r_proto=0
14838         ;;
14839 esac
14840
14841 : see if getpwnam_r exists
14842 set getpwnam_r d_getpwnam_r
14843 eval $inlibc
14844 case "$d_getpwnam_r" in
14845 "$define")
14846         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14847         case "$d_getpwnam_r_proto:$usethreads" in
14848         ":define")      d_getpwnam_r_proto=define
14849                 set d_getpwnam_r_proto getpwnam_r $hdrs
14850                 eval $hasproto ;;
14851         *)      ;;
14852         esac
14853         case "$d_getpwnam_r_proto" in
14854         define)
14855         case "$getpwnam_r_proto" in
14856         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14857         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14858         esac
14859         case "$getpwnam_r_proto" in
14860         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14861         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14862         esac
14863         case "$getpwnam_r_proto" in
14864         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14865         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14866         esac
14867         case "$getpwnam_r_proto" in
14868         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14869         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14870         esac
14871         case "$getpwnam_r_proto" in
14872         ''|0)   d_getpwnam_r=undef
14873                 getpwnam_r_proto=0
14874                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14875         * )     case "$getpwnam_r_proto" in
14876                 REENTRANT_PROTO*) ;;
14877                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14878                 esac
14879                 echo "Prototype: $try" ;;
14880         esac
14881         ;;
14882         *)      case "$usethreads" in
14883                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14884                 esac
14885                 d_getpwnam_r=undef
14886                 getpwnam_r_proto=0
14887                 ;;
14888         esac
14889         ;;
14890 *)      getpwnam_r_proto=0
14891         ;;
14892 esac
14893
14894 : see if getpwuid_r exists
14895 set getpwuid_r d_getpwuid_r
14896 eval $inlibc
14897 case "$d_getpwuid_r" in
14898 "$define")
14899         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14900         case "$d_getpwuid_r_proto:$usethreads" in
14901         ":define")      d_getpwuid_r_proto=define
14902                 set d_getpwuid_r_proto getpwuid_r $hdrs
14903                 eval $hasproto ;;
14904         *)      ;;
14905         esac
14906         case "$d_getpwuid_r_proto" in
14907         define)
14908         case "$getpwuid_r_proto" in
14909         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14910         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14911         esac
14912         case "$getpwuid_r_proto" in
14913         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14914         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14915         esac
14916         case "$getpwuid_r_proto" in
14917         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14918         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14919         esac
14920         case "$getpwuid_r_proto" in
14921         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14922         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14923         esac
14924         case "$getpwuid_r_proto" in
14925         ''|0)   d_getpwuid_r=undef
14926                 getpwuid_r_proto=0
14927                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14928         * )     case "$getpwuid_r_proto" in
14929                 REENTRANT_PROTO*) ;;
14930                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14931                 esac
14932                 echo "Prototype: $try" ;;
14933         esac
14934         ;;
14935         *)      case "$usethreads" in
14936                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14937                 esac
14938                 d_getpwuid_r=undef
14939                 getpwuid_r_proto=0
14940                 ;;
14941         esac
14942         ;;
14943 *)      getpwuid_r_proto=0
14944         ;;
14945 esac
14946
14947 : Optional checks for getsbyname and getsbyport
14948
14949 : see if getservbyname exists
14950 set getservbyname d_getsbyname
14951 eval $inlibc
14952
14953 : see if getservbyport exists
14954 set getservbyport d_getsbyport
14955 eval $inlibc
14956
14957 : see if getservent exists
14958 set getservent d_getsent
14959 eval $inlibc
14960
14961 : see if getservbyname_r exists
14962 set getservbyname_r d_getservbyname_r
14963 eval $inlibc
14964 case "$d_getservbyname_r" in
14965 "$define")
14966         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14967         case "$d_getservbyname_r_proto:$usethreads" in
14968         ":define")      d_getservbyname_r_proto=define
14969                 set d_getservbyname_r_proto getservbyname_r $hdrs
14970                 eval $hasproto ;;
14971         *)      ;;
14972         esac
14973         case "$d_getservbyname_r_proto" in
14974         define)
14975         case "$getservbyname_r_proto" in
14976         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14977         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14978         esac
14979         case "$getservbyname_r_proto" in
14980         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14981         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14982         esac
14983         case "$getservbyname_r_proto" in
14984         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14985         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14986         esac
14987         case "$getservbyname_r_proto" in
14988         ''|0)   d_getservbyname_r=undef
14989                 getservbyname_r_proto=0
14990                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14991         * )     case "$getservbyname_r_proto" in
14992                 REENTRANT_PROTO*) ;;
14993                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14994                 esac
14995                 echo "Prototype: $try" ;;
14996         esac
14997         ;;
14998         *)      case "$usethreads" in
14999                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15000                 esac
15001                 d_getservbyname_r=undef
15002                 getservbyname_r_proto=0
15003                 ;;
15004         esac
15005         ;;
15006 *)      getservbyname_r_proto=0
15007         ;;
15008 esac
15009
15010 : see if getservbyport_r exists
15011 set getservbyport_r d_getservbyport_r
15012 eval $inlibc
15013 case "$d_getservbyport_r" in
15014 "$define")
15015         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15016         case "$d_getservbyport_r_proto:$usethreads" in
15017         ":define")      d_getservbyport_r_proto=define
15018                 set d_getservbyport_r_proto getservbyport_r $hdrs
15019                 eval $hasproto ;;
15020         *)      ;;
15021         esac
15022         case "$d_getservbyport_r_proto" in
15023         define)
15024         case "$getservbyport_r_proto" in
15025         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15026         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15027         esac
15028         case "$getservbyport_r_proto" in
15029         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15030         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15031         esac
15032         case "$getservbyport_r_proto" in
15033         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15034         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15035         esac
15036         case "$getservbyport_r_proto" in
15037         ''|0)   d_getservbyport_r=undef
15038                 getservbyport_r_proto=0
15039                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15040         * )     case "$getservbyport_r_proto" in
15041                 REENTRANT_PROTO*) ;;
15042                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15043                 esac
15044                 echo "Prototype: $try" ;;
15045         esac
15046         ;;
15047         *)      case "$usethreads" in
15048                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15049                 esac
15050                 d_getservbyport_r=undef
15051                 getservbyport_r_proto=0
15052                 ;;
15053         esac
15054         ;;
15055 *)      getservbyport_r_proto=0
15056         ;;
15057 esac
15058
15059 : see if getservent_r exists
15060 set getservent_r d_getservent_r
15061 eval $inlibc
15062 case "$d_getservent_r" in
15063 "$define")
15064         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15065         case "$d_getservent_r_proto:$usethreads" in
15066         ":define")      d_getservent_r_proto=define
15067                 set d_getservent_r_proto getservent_r $hdrs
15068                 eval $hasproto ;;
15069         *)      ;;
15070         esac
15071         case "$d_getservent_r_proto" in
15072         define)
15073         case "$getservent_r_proto" in
15074         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15075         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15076         esac
15077         case "$getservent_r_proto" in
15078         ''|0) try='int getservent_r(struct servent*, char*, int);'
15079         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15080         esac
15081         case "$getservent_r_proto" in
15082         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15083         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15084         esac
15085         case "$getservent_r_proto" in
15086         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15087         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15088         esac
15089         case "$getservent_r_proto" in
15090         ''|0)   d_getservent_r=undef
15091                 getservent_r_proto=0
15092                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15093         * )     case "$getservent_r_proto" in
15094                 REENTRANT_PROTO*) ;;
15095                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15096                 esac
15097                 echo "Prototype: $try" ;;
15098         esac
15099         ;;
15100         *)      case "$usethreads" in
15101                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15102                 esac
15103                 d_getservent_r=undef
15104                 getservent_r_proto=0
15105                 ;;
15106         esac
15107         ;;
15108 *)      getservent_r_proto=0
15109         ;;
15110 esac
15111
15112 : see if prototypes for various getservxxx netdb.h functions are available
15113 echo " "
15114 set d_getservprotos getservent $i_netdb netdb.h
15115 eval $hasproto
15116
15117 : see if getspnam exists
15118 set getspnam d_getspnam
15119 eval $inlibc
15120
15121 : see if this is a shadow.h system
15122 set shadow.h i_shadow
15123 eval $inhdr
15124
15125 : see if getspnam_r exists
15126 set getspnam_r d_getspnam_r
15127 eval $inlibc
15128 case "$d_getspnam_r" in
15129 "$define")
15130         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15131         case "$d_getspnam_r_proto:$usethreads" in
15132         ":define")      d_getspnam_r_proto=define
15133                 set d_getspnam_r_proto getspnam_r $hdrs
15134                 eval $hasproto ;;
15135         *)      ;;
15136         esac
15137         case "$d_getspnam_r_proto" in
15138         define)
15139         case "$getspnam_r_proto" in
15140         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15141         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15142         esac
15143         case "$getspnam_r_proto" in
15144         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15145         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15146         esac
15147         case "$getspnam_r_proto" in
15148         ''|0)   d_getspnam_r=undef
15149                 getspnam_r_proto=0
15150                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15151         * )     case "$getspnam_r_proto" in
15152                 REENTRANT_PROTO*) ;;
15153                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15154                 esac
15155                 echo "Prototype: $try" ;;
15156         esac
15157         ;;
15158         *)      case "$usethreads" in
15159                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15160                 esac
15161                 d_getspnam_r=undef
15162                 getspnam_r_proto=0
15163                 ;;
15164         esac
15165         ;;
15166 *)      getspnam_r_proto=0
15167         ;;
15168 esac
15169
15170 : see if gettimeofday or ftime exists
15171 set gettimeofday d_gettimeod
15172 eval $inlibc
15173 case "$d_gettimeod" in
15174 "$undef")
15175         set ftime d_ftime 
15176         eval $inlibc
15177         ;;
15178 *)
15179         val="$undef"; set d_ftime; eval $setvar
15180         ;;
15181 esac
15182 case "$d_gettimeod$d_ftime" in
15183 "$undef$undef")
15184         echo " "
15185         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15186         ;;
15187 esac
15188
15189 : see if gmtime_r exists
15190 set gmtime_r d_gmtime_r
15191 eval $inlibc
15192 case "$d_gmtime_r" in
15193 "$define")
15194         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15195         case "$d_gmtime_r_proto:$usethreads" in
15196         ":define")      d_gmtime_r_proto=define
15197                 set d_gmtime_r_proto gmtime_r $hdrs
15198                 eval $hasproto ;;
15199         *)      ;;
15200         esac
15201         case "$d_gmtime_r_proto" in
15202         define)
15203         case "$gmtime_r_proto" in
15204         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15205         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15206         esac
15207         case "$gmtime_r_proto" in
15208         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15209         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15210         esac
15211         case "$gmtime_r_proto" in
15212         ''|0)   d_gmtime_r=undef
15213                 gmtime_r_proto=0
15214                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15215         * )     case "$gmtime_r_proto" in
15216                 REENTRANT_PROTO*) ;;
15217                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15218                 esac
15219                 echo "Prototype: $try" ;;
15220         esac
15221         ;;
15222         *)      case "$usethreads" in
15223                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15224                 esac
15225                 d_gmtime_r=undef
15226                 gmtime_r_proto=0
15227                 ;;
15228         esac
15229         ;;
15230 *)      gmtime_r_proto=0
15231         ;;
15232 esac
15233
15234 : see if hasmntopt exists
15235 set hasmntopt d_hasmntopt
15236 eval $inlibc
15237
15238 : see if this is a netinet/in.h or sys/in.h system
15239 set netinet/in.h i_niin sys/in.h i_sysin
15240 eval $inhdr
15241
15242 : see if arpa/inet.h has to be included
15243 set arpa/inet.h i_arpainet
15244 eval $inhdr
15245
15246 : see if htonl --and friends-- exists
15247 val=''
15248 set htonl val
15249 eval $inlibc
15250
15251 : Maybe they are macros.
15252 case "$val" in
15253 $undef)
15254         $cat >htonl.c <<EOM
15255 #include <stdio.h>
15256 #include <sys/types.h>
15257 #$i_niin I_NETINET_IN
15258 #$i_sysin I_SYS_IN
15259 #$i_arpainet I_ARPA_INET
15260 #ifdef I_NETINET_IN
15261 #include <netinet/in.h>
15262 #endif
15263 #ifdef I_SYS_IN
15264 #include <sys/in.h>
15265 #endif
15266 #ifdef I_ARPA_INET
15267 #include <arpa/inet.h>
15268 #endif
15269 #ifdef htonl
15270 printf("Defined as a macro.");
15271 #endif
15272 EOM
15273         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15274         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15275                 val="$define"
15276                 echo "But it seems to be defined as a macro." >&4
15277         fi
15278         $rm -f htonl.?
15279         ;;
15280 esac
15281 set d_htonl
15282 eval $setvar
15283
15284 : see if ilogbl exists
15285 set ilogbl d_ilogbl
15286 eval $inlibc
15287
15288 : index or strchr
15289 echo " "
15290 if set index val -f; eval $csym; $val; then
15291         if set strchr val -f d_strchr; eval $csym; $val; then
15292                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15293                         val="$define"
15294                         vali="$undef"
15295                         echo "strchr() found." >&4
15296                 else
15297                         val="$undef"
15298                         vali="$define"
15299                         echo "index() found." >&4
15300                 fi
15301         else
15302                 val="$undef"
15303                 vali="$define"
15304                 echo "index() found." >&4
15305         fi
15306 else
15307         if set strchr val -f d_strchr; eval $csym; $val; then
15308                 val="$define"
15309                 vali="$undef"
15310                 echo "strchr() found." >&4
15311         else
15312                 echo "No index() or strchr() found!" >&4
15313                 val="$undef"
15314                 vali="$undef"
15315         fi
15316 fi
15317 set d_strchr; eval $setvar
15318 val="$vali"
15319 set d_index; eval $setvar
15320
15321 : check whether inet_aton exists
15322 set inet_aton d_inetaton
15323 eval $inlibc
15324
15325 : see if inet_ntop exists
15326 set inet_ntop d_inetntop
15327 eval $inlibc
15328
15329 : see if inet_pton exists
15330 set inet_pton d_inetpton
15331 eval $inlibc
15332
15333 : Look for isascii
15334 echo " "
15335 $cat >isascii.c <<EOCP
15336 #include <stdio.h>
15337 #include <ctype.h>
15338 #$i_stdlib I_STDLIB
15339 #ifdef I_STDLIB
15340 #include <stdlib.h>
15341 #endif
15342 int main() {
15343         int c = 'A';
15344         if (isascii(c))
15345                 exit(0);
15346         else
15347                 exit(1);
15348 }
15349 EOCP
15350 set isascii
15351 if eval $compile; then
15352         echo "isascii() found." >&4
15353         val="$define"
15354 else
15355         echo "isascii() NOT found." >&4
15356         val="$undef"
15357 fi
15358 set d_isascii
15359 eval $setvar
15360 $rm -f isascii*
15361
15362 : Look for isblank
15363 echo " "
15364 $cat >isblank.c <<'EOCP'
15365 #include <stdio.h>
15366 #include <ctype.h>
15367 int main() {
15368         int c = ' ';
15369         if (isblank(c))
15370                 return 0 ;
15371         else
15372                 return 1 ;
15373 }
15374 EOCP
15375 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15376         echo "isblank() found." >&4
15377         val="$define"
15378 else
15379         echo "isblank() NOT found." >&4
15380         val="$undef"
15381 fi
15382 set d_isblank
15383 eval $setvar
15384 $rm -f isblank*
15385
15386 : see if isfinite exists
15387 set isfinite d_isfinite
15388 eval $inlibc
15389
15390 : see if isinf exists
15391 set isinf d_isinf
15392 eval $inlibc
15393
15394 : see if isnan exists
15395 set isnan d_isnan
15396 eval $inlibc
15397
15398 : see if isnanl exists
15399 set isnanl d_isnanl
15400 eval $inlibc
15401
15402 : see if killpg exists
15403 set killpg d_killpg
15404 eval $inlibc
15405
15406 : see if lchown exists
15407 echo " "
15408 $cat > try.c <<'EOCP'
15409 /* System header to define __stub macros and hopefully few prototypes,
15410     which can conflict with char lchown(); below.  */
15411 #include <assert.h>
15412 /* Override any gcc2 internal prototype to avoid an error.  */
15413 /* We use char because int might match the return type of a gcc2
15414    builtin and then its argument prototype would still apply.  */
15415 char lchown();
15416 int main() {
15417     /*  The GNU C library defines this for functions which it implements
15418         to always fail with ENOSYS.  Some functions are actually named
15419         something starting with __ and the normal name is an alias.  */
15420 #if defined (__stub_lchown) || defined (__stub___lchown)
15421 choke me
15422 #else
15423 lchown();
15424 #endif
15425 ; return 0; }
15426 EOCP
15427 set try
15428 if eval $compile; then
15429     $echo "lchown() found." >&4
15430     val="$define"
15431 else
15432     $echo "lchown() NOT found." >&4
15433     val="$undef"
15434 fi
15435 set d_lchown
15436 eval $setvar
15437
15438 : See if number of significant digits in a double precision number is known
15439 echo " "
15440 $cat >ldbl_dig.c <<EOM
15441 #$i_limits I_LIMITS
15442 #$i_float I_FLOAT
15443 #ifdef I_LIMITS
15444 #include <limits.h>
15445 #endif
15446 #ifdef I_FLOAT
15447 #include <float.h>
15448 #endif
15449 #ifdef LDBL_DIG
15450 printf("Contains LDBL_DIG");
15451 #endif
15452 EOM
15453 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15454 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15455         echo "LDBL_DIG found." >&4
15456         val="$define"
15457 else
15458         echo "LDBL_DIG NOT found." >&4
15459         val="$undef"
15460 fi
15461 $rm -f ldbl_dig.?
15462 set d_ldbl_dig
15463 eval $setvar
15464
15465 : see if this is a math.h system
15466 set math.h i_math
15467 eval $inhdr
15468
15469 : check to see if math.h defines _LIB_VERSION
15470 d_libm_lib_version="$undef"
15471 case $i_math in
15472     $define)
15473         echo " "
15474         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15475         $cat >try.c <<EOCP
15476 #include <unistd.h>
15477 #include <math.h>
15478 int main (int argc, char *argv[])
15479 {
15480     printf ("%d\n", _LIB_VERSION);
15481     return (0);
15482     } /* main */
15483 EOCP
15484         set try
15485         if eval $compile; then
15486             foo=`$run ./try`
15487             echo "Yes, it does ($foo)" >&4
15488             d_libm_lib_version="$define"
15489         else
15490             echo "No, it does not (probably harmless)" >&4
15491             fi
15492         $rm_try
15493         ;;
15494
15495     esac
15496
15497 : see if link exists
15498 set link d_link
15499 eval $inlibc
15500
15501 : see if localtime_r exists
15502 set localtime_r d_localtime_r
15503 eval $inlibc
15504 case "$d_localtime_r" in
15505 "$define")
15506         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15507         case "$d_localtime_r_proto:$usethreads" in
15508         ":define")      d_localtime_r_proto=define
15509                 set d_localtime_r_proto localtime_r $hdrs
15510                 eval $hasproto ;;
15511         *)      ;;
15512         esac
15513         case "$d_localtime_r_proto" in
15514         define)
15515         case "$localtime_r_proto" in
15516         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15517         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15518         esac
15519         case "$localtime_r_proto" in
15520         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15521         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15522         esac
15523         case "$localtime_r_proto" in
15524         ''|0)   d_localtime_r=undef
15525                 localtime_r_proto=0
15526                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15527         * )     case "$localtime_r_proto" in
15528                 REENTRANT_PROTO*) ;;
15529                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15530                 esac
15531                 echo "Prototype: $try" ;;
15532         esac
15533         ;;
15534         *)      case "$usethreads" in
15535                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15536                 esac
15537                 d_localtime_r=undef
15538                 localtime_r_proto=0
15539                 ;;
15540         esac
15541         ;;
15542 *)      localtime_r_proto=0
15543         ;;
15544 esac
15545
15546 : see if localtime_r calls tzset
15547 case "$localtime_r_proto" in
15548 REENTRANT_PROTO*)
15549         $cat >try.c <<EOCP
15550 /*  Does our libc's localtime_r call tzset ?
15551  *  return 0 if so, 1 otherwise.
15552  */
15553 #$i_systypes    I_SYS_TYPES
15554 #$i_unistd      I_UNISTD
15555 #$i_time        I_TIME
15556 #$i_stdlib      I_STDLIB
15557 #$i_string      I_STRING
15558 #$i_malloc      I_MALLOC
15559 #ifdef I_SYS_TYPES
15560 #  include <sys/types.h>
15561 #endif
15562 #ifdef I_UNISTD
15563 #  include <unistd.h>
15564 #endif
15565 #ifdef I_TIME
15566 #  include <time.h>
15567 #endif
15568 #ifdef I_STDLIB
15569 #include <stdlib.h>
15570 #endif
15571 #ifdef I_STRING
15572 #  include <string.h>
15573 #else
15574 #  include <strings.h>
15575 #endif
15576 #ifdef I_MALLOC
15577 #  include <malloc.h>
15578 #endif
15579 int main()
15580 {
15581     time_t t = time(0L);
15582     char w_tz[]="TZ" "=GMT+5",
15583          e_tz[]="TZ" "=GMT-5",
15584         *tz_e = (char*)malloc(16),
15585         *tz_w = (char*)malloc(16);
15586     struct tm tm_e, tm_w;
15587     memset(&tm_e,'\0',sizeof(struct tm));
15588     memset(&tm_w,'\0',sizeof(struct tm));
15589     strcpy(tz_e,e_tz);
15590     strcpy(tz_w,w_tz);
15591
15592     putenv(tz_e);
15593     localtime_r(&t, &tm_e);
15594
15595     putenv(tz_w);
15596     localtime_r(&t, &tm_w);
15597
15598     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15599         return 1;
15600     return 0;
15601 }
15602 EOCP
15603         set try
15604         if eval $compile; then
15605             if $run ./try; then
15606                 d_localtime_r_needs_tzset=undef;
15607             else
15608                 d_localtime_r_needs_tzset=define;
15609             fi;
15610         else
15611             d_localtime_r_needs_tzset=undef;
15612         fi;
15613      ;;
15614   *)
15615      d_localtime_r_needs_tzset=undef;
15616      ;;
15617 esac
15618 $rm_try
15619
15620 : see if localeconv exists
15621 set localeconv d_locconv
15622 eval $inlibc
15623
15624 : see if lockf exists
15625 set lockf d_lockf
15626 eval $inlibc
15627
15628 : see if prototype for lseek is available
15629 echo " "
15630 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15631 eval $hasproto
15632
15633 : see if lstat exists
15634 set lstat d_lstat
15635 eval $inlibc
15636
15637 : see if madvise exists
15638 set madvise d_madvise
15639 eval $inlibc
15640
15641 : see if malloc_size exists
15642 set malloc_size d_malloc_size
15643 eval $inlibc
15644
15645 : see if malloc_size_good exists
15646 set malloc_good_size d_malloc_good_size
15647 eval $inlibc
15648
15649 : see if mblen exists
15650 set mblen d_mblen
15651 eval $inlibc
15652
15653 : see if mbstowcs exists
15654 set mbstowcs d_mbstowcs
15655 eval $inlibc
15656
15657 : see if mbtowc exists
15658 set mbtowc d_mbtowc
15659 eval $inlibc
15660
15661 : see if memchr exists
15662 set memchr d_memchr
15663 eval $inlibc
15664
15665 : see if memcmp exists
15666 set memcmp d_memcmp
15667 eval $inlibc
15668
15669 : see if memcpy exists
15670 set memcpy d_memcpy
15671 eval $inlibc
15672
15673 : see if memmove exists
15674 set memmove d_memmove
15675 eval $inlibc
15676
15677 : see if memset exists
15678 set memset d_memset
15679 eval $inlibc
15680
15681 : see if mkdir exists
15682 set mkdir d_mkdir
15683 eval $inlibc
15684
15685 : see if mkdtemp exists
15686 set mkdtemp d_mkdtemp
15687 eval $inlibc
15688
15689 : see if mkfifo exists
15690 set mkfifo d_mkfifo
15691 eval $inlibc
15692
15693 : see if mkstemp exists
15694 set mkstemp d_mkstemp
15695 eval $inlibc
15696
15697 : see if mkstemps exists
15698 set mkstemps d_mkstemps
15699 eval $inlibc
15700
15701 : see if mktime exists
15702 set mktime d_mktime
15703 eval $inlibc
15704
15705 : see if this is a sys/mman.h system
15706 set sys/mman.h i_sysmman
15707 eval $inhdr
15708
15709 : see if mmap exists
15710 set mmap d_mmap
15711 eval $inlibc
15712 : see what shmat returns
15713 : default to something harmless
15714 mmaptype='void *'
15715 case "$i_sysmman$d_mmap" in
15716 "$define$define")
15717         $cat >mmap.c <<'END'
15718 #include <sys/mman.h>
15719 void *mmap();
15720 END
15721         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15722                 mmaptype='void *'
15723         else
15724                 mmaptype='caddr_t'
15725         fi
15726         echo "and it returns ($mmaptype)." >&4
15727         ;;
15728 esac
15729
15730
15731
15732 : see if sqrtl exists
15733 set sqrtl d_sqrtl
15734 eval $inlibc
15735
15736 : see if scalbnl exists
15737 set scalbnl d_scalbnl
15738 eval $inlibc
15739
15740 : see if modfl exists
15741 set modfl d_modfl
15742 eval $inlibc
15743
15744 : see if prototype for modfl is available
15745 echo " "
15746 set d_modflproto modfl $i_math math.h
15747 eval $hasproto
15748
15749 d_modfl_pow32_bug="$undef"
15750
15751 case "$d_longdbl$d_modfl" in
15752 $define$define)
15753         $cat <<EOM
15754 Checking to see whether your modfl() is okay for large values...
15755 EOM
15756 $cat >try.c <<EOCP
15757 #include <math.h>
15758 #include <stdio.h>
15759 EOCP
15760 if $test "X$d_modflproto" != "X$define"; then
15761         $cat >>try.c <<EOCP
15762 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15763 long double modfl (long double, long double *);
15764 EOCP
15765 fi
15766 $cat >>try.c <<EOCP
15767 int main() {
15768     long double nv = 4294967303.15;
15769     long double v, w;
15770     v = modfl(nv, &w);
15771 #ifdef __GLIBC__
15772     printf("glibc");
15773 #endif
15774     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15775     return 0;
15776 }
15777 EOCP
15778         case "$osname:$gccversion" in
15779         aix:)   saveccflags="$ccflags"
15780                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15781         esac
15782         set try
15783         if eval $compile; then
15784                 foo=`$run ./try`
15785                 case "$foo" in
15786                 *" 4294967303.150000 1.150000 4294967302.000000")
15787                         echo >&4 "Your modfl() is broken for large values."
15788                         d_modfl_pow32_bug="$define"
15789                         case "$foo" in
15790                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15791                         ;;
15792                         esac
15793                         ;;
15794                 *" 4294967303.150000 0.150000 4294967303.000000")
15795                         echo >&4 "Your modfl() seems okay for large values."
15796                         ;;
15797                 *)      echo >&4 "I don't understand your modfl() at all."
15798                         d_modfl="$undef"
15799                         ;;
15800                 esac
15801                 $rm_try
15802         else
15803                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15804                 d_modfl="$undef"
15805         fi
15806         case "$osname:$gccversion" in
15807         aix:)   ccflags="$saveccflags" ;; # restore
15808         esac
15809         ;;
15810 esac
15811
15812 if $test "$uselongdouble" = "$define"; then
15813     message=""
15814     if $test "$d_sqrtl" != "$define"; then
15815         message="$message sqrtl"
15816     fi
15817     if $test "$d_modfl" != "$define"; then
15818         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15819             echo "You have both aintl and copysignl, so I can emulate modfl."
15820         else
15821             message="$message modfl"
15822         fi
15823     fi
15824     if $test "$d_frexpl" != "$define"; then
15825         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15826             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15827         else
15828             message="$message frexpl"
15829         fi
15830     fi
15831
15832     if $test "$message" != ""; then
15833         $cat <<EOM >&4
15834
15835 *** You requested the use of long doubles but you do not seem to have
15836 *** the following mathematical functions needed for long double support:
15837 ***    $message
15838 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15839 *** Cannot continue, aborting.
15840
15841 EOM
15842
15843         exit 1
15844     fi
15845 fi
15846
15847 : see if mprotect exists
15848 set mprotect d_mprotect
15849 eval $inlibc
15850
15851 : see if msgctl exists
15852 set msgctl d_msgctl
15853 eval $inlibc
15854
15855 : see if msgget exists
15856 set msgget d_msgget
15857 eval $inlibc
15858
15859 : see if msgsnd exists
15860 set msgsnd d_msgsnd
15861 eval $inlibc
15862
15863 : see if msgrcv exists
15864 set msgrcv d_msgrcv
15865 eval $inlibc
15866
15867 : see how much of the 'msg*(2)' library is present.
15868 h_msg=true
15869 echo " "
15870 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15871 *"$undef"*) h_msg=false;;
15872 esac
15873 case "$osname" in
15874 freebsd)
15875     case "`ipcs 2>&1`" in
15876     "SVID messages"*"not configured"*)
15877         echo "Your $osname does not have the msg*(2) configured." >&4
15878         h_msg=false
15879         val="$undef"
15880         set msgctl d_msgctl
15881         eval $setvar
15882         set msgget d_msgget
15883         eval $setvar
15884         set msgsnd d_msgsnd
15885         eval $setvar
15886         set msgrcv d_msgrcv
15887         eval $setvar
15888         ;;
15889     esac
15890     ;;
15891 esac
15892 : we could also check for sys/ipc.h ...
15893 if $h_msg && $test `./findhdr sys/msg.h`; then
15894         echo "You have the full msg*(2) library." >&4
15895         val="$define"
15896 else
15897         echo "You don't have the full msg*(2) library." >&4
15898         val="$undef"
15899 fi
15900 set d_msg
15901 eval $setvar
15902
15903 : Check for msghdr_s
15904 echo " "
15905 echo "Checking to see if your system supports struct msghdr..." >&4
15906 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15907 eval $hasstruct
15908 case "$d_msghdr_s" in
15909 "$define")      echo "Yes, it does."   ;;
15910 *)              echo "No, it doesn't." ;;
15911 esac
15912
15913
15914 : see if msync exists
15915 set msync d_msync
15916 eval $inlibc
15917
15918 : see if munmap exists
15919 set munmap d_munmap
15920 eval $inlibc
15921
15922 : see if nice exists
15923 set nice d_nice
15924 eval $inlibc
15925
15926 : see if this is a langinfo.h system
15927 set langinfo.h i_langinfo
15928 eval $inhdr
15929
15930 : see if nl_langinfo exists
15931 set nl_langinfo d_nl_langinfo
15932 eval $inlibc
15933
15934 : check for volatile keyword
15935 echo " "
15936 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15937 $cat >try.c <<'EOCP'
15938 int main()
15939 {
15940         typedef struct _goo_struct goo_struct;
15941         goo_struct * volatile goo = ((goo_struct *)0);
15942         struct _goo_struct {
15943                 long long_int;
15944                 int reg_int;
15945                 char char_var;
15946         };
15947         typedef unsigned short foo_t;
15948         char *volatile foo;
15949         volatile int bar;
15950         volatile foo_t blech;
15951         foo = foo;
15952 }
15953 EOCP
15954 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15955         val="$define"
15956         echo "Yup, it does."
15957 else
15958         val="$undef"
15959         echo "Nope, it doesn't."
15960 fi
15961 set d_volatile
15962 eval $setvar
15963 $rm_try
15964
15965 : Check basic sizes
15966 echo " "
15967 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15968
15969 case "$use64bitint:$d_quad:$quadtype" in
15970 define:define:?*)
15971         ivtype="$quadtype"
15972         uvtype="$uquadtype"
15973         ivsize=8
15974         uvsize=8
15975         ;;
15976 *)      ivtype="long"
15977         uvtype="unsigned long"
15978         ivsize=$longsize
15979         uvsize=$longsize
15980         ;;
15981 esac
15982
15983 case "$uselongdouble:$d_longdbl" in
15984 define:define)
15985         nvtype="long double"
15986         nvsize=$longdblsize
15987         ;;
15988 *)      nvtype=double
15989         nvsize=$doublesize
15990         ;;
15991 esac
15992
15993 $echo "(IV will be "$ivtype", $ivsize bytes)"
15994 $echo "(UV will be "$uvtype", $uvsize bytes)"
15995 $echo "(NV will be "$nvtype", $nvsize bytes)"
15996
15997 $cat >try.c <<EOCP
15998 #$i_inttypes I_INTTYPES
15999 #ifdef I_INTTYPES
16000 #include <inttypes.h>
16001 #endif
16002 #include <stdio.h>
16003 int main() {
16004 #ifdef INT8
16005    int8_t i =  INT8_MAX;
16006   uint8_t u = UINT8_MAX;
16007   printf("int8_t\n");
16008 #endif
16009 #ifdef INT16
16010    int16_t i =  INT16_MAX;
16011   uint16_t u = UINT16_MAX;
16012   printf("int16_t\n");
16013 #endif
16014 #ifdef INT32
16015    int32_t i =  INT32_MAX;
16016   uint32_t u = UINT32_MAX;
16017   printf("int32_t\n");
16018 #endif
16019 }
16020 EOCP
16021
16022 i8type="signed char"
16023 u8type="unsigned char"
16024 i8size=1
16025 u8size=1
16026
16027 case "$i16type" in
16028 '')     case "$shortsize" in
16029         2)      i16type=short
16030                 u16type="unsigned short"
16031                 i16size=$shortsize
16032                 u16size=$shortsize
16033                 ;;
16034         esac
16035         ;;
16036 esac
16037 case "$i16type" in
16038 '')     set try -DINT16
16039         if eval $compile; then
16040                 case "`$run ./try`" in
16041                 int16_t)
16042                         i16type=int16_t
16043                         u16type=uint16_t
16044                         i16size=2
16045                         u16size=2
16046                         ;;
16047                 esac
16048         fi
16049         ;;
16050 esac
16051 case "$i16type" in
16052 '')     if $test $shortsize -ge 2; then
16053                 i16type=short
16054                 u16type="unsigned short"
16055                 i16size=$shortsize
16056                 u16size=$shortsize
16057         fi
16058         ;;
16059 esac
16060
16061 case "$i32type" in
16062 '')     case "$longsize" in
16063         4)      i32type=long
16064                 u32type="unsigned long"
16065                 i32size=$longsize
16066                 u32size=$longsize
16067                 ;;
16068         *)      case "$intsize" in
16069                 4)      i32type=int
16070                         u32type="unsigned int"
16071                         i32size=$intsize
16072                         u32size=$intsize
16073                         ;;
16074                 esac
16075                 ;;
16076         esac
16077         ;;
16078 esac
16079 case "$i32type" in
16080 '')     set try -DINT32
16081         if eval $compile; then
16082                 case "`$run ./try`" in
16083                 int32_t)
16084                         i32type=int32_t
16085                         u32type=uint32_t
16086                         i32size=4
16087                         u32size=4
16088                         ;;
16089                 esac
16090         fi
16091         ;;
16092 esac
16093 case "$i32type" in
16094 '')     if $test $intsize -ge 4; then
16095                 i32type=int
16096                 u32type="unsigned int"
16097                 i32size=$intsize
16098                 u32size=$intsize
16099         fi
16100         ;;
16101 esac
16102
16103 case "$i64type" in
16104 '')     case "$d_quad:$quadtype" in
16105         define:?*)
16106                 i64type="$quadtype"
16107                 u64type="$uquadtype"
16108                 i64size=8
16109                 u64size=8
16110                 ;;
16111         esac
16112         ;;
16113 esac
16114
16115 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16116 : volatile so that the compiler has to store it out to memory.
16117 if test X"$d_volatile" = X"$define"; then
16118         volatile=volatile
16119 fi
16120 $cat <<EOP >try.c
16121 #include <stdio.h>
16122 #$i_stdlib I_STDLIB
16123 #ifdef I_STDLIB
16124 #include <stdlib.h>
16125 #endif
16126 #include <sys/types.h>
16127 #include <signal.h>
16128 #ifdef SIGFPE
16129 $volatile int bletched = 0;
16130 $signal_t blech(int s) { bletched = 1; }
16131 #endif
16132 int main() {
16133     $uvtype u = 0;
16134     $nvtype d;
16135     int     n = 8 * $uvsize;
16136     int     i;
16137 #ifdef SIGFPE
16138     signal(SIGFPE, blech);
16139 #endif
16140
16141     for (i = 0; i < n; i++) {
16142       u = u << 1 | ($uvtype)1;
16143       d = ($nvtype)u;
16144       if (($uvtype)d != u)
16145         break;
16146       if (d <= 0)
16147         break;
16148       d = ($nvtype)(u - 1);
16149       if (($uvtype)d != (u - 1))
16150         break;
16151 #ifdef SIGFPE
16152       if (bletched)
16153         break;
16154 #endif
16155     }
16156     printf("%d\n", ((i == n) ? -n : i));
16157     exit(0);
16158 }
16159 EOP
16160 set try
16161
16162 d_nv_preserves_uv="$undef"
16163 if eval $compile; then
16164         nv_preserves_uv_bits="`$run ./try`"
16165 fi
16166 case "$nv_preserves_uv_bits" in
16167 \-[1-9]*)
16168         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16169         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16170         d_nv_preserves_uv="$define"
16171         ;;
16172 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16173         d_nv_preserves_uv="$undef" ;;
16174 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16175         nv_preserves_uv_bits="0" ;;
16176 esac
16177 $rm_try
16178
16179 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16180 : volatile so that the compiler has to store it out to memory.
16181 if test X"$d_volatile" = X"$define"; then
16182         volatile=volatile
16183 fi
16184 $cat <<EOP >try.c
16185 #include <stdio.h>
16186
16187 typedef $nvtype NV;
16188
16189 int
16190 main() {
16191   NV value = 2;
16192   int count = 1;
16193
16194   while(count < 256) {
16195     $volatile NV up = value + 1.0;
16196     $volatile NV negated = -value;
16197     $volatile NV down = negated - 1.0;
16198     $volatile NV got_up = up - value;
16199     int up_good = got_up == 1.0;
16200     int got_down = down - negated;
16201     int down_good = got_down == -1.0;
16202
16203     if (down_good != up_good) {
16204       fprintf(stderr,
16205               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16206               up_good, (double) got_up, down_good, (double) got_down,
16207               count, (double) value);
16208       return 1;
16209     }
16210     if (!up_good) {
16211       while (1) {
16212         if (count > 8) {
16213           count -= 8;
16214           fputs("256.0", stdout);
16215         } else {
16216           count--;
16217           fputs("2.0", stdout);
16218         }
16219         if (!count) {
16220           puts("");
16221           return 0;
16222         }
16223         fputs("*", stdout);
16224       }
16225     }
16226     value *= 2;
16227     ++count;
16228   }
16229   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16230           count, (double) value);
16231   return 1;
16232 }
16233 EOP
16234 set try
16235
16236 nv_overflows_integers_at='0'
16237 if eval $compile; then
16238     xxx="`$run ./try`"
16239     case "$?" in
16240         0)
16241             case "$xxx" in
16242                 2*)  cat >&4 <<EOM
16243 The largest integer your NVs can preserve is equal to $xxx
16244 EOM
16245                     nv_overflows_integers_at="$xxx"
16246                     ;;
16247                 *)  cat >&4 <<EOM
16248 Cannot determine the largest integer value your NVs can hold, unexpected output
16249 '$xxx'
16250 EOM
16251                     ;;
16252             esac
16253             ;;
16254         *)  cat >&4 <<EOM
16255 Cannot determine the largest integer value your NVs can hold
16256 EOM
16257             ;;
16258     esac
16259 fi
16260 $rm_try
16261
16262 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16263 : volatile so that the compiler has to store it out to memory.
16264 if test X"$d_volatile" = X"$define"; then
16265         volatile=volatile
16266 fi
16267 $cat <<EOP >try.c
16268 #include <stdio.h>
16269 #$i_stdlib I_STDLIB
16270 #ifdef I_STDLIB
16271 #include <stdlib.h>
16272 #endif
16273 #$i_string I_STRING
16274 #ifdef I_STRING
16275 #  include <string.h>
16276 #else
16277 #  include <strings.h>
16278 #endif
16279 #include <sys/types.h>
16280 #include <signal.h>
16281 #ifdef SIGFPE
16282 $volatile int bletched = 0;
16283 $signal_t blech(int s) { bletched = 1; }
16284 #endif
16285
16286 int checkit($nvtype d, char *where) {
16287     unsigned char *p = (char *)&d;
16288     unsigned char *end = p + sizeof(d);
16289     int fail = 0;
16290
16291     while (p < end)
16292         fail += *p++;
16293
16294     if (!fail)
16295         return 0;
16296
16297     p = (char *)&d;
16298     printf("No - %s: 0x", where);
16299     while (p < end)
16300         printf ("%02X", *p++);
16301     printf("\n");
16302     return 1;
16303 }
16304
16305 int main(int argc, char **argv) {
16306     $nvtype d = 0.0;
16307     int fail = 0;
16308     fail += checkit(d, "0.0");
16309
16310     /* The compiler shouldn't be assuming that bletched is 0  */
16311     d = bletched;
16312
16313     fail += checkit(d, "bleched");
16314
16315 #ifdef SIGFPE
16316     signal(SIGFPE, blech);
16317 #endif
16318
16319     /* Paranoia - the compiler should have no way of knowing that ANSI says
16320        that argv[argc] will always be NULL.  Actually, if it did assume this it
16321        would be buggy, as this is C and main() can be called from elsewhere in
16322        the program.  */
16323     d = argv[argc] ? 1 : 0;
16324
16325     if (d) {
16326         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16327     }
16328
16329     fail += checkit(d, "ternary");
16330
16331     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16332
16333     if (d != 0.0) {
16334         printf("No - memset doesn't give 0.0\n");
16335         /* This might just blow up:  */
16336         printf("(gives %g)\n", d);
16337         return 1;
16338     }
16339
16340 #ifdef SIGFPE
16341     if (bletched) {
16342         printf("No - something bleched\n");
16343         return 1;
16344     }
16345 #endif
16346     if (fail) {
16347       printf("No - %d fail(s)\n", fail);
16348       return 1;
16349     }
16350     printf("Yes\n");
16351     return 0;
16352 }
16353 EOP
16354 set try
16355
16356 d_nv_zero_is_allbits_zero="$undef"
16357 if eval $compile; then
16358     xxx="`$run ./try`"
16359     case "$?" in
16360         0)
16361             case "$xxx" in
16362                 Yes)  cat >&4 <<EOM
16363 0.0 is represented as all bits zero in memory
16364 EOM
16365                     d_nv_zero_is_allbits_zero="$define"
16366                     ;;
16367                 *)  cat >&4 <<EOM
16368 0.0 is not represented as all bits zero in memory
16369 EOM
16370                     d_nv_zero_is_allbits_zero="$undef"
16371                     ;;
16372             esac
16373             ;;
16374         *)  cat >&4 <<EOM
16375 0.0 is not represented as all bits zero in memory
16376 EOM
16377             d_nv_zero_is_allbits_zero="$undef"
16378             ;;
16379     esac
16380 fi
16381 $rm_try
16382
16383 : check for off64_t
16384 echo " "
16385 echo "Checking to see if you have off64_t..." >&4
16386 $cat >try.c <<EOCP
16387 #include <sys/types.h>
16388 #include <unistd.h>
16389 int main() { off64_t x = 7; }
16390 EOCP
16391 set try
16392 if eval $compile; then
16393         val="$define"
16394         echo "You have off64_t."
16395 else
16396         val="$undef"
16397         echo "You do not have off64_t."
16398         case "$lseeksize" in
16399         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16400         esac
16401 fi
16402 $rm_try
16403 set d_off64_t
16404 eval $setvar
16405
16406 : how to create joinable pthreads
16407 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16408         echo " "
16409         echo "Checking what constant to use for creating joinable pthreads..." >&4
16410         $cat >try.c <<'EOCP'
16411 #include <pthread.h>
16412 int main() {
16413     int detachstate = JOINABLE;
16414 }
16415 EOCP
16416         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16417         if eval $compile; then
16418                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16419                 val="$undef" # Yes, undef.
16420                 set d_old_pthread_create_joinable
16421                 eval $setvar
16422                 val=""
16423                 set old_pthread_create_joinable
16424                 eval $setvar
16425         else
16426                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16427                 if eval $compile; then
16428                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16429                         val="$define"
16430                         set d_old_pthread_create_joinable
16431                         eval $setvar
16432                         val=PTHREAD_CREATE_UNDETACHED
16433                         set old_pthread_create_joinable
16434                         eval $setvar
16435                 else
16436                         set try -DJOINABLE=__UNDETACHED
16437                         if eval $compile; then
16438                                 echo "You seem to use __UNDETACHED." >&4
16439                                 val="$define"
16440                                 set d_old_pthread_create_joinable
16441                                 eval $setvar
16442                                 val=__UNDETACHED
16443                                 set old_pthread_create_joinable
16444                                 eval $setvar
16445                         else
16446                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16447                                 val="$define"
16448                                 set d_old_pthread_create_joinable
16449                                 eval $setvar
16450                                 val=0
16451                                 set old_pthread_create_joinable
16452                                 eval $setvar
16453                         fi
16454                 fi
16455         fi
16456         $rm_try
16457 else
16458     d_old_pthread_create_joinable="$undef"
16459     old_pthread_create_joinable=""
16460 fi
16461
16462 : see if pause exists
16463 set pause d_pause
16464 eval $inlibc
16465
16466 : see if poll exists
16467 set poll d_poll
16468 eval $inlibc
16469
16470 : see if prctl exists
16471 set prctl d_prctl
16472 eval $inlibc
16473
16474 : see if prctl supports PR_SET_NAME
16475 d_prctl_set_name=$undef
16476 case $d_prctl in
16477     $define)
16478         $cat >try.c <<EOM
16479 #include <sys/prctl.h>
16480
16481 int main (int argc, char *argv[])
16482 {
16483     return (prctl (PR_SET_NAME, "Test"));
16484     } /* main */
16485 EOM
16486         set try
16487         if eval $compile_ok && $run ./try; then
16488             echo "Your prctl (PR_SET_NAME, ...) works"
16489             d_prctl_set_name=$define
16490             fi
16491         $rm_try
16492         ;;
16493     esac
16494
16495 : see if readlink exists
16496 set readlink d_readlink
16497 eval $inlibc
16498
16499 : Check if exe is symlink to abs path of executing program
16500 echo " "
16501 procselfexe=''
16502 val="$undef"
16503 case "$d_readlink" in
16504     "$define")
16505         : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
16506         : more tidy to avoid an extra level of symlink
16507         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
16508         while test $# -gt 0; do
16509             type=$1; try=$2
16510             shift; shift
16511             if $issymlink $try; then
16512                 $ls -l $try > reflect
16513                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16514                     echo "You have $type-like $try."
16515                     procselfexe='"'$try'"'
16516                     val="$define"
16517                     : This will break out of the loop
16518                     set X; shift
16519                 fi
16520             fi
16521         done
16522         ;;
16523 esac
16524 $rm -f reflect
16525 set d_procselfexe
16526 eval $setvar
16527
16528 : backward compatibility for d_hvfork
16529 if test X$d_hvfork != X; then
16530         d_vfork="$d_hvfork"
16531         d_hvfork=''
16532 fi
16533 : see if there is a vfork
16534 val=''
16535 set vfork val
16536 eval $inlibc
16537
16538 d_pseudofork=$undef
16539
16540 : Ok, but do we want to use it. vfork is reportedly unreliable in
16541 : perl on Solaris 2.x, and probably elsewhere.
16542 case "$val" in
16543 $define)
16544         echo " "
16545         case "$usevfork" in
16546         false) dflt='n';;
16547         *) dflt='y';;
16548         esac
16549         cat <<'EOM'
16550
16551 Perl can only use a vfork() that doesn't suffer from strict
16552 restrictions on calling functions or modifying global data in
16553 the child.  For example, glibc-2.1 contains such a vfork()
16554 that is unsuitable.  If your system provides a proper fork()
16555 call, chances are that you do NOT want perl to use vfork().
16556
16557 EOM
16558         rp="Do you still want to use vfork()?"
16559         . ./myread
16560         case "$ans" in
16561         y|Y) ;;
16562         *)
16563                 echo "Ok, we won't use vfork()."
16564                 val="$undef"
16565                 ;;
16566         esac
16567         ;;
16568 esac
16569 set d_vfork
16570 eval $setvar
16571 case "$d_vfork" in
16572 $define) usevfork='true';;
16573 *) usevfork='false';;
16574 esac
16575
16576 : see whether the pthread_atfork exists
16577 $cat >try.c <<EOP
16578 #include <pthread.h>
16579 #include <stdio.h>
16580 int main() {
16581 #ifdef  PTHREAD_ATFORK
16582         pthread_atfork(NULL,NULL,NULL);
16583 #endif
16584 }
16585 EOP
16586
16587 : see if pthread_atfork exists
16588 set try -DPTHREAD_ATFORK
16589 if eval $compile; then
16590     val="$define"
16591 else
16592     val="$undef"
16593 fi
16594 case "$usethreads" in
16595 $define)
16596         case "$val" in
16597         $define) echo 'pthread_atfork found.' >&4        ;;
16598         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16599         esac
16600 esac
16601 set d_pthread_atfork
16602 eval $setvar
16603
16604 : see if pthread_attr_setscope exists
16605 set pthread_attr_setscope d_pthread_attr_setscope
16606 eval $inlibc
16607
16608 : see whether the various POSIXish _yields exist
16609 $cat >try.c <<EOP
16610 #include <pthread.h>
16611 #include <stdio.h>
16612 int main() {
16613 #ifdef SCHED_YIELD
16614         sched_yield();
16615 #else
16616 #ifdef PTHREAD_YIELD
16617         pthread_yield();
16618 #else
16619 #ifdef PTHREAD_YIELD_NULL
16620         pthread_yield(NULL);
16621 #endif
16622 #endif
16623 #endif
16624 }
16625 EOP
16626 : see if sched_yield exists
16627 set try -DSCHED_YIELD
16628 if eval $compile; then
16629     val="$define"
16630     sched_yield='sched_yield()'
16631 else
16632     val="$undef"
16633 fi
16634 case "$usethreads" in
16635 $define)
16636         case "$val" in
16637         $define) echo 'sched_yield() found.' >&4        ;;
16638         *)       echo 'sched_yield() NOT found.' >&4    ;;
16639         esac
16640 esac
16641 set d_sched_yield
16642 eval $setvar
16643
16644 : see if pthread_yield exists
16645 set try -DPTHREAD_YIELD
16646 if eval $compile; then
16647     val="$define"
16648     case "$sched_yield" in
16649     '') sched_yield='pthread_yield()' ;;
16650     esac
16651 else
16652     set try -DPTHREAD_YIELD_NULL
16653     if eval $compile; then
16654         val="$define"
16655         case "$sched_yield" in
16656         '') sched_yield='pthread_yield(NULL)' ;;
16657         esac
16658     else
16659         val="$undef"
16660     fi
16661 fi
16662 case "$usethreads" in
16663 $define)
16664         case "$val" in
16665         $define) echo 'pthread_yield() found.' >&4      ;;
16666         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16667         esac
16668         ;;
16669 esac
16670 set d_pthread_yield
16671 eval $setvar
16672 case "$sched_yield" in
16673 '') sched_yield=undef ;;
16674 esac
16675 $rm_try
16676
16677 : see if random_r exists
16678 set random_r d_random_r
16679 eval $inlibc
16680 case "$d_random_r" in
16681 "$define")
16682         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16683         case "$d_random_r_proto:$usethreads" in
16684         ":define")      d_random_r_proto=define
16685                 set d_random_r_proto random_r $hdrs
16686                 eval $hasproto ;;
16687         *)      ;;
16688         esac
16689         case "$d_random_r_proto" in
16690         define)
16691         case "$random_r_proto" in
16692         ''|0) try='int random_r(int*, struct random_data*);'
16693         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16694         esac
16695         case "$random_r_proto" in
16696         ''|0) try='int random_r(long*, struct random_data*);'
16697         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16698         esac
16699         case "$random_r_proto" in
16700         ''|0) try='int random_r(struct random_data*, int32_t*);'
16701         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16702         esac
16703         case "$random_r_proto" in
16704         ''|0)   d_random_r=undef
16705                 random_r_proto=0
16706                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16707         * )     case "$random_r_proto" in
16708                 REENTRANT_PROTO*) ;;
16709                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16710                 esac
16711                 echo "Prototype: $try" ;;
16712         esac
16713         ;;
16714         *)      case "$usethreads" in
16715                 define) echo "random_r has no prototype, not using it." >&4 ;;
16716                 esac
16717                 d_random_r=undef
16718                 random_r_proto=0
16719                 ;;
16720         esac
16721         ;;
16722 *)      random_r_proto=0
16723         ;;
16724 esac
16725
16726 : see if readdir and friends exist
16727 set readdir d_readdir
16728 eval $inlibc
16729 set seekdir d_seekdir
16730 eval $inlibc
16731 set telldir d_telldir
16732 eval $inlibc
16733 set rewinddir d_rewinddir
16734 eval $inlibc
16735
16736 : see if readdir64_r exists
16737 set readdir64_r d_readdir64_r
16738 eval $inlibc
16739 case "$d_readdir64_r" in
16740 "$define")
16741         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16742         case "$d_readdir64_r_proto:$usethreads" in
16743         ":define")      d_readdir64_r_proto=define
16744                 set d_readdir64_r_proto readdir64_r $hdrs
16745                 eval $hasproto ;;
16746         *)      ;;
16747         esac
16748         case "$d_readdir64_r_proto" in
16749         define)
16750         case "$readdir64_r_proto" in
16751         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16752         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16753         esac
16754         case "$readdir64_r_proto" in
16755         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16756         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16757         esac
16758         case "$readdir64_r_proto" in
16759         ''|0)   d_readdir64_r=undef
16760                 readdir64_r_proto=0
16761                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16762         * )     case "$readdir64_r_proto" in
16763                 REENTRANT_PROTO*) ;;
16764                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16765                 esac
16766                 echo "Prototype: $try" ;;
16767         esac
16768         ;;
16769         *)      case "$usethreads" in
16770                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16771                 esac
16772                 d_readdir64_r=undef
16773                 readdir64_r_proto=0
16774                 ;;
16775         esac
16776         ;;
16777 *)      readdir64_r_proto=0
16778         ;;
16779 esac
16780
16781 : see if readdir_r exists
16782 set readdir_r d_readdir_r
16783 eval $inlibc
16784 case "$d_readdir_r" in
16785 "$define")
16786         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16787         case "$d_readdir_r_proto:$usethreads" in
16788         ":define")      d_readdir_r_proto=define
16789                 set d_readdir_r_proto readdir_r $hdrs
16790                 eval $hasproto ;;
16791         *)      ;;
16792         esac
16793         case "$d_readdir_r_proto" in
16794         define)
16795         case "$readdir_r_proto" in
16796         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16797         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16798         esac
16799         case "$readdir_r_proto" in
16800         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16801         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16802         esac
16803         case "$readdir_r_proto" in
16804         ''|0)   d_readdir_r=undef
16805                 readdir_r_proto=0
16806                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16807         * )     case "$readdir_r_proto" in
16808                 REENTRANT_PROTO*) ;;
16809                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16810                 esac
16811                 echo "Prototype: $try" ;;
16812         esac
16813         ;;
16814         *)      case "$usethreads" in
16815                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16816                 esac
16817                 d_readdir_r=undef
16818                 readdir_r_proto=0
16819                 ;;
16820         esac
16821         ;;
16822 *)      readdir_r_proto=0
16823         ;;
16824 esac
16825
16826 : see if readv exists
16827 set readv d_readv
16828 eval $inlibc
16829
16830 : see if recvmsg exists
16831 set recvmsg d_recvmsg
16832 eval $inlibc
16833
16834 : see if rename exists
16835 set rename d_rename
16836 eval $inlibc
16837
16838 : see if rmdir exists
16839 set rmdir d_rmdir
16840 eval $inlibc
16841
16842 : see if memory.h is available.
16843 val=''
16844 set memory.h val
16845 eval $inhdr
16846
16847 : See if it conflicts with string.h
16848 case "$val" in
16849 $define)
16850         case "$strings" in
16851         '') ;;
16852         *)
16853                 $cppstdin $cppflags $cppminus < $strings > mem.h
16854                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16855                         echo " "
16856                         echo "We won't be including <memory.h>."
16857                         val="$undef"
16858                 fi
16859                 $rm -f mem.h
16860                 ;;
16861         esac
16862 esac
16863 set i_memory
16864 eval $setvar
16865
16866 : can bcopy handle overlapping blocks?
16867 echo " "
16868 val="$undef"
16869 case "$d_memmove" in
16870 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16871 *)      case "$d_bcopy" in
16872         "$define")
16873                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16874                 $cat >try.c <<EOCP
16875 #$i_memory I_MEMORY
16876 #$i_stdlib I_STDLIB
16877 #$i_string I_STRING
16878 #$i_unistd I_UNISTD
16879 EOCP
16880         $cat >>try.c <<'EOCP'
16881 #include <stdio.h>
16882 #ifdef I_MEMORY
16883 #  include <memory.h>
16884 #endif
16885 #ifdef I_STDLIB
16886 #  include <stdlib.h>
16887 #endif
16888 #ifdef I_STRING
16889 #  include <string.h>
16890 #else
16891 #  include <strings.h>
16892 #endif
16893 #ifdef I_UNISTD
16894 #  include <unistd.h>  /* Needed for NetBSD */
16895 #endif
16896 int main()
16897 {
16898 char buf[128], abc[128];
16899 char *b;
16900 int len;
16901 int off;
16902 int align;
16903
16904 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16905    try to store the string in read-only memory. */
16906 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16907
16908 for (align = 7; align >= 0; align--) {
16909         for (len = 36; len; len--) {
16910                 b = buf+align;
16911                 bcopy(abc, b, len);
16912                 for (off = 1; off <= len; off++) {
16913                         bcopy(b, b+off, len);
16914                         bcopy(b+off, b, len);
16915                         if (bcmp(b, abc, len))
16916                                 exit(1);
16917                 }
16918         }
16919 }
16920 exit(0);
16921 }
16922 EOCP
16923                 set try
16924                 if eval $compile_ok; then
16925                         if $run ./try 2>/dev/null; then
16926                                 echo "Yes, it can."
16927                                 val="$define"
16928                         else
16929                                 echo "It can't, sorry."
16930                         fi
16931                 else
16932                         echo "(I can't compile the test program, so we'll assume not...)"
16933                 fi
16934                 ;;
16935         esac
16936         $rm_try
16937         ;;
16938 esac
16939 set d_safebcpy
16940 eval $setvar
16941
16942 : can memcpy handle overlapping blocks?
16943 echo " "
16944 val="$undef"
16945 case "$d_memmove" in
16946 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16947 *)      case "$d_memcpy" in
16948         "$define")
16949                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16950                 $cat >try.c <<EOCP
16951 #$i_memory I_MEMORY
16952 #$i_stdlib I_STDLIB
16953 #$i_string I_STRING
16954 #$i_unistd I_UNISTD
16955 EOCP
16956         $cat >>try.c <<'EOCP'
16957 #include <stdio.h>
16958 #ifdef I_MEMORY
16959 #  include <memory.h>
16960 #endif
16961 #ifdef I_STDLIB
16962 #  include <stdlib.h>
16963 #endif
16964 #ifdef I_STRING
16965 #  include <string.h>
16966 #else
16967 #  include <strings.h>
16968 #endif
16969 #ifdef I_UNISTD
16970 #  include <unistd.h>  /* Needed for NetBSD */
16971 #endif
16972 int main()
16973 {
16974 char buf[128], abc[128];
16975 char *b;
16976 int len;
16977 int off;
16978 int align;
16979
16980 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16981    try to store the string in read-only memory. */
16982 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16983
16984 for (align = 7; align >= 0; align--) {
16985         for (len = 36; len; len--) {
16986                 b = buf+align;
16987                 memcpy(b, abc, len);
16988                 for (off = 1; off <= len; off++) {
16989                         memcpy(b+off, b, len);
16990                         memcpy(b, b+off, len);
16991                         if (memcmp(b, abc, len))
16992                                 exit(1);
16993                 }
16994         }
16995 }
16996 exit(0);
16997 }
16998 EOCP
16999                 set try
17000                 if eval $compile_ok; then
17001                         if $run ./try 2>/dev/null; then
17002                                 echo "Yes, it can."
17003                                 val="$define"
17004                         else
17005                                 echo "It can't, sorry."
17006                         fi
17007                 else
17008                         echo "(I can't compile the test program, so we'll assume not...)"
17009                 fi
17010                 ;;
17011         esac
17012         $rm_try
17013         ;;
17014 esac
17015 set d_safemcpy
17016 eval $setvar
17017
17018 : can memcmp be trusted to compare relative magnitude?
17019 val="$undef"
17020 case "$d_memcmp" in
17021 "$define")
17022         echo " "
17023         echo "Checking if your memcmp() can compare relative magnitude..." >&4
17024         $cat >try.c <<EOCP
17025 #$i_memory I_MEMORY
17026 #$i_stdlib I_STDLIB
17027 #$i_string I_STRING
17028 #$i_unistd I_UNISTD
17029 EOCP
17030         $cat >>try.c <<'EOCP'
17031 #include <stdio.h>
17032 #ifdef I_MEMORY
17033 #  include <memory.h>
17034 #endif
17035 #ifdef I_STDLIB
17036 #  include <stdlib.h>
17037 #endif
17038 #ifdef I_STRING
17039 #  include <string.h>
17040 #else
17041 #  include <strings.h>
17042 #endif
17043 #ifdef I_UNISTD
17044 #  include <unistd.h>  /* Needed for NetBSD */
17045 #endif
17046 int main()
17047 {
17048 char a = -1;
17049 char b = 0;
17050 if ((a < b) && memcmp(&a, &b, 1) < 0)
17051         exit(1);
17052 exit(0);
17053 }
17054 EOCP
17055         set try
17056         if eval $compile_ok; then
17057                 if $run ./try 2>/dev/null; then
17058                         echo "Yes, it can."
17059                         val="$define"
17060                 else
17061                         echo "No, it can't (it uses signed chars)."
17062                 fi
17063         else
17064                 echo "(I can't compile the test program, so we'll assume not...)"
17065         fi
17066         ;;
17067 esac
17068 $rm_try
17069 set d_sanemcmp
17070 eval $setvar
17071
17072 : see if prototype for sbrk is available
17073 echo " "
17074 set d_sbrkproto sbrk $i_unistd unistd.h
17075 eval $hasproto
17076
17077 : see if select exists
17078 set select d_select
17079 eval $inlibc
17080
17081 : see if semctl exists
17082 set semctl d_semctl
17083 eval $inlibc
17084
17085 : see if semget exists
17086 set semget d_semget
17087 eval $inlibc
17088
17089 : see if semop exists
17090 set semop d_semop
17091 eval $inlibc
17092
17093 : see how much of the 'sem*(2)' library is present.
17094 h_sem=true
17095 echo " "
17096 case "$d_semctl$d_semget$d_semop" in
17097 *"$undef"*) h_sem=false;;
17098 esac
17099 case "$osname" in
17100 freebsd)
17101     case "`ipcs 2>&1`" in
17102     "SVID messages"*"not configured"*)
17103         echo "Your $osname does not have the sem*(2) configured." >&4
17104         h_sem=false
17105         val="$undef"
17106         set semctl d_semctl
17107         eval $setvar
17108         set semget d_semget
17109         eval $setvar
17110         set semop d_semop
17111         eval $setvar
17112         ;;
17113     esac
17114     ;;
17115 esac
17116 : we could also check for sys/ipc.h ...
17117 if $h_sem && $test `./findhdr sys/sem.h`; then
17118         echo "You have the full sem*(2) library." >&4
17119         val="$define"
17120 else
17121         echo "You don't have the full sem*(2) library." >&4
17122         val="$undef"
17123 fi
17124 set d_sem
17125 eval $setvar
17126
17127 : see whether sys/sem.h defines union semun
17128 echo " "
17129 $cat > try.c <<'END'
17130 #include <sys/types.h>
17131 #include <sys/ipc.h>
17132 #include <sys/sem.h>
17133 int main () { union semun semun; semun.buf = 0; }
17134 END
17135 set try
17136 if eval $compile; then
17137     echo "You have union semun in <sys/sem.h>." >&4
17138     val="$define"
17139 else
17140     echo "You do not have union semun in <sys/sem.h>." >&4
17141     val="$undef"
17142 fi
17143 $rm_try
17144 set d_union_semun
17145 eval $setvar
17146
17147 : see how to do semctl IPC_STAT
17148 case "$d_sem" in
17149 $define)
17150     echo " "
17151     $cat > tryh.h <<END
17152 #ifndef S_IRUSR
17153 #   ifdef S_IREAD
17154 #       define S_IRUSR S_IREAD
17155 #       define S_IWUSR S_IWRITE
17156 #       define S_IXUSR S_IEXEC
17157 #   else
17158 #       define S_IRUSR 0400
17159 #       define S_IWUSR 0200
17160 #       define S_IXUSR 0100
17161 #   endif
17162 #   define S_IRGRP (S_IRUSR>>3)
17163 #   define S_IWGRP (S_IWUSR>>3)
17164 #   define S_IXGRP (S_IXUSR>>3)
17165 #   define S_IROTH (S_IRUSR>>6)
17166 #   define S_IWOTH (S_IWUSR>>6)
17167 #   define S_IXOTH (S_IXUSR>>6)
17168 #endif
17169 #ifndef S_IRWXU
17170 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17171 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17172 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17173 #endif
17174 END
17175     : see whether semctl IPC_STAT can use union semun
17176     case "$d_semctl_semun" in
17177     '')
17178       val="$undef"
17179       $cat > try.c <<END
17180 #include <sys/types.h>
17181 #include <sys/ipc.h>
17182 #include <sys/sem.h>
17183 #include <sys/stat.h>
17184 #include <stdio.h>
17185 #include <errno.h>
17186 #include "tryh.h"
17187 #ifndef errno
17188 extern int errno;
17189 #endif
17190 #$d_union_semun HAS_UNION_SEMUN
17191 int main() {
17192     union semun
17193 #ifndef HAS_UNION_SEMUN
17194     {
17195         int val;
17196         struct semid_ds *buf;
17197         unsigned short *array;
17198     }
17199 #endif
17200     arg;
17201     int sem, st;
17202
17203 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17204     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17205     if (sem > -1) {
17206         struct semid_ds argbuf;
17207         arg.buf = &argbuf;
17208 #       ifdef IPC_STAT
17209         st = semctl(sem, 0, IPC_STAT, arg);
17210         if (st == 0)
17211             printf("semun\n");
17212         else
17213 #       endif /* IPC_STAT */
17214             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17215 #       ifdef IPC_RMID
17216         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17217 #       endif /* IPC_RMID */
17218             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17219     } else
17220 #endif /* IPC_PRIVATE && ... */
17221         printf("semget failed: errno = %d\n", errno);
17222   return 0;
17223 }
17224 END
17225       set try
17226       if eval $compile; then
17227           xxx=`$run ./try`
17228           case "$xxx" in
17229           semun) val="$define" ;;
17230           esac
17231       fi
17232       $rm_try
17233       set d_semctl_semun
17234       eval $setvar
17235       ;;
17236     esac
17237     case "$d_semctl_semun" in
17238     $define)
17239         echo "You can use union semun for semctl IPC_STAT." >&4
17240         also='also'
17241         ;;
17242     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17243         also=''
17244         ;;
17245     esac
17246
17247     : see whether semctl IPC_STAT can use struct semid_ds pointer
17248     case "$d_semctl_semid_ds" in
17249     '')
17250       val="$undef"
17251       $cat > try.c <<'END'
17252 #include <sys/types.h>
17253 #include <sys/ipc.h>
17254 #include <sys/sem.h>
17255 #include <sys/stat.h>
17256 #include "tryh.h"
17257 #include <stdio.h>
17258 #include <errno.h>
17259 #ifndef errno
17260 extern int errno;
17261 #endif
17262 int main() {
17263     struct semid_ds arg;
17264     int sem, st;
17265
17266 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17267     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17268     if (sem > -1) {
17269 #       ifdef IPC_STAT
17270         st = semctl(sem, 0, IPC_STAT, &arg);
17271         if (st == 0)
17272             printf("semid_ds\n");
17273         else
17274 #       endif /* IPC_STAT */
17275             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17276 #       ifdef IPC_RMID
17277         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
17278 #       endif /* IPC_RMID */
17279             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17280     } else
17281 #endif /* IPC_PRIVATE && ... */
17282         printf("semget failed: errno = %d\n", errno);
17283
17284     return 0;
17285 }
17286 END
17287       set try
17288       if eval $compile; then
17289           xxx=`$run ./try`
17290           case "$xxx" in
17291           semid_ds) val="$define" ;;
17292           esac
17293       fi
17294       $rm_try
17295       set d_semctl_semid_ds
17296       eval $setvar
17297       ;;
17298     esac
17299     case "$d_semctl_semid_ds" in
17300     $define)
17301         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17302         ;;
17303     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17304         ;;
17305     esac
17306     ;;
17307 *)  val="$undef"
17308
17309     # We do not have the full sem*(2) library, so assume we can not
17310     # use either.
17311
17312     set d_semctl_semun
17313     eval $setvar
17314
17315     set d_semctl_semid_ds
17316     eval $setvar
17317     ;;
17318 esac
17319 $rm_try tryh.h
17320
17321 : see if sendmsg exists
17322 set sendmsg d_sendmsg
17323 eval $inlibc
17324
17325 : see if setegid exists
17326 set setegid d_setegid
17327 eval $inlibc
17328
17329 : see if seteuid exists
17330 set seteuid d_seteuid
17331 eval $inlibc
17332
17333 : see if setgrent exists
17334 set setgrent d_setgrent
17335 eval $inlibc
17336
17337 : see if setgrent_r exists
17338 set setgrent_r d_setgrent_r
17339 eval $inlibc
17340 case "$d_setgrent_r" in
17341 "$define")
17342         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17343         case "$d_setgrent_r_proto:$usethreads" in
17344         ":define")      d_setgrent_r_proto=define
17345                 set d_setgrent_r_proto setgrent_r $hdrs
17346                 eval $hasproto ;;
17347         *)      ;;
17348         esac
17349         case "$d_setgrent_r_proto" in
17350         define)
17351         case "$setgrent_r_proto" in
17352         ''|0) try='int setgrent_r(FILE**);'
17353         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17354         esac
17355         case "$setgrent_r_proto" in
17356         ''|0) try='void setgrent_r(FILE**);'
17357         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17358         esac
17359         case "$setgrent_r_proto" in
17360         ''|0)   d_setgrent_r=undef
17361                 setgrent_r_proto=0
17362                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17363         * )     case "$setgrent_r_proto" in
17364                 REENTRANT_PROTO*) ;;
17365                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17366                 esac
17367                 echo "Prototype: $try" ;;
17368         esac
17369         ;;
17370         *)      case "$usethreads" in
17371                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17372                 esac
17373                 d_setgrent_r=undef
17374                 setgrent_r_proto=0
17375                 ;;
17376         esac
17377         ;;
17378 *)      setgrent_r_proto=0
17379         ;;
17380 esac
17381
17382 : see if sethostent exists
17383 set sethostent d_sethent
17384 eval $inlibc
17385
17386 : see if sethostent_r exists
17387 set sethostent_r d_sethostent_r
17388 eval $inlibc
17389 case "$d_sethostent_r" in
17390 "$define")
17391         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17392         case "$d_sethostent_r_proto:$usethreads" in
17393         ":define")      d_sethostent_r_proto=define
17394                 set d_sethostent_r_proto sethostent_r $hdrs
17395                 eval $hasproto ;;
17396         *)      ;;
17397         esac
17398         case "$d_sethostent_r_proto" in
17399         define)
17400         case "$sethostent_r_proto" in
17401         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17402         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17403         esac
17404         case "$sethostent_r_proto" in
17405         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17406         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17407         esac
17408         case "$sethostent_r_proto" in
17409         ''|0)   d_sethostent_r=undef
17410                 sethostent_r_proto=0
17411                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17412         * )     case "$sethostent_r_proto" in
17413                 REENTRANT_PROTO*) ;;
17414                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17415                 esac
17416                 echo "Prototype: $try" ;;
17417         esac
17418         ;;
17419         *)      case "$usethreads" in
17420                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17421                 esac
17422                 d_sethostent_r=undef
17423                 sethostent_r_proto=0
17424                 ;;
17425         esac
17426         ;;
17427 *)      sethostent_r_proto=0
17428         ;;
17429 esac
17430
17431 : see if setitimer exists
17432 set setitimer d_setitimer
17433 eval $inlibc
17434
17435 : see if setlinebuf exists
17436 set setlinebuf d_setlinebuf
17437 eval $inlibc
17438
17439 : see if setlocale exists
17440 set setlocale d_setlocale
17441 eval $inlibc
17442
17443 : see if locale.h is available
17444 set locale.h i_locale
17445 eval $inhdr
17446
17447 : see if setlocale_r exists
17448 set setlocale_r d_setlocale_r
17449 eval $inlibc
17450 case "$d_setlocale_r" in
17451 "$define")
17452         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17453         case "$d_setlocale_r_proto:$usethreads" in
17454         ":define")      d_setlocale_r_proto=define
17455                 set d_setlocale_r_proto setlocale_r $hdrs
17456                 eval $hasproto ;;
17457         *)      ;;
17458         esac
17459         case "$d_setlocale_r_proto" in
17460         define)
17461         case "$setlocale_r_proto" in
17462         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17463         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17464         esac
17465         case "$setlocale_r_proto" in
17466         ''|0)   d_setlocale_r=undef
17467                 setlocale_r_proto=0
17468                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17469         * )     case "$setlocale_r_proto" in
17470                 REENTRANT_PROTO*) ;;
17471                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17472                 esac
17473                 echo "Prototype: $try" ;;
17474         esac
17475         ;;
17476         *)      case "$usethreads" in
17477                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17478                 esac
17479                 d_setlocale_r=undef
17480                 setlocale_r_proto=0
17481                 ;;
17482         esac
17483         ;;
17484 *)      setlocale_r_proto=0
17485         ;;
17486 esac
17487
17488 : see if setnetent exists
17489 set setnetent d_setnent
17490 eval $inlibc
17491
17492 : see if setnetent_r exists
17493 set setnetent_r d_setnetent_r
17494 eval $inlibc
17495 case "$d_setnetent_r" in
17496 "$define")
17497         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17498         case "$d_setnetent_r_proto:$usethreads" in
17499         ":define")      d_setnetent_r_proto=define
17500                 set d_setnetent_r_proto setnetent_r $hdrs
17501                 eval $hasproto ;;
17502         *)      ;;
17503         esac
17504         case "$d_setnetent_r_proto" in
17505         define)
17506         case "$setnetent_r_proto" in
17507         ''|0) try='int setnetent_r(int, struct netent_data*);'
17508         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17509         esac
17510         case "$setnetent_r_proto" in
17511         ''|0) try='void setnetent_r(int, struct netent_data*);'
17512         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17513         esac
17514         case "$setnetent_r_proto" in
17515         ''|0)   d_setnetent_r=undef
17516                 setnetent_r_proto=0
17517                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17518         * )     case "$setnetent_r_proto" in
17519                 REENTRANT_PROTO*) ;;
17520                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17521                 esac
17522                 echo "Prototype: $try" ;;
17523         esac
17524         ;;
17525         *)      case "$usethreads" in
17526                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17527                 esac
17528                 d_setnetent_r=undef
17529                 setnetent_r_proto=0
17530                 ;;
17531         esac
17532         ;;
17533 *)      setnetent_r_proto=0
17534         ;;
17535 esac
17536
17537 : see if setprotoent exists
17538 set setprotoent d_setpent
17539 eval $inlibc
17540
17541 : see if setpgid exists
17542 set setpgid d_setpgid
17543 eval $inlibc
17544
17545 : see if setpgrp2 exists
17546 set setpgrp2 d_setpgrp2
17547 eval $inlibc
17548
17549 : see if setpriority exists
17550 set setpriority d_setprior
17551 eval $inlibc
17552
17553 : see if setproctitle exists
17554 set setproctitle d_setproctitle
17555 eval $inlibc
17556
17557 : see if setprotoent_r exists
17558 set setprotoent_r d_setprotoent_r
17559 eval $inlibc
17560 case "$d_setprotoent_r" in
17561 "$define")
17562         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17563         case "$d_setprotoent_r_proto:$usethreads" in
17564         ":define")      d_setprotoent_r_proto=define
17565                 set d_setprotoent_r_proto setprotoent_r $hdrs
17566                 eval $hasproto ;;
17567         *)      ;;
17568         esac
17569         case "$d_setprotoent_r_proto" in
17570         define)
17571         case "$setprotoent_r_proto" in
17572         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17573         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17574         esac
17575         case "$setprotoent_r_proto" in
17576         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17577         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17578         esac
17579         case "$setprotoent_r_proto" in
17580         ''|0)   d_setprotoent_r=undef
17581                 setprotoent_r_proto=0
17582                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17583         * )     case "$setprotoent_r_proto" in
17584                 REENTRANT_PROTO*) ;;
17585                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17586                 esac
17587                 echo "Prototype: $try" ;;
17588         esac
17589         ;;
17590         *)      case "$usethreads" in
17591                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17592                 esac
17593                 d_setprotoent_r=undef
17594                 setprotoent_r_proto=0
17595                 ;;
17596         esac
17597         ;;
17598 *)      setprotoent_r_proto=0
17599         ;;
17600 esac
17601
17602 : see if setpwent exists
17603 set setpwent d_setpwent
17604 eval $inlibc
17605
17606 : see if setpwent_r exists
17607 set setpwent_r d_setpwent_r
17608 eval $inlibc
17609 case "$d_setpwent_r" in
17610 "$define")
17611         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17612         case "$d_setpwent_r_proto:$usethreads" in
17613         ":define")      d_setpwent_r_proto=define
17614                 set d_setpwent_r_proto setpwent_r $hdrs
17615                 eval $hasproto ;;
17616         *)      ;;
17617         esac
17618         case "$d_setpwent_r_proto" in
17619         define)
17620         case "$setpwent_r_proto" in
17621         ''|0) try='int setpwent_r(FILE**);'
17622         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17623         esac
17624         case "$setpwent_r_proto" in
17625         ''|0) try='void setpwent_r(FILE**);'
17626         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17627         esac
17628         case "$setpwent_r_proto" in
17629         ''|0)   d_setpwent_r=undef
17630                 setpwent_r_proto=0
17631                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17632         * )     case "$setpwent_r_proto" in
17633                 REENTRANT_PROTO*) ;;
17634                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17635                 esac
17636                 echo "Prototype: $try" ;;
17637         esac
17638         ;;
17639         *)      case "$usethreads" in
17640                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17641                 esac
17642                 d_setpwent_r=undef
17643                 setpwent_r_proto=0
17644                 ;;
17645         esac
17646         ;;
17647 *)      setpwent_r_proto=0
17648         ;;
17649 esac
17650
17651 : see if setregid exists
17652 set setregid d_setregid
17653 eval $inlibc
17654 set setresgid d_setresgid
17655 eval $inlibc
17656
17657 : see if setreuid exists
17658 set setreuid d_setreuid
17659 eval $inlibc
17660 set setresuid d_setresuid
17661 eval $inlibc
17662
17663 : see if setrgid exists
17664 set setrgid d_setrgid
17665 eval $inlibc
17666
17667 : see if setruid exists
17668 set setruid d_setruid
17669 eval $inlibc
17670
17671 : see if setservent exists
17672 set setservent d_setsent
17673 eval $inlibc
17674
17675 : see if setservent_r exists
17676 set setservent_r d_setservent_r
17677 eval $inlibc
17678 case "$d_setservent_r" in
17679 "$define")
17680         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17681         case "$d_setservent_r_proto:$usethreads" in
17682         ":define")      d_setservent_r_proto=define
17683                 set d_setservent_r_proto setservent_r $hdrs
17684                 eval $hasproto ;;
17685         *)      ;;
17686         esac
17687         case "$d_setservent_r_proto" in
17688         define)
17689         case "$setservent_r_proto" in
17690         ''|0) try='int setservent_r(int, struct servent_data*);'
17691         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17692         esac
17693         case "$setservent_r_proto" in
17694         ''|0) try='void setservent_r(int, struct servent_data*);'
17695         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17696         esac
17697         case "$setservent_r_proto" in
17698         ''|0)   d_setservent_r=undef
17699                 setservent_r_proto=0
17700                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17701         * )     case "$setservent_r_proto" in
17702                 REENTRANT_PROTO*) ;;
17703                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17704                 esac
17705                 echo "Prototype: $try" ;;
17706         esac
17707         ;;
17708         *)      case "$usethreads" in
17709                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17710                 esac
17711                 d_setservent_r=undef
17712                 setservent_r_proto=0
17713                 ;;
17714         esac
17715         ;;
17716 *)      setservent_r_proto=0
17717         ;;
17718 esac
17719
17720 : see if setsid exists
17721 set setsid d_setsid
17722 eval $inlibc
17723
17724 : see if setvbuf exists
17725 set setvbuf d_setvbuf
17726 eval $inlibc
17727
17728 : see if shmctl exists
17729 set shmctl d_shmctl
17730 eval $inlibc
17731
17732 : see if shmget exists
17733 set shmget d_shmget
17734 eval $inlibc
17735
17736 : see if shmat exists
17737 set shmat d_shmat
17738 eval $inlibc
17739 : see what shmat returns
17740 case "$d_shmat" in
17741 "$define")
17742         $cat >shmat.c <<'END'
17743 #include <sys/shm.h>
17744 void *shmat();
17745 END
17746         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17747                 shmattype='void *'
17748         else
17749                 shmattype='char *'
17750         fi
17751         echo "and it returns ($shmattype)." >&4
17752         : see if a prototype for shmat is available
17753         xxx=`./findhdr sys/shm.h`
17754         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17755         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17756                 val="$define"
17757         else
17758                 val="$undef"
17759         fi
17760         $rm -f shmat.[co]
17761         ;;
17762 *)
17763         val="$undef"
17764         ;;
17765 esac
17766 set d_shmatprototype
17767 eval $setvar
17768
17769 : see if shmdt exists
17770 set shmdt d_shmdt
17771 eval $inlibc
17772
17773 : see how much of the 'shm*(2)' library is present.
17774 h_shm=true
17775 echo " "
17776 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17777 *"$undef"*) h_shm=false;;
17778 esac
17779 case "$osname" in
17780 freebsd)
17781     case "`ipcs 2>&1`" in
17782     "SVID shared memory"*"not configured"*)
17783         echo "Your $osname does not have the shm*(2) configured." >&4
17784         h_shm=false
17785         val="$undef"
17786         set shmctl d_shmctl
17787         eval $setvar
17788         set shmget d_shmget
17789         eval $setvar
17790         set shmat d_shmat
17791         eval $setvar
17792         set shmdt d_shmdt
17793         eval $setvar
17794         ;;
17795     esac
17796     ;;
17797 esac
17798 : we could also check for sys/ipc.h ...
17799 if $h_shm && $test `./findhdr sys/shm.h`; then
17800         echo "You have the full shm*(2) library." >&4
17801         val="$define"
17802 else
17803         echo "You don't have the full shm*(2) library." >&4
17804         val="$undef"
17805 fi
17806 set d_shm
17807 eval $setvar
17808
17809 : see if we have sigaction
17810 echo " "
17811 if set sigaction val -f d_sigaction; eval $csym; $val; then
17812         echo 'sigaction() found.' >&4
17813         $cat > try.c <<EOP
17814 #include <stdio.h>
17815 #include <sys/types.h>
17816 #include <signal.h>
17817 #$i_stdlib I_STDLIB
17818 #ifdef I_STDLIB
17819 #include <stdlib.h>
17820 #endif
17821 int main()
17822 {
17823     struct sigaction act, oact;
17824     act.sa_flags = 0;
17825     oact.sa_handler = 0;
17826     /* so that act and oact are used */
17827     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17828 }
17829 EOP
17830         set try
17831         if eval $compile_ok; then
17832                 val="$define"
17833         else
17834                 echo "But you don't seem to have a usable struct sigaction." >&4
17835                 val="$undef"
17836         fi
17837 else
17838         echo 'sigaction NOT found.' >&4
17839         val="$undef"
17840 fi
17841 set d_sigaction; eval $setvar
17842 $rm_try
17843
17844 : see if this is a sunmath.h system
17845 set sunmath.h i_sunmath
17846 eval $inhdr
17847
17848 : see if signbit exists
17849 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17850 $cat >try.c <<EOCP
17851 #$i_math I_MATH
17852 #$i_sunmath I_SUNMATH
17853 #ifdef I_MATH
17854 #  include <math.h>
17855 #endif
17856 #ifdef I_SUNMATH  /* Solaris special math library */
17857 #  include <sunmath.h>
17858 #endif
17859 #define NV $nvtype
17860 int main(int argc, char **argv)
17861 {
17862     NV x = 0.0;
17863     NV y = -0.0;
17864     if ((signbit(x) == 0) && (signbit(y) != 0))
17865         return 0;
17866     else
17867         return 1;
17868 }
17869 EOCP
17870 val="$undef"
17871 set try
17872 if eval $compile; then
17873     if $run ./try; then
17874         $echo "Yes." >&4
17875         val="$define"
17876     else
17877         $echo "Signbit seems to be available, but doesn't work as I expected."
17878         $echo "I won't use it." >&4
17879         val="$undef"
17880     fi
17881 else
17882     $echo "Nope." >&4
17883     dflt="$undef"
17884 fi
17885 set d_signbit
17886 eval $setvar
17887 $rm_try
17888
17889 : see if sigprocmask exists
17890 set sigprocmask d_sigprocmask
17891 eval $inlibc
17892
17893 : see if sigsetjmp exists
17894 echo " "
17895 case "$d_sigsetjmp" in
17896 '')
17897         $cat >try.c <<EOP
17898 #include <setjmp.h>
17899 #$i_stdlib I_STDLIB
17900 #ifdef I_STDLIB
17901 #include <stdlib.h>
17902 #endif
17903 sigjmp_buf env;
17904 int set = 1;
17905 int main()
17906 {
17907         if (sigsetjmp(env,1))
17908                 exit(set);
17909         set = 0;
17910         siglongjmp(env, 1);
17911         exit(1);
17912 }
17913 EOP
17914         set try
17915         if eval $compile; then
17916                 if $run ./try >/dev/null 2>&1; then
17917                         echo "POSIX sigsetjmp found." >&4
17918                         val="$define"
17919                 else
17920                         $cat >&4 <<EOM
17921 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17922 I'll ignore them.
17923 EOM
17924                         val="$undef"
17925                 fi
17926         else
17927                 echo "sigsetjmp not found." >&4
17928                 val="$undef"
17929         fi
17930         ;;
17931 *) val="$d_sigsetjmp"
17932         case "$d_sigsetjmp" in
17933         $define) echo "POSIX sigsetjmp found." >&4;;
17934         $undef) echo "sigsetjmp not found." >&4;;
17935         esac
17936         ;;
17937 esac
17938 set d_sigsetjmp
17939 eval $setvar
17940 $rm_try
17941
17942 : see if snprintf exists
17943 set snprintf d_snprintf
17944 eval $inlibc
17945
17946 : see if vsnprintf exists
17947 set vsnprintf d_vsnprintf
17948 eval $inlibc
17949
17950 case "$d_snprintf-$d_vsnprintf" in
17951 "$define-$define")
17952     $cat <<EOM
17953 Checking whether your snprintf() and vsnprintf() work okay...
17954 EOM
17955     $cat >try.c <<'EOCP'
17956 /* v?snprintf testing logic courtesy of Russ Allbery.
17957  * According to C99:
17958  * - if the buffer is too short it still must be \0-terminated
17959  * - if the buffer is too short the potentially required length
17960  *   must be returned and not -1
17961  * - if the buffer is NULL the potentially required length
17962  *   must be returned and not -1 or core dump
17963  */
17964 #include <stdio.h>
17965 #include <stdarg.h>
17966
17967 char buf[2];
17968
17969 int test (char *format, ...)
17970 {
17971     va_list args;
17972     int count;
17973
17974     va_start (args, format);
17975     count = vsnprintf (buf, sizeof buf, format, args);
17976     va_end (args);
17977     return count;
17978 }
17979
17980 int main ()
17981 {
17982     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17983              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17984 }
17985 EOCP
17986     set try
17987     if eval $compile; then
17988         `$run ./try`
17989         case "$?" in
17990         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17991         *) cat <<EOM >&4
17992 Your snprintf() and snprintf() don't seem to be working okay.
17993 EOM
17994            d_snprintf="$undef"
17995            d_vsnprintf="$undef"
17996            ;;
17997         esac
17998     else
17999         echo "(I can't seem to compile the test program--assuming they don't)"
18000         d_snprintf="$undef"
18001         d_vsnprintf="$undef"
18002     fi
18003     $rm_try
18004     ;;
18005 esac
18006
18007 : see if sockatmark exists
18008 set sockatmark d_sockatmark
18009 eval $inlibc
18010
18011 : see if prototype for sockatmark is available
18012 echo " "
18013 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18014 eval $hasproto
18015
18016 : see if socks5_init exists
18017 set socks5_init d_socks5_init
18018 eval $inlibc
18019
18020 : see if sprintf returns the length of the string in the buffer as per ANSI
18021 $echo "Checking whether sprintf returns the length of the string..." >&4
18022 $cat <<EOP >try.c
18023 #include <stdio.h>
18024 #$i_stdlib I_STDLIB
18025 #ifdef I_STDLIB
18026 #include <stdlib.h>
18027 #endif
18028 #$i_string I_STRING
18029 #ifdef I_STRING
18030 #  include <string.h>
18031 #else
18032 #  include <strings.h>
18033 #endif
18034 #$i_math I_MATH
18035 #ifdef I_MATH
18036 #include <math.h>
18037 #endif
18038
18039 char buffer[256];
18040
18041 int check (size_t expect, int test) {
18042   size_t got = strlen(buffer);
18043   if (expect == got)
18044     return 0;
18045
18046   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
18047        test, buffer);
18048   exit (test);
18049 }
18050
18051 int main(int argc, char **argv) {
18052   int test = 0;
18053
18054   check(sprintf(buffer, ""), ++test);
18055   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
18056   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
18057
18058   return 0;
18059 }
18060 EOP
18061 set try
18062
18063 if eval $compile; then
18064     xxx="`$run ./try`"
18065     case "$?" in
18066         0) cat >&4 <<EOM
18067 sprintf returns the length of the string (as ANSI says it should)
18068 EOM
18069         d_sprintf_returns_strlen="$define"
18070         ;;
18071         *) cat >&4 <<EOM
18072 sprintf does not return the length of the string (how old is this system?)
18073 EOM
18074         d_sprintf_returns_strlen="$undef"
18075         ;;
18076     esac
18077 else
18078     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
18079     d_sprintf_returns_strlen="$undef"
18080 fi
18081 $rm_try
18082
18083 : see if srand48_r exists
18084 set srand48_r d_srand48_r
18085 eval $inlibc
18086 case "$d_srand48_r" in
18087 "$define")
18088         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18089         case "$d_srand48_r_proto:$usethreads" in
18090         ":define")      d_srand48_r_proto=define
18091                 set d_srand48_r_proto srand48_r $hdrs
18092                 eval $hasproto ;;
18093         *)      ;;
18094         esac
18095         case "$d_srand48_r_proto" in
18096         define)
18097         case "$srand48_r_proto" in
18098         ''|0) try='int srand48_r(long, struct drand48_data*);'
18099         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18100         esac
18101         case "$srand48_r_proto" in
18102         ''|0)   d_srand48_r=undef
18103                 srand48_r_proto=0
18104                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18105         * )     case "$srand48_r_proto" in
18106                 REENTRANT_PROTO*) ;;
18107                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18108                 esac
18109                 echo "Prototype: $try" ;;
18110         esac
18111         ;;
18112         *)      case "$usethreads" in
18113                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18114                 esac
18115                 d_srand48_r=undef
18116                 srand48_r_proto=0
18117                 ;;
18118         esac
18119         ;;
18120 *)      srand48_r_proto=0
18121         ;;
18122 esac
18123
18124 : see if srandom_r exists
18125 set srandom_r d_srandom_r
18126 eval $inlibc
18127 case "$d_srandom_r" in
18128 "$define")
18129         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18130         case "$d_srandom_r_proto:$usethreads" in
18131         ":define")      d_srandom_r_proto=define
18132                 set d_srandom_r_proto srandom_r $hdrs
18133                 eval $hasproto ;;
18134         *)      ;;
18135         esac
18136         case "$d_srandom_r_proto" in
18137         define)
18138         case "$srandom_r_proto" in
18139         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18140         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18141         esac
18142         case "$srandom_r_proto" in
18143         ''|0)   d_srandom_r=undef
18144                 srandom_r_proto=0
18145                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18146         * )     case "$srandom_r_proto" in
18147                 REENTRANT_PROTO*) ;;
18148                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18149                 esac
18150                 echo "Prototype: $try" ;;
18151         esac
18152         ;;
18153         *)      case "$usethreads" in
18154                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18155                 esac
18156                 d_srandom_r=undef
18157                 srandom_r_proto=0
18158                 ;;
18159         esac
18160         ;;
18161 *)      srandom_r_proto=0
18162         ;;
18163 esac
18164
18165 : see if prototype for setresgid is available
18166 echo " "
18167 set d_sresgproto setresgid $i_unistd unistd.h
18168 eval $hasproto
18169
18170 : see if prototype for setresuid is available
18171 echo " "
18172 set d_sresuproto setresuid $i_unistd unistd.h
18173 eval $hasproto
18174
18175 : see if sys/stat.h is available
18176 set sys/stat.h i_sysstat
18177 eval $inhdr
18178
18179 : see if stat knows about block sizes
18180 echo " "
18181 echo "Checking to see if your struct stat has st_blocks field..." >&4
18182 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18183 eval $hasfield
18184
18185 : see if this is a sys/vfs.h system
18186 set sys/vfs.h i_sysvfs
18187 eval $inhdr
18188
18189 : see if this is a sys/statfs.h system
18190 set sys/statfs.h i_sysstatfs
18191 eval $inhdr
18192
18193 : Check for statfs_s
18194 echo " "
18195 echo "Checking to see if your system supports struct statfs..." >&4
18196 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
18197 eval $hasstruct
18198 case "$d_statfs_s" in
18199 "$define")      echo "Yes, it does."   ;;
18200 *)              echo "No, it doesn't." ;;
18201 esac
18202
18203
18204 : see if struct statfs knows about f_flags
18205 case "$d_statfs_s" in
18206 define)
18207         echo " "
18208         echo "Checking to see if your struct statfs has f_flags field..." >&4
18209         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
18210         eval $hasfield
18211         ;;
18212 *)      val="$undef"
18213         set d_statfs_f_flags
18214         eval $setvar
18215         ;;
18216 esac
18217 case "$d_statfs_f_flags" in
18218 "$define")      echo "Yes, it does."   ;;
18219 *)              echo "No, it doesn't." ;;
18220 esac
18221
18222 : see what flavor, if any, of static inline is supported
18223 echo " "
18224 echo "Checking to see if your system supports static inline..."
18225 $cat > try.c <<'EOCP'
18226 #include <stdlib.h>
18227 extern int f_via_a(int x);
18228 extern int f_via_b(int x);
18229 int main(int argc, char **argv)
18230 {
18231     int y;
18232
18233     y = f_via_a(0);
18234 #ifdef USE_B
18235     y = f_via_b(0);
18236 #endif
18237     if (y == 42) {
18238         return EXIT_SUCCESS;
18239     }
18240     else {
18241         return EXIT_FAILURE;
18242     }
18243 }
18244 EOCP
18245 $cat > a.c <<'EOCP'
18246 static INLINE int f(int x) {
18247     int y;
18248     y = x + 42;
18249     return y;
18250 }
18251
18252 int f_via_a(int x)
18253 {
18254     return f(x);
18255 }
18256 EOCP
18257 $cat > b.c <<'EOCP'
18258 extern int f(int x);
18259
18260 int f_via_b(int x)
18261 {
18262     return f(x);
18263 }
18264 EOCP
18265
18266 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18267 case "$perl_static_inline" in
18268 '')     # Check the various possibilities, and break out on success.
18269         # For gcc, prefer __inline__, which will still permit
18270         # cflags.SH to add in -ansi.
18271         case "$gccversion" in
18272                 '') xxx="inline __inline__ __inline _inline";;
18273                 *)  xxx="__inline__ inline __inline _inline";;
18274         esac
18275         for inline in $xxx; do
18276                 set try -DINLINE=$inline a.c
18277                 if eval $compile && $run ./try; then
18278                         # Now make sure there is no external linkage of static
18279                         # functions
18280                         set try -DINLINE=$inline -DUSE_B a.c b.c
18281                         if eval $compile && $run ./try; then
18282                                 $echo "Your compiler supports static $inline, " >&4
18283                                 $echo "but it also creates an external definition," >&4
18284                                 $echo "so I won't use it." >&4
18285                                 val=$undef
18286                         else
18287                                 $echo "Your compiler supports static $inline." >&4
18288                                 val=$define
18289                                 perl_static_inline="static $inline";
18290                                 break;
18291                         fi
18292                 else
18293                         $echo "Your compiler does NOT support static $inline." >&4
18294                         val="$undef"
18295                 fi
18296         done
18297         ;;
18298 *inline*) # Some variant of inline exists.
18299         echo "Keeping your $hint value of $perl_static_inline."
18300         val=$define
18301         ;;
18302 static)  # No inline capabilities
18303         echo "Keeping your $hint value of $perl_static_inline."
18304         val=$undef
18305         ;;
18306 *)  # Unrecognized previous value -- blindly trust the supplied
18307         # value and hope it makes sense.  Use old value for
18308         # d_static_inline, if there is one.
18309         echo "Keeping your $hint value of $perl_static_inline."
18310         case "$d_static_inline" in
18311                 '') val=$define ;;
18312                 *)  val=$d_static_inline ;;
18313         esac
18314         ;;
18315 esac
18316 # Fallback to plain 'static' if nothing worked.
18317 case "$perl_static_inline" in
18318 '')
18319         perl_static_inline="static"
18320         val=$undef
18321         ;;
18322 esac
18323 set d_static_inline
18324 eval $setvar
18325 $rm -f a.[co] b.[co]
18326 $rm_try
18327
18328 : Check stream access
18329 $cat >&4 <<EOM
18330 Checking how to access stdio streams by file descriptor number...
18331 EOM
18332 case "$stdio_stream_array" in
18333 '')     $cat >try.c <<EOCP
18334 #include <stdio.h>
18335 int main() {
18336   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18337     printf("yes\n");
18338 }
18339 EOCP
18340         for s in _iob __iob __sF
18341         do
18342                 set try -DSTDIO_STREAM_ARRAY=$s
18343                 if eval $compile; then
18344                         case "`$run ./try`" in
18345                         yes)    stdio_stream_array=$s; break ;;
18346                         esac
18347                 fi
18348         done
18349         $rm_try
18350 esac
18351 case "$stdio_stream_array" in
18352 '')     $cat >&4 <<EOM
18353 I can't figure out how to access stdio streams by file descriptor number.
18354 EOM
18355         d_stdio_stream_array="$undef"
18356         ;;
18357 *)      $cat >&4 <<EOM
18358 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18359 EOM
18360         d_stdio_stream_array="$define"
18361         ;;
18362 esac
18363
18364 : see if strcoll exists
18365 set strcoll d_strcoll
18366 eval $inlibc
18367
18368 : check for structure copying
18369 echo " "
18370 echo "Checking to see if your C compiler can copy structs..." >&4
18371 $cat >try.c <<'EOCP'
18372 int main()
18373 {
18374         struct blurfl {
18375                 int dyick;
18376         } foo, bar;
18377
18378         foo = bar;
18379 }
18380 EOCP
18381 if $cc -c try.c >/dev/null 2>&1 ; then
18382         val="$define"
18383         echo "Yup, it can."
18384 else
18385         val="$undef"
18386         echo "Nope, it can't."
18387 fi
18388 set d_strctcpy
18389 eval $setvar
18390 $rm_try
18391
18392 : see if strerror and/or sys_errlist[] exist
18393 echo " "
18394 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18395     if set strerror val -f d_strerror; eval $csym; $val; then
18396                 echo 'strerror() found.' >&4
18397                 d_strerror="$define"
18398                 d_strerrm='strerror(e)'
18399                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18400                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
18401                         d_syserrlst="$define"
18402                 else
18403                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
18404                         d_syserrlst="$undef"
18405                 fi
18406     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18407                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18408                 echo 'strerror() found in string header.' >&4
18409                 d_strerror="$define"
18410                 d_strerrm='strerror(e)'
18411                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18412                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18413                                 d_syserrlst="$define"
18414                 else
18415                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
18416                         d_syserrlst="$undef"
18417                 fi
18418     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18419                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18420                 d_strerror="$undef"
18421                 d_syserrlst="$define"
18422                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18423     else
18424                 echo 'strerror() and sys_errlist[] NOT found.' >&4
18425                 d_strerror="$undef"
18426                 d_syserrlst="$undef"
18427                 d_strerrm='"unknown"'
18428     fi
18429 fi
18430
18431 : see if strerror_r exists
18432 set strerror_r d_strerror_r
18433 eval $inlibc
18434 case "$d_strerror_r" in
18435 "$define")
18436         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18437         case "$d_strerror_r_proto:$usethreads" in
18438         ":define")      d_strerror_r_proto=define
18439                 set d_strerror_r_proto strerror_r $hdrs
18440                 eval $hasproto ;;
18441         *)      ;;
18442         esac
18443         case "$d_strerror_r_proto" in
18444         define)
18445         case "$strerror_r_proto" in
18446         ''|0) try='int strerror_r(int, char*, size_t);'
18447         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18448         esac
18449         case "$strerror_r_proto" in
18450         ''|0) try='int strerror_r(int, char*, int);'
18451         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18452         esac
18453         case "$strerror_r_proto" in
18454         ''|0) try='char* strerror_r(int, char*, size_t);'
18455         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18456         esac
18457         case "$strerror_r_proto" in
18458         ''|0)   d_strerror_r=undef
18459                 strerror_r_proto=0
18460                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18461         * )     case "$strerror_r_proto" in
18462                 REENTRANT_PROTO*) ;;
18463                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18464                 esac
18465                 echo "Prototype: $try" ;;
18466         esac
18467         ;;
18468         *)      case "$usethreads" in
18469                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18470                 esac
18471                 d_strerror_r=undef
18472                 strerror_r_proto=0
18473                 ;;
18474         esac
18475         ;;
18476 *)      strerror_r_proto=0
18477         ;;
18478 esac
18479
18480 : see if strftime exists
18481 set strftime d_strftime
18482 eval $inlibc
18483
18484 : see if strlcat exists
18485 set strlcat d_strlcat
18486 eval $inlibc
18487
18488 : see if strlcpy exists
18489 set strlcpy d_strlcpy
18490 eval $inlibc
18491
18492 : see if strtod exists
18493 set strtod d_strtod
18494 eval $inlibc
18495
18496 : see if strtol exists
18497 set strtol d_strtol
18498 eval $inlibc
18499
18500 : see if strtold exists
18501 set strtold d_strtold
18502 eval $inlibc
18503
18504 : see if strtoll exists
18505 set strtoll d_strtoll
18506 eval $inlibc
18507
18508 case "$d_longlong-$d_strtoll" in
18509 "$define-$define")
18510         $cat <<EOM
18511 Checking whether your strtoll() works okay...
18512 EOM
18513         $cat >try.c <<'EOCP'
18514 #include <errno.h>
18515 #ifdef __hpux
18516 #define strtoll __strtoll
18517 #endif
18518 #ifdef __EMX__
18519 #define strtoll _strtoll
18520 #endif
18521 #include <stdio.h>
18522 extern long long int strtoll(char *s, char **, int);
18523 static int bad = 0;
18524 int check(char *s, long long ell, int een) {
18525         long long gll;
18526         errno = 0;
18527         gll = strtoll(s, 0, 10);
18528         if (!((gll == ell) && (errno == een)))
18529                 bad++;
18530 }
18531 int main() {
18532         check(" 1",                                      1LL, 0);
18533         check(" 0",                                      0LL, 0);
18534         check("-1",                                     -1LL, 0);
18535         check("-9223372036854775808", -9223372036854775808LL, 0);
18536         check("-9223372036854775808", -9223372036854775808LL, 0);
18537         check(" 9223372036854775807",  9223372036854775807LL, 0);
18538         check("-9223372036854775808", -9223372036854775808LL, 0);
18539         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18540         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18541         if (!bad)
18542                 printf("ok\n");
18543 }
18544 EOCP
18545         set try
18546         if eval $compile; then
18547                 yyy=`$run ./try`
18548                 case "$yyy" in
18549                 ok) echo "Your strtoll() seems to be working okay." ;;
18550                 *) cat <<EOM >&4
18551 Your strtoll() doesn't seem to be working okay.
18552 EOM
18553                    d_strtoll="$undef"
18554                    ;;
18555                 esac
18556         else
18557                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18558                 d_strtoll="$undef"
18559         fi
18560         ;;
18561 esac
18562
18563 : see if strtoq exists
18564 set strtoq d_strtoq
18565 eval $inlibc
18566
18567 : see if strtoul exists
18568 set strtoul d_strtoul
18569 eval $inlibc
18570
18571 case "$d_strtoul" in
18572 "$define")
18573         $cat <<EOM
18574 Checking whether your strtoul() works okay...
18575 EOM
18576         $cat >try.c <<'EOCP'
18577 #include <errno.h>
18578 #include <stdio.h>
18579 extern unsigned long int strtoul(char *s, char **, int);
18580 static int bad = 0;
18581 void check(char *s, unsigned long eul, int een) {
18582         unsigned long gul;
18583         errno = 0;
18584         gul = strtoul(s, 0, 10);
18585         if (!((gul == eul) && (errno == een)))
18586                 bad++;
18587 }
18588 int main() {
18589         check(" 1", 1L, 0);
18590         check(" 0", 0L, 0);
18591 EOCP
18592         case "$longsize" in
18593         8)
18594             $cat >>try.c <<'EOCP'
18595         check("18446744073709551615", 18446744073709551615UL, 0);
18596         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18597 #if 0 /* strtoul() for /^-/ strings is undefined. */
18598         check("-1", 18446744073709551615UL, 0);
18599         check("-18446744073709551614", 2, 0);
18600         check("-18446744073709551615", 1, 0);
18601         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18602         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18603 #endif
18604 EOCP
18605                 ;;
18606         4)
18607                     $cat >>try.c <<'EOCP'
18608         check("4294967295", 4294967295UL, 0);
18609         check("4294967296", 4294967295UL, ERANGE);
18610 #if 0 /* strtoul() for /^-/ strings is undefined. */
18611         check("-1", 4294967295UL, 0);
18612         check("-4294967294", 2, 0);
18613         check("-4294967295", 1, 0);
18614         check("-4294967296", 4294967295UL, ERANGE);
18615         check("-4294967297", 4294967295UL, ERANGE);
18616 #endif
18617 EOCP
18618                 ;;
18619         *)
18620 : Should we write these tests to be more portable by sprintf-ing
18621 : ~0 and then manipulating that char string as input for strtol?
18622                 ;;
18623         esac
18624         $cat >>try.c <<'EOCP'
18625         if (!bad)
18626                 printf("ok\n");
18627         return 0;
18628 }
18629 EOCP
18630         set try
18631         if eval $compile; then
18632                 case "`$run ./try`" in
18633                 ok) echo "Your strtoul() seems to be working okay." ;;
18634                 *) cat <<EOM >&4
18635 Your strtoul() doesn't seem to be working okay.
18636 EOM
18637                    d_strtoul="$undef"
18638                    ;;
18639                 esac
18640         else
18641                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18642                 d_strtoul="$undef"
18643         fi
18644         ;;
18645 esac
18646
18647 : see if strtoull exists
18648 set strtoull d_strtoull
18649 eval $inlibc
18650
18651 case "$d_longlong-$d_strtoull" in
18652 "$define-$define")
18653         $cat <<EOM
18654 Checking whether your strtoull() works okay...
18655 EOM
18656         $cat >try.c <<'EOCP'
18657 #include <errno.h>
18658 #ifdef __hpux
18659 #define strtoull __strtoull
18660 #endif
18661 #include <stdio.h>
18662 extern unsigned long long int strtoull(char *s, char **, int);
18663 static int bad = 0;
18664 int check(char *s, long long eull, int een) {
18665         long long gull;
18666         errno = 0;
18667         gull = strtoull(s, 0, 10);
18668         if (!((gull == eull) && (errno == een)))
18669                 bad++;
18670 }
18671 int main() {
18672         check(" 1",                                        1LL, 0);
18673         check(" 0",                                        0LL, 0);
18674         check("18446744073709551615",  18446744073709551615ULL, 0);
18675         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18676 #if 0 /* strtoull() for /^-/ strings is undefined. */
18677         check("-1",                    18446744073709551615ULL, 0);
18678         check("-18446744073709551614",                     2LL, 0);
18679         check("-18446744073709551615",                     1LL, 0);
18680         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18681         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18682 #endif
18683         if (!bad)
18684                 printf("ok\n");
18685 }
18686 EOCP
18687         set try
18688         if eval $compile; then
18689                 case "`$run ./try`" in
18690                 ok) echo "Your strtoull() seems to be working okay." ;;
18691                 *) cat <<EOM >&4
18692 Your strtoull() doesn't seem to be working okay.
18693 EOM
18694                    d_strtoull="$undef"
18695                    ;;
18696                 esac
18697         else
18698                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18699                 d_strtoull="$undef"
18700         fi
18701         ;;
18702 esac
18703
18704 : see if strtouq exists
18705 set strtouq d_strtouq
18706 eval $inlibc
18707
18708 case "$d_strtouq" in
18709 "$define")
18710         $cat <<EOM
18711 Checking whether your strtouq() works okay...
18712 EOM
18713         $cat >try.c <<'EOCP'
18714 #include <errno.h>
18715 #include <stdio.h>
18716 extern unsigned long long int strtouq(char *s, char **, int);
18717 static int bad = 0;
18718 void check(char *s, unsigned long long eull, int een) {
18719         unsigned long long gull;
18720         errno = 0;
18721         gull = strtouq(s, 0, 10);
18722         if (!((gull == eull) && (errno == een)))
18723                 bad++;
18724 }
18725 int main() {
18726         check(" 1",                                        1LL, 0);
18727         check(" 0",                                        0LL, 0);
18728         check("18446744073709551615",  18446744073709551615ULL, 0);
18729         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18730 #if 0 /* strtouq() for /^-/ strings is undefined. */
18731         check("-1",                    18446744073709551615ULL, 0);
18732         check("-18446744073709551614",                     2LL, 0);
18733         check("-18446744073709551615",                     1LL, 0);
18734         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18735         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18736 #endif
18737         if (!bad)
18738                 printf("ok\n");
18739         return 0;
18740 }
18741 EOCP
18742         set try
18743         if eval $compile; then
18744                 case "`$run ./try`" in
18745                 ok) echo "Your strtouq() seems to be working okay." ;;
18746                 *) cat <<EOM >&4
18747 Your strtouq() doesn't seem to be working okay.
18748 EOM
18749                    d_strtouq="$undef"
18750                    ;;
18751                 esac
18752         else
18753                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18754                 d_strtouq="$undef"
18755         fi
18756         ;;
18757 esac
18758
18759 : see if strxfrm exists
18760 set strxfrm d_strxfrm
18761 eval $inlibc
18762
18763 : see if symlink exists
18764 set symlink d_symlink
18765 eval $inlibc
18766
18767 : see if syscall exists
18768 set syscall d_syscall
18769 eval $inlibc
18770
18771 : see if prototype for syscall is available
18772 echo " "
18773 set d_syscallproto syscall $i_unistd unistd.h
18774 eval $hasproto
18775
18776 : see if sysconf exists
18777 set sysconf d_sysconf
18778 eval $inlibc
18779
18780 : see if system exists
18781 set system d_system
18782 eval $inlibc
18783
18784 : see if tcgetpgrp exists
18785 set tcgetpgrp d_tcgetpgrp
18786 eval $inlibc
18787
18788 : see if tcsetpgrp exists
18789 set tcsetpgrp d_tcsetpgrp
18790 eval $inlibc
18791
18792 : see if prototype for telldir is available
18793 echo " "
18794 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18795 eval $hasproto
18796
18797 : see if time exists
18798 echo " "
18799 if test "X$d_time" = X -o X"$timetype" = X; then
18800     if set time val -f d_time; eval $csym; $val; then
18801                 echo 'time() found.' >&4
18802                 val="$define"
18803                 rp="What is the type returned by time() on this system?"
18804                 set time_t timetype long stdio.h sys/types.h
18805                 eval $typedef_ask
18806     else
18807                 echo 'time() not found, hope that will do.' >&4
18808                 val="$undef"
18809                 timetype='int';
18810     fi
18811     set d_time
18812     eval $setvar
18813 fi
18814
18815 : see if timegm exists
18816 set timegm d_timegm
18817 eval $inlibc
18818
18819 : see if this is a sys/times.h system
18820 set sys/times.h i_systimes
18821 eval $inhdr
18822
18823 : see if times exists
18824 echo " "
18825 if set times val -f d_times; eval $csym; $val; then
18826         echo 'times() found.' >&4
18827         d_times="$define"
18828         inc=''
18829         case "$i_systimes" in
18830         "$define") inc='sys/times.h';;
18831         esac
18832         rp="What is the type returned by times() on this system?"
18833         set clock_t clocktype long stdio.h sys/types.h $inc
18834         eval $typedef_ask
18835 else
18836         echo 'times() NOT found, hope that will do.' >&4
18837         d_times="$undef"
18838         clocktype='int'
18839 fi
18840
18841 : see if tmpnam_r exists
18842 set tmpnam_r d_tmpnam_r
18843 eval $inlibc
18844 case "$d_tmpnam_r" in
18845 "$define")
18846         hdrs="$i_systypes sys/types.h define stdio.h "
18847         case "$d_tmpnam_r_proto:$usethreads" in
18848         ":define")      d_tmpnam_r_proto=define
18849                 set d_tmpnam_r_proto tmpnam_r $hdrs
18850                 eval $hasproto ;;
18851         *)      ;;
18852         esac
18853         case "$d_tmpnam_r_proto" in
18854         define)
18855         case "$tmpnam_r_proto" in
18856         ''|0) try='char* tmpnam_r(char*);'
18857         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18858         esac
18859         case "$tmpnam_r_proto" in
18860         ''|0)   d_tmpnam_r=undef
18861                 tmpnam_r_proto=0
18862                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18863         * )     case "$tmpnam_r_proto" in
18864                 REENTRANT_PROTO*) ;;
18865                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18866                 esac
18867                 echo "Prototype: $try" ;;
18868         esac
18869         ;;
18870         *)      case "$usethreads" in
18871                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18872                 esac
18873                 d_tmpnam_r=undef
18874                 tmpnam_r_proto=0
18875                 ;;
18876         esac
18877         ;;
18878 *)      tmpnam_r_proto=0
18879         ;;
18880 esac
18881
18882 : see if truncate exists
18883 set truncate d_truncate
18884 eval $inlibc
18885
18886 : see if ttyname_r exists
18887 set ttyname_r d_ttyname_r
18888 eval $inlibc
18889 case "$d_ttyname_r" in
18890 "$define")
18891         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18892         case "$d_ttyname_r_proto:$usethreads" in
18893         ":define")      d_ttyname_r_proto=define
18894                 set d_ttyname_r_proto ttyname_r $hdrs
18895                 eval $hasproto ;;
18896         *)      ;;
18897         esac
18898         case "$d_ttyname_r_proto" in
18899         define)
18900         case "$ttyname_r_proto" in
18901         ''|0) try='int ttyname_r(int, char*, size_t);'
18902         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18903         esac
18904         case "$ttyname_r_proto" in
18905         ''|0) try='int ttyname_r(int, char*, int);'
18906         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18907         esac
18908         case "$ttyname_r_proto" in
18909         ''|0) try='char* ttyname_r(int, char*, int);'
18910         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18911         esac
18912         case "$ttyname_r_proto" in
18913         ''|0)   d_ttyname_r=undef
18914                 ttyname_r_proto=0
18915                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18916         * )     case "$ttyname_r_proto" in
18917                 REENTRANT_PROTO*) ;;
18918                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18919                 esac
18920                 echo "Prototype: $try" ;;
18921         esac
18922         ;;
18923         *)      case "$usethreads" in
18924                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18925                 esac
18926                 d_ttyname_r=undef
18927                 ttyname_r_proto=0
18928                 ;;
18929         esac
18930         ;;
18931 *)      ttyname_r_proto=0
18932         ;;
18933 esac
18934
18935 : see if tzname[] exists
18936 echo " "
18937 if set tzname val -a d_tzname; eval $csym; $val; then
18938         val="$define"
18939         echo 'tzname[] found.' >&4
18940 else
18941         val="$undef"
18942         echo 'tzname[] NOT found.' >&4
18943 fi
18944 set d_tzname
18945 eval $setvar
18946
18947 : Check if is a multiplatform env
18948 case "$osname" in
18949 next|darwin) multiarch="$define" ;;
18950 esac
18951 case "$multiarch" in
18952 ''|[nN]*) multiarch="$undef" ;;
18953 esac
18954
18955 : check for ordering of bytes in a UV
18956 echo " "
18957 case "$multiarch" in
18958 *$define*)
18959         $cat <<EOM
18960 You seem to be doing a multiarchitecture build,
18961 skipping the byteorder check.
18962
18963 EOM
18964         byteorder='ffff'
18965         ;;
18966 *)
18967         case "$byteorder" in
18968         '')
18969                 $cat <<'EOM'
18970 In the following, larger digits indicate more significance.  A big-endian
18971 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18972 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18973 machines may have weird orders like 3412.  A Cray will report 87654321,
18974 an Alpha will report 12345678. If the test program works the default is
18975 probably right.
18976 I'm now running the test program...
18977 EOM
18978                 $cat >try.c <<EOCP
18979 #include <stdio.h>
18980 #$i_stdlib I_STDLIB
18981 #ifdef I_STDLIB
18982 #include <stdlib.h>
18983 #endif
18984 #include <sys/types.h>
18985 typedef $uvtype UV;
18986 int main()
18987 {
18988         int i;
18989         union {
18990                 UV l;
18991                 char c[$uvsize];
18992         } u;
18993
18994         if ($uvsize > 4)
18995                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18996         else
18997                 u.l = (UV)0x04030201;
18998         for (i = 0; i < $uvsize; i++)
18999                 printf("%c", u.c[i]+'0');
19000         printf("\n");
19001         exit(0);
19002 }
19003 EOCP
19004                 xxx_prompt=y
19005                 set try
19006                 if eval $compile && $run ./try > /dev/null; then
19007                         dflt=`$run ./try`
19008                         case "$dflt" in
19009                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19010                                 echo "(The test program ran ok.)"
19011                                 echo "byteorder=$dflt"
19012                                 xxx_prompt=n
19013                         ;;
19014                         ????|????????) echo "(The test program ran ok.)" ;;
19015                         *) echo "(The test program didn't run right for some reason.)" ;;
19016                         esac
19017                 else
19018                         dflt='4321'
19019                         cat <<'EOM'
19020 (I can't seem to compile the test program.  Guessing big-endian...)
19021 EOM
19022                 fi
19023                 case "$xxx_prompt" in
19024                 y)
19025                         rp="What is the order of bytes in $uvtype?"
19026                         . ./myread
19027                         byteorder="$ans"
19028                         ;;
19029                 *)      byteorder=$dflt
19030                         ;;
19031                 esac
19032                 ;;
19033         esac
19034         $rm_try
19035         ;;
19036 esac
19037
19038 : Checking 32bit alignedness
19039 $cat <<EOM
19040
19041 Checking to see whether you can access character data unalignedly...
19042 EOM
19043 case "$d_u32align" in
19044 '')   $cat >try.c <<EOCP
19045 #include <stdio.h>
19046 #$i_stdlib I_STDLIB
19047 #ifdef I_STDLIB
19048 #include <stdlib.h>
19049 #endif
19050 #define U32 $u32type
19051 #define BYTEORDER 0x$byteorder
19052 #define U8 $u8type
19053 #include <signal.h>
19054 #ifdef SIGBUS
19055 $signal_t bletch(int s) { exit(4); }
19056 #endif
19057 int main() {
19058 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19059     volatile U8 buf[8];
19060     volatile U32 *up;
19061     int i;
19062
19063     if (sizeof(U32) != 4) {
19064         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19065         exit(1);
19066     }
19067
19068     fflush(stdout);
19069
19070 #ifdef SIGBUS
19071     signal(SIGBUS, bletch);
19072 #endif
19073
19074     buf[0] = 0;
19075     buf[1] = 0;
19076     buf[2] = 0;
19077     buf[3] = 1;
19078     buf[4] = 0;
19079     buf[5] = 0;
19080     buf[6] = 0;
19081     buf[7] = 1;
19082
19083     for (i = 0; i < 4; i++) {
19084         up = (U32*)(buf + i);
19085         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19086                (*up == 1 << (8*(3-i)))  /* little-endian */
19087               )
19088            )
19089         {
19090             printf("read failed (%x)\n", *up);
19091             exit(2);
19092         }
19093     }
19094
19095     /* write test */
19096     for (i = 0; i < 4; i++) {
19097         up = (U32*)(buf + i);
19098         *up = 0xBeef;
19099         if (*up != 0xBeef) {
19100             printf("write failed (%x)\n", *up);
19101             exit(3);
19102         }
19103     }
19104
19105     exit(0);
19106 #else
19107     printf("1\n");
19108     exit(1);
19109 #endif
19110     return 0;
19111 }
19112 EOCP
19113 set try
19114 if eval $compile_ok; then
19115         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19116         $run ./try 2>&1 >/dev/null
19117         case "$?" in
19118         0)      cat >&4 <<EOM
19119 You can access character data pretty unalignedly.
19120 EOM
19121                 d_u32align="$undef"
19122                 ;;
19123         *)      cat >&4 <<EOM
19124 It seems that you must access character data in an aligned manner.
19125 EOM
19126                 d_u32align="$define"
19127                 ;;
19128         esac
19129 else
19130         rp='Can you access character data at unaligned addresses?'
19131         dflt='n'
19132         . ./myread
19133         case "$ans" in
19134         [yY]*)  d_u32align="$undef"  ;;
19135         *)      d_u32align="$define" ;;
19136         esac
19137 fi
19138 $rm_try
19139 ;;
19140 esac
19141
19142 : see if ualarm exists
19143 set ualarm d_ualarm
19144 eval $inlibc
19145
19146 : see if umask exists
19147 set umask d_umask
19148 eval $inlibc
19149
19150 : see if unordered exists
19151 set unordered d_unordered
19152 eval $inlibc
19153
19154 : see if unsetenv exists
19155 set unsetenv d_unsetenv
19156 eval $inlibc
19157
19158 : see if usleep exists
19159 set usleep d_usleep
19160 eval $inlibc
19161
19162 : see if prototype for usleep is available
19163 echo " "
19164 set d_usleepproto usleep $i_unistd unistd.h
19165 eval $hasproto
19166
19167 : see if ustat exists
19168 set ustat d_ustat
19169 eval $inlibc
19170
19171 : see if closedir exists
19172 set closedir d_closedir
19173 eval $inlibc
19174
19175 case "$d_closedir" in
19176 "$define")
19177         echo " "
19178         echo "Checking whether closedir() returns a status..." >&4
19179         cat > try.c <<EOM
19180 #$i_dirent I_DIRENT             /**/
19181 #$i_sysdir I_SYS_DIR            /**/
19182 #$i_sysndir I_SYS_NDIR          /**/
19183 #$i_systypes I_SYS_TYPES        /**/
19184
19185 #if defined(I_SYS_TYPES)
19186 #include <sys/types.h>
19187 #endif
19188 #if defined(I_DIRENT)
19189 #include <dirent.h>
19190 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
19191 #include <sys/dir.h>
19192 #endif
19193 #else
19194 #ifdef I_SYS_NDIR
19195 #include <sys/ndir.h>
19196 #else
19197 #ifdef I_SYS_DIR
19198 #ifdef hp9000s500
19199 #include <ndir.h>       /* may be wrong in the future */
19200 #else
19201 #include <sys/dir.h>
19202 #endif
19203 #endif
19204 #endif
19205 #endif
19206 int main() { return closedir(opendir(".")); }
19207 EOM
19208         set try
19209         if eval $compile_ok; then
19210                 if $run ./try > /dev/null 2>&1 ; then
19211                         echo "Yes, it does."
19212                         val="$undef"
19213                 else
19214                         echo "No, it doesn't."
19215                         val="$define"
19216                 fi
19217         else
19218                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19219                 val="$define"
19220         fi
19221         ;;
19222 *)
19223         val="$undef";
19224         ;;
19225 esac
19226 set d_void_closedir
19227 eval $setvar
19228 $rm_try
19229
19230 : see if there is a wait4
19231 set wait4 d_wait4
19232 eval $inlibc
19233
19234 : see if waitpid exists
19235 set waitpid d_waitpid
19236 eval $inlibc
19237
19238 : look for wcscmp
19239 echo " "
19240 $cat >try.c <<'EOCP'
19241 #include <stdio.h>
19242 #include <wchar.h>
19243 int main ()
19244 {
19245     wchar_t *s = L" ";
19246     return (wcscmp (s, s) ? 1 : 0);
19247     }
19248 EOCP
19249 set try
19250 val="$undef"
19251 if eval $compile; then
19252     `$run ./try`
19253     case "$?" in
19254         0)  echo "A working wcscmp() found." >&4
19255             val="$define" ;;
19256         *)  echo "wcscmp() found, but it doesn't work" >&4
19257             ;;
19258         esac
19259 else
19260     echo "wcscmp() NOT found." >&4
19261     fi
19262 set d_wcscmp
19263 eval $setvar
19264 $rm_try
19265
19266 : see if wcstombs exists
19267 set wcstombs d_wcstombs
19268 eval $inlibc
19269
19270 : look for wcsxfrm
19271 echo " "
19272 $cat >try.c <<'EOCP'
19273 #include <errno.h>
19274 #include <wchar.h>
19275 int main ()
19276 {
19277     wchar_t dst[4], *src = L" ";
19278     errno = 0;
19279     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
19280     }
19281 EOCP
19282 set try
19283 val="$undef"
19284 if eval $compile; then
19285     `$run ./try`
19286     case "$?" in
19287         0)  echo "A working wcsxfrm() found." >&4
19288             val="$define" ;;
19289         *)  echo "wcsxfrm() found, but it doesn't work" >&4
19290             ;;
19291         esac
19292 else
19293     echo "wcsxfrm() NOT found." >&4
19294     fi
19295 set d_wcsxfrm
19296 eval $setvar
19297 $rm_try
19298
19299 : see if wctomb exists
19300 set wctomb d_wctomb
19301 eval $inlibc
19302
19303 : see if writev exists
19304 set writev d_writev
19305 eval $inlibc
19306
19307 : check for alignment requirements
19308 echo " "
19309 case "$alignbytes" in
19310     '') echo "Checking alignment constraints..." >&4
19311         if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
19312             $cat >try.c <<'EOCP'
19313 typedef long double NV;
19314 EOCP
19315         else
19316             $cat >try.c <<'EOCP'
19317 typedef double NV;
19318 EOCP
19319         fi
19320         $cat >>try.c <<'EOCP'
19321 #include <stdio.h>
19322 struct foobar {
19323     char foo;
19324     NV bar;
19325 } try_algn;
19326 int main()
19327 {
19328     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19329     return(0);
19330 }
19331 EOCP
19332         set try
19333         if eval $compile_ok; then
19334             dflt=`$run ./try`
19335         else
19336             dflt='8'
19337             echo "(I can't seem to compile the test program...)"
19338         fi
19339         case "$multiarch" in
19340             *$define*)
19341                 : The usual safe value is 8, but Darwin with -Duselongdouble
19342                 : needs 16.  Hence, we will take 8 as a minimum, but allow
19343                 : Configure to pick a larger value if needed.
19344                 if $test "$dflt" -lt 8; then
19345                     dflt='8'
19346                     echo "Setting alignment to 8 for multiarch support.">&4
19347                 fi
19348                 ;;
19349         esac
19350         ;;
19351     *) dflt="$alignbytes"
19352         ;;
19353 esac
19354 rp="Doubles must be aligned on a how-many-byte boundary?"
19355 . ./myread
19356 alignbytes="$ans"
19357 $rm_try
19358
19359 : set the base revision
19360 baserev=5.0
19361
19362 : length of character in bytes. Is always 1, otherwise it is not C
19363 : This used to be a test using sizeof
19364 charsize=1
19365
19366 : Check for the number of bits in a character
19367 case "$charbits" in
19368 '')     echo "Checking how long a character is (in bits)..." >&4
19369         $cat >try.c <<EOCP
19370 #include <stdio.h>
19371 int main ()
19372 {
19373     int n;
19374     unsigned char c;
19375     for (c = 1, n = 0; c; c <<= 1, n++) ;
19376     printf ("%d\n", n);
19377     return (0);
19378     }
19379 EOCP
19380         set try
19381         if eval $compile_ok; then
19382                 dflt=`$run ./try`
19383         else
19384                 dflt='8'
19385                 echo "(I can't seem to compile the test program.  Guessing...)"
19386         fi
19387         ;;
19388 *)
19389         dflt="$charbits"
19390         ;;
19391 esac
19392 rp="What is the length of a character (in bits)?"
19393 . ./myread
19394 charbits="$ans"
19395 $rm_try
19396 case "$charbits" in
19397 8)      ;;
19398 *)      cat >&4 << EOM
19399 Your system has an unsigned character size of $charbits bits, which
19400 is rather unusual (normally it is 8 bits).  Perl likely will not work
19401 correctly on your system, with subtle bugs in various places.
19402 EOM
19403         rp='Do you really want to continue?'
19404         dflt='n'
19405         . ./myread
19406         case "$ans" in
19407                 [yY])   echo >&4 "Okay, continuing."    ;;
19408                 *)      exit 1                          ;;
19409         esac
19410 esac
19411
19412 : how do we concatenate cpp tokens here?
19413 echo " "
19414 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19415 $cat >cpp_stuff.c <<'EOCP'
19416 #define RCAT(a,b)a/**/b
19417 #define ACAT(a,b)a ## b
19418 RCAT(Rei,ser)
19419 ACAT(Cir,cus)
19420 EOCP
19421 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19422 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19423         echo "Oh!  Smells like ANSI's been here." >&4
19424         echo "We can catify or stringify, separately or together!"
19425         cpp_stuff=42
19426 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19427         echo "Ah, yes!  The good old days!" >&4
19428         echo "However, in the good old days we don't know how to stringify and"
19429         echo "catify at the same time."
19430         cpp_stuff=1
19431 else
19432         $cat >&4 <<EOM
19433 Hmm, I don't seem to be able to concatenate tokens with your cpp.
19434 You're going to have to edit the values of CAT[2-5] in config.h...
19435 EOM
19436         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19437 fi
19438 $rm -f cpp_stuff.*
19439
19440 : see if this is a db.h system
19441 set db.h i_db
19442 eval $inhdr
19443
19444 case "$i_db" in
19445 $define)
19446         : Check db version.
19447         echo " "
19448         echo "Checking Berkeley DB version ..." >&4
19449         $cat >try.c <<EOCP
19450 #$d_const HASCONST
19451 #ifndef HASCONST
19452 #define const
19453 #endif
19454 #include <sys/types.h>
19455 #include <stdio.h>
19456 #$i_stdlib I_STDLIB
19457 #ifdef I_STDLIB
19458 #include <stdlib.h>
19459 #endif
19460 #include <db.h>
19461 int main(int argc, char *argv[])
19462 {
19463 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19464     int Major, Minor, Patch ;
19465     unsigned long Version ;
19466     (void)db_version(&Major, &Minor, &Patch) ;
19467     if (argc == 2) {
19468         printf("%d %d %d %d %d %d\n",
19469                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19470                Major, Minor, Patch);
19471         exit(0);
19472     }
19473     printf("You have Berkeley DB Version 2 or greater.\n");
19474
19475     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19476                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19477     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19478                 Major, Minor, Patch) ;
19479
19480     /* check that db.h & libdb are compatible */
19481     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19482         printf("db.h and libdb are incompatible.\n") ;
19483         exit(3);
19484     }
19485
19486     printf("db.h and libdb are compatible.\n") ;
19487
19488     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19489                 + DB_VERSION_PATCH ;
19490
19491     /* needs to be >= 2.3.4 */
19492     if (Version < 2003004) {
19493     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19494         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19495         exit(2);
19496     }
19497
19498     exit(0);
19499 #else
19500 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19501     if (argc == 2) {
19502         printf("1 0 0\n");
19503         exit(0);
19504     }
19505     printf("You have Berkeley DB Version 1.\n");
19506     exit(0);    /* DB version < 2: the coast is clear. */
19507 #else
19508     exit(1);    /* <db.h> not Berkeley DB? */
19509 #endif
19510 #endif
19511 }
19512 EOCP
19513         set try
19514         if eval $compile_ok && $run ./try; then
19515                 echo 'Looks OK.' >&4
19516                 set `$run ./try 1`
19517                 db_version_major=$1
19518                 db_version_minor=$2
19519                 db_version_patch=$3
19520         else
19521                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19522                 i_db=$undef
19523                 case " $libs " in
19524                 *"-ldb "*)
19525                         : Remove db from list of libraries to use
19526                         echo "Removing unusable -ldb from library list" >&4
19527                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19528                         shift
19529                         libs="$*"
19530                         echo "libs = $libs" >&4
19531                         ;;
19532                 esac
19533         fi
19534         $rm_try
19535         ;;
19536 esac
19537
19538 case "$i_db" in
19539 define)
19540         : Check the return type needed for hash
19541         echo " "
19542         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19543         $cat >try.c <<EOCP
19544 #$d_const HASCONST
19545 #ifndef HASCONST
19546 #define const
19547 #endif
19548 #include <sys/types.h>
19549 #include <db.h>
19550
19551 #ifndef DB_VERSION_MAJOR
19552 u_int32_t hash_cb (ptr, size)
19553 const void *ptr;
19554 size_t size;
19555 {
19556 }
19557 HASHINFO info;
19558 int main()
19559 {
19560         info.hash = hash_cb;
19561 }
19562 #endif
19563 EOCP
19564         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19565                 if $contains warning try.out >>/dev/null 2>&1 ; then
19566                         db_hashtype='int'
19567                 else
19568                         db_hashtype='u_int32_t'
19569                 fi
19570         else
19571                 : XXX Maybe we should just give up here.
19572                 db_hashtype=u_int32_t
19573                 $cat try.out >&4
19574                 echo "Help:  I can't seem to compile the db test program." >&4
19575                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19576         fi
19577         $rm_try
19578         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19579         ;;
19580 *)      db_hashtype=u_int32_t
19581         ;;
19582 esac
19583 case "$i_db" in
19584 define)
19585         : Check the return type needed for prefix
19586         echo " "
19587         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19588         cat >try.c <<EOCP
19589 #$d_const HASCONST
19590 #ifndef HASCONST
19591 #define const
19592 #endif
19593 #include <sys/types.h>
19594 #include <db.h>
19595
19596 #ifndef DB_VERSION_MAJOR
19597 size_t prefix_cb (key1, key2)
19598 const DBT *key1;
19599 const DBT *key2;
19600 {
19601 }
19602 BTREEINFO info;
19603 int main()
19604 {
19605         info.prefix = prefix_cb;
19606 }
19607 #endif
19608 EOCP
19609         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19610                 if $contains warning try.out >>/dev/null 2>&1 ; then
19611                         db_prefixtype='int'
19612                 else
19613                         db_prefixtype='size_t'
19614                 fi
19615         else
19616                 db_prefixtype='size_t'
19617                 : XXX Maybe we should just give up here.
19618                 $cat try.out >&4
19619                 echo "Help:  I can't seem to compile the db test program." >&4
19620                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19621         fi
19622         $rm_try
19623         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19624         ;;
19625 *)      db_prefixtype='size_t'
19626         ;;
19627 esac
19628
19629 : How can we generate normalized random numbers ?
19630 echo " "
19631 echo "Using our internal random number implementation..." >&4
19632
19633 case "$ccflags" in
19634 *-Dmy_rand=*|*-Dmy_srand=*)
19635         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19636         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19637         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19638         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19639         ;;
19640 esac
19641
19642 randfunc=Perl_drand48
19643 drand01="Perl_drand48()"
19644 seedfunc="Perl_drand48_init"
19645 randbits=48
19646 randseedtype=U32
19647
19648 : Determine if this is an EBCDIC system
19649 echo " "
19650 echo "Determining whether or not we are on an EBCDIC system..." >&4
19651 $cat >try.c <<'EOM'
19652 int main()
19653 {
19654   if ('M'==0xd4) return 0;
19655   return 1;
19656 }
19657 EOM
19658
19659 val=$undef
19660 set try
19661 if eval $compile_ok; then
19662         if $run ./try; then
19663                 echo "You seem to speak EBCDIC." >&4
19664                 val="$define"
19665         else
19666                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19667         fi
19668 else
19669         echo "I'm unable to compile the test program." >&4
19670         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19671 fi
19672 $rm_try
19673 set ebcdic
19674 eval $setvar
19675
19676 : Check how to flush
19677 echo " "
19678 $cat >&4 <<EOM
19679 Checking how to flush all pending stdio output...
19680 EOM
19681 # I only know how to find the first 32 possibly open files on SunOS.
19682 # See also hints/sunos_4_1.sh and util.c  --AD
19683 case "$osname" in
19684 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19685 esac
19686 $cat >>try.c <<EOCP
19687 #include <stdio.h>
19688 #$i_stdlib I_STDLIB
19689 #ifdef I_STDLIB
19690 #include <stdlib.h>
19691 #endif
19692 #$i_unistd I_UNISTD
19693 #ifdef I_UNISTD
19694 # include <unistd.h>
19695 #endif
19696 #$d_sysconf HAS_SYSCONF
19697 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19698 #ifdef HAS_STDIO_STREAM_ARRAY
19699 # define STDIO_STREAM_ARRAY $stdio_stream_array
19700 #endif
19701 int main() {
19702   FILE* p;
19703   unlink("try.out");
19704   p = fopen("try.out", "w");
19705 #ifdef TRY_FPUTC
19706   fputc('x', p);
19707 #else
19708 # ifdef TRY_FPRINTF
19709   fprintf(p, "x");
19710 # endif
19711 #endif
19712 #ifdef TRY_FFLUSH_NULL
19713   fflush(NULL);
19714 #endif
19715 #ifdef TRY_FFLUSH_ALL
19716   {
19717     long open_max = -1;
19718 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19719     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19720 # else
19721 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19722     open_max = sysconf(_SC_OPEN_MAX);
19723 #  else
19724 #   ifdef FOPEN_MAX
19725     open_max = FOPEN_MAX;
19726 #   else
19727 #    ifdef OPEN_MAX
19728     open_max = OPEN_MAX;
19729 #    else
19730 #     ifdef _NFILE
19731     open_max = _NFILE;
19732 #     endif
19733 #    endif
19734 #   endif
19735 #  endif
19736 # endif
19737 # ifdef HAS_STDIO_STREAM_ARRAY
19738     if (open_max > 0) {
19739       long i;
19740       for (i = 0; i < open_max; i++)
19741             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19742                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19743                 STDIO_STREAM_ARRAY[i]._flag)
19744                 fflush(&STDIO_STREAM_ARRAY[i]);
19745     }
19746   }
19747 # endif
19748 #endif
19749   _exit(42);
19750 }
19751 EOCP
19752 : first we have to find out how _not_ to flush
19753 $to try.c
19754 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19755     output=''
19756     set try -DTRY_FPUTC
19757     if eval $compile; then
19758             $run ./try 2>/dev/null
19759             code="$?"
19760             $from try.out
19761             if $test ! -s try.out -a "X$code" = X42; then
19762                 output=-DTRY_FPUTC
19763             fi
19764     fi
19765     case "$output" in
19766     '')
19767             set try -DTRY_FPRINTF
19768             if eval $compile; then
19769                     $run ./try 2>/dev/null
19770                     code="$?"
19771                     $from try.out
19772                     if $test ! -s try.out -a "X$code" = X42; then
19773                         output=-DTRY_FPRINTF
19774                     fi
19775             fi
19776         ;;
19777     esac
19778 fi
19779 : check for fflush NULL behavior
19780 case "$fflushNULL" in
19781 '')     set try -DTRY_FFLUSH_NULL $output
19782         if eval $compile; then
19783                 $run ./try 2>/dev/null
19784                 code="$?"
19785                 $from try.out
19786                 if $test -s try.out -a "X$code" = X42; then
19787                         fflushNULL="`$cat try.out`"
19788                 else
19789                         if $test "X$code" != X42; then
19790                                 $cat >&4 <<EOM
19791 (If this test failed, don't worry, we'll try another method shortly.)
19792 EOM
19793                         fi
19794                 fi
19795         fi
19796         $rm -f core try.core core.try.*
19797         case "$fflushNULL" in
19798         x)      $cat >&4 <<EOM
19799 Your fflush(NULL) works okay for output streams.
19800 Let's see if it clobbers input pipes...
19801 EOM
19802 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19803 # bug that improperly flushes the input end of pipes.  So we avoid the
19804 # autoflush on fork/system/exec support for now. :-(
19805 $cat >tryp.c <<EOCP
19806 #include <stdio.h>
19807 int
19808 main(int argc, char **argv)
19809 {
19810     char buf[1024];
19811     int i;
19812     char *bp = buf;
19813     while (1) {
19814         while ((i = getc(stdin)) != -1
19815                && (*bp++ = i) != '\n'
19816                && bp < &buf[1024])
19817         /* DO NOTHING */ ;
19818         *bp = '\0';
19819         fprintf(stdout, "%s", buf);
19820         fflush(NULL);
19821         if (i == -1)
19822             return 0;
19823         bp = buf;
19824     }
19825 }
19826 EOCP
19827                 fflushNULL="$define"
19828                 set tryp
19829                 if eval $compile; then
19830                     $rm -f tryp.out
19831                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
19832                     if $test "X$targethost" != X; then
19833                         $to tryp.c
19834                         $to tryp
19835                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
19836                     else
19837                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
19838                     fi
19839                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19840                        $cat >&4 <<EOM
19841 fflush(NULL) seems to behave okay with input streams.
19842 EOM
19843                         fflushNULL="$define"
19844                     else
19845                         $cat >&4 <<EOM
19846 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19847 EOM
19848                         fflushNULL="$undef"
19849                     fi
19850                 fi
19851                 $rm -f core tryp.c tryp.core core.tryp.*
19852                 ;;
19853         '')     $cat >&4 <<EOM
19854 Your fflush(NULL) isn't working (contrary to ANSI C).
19855 EOM
19856                 fflushNULL="$undef"
19857                 ;;
19858         *)      $cat >&4 <<EOM
19859 Cannot figure out whether your fflush(NULL) works or not.
19860 I'm assuming it doesn't (contrary to ANSI C).
19861 EOM
19862                 fflushNULL="$undef"
19863                 ;;
19864         esac
19865         ;;
19866 $define|true|[yY]*)
19867         fflushNULL="$define"
19868         ;;
19869 *)
19870         fflushNULL="$undef"
19871         ;;
19872 esac
19873 : check explicit looping only if NULL did not work, and if the pipe
19874 : bug does not show up on an explicit flush too
19875 case "$fflushNULL" in
19876 "$undef")
19877         $cat >tryp.c <<EOCP
19878 #include <stdio.h>
19879 int
19880 main(int argc, char **argv)
19881 {
19882     char buf[1024];
19883     int i;
19884     char *bp = buf;
19885     while (1) {
19886         while ((i = getc(stdin)) != -1
19887                && (*bp++ = i) != '\n'
19888                && bp < &buf[1024])
19889         /* DO NOTHING */ ;
19890         *bp = '\0';
19891         fprintf(stdout, "%s", buf);
19892         fflush(stdin);
19893         if (i == -1)
19894             return 0;
19895         bp = buf;
19896     }
19897 }
19898 EOCP
19899         set tryp
19900         if eval $compile; then
19901             $rm -f tryp.out
19902             if $test "X$targethost" != X; then
19903                 $to tryp.c
19904                 $to tryp
19905                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
19906             else
19907                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
19908             fi
19909             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19910                $cat >&4 <<EOM
19911 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19912 EOM
19913                 : now check for fflushall behaviour
19914                 case "$fflushall" in
19915                 '')     set try -DTRY_FFLUSH_ALL $output
19916                         if eval $compile; then
19917                                 $cat >&4 <<EOM
19918 (Now testing the other method--but note that this also may fail.)
19919 EOM
19920                                 $run ./try 2>/dev/null
19921                                 code=$?
19922                                 $from try.out
19923                                 if $test -s try.out -a "X$code" = X42; then
19924                                         fflushall="`$cat try.out`"
19925                                 fi
19926                         fi
19927                         $rm_try
19928                         case "$fflushall" in
19929                         x)      $cat >&4 <<EOM
19930 Whew. Flushing explicitly all the stdio streams works.
19931 EOM
19932                                 fflushall="$define"
19933                                 ;;
19934                         '')     $cat >&4 <<EOM
19935 Sigh. Flushing explicitly all the stdio streams doesn't work.
19936 EOM
19937                                 fflushall="$undef"
19938                                 ;;
19939                         *)      $cat >&4 <<EOM
19940 Cannot figure out whether flushing stdio streams explicitly works or not.
19941 I'm assuming it doesn't.
19942 EOM
19943                                 fflushall="$undef"
19944                                 ;;
19945                         esac
19946                         ;;
19947                 "$define"|true|[yY]*)
19948                         fflushall="$define"
19949                         ;;
19950                 *)
19951                         fflushall="$undef"
19952                         ;;
19953                 esac
19954             else
19955                 $cat >&4 <<EOM
19956 All is futile.  Even fflush(stdin) clobbers input pipes!
19957 EOM
19958                 fflushall="$undef"
19959             fi
19960         else
19961             fflushall="$undef"
19962         fi
19963         $rm -f core tryp.c tryp.core core.tryp.*
19964         ;;
19965 *)      fflushall="$undef"
19966         ;;
19967 esac
19968
19969 case "$fflushNULL$fflushall" in
19970 undefundef)
19971         $cat <<EOM
19972 OK, I give up.  I cannot figure out how to flush pending stdio output.
19973 We won't be flushing handles at all before fork/exec/popen.
19974 EOM
19975         ;;
19976 esac
19977 $rm_try tryp
19978
19979 : Store the full pathname to the ar program for use in the C program
19980 : Respect a hint or command line value for full_ar.
19981 case "$full_ar" in
19982 '') full_ar=$ar ;;
19983 esac
19984
19985 : Store the full pathname to the sed program for use in the C program
19986 full_sed=$sed
19987
19988 : see what type gids are declared as in the kernel
19989 echo " "
19990 echo "Looking for the type for group ids returned by getgid()."
19991 set gid_t gidtype xxx stdio.h sys/types.h
19992 eval $typedef
19993 case "$gidtype" in
19994 xxx)
19995         xxx=`./findhdr sys/user.h`
19996         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19997         case $1 in
19998         unsigned) dflt="$1 $2" ;;
19999         *) dflt="$1" ;;
20000         esac
20001         ;;
20002 *) dflt="$gidtype";;
20003 esac
20004 case "$gidtype" in
20005 gid_t) echo "gid_t found." ;;
20006 *)      rp="What is the type for group ids returned by getgid()?"
20007         . ./myread
20008         gidtype="$ans"
20009         ;;
20010 esac
20011
20012 : Check the size of GID
20013 echo " "
20014 case "$gidtype" in
20015 *_t) zzz="$gidtype"     ;;
20016 *)   zzz="gid"          ;;
20017 esac
20018 echo "Checking the size of $zzz..." >&4
20019 cat > try.c <<EOCP
20020 #include <sys/types.h>
20021 #include <stdio.h>
20022 #$i_stdlib I_STDLIB
20023 #ifdef I_STDLIB
20024 #include <stdlib.h>
20025 #endif
20026 int main() {
20027     printf("%d\n", (int)sizeof($gidtype));
20028     exit(0);
20029 }
20030 EOCP
20031 set try
20032 if eval $compile_ok; then
20033         yyy=`$run ./try`
20034         case "$yyy" in
20035         '')     gidsize=4
20036                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
20037                 ;;
20038         *)      gidsize=$yyy
20039                 echo "Your $zzz is $gidsize bytes long."
20040                 ;;
20041         esac
20042 else
20043         gidsize=4
20044         echo "(I can't compile the test program--guessing $gidsize.)" >&4
20045 fi
20046
20047
20048 : Check if GID is signed
20049 echo " "
20050 case "$gidtype" in
20051 *_t) zzz="$gidtype"     ;;
20052 *)   zzz="gid"          ;;
20053 esac
20054 echo "Checking the sign of $zzz..." >&4
20055 cat > try.c <<EOCP
20056 #include <sys/types.h>
20057 #include <stdio.h>
20058 int main() {
20059         $gidtype foo = -1;
20060         if (foo < 0)
20061                 printf("-1\n");
20062         else
20063                 printf("1\n");
20064 }
20065 EOCP
20066 set try
20067 if eval $compile; then
20068         yyy=`$run ./try`
20069         case "$yyy" in
20070         '')     gidsign=1
20071                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20072                 ;;
20073         *)      gidsign=$yyy
20074                 case "$gidsign" in
20075                  1) echo "Your $zzz is unsigned." ;;
20076                 -1) echo "Your $zzz is signed."   ;;
20077                 esac
20078                 ;;
20079         esac
20080 else
20081         gidsign=1
20082         echo "(I can't compile the test program--guessing unsigned.)" >&4
20083 fi
20084
20085
20086 : Check 64bit sizes
20087 echo " "
20088
20089 if $test X"$quadtype" != X; then
20090
20091 echo "Checking how to print 64-bit integers..." >&4
20092
20093 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
20094         $cat >try.c <<'EOCP'
20095 #include <sys/types.h>
20096 #include <stdio.h>
20097 int main() {
20098   int q = 12345678901;
20099   printf("%ld\n", q);
20100 }
20101 EOCP
20102         set try
20103         if eval $compile; then
20104                 yyy=`$run ./try`
20105                 case "$yyy" in
20106                 12345678901)
20107                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
20108                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
20109                         echo "We will use %d."
20110                         ;;
20111                 esac
20112         fi
20113 fi
20114
20115 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
20116         $cat >try.c <<'EOCP'
20117 #include <sys/types.h>
20118 #include <stdio.h>
20119 int main() {
20120   long q = 12345678901;
20121   printf("%ld\n", q);
20122 }
20123 EOCP
20124         set try
20125         if eval $compile; then
20126                 yyy=`$run ./try`
20127                 case "$yyy" in
20128                 12345678901)
20129                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
20130                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
20131                         echo "We will use %ld."
20132                         ;;
20133                 esac
20134         fi
20135 fi
20136
20137 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
20138         $cat >try.c <<'EOCP'
20139 #include <sys/types.h>
20140 #include <inttypes.h>
20141 #include <stdio.h>
20142 int main() {
20143   int64_t q = 12345678901;
20144   printf("%" PRId64 "\n", q);
20145 }
20146 EOCP
20147         set try
20148         if eval $compile; then
20149                 yyy=`$run ./try`
20150                 case "$yyy" in
20151                 12345678901)
20152                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
20153                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
20154                         echo "We will use the C9X style."
20155                         ;;
20156                 esac
20157         fi
20158 fi
20159
20160 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20161         $cat >try.c <<EOCP
20162 #include <sys/types.h>
20163 #include <stdio.h>
20164 int main() {
20165   $quadtype q = 12345678901;
20166   printf("%Ld\n", q);
20167 }
20168 EOCP
20169         set try
20170         if eval $compile; then
20171                 yyy=`$run ./try`
20172                 case "$yyy" in
20173                 12345678901)
20174                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
20175                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
20176                         echo "We will use %Ld."
20177                         ;;
20178                 esac
20179         fi
20180 fi
20181
20182 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
20183         $cat >try.c <<'EOCP'
20184 #include <sys/types.h>
20185 #include <stdio.h>
20186 int main() {
20187   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
20188   printf("%lld\n", q);
20189 }
20190 EOCP
20191         set try
20192         if eval $compile; then
20193                 yyy=`$run ./try`
20194                 case "$yyy" in
20195                 12345678901)
20196                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
20197                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
20198                         echo "We will use the %lld style."
20199                         ;;
20200                 esac
20201         fi
20202 fi
20203
20204 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20205         $cat >try.c <<EOCP
20206 #include <sys/types.h>
20207 #include <stdio.h>
20208 int main() {
20209   $quadtype q = 12345678901;
20210   printf("%qd\n", q);
20211 }
20212 EOCP
20213         set try
20214         if eval $compile; then
20215                 yyy=`$run ./try`
20216                 case "$yyy" in
20217                 12345678901)
20218                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
20219                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
20220                         echo "We will use %qd."
20221                         ;;
20222                 esac
20223         fi
20224 fi
20225
20226 if $test X"$sPRId64" = X; then
20227         echo "Cannot figure out how to print 64-bit integers." >&4
20228 fi
20229 $rm_try
20230
20231 fi
20232
20233 case "$sPRId64" in
20234 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
20235         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
20236         ;;
20237 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
20238         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
20239         ;;
20240 esac
20241
20242 : Check format strings for internal types
20243 echo " "
20244 $echo "Checking the format strings to be used for Perl's internal types..." >&4
20245
20246 if $test X"$ivsize" = X8; then
20247         ivdformat="$sPRId64"
20248         uvuformat="$sPRIu64"
20249         uvoformat="$sPRIo64"
20250         uvxformat="$sPRIx64"
20251         uvXUformat="$sPRIXU64"
20252 else
20253         if $test X"$ivsize" = X"$longsize"; then
20254                 ivdformat='"ld"'
20255                 uvuformat='"lu"'
20256                 uvoformat='"lo"'
20257                 uvxformat='"lx"'
20258                 uvXUformat='"lX"'
20259         else
20260                 if $test X"$ivsize" = X"$intsize"; then
20261                         ivdformat='"d"'
20262                         uvuformat='"u"'
20263                         uvoformat='"o"'
20264                         uvxformat='"x"'
20265                         uvXUformat='"X"'
20266                 else
20267                         : far out
20268                         if $test X"$ivsize" = X"$shortsize"; then
20269                                 ivdformat='"hd"'
20270                                 uvuformat='"hu"'
20271                                 uvoformat='"ho"'
20272                                 uvxformat='"hx"'
20273                                 uvXUformat='"hX"'
20274                         fi
20275                 fi
20276         fi
20277 fi
20278
20279 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
20280         nveformat="$sPRIeldbl"
20281         nvfformat="$sPRIfldbl"
20282         nvgformat="$sPRIgldbl"
20283         nvEUformat="$sPRIEUldbl"
20284         nvFUformat="$sPRIFUldbl"
20285         nvGUformat="$sPRIGUldbl"
20286 else
20287         nveformat='"e"'
20288         nvfformat='"f"'
20289         nvgformat='"g"'
20290         nvEUformat='"E"'
20291         nvFUformat='"F"'
20292         nvGUformat='"G"'
20293 fi
20294
20295 case "$ivdformat" in
20296 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
20297     exit 1
20298     ;;
20299 esac
20300
20301 : Check format string for GID
20302
20303 echo " "
20304 $echo "Checking the format string to be used for gids..." >&4
20305
20306 case "$gidsign" in
20307 -1)     if $test X"$gidsize" = X"$ivsize"; then
20308                 gidformat="$ivdformat"
20309         else
20310                 if $test X"$gidsize" = X"$longsize"; then
20311                         gidformat='"ld"'
20312                 else
20313                         if $test X"$gidsize" = X"$intsize"; then
20314                                 gidformat='"d"'
20315                         else
20316                                 if $test X"$gidsize" = X"$shortsize"; then
20317                                         gidformat='"hd"'
20318                                 fi
20319                         fi
20320                 fi
20321         fi
20322         ;;
20323 *)      if $test X"$gidsize" = X"$uvsize"; then
20324                 gidformat="$uvuformat"
20325         else
20326                 if $test X"$gidsize" = X"$longsize"; then
20327                         gidformat='"lu"'
20328                 else
20329                         if $test X"$gidsize" = X"$intsize"; then
20330                                 gidformat='"u"'
20331                         else
20332                                 if $test X"$gidsize" = X"$shortsize"; then
20333                                         gidformat='"hu"'
20334                                 fi
20335                         fi
20336                 fi
20337         fi
20338         ;;
20339 esac
20340
20341 : see if getgroups exists
20342 set getgroups d_getgrps
20343 eval $inlibc
20344
20345 : see if setgroups exists
20346 set setgroups d_setgrps
20347 eval $inlibc
20348
20349 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20350 echo " "
20351 case "$d_getgrps$d_setgrps" in
20352 *define*)
20353         case "$groupstype" in
20354         '') dflt="$gidtype" ;;
20355         *)  dflt="$groupstype" ;;
20356         esac
20357         $cat <<EOM
20358 What type of pointer is the second argument to getgroups() and setgroups()?
20359 Usually this is the same as group ids, $gidtype, but not always.
20360
20361 EOM
20362         rp='What type pointer is the second argument to getgroups() and setgroups()?'
20363         . ./myread
20364         groupstype="$ans"
20365         ;;
20366 *)  groupstype="$gidtype";;
20367 esac
20368
20369 : MAD = Misc Attribute Definition
20370
20371 if $test $patchlevel -lt 9; then
20372 : MAD is not available in 5.8.x or earlier.
20373     ans=n;
20374 else
20375     case "$mad" in
20376     $define|true|[yY]*) dflt='y' ;;
20377     *)                  dflt='n' ;;
20378     esac
20379     cat <<EOM
20380
20381 Would you like to build with Misc Attribute Decoration? This is development
20382 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20383 overhead on the interpreter.
20384
20385 If this doesn't make any sense to you, just accept the default '$dflt'.
20386 EOM
20387     rp='Build Perl with MAD?'
20388     . ./myread
20389 fi
20390 case "$ans" in
20391 y|Y)    val="$define"
20392         madlyh='madly.h madly.act madly.tab'
20393         madlysrc='madly.c'
20394         madlyobj="madly$_o" ;;
20395 *)      val="$undef"
20396         madlyh=''
20397         madlysrc=''
20398         madlyobj='' ;;
20399 esac
20400 set mad
20401 eval $setvar
20402
20403 : check whether make sets MAKE
20404 echo " "
20405 echo "Checking if your $make program sets \$(MAKE)..." >&4
20406 case "$make_set_make" in
20407 '')
20408         $sed 's/^X //' > testmake.mak << 'EOF'
20409 Xall:
20410 X       @echo 'maketemp="$(MAKE)"'
20411 EOF
20412         case "`$make -f testmake.mak 2>/dev/null`" in
20413         *maketemp=*) make_set_make='#' ;;
20414         *)      make_set_make="MAKE=$make" ;;
20415         esac
20416         $rm -f testmake.mak
20417         ;;
20418 esac
20419 case "$make_set_make" in
20420 '#') echo "Yup, it does.";;
20421 *) echo "Nope, it doesn't.";;
20422 esac
20423
20424 : see what type is used for mode_t
20425 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20426 set mode_t modetype int stdio.h sys/types.h
20427 eval $typedef_ask
20428
20429 : see if we need va_copy
20430 echo " "
20431 case "$i_stdarg" in
20432 "$define")
20433         $cat >try.c <<EOCP
20434 #include <stdarg.h>
20435 #include <stdio.h>
20436 #$i_stdlib I_STDLIB
20437 #ifdef I_STDLIB
20438 #include <stdlib.h>
20439 #endif
20440 #include <signal.h>
20441
20442 int
20443 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20444 {
20445   return vfprintf(f, fmt, *valp);
20446 }
20447
20448 int
20449 myvfprintf(FILE *f, const  char *fmt, va_list val)
20450 {
20451   return ivfprintf(f, fmt, &val);
20452 }
20453
20454 int
20455 myprintf(char *fmt, ...)
20456 {
20457   va_list val;
20458   va_start(val, fmt);
20459   return myvfprintf(stdout, fmt, val);
20460 }
20461
20462 int
20463 main(int ac, char **av)
20464 {
20465   signal(SIGSEGV, exit);
20466
20467   myprintf("%s%cs all right, then\n", "that", '\'');
20468   exit(0);
20469 }
20470 EOCP
20471         set try
20472         if eval $compile && $run ./try 2>&1 >/dev/null; then
20473                 case "`$run ./try`" in
20474                 "that's all right, then")
20475                         okay=yes
20476                         ;;
20477                 esac
20478         fi
20479         case "$okay" in
20480         yes)    echo "It seems that you don't need va_copy()." >&4
20481                 need_va_copy="$undef"
20482                 ;;
20483         *)      echo "It seems that va_copy() or similar will be needed." >&4
20484                 need_va_copy="$define"
20485                 ;;
20486         esac
20487         $rm_try
20488         ;;
20489 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20490         need_va_copy="$undef"
20491         ;;
20492 esac
20493
20494 : see what type is used for size_t
20495 rp="What is the type used for the length parameter for string functions?"
20496 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20497 eval $typedef_ask
20498
20499 : check for type of arguments to gethostbyaddr. 
20500 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20501         case "$d_gethbyaddr" in
20502         $define)
20503                 $cat <<EOM
20504
20505 Checking to see what type of arguments are accepted by gethostbyaddr().
20506 EOM
20507                 hdrs="$define sys/types.h
20508                         $d_socket sys/socket.h 
20509                         $i_niin netinet/in.h 
20510                         $i_netdb netdb.h
20511                         $i_unistd unistd.h"
20512                 : The first arg can 'char *' or 'void *'
20513                 : The second arg is some of integral type
20514                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20515                         for yyy in size_t long int; do
20516                                 case "$netdb_host_type" in
20517                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20518                                         if ./protochk "$try" $hdrs; then
20519                                                 echo "Your system accepts $xxx for the first arg."
20520                                                 echo "...and $yyy for the second arg."
20521                                                 netdb_host_type="$xxx"
20522                                                 netdb_hlen_type="$yyy"
20523                                         fi
20524                                         ;;
20525                                 esac
20526                         done
20527                 done
20528                 : In case none of those worked, prompt the user.
20529                 case "$netdb_host_type" in
20530                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20531                         dflt='char *'
20532                         . ./myread
20533                         netdb_host_type=$ans
20534                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20535                         dflt="$sizetype"
20536                         . ./myread
20537                         netdb_hlen_type=$ans
20538                         ;;
20539                 esac
20540                 ;;
20541         *)      : no gethostbyaddr, so pick harmless defaults
20542                 netdb_host_type='char *'
20543                 netdb_hlen_type="$sizetype"
20544                 ;;
20545         esac
20546         # Remove the "const" if needed. -- but then we'll have a 
20547         # prototype clash!
20548         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20549 fi
20550
20551 : check for type of argument to gethostbyname. 
20552 if test "X$netdb_name_type" = X ; then
20553         case "$d_gethbyname" in
20554         $define)
20555                 $cat <<EOM
20556
20557 Checking to see what type of argument is accepted by gethostbyname().
20558 EOM
20559                 hdrs="$define sys/types.h
20560                         $d_socket sys/socket.h 
20561                         $i_niin netinet/in.h 
20562                         $i_netdb netdb.h
20563                         $i_unistd unistd.h"
20564                 for xxx in "const char *" "char *"; do
20565                         case "$netdb_name_type" in
20566                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20567                                 if ./protochk "$try" $hdrs; then
20568                                         echo "Your system accepts $xxx."
20569                                         netdb_name_type="$xxx"
20570                                 fi
20571                                 ;;
20572                         esac
20573                 done
20574                 : In case none of those worked, prompt the user.
20575                 case "$netdb_name_type" in
20576                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20577                         dflt='char *'
20578                         . ./myread
20579                         netdb_name_type=$ans
20580                         ;;
20581                 esac
20582                 ;;
20583         *)      : no gethostbyname, so pick harmless default
20584                 netdb_name_type='char *'
20585                 ;;
20586         esac
20587 fi
20588
20589 : check for type of 1st argument to getnetbyaddr. 
20590 if test "X$netdb_net_type" = X ; then
20591         case "$d_getnbyaddr" in
20592         $define)
20593                 $cat <<EOM
20594
20595 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20596 EOM
20597                 hdrs="$define sys/types.h
20598                         $d_socket sys/socket.h 
20599                         $i_niin netinet/in.h 
20600                         $i_netdb netdb.h
20601                         $i_unistd unistd.h"
20602                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20603                         case "$netdb_net_type" in
20604                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20605                                 if ./protochk "$try" $hdrs; then
20606                                         echo "Your system accepts $xxx."
20607                                         netdb_net_type="$xxx"
20608                                 fi
20609                                 ;;
20610                         esac
20611                 done
20612                 : In case none of those worked, prompt the user.
20613                 case "$netdb_net_type" in
20614                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20615                         dflt='long'
20616                         . ./myread
20617                         netdb_net_type=$ans
20618                         ;;
20619                 esac
20620                 ;;
20621         *)      : no getnetbyaddr, so pick harmless default
20622                 netdb_net_type='long'
20623                 ;;
20624         esac
20625 fi
20626 : locate the preferred pager for this system
20627 fn=f/
20628 case "$pager" in
20629 '')
20630         dflt=''
20631         case "$pg" in
20632         /*) dflt=$pg;;
20633         [a-zA-Z]:/*) dflt=$pg;;
20634         esac
20635         case "$more" in
20636         /*) dflt=$more;;
20637         [a-zA-Z]:/*) dflt=$more;;
20638         esac
20639         case "$less" in
20640         /*) dflt=$less;;
20641         [a-zA-Z]:/*) dflt=$less;;
20642         esac
20643         case "$dflt" in
20644         '') dflt=/usr/ucb/more;;
20645         esac
20646         ;;
20647 *)      dflt="$pager"
20648         ;;
20649 esac
20650 fn="f/($dflt)"
20651 echo " "
20652 rp='What pager is used on your system?'
20653 . ./getfile
20654 pager="$ans"
20655
20656 : see what type pids are declared as in the kernel
20657 rp="What is the type of process ids on this system?"
20658 set pid_t pidtype int stdio.h sys/types.h
20659 eval $typedef_ask
20660
20661 : see if ar generates random libraries by itself
20662 echo " "
20663 echo "Checking how to generate random libraries on your machine..." >&4
20664 echo 'int bar1() { return bar2(); }' > bar1.c
20665 echo 'int bar2() { return 2; }' > bar2.c
20666 $cat > foo.c <<EOP
20667 #$i_stdlib I_STDLIB
20668 #ifdef I_STDLIB
20669 #include <stdlib.h>
20670 #endif
20671 int main() { printf("%d\n", bar1()); exit(0); }
20672 EOP
20673 $cc $ccflags -c bar1.c >/dev/null 2>&1
20674 $cc $ccflags -c bar2.c >/dev/null 2>&1
20675 $cc $ccflags -c foo.c >/dev/null 2>&1
20676 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20677 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20678         $run ./foobar >/dev/null 2>&1; then
20679         echo "$ar appears to generate random libraries itself."
20680         orderlib=false
20681         if [ "X$ranlib" = "X" ]; then
20682             ranlib=":"
20683         fi
20684 elif $ar s bar$_a >/dev/null 2>&1 &&
20685         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20686         $run ./foobar >/dev/null 2>&1; then
20687                 echo "a table of contents needs to be added with '$ar s'."
20688                 orderlib=false
20689                 ranlib="$ar s"
20690 elif $ar ts bar$_a >/dev/null 2>&1 &&
20691         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20692         $run ./foobar >/dev/null 2>&1; then
20693                 echo "a table of contents needs to be added with '$ar ts'."
20694                 orderlib=false
20695                 ranlib="$ar ts"
20696 else
20697         case "$ranlib" in
20698         :) ranlib='';;
20699         '')
20700                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20701                 $test -f $ranlib || ranlib=''
20702                 ;;
20703         esac
20704         if $test -n "$ranlib"; then
20705                 echo "your system has '$ranlib'; we'll use that."
20706                 orderlib=false
20707         else
20708                 echo "your system doesn't seem to support random libraries"
20709                 echo "so we'll use lorder and tsort to order the libraries."
20710                 orderlib=true
20711                 ranlib=":"
20712         fi
20713 fi
20714 $rm -f foo* bar*
20715
20716 : see if this is a values.h system
20717 set values.h i_values
20718 eval $inhdr
20719
20720 : Check the max offset that gmtime and localtime accept
20721 echo "Checking max offsets that gmtime () accepts"
20722
20723 case $i_values in
20724     define) yyy="#include <values.h>" ;;
20725     *)      yyy="" ;;
20726     esac
20727
20728 case "$sGMTIME_min/$sGMTIME_max" in
20729     0/0|/)
20730         $cat >try.c <<EOCP
20731 #include <sys/types.h>
20732 #include <stdio.h>
20733 #include <time.h>
20734 $yyy
20735
20736 int i;
20737 struct tm *tmp;
20738 time_t pt;
20739
20740 void gm_check (time_t t, int min_year, int max_year)
20741 {
20742     tmp = gmtime (&t);
20743     if ( tmp == NULL ||
20744         /* Check tm_year overflow */
20745          tmp->tm_year < min_year || tmp->tm_year > max_year)
20746         tmp = NULL;
20747     else
20748         pt = t;
20749     } /* gm_check */
20750
20751 int check_max ()
20752 {
20753     tmp = NULL;
20754     pt  = 0;
20755 #ifdef MAXLONG
20756     gm_check (MAXLONG, 69, 0x7fffffff);
20757 #endif
20758     if (tmp == NULL || tmp->tm_year < 0) {
20759         for (i = 63; i >= 0; i--) {
20760             time_t x = pt | ((time_t)1 << i);
20761             if (x < 0 || x < pt) continue;
20762             gm_check (x, 69, 0x7fffffff);
20763             }
20764         }
20765     printf ("sGMTIME_max=%ld\n", pt);
20766     return (0);
20767     } /* check_max */
20768
20769 int check_min ()
20770 {
20771     tmp = NULL;
20772     pt  = 0;
20773 #ifdef MINLONG
20774     gm_check (MINLONG, -1900, 70);
20775 #endif
20776     if (tmp == NULL) {
20777         for (i = 36; i >= 0; i--) {
20778             time_t x = pt - ((time_t)1 << i);
20779             if (x > 0) continue;
20780             gm_check (x, -1900, 70);
20781             }
20782         }
20783     printf ("sGMTIME_min=%ld\n", pt);
20784     return (0);
20785     } /* check_min */
20786
20787 int main (int argc, char *argv[])
20788 {
20789     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20790     check_max ();
20791     check_min ();
20792     return (0);
20793     } /* main */
20794 EOCP
20795         set try
20796         if eval $compile; then
20797             eval `$run ./try`
20798         else
20799             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20800             fi
20801         $rm_try
20802         ;;
20803     esac
20804
20805 echo "Checking max offsets that localtime () accepts"
20806
20807 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20808     0/0|/)
20809         $cat >try.c <<EOCP
20810 #include <sys/types.h>
20811 #include <stdio.h>
20812 #include <time.h>
20813 $yyy
20814
20815 int i;
20816 struct tm *tmp;
20817 time_t pt;
20818
20819 void local_check (time_t t, int min_year, int max_year)
20820 {
20821     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20822         tmp = NULL;
20823     else
20824         tmp = localtime (&t);
20825     if ( tmp == NULL ||
20826         /* Check tm_year overflow */
20827          tmp->tm_year < min_year || tmp->tm_year > max_year)
20828         tmp = NULL;
20829     else
20830         pt = t;
20831     } /* local_check */
20832
20833 int check_max ()
20834 {
20835     tmp = NULL;
20836     pt  = 0;
20837 #ifdef MAXLONG
20838     local_check (MAXLONG, 69, 0x7fffffff);
20839 #endif
20840     if (tmp == NULL || tmp->tm_year < 0) {
20841         for (i = 63; i >= 0; i--) {
20842             time_t x = pt | ((time_t)1 << i);
20843             if (x < 0 || x < pt) continue;
20844             local_check (x, 69, 0x7fffffff);
20845             }
20846         }
20847     printf ("sLOCALTIME_max=%ld\n", pt);
20848     return (0);
20849    } /* check_max */
20850
20851 int check_min ()
20852 {
20853     tmp = NULL;
20854     pt  = 0;
20855 #ifdef MINLONG
20856     local_check (MINLONG, -1900, 70);
20857 #endif
20858     if (tmp == NULL) {
20859         for (i = 36; i >= 0; i--) {
20860             time_t x = pt - ((time_t)1 << i);
20861             if (x > 0) continue;
20862             local_check (x, -1900, 70);
20863             }
20864         }
20865     printf ("sLOCALTIME_min=%ld\n", pt);
20866     return (0);
20867     } /* check_min */
20868
20869 int main (int argc, char *argv[])
20870 {
20871     check_max ();
20872     check_min ();
20873     return (0);
20874     } /* main */
20875 EOCP
20876         set try
20877         if eval $compile; then
20878             eval `$run ./try`
20879         else
20880             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20881             fi
20882         $rm_try
20883         ;;
20884     esac
20885
20886 : check for type of arguments to select.
20887 case "$selecttype" in
20888 '') case "$d_select" in
20889         $define)
20890                 echo " "
20891                 $cat <<EOM
20892 Checking to see what type of arguments are accepted by select().
20893 EOM
20894                 hdrs="$define sys/types.h
20895                         $i_systime sys/time.h
20896                         $i_sysselct sys/select.h
20897                         $d_socket sys/socket.h"
20898                 : The first arg can be int, unsigned, or size_t
20899                 : The last arg may or may not be 'const'
20900                 val=''
20901                 : void pointer has been seen but using that
20902                 : breaks the selectminbits test
20903                 for xxx in 'fd_set *' 'int *'; do
20904                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20905                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20906                                         case "$val" in
20907                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20908                                                 if ./protochk "$try" $hdrs; then
20909                                                         echo "Your system accepts $xxx."
20910                                                         val="$xxx"
20911                                                 fi
20912                                                 ;;
20913                                         esac
20914                                 done
20915                         done
20916                 done
20917                 case "$val" in
20918                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20919                         case "$d_fd_set" in
20920                                 $define) dflt="fd_set *" ;;
20921                                 *)              dflt="int *" ;;
20922                         esac
20923                         . ./myread
20924                         val=$ans
20925                         ;;
20926                 esac
20927                 selecttype="$val"
20928                 ;;
20929         *)      : no select, so pick a harmless default
20930                 selecttype='int *'
20931                 ;;
20932         esac
20933         ;;
20934 esac
20935
20936 : check for the select 'width'
20937 case "$selectminbits" in
20938 '') safebits=`expr $ptrsize \* 8`
20939     case "$d_select" in
20940         $define)
20941                 $cat <<EOM
20942
20943 Checking to see on how many bits at a time your select() operates...
20944 EOM
20945                 $cat >try.c <<EOCP
20946 #include <sys/types.h>
20947 #$i_time I_TIME
20948 #$i_systime I_SYS_TIME
20949 #$i_systimek I_SYS_TIME_KERNEL
20950 #ifdef I_TIME
20951 #   include <time.h>
20952 #endif
20953 #ifdef I_SYS_TIME
20954 #   ifdef I_SYS_TIME_KERNEL
20955 #       define KERNEL
20956 #   endif
20957 #   include <sys/time.h>
20958 #   ifdef I_SYS_TIME_KERNEL
20959 #       undef KERNEL
20960 #   endif
20961 #endif
20962 #$i_sysselct I_SYS_SELECT
20963 #ifdef I_SYS_SELECT
20964 #include <sys/select.h>
20965 #endif
20966 #$d_socket HAS_SOCKET
20967 #ifdef HAS_SOCKET
20968 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20969 #endif
20970 #include <stdio.h>
20971 #$i_stdlib I_STDLIB
20972 #ifdef I_STDLIB
20973 #include <stdlib.h>
20974 #endif
20975 $selecttype b;
20976 #define S sizeof(*(b))
20977 #define MINBITS 64
20978 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20979 #define NBITS  (NBYTES * 8)
20980 int main() {
20981     char *s = (char *)malloc(NBYTES);
20982     struct timeval t;
20983     int i;
20984     FILE* fp;
20985     int fd;
20986
20987     if (!s)
20988         exit(1);
20989     fclose(stdin);
20990     fp = fopen("try.c", "r");
20991     if (fp == 0)
20992       exit(2);
20993     fd = fileno(fp);
20994     if (fd < 0)
20995       exit(3);
20996     b = ($selecttype)s;
20997     for (i = 0; i < NBITS; i++)
20998         FD_SET(i, b);
20999     t.tv_sec  = 0;
21000     t.tv_usec = 0;
21001     select(fd + 1, b, 0, 0, &t);
21002     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
21003     free(s);
21004     printf("%d\n", i + 1);
21005     return 0;
21006 }
21007 EOCP
21008                 set try
21009                 if eval $compile_ok; then
21010                         selectminbits=`$run ./try`
21011                         case "$selectminbits" in
21012                         '')     cat >&4 <<EOM
21013 Cannot figure out on how many bits at a time your select() operates.
21014 I'll play safe and guess it is $safebits bits.
21015 EOM
21016                                 selectminbits=$safebits
21017                                 bits="$safebits bits"
21018                                 ;;
21019                         1)      bits="1 bit" ;;
21020                         *)      bits="$selectminbits bits" ;;
21021                         esac
21022                         echo "Your select() operates on $bits at a time." >&4
21023                 else
21024                         rp='What is the minimum number of bits your select() operates on?'
21025                         case "$byteorder" in
21026                         12345678)       dflt=64 ;;
21027                         1234)           dflt=32 ;;
21028                         *)              dflt=1  ;;
21029                         esac
21030                         . ./myread
21031                         val=$ans
21032                         selectminbits="$val"
21033                 fi
21034                 $rm_try
21035                 ;;
21036         *)      : no select, so pick a harmless default
21037                 selectminbits=$safebits
21038                 ;;
21039         esac
21040         ;;
21041 esac
21042
21043 : Trace out the files included by signal.h, then look for SIGxxx names.
21044 if [ "X$fieldn" = X ]; then
21045         : Just make some guesses.  We check them later.
21046         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
21047 else
21048         xxx=`echo '#include <signal.h>' |
21049         $cppstdin $cppminus $cppflags 2>/dev/null |
21050         $grep '^[       ]*#.*include' |
21051         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
21052                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
21053 fi
21054 xxxfiles=''
21055 for xx in $xxx /dev/null ; do
21056         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
21057 done
21058 case "$xxxfiles" in
21059 '')     xxxfiles=`./findhdr signal.h` ;;
21060 esac
21061 xxx=`awk '
21062 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
21063         print substr($2, 4, 20)
21064 }
21065 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
21066         print substr($3, 4, 20)
21067 }' $xxxfiles`
21068 : Append some common names just in case the awk scan failed.
21069 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
21070 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
21071 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
21072 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
21073 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
21074
21075 : generate a few handy files for later
21076 $cat > signal.c <<EOCP
21077 #include <sys/types.h>
21078 #include <signal.h>
21079 #$i_stdlib I_STDLIB
21080 #ifdef I_STDLIB
21081 #include <stdlib.h>
21082 #endif
21083 #include <stdio.h>
21084 int main() {
21085
21086 /* Strange style to avoid deeply-nested #if/#else/#endif */
21087 #ifndef NSIG
21088 #  ifdef _NSIG
21089 #    define NSIG (_NSIG)
21090 #  endif
21091 #endif
21092
21093 #ifndef NSIG
21094 #  ifdef SIGMAX
21095 #    define NSIG (SIGMAX+1)
21096 #  endif
21097 #endif
21098
21099 #ifndef NSIG
21100 #  ifdef SIG_MAX
21101 #    define NSIG (SIG_MAX+1)
21102 #  endif
21103 #endif
21104
21105 #ifndef NSIG
21106 #  ifdef _SIG_MAX
21107 #    define NSIG (_SIG_MAX+1)
21108 #  endif
21109 #endif
21110
21111 #ifndef NSIG
21112 #  ifdef MAXSIG
21113 #    define NSIG (MAXSIG+1)
21114 #  endif
21115 #endif
21116
21117 #ifndef NSIG
21118 #  ifdef MAX_SIG
21119 #    define NSIG (MAX_SIG+1)
21120 #  endif
21121 #endif
21122
21123 #ifndef NSIG
21124 #  ifdef SIGARRAYSIZE
21125 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
21126 #  endif
21127 #endif
21128
21129 #ifndef NSIG
21130 #  ifdef _sys_nsig
21131 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
21132 #  endif
21133 #endif
21134
21135 /* Default to some arbitrary number that's big enough to get most
21136    of the common signals.
21137 */
21138 #ifndef NSIG
21139 #    define NSIG 50
21140 #endif
21141
21142 printf("NSIG %d\n", NSIG);
21143
21144 #ifndef JUST_NSIG
21145
21146 EOCP
21147
21148 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
21149 {
21150         printf "#ifdef SIG"; printf $1; printf "\n"
21151         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
21152         printf $1; printf ");\n"
21153         printf "#endif\n"
21154 }
21155 END {
21156         printf "#endif /* JUST_NSIG */\n";
21157         printf "exit(0);\n}\n";
21158 }
21159 ' >>signal.c
21160 $cat >signal.awk <<'EOP'
21161 BEGIN { ndups = 0 }
21162 $1 ~ /^NSIG$/ { nsig = $2 }
21163 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
21164     if ($2 > maxsig) { maxsig = $2 }
21165     if (sig_name[$2]) {
21166         dup_name[ndups] = $1
21167         dup_num[ndups] = $2
21168         ndups++
21169     }
21170     else {
21171         sig_name[$2] = $1
21172         sig_num[$2] = $2
21173     }
21174 }
21175 END {
21176     if (nsig == 0) {
21177         nsig = maxsig + 1
21178     }
21179     printf("NSIG %d\n", nsig);
21180     for (n = 1; n < nsig; n++) {
21181         if (sig_name[n]) {
21182             printf("%s %d\n", sig_name[n], sig_num[n])
21183         }
21184         else {
21185             printf("NUM%d %d\n", n, n)
21186         }
21187     }
21188     for (n = 0; n < ndups; n++) {
21189         printf("%s %d\n", dup_name[n], dup_num[n])
21190     }
21191 }
21192 EOP
21193 $cat >signal_cmd <<EOS
21194 $startsh
21195 if $test -s signal.lst; then
21196     echo "Using your existing signal.lst file"
21197         exit 0
21198 fi
21199 xxx="$xxx"
21200 EOS
21201 $cat >>signal_cmd <<'EOS'
21202
21203 set signal
21204 if eval $compile_ok; then
21205         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
21206                 $uniq | $awk -f signal.awk >signal.lst
21207 else
21208         echo "(I can't seem be able to compile the whole test program)" >&4
21209         echo "(I'll try it in little pieces.)" >&4
21210         set signal -DJUST_NSIG
21211         if eval $compile_ok; then
21212                 $run ./signal$_exe > signal.nsg
21213                 $cat signal.nsg
21214         else
21215                 echo "I can't seem to figure out how many signals you have." >&4
21216                 echo "Guessing 50." >&4
21217                 echo 'NSIG 50' > signal.nsg
21218         fi
21219         : Now look at all the signal names, one at a time.
21220         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
21221                 $cat > signal.c <<EOCP
21222 #include <sys/types.h>
21223 #include <signal.h>
21224 #include <stdio.h>
21225 int main() {
21226 printf("$xx %d\n", SIG${xx});
21227 return 0;
21228 }
21229 EOCP
21230                 set signal
21231                 if eval $compile; then
21232                         echo "SIG${xx} found."
21233                         $run ./signal$_exe  >> signal.ls1
21234                 else
21235                         echo "SIG${xx} NOT found."
21236                 fi
21237         done
21238         if $test -s signal.ls1; then
21239                 $cat signal.nsg signal.ls1 |
21240                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
21241         fi
21242
21243 fi
21244 if $test -s signal.lst; then
21245         :
21246 else
21247         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
21248         echo 'kill -l' >signal
21249         set X `csh -f <signal`
21250         $rm -f signal
21251         shift
21252         case $# in
21253         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
21254         esac
21255         echo $@ | $tr ' ' $trnl | \
21256             $awk '{ printf "%s %d\n", $1, ++s; }
21257                   END { printf "NSIG %d\n", ++s }' >signal.lst
21258 fi
21259 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
21260 EOS
21261 chmod a+x signal_cmd
21262 $eunicefix signal_cmd
21263
21264 : generate list of signal names
21265 echo " "
21266 case "$sig_name_init" in
21267 '') doinit=yes ;;
21268 *)  case "$sig_num_init" in
21269     ''|*,*) doinit=yes ;;
21270     esac ;;
21271 esac
21272 case "$doinit" in
21273 yes)
21274         echo "Generating a list of signal names and numbers..." >&4
21275         . ./signal_cmd
21276         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21277         sig_name=`$awk 'BEGIN { printf "ZERO " }
21278                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
21279         sig_num=`$awk  'BEGIN { printf "0 " }
21280                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
21281         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
21282                              !/^NSIG/   { printf "\"%s\", ", $1 }
21283                              END        { printf "0\n" }' signal.lst`
21284         sig_num_init=`$awk  'BEGIN      { printf "0, " }
21285                              !/^NSIG/   { printf "%d, ", $2}
21286                              END        { printf "0\n"}' signal.lst`
21287         ;;
21288 esac
21289 echo "The following $sig_count signals are available:"
21290 echo " "
21291 echo $sig_name | $awk \
21292 'BEGIN { linelen = 0 }
21293 {
21294         for (i = 1; i <= NF; i++) {
21295                 name = "SIG" $i " "
21296                 linelen = linelen + length(name)
21297                 if (linelen > 70) {
21298                         printf "\n"
21299                         linelen = length(name)
21300                 }
21301                 printf "%s", name
21302         }
21303         printf "\n"
21304 }'
21305 sig_size=`echo $sig_name | awk '{print NF}'`
21306 $rm -f signal signal.c signal.awk signal.lst signal_cmd
21307
21308 : Check size of size
21309 echo " "
21310 case "$sizetype" in
21311 *_t) zzz="$sizetype"    ;;
21312 *)   zzz="filesize"     ;;
21313 esac
21314 echo "Checking the size of $zzz..." >&4
21315 cat > try.c <<EOCP
21316 #include <sys/types.h>
21317 #include <stdio.h>
21318 #$i_stdlib I_STDLIB
21319 #ifdef I_STDLIB
21320 #include <stdlib.h>
21321 #endif
21322 int main() {
21323     printf("%d\n", (int)sizeof($sizetype));
21324     exit(0);
21325 }
21326 EOCP
21327 set try
21328 if eval $compile_ok; then
21329         yyy=`$run ./try`
21330         case "$yyy" in
21331         '')     sizesize=4
21332                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21333                 ;;
21334         *)      sizesize=$yyy
21335                 echo "Your $zzz size is $sizesize bytes."
21336                 ;;
21337         esac
21338 else
21339         sizesize=4
21340         echo "(I can't compile the test program--guessing $sizesize.)" >&4
21341 fi
21342
21343
21344 : check for socklen_t
21345 echo " "
21346 echo "Checking to see if you have socklen_t..." >&4
21347 $cat >try.c <<EOCP
21348 #include <sys/types.h>
21349 #$d_socket HAS_SOCKET
21350 #ifdef HAS_SOCKET
21351 #include <sys/socket.h>
21352 #endif
21353 int main() { socklen_t x = 16; }
21354 EOCP
21355 set try
21356 if eval $compile; then
21357         val="$define"
21358         echo "You have socklen_t."
21359 else
21360         val="$undef"
21361         echo "You do not have socklen_t."
21362         case "$sizetype" in
21363         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21364         esac
21365 fi
21366 $rm_try
21367 set d_socklen_t
21368 eval $setvar
21369
21370 : see if this is a socks.h system
21371 set socks.h i_socks
21372 eval $inhdr
21373
21374 : check for type of the size argument to socket calls
21375 case "$d_socket" in
21376 "$define")
21377         $cat <<EOM
21378
21379 Checking to see what type is the last argument of accept().
21380 EOM
21381         yyy=''
21382         case "$d_socklen_t" in
21383         "$define") yyy="$yyy socklen_t"
21384         esac
21385         yyy="$yyy $sizetype int long unsigned"
21386         for xxx in $yyy; do
21387                 case "$socksizetype" in
21388                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21389                         case "$usesocks" in
21390                         "$define")
21391                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21392                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21393                                         socksizetype="$xxx"
21394                                 fi
21395                                 ;;
21396                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21397                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21398                                         socksizetype="$xxx"
21399                                 fi
21400                                 ;;
21401                         esac
21402                         ;;
21403                 esac
21404         done
21405 : In case none of those worked, prompt the user.
21406         case "$socksizetype" in
21407         '')     rp='What is the type for socket address structure sizes?'
21408                 dflt='int'
21409                 . ./myread
21410                 socksizetype=$ans
21411                 ;;
21412         esac
21413         ;;
21414 *)      : no sockets, so pick relatively harmless default
21415         socksizetype='int'
21416         ;;
21417 esac
21418
21419 : see what type is used for signed size_t
21420 set ssize_t ssizetype int stdio.h sys/types.h
21421 eval $typedef
21422 dflt="$ssizetype"
21423 $cat > try.c <<EOM
21424 #include <stdio.h>
21425 #$i_stdlib I_STDLIB
21426 #ifdef I_STDLIB
21427 #include <stdlib.h>
21428 #endif
21429 #include <sys/types.h>
21430 #define Size_t $sizetype
21431 #define SSize_t $dflt
21432 int main()
21433 {
21434         if (sizeof(Size_t) == sizeof(SSize_t))
21435                 printf("$dflt\n");
21436         else if (sizeof(Size_t) == sizeof(int))
21437                 printf("int\n");
21438         else
21439                 printf("long\n");
21440         exit(0);
21441 }
21442 EOM
21443 echo " "
21444 set try
21445 if eval $compile_ok && $run ./try > /dev/null; then
21446         ssizetype=`$run ./try`
21447         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21448 else
21449         $cat >&4 <<EOM
21450 Help! I can't compile and run the ssize_t test program: please enlighten me!
21451 (This is probably a misconfiguration in your system or libraries, and
21452 you really ought to fix it.  Still, I'll try anyway.)
21453
21454 I need a type that is the same size as $sizetype, but is guaranteed to
21455 be signed.  Common values are ssize_t, int and long.
21456
21457 EOM
21458         rp="What signed type is the same size as $sizetype?"
21459         . ./myread
21460         ssizetype="$ans"
21461 fi
21462 $rm_try
21463
21464 : Check the size of st_ino
21465 $echo " "
21466 $echo "Checking the size of st_ino..." >&4
21467 $cat > try.c <<EOCP
21468 #include <sys/stat.h>
21469 #include <stdio.h>
21470 #$i_stdlib I_STDLIB
21471 #ifdef I_STDLIB
21472 #include <stdlib.h>
21473 #endif
21474 int main() {
21475     struct stat st;
21476     printf("%d\n", (int)sizeof(st.st_ino));
21477     exit(0);
21478 }
21479 EOCP
21480 set try
21481 if eval $compile_ok; then
21482         val=`$run ./try`
21483         case "$val" in
21484         '')     st_ino_size=4
21485                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21486                 ;;
21487         *)      st_ino_size=$val
21488                 $echo "Your st_ino is $st_ino_size bytes long."
21489                 ;;
21490         esac
21491 else
21492         st_ino_size=4
21493         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21494 fi
21495 $rm_try
21496
21497 : Check if st_ino is signed
21498 $echo " "
21499 $echo "Checking the sign of st_ino..." >&4
21500 $cat > try.c <<EOCP
21501 #include <sys/stat.h>
21502 #include <stdio.h>
21503 int main() {
21504         struct stat foo;
21505         foo.st_ino = -1;
21506         if (foo.st_ino < 0)
21507                 printf("-1\n");
21508         else
21509                 printf("1\n");
21510 }
21511 EOCP
21512 set try
21513 if eval $compile; then
21514         val=`$run ./try`
21515         case "$val" in
21516         '')     st_ino_sign=1
21517                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
21518                 ;;
21519         *)      st_ino_sign=$val
21520                 case "$st_ino_sign" in
21521                  1) $echo "Your st_ino is unsigned." ;;
21522                 -1) $echo "Your st_ino is signed."   ;;
21523                 esac
21524                 ;;
21525         esac
21526 else
21527         st_ino_sign=1
21528         $echo "(I can't compile the test program--guessing unsigned.)" >&4
21529 fi
21530 $rm_try
21531
21532 : see what type of char stdio uses.
21533 echo " "
21534 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21535 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21536         echo "Your stdio uses unsigned chars." >&4
21537         stdchar="unsigned char"
21538 else
21539         echo "Your stdio uses signed chars." >&4
21540         stdchar="char"
21541 fi
21542 $rm -f stdioh
21543
21544 : see what type uids are declared as in the kernel
21545 echo " "
21546 echo "Looking for the type for user ids returned by getuid()."
21547 set uid_t uidtype xxx stdio.h sys/types.h
21548 eval $typedef
21549 case "$uidtype" in
21550 xxx)
21551         xxx=`./findhdr sys/user.h`
21552         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21553         case $1 in
21554         unsigned) dflt="$1 $2" ;;
21555         *) dflt="$1" ;;
21556         esac
21557         ;;
21558 *) dflt="$uidtype";;
21559 esac
21560 case "$uidtype" in
21561 uid_t)  echo "uid_t found." ;;
21562 *)      rp="What is the type for user ids returned by getuid()?"
21563         . ./myread
21564         uidtype="$ans"
21565         ;;
21566 esac
21567
21568 : Check size of UID
21569 echo " "
21570 case "$uidtype" in
21571 *_t) zzz="$uidtype"     ;;
21572 *)   zzz="uid"          ;;
21573 esac
21574 echo "Checking the size of $zzz..." >&4
21575 cat > try.c <<EOCP
21576 #include <sys/types.h>
21577 #include <stdio.h>
21578 #$i_stdlib I_STDLIB
21579 #ifdef I_STDLIB
21580 #include <stdlib.h>
21581 #endif
21582 int main() {
21583     printf("%d\n", (int)sizeof($uidtype));
21584     exit(0);
21585 }
21586 EOCP
21587 set try
21588 if eval $compile_ok; then
21589         yyy=`$run ./try`
21590         case "$yyy" in
21591         '')     uidsize=4
21592                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21593                 ;;
21594         *)      uidsize=$yyy
21595                 echo "Your $zzz is $uidsize bytes long."
21596                 ;;
21597         esac
21598 else
21599         uidsize=4
21600         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21601 fi
21602
21603 : Check if UID is signed
21604 echo " "
21605 case "$uidtype" in
21606 *_t) zzz="$uidtype"     ;;
21607 *)   zzz="uid"          ;;
21608 esac
21609 echo "Checking the sign of $zzz..." >&4
21610 cat > try.c <<EOCP
21611 #include <sys/types.h>
21612 #include <stdio.h>
21613 int main() {
21614         $uidtype foo = -1;
21615         if (foo < 0)
21616                 printf("-1\n");
21617         else
21618                 printf("1\n");
21619 }
21620 EOCP
21621 set try
21622 if eval $compile; then
21623         yyy=`$run ./try`
21624         case "$yyy" in
21625         '')     uidsign=1
21626                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21627                 ;;
21628         *)      uidsign=$yyy
21629                 case "$uidsign" in
21630                  1) echo "Your $zzz is unsigned." ;;
21631                 -1) echo "Your $zzz is signed."   ;;
21632                 esac
21633                 ;;
21634         esac
21635 else
21636         uidsign=1
21637         echo "(I can't compile the test program--guessing unsigned.)" >&4
21638 fi
21639
21640
21641 : Check format string for UID
21642 echo " "
21643 $echo "Checking the format string to be used for uids..." >&4
21644
21645 case "$uidsign" in
21646 -1)     if $test X"$uidsize" = X"$ivsize"; then
21647                 uidformat="$ivdformat"
21648         else
21649                 if $test X"$uidsize" = X"$longsize"; then
21650                         uidformat='"ld"'
21651                 else
21652                         if $test X"$uidsize" = X"$intsize"; then
21653                                 uidformat='"d"'
21654                         else
21655                                 if $test X"$uidsize" = X"$shortsize"; then
21656                                         uidformat='"hd"'
21657                                 fi
21658                         fi
21659                 fi
21660         fi
21661         ;;
21662 *)      if $test X"$uidsize" = X"$uvsize"; then
21663                 uidformat="$uvuformat"
21664         else
21665                 if $test X"$uidsize" = X"$longsize"; then
21666                         uidformat='"lu"'
21667                 else
21668                         if $test X"$uidsize" = X"$intsize"; then
21669                                 uidformat='"u"'
21670                         else
21671                                 if $test X"$uidsize" = X"$shortsize"; then
21672                                         uidformat='"hu"'
21673                                 fi
21674                         fi
21675                 fi
21676         fi
21677         ;;
21678 esac
21679
21680 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
21681 echo " "
21682 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
21683 $cat >try.c <<'EOM'
21684 /* Intentionally a long probe as I'd like to sanity check that the exact
21685    approach is going to work, as thinking it will work, but only having it
21686    part working at runtime is worse than not having it.  */
21687
21688 #include <sys/types.h>
21689 #include <sys/sysctl.h>
21690 #include <sys/param.h>
21691 #include <stdio.h>
21692 #include <string.h>
21693 #include <stdlib.h>
21694 #include <unistd.h>
21695
21696 int
21697 main(int argc, char **argv) {
21698     char *buffer;
21699     char *argv_leaf = strrchr(argv[0], '/');
21700     char *buffer_leaf;
21701     size_t size = 0;
21702     int mib[4];
21703
21704     mib[0] = CTL_KERN;
21705     mib[1] = KERN_PROC;
21706     mib[2] = KERN_PROC_PATHNAME;
21707     mib[3] = -1;
21708
21709     if (!argv_leaf) {
21710         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21711         return 1;
21712     }
21713
21714     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
21715         perror("sysctl");
21716         return 2;
21717     }
21718
21719     if (size < strlen(argv_leaf) + 1) {
21720         fprintf(stderr, "size %lu is too short for a path\n",
21721                 (unsigned long) size);
21722         return 3;
21723     }
21724
21725     if (size > MAXPATHLEN * MAXPATHLEN) {
21726         fprintf(stderr, "size %lu is too long for a path\n",
21727                 (unsigned long) size);
21728         return 4;
21729     }
21730
21731     buffer = malloc(size);
21732     if (!buffer) {
21733         perror("malloc");
21734         return 5;
21735     }
21736
21737     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
21738         perror("sysctl");
21739         return 6;
21740     }
21741
21742     if (strlen(buffer) + 1 != size) {
21743         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
21744                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
21745         return 7;
21746     }
21747
21748
21749     if (*buffer != '/') {
21750         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
21751         return 8;
21752     }
21753
21754     if (strstr(buffer, "/./")) {
21755         fprintf(stderr, "Contains /./: '%s'\n", buffer);
21756         return 9;
21757     }
21758
21759     if (strstr(buffer, "/../")) {
21760         fprintf(stderr, "Contains /../: '%s'\n", buffer);
21761         return 10;
21762     }
21763
21764     buffer_leaf = strrchr(buffer, '/');
21765     if (strcmp(buffer_leaf, argv_leaf) != 0) {
21766         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
21767         return 11;
21768     }
21769
21770     free(buffer);
21771
21772     return 0;
21773 }
21774 EOM
21775
21776 val=$undef
21777 set try
21778 if eval $compile; then
21779         if $run ./try; then
21780                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
21781                 val="$define"
21782         else
21783                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
21784                 val="$undef"
21785         fi
21786 else
21787         echo "I'm unable to compile the test program." >&4
21788         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
21789         val="$undef"
21790 fi
21791 $rm_try
21792 set usekernprocpathname
21793 eval $setvar
21794
21795 : Determine if we can use _NSGetExecutablePath to find executing program
21796 echo " "
21797 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
21798 $cat >try.c <<'EOM'
21799 /* Intentionally a long probe as I'd like to sanity check that the exact
21800    approach is going to work, as thinking it will work, but only having it
21801    part working at runtime is worse than not having it.  */
21802 #include <mach-o/dyld.h>
21803 #include <stdio.h>
21804 #include <stdlib.h>
21805 #include <sys/param.h>
21806 #include <string.h>
21807
21808 int
21809 main(int argc, char **argv) {
21810     char buf[1];
21811     uint32_t size = sizeof(buf);
21812     int result;
21813     char *buffer;
21814     char *tidied;
21815     char *argv_leaf = strrchr(argv[0], '/');
21816     char *tidied_leaf;
21817
21818     if (!argv_leaf) {
21819         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21820         return 1;
21821     }
21822
21823     _NSGetExecutablePath(buf, &size);
21824     if (size > MAXPATHLEN * MAXPATHLEN) {
21825         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
21826                 (unsigned int) size);
21827         return 2;
21828     }
21829
21830     buffer = malloc(size);
21831     if (!buffer) {
21832         perror("malloc");
21833         return 3;
21834     }
21835
21836     result = _NSGetExecutablePath(buffer, &size);
21837     if (result != 0) {
21838         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
21839                 result, (unsigned int) size);
21840         return 4;
21841     }
21842
21843     tidied = realpath(buffer, NULL);
21844     if (!tidied) {
21845         perror("realpath");
21846         return 5;
21847     }
21848
21849     free(buffer);
21850
21851     if (*tidied != '/') {
21852         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
21853         return 6;
21854     }
21855
21856     if (strstr(tidied, "/./")) {
21857         fprintf(stderr, "Contains /./: '%s'\n", tidied);
21858         return 7;
21859     }
21860
21861     if (strstr(tidied, "/../")) {
21862         fprintf(stderr, "Contains /../: '%s'\n", tidied);
21863         return 8;
21864     }
21865
21866     tidied_leaf = strrchr(tidied, '/');
21867     if (strcmp(tidied_leaf, argv_leaf) != 0) {
21868         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
21869         return 9;
21870     }
21871
21872     free(tidied);
21873
21874     return 0;
21875 }
21876 EOM
21877
21878 val=$undef
21879 set try
21880 if eval $compile; then
21881         if $run ./try; then
21882                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
21883                 val="$define"
21884         else
21885                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
21886         fi
21887 else
21888         echo "I'm unable to compile the test program." >&4
21889         echo "I'll assume no _NSGetExecutablePath here." >&4
21890 fi
21891 $rm_try
21892 set usensgetexecutablepath
21893 eval $setvar
21894
21895 : Check if site customization support was requested
21896 case "$usesitecustomize" in
21897     $define|true|[Yy]*)
21898         usesitecustomize="$define"
21899         ;;
21900     *)
21901         usesitecustomize="$undef"
21902         ;;
21903     esac
21904
21905 : see if prototypes support variable argument declarations
21906 echo " "
21907 case "$prototype$i_stdarg" in
21908 $define$define)
21909         echo "It appears we'll be able to prototype varargs functions." >&4
21910         val="$define"
21911         ;;
21912 *)
21913         echo "Too bad... We won't be using prototyped varargs functions..." >&4
21914         val="$undef"
21915         ;;
21916 esac
21917 set vaproto
21918 eval $setvar
21919
21920 : determine compiler compiler
21921 case "$yacc" in
21922 '')
21923         dflt=yacc;;
21924 *)
21925         dflt="$yacc";;
21926 esac
21927 echo " "
21928 comp='yacc'
21929 if $test -f "$byacc$_exe"; then
21930         dflt="$byacc"
21931         comp="byacc or $comp"
21932 fi
21933 if $test -f "$bison$_exe"; then
21934         comp="$comp or bison -y"
21935 fi
21936 rp="Which compiler compiler ($comp) shall I use?"
21937 . ./myread
21938 yacc="$ans"
21939 case "$yacc" in
21940 *bis*)
21941         case "$yacc" in
21942         *-y*) ;;
21943         *)
21944                 yacc="$yacc -y"
21945                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
21946                 ;;
21947         esac
21948         ;;
21949 esac
21950
21951 : see if this is a assert.h system
21952 set assert.h i_assert
21953 eval $inhdr
21954
21955 : see if this is a bfd.h system
21956 set bfd.h i_bfd
21957 eval $inhdr
21958
21959 : see if this is an execinfo.h system
21960 set execinfo.h i_execinfo
21961 eval $inhdr
21962
21963 : see if this is a fp.h system
21964 set fp.h i_fp
21965 eval $inhdr
21966
21967 : see if this is a fp_class.h system
21968 set fp_class.h i_fp_class
21969 eval $inhdr
21970
21971 : see if gdbm.h is available
21972 set gdbm.h t_gdbm
21973 eval $inhdr
21974 case "$t_gdbm" in
21975 $define)
21976         : see if gdbm_open exists
21977         set gdbm_open d_gdbm_open
21978         eval $inlibc
21979         case "$d_gdbm_open" in
21980         $undef)
21981                 t_gdbm="$undef"
21982                 echo "We won't be including <gdbm.h>"
21983                 ;;
21984         esac
21985         ;;
21986 esac
21987 val="$t_gdbm"
21988 set i_gdbm
21989 eval $setvar
21990
21991 : see if this is a ieeefp.h system
21992 case "$i_ieeefp" in
21993 '' ) set ieeefp.h i_ieeefp
21994      eval $inhdr
21995      ;;
21996 esac
21997
21998 : see if this is a libutil.h system
21999 set libutil.h i_libutil
22000 eval $inhdr
22001
22002 : see if mach cthreads are available
22003 if test "X$usethreads" = "X$define"; then
22004         set mach/cthreads.h i_machcthr
22005         eval $inhdr
22006 else
22007         i_machcthr="$undef"
22008 fi
22009
22010 : see if this is a mntent.h system
22011 set mntent.h i_mntent
22012 eval $inhdr
22013
22014 : see if net/errno.h is available
22015 val=''
22016 set net/errno.h val
22017 eval $inhdr
22018
22019 : Unfortunately, it causes problems on some systems.  Arrgh.
22020 case "$val" in
22021 $define)
22022         cat > try.c <<'EOM'
22023 #include <stdio.h>
22024 #include <errno.h>
22025 #include <net/errno.h>
22026 int func()
22027 {
22028         return ENOTSOCK;
22029 }
22030 EOM
22031         if $cc $ccflags -c try.c >/dev/null 2>&1; then
22032                 echo "We'll be including <net/errno.h>." >&4
22033         else
22034                 echo "We won't be including <net/errno.h>." >&4
22035                 val="$undef"
22036         fi
22037         $rm_try
22038         ;;
22039 esac
22040 set i_neterrno
22041 eval $setvar
22042
22043 : see if netinet/tcp.h is available
22044 set netinet/tcp.h i_netinettcp
22045 eval $inhdr
22046
22047 : see if this is a poll.h system
22048 set poll.h i_poll
22049 eval $inhdr
22050
22051 : see if this is a prot.h system
22052 set prot.h i_prot
22053 eval $inhdr
22054
22055 : Preprocessor symbols
22056 echo " "
22057 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
22058 $cat <<'EOSH' > Cppsym.know
22059 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
22060 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
22061 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
22062 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
22063 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
22064 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
22065 bull c cadmus clipper CMU COFF COMPILER_VERSION
22066 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
22067 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
22068 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
22069 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
22070 GLIBC GLIBC_MINOR
22071 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
22072 H3050R H3050RX hbullx20 hcx host_mips
22073 hp200 hp300 hp700 HP700 hp800 hp9000
22074 hp9000s200 hp9000s300 hp9000s400 hp9000s500
22075 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
22076 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
22077 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
22078 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
22079 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
22080 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
22081 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
22082 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
22083 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
22084 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
22085 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
22086 MATH_HAS_NO_SIDE_EFFECTS
22087 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
22088 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
22089 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
22090 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
22091 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
22092 NetBSD news1500 news1700 news1800 news1900 news3700
22093 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
22094 ns32016 ns32332 ns32k nsc32000
22095 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
22096 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
22097 pc532 pdp11 PGC PIC plexus PORTAR posix
22098 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
22099 POSIX_C_SOURCE POSIX_SOURCE POWER
22100 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
22101 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
22102 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
22103 sony sony_news sonyrisc sparc sparclite spectrum
22104 stardent stdc STDC_EXT stratos sun sun3 sun386
22105 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
22106 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
22107 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
22108 sysV68 sysV88 Tek4132 Tek4300 titan
22109 TM3200 TM5400 TM5600
22110 tower tower32 tower32_200 tower32_600 tower32_700
22111 tower32_800 tower32_850 tss
22112 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
22113 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
22114 unix UNIX95 UNIX99 unixpc unos
22115 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
22116 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
22117 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
22118 USGr4 USGr4_2
22119 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
22120 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
22121 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
22122 z8000
22123 EOSH
22124 # Maybe put other stuff here too.
22125 cat <<EOSH >>Cppsym.know
22126 $osname
22127 EOSH
22128 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
22129 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
22130 $cat Cppsym.know > Cppsym.c
22131 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
22132 $rm -f Cppsym.a Cppsym.b Cppsym.c
22133 cat <<EOSH > Cppsym
22134 $startsh
22135 if $test \$# -gt 0; then
22136     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
22137     if $test -s Cppsym.got; then
22138         $rm -f Cppsym.got
22139         exit 0
22140     fi
22141     $rm -f Cppsym.got
22142     exit 1
22143 else
22144     $tr " " "$trnl" | ./Cppsym.try
22145     exit 0
22146 fi
22147 EOSH
22148 chmod +x Cppsym
22149 $eunicefix Cppsym
22150 cat <<EOSH > Cppsym.try
22151 $startsh
22152 cat <<'EOCP' > try.c
22153 #include <stdio.h>
22154 #if cpp_stuff == 1
22155 #define STRINGIFY(a)    "a"
22156 #endif
22157 #if cpp_stuff == 42
22158 #define StGiFy(a)  #a
22159 #define STRINGIFY(a)    StGiFy(a)
22160 #endif
22161 #if $cpp_stuff != 1 && $cpp_stuff != 42
22162 #   include "Bletch: How does this C preprocessor stringify macros?"
22163 #endif
22164 int main() {
22165 EOCP
22166 $awk \\
22167 EOSH
22168 cat <<'EOSH' >> Cppsym.try
22169 'length($1) > 0 {
22170     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
22171     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
22172     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
22173     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
22174 }'       >> try.c
22175 echo 'return 0;}' >> try.c
22176 EOSH
22177 cat <<EOSH >> Cppsym.try
22178 ccflags="$ccflags"
22179 case "$osname-$gccversion" in
22180 irix-) ccflags="\$ccflags -woff 1178" ;;
22181 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
22182 esac
22183 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
22184 EOSH
22185 chmod +x Cppsym.try
22186 $eunicefix Cppsym.try
22187 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
22188 : Add in any Linux cpp "predefined macros":
22189 case "$osname::$gccversion" in
22190   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
22191     tHdrH=_tmpHdr
22192     rm -f $tHdrH'.h' $tHdrH
22193     touch $tHdrH'.h'
22194     # Filter out macro arguments, such as Linux's __INT8_C(c)
22195     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
22196        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
22197        if [ -s $tHdrH'_cppsym.real' ]; then
22198           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
22199        fi
22200     fi
22201     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
22202   ;;
22203 esac
22204 : now check the C compiler for additional symbols
22205 postprocess_cc_v=''
22206 case "$osname" in
22207 aix) postprocess_cc_v="|$tr , ' '" ;;
22208 esac
22209 $cat >ccsym <<EOS
22210 $startsh
22211 $cat >tmp.c <<EOF
22212 extern int foo;
22213 EOF
22214 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
22215 do
22216         case "\$i" in
22217         -D*) echo "\$i" | $sed 's/^-D//';;
22218         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
22219         esac
22220 done
22221 $rm_try
22222 EOS
22223 postprocess_cc_v=''
22224 chmod +x ccsym
22225 $eunicefix ccsym
22226 ./ccsym > ccsym1.raw
22227 if $test -s ccsym1.raw; then
22228        $sort ccsym1.raw | $uniq >ccsym.raw
22229 else
22230        mv ccsym1.raw ccsym.raw
22231 fi
22232
22233 $awk '/\=/ { print $0; next }
22234         { print $0"=1" }' ccsym.raw >ccsym.list
22235 $comm -13 Cppsym.true ccsym.list >ccsym.own
22236 $comm -12 Cppsym.true ccsym.list >ccsym.com
22237 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
22238 also=''
22239 if $test -z ccsym.raw; then
22240         echo "Your C compiler doesn't seem to define any symbols!" >&4
22241         echo " "
22242         echo "However, your C preprocessor defines the following symbols:"
22243         $cat Cppsym.true
22244         ccsymbols=''
22245         cppsymbols=`$cat Cppsym.true`
22246         cppsymbols=`echo $cppsymbols`
22247         cppccsymbols="$cppsymbols"
22248 else
22249         if $test -s ccsym.com; then
22250                 echo "Your C compiler and pre-processor define these symbols:"
22251                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
22252                 also='also '
22253                 symbols='ones'
22254                 cppccsymbols=`$cat ccsym.com`
22255                 cppccsymbols=`echo $cppccsymbols`
22256                 $test "$silent" || sleep 1
22257         fi
22258         if $test -s ccsym.cpp; then
22259                 $test "$also" && echo " "
22260                 echo "Your C pre-processor ${also}defines the following symbols:"
22261                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22262                 also='further '
22263                 cppsymbols=`$cat ccsym.cpp`
22264                 cppsymbols=`echo $cppsymbols`
22265                 $test "$silent" || sleep 1
22266         fi
22267         if $test -s ccsym.own; then
22268                 $test "$also" && echo " "
22269                 echo "Your C compiler ${also}defines the following cpp symbols:"
22270                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
22271                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22272                 ccsymbols=`$cat ccsym.own`
22273                 ccsymbols=`echo $ccsymbols`
22274                 $test "$silent" || sleep 1
22275         fi
22276 fi
22277
22278 : see if this is a termio system
22279 val="$undef"
22280 val2="$undef"
22281 val3="$undef"
22282 if $test `./findhdr termios.h`; then
22283     set tcsetattr i_termios
22284     eval $inlibc
22285     val3="$i_termios"
22286 fi
22287 echo " "
22288 case "$val3" in
22289     "$define") echo "You have POSIX termios.h... good!" >&4;;
22290     *)  if ./Cppsym pyr; then
22291             case "`$run /bin/universe`" in
22292                 ucb) if $test `./findhdr sgtty.h`; then
22293                         val2="$define"
22294                         echo "<sgtty.h> found." >&4
22295                     else
22296                         echo "System is pyramid with BSD universe."
22297                         ./warn "<sgtty.h> not found--you could have problems."
22298                     fi;;
22299                 *)  if $test `./findhdr termio.h`; then
22300                         val="$define"
22301                         echo "<termio.h> found." >&4
22302                     else
22303                         echo "System is pyramid with USG universe."
22304                         ./warn "<termio.h> not found--you could have problems."
22305                     fi;;
22306             esac
22307         elif ./usg; then
22308             if $test `./findhdr termio.h`; then
22309                 echo "<termio.h> found." >&4
22310                 val="$define"
22311             elif $test `./findhdr sgtty.h`; then
22312                 echo "<sgtty.h> found." >&4
22313                 val2="$define"
22314             else
22315                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
22316             fi
22317         else
22318             if $test `./findhdr sgtty.h`; then
22319                 echo "<sgtty.h> found." >&4
22320                 val2="$define"
22321             elif $test `./findhdr termio.h`; then
22322                 echo "<termio.h> found." >&4
22323                 val="$define"
22324             else
22325                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
22326             fi
22327         fi;;
22328 esac
22329 set i_termio; eval $setvar
22330 val=$val2; set i_sgtty; eval $setvar
22331 val=$val3; set i_termios; eval $setvar
22332
22333 : see if stdbool is available
22334 : we want a real compile instead of Inhdr because some Solaris systems
22335 : have stdbool.h, but it can only be used if the compiler indicates it
22336 : is sufficiently c99-compliant.
22337 echo " "
22338 $cat >try.c <<EOCP
22339 #include <stdio.h>
22340 #include <stdbool.h>
22341 int func(bool x)
22342 {
22343     return x ? 1 : 0;
22344 }
22345 int main(int argc, char **argv)
22346 {
22347     return func(0);
22348 }
22349 EOCP
22350 set try
22351 if eval $compile; then
22352         echo "<stdbool.h> found." >&4
22353         val="$define"
22354 else
22355         echo "<stdbool.h> NOT found." >&4
22356         val="$undef"
22357 fi
22358 $rm_try
22359 set i_stdbool
22360 eval $setvar
22361
22362 : see if stddef is available
22363 set stddef.h i_stddef
22364 eval $inhdr
22365
22366 : see if sys/access.h is available
22367 set sys/access.h i_sysaccess
22368 eval $inhdr
22369
22370 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
22371 set sys/filio.h i_sysfilio
22372 eval $inhdr
22373 echo " "
22374 if $test `./findhdr sys/ioctl.h`; then
22375         val="$define"
22376         echo '<sys/ioctl.h> found.' >&4
22377 else
22378         val="$undef"
22379         if $test $i_sysfilio = "$define"; then
22380             echo '<sys/ioctl.h> NOT found.' >&4
22381         else
22382                 $test $i_sgtty = "$define" && xxx="sgtty.h"
22383                 $test $i_termio = "$define" && xxx="termio.h"
22384                 $test $i_termios = "$define" && xxx="termios.h"
22385 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
22386         fi
22387 fi
22388 set i_sysioctl
22389 eval $setvar
22390
22391 : see if socket ioctl defs are in sys/sockio.h
22392 echo " "
22393 xxx=`./findhdr sys/sockio.h`
22394 if $test "$xxx"; then
22395         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
22396                 val="$define"
22397                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
22398         else
22399                 val="$undef"
22400                 echo "No socket ioctls found in <sys/sockio.h>." >&4
22401         fi
22402 else
22403         val="$undef"
22404         $cat <<EOM
22405 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
22406 EOM
22407 fi
22408 set i_syssockio
22409 eval $setvar
22410
22411 : see if this is a syslog.h system
22412 set syslog.h i_syslog
22413 eval $inhdr
22414
22415 : see if this is a sys/mode.h system
22416 set sys/mode.h i_sysmode
22417 eval $inhdr
22418
22419 : see if there is a sys/poll.h file
22420 set sys/poll.h i_syspoll
22421 eval $inhdr
22422
22423 : see if sys/resource.h has to be included
22424 set sys/resource.h i_sysresrc
22425 eval $inhdr
22426
22427 : see if sys/security.h is available
22428 set sys/security.h i_syssecrt
22429 eval $inhdr
22430
22431 : see if this is a sys/statvfs.h system
22432 set sys/statvfs.h i_sysstatvfs
22433 eval $inhdr
22434
22435 : see if this is a sys/un.h system
22436 set sys/un.h i_sysun
22437 eval $inhdr
22438
22439 : see if this is a sys/utsname.h system
22440 set sys/utsname.h i_sysutsname
22441 eval $inhdr
22442
22443 : see if this is a syswait system
22444 set sys/wait.h i_syswait
22445 eval $inhdr
22446
22447 : see if this is a ustat.h system
22448 set ustat.h i_ustat
22449 eval $inhdr
22450
22451 : see if this is an utime system
22452 set utime.h i_utime
22453 eval $inhdr
22454
22455 : see if this is a vfork system
22456 case "$d_vfork" in
22457 "$define")
22458         set vfork.h i_vfork
22459         eval $inhdr
22460         ;;
22461 *)
22462         i_vfork="$undef"
22463         ;;
22464 esac
22465
22466 : Check extensions
22467 echo " "
22468 echo "Looking for extensions..." >&4
22469 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
22470 : contain old or inaccurate or duplicate values.
22471 nonxs_extensions=''
22472 xs_extensions=''
22473 : We do not use find because it might not be available.
22474 : We do not just use MANIFEST because the user may have dropped
22475 : some additional extensions into the source tree and expect them
22476 : to be built.
22477
22478 : Function to recursively find available extensions, ignoring DynaLoader
22479 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
22480 : In 5.10.1 and later, extensions are stored in directories
22481 : like File-Glob instead of the older File/Glob/.
22482 find_extensions='
22483     for xxx in *; do
22484         case "$xxx" in
22485             DynaLoader|dynaload) ;;
22486             *)
22487             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
22488             case "$this_ext" in
22489                 Scalar/List/Utils) this_ext="List/Util" ;;
22490                 PathTools)         this_ext="Cwd"       ;;
22491             esac;
22492             echo " $xs_extensions $nonxs_extensions" > $tdir/$$.tmp;
22493             if $contains " $this_ext " $tdir/$$.tmp; then
22494                 echo >&4;
22495                 echo "Duplicate directories detected for extension $xxx" >&4;
22496                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
22497                 case "$knowitall" in
22498                 "") dflt=y;;
22499                 *) dflt=n;;
22500                 esac;
22501                 . ../UU/myread;
22502                 case "$ans" in
22503                 n*|N*) ;;
22504                 *) echo >&4;
22505                     echo "Ok.  Stopping Configure." >&4;
22506                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
22507                     exit 1;;
22508                 esac;
22509                 echo "Ok.  You will need to correct config.sh before running make." >&4;
22510             fi;
22511             $ls -1 $xxx > $tdir/$$.tmp;
22512             if   $contains "\.xs$" $tdir/$$.tmp > /dev/null 2>&1; then
22513                 xs_extensions="$xs_extensions $this_ext";
22514             elif $contains "\.c$"  $tdir/$$.tmp > /dev/null 2>&1; then
22515                 xs_extensions="$xs_extensions $this_ext";
22516             elif $test -d $xxx; then
22517                 nonxs_extensions="$nonxs_extensions $this_ext";
22518             fi;
22519             $rm -f $tdir/$$.tmp;
22520             ;;
22521         esac;
22522     done'
22523 tdir=`pwd`
22524 cd "$rsrc/cpan"
22525 set X
22526 shift
22527 eval $find_extensions
22528 cd "$rsrc/dist"
22529 set X
22530 shift
22531 eval $find_extensions
22532 cd "$rsrc/ext"
22533 set X
22534 shift
22535 eval $find_extensions
22536 set X $xs_extensions
22537 shift
22538 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22539 set X $nonxs_extensions
22540 shift
22541 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22542 cd "$tdir"
22543 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
22544
22545 : Now see which are supported on this system.
22546 avail_ext=''
22547 for xxx in $xs_extensions ; do
22548         case "$xxx" in
22549         DB_File|db_file)
22550                 case "$i_db" in
22551                 $define) avail_ext="$avail_ext $xxx" ;;
22552                 esac
22553                 ;;
22554         GDBM_File|gdbm_fil)
22555                 case "$i_gdbm" in
22556                 $define) avail_ext="$avail_ext $xxx" ;;
22557                 esac
22558                 ;;
22559         I18N/Langinfo|i18n_lan)
22560                 case "$i_langinfo$d_nl_langinfo" in
22561                 $define$define) avail_ext="$avail_ext $xxx" ;;
22562                 esac
22563                 ;;
22564         IPC/SysV|ipc/sysv)
22565                 : XXX Do we need a useipcsysv variable here
22566                 case "${d_msg}${d_sem}${d_shm}" in
22567                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
22568                 esac
22569                 ;;
22570         NDBM_File|ndbm_fil)
22571                 case "$d_ndbm" in
22572                 $define)
22573                     case "$osname-$use64bitint" in
22574                     hpux-define)
22575                         case "$libs" in
22576                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
22577                         esac
22578                         ;;
22579                     *) avail_ext="$avail_ext $xxx" ;;
22580                     esac
22581                     ;;
22582                 esac
22583                 ;;
22584         ODBM_File|odbm_fil)
22585                 case "${i_dbm}${i_rpcsvcdbm}" in
22586                 *"${define}"*)
22587                     case "$d_cplusplus" in
22588                     define) ;; # delete as a function name will not work
22589                     *)  case "$osname-$use64bitint" in
22590                         hpux-define)
22591                             case "$libs" in
22592                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22593                             esac
22594                             ;;
22595                         *) avail_ext="$avail_ext $xxx" ;;
22596                         esac
22597                         ;;
22598                     esac
22599                     ;;
22600                 esac
22601                 ;;
22602         Opcode|opcode)
22603                 case "$useopcode" in
22604                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22605                 esac
22606                 ;;
22607         POSIX|posix)
22608                 case "$useposix" in
22609                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22610                 esac
22611                 ;;
22612         Socket|socket)
22613                 case "$d_socket" in
22614                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22615                 esac
22616                 ;;
22617         Sys/Syslog|sys/syslog)
22618                 : XXX syslog requires socket
22619                 case "$d_socket" in
22620                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22621                 esac
22622                 ;;
22623         Thread|thread)
22624                 case "$usethreads" in
22625                 true|$define|y)
22626                         case "$use5005threads" in
22627                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
22628                         esac
22629                 esac
22630                 ;;
22631         threads|threads/shared)
22632                 # threads and threads::shared are special cases.
22633                 # To stop people from asking "Perl 5.8.0 was supposed
22634                 # to have this new fancy threads implementation but my
22635                 # perl doesn't have it" and from people trying to
22636                 # (re)install the threads module using CPAN.pm and
22637                 # CPAN.pm then offering to reinstall Perl 5.8.0,
22638                 # the threads.pm and threads/shared.pm will always be
22639                 # there, croaking informatively ("you need to rebuild
22640                 # all of Perl with threads, sorry") when threads haven't
22641                 # been compiled in.
22642                 # --jhi
22643                 avail_ext="$avail_ext $xxx"
22644                 ;;
22645         VMS*)
22646                 ;;
22647         Win32*)
22648                 case "$osname" in
22649                 cygwin) avail_ext="$avail_ext $xxx" ;;
22650                 esac
22651                 ;;
22652         XS/APItest|xs/apitest)
22653                 # This is just for testing.  Skip it unless we have dynamic loading.
22654
22655                 case "$usedl" in
22656                 $define) avail_ext="$avail_ext $xxx" ;;
22657                 esac
22658                 ;;
22659         XS/Typemap|xs/typemap)
22660                 # This is just for testing.  Skip it unless we have dynamic loading.
22661                 case "$usedl" in
22662                 $define) avail_ext="$avail_ext $xxx" ;;
22663                 esac
22664                 ;;
22665         *)      avail_ext="$avail_ext $xxx"
22666                 ;;
22667         esac
22668 done
22669
22670 set X $avail_ext
22671 shift
22672 avail_ext="$*"
22673
22674 case "$onlyextensions" in
22675 '') ;;
22676 *)  keepextensions=''
22677     echo "You have requested that only certain extensions be included..." >&4
22678     for i in $onlyextensions; do
22679         case " $avail_ext " in
22680         *" $i "*)
22681             echo "Keeping extension $i."
22682             keepextensions="$keepextensions $i"
22683             ;;
22684         *) echo "Ignoring extension $i." ;;
22685         esac
22686     done
22687     avail_ext="$keepextensions"
22688     ;;
22689 esac
22690
22691 case "$noextensions" in
22692 '') ;;
22693 *)  keepextensions=''
22694     echo "You have requested that certain extensions be ignored..." >&4
22695     for i in $avail_ext; do
22696         case " $noextensions " in
22697         *" $i "*) echo "Ignoring extension $i." ;;
22698         *) echo "Keeping extension $i.";
22699            keepextensions="$keepextensions $i"
22700            ;;
22701         esac
22702     done
22703     avail_ext="$keepextensions"
22704     ;;
22705 esac
22706
22707 : Now see which nonxs extensions are supported on this system.
22708 : For now assume all are.
22709 nonxs_ext=''
22710 for xxx in $nonxs_extensions ; do
22711         case "$xxx" in
22712         VMS*)
22713                 ;;
22714         *)      nonxs_ext="$nonxs_ext $xxx"
22715                 ;;
22716         esac
22717 done
22718
22719 set X $nonxs_ext
22720 shift
22721 nonxs_ext="$*"
22722
22723 case $usedl in
22724 $define)
22725         $cat <<EOM
22726 A number of extensions are supplied with $package.  You may choose to
22727 compile these extensions for dynamic loading (the default), compile
22728 them into the $package executable (static loading), or not include
22729 them at all.  Answer "none" to include no extensions.
22730 Note that DynaLoader is always built and need not be mentioned here.
22731
22732 EOM
22733         case "$dynamic_ext" in
22734         '')
22735                 : Exclude those listed in static_ext
22736                 dflt=''
22737                 for xxx in $avail_ext; do
22738                         case " $static_ext " in
22739                         *" $xxx "*) ;;
22740                         *) dflt="$dflt $xxx" ;;
22741                         esac
22742                 done
22743                 set X $dflt
22744                 shift
22745                 dflt="$*"
22746                 ;;
22747         *)      dflt="$dynamic_ext"
22748                 # Perhaps we are reusing an old out-of-date config.sh.
22749                 case "$hint" in
22750                 previous)
22751                         if test X"$dynamic_ext" != X"$avail_ext"; then
22752                                 $cat <<EOM
22753 NOTICE:  Your previous config.sh list may be incorrect.
22754 The extensions now available to you are
22755         ${avail_ext}
22756 but the default list from your previous config.sh is
22757         ${dynamic_ext}
22758
22759 EOM
22760                         fi
22761                         ;;
22762                 esac
22763                 ;;
22764         esac
22765         case "$dflt" in
22766         '')     dflt=none;;
22767         esac
22768         rp="What extensions do you wish to load dynamically?"
22769         . ./myread
22770         case "$ans" in
22771         none) dynamic_ext=' ' ;;
22772         *) dynamic_ext="$ans" ;;
22773         esac
22774
22775         case "$static_ext" in
22776         '')
22777                 : Exclude those already listed in dynamic linking
22778                 dflt=''
22779                 for xxx in $avail_ext; do
22780                         case " $dynamic_ext " in
22781                         *" $xxx "*) ;;
22782                         *) dflt="$dflt $xxx" ;;
22783                         esac
22784                 done
22785                 set X $dflt
22786                 shift
22787                 dflt="$*"
22788                 ;;
22789         *)  dflt="$static_ext"
22790                 ;;
22791         esac
22792
22793         case "$dflt" in
22794         '')     dflt=none;;
22795         esac
22796         rp="What extensions do you wish to load statically?"
22797         . ./myread
22798         case "$ans" in
22799         none) static_ext=' ' ;;
22800         *) static_ext="$ans" ;;
22801         esac
22802         ;;
22803 *)
22804         $cat <<EOM
22805 A number of extensions are supplied with $package.  Answer "none"
22806 to include no extensions.
22807 Note that DynaLoader is always built and need not be mentioned here.
22808
22809 EOM
22810         case "$static_ext" in
22811         '') dflt="$avail_ext" ;;
22812         *)      dflt="$static_ext"
22813                 # Perhaps we are reusing an old out-of-date config.sh.
22814                 case "$hint" in
22815                 previous)
22816                         if test X"$static_ext" != X"$avail_ext"; then
22817                                 $cat <<EOM
22818 NOTICE:  Your previous config.sh list may be incorrect.
22819 The extensions now available to you are
22820         ${avail_ext}
22821 but the default list from your previous config.sh is
22822         ${static_ext}
22823
22824 EOM
22825                         fi
22826                         ;;
22827                 esac
22828                 ;;
22829         esac
22830         : Exclude those that are not xs extensions
22831         case "$dflt" in
22832         '')     dflt=none;;
22833         esac
22834         rp="What extensions do you wish to include?"
22835         . ./myread
22836         case "$ans" in
22837         none) static_ext=' ' ;;
22838         *) static_ext="$ans" ;;
22839         esac
22840         ;;
22841 esac
22842 #
22843 # Encode is a special case.  If we are building Encode as a static
22844 # extension, we need to explicitly list its subextensions as well.
22845 # For other nested extensions, this is handled automatically by
22846 # the appropriate Makefile.PL.
22847 case " $static_ext " in
22848         *" Encode "*) # Add the subextensions of Encode
22849         cd "$rsrc/cpan"
22850         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22851                 static_ext="$static_ext Encode/$xxx"
22852                 known_extensions="$known_extensions Encode/$xxx"
22853         done
22854         cd "$tdir"
22855         ;;
22856 esac
22857
22858 set X $dynamic_ext $static_ext $nonxs_ext
22859 shift
22860 extensions="$*"
22861
22862 # Sanity check:  We require an extension suitable for use with
22863 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22864 # should show up as failures in the test suite, but it's helpful to
22865 # catch them now.) The 'extensions' list is normally sorted
22866 # alphabetically, so we need to accept either
22867 #    DB_File ... Fcntl ... IO  ....
22868 # or something like
22869 #    Fcntl ... NDBM_File ... IO  ....
22870 case " $extensions"  in
22871 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22872 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22873 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22874 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22875    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22876    ;;
22877 esac
22878
22879 : Remove libraries needed only for extensions
22880 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22881 : The exception is SunOS 4.x, which needs them.
22882 case "${osname}X${osvers}" in
22883 sunos*X4*)
22884     perllibs="$libs"
22885     ;;
22886 *) case "$usedl" in
22887     $define|true|[yY]*)
22888             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
22889             shift
22890             perllibs="$*"
22891             ;;
22892     *)  perllibs="$libs"
22893             ;;
22894     esac
22895     ;;
22896 esac
22897
22898 : Remove build directory name from cppstdin so it can be used from
22899 : either the present location or the final installed location.
22900 echo " "
22901 : Get out of the UU directory to get correct path name.
22902 cd ..
22903 case "$cppstdin" in
22904 `pwd`/cppstdin)
22905         echo "Stripping down cppstdin path name"
22906         cppstdin=cppstdin
22907         ;;
22908 esac
22909 cd UU
22910
22911 : end of configuration questions
22912 echo " "
22913 echo "End of configuration questions."
22914 echo " "
22915
22916 : back to where it started
22917 if test -d ../UU; then
22918         cd ..
22919 fi
22920
22921 : configuration may be unconditionally patched via a 'config.arch' file
22922 if $test -f config.arch; then
22923         echo "I see a config.arch file, loading it." >&4
22924         . ./config.arch
22925 fi
22926
22927 : configuration may be patched via a 'config.over' file
22928 if $test -f config.over; then
22929         echo " "
22930         dflt=y
22931         rp='I see a config.over file.  Do you wish to load it?'
22932         . UU/myread
22933         case "$ans" in
22934         n*) echo "OK, I'll ignore it.";;
22935         *)      . ./config.over
22936                 echo "Configuration override changes have been loaded."
22937                 ;;
22938         esac
22939 fi
22940
22941 : in case they want portability, strip down executable paths
22942 case "$d_portable" in
22943 "$define")
22944         echo " "
22945         echo "Stripping down executable paths..." >&4
22946         for file in $loclist $trylist; do
22947                 eval temp=\$$file
22948                 eval $file=`basename $temp`
22949         done
22950         ;;
22951 esac
22952
22953 : create config.sh file
22954 echo " "
22955 echo "Creating config.sh..." >&4
22956 $spitshell <<EOT >config.sh
22957 $startsh
22958 #
22959 # This file was produced by running the Configure script. It holds all the
22960 # definitions figured out by Configure. Should you modify one of these values,
22961 # do not forget to propagate your changes by running "Configure -der". You may
22962 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22963 #
22964
22965 # Package name      : $package
22966 # Source directory  : $src
22967 # Configuration time: $cf_time
22968 # Configured by     : $cf_by
22969 # Target system     : $myuname
22970
22971 EOT
22972 : Add in command line options if available
22973 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22974
22975 $spitshell <<EOT >>config.sh
22976
22977 Author='$Author'
22978 Date='$Date'
22979 Header='$Header'
22980 Id='$Id'
22981 Locker='$Locker'
22982 Log='$Log'
22983 RCSfile='$RCSfile'
22984 Revision='$Revision'
22985 Source='$Source'
22986 State='$State'
22987 _a='$_a'
22988 _exe='$_exe'
22989 _o='$_o'
22990 afs='$afs'
22991 afsroot='$afsroot'
22992 alignbytes='$alignbytes'
22993 ansi2knr='$ansi2knr'
22994 aphostname='$aphostname'
22995 api_revision='$api_revision'
22996 api_subversion='$api_subversion'
22997 api_version='$api_version'
22998 api_versionstring='$api_versionstring'
22999 ar='$ar'
23000 archlib='$archlib'
23001 archlibexp='$archlibexp'
23002 archname64='$archname64'
23003 archname='$archname'
23004 archobjs='$archobjs'
23005 asctime_r_proto='$asctime_r_proto'
23006 awk='$awk'
23007 baserev='$baserev'
23008 bash='$bash'
23009 bin='$bin'
23010 bin_ELF='$bin_ELF'
23011 binexp='$binexp'
23012 bison='$bison'
23013 byacc='$byacc'
23014 byteorder='$byteorder'
23015 c='$c'
23016 castflags='$castflags'
23017 cat='$cat'
23018 cc='$cc'
23019 cccdlflags='$cccdlflags'
23020 ccdlflags='$ccdlflags'
23021 ccflags='$ccflags'
23022 ccflags_uselargefiles='$ccflags_uselargefiles'
23023 ccname='$ccname'
23024 ccsymbols='$ccsymbols'
23025 ccversion='$ccversion'
23026 cf_by='$cf_by'
23027 cf_email='$cf_email'
23028 cf_time='$cf_time'
23029 charbits='$charbits'
23030 charsize='$charsize'
23031 chgrp='$chgrp'
23032 chmod='$chmod'
23033 chown='$chown'
23034 clocktype='$clocktype'
23035 comm='$comm'
23036 compress='$compress'
23037 contains='$contains'
23038 cp='$cp'
23039 cpio='$cpio'
23040 cpp='$cpp'
23041 cpp_stuff='$cpp_stuff'
23042 cppccsymbols='$cppccsymbols'
23043 cppflags='$cppflags'
23044 cpplast='$cpplast'
23045 cppminus='$cppminus'
23046 cpprun='$cpprun'
23047 cppstdin='$cppstdin'
23048 cppsymbols='$cppsymbols'
23049 crypt_r_proto='$crypt_r_proto'
23050 cryptlib='$cryptlib'
23051 csh='$csh'
23052 ctermid_r_proto='$ctermid_r_proto'
23053 ctime_r_proto='$ctime_r_proto'
23054 d_Gconvert='$d_Gconvert'
23055 d_PRIEUldbl='$d_PRIEUldbl'
23056 d_PRIFUldbl='$d_PRIFUldbl'
23057 d_PRIGUldbl='$d_PRIGUldbl'
23058 d_PRIXU64='$d_PRIXU64'
23059 d_PRId64='$d_PRId64'
23060 d_PRIeldbl='$d_PRIeldbl'
23061 d_PRIfldbl='$d_PRIfldbl'
23062 d_PRIgldbl='$d_PRIgldbl'
23063 d_PRIi64='$d_PRIi64'
23064 d_PRIo64='$d_PRIo64'
23065 d_PRIu64='$d_PRIu64'
23066 d_PRIx64='$d_PRIx64'
23067 d_SCNfldbl='$d_SCNfldbl'
23068 d__fwalk='$d__fwalk'
23069 d_access='$d_access'
23070 d_accessx='$d_accessx'
23071 d_aintl='$d_aintl'
23072 d_alarm='$d_alarm'
23073 d_archlib='$d_archlib'
23074 d_asctime64='$d_asctime64'
23075 d_asctime_r='$d_asctime_r'
23076 d_atolf='$d_atolf'
23077 d_atoll='$d_atoll'
23078 d_attribute_deprecated='$d_attribute_deprecated'
23079 d_attribute_format='$d_attribute_format'
23080 d_attribute_malloc='$d_attribute_malloc'
23081 d_attribute_nonnull='$d_attribute_nonnull'
23082 d_attribute_noreturn='$d_attribute_noreturn'
23083 d_attribute_pure='$d_attribute_pure'
23084 d_attribute_unused='$d_attribute_unused'
23085 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
23086 d_backtrace='$d_backtrace'
23087 d_bcmp='$d_bcmp'
23088 d_bcopy='$d_bcopy'
23089 d_bsd='$d_bsd'
23090 d_bsdgetpgrp='$d_bsdgetpgrp'
23091 d_bsdsetpgrp='$d_bsdsetpgrp'
23092 d_builtin_choose_expr='$d_builtin_choose_expr'
23093 d_builtin_expect='$d_builtin_expect'
23094 d_bzero='$d_bzero'
23095 d_c99_variadic_macros='$d_c99_variadic_macros'
23096 d_casti32='$d_casti32'
23097 d_castneg='$d_castneg'
23098 d_charvspr='$d_charvspr'
23099 d_chown='$d_chown'
23100 d_chroot='$d_chroot'
23101 d_chsize='$d_chsize'
23102 d_class='$d_class'
23103 d_clearenv='$d_clearenv'
23104 d_closedir='$d_closedir'
23105 d_cmsghdr_s='$d_cmsghdr_s'
23106 d_const='$d_const'
23107 d_copysignl='$d_copysignl'
23108 d_cplusplus='$d_cplusplus'
23109 d_crypt='$d_crypt'
23110 d_crypt_r='$d_crypt_r'
23111 d_csh='$d_csh'
23112 d_ctermid='$d_ctermid'
23113 d_ctermid_r='$d_ctermid_r'
23114 d_ctime64='$d_ctime64'
23115 d_ctime_r='$d_ctime_r'
23116 d_cuserid='$d_cuserid'
23117 d_dbl_dig='$d_dbl_dig'
23118 d_dbminitproto='$d_dbminitproto'
23119 d_difftime64='$d_difftime64'
23120 d_difftime='$d_difftime'
23121 d_dir_dd_fd='$d_dir_dd_fd'
23122 d_dirfd='$d_dirfd'
23123 d_dirnamlen='$d_dirnamlen'
23124 d_dladdr='$d_dladdr'
23125 d_dlerror='$d_dlerror'
23126 d_dlopen='$d_dlopen'
23127 d_dlsymun='$d_dlsymun'
23128 d_dosuid='$d_dosuid'
23129 d_drand48_r='$d_drand48_r'
23130 d_drand48proto='$d_drand48proto'
23131 d_dup2='$d_dup2'
23132 d_eaccess='$d_eaccess'
23133 d_endgrent='$d_endgrent'
23134 d_endgrent_r='$d_endgrent_r'
23135 d_endhent='$d_endhent'
23136 d_endhostent_r='$d_endhostent_r'
23137 d_endnent='$d_endnent'
23138 d_endnetent_r='$d_endnetent_r'
23139 d_endpent='$d_endpent'
23140 d_endprotoent_r='$d_endprotoent_r'
23141 d_endpwent='$d_endpwent'
23142 d_endpwent_r='$d_endpwent_r'
23143 d_endsent='$d_endsent'
23144 d_endservent_r='$d_endservent_r'
23145 d_eofnblk='$d_eofnblk'
23146 d_eunice='$d_eunice'
23147 d_faststdio='$d_faststdio'
23148 d_fchdir='$d_fchdir'
23149 d_fchmod='$d_fchmod'
23150 d_fchown='$d_fchown'
23151 d_fcntl='$d_fcntl'
23152 d_fcntl_can_lock='$d_fcntl_can_lock'
23153 d_fd_macros='$d_fd_macros'
23154 d_fd_set='$d_fd_set'
23155 d_fds_bits='$d_fds_bits'
23156 d_fgetpos='$d_fgetpos'
23157 d_finite='$d_finite'
23158 d_finitel='$d_finitel'
23159 d_flexfnam='$d_flexfnam'
23160 d_flock='$d_flock'
23161 d_flockproto='$d_flockproto'
23162 d_fork='$d_fork'
23163 d_fp_class='$d_fp_class'
23164 d_fpathconf='$d_fpathconf'
23165 d_fpclass='$d_fpclass'
23166 d_fpclassify='$d_fpclassify'
23167 d_fpclassl='$d_fpclassl'
23168 d_fpos64_t='$d_fpos64_t'
23169 d_frexpl='$d_frexpl'
23170 d_fs_data_s='$d_fs_data_s'
23171 d_fseeko='$d_fseeko'
23172 d_fsetpos='$d_fsetpos'
23173 d_fstatfs='$d_fstatfs'
23174 d_fstatvfs='$d_fstatvfs'
23175 d_fsync='$d_fsync'
23176 d_ftello='$d_ftello'
23177 d_ftime='$d_ftime'
23178 d_futimes='$d_futimes'
23179 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
23180 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
23181 d_getaddrinfo='$d_getaddrinfo'
23182 d_getcwd='$d_getcwd'
23183 d_getespwnam='$d_getespwnam'
23184 d_getfsstat='$d_getfsstat'
23185 d_getgrent='$d_getgrent'
23186 d_getgrent_r='$d_getgrent_r'
23187 d_getgrgid_r='$d_getgrgid_r'
23188 d_getgrnam_r='$d_getgrnam_r'
23189 d_getgrps='$d_getgrps'
23190 d_gethbyaddr='$d_gethbyaddr'
23191 d_gethbyname='$d_gethbyname'
23192 d_gethent='$d_gethent'
23193 d_gethname='$d_gethname'
23194 d_gethostbyaddr_r='$d_gethostbyaddr_r'
23195 d_gethostbyname_r='$d_gethostbyname_r'
23196 d_gethostent_r='$d_gethostent_r'
23197 d_gethostprotos='$d_gethostprotos'
23198 d_getitimer='$d_getitimer'
23199 d_getlogin='$d_getlogin'
23200 d_getlogin_r='$d_getlogin_r'
23201 d_getmnt='$d_getmnt'
23202 d_getmntent='$d_getmntent'
23203 d_getnameinfo='$d_getnameinfo'
23204 d_getnbyaddr='$d_getnbyaddr'
23205 d_getnbyname='$d_getnbyname'
23206 d_getnent='$d_getnent'
23207 d_getnetbyaddr_r='$d_getnetbyaddr_r'
23208 d_getnetbyname_r='$d_getnetbyname_r'
23209 d_getnetent_r='$d_getnetent_r'
23210 d_getnetprotos='$d_getnetprotos'
23211 d_getpagsz='$d_getpagsz'
23212 d_getpbyname='$d_getpbyname'
23213 d_getpbynumber='$d_getpbynumber'
23214 d_getpent='$d_getpent'
23215 d_getpgid='$d_getpgid'
23216 d_getpgrp2='$d_getpgrp2'
23217 d_getpgrp='$d_getpgrp'
23218 d_getppid='$d_getppid'
23219 d_getprior='$d_getprior'
23220 d_getprotobyname_r='$d_getprotobyname_r'
23221 d_getprotobynumber_r='$d_getprotobynumber_r'
23222 d_getprotoent_r='$d_getprotoent_r'
23223 d_getprotoprotos='$d_getprotoprotos'
23224 d_getprpwnam='$d_getprpwnam'
23225 d_getpwent='$d_getpwent'
23226 d_getpwent_r='$d_getpwent_r'
23227 d_getpwnam_r='$d_getpwnam_r'
23228 d_getpwuid_r='$d_getpwuid_r'
23229 d_getsbyname='$d_getsbyname'
23230 d_getsbyport='$d_getsbyport'
23231 d_getsent='$d_getsent'
23232 d_getservbyname_r='$d_getservbyname_r'
23233 d_getservbyport_r='$d_getservbyport_r'
23234 d_getservent_r='$d_getservent_r'
23235 d_getservprotos='$d_getservprotos'
23236 d_getspnam='$d_getspnam'
23237 d_getspnam_r='$d_getspnam_r'
23238 d_gettimeod='$d_gettimeod'
23239 d_gmtime64='$d_gmtime64'
23240 d_gmtime_r='$d_gmtime_r'
23241 d_gnulibc='$d_gnulibc'
23242 d_grpasswd='$d_grpasswd'
23243 d_hasmntopt='$d_hasmntopt'
23244 d_htonl='$d_htonl'
23245 d_ilogbl='$d_ilogbl'
23246 d_inc_version_list='$d_inc_version_list'
23247 d_index='$d_index'
23248 d_inetaton='$d_inetaton'
23249 d_inetntop='$d_inetntop'
23250 d_inetpton='$d_inetpton'
23251 d_int64_t='$d_int64_t'
23252 d_ip_mreq='$d_ip_mreq'
23253 d_ip_mreq_source='$d_ip_mreq_source'
23254 d_ipv6_mreq='$d_ipv6_mreq'
23255 d_ipv6_mreq_source='$d_ipv6_mreq_source'
23256 d_isascii='$d_isascii'
23257 d_isblank='$d_isblank'
23258 d_isfinite='$d_isfinite'
23259 d_isinf='$d_isinf'
23260 d_isnan='$d_isnan'
23261 d_isnanl='$d_isnanl'
23262 d_killpg='$d_killpg'
23263 d_lchown='$d_lchown'
23264 d_ldbl_dig='$d_ldbl_dig'
23265 d_libm_lib_version='$d_libm_lib_version'
23266 d_libname_unique='$d_libname_unique'
23267 d_link='$d_link'
23268 d_localtime64='$d_localtime64'
23269 d_localtime_r='$d_localtime_r'
23270 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
23271 d_locconv='$d_locconv'
23272 d_lockf='$d_lockf'
23273 d_longdbl='$d_longdbl'
23274 d_longlong='$d_longlong'
23275 d_lseekproto='$d_lseekproto'
23276 d_lstat='$d_lstat'
23277 d_madvise='$d_madvise'
23278 d_malloc_good_size='$d_malloc_good_size'
23279 d_malloc_size='$d_malloc_size'
23280 d_mblen='$d_mblen'
23281 d_mbstowcs='$d_mbstowcs'
23282 d_mbtowc='$d_mbtowc'
23283 d_memchr='$d_memchr'
23284 d_memcmp='$d_memcmp'
23285 d_memcpy='$d_memcpy'
23286 d_memmove='$d_memmove'
23287 d_memset='$d_memset'
23288 d_mkdir='$d_mkdir'
23289 d_mkdtemp='$d_mkdtemp'
23290 d_mkfifo='$d_mkfifo'
23291 d_mkstemp='$d_mkstemp'
23292 d_mkstemps='$d_mkstemps'
23293 d_mktime64='$d_mktime64'
23294 d_mktime='$d_mktime'
23295 d_mmap='$d_mmap'
23296 d_modfl='$d_modfl'
23297 d_modfl_pow32_bug='$d_modfl_pow32_bug'
23298 d_modflproto='$d_modflproto'
23299 d_mprotect='$d_mprotect'
23300 d_msg='$d_msg'
23301 d_msg_ctrunc='$d_msg_ctrunc'
23302 d_msg_dontroute='$d_msg_dontroute'
23303 d_msg_oob='$d_msg_oob'
23304 d_msg_peek='$d_msg_peek'
23305 d_msg_proxy='$d_msg_proxy'
23306 d_msgctl='$d_msgctl'
23307 d_msgget='$d_msgget'
23308 d_msghdr_s='$d_msghdr_s'
23309 d_msgrcv='$d_msgrcv'
23310 d_msgsnd='$d_msgsnd'
23311 d_msync='$d_msync'
23312 d_munmap='$d_munmap'
23313 d_mymalloc='$d_mymalloc'
23314 d_ndbm='$d_ndbm'
23315 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
23316 d_nice='$d_nice'
23317 d_nl_langinfo='$d_nl_langinfo'
23318 d_nv_preserves_uv='$d_nv_preserves_uv'
23319 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
23320 d_off64_t='$d_off64_t'
23321 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
23322 d_oldpthreads='$d_oldpthreads'
23323 d_oldsock='$d_oldsock'
23324 d_open3='$d_open3'
23325 d_pathconf='$d_pathconf'
23326 d_pause='$d_pause'
23327 d_perl_otherlibdirs='$d_perl_otherlibdirs'
23328 d_phostname='$d_phostname'
23329 d_pipe='$d_pipe'
23330 d_poll='$d_poll'
23331 d_portable='$d_portable'
23332 d_prctl='$d_prctl'
23333 d_prctl_set_name='$d_prctl_set_name'
23334 d_printf_format_null='$d_printf_format_null'
23335 d_procselfexe='$d_procselfexe'
23336 d_pseudofork='$d_pseudofork'
23337 d_pthread_atfork='$d_pthread_atfork'
23338 d_pthread_attr_setscope='$d_pthread_attr_setscope'
23339 d_pthread_yield='$d_pthread_yield'
23340 d_pwage='$d_pwage'
23341 d_pwchange='$d_pwchange'
23342 d_pwclass='$d_pwclass'
23343 d_pwcomment='$d_pwcomment'
23344 d_pwexpire='$d_pwexpire'
23345 d_pwgecos='$d_pwgecos'
23346 d_pwpasswd='$d_pwpasswd'
23347 d_pwquota='$d_pwquota'
23348 d_qgcvt='$d_qgcvt'
23349 d_quad='$d_quad'
23350 d_random_r='$d_random_r'
23351 d_readdir64_r='$d_readdir64_r'
23352 d_readdir='$d_readdir'
23353 d_readdir_r='$d_readdir_r'
23354 d_readlink='$d_readlink'
23355 d_readv='$d_readv'
23356 d_recvmsg='$d_recvmsg'
23357 d_rename='$d_rename'
23358 d_rewinddir='$d_rewinddir'
23359 d_rmdir='$d_rmdir'
23360 d_safebcpy='$d_safebcpy'
23361 d_safemcpy='$d_safemcpy'
23362 d_sanemcmp='$d_sanemcmp'
23363 d_sbrkproto='$d_sbrkproto'
23364 d_scalbnl='$d_scalbnl'
23365 d_sched_yield='$d_sched_yield'
23366 d_scm_rights='$d_scm_rights'
23367 d_seekdir='$d_seekdir'
23368 d_select='$d_select'
23369 d_sem='$d_sem'
23370 d_semctl='$d_semctl'
23371 d_semctl_semid_ds='$d_semctl_semid_ds'
23372 d_semctl_semun='$d_semctl_semun'
23373 d_semget='$d_semget'
23374 d_semop='$d_semop'
23375 d_sendmsg='$d_sendmsg'
23376 d_setegid='$d_setegid'
23377 d_seteuid='$d_seteuid'
23378 d_setgrent='$d_setgrent'
23379 d_setgrent_r='$d_setgrent_r'
23380 d_setgrps='$d_setgrps'
23381 d_sethent='$d_sethent'
23382 d_sethostent_r='$d_sethostent_r'
23383 d_setitimer='$d_setitimer'
23384 d_setlinebuf='$d_setlinebuf'
23385 d_setlocale='$d_setlocale'
23386 d_setlocale_r='$d_setlocale_r'
23387 d_setnent='$d_setnent'
23388 d_setnetent_r='$d_setnetent_r'
23389 d_setpent='$d_setpent'
23390 d_setpgid='$d_setpgid'
23391 d_setpgrp2='$d_setpgrp2'
23392 d_setpgrp='$d_setpgrp'
23393 d_setprior='$d_setprior'
23394 d_setproctitle='$d_setproctitle'
23395 d_setprotoent_r='$d_setprotoent_r'
23396 d_setpwent='$d_setpwent'
23397 d_setpwent_r='$d_setpwent_r'
23398 d_setregid='$d_setregid'
23399 d_setresgid='$d_setresgid'
23400 d_setresuid='$d_setresuid'
23401 d_setreuid='$d_setreuid'
23402 d_setrgid='$d_setrgid'
23403 d_setruid='$d_setruid'
23404 d_setsent='$d_setsent'
23405 d_setservent_r='$d_setservent_r'
23406 d_setsid='$d_setsid'
23407 d_setvbuf='$d_setvbuf'
23408 d_shm='$d_shm'
23409 d_shmat='$d_shmat'
23410 d_shmatprototype='$d_shmatprototype'
23411 d_shmctl='$d_shmctl'
23412 d_shmdt='$d_shmdt'
23413 d_shmget='$d_shmget'
23414 d_sigaction='$d_sigaction'
23415 d_signbit='$d_signbit'
23416 d_sigprocmask='$d_sigprocmask'
23417 d_sigsetjmp='$d_sigsetjmp'
23418 d_sin6_scope_id='$d_sin6_scope_id'
23419 d_sitearch='$d_sitearch'
23420 d_snprintf='$d_snprintf'
23421 d_sockaddr_in6='$d_sockaddr_in6'
23422 d_sockaddr_sa_len='$d_sockaddr_sa_len'
23423 d_sockatmark='$d_sockatmark'
23424 d_sockatmarkproto='$d_sockatmarkproto'
23425 d_socket='$d_socket'
23426 d_socklen_t='$d_socklen_t'
23427 d_sockpair='$d_sockpair'
23428 d_socks5_init='$d_socks5_init'
23429 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
23430 d_sqrtl='$d_sqrtl'
23431 d_srand48_r='$d_srand48_r'
23432 d_srandom_r='$d_srandom_r'
23433 d_sresgproto='$d_sresgproto'
23434 d_sresuproto='$d_sresuproto'
23435 d_statblks='$d_statblks'
23436 d_statfs_f_flags='$d_statfs_f_flags'
23437 d_statfs_s='$d_statfs_s'
23438 d_static_inline='$d_static_inline'
23439 d_statvfs='$d_statvfs'
23440 d_stdio_cnt_lval='$d_stdio_cnt_lval'
23441 d_stdio_ptr_lval='$d_stdio_ptr_lval'
23442 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
23443 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
23444 d_stdio_stream_array='$d_stdio_stream_array'
23445 d_stdiobase='$d_stdiobase'
23446 d_stdstdio='$d_stdstdio'
23447 d_strchr='$d_strchr'
23448 d_strcoll='$d_strcoll'
23449 d_strctcpy='$d_strctcpy'
23450 d_strerrm='$d_strerrm'
23451 d_strerror='$d_strerror'
23452 d_strerror_r='$d_strerror_r'
23453 d_strftime='$d_strftime'
23454 d_strlcat='$d_strlcat'
23455 d_strlcpy='$d_strlcpy'
23456 d_strtod='$d_strtod'
23457 d_strtol='$d_strtol'
23458 d_strtold='$d_strtold'
23459 d_strtoll='$d_strtoll'
23460 d_strtoq='$d_strtoq'
23461 d_strtoul='$d_strtoul'
23462 d_strtoull='$d_strtoull'
23463 d_strtouq='$d_strtouq'
23464 d_strxfrm='$d_strxfrm'
23465 d_suidsafe='$d_suidsafe'
23466 d_symlink='$d_symlink'
23467 d_syscall='$d_syscall'
23468 d_syscallproto='$d_syscallproto'
23469 d_sysconf='$d_sysconf'
23470 d_sysernlst='$d_sysernlst'
23471 d_syserrlst='$d_syserrlst'
23472 d_system='$d_system'
23473 d_tcgetpgrp='$d_tcgetpgrp'
23474 d_tcsetpgrp='$d_tcsetpgrp'
23475 d_telldir='$d_telldir'
23476 d_telldirproto='$d_telldirproto'
23477 d_time='$d_time'
23478 d_timegm='$d_timegm'
23479 d_times='$d_times'
23480 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
23481 d_tm_tm_zone='$d_tm_tm_zone'
23482 d_tmpnam_r='$d_tmpnam_r'
23483 d_truncate='$d_truncate'
23484 d_ttyname_r='$d_ttyname_r'
23485 d_tzname='$d_tzname'
23486 d_u32align='$d_u32align'
23487 d_ualarm='$d_ualarm'
23488 d_umask='$d_umask'
23489 d_uname='$d_uname'
23490 d_union_semun='$d_union_semun'
23491 d_unordered='$d_unordered'
23492 d_unsetenv='$d_unsetenv'
23493 d_usleep='$d_usleep'
23494 d_usleepproto='$d_usleepproto'
23495 d_ustat='$d_ustat'
23496 d_vendorarch='$d_vendorarch'
23497 d_vendorbin='$d_vendorbin'
23498 d_vendorlib='$d_vendorlib'
23499 d_vendorscript='$d_vendorscript'
23500 d_vfork='$d_vfork'
23501 d_void_closedir='$d_void_closedir'
23502 d_voidsig='$d_voidsig'
23503 d_voidtty='$d_voidtty'
23504 d_volatile='$d_volatile'
23505 d_vprintf='$d_vprintf'
23506 d_vsnprintf='$d_vsnprintf'
23507 d_wait4='$d_wait4'
23508 d_waitpid='$d_waitpid'
23509 d_wcscmp='$d_wcscmp'
23510 d_wcstombs='$d_wcstombs'
23511 d_wcsxfrm='$d_wcsxfrm'
23512 d_wctomb='$d_wctomb'
23513 d_writev='$d_writev'
23514 d_xenix='$d_xenix'
23515 date='$date'
23516 db_hashtype='$db_hashtype'
23517 db_prefixtype='$db_prefixtype'
23518 db_version_major='$db_version_major'
23519 db_version_minor='$db_version_minor'
23520 db_version_patch='$db_version_patch'
23521 direntrytype='$direntrytype'
23522 dlext='$dlext'
23523 dlsrc='$dlsrc'
23524 doublesize='$doublesize'
23525 drand01='$drand01'
23526 drand48_r_proto='$drand48_r_proto'
23527 dtrace='$dtrace'
23528 dynamic_ext='$dynamic_ext'
23529 eagain='$eagain'
23530 ebcdic='$ebcdic'
23531 echo='$echo'
23532 egrep='$egrep'
23533 emacs='$emacs'
23534 endgrent_r_proto='$endgrent_r_proto'
23535 endhostent_r_proto='$endhostent_r_proto'
23536 endnetent_r_proto='$endnetent_r_proto'
23537 endprotoent_r_proto='$endprotoent_r_proto'
23538 endpwent_r_proto='$endpwent_r_proto'
23539 endservent_r_proto='$endservent_r_proto'
23540 eunicefix='$eunicefix'
23541 exe_ext='$exe_ext'
23542 expr='$expr'
23543 extensions='$extensions'
23544 extern_C='$extern_C'
23545 extras='$extras'
23546 fflushNULL='$fflushNULL'
23547 fflushall='$fflushall'
23548 find='$find'
23549 firstmakefile='$firstmakefile'
23550 flex='$flex'
23551 fpossize='$fpossize'
23552 fpostype='$fpostype'
23553 freetype='$freetype'
23554 from='$from'
23555 full_ar='$full_ar'
23556 full_csh='$full_csh'
23557 full_sed='$full_sed'
23558 gccansipedantic='$gccansipedantic'
23559 gccosandvers='$gccosandvers'
23560 gccversion='$gccversion'
23561 getgrent_r_proto='$getgrent_r_proto'
23562 getgrgid_r_proto='$getgrgid_r_proto'
23563 getgrnam_r_proto='$getgrnam_r_proto'
23564 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
23565 gethostbyname_r_proto='$gethostbyname_r_proto'
23566 gethostent_r_proto='$gethostent_r_proto'
23567 getlogin_r_proto='$getlogin_r_proto'
23568 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
23569 getnetbyname_r_proto='$getnetbyname_r_proto'
23570 getnetent_r_proto='$getnetent_r_proto'
23571 getprotobyname_r_proto='$getprotobyname_r_proto'
23572 getprotobynumber_r_proto='$getprotobynumber_r_proto'
23573 getprotoent_r_proto='$getprotoent_r_proto'
23574 getpwent_r_proto='$getpwent_r_proto'
23575 getpwnam_r_proto='$getpwnam_r_proto'
23576 getpwuid_r_proto='$getpwuid_r_proto'
23577 getservbyname_r_proto='$getservbyname_r_proto'
23578 getservbyport_r_proto='$getservbyport_r_proto'
23579 getservent_r_proto='$getservent_r_proto'
23580 getspnam_r_proto='$getspnam_r_proto'
23581 gidformat='$gidformat'
23582 gidsign='$gidsign'
23583 gidsize='$gidsize'
23584 gidtype='$gidtype'
23585 glibpth='$glibpth'
23586 gmake='$gmake'
23587 gmtime_r_proto='$gmtime_r_proto'
23588 gnulibc_version='$gnulibc_version'
23589 grep='$grep'
23590 groupcat='$groupcat'
23591 groupstype='$groupstype'
23592 gzip='$gzip'
23593 h_fcntl='$h_fcntl'
23594 h_sysfile='$h_sysfile'
23595 hint='$hint'
23596 hostcat='$hostcat'
23597 hostgenerate='$hostgenerate'
23598 hostosname='$hostosname'
23599 hostperl='$hostperl'
23600 html1dir='$html1dir'
23601 html1direxp='$html1direxp'
23602 html3dir='$html3dir'
23603 html3direxp='$html3direxp'
23604 i16size='$i16size'
23605 i16type='$i16type'
23606 i32size='$i32size'
23607 i32type='$i32type'
23608 i64size='$i64size'
23609 i64type='$i64type'
23610 i8size='$i8size'
23611 i8type='$i8type'
23612 i_arpainet='$i_arpainet'
23613 i_assert='$i_assert'
23614 i_bfd='$i_bfd'
23615 i_bsdioctl='$i_bsdioctl'
23616 i_crypt='$i_crypt'
23617 i_db='$i_db'
23618 i_dbm='$i_dbm'
23619 i_dirent='$i_dirent'
23620 i_dlfcn='$i_dlfcn'
23621 i_execinfo='$i_execinfo'
23622 i_fcntl='$i_fcntl'
23623 i_float='$i_float'
23624 i_fp='$i_fp'
23625 i_fp_class='$i_fp_class'
23626 i_gdbm='$i_gdbm'
23627 i_gdbm_ndbm='$i_gdbm_ndbm'
23628 i_gdbmndbm='$i_gdbmndbm'
23629 i_grp='$i_grp'
23630 i_ieeefp='$i_ieeefp'
23631 i_inttypes='$i_inttypes'
23632 i_langinfo='$i_langinfo'
23633 i_libutil='$i_libutil'
23634 i_limits='$i_limits'
23635 i_locale='$i_locale'
23636 i_machcthr='$i_machcthr'
23637 i_malloc='$i_malloc'
23638 i_mallocmalloc='$i_mallocmalloc'
23639 i_math='$i_math'
23640 i_memory='$i_memory'
23641 i_mntent='$i_mntent'
23642 i_ndbm='$i_ndbm'
23643 i_netdb='$i_netdb'
23644 i_neterrno='$i_neterrno'
23645 i_netinettcp='$i_netinettcp'
23646 i_niin='$i_niin'
23647 i_poll='$i_poll'
23648 i_prot='$i_prot'
23649 i_pthread='$i_pthread'
23650 i_pwd='$i_pwd'
23651 i_rpcsvcdbm='$i_rpcsvcdbm'
23652 i_sgtty='$i_sgtty'
23653 i_shadow='$i_shadow'
23654 i_socks='$i_socks'
23655 i_stdarg='$i_stdarg'
23656 i_stdbool='$i_stdbool'
23657 i_stddef='$i_stddef'
23658 i_stdlib='$i_stdlib'
23659 i_string='$i_string'
23660 i_sunmath='$i_sunmath'
23661 i_sysaccess='$i_sysaccess'
23662 i_sysdir='$i_sysdir'
23663 i_sysfile='$i_sysfile'
23664 i_sysfilio='$i_sysfilio'
23665 i_sysin='$i_sysin'
23666 i_sysioctl='$i_sysioctl'
23667 i_syslog='$i_syslog'
23668 i_sysmman='$i_sysmman'
23669 i_sysmode='$i_sysmode'
23670 i_sysmount='$i_sysmount'
23671 i_sysndir='$i_sysndir'
23672 i_sysparam='$i_sysparam'
23673 i_syspoll='$i_syspoll'
23674 i_sysresrc='$i_sysresrc'
23675 i_syssecrt='$i_syssecrt'
23676 i_sysselct='$i_sysselct'
23677 i_syssockio='$i_syssockio'
23678 i_sysstat='$i_sysstat'
23679 i_sysstatfs='$i_sysstatfs'
23680 i_sysstatvfs='$i_sysstatvfs'
23681 i_systime='$i_systime'
23682 i_systimek='$i_systimek'
23683 i_systimes='$i_systimes'
23684 i_systypes='$i_systypes'
23685 i_sysuio='$i_sysuio'
23686 i_sysun='$i_sysun'
23687 i_sysutsname='$i_sysutsname'
23688 i_sysvfs='$i_sysvfs'
23689 i_syswait='$i_syswait'
23690 i_termio='$i_termio'
23691 i_termios='$i_termios'
23692 i_time='$i_time'
23693 i_unistd='$i_unistd'
23694 i_ustat='$i_ustat'
23695 i_utime='$i_utime'
23696 i_values='$i_values'
23697 i_varargs='$i_varargs'
23698 i_varhdr='$i_varhdr'
23699 i_vfork='$i_vfork'
23700 ignore_versioned_solibs='$ignore_versioned_solibs'
23701 inc_version_list='$inc_version_list'
23702 inc_version_list_init='$inc_version_list_init'
23703 incpath='$incpath'
23704 incpth='$incpth'
23705 inews='$inews'
23706 initialinstalllocation='$initialinstalllocation'
23707 installarchlib='$installarchlib'
23708 installbin='$installbin'
23709 installhtml1dir='$installhtml1dir'
23710 installhtml3dir='$installhtml3dir'
23711 installman1dir='$installman1dir'
23712 installman3dir='$installman3dir'
23713 installprefix='$installprefix'
23714 installprefixexp='$installprefixexp'
23715 installprivlib='$installprivlib'
23716 installscript='$installscript'
23717 installsitearch='$installsitearch'
23718 installsitebin='$installsitebin'
23719 installsitehtml1dir='$installsitehtml1dir'
23720 installsitehtml3dir='$installsitehtml3dir'
23721 installsitelib='$installsitelib'
23722 installsiteman1dir='$installsiteman1dir'
23723 installsiteman3dir='$installsiteman3dir'
23724 installsitescript='$installsitescript'
23725 installstyle='$installstyle'
23726 installusrbinperl='$installusrbinperl'
23727 installvendorarch='$installvendorarch'
23728 installvendorbin='$installvendorbin'
23729 installvendorhtml1dir='$installvendorhtml1dir'
23730 installvendorhtml3dir='$installvendorhtml3dir'
23731 installvendorlib='$installvendorlib'
23732 installvendorman1dir='$installvendorman1dir'
23733 installvendorman3dir='$installvendorman3dir'
23734 installvendorscript='$installvendorscript'
23735 intsize='$intsize'
23736 issymlink='$issymlink'
23737 ivdformat='$ivdformat'
23738 ivsize='$ivsize'
23739 ivtype='$ivtype'
23740 known_extensions='$known_extensions'
23741 ksh='$ksh'
23742 ld='$ld'
23743 ld_can_script='$ld_can_script'
23744 lddlflags='$lddlflags'
23745 ldflags='$ldflags'
23746 ldflags_uselargefiles='$ldflags_uselargefiles'
23747 ldlibpthname='$ldlibpthname'
23748 less='$less'
23749 lib_ext='$lib_ext'
23750 libc='$libc'
23751 libperl='$libperl'
23752 libpth='$libpth'
23753 libs='$libs'
23754 libsdirs='$libsdirs'
23755 libsfiles='$libsfiles'
23756 libsfound='$libsfound'
23757 libspath='$libspath'
23758 libswanted='$libswanted'
23759 libswanted_uselargefiles='$libswanted_uselargefiles'
23760 line='$line'
23761 lint='$lint'
23762 lkflags='$lkflags'
23763 ln='$ln'
23764 lns='$lns'
23765 localtime_r_proto='$localtime_r_proto'
23766 locincpth='$locincpth'
23767 loclibpth='$loclibpth'
23768 longdblsize='$longdblsize'
23769 longlongsize='$longlongsize'
23770 longsize='$longsize'
23771 lp='$lp'
23772 lpr='$lpr'
23773 ls='$ls'
23774 lseeksize='$lseeksize'
23775 lseektype='$lseektype'
23776 mad='$mad'
23777 madlyh='$madlyh'
23778 madlyobj='$madlyobj'
23779 madlysrc='$madlysrc'
23780 mail='$mail'
23781 mailx='$mailx'
23782 make='$make'
23783 make_set_make='$make_set_make'
23784 mallocobj='$mallocobj'
23785 mallocsrc='$mallocsrc'
23786 malloctype='$malloctype'
23787 man1dir='$man1dir'
23788 man1direxp='$man1direxp'
23789 man1ext='$man1ext'
23790 man3dir='$man3dir'
23791 man3direxp='$man3direxp'
23792 man3ext='$man3ext'
23793 mips_type='$mips_type'
23794 mistrustnm='$mistrustnm'
23795 mkdir='$mkdir'
23796 mmaptype='$mmaptype'
23797 modetype='$modetype'
23798 more='$more'
23799 multiarch='$multiarch'
23800 mv='$mv'
23801 myarchname='$myarchname'
23802 mydomain='$mydomain'
23803 myhostname='$myhostname'
23804 myuname='$myuname'
23805 n='$n'
23806 need_va_copy='$need_va_copy'
23807 netdb_hlen_type='$netdb_hlen_type'
23808 netdb_host_type='$netdb_host_type'
23809 netdb_name_type='$netdb_name_type'
23810 netdb_net_type='$netdb_net_type'
23811 nm='$nm'
23812 nm_opt='$nm_opt'
23813 nm_so_opt='$nm_so_opt'
23814 nonxs_ext='$nonxs_ext'
23815 nroff='$nroff'
23816 nvEUformat='$nvEUformat'
23817 nvFUformat='$nvFUformat'
23818 nvGUformat='$nvGUformat'
23819 nv_overflows_integers_at='$nv_overflows_integers_at'
23820 nv_preserves_uv_bits='$nv_preserves_uv_bits'
23821 nveformat='$nveformat'
23822 nvfformat='$nvfformat'
23823 nvgformat='$nvgformat'
23824 nvsize='$nvsize'
23825 nvtype='$nvtype'
23826 o_nonblock='$o_nonblock'
23827 obj_ext='$obj_ext'
23828 old_pthread_create_joinable='$old_pthread_create_joinable'
23829 optimize='$optimize'
23830 orderlib='$orderlib'
23831 osname='$osname'
23832 osvers='$osvers'
23833 otherlibdirs='$otherlibdirs'
23834 package='$package'
23835 pager='$pager'
23836 passcat='$passcat'
23837 patchlevel='$patchlevel'
23838 path_sep='$path_sep'
23839 perl5='$perl5'
23840 perl='$perl'
23841 perl_patchlevel='$perl_patchlevel'
23842 perl_static_inline='$perl_static_inline'
23843 perladmin='$perladmin'
23844 perllibs='$perllibs'
23845 perlpath='$perlpath'
23846 pg='$pg'
23847 phostname='$phostname'
23848 pidtype='$pidtype'
23849 plibpth='$plibpth'
23850 pmake='$pmake'
23851 pr='$pr'
23852 prefix='$prefix'
23853 prefixexp='$prefixexp'
23854 privlib='$privlib'
23855 privlibexp='$privlibexp'
23856 procselfexe='$procselfexe'
23857 prototype='$prototype'
23858 ptrsize='$ptrsize'
23859 quadkind='$quadkind'
23860 quadtype='$quadtype'
23861 randbits='$randbits'
23862 randfunc='$randfunc'
23863 random_r_proto='$random_r_proto'
23864 randseedtype='$randseedtype'
23865 ranlib='$ranlib'
23866 rd_nodata='$rd_nodata'
23867 readdir64_r_proto='$readdir64_r_proto'
23868 readdir_r_proto='$readdir_r_proto'
23869 revision='$revision'
23870 rm='$rm'
23871 rm_try='$rm_try'
23872 rmail='$rmail'
23873 run='$run'
23874 runnm='$runnm'
23875 sGMTIME_max='$sGMTIME_max'
23876 sGMTIME_min='$sGMTIME_min'
23877 sLOCALTIME_max='$sLOCALTIME_max'
23878 sLOCALTIME_min='$sLOCALTIME_min'
23879 sPRIEUldbl='$sPRIEUldbl'
23880 sPRIFUldbl='$sPRIFUldbl'
23881 sPRIGUldbl='$sPRIGUldbl'
23882 sPRIXU64='$sPRIXU64'
23883 sPRId64='$sPRId64'
23884 sPRIeldbl='$sPRIeldbl'
23885 sPRIfldbl='$sPRIfldbl'
23886 sPRIgldbl='$sPRIgldbl'
23887 sPRIi64='$sPRIi64'
23888 sPRIo64='$sPRIo64'
23889 sPRIu64='$sPRIu64'
23890 sPRIx64='$sPRIx64'
23891 sSCNfldbl='$sSCNfldbl'
23892 sched_yield='$sched_yield'
23893 scriptdir='$scriptdir'
23894 scriptdirexp='$scriptdirexp'
23895 sed='$sed'
23896 seedfunc='$seedfunc'
23897 selectminbits='$selectminbits'
23898 selecttype='$selecttype'
23899 sendmail='$sendmail'
23900 setgrent_r_proto='$setgrent_r_proto'
23901 sethostent_r_proto='$sethostent_r_proto'
23902 setlocale_r_proto='$setlocale_r_proto'
23903 setnetent_r_proto='$setnetent_r_proto'
23904 setprotoent_r_proto='$setprotoent_r_proto'
23905 setpwent_r_proto='$setpwent_r_proto'
23906 setservent_r_proto='$setservent_r_proto'
23907 sh='$sh'
23908 shar='$shar'
23909 sharpbang='$sharpbang'
23910 shmattype='$shmattype'
23911 shortsize='$shortsize'
23912 shrpenv='$shrpenv'
23913 shsharp='$shsharp'
23914 sig_count='$sig_count'
23915 sig_name='$sig_name'
23916 sig_name_init='$sig_name_init'
23917 sig_num='$sig_num'
23918 sig_num_init='$sig_num_init'
23919 sig_size='$sig_size'
23920 signal_t='$signal_t'
23921 sitearch='$sitearch'
23922 sitearchexp='$sitearchexp'
23923 sitebin='$sitebin'
23924 sitebinexp='$sitebinexp'
23925 sitehtml1dir='$sitehtml1dir'
23926 sitehtml1direxp='$sitehtml1direxp'
23927 sitehtml3dir='$sitehtml3dir'
23928 sitehtml3direxp='$sitehtml3direxp'
23929 sitelib='$sitelib'
23930 sitelib_stem='$sitelib_stem'
23931 sitelibexp='$sitelibexp'
23932 siteman1dir='$siteman1dir'
23933 siteman1direxp='$siteman1direxp'
23934 siteman3dir='$siteman3dir'
23935 siteman3direxp='$siteman3direxp'
23936 siteprefix='$siteprefix'
23937 siteprefixexp='$siteprefixexp'
23938 sitescript='$sitescript'
23939 sitescriptexp='$sitescriptexp'
23940 sizesize='$sizesize'
23941 sizetype='$sizetype'
23942 sleep='$sleep'
23943 smail='$smail'
23944 so='$so'
23945 sockethdr='$sockethdr'
23946 socketlib='$socketlib'
23947 socksizetype='$socksizetype'
23948 sort='$sort'
23949 spackage='$spackage'
23950 spitshell='$spitshell'
23951 srand48_r_proto='$srand48_r_proto'
23952 srandom_r_proto='$srandom_r_proto'
23953 src='$src'
23954 ssizetype='$ssizetype'
23955 st_ino_sign='$st_ino_sign'
23956 st_ino_size='$st_ino_size'
23957 startperl='$startperl'
23958 startsh='$startsh'
23959 static_ext='$static_ext'
23960 stdchar='$stdchar'
23961 stdio_base='$stdio_base'
23962 stdio_bufsiz='$stdio_bufsiz'
23963 stdio_cnt='$stdio_cnt'
23964 stdio_filbuf='$stdio_filbuf'
23965 stdio_ptr='$stdio_ptr'
23966 stdio_stream_array='$stdio_stream_array'
23967 strerror_r_proto='$strerror_r_proto'
23968 strings='$strings'
23969 submit='$submit'
23970 subversion='$subversion'
23971 sysman='$sysman'
23972 sysroot='$sysroot'
23973 tail='$tail'
23974 tar='$tar'
23975 targetarch='$targetarch'
23976 targetdir='$targetdir'
23977 targetenv='$targetenv'
23978 targethost='$targethost'
23979 targetmkdir='$targetmkdir'
23980 targetport='$targetport'
23981 targetsh='$targetsh'
23982 tbl='$tbl'
23983 tee='$tee'
23984 test='$test'
23985 timeincl='$timeincl'
23986 timetype='$timetype'
23987 tmpnam_r_proto='$tmpnam_r_proto'
23988 to='$to'
23989 touch='$touch'
23990 tr='$tr'
23991 trnl='$trnl'
23992 troff='$troff'
23993 ttyname_r_proto='$ttyname_r_proto'
23994 u16size='$u16size'
23995 u16type='$u16type'
23996 u32size='$u32size'
23997 u32type='$u32type'
23998 u64size='$u64size'
23999 u64type='$u64type'
24000 u8size='$u8size'
24001 u8type='$u8type'
24002 uidformat='$uidformat'
24003 uidsign='$uidsign'
24004 uidsize='$uidsize'
24005 uidtype='$uidtype'
24006 uname='$uname'
24007 uniq='$uniq'
24008 uquadtype='$uquadtype'
24009 use5005threads='$use5005threads'
24010 use64bitall='$use64bitall'
24011 use64bitint='$use64bitint'
24012 usecbacktrace='$usecbacktrace'
24013 usecrosscompile='$usecrosscompile'
24014 usedevel='$usedevel'
24015 usedl='$usedl'
24016 usedtrace='$usedtrace'
24017 usefaststdio='$usefaststdio'
24018 useithreads='$useithreads'
24019 usekernprocpathname='$usekernprocpathname'
24020 uselargefiles='$uselargefiles'
24021 uselongdouble='$uselongdouble'
24022 usemallocwrap='$usemallocwrap'
24023 usemorebits='$usemorebits'
24024 usemultiplicity='$usemultiplicity'
24025 usemymalloc='$usemymalloc'
24026 usenm='$usenm'
24027 usensgetexecutablepath='$usensgetexecutablepath'
24028 useopcode='$useopcode'
24029 useperlio='$useperlio'
24030 useposix='$useposix'
24031 usereentrant='$usereentrant'
24032 userelocatableinc='$userelocatableinc'
24033 useshrplib='$useshrplib'
24034 usesitecustomize='$usesitecustomize'
24035 usesocks='$usesocks'
24036 usethreads='$usethreads'
24037 usevendorprefix='$usevendorprefix'
24038 useversionedarchname='$useversionedarchname'
24039 usevfork='$usevfork'
24040 usrinc='$usrinc'
24041 uuname='$uuname'
24042 uvXUformat='$uvXUformat'
24043 uvoformat='$uvoformat'
24044 uvsize='$uvsize'
24045 uvtype='$uvtype'
24046 uvuformat='$uvuformat'
24047 uvxformat='$uvxformat'
24048 vaproto='$vaproto'
24049 vendorarch='$vendorarch'
24050 vendorarchexp='$vendorarchexp'
24051 vendorbin='$vendorbin'
24052 vendorbinexp='$vendorbinexp'
24053 vendorhtml1dir='$vendorhtml1dir'
24054 vendorhtml1direxp='$vendorhtml1direxp'
24055 vendorhtml3dir='$vendorhtml3dir'
24056 vendorhtml3direxp='$vendorhtml3direxp'
24057 vendorlib='$vendorlib'
24058 vendorlib_stem='$vendorlib_stem'
24059 vendorlibexp='$vendorlibexp'
24060 vendorman1dir='$vendorman1dir'
24061 vendorman1direxp='$vendorman1direxp'
24062 vendorman3dir='$vendorman3dir'
24063 vendorman3direxp='$vendorman3direxp'
24064 vendorprefix='$vendorprefix'
24065 vendorprefixexp='$vendorprefixexp'
24066 vendorscript='$vendorscript'
24067 vendorscriptexp='$vendorscriptexp'
24068 version='$version'
24069 version_patchlevel_string='$version_patchlevel_string'
24070 versiononly='$versiononly'
24071 vi='$vi'
24072 xlibpth='$xlibpth'
24073 yacc='$yacc'
24074 yaccflags='$yaccflags'
24075 zcat='$zcat'
24076 zip='$zip'
24077 EOT
24078
24079 : add special variables
24080 $test -f $src/patchlevel.h && \
24081 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
24082 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
24083 echo "PERL_CONFIG_SH=true" >>config.sh
24084
24085 : propagate old symbols
24086 if $test -f UU/config.sh; then
24087         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
24088         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
24089                 config.sh config.sh UU/oldconfig.sh |\
24090                 $sort | $uniq -u >UU/oldsyms
24091         set X `$cat UU/oldsyms`
24092         shift
24093         case $# in
24094         0) ;;
24095         *)
24096                 $cat <<EOM
24097 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
24098 EOM
24099                 echo ": Variables propagated from previous config.sh file." >>config.sh
24100                 for sym in `$cat UU/oldsyms`; do
24101                         echo "    Propagating $hint variable "'$'"$sym..."
24102                         eval 'tmp="$'"${sym}"'"'
24103                         echo "$tmp" | \
24104                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
24105                 done
24106                 ;;
24107         esac
24108 fi
24109
24110 : preserve RCS keywords in files with variable substitution, grrr
24111 Id='$Id'
24112
24113 : Finish up by extracting the .SH files
24114 case "$alldone" in
24115 exit)
24116         $rm -rf UU
24117         echo "Extraction done."
24118         exit 0
24119         ;;
24120 cont)
24121         ;;
24122 '')
24123         dflt=''
24124         nostick=true
24125         $cat <<EOM
24126
24127 If you'd like to make any changes to the config.sh file before I begin
24128 to configure things, do it as a shell escape now (e.g. !vi config.sh).
24129
24130 EOM
24131         rp="Press return or use a shell escape to edit config.sh:"
24132         . UU/myread
24133         nostick=''
24134         case "$ans" in
24135         '') ;;
24136         *) : in case they cannot read
24137                 sh 1>&4 -c "$ans";;
24138         esac
24139         ;;
24140 esac
24141
24142 : if this fails, just run all the .SH files by hand
24143 . ./config.sh
24144
24145 echo " "
24146 exec 1>&4
24147 pwd=`pwd`
24148 . ./UU/extract
24149 cd "$pwd"
24150
24151 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
24152         dflt=y
24153         case "$silent" in
24154         true) ;;
24155         *)
24156                 $cat <<EOM
24157
24158 Now you need to generate make dependencies by running "$make depend".
24159 You might prefer to run it in background: "$make depend > makedepend.out &"
24160 It can take a while, so you might not want to run it right now.
24161
24162 EOM
24163                 ;;
24164         esac
24165         rp="Run $make depend now?"
24166         . UU/myread
24167         case "$ans" in
24168         y*)
24169                 $make depend && echo "Now you must run '$make'."
24170                 ;;
24171         *)
24172                 echo "You must run '$make depend' then '$make'."
24173                 ;;
24174         esac
24175 elif test -f [Mm]akefile; then
24176         echo " "
24177         echo "Now you must run a $make."
24178 else
24179         echo "Configure done."
24180 fi
24181
24182 if $test -f Policy.sh; then
24183     $cat <<EOM
24184
24185 If you compile $package on a different machine or from a different object
24186 directory, copy the Policy.sh file from this object directory to the
24187 new one before you run Configure -- this will help you with most of
24188 the policy defaults.
24189
24190 EOM
24191 fi
24192 if $test -f config.msg; then
24193     echo "Hmm.  I also noted the following information while running:"
24194     echo " "
24195     $cat config.msg >&4
24196     $rm -f config.msg
24197 fi
24198 $rm -f kit*isdone ark*isdone
24199 $rm -rf UU
24200
24201 : End of Configure
24202