This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade to Module::CoreList 2.05
[perl5.git] / Configure
CommitLineData
2304df62
AD
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-3.0 package (which contains metaconfig) was posted in
dfe9444c
AD
17# comp.sources.misc and is available on CPAN under authors/id/RAM so
18# you may fetch it yourself from your nearest archive site.)
2304df62 19#
5cadb3f3
MB
20#
21# Though this script was generated by metaconfig, it is OK to send
22# patches against it. It's up to the Configure pumpkin to backport
23# the patch to the metaunits if it is accepted.
24# See Porting/pumpkin.pod for more information on metaconfig.
25#
2304df62 26
dfe9444c 27# $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
2304df62 28#
a2d23ec2 29# Generated on Mon May 22 19:21:39 CEST 2006 [metaconfig 3.0 PL70]
7f2de2d2 30# (with additional metaconfig patches by perlbug@perl.org)
2304df62 31
283fdd21 32cat >c1$$ <<EOF
2304df62
AD
33ARGGGHHHH!!!!!
34
35SCO csh still thinks true is false. Write to SCO today and tell them that next
36year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
37
38(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
39we'd have to do is go in and swap the && and || tokens, wherever they are.)
40
41[End of diatribe. We now return you to your regularly scheduled programming...]
42EOF
283fdd21 43cat >c2$$ <<EOF
2304df62
AD
44
45OOPS! You naughty creature! You didn't run Configure with sh!
46I will attempt to remedy the situation by running sh for you...
47EOF
48
283fdd21 49true || cat c1$$ c2$$
2304df62
AD
50true || exec sh $0 $argv:q
51
283fdd21 52(exit $?0) || cat c2$$
2304df62 53(exit $?0) || exec sh $0 $argv:q
283fdd21 54rm -f c1$$ c2$$
2304df62 55
f6538904 56if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
cbee2ce6
JH
57 cat >&4 <<EOF
58***
59*** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
60*** Configure that well. (Plan 9 is close to UNIX but not close enough.)
61*** Please read the README.plan9 for further instructions.
62*** Cannot continue, aborting.
63***
64EOF
65 exit 1
66fi
67
a0d0e21e
LW
68: compute my invocation name
69me=$0
70case "$0" in
71*/*)
72 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
73 test "$me" || me=$0
74 ;;
75esac
76
dfe9444c 77: Proper separator for the PATH environment variable
8e07c86e
AD
78p_=:
79: On OS/2 this directory should exist if this is not floppy only system :-]
5c728af0 80if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
dfe9444c
AD
81 if test -n "$OS2_SHELL"; then
82 p_=\;
83 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
84 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
5c728af0 85 is_os2=yes
c4f23d77 86 elif test -n "$DJGPP"; then
495e2cbe
MB
87 case "X${MACHTYPE:-nonesuchmach}" in
88 *cygwin) ;;
89 *) p_=\; ;;
90 esac
dfe9444c 91 fi
39e571d4 92fi
a0d0e21e
LW
93
94: Proper PATH setting
95paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
16d20bd9 96paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
232e078e 97paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
16d20bd9 98paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
232e078e 99paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
87bdd940 100paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
232e078e
AD
101paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
102paths="$paths /sbin /usr/sbin /usr/libexec"
3c728e00 103paths="$paths /system/gnu_library/bin"
a0d0e21e
LW
104
105for p in $paths
106do
8e07c86e
AD
107 case "$p_$PATH$p_" in
108 *$p_$p$p_*) ;;
109 *) test -d $p && PATH=$PATH$p_$p ;;
a0d0e21e
LW
110 esac
111done
112
8e07c86e 113PATH=.$p_$PATH
2304df62
AD
114export PATH
115
dfe9444c
AD
116: shall we be using ksh?
117inksh=''
118needksh=''
119avoidksh=''
120newsh=/bin/ksh
121changesh=''
ff0cee69 122if (PATH=.; alias -x) >/dev/null 2>&1; then
dfe9444c
AD
123 inksh=true
124fi
125if test -f /hp-ux -a -f /bin/ksh; then
126 needksh='to avoid sh bug in "here document" expansion'
127fi
128if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
129 if test X`/usr/bin/uname -v` = X4; then
130 avoidksh="to avoid AIX 4's /bin/sh"
131 newsh=/usr/bin/bsh
2304df62 132 fi
dfe9444c 133fi
cf04f91f
JH
134if test -f /osf_boot -a -f /usr/sbin/setld; then
135 if test X`/usr/bin/uname -s` = XOSF1; then
136 avoidksh="to avoid Digital UNIX' ksh"
137 newsh=/bin/sh
138 unset BIN_SH # if this is 'xpg4' sh will start up ksh
139 fi
140fi
dfe9444c
AD
141case "$inksh/$needksh" in
142/[a-z]*)
c4f23d77 143 ENV=''
dfe9444c
AD
144 changesh=true
145 reason="$needksh"
146 ;;
147esac
148case "$inksh/$avoidksh" in
149true/[a-z]*)
150 changesh=true
151 reason="$avoidksh"
152 ;;
153esac
154case "$inksh/$needksh-$avoidksh-" in
155true/--)
a0d0e21e
LW
156 cat <<EOM
157(I see you are using the Korn shell. Some ksh's blow up on $me,
dfe9444c 158mainly on older exotic systems. If yours does, try the Bourne shell instead.)
ff0cee69 159EOM
dfe9444c
AD
160 ;;
161esac
162case "$changesh" in
163true)
2e2a97a6 164 export newsh
dfe9444c
AD
165 echo "(Feeding myself to $newsh $reason.)"
166 case "$0" in
167 Configure|*/Configure) exec $newsh $0 "$@";;
168 *) exec $newsh Configure "$@";;
169 esac
170 ;;
171esac
2304df62 172
bfb7748a
AD
173: if needed set CDPATH to a harmless value that is not chatty
174: avoid bash 2.02 problems with empty CDPATH.
175case "$CDPATH" in
176'') ;;
177*) case "$SHELL" in
178 *bash*) CDPATH='.' ;;
179 *) CDPATH='' ;;
180 esac
181 ;;
182esac
2304df62
AD
183: Configure runs within the UU subdirectory
184test -d UU || mkdir UU
8e07c86e 185cd UU && rm -f ./*
2304df62 186
6b356c8e
JH
187ccname=''
188ccversion=''
b4eb6b3d
JH
189ccsymbols=''
190cppccsymbols=''
191cppsymbols=''
5440bc8e
JH
192from=''
193run=''
194targetarch=''
195to=''
196usecrosscompile=''
6b34ded5 197mistrustnm=''
9c839522 198perllibs=''
b4eb6b3d
JH
199dynamic_ext=''
200extensions=''
201known_extensions=''
202nonxs_ext=''
203static_ext=''
204useopcode=''
205useposix=''
6fcddf3b 206extras=''
ecfc5424 207d_bsd=''
40a7a20a 208d_eunice=''
2304df62
AD
209d_xenix=''
210eunicefix=''
211Mcc=''
dfe9444c 212ar=''
2304df62
AD
213awk=''
214bash=''
215bison=''
216byacc=''
217cat=''
218chgrp=''
219chmod=''
220chown=''
ecfc5424 221comm=''
2304df62
AD
222compress=''
223cp=''
224cpio=''
225cpp=''
226csh=''
227date=''
228echo=''
229egrep=''
230emacs=''
231expr=''
232find=''
233flex=''
3c728e00 234gmake=''
2304df62 235grep=''
8ff267be 236gzip=''
2304df62
AD
237inews=''
238ksh=''
239less=''
240line=''
241lint=''
242ln=''
243lp=''
244lpr=''
245ls=''
246mail=''
247mailx=''
dfe9444c 248make=''
2304df62
AD
249mkdir=''
250more=''
251mv=''
693762b4 252nm=''
2304df62
AD
253nroff=''
254perl=''
255pg=''
256pmake=''
257pr=''
258rm=''
259rmail=''
260sed=''
261sendmail=''
2304df62
AD
262shar=''
263sleep=''
264smail=''
265sort=''
266submit=''
267tail=''
268tar=''
269tbl=''
693762b4 270tee=''
2304df62
AD
271test=''
272touch=''
273tr=''
274troff=''
275uname=''
276uniq=''
277uuname=''
278vi=''
279zcat=''
8ff267be 280zip=''
b4eb6b3d
JH
281full_ar=''
282full_sed=''
a0d0e21e 283libswanted=''
2304df62
AD
284hint=''
285myuname=''
85e6fe83
LW
286osname=''
287osvers=''
2304df62
AD
288Author=''
289Date=''
290Header=''
291Id=''
292Locker=''
293Log=''
294RCSfile=''
295Revision=''
296Source=''
297State=''
dfe9444c
AD
298_a=''
299_exe=''
300_o=''
4633a7c4
LW
301archobjs=''
302exe_ext=''
303firstmakefile=''
304lib_ext=''
305obj_ext=''
306path_sep=''
b4eb6b3d 307afs=''
a6d26a0d 308afsroot=''
b4eb6b3d
JH
309alignbytes=''
310ansi2knr=''
311archlib=''
312archlibexp=''
313d_archlib=''
314installarchlib=''
315archname=''
316myarchname=''
317d_atolf=''
318d_atoll=''
319baserev=''
320bin=''
321binexp=''
f3f1a2d8 322initialinstalllocation=''
b4eb6b3d 323installbin=''
f3f1a2d8 324userelocatableinc=''
b4eb6b3d 325byteorder=''
2304df62 326cc=''
2304df62
AD
327ccflags=''
328cppflags=''
329ldflags=''
330lkflags=''
8e07c86e 331locincpth=''
2304df62 332optimize=''
b4eb6b3d 333cf_email=''
2304df62
AD
334cf_by=''
335cf_time=''
b4eb6b3d 336charsize=''
2304df62 337contains=''
b4eb6b3d 338cpp_stuff=''
2304df62
AD
339cpplast=''
340cppminus=''
341cpprun=''
342cppstdin=''
74cac757 343d__fwalk=''
b4eb6b3d
JH
344d_access=''
345d_accessx=''
55954f19 346d_aintl=''
b4eb6b3d 347d_alarm=''
10bc17b6
JH
348asctime_r_proto=''
349d_asctime_r=''
0dbb1585
AL
350d_attribute_format=''
351d_attribute_malloc=''
352d_attribute_nonnull=''
353d_attribute_noreturn=''
354d_attribute_pure=''
355d_attribute_unused=''
356d_attribute_warn_unused_result=''
b4eb6b3d
JH
357d_bcmp=''
358d_bcopy=''
635aebb7
AL
359d_builtin_choose_expr=''
360d_builtin_expect=''
b4eb6b3d 361d_bzero=''
a2d23ec2 362d_c99_variadic_macros=''
b4eb6b3d
JH
363d_casti32=''
364castflags=''
365d_castneg=''
366d_chown=''
367d_chroot=''
368d_chsize=''
758a5d79 369d_class=''
b0a2e8e6 370d_clearenv=''
b4eb6b3d
JH
371d_closedir=''
372d_void_closedir=''
4e0554ec 373d_cmsghdr_s=''
b4eb6b3d 374d_const=''
36adc09b 375d_copysignl=''
b4eb6b3d
JH
376cryptlib=''
377d_crypt=''
10bc17b6
JH
378crypt_r_proto=''
379d_crypt_r=''
b4eb6b3d
JH
380d_csh=''
381full_csh=''
10bc17b6
JH
382ctermid_r_proto=''
383d_ctermid_r=''
384ctime_r_proto=''
385d_ctime_r=''
b4eb6b3d
JH
386d_cuserid=''
387d_dbl_dig=''
2ef53570 388d_dbminitproto=''
b4eb6b3d 389d_difftime=''
ae0e3d3b 390d_dirfd=''
b4eb6b3d 391d_dlerror=''
a0d0e21e 392d_dlopen=''
b4eb6b3d
JH
393d_dlsymun=''
394d_dosuid=''
395d_suidsafe=''
10bc17b6
JH
396d_drand48_r=''
397drand48_r_proto=''
b4eb6b3d
JH
398d_drand48proto=''
399d_dup2=''
400d_eaccess=''
401d_endgrent=''
10bc17b6
JH
402d_endgrent_r=''
403endgrent_r_proto=''
b4eb6b3d 404d_endhent=''
10bc17b6
JH
405d_endhostent_r=''
406endhostent_r_proto=''
b4eb6b3d 407d_endnent=''
10bc17b6
JH
408d_endnetent_r=''
409endnetent_r_proto=''
b4eb6b3d 410d_endpent=''
10bc17b6
JH
411d_endprotoent_r=''
412endprotoent_r_proto=''
b4eb6b3d 413d_endpwent=''
10bc17b6
JH
414d_endpwent_r=''
415endpwent_r_proto=''
b4eb6b3d 416d_endsent=''
10bc17b6
JH
417d_endservent_r=''
418endservent_r_proto=''
15b61c98 419d_faststdio=''
b363b713 420d_fchdir=''
b4eb6b3d
JH
421d_fchmod=''
422d_fchown=''
423d_fcntl=''
9d9004a9 424d_fcntl_can_lock=''
b4eb6b3d
JH
425d_fd_macros=''
426d_fd_set=''
427d_fds_bits=''
428d_fgetpos=''
758a5d79
JH
429d_finite=''
430d_finitel=''
b4eb6b3d
JH
431d_flexfnam=''
432d_flock=''
2ef53570 433d_flockproto=''
b4eb6b3d 434d_fork=''
758a5d79
JH
435d_fp_class=''
436d_fpclass=''
437d_fpclassify=''
438d_fpclassl=''
b4eb6b3d
JH
439d_fpos64_t=''
440d_frexpl=''
441d_fs_data_s=''
442d_fseeko=''
443d_fsetpos=''
444d_fstatfs=''
411ab01c 445d_fsync=''
b4eb6b3d
JH
446d_ftello=''
447d_ftime=''
448d_gettimeod=''
dc814df1 449d_futimes=''
b4eb6b3d
JH
450d_Gconvert=''
451d_getcwd=''
452d_getespwnam=''
453d_getfsstat=''
454d_getgrent=''
10bc17b6
JH
455d_getgrent_r=''
456getgrent_r_proto=''
457d_getgrgid_r=''
458getgrgid_r_proto=''
459d_getgrnam_r=''
460getgrnam_r_proto=''
b4eb6b3d
JH
461d_getgrps=''
462d_gethbyaddr=''
463d_gethbyname=''
464d_gethent=''
465aphostname=''
466d_gethname=''
467d_phostname=''
468d_uname=''
10bc17b6
JH
469d_gethostbyaddr_r=''
470gethostbyaddr_r_proto=''
471d_gethostbyname_r=''
472gethostbyname_r_proto=''
473d_gethostent_r=''
474gethostent_r_proto=''
b4eb6b3d 475d_gethostprotos=''
4e0554ec 476d_getitimer=''
b4eb6b3d 477d_getlogin=''
10bc17b6
JH
478d_getlogin_r=''
479getlogin_r_proto=''
b4eb6b3d
JH
480d_getmnt=''
481d_getmntent=''
482d_getnbyaddr=''
483d_getnbyname=''
484d_getnent=''
10bc17b6
JH
485d_getnetbyaddr_r=''
486getnetbyaddr_r_proto=''
487d_getnetbyname_r=''
488getnetbyname_r_proto=''
489d_getnetent_r=''
490getnetent_r_proto=''
b4eb6b3d 491d_getnetprotos=''
0c0643d0 492d_getpagsz=''
b4eb6b3d
JH
493d_getpent=''
494d_getpgid=''
495d_getpgrp2=''
496d_bsdgetpgrp=''
497d_getpgrp=''
498d_getppid=''
499d_getprior=''
500d_getpbyname=''
501d_getpbynumber=''
10bc17b6
JH
502d_getprotobyname_r=''
503getprotobyname_r_proto=''
504d_getprotobynumber_r=''
505getprotobynumber_r_proto=''
506d_getprotoent_r=''
507getprotoent_r_proto=''
b4eb6b3d
JH
508d_getprotoprotos=''
509d_getprpwnam=''
510d_getpwent=''
10bc17b6
JH
511d_getpwent_r=''
512getpwent_r_proto=''
513d_getpwnam_r=''
514getpwnam_r_proto=''
515d_getpwuid_r=''
516getpwuid_r_proto=''
b4eb6b3d 517d_getsent=''
10bc17b6
JH
518d_getservbyname_r=''
519getservbyname_r_proto=''
520d_getservbyport_r=''
521getservbyport_r_proto=''
522d_getservent_r=''
523getservent_r_proto=''
b4eb6b3d
JH
524d_getservprotos=''
525d_getspnam=''
10bc17b6
JH
526d_getspnam_r=''
527getspnam_r_proto=''
b4eb6b3d
JH
528d_getsbyname=''
529d_getsbyport=''
10bc17b6
JH
530d_gmtime_r=''
531gmtime_r_proto=''
a4f3eea9 532d_gnulibc=''
5f6e0ee4 533gnulibc_version=''
b4eb6b3d
JH
534d_hasmntopt=''
535d_htonl=''
55954f19 536d_ilogbl=''
b4eb6b3d
JH
537d_inetaton=''
538d_int64_t=''
539d_isascii=''
758a5d79
JH
540d_isfinite=''
541d_isinf=''
b4eb6b3d
JH
542d_isnan=''
543d_isnanl=''
544d_killpg=''
545d_lchown=''
546d_ldbl_dig=''
0a0abfba 547d_libm_lib_version=''
b4eb6b3d 548d_link=''
10bc17b6
JH
549d_localtime_r=''
550localtime_r_proto=''
b4eb6b3d
JH
551d_locconv=''
552d_lockf=''
553d_longdbl=''
554longdblsize=''
555d_longlong=''
556longlongsize=''
557d_lseekproto=''
558d_lstat=''
559d_madvise=''
7dd121ae
MB
560d_malloc_good_size=''
561d_malloc_size=''
b4eb6b3d
JH
562d_mblen=''
563d_mbstowcs=''
564d_mbtowc=''
565d_memchr=''
566d_memcmp=''
567d_memcpy=''
568d_memmove=''
569d_memset=''
570d_mkdir=''
571d_mkdtemp=''
572d_mkfifo=''
573d_mkstemp=''
574d_mkstemps=''
575d_mktime=''
576d_mmap=''
577mmaptype=''
578d_modfl=''
e67aeab1 579d_modfl_pow32_bug=''
bc9a1b2c 580d_modflproto=''
b4eb6b3d
JH
581d_mprotect=''
582d_msg=''
583d_msgctl=''
584d_msgget=''
4e0554ec 585d_msghdr_s=''
b4eb6b3d
JH
586d_msgrcv=''
587d_msgsnd=''
588d_msync=''
589d_munmap=''
590d_nice=''
2765b840 591d_nl_langinfo=''
b4eb6b3d
JH
592d_off64_t=''
593d_open3=''
594d_fpathconf=''
595d_pathconf=''
596d_pause=''
597d_pipe=''
598d_poll=''
2304df62 599d_portable=''
a33c94aa 600d_procselfexe=''
f24dbf84 601procselfexe=''
b4eb6b3d
JH
602d_old_pthread_create_joinable=''
603old_pthread_create_joinable=''
d6483fcc 604d_pthread_atfork=''
58d975c3 605d_pthread_attr_setscope=''
b4eb6b3d
JH
606d_pthread_yield=''
607d_sched_yield=''
608sched_yield=''
609d_qgcvt=''
10bc17b6
JH
610d_random_r=''
611random_r_proto=''
612d_readdir64_r=''
613readdir64_r_proto=''
b4eb6b3d
JH
614d_readdir=''
615d_rewinddir=''
616d_seekdir=''
617d_telldir=''
10bc17b6
JH
618d_readdir_r=''
619readdir_r_proto=''
b4eb6b3d 620d_readlink=''
4e0554ec
JH
621d_readv=''
622d_recvmsg=''
b4eb6b3d
JH
623d_rename=''
624d_rmdir=''
625d_safebcpy=''
626d_safemcpy=''
627d_sanemcmp=''
ef9f17be 628d_sbrkproto=''
55954f19 629d_scalbnl=''
b4eb6b3d
JH
630d_select=''
631d_sem=''
632d_semctl=''
633d_semget=''
634d_semop=''
4e0554ec 635d_sendmsg=''
b4eb6b3d
JH
636d_setegid=''
637d_seteuid=''
638d_setgrent=''
10bc17b6
JH
639d_setgrent_r=''
640setgrent_r_proto=''
b4eb6b3d
JH
641d_setgrps=''
642d_sethent=''
10bc17b6
JH
643d_sethostent_r=''
644sethostent_r_proto=''
4e0554ec 645d_setitimer=''
b4eb6b3d
JH
646d_setlinebuf=''
647d_setlocale=''
10bc17b6
JH
648d_setlocale_r=''
649setlocale_r_proto=''
b4eb6b3d 650d_setnent=''
10bc17b6
JH
651d_setnetent_r=''
652setnetent_r_proto=''
b4eb6b3d
JH
653d_setpent=''
654d_setpgid=''
655d_setpgrp2=''
656d_bsdsetpgrp=''
657d_setpgrp=''
658d_setprior=''
659d_setproctitle=''
10bc17b6
JH
660d_setprotoent_r=''
661setprotoent_r_proto=''
b4eb6b3d 662d_setpwent=''
10bc17b6
JH
663d_setpwent_r=''
664setpwent_r_proto=''
b4eb6b3d
JH
665d_setregid=''
666d_setresgid=''
667d_setresuid=''
668d_setreuid=''
669d_setrgid=''
670d_setruid=''
671d_setsent=''
10bc17b6
JH
672d_setservent_r=''
673setservent_r_proto=''
b4eb6b3d
JH
674d_setsid=''
675d_setvbuf=''
676d_sfio=''
677usesfio=''
678d_shm=''
679d_shmat=''
680d_shmatprototype=''
681shmattype=''
682d_shmctl=''
683d_shmdt=''
684d_shmget=''
685d_sigaction=''
983dbef6 686d_sigprocmask=''
b4eb6b3d 687d_sigsetjmp=''
5f106f9c 688usesitecustomize=''
4f5da3e9
SP
689d_snprintf=''
690d_vsnprintf=''
49a78c82 691d_sockatmark=''
2ef53570 692d_sockatmarkproto=''
b4eb6b3d
JH
693d_msg_ctrunc=''
694d_msg_dontroute=''
695d_msg_oob=''
696d_msg_peek=''
697d_msg_proxy=''
698d_oldsock=''
699d_scm_rights=''
700d_socket=''
701d_sockpair=''
702sockethdr=''
703socketlib=''
704d_socklen_t=''
705d_socks5_init=''
360321b3 706d_sprintf_returns_strlen=''
b4eb6b3d 707d_sqrtl=''
10bc17b6
JH
708d_srand48_r=''
709srand48_r_proto=''
710d_srandom_r=''
711srandom_r_proto=''
eef837ea 712d_sresgproto=''
640374d0 713d_sresuproto=''
b4eb6b3d
JH
714d_statblks=''
715d_statfs_f_flags=''
716d_statfs_s=''
717d_fstatvfs=''
718d_statvfs=''
719d_stdio_cnt_lval=''
720d_stdio_ptr_lval=''
a7ffa9b9
NC
721d_stdio_ptr_lval_nochange_cnt=''
722d_stdio_ptr_lval_sets_cnt=''
b4eb6b3d
JH
723d_stdiobase=''
724d_stdstdio=''
725stdio_base=''
726stdio_bufsiz=''
727stdio_cnt=''
728stdio_filbuf=''
729stdio_ptr=''
730d_index=''
731d_strchr=''
732d_strcoll=''
733d_strctcpy=''
734d_strerrm=''
735d_strerror=''
736d_sysernlst=''
737d_syserrlst=''
10bc17b6
JH
738d_strerror_r=''
739strerror_r_proto=''
b3c85772 740d_strftime=''
08c92000
MB
741d_strlcat=''
742d_strlcpy=''
b4eb6b3d
JH
743d_strtod=''
744d_strtol=''
745d_strtold=''
746d_strtoll=''
28e5dec8 747d_strtoq=''
b4eb6b3d
JH
748d_strtoul=''
749d_strtoull=''
750d_strtouq=''
751d_strxfrm=''
752d_symlink=''
753d_syscall=''
2ef53570 754d_syscallproto=''
b4eb6b3d
JH
755d_sysconf=''
756d_system=''
757d_tcgetpgrp=''
758d_tcsetpgrp=''
759d_telldirproto=''
760d_time=''
761timetype=''
762clocktype=''
763d_times=''
10bc17b6
JH
764d_tmpnam_r=''
765tmpnam_r_proto=''
b4eb6b3d 766d_truncate=''
10bc17b6
JH
767d_ttyname_r=''
768ttyname_r_proto=''
b4eb6b3d 769d_tzname=''
4e0554ec
JH
770d_u32align=''
771d_ualarm=''
b4eb6b3d
JH
772d_umask=''
773d_semctl_semid_ds=''
774d_semctl_semun=''
775d_union_semun=''
758a5d79 776d_unordered=''
bdf33aa7 777d_unsetenv=''
4e0554ec 778d_usleep=''
2ef53570 779d_usleepproto=''
b4eb6b3d
JH
780d_ustat=''
781d_vfork=''
782usevfork=''
783d_voidsig=''
784signal_t=''
785d_volatile=''
786d_charvspr=''
787d_vprintf=''
788d_wait4=''
789d_waitpid=''
790d_wcstombs=''
791d_wctomb=''
4e0554ec 792d_writev=''
b4eb6b3d 793dlext=''
85e6fe83
LW
794cccdlflags=''
795ccdlflags=''
2304df62 796dlsrc=''
232e078e 797ld=''
85e6fe83 798lddlflags=''
2304df62 799usedl=''
b4eb6b3d
JH
800doublesize=''
801ebcdic=''
802fflushNULL=''
803fflushall=''
804fpossize=''
805fpostype=''
2d736872 806gccansipedantic=''
5b463ca7 807gccosandvers=''
8a27cf78 808gccversion=''
b4eb6b3d
JH
809gidformat=''
810gidsign=''
811gidsize=''
812gidtype=''
813groupstype=''
814h_fcntl=''
815h_sysfile=''
6e1038e0
MB
816html1dir=''
817html1direxp=''
818installhtml1dir=''
819html3dir=''
820html3direxp=''
821installhtml3dir=''
b4eb6b3d 822i_arpainet=''
10bc17b6 823i_crypt=''
b4eb6b3d
JH
824db_hashtype=''
825db_prefixtype=''
640374d0
JH
826db_version_major=''
827db_version_minor=''
828db_version_patch=''
b4eb6b3d
JH
829i_db=''
830i_dbm=''
831i_rpcsvcdbm=''
832d_dirnamlen=''
833direntrytype=''
834i_dirent=''
a0d0e21e 835i_dld=''
b4eb6b3d
JH
836i_dlfcn=''
837i_fcntl=''
838i_float=''
758a5d79
JH
839i_fp=''
840i_fp_class=''
b4eb6b3d
JH
841i_gdbm=''
842d_grpasswd=''
843i_grp=''
b4eb6b3d
JH
844i_ieeefp=''
845i_inttypes=''
2765b840 846i_langinfo=''
b4eb6b3d
JH
847i_libutil=''
848i_limits=''
849i_locale=''
850i_machcthr=''
851i_malloc=''
852i_math=''
853i_memory=''
854i_mntent=''
855i_ndbm=''
856i_netdb=''
857i_neterrno=''
858i_netinettcp=''
859i_niin=''
860i_sysin=''
861i_poll=''
862i_prot=''
863i_pthread=''
864d_pwage=''
865d_pwchange=''
866d_pwclass=''
867d_pwcomment=''
868d_pwexpire=''
869d_pwgecos=''
870d_pwpasswd=''
871d_pwquota=''
872i_pwd=''
873i_sfio=''
874i_shadow=''
875i_socks=''
876i_stddef=''
877i_stdlib=''
878i_string=''
879strings=''
880i_sunmath=''
881i_sysaccess=''
882i_sysdir=''
883i_sysfile=''
884d_voidtty=''
885i_bsdioctl=''
886i_sysfilio=''
887i_sysioctl=''
888i_syssockio=''
889i_syslog=''
890i_sysmman=''
891i_sysmode=''
892i_sysmount=''
893i_sysndir=''
894i_sysparam=''
895i_sysresrc=''
896i_syssecrt=''
897i_sysselct=''
898i_sysstat=''
899i_sysstatfs=''
900i_sysstatvfs=''
901i_systimes=''
902i_systypes=''
903i_sysuio=''
904i_sysun=''
905i_sysutsname=''
906i_sysvfs=''
907i_syswait=''
908i_sgtty=''
909i_termio=''
910i_termios=''
14b90194
JH
911d_tm_tm_gmtoff=''
912d_tm_tm_zone=''
b4eb6b3d
JH
913i_systime=''
914i_systimek=''
915i_time=''
916timeincl=''
917i_unistd=''
918i_ustat=''
919i_utime=''
920i_values=''
921i_stdarg=''
922i_varargs=''
923i_varhdr=''
924i_vfork=''
f3f1a2d8 925d_inc_version_list=''
b4eb6b3d
JH
926inc_version_list=''
927inc_version_list_init=''
928installprefix=''
929installprefixexp=''
930installstyle=''
931installusrbinperl=''
932intsize=''
933longsize=''
934shortsize=''
4b661809 935issymlink=''
2304df62 936libc=''
b4eb6b3d
JH
937ldlibpthname=''
938libperl=''
939shrpenv=''
940useshrplib=''
a0d0e21e 941glibpth=''
2304df62 942libpth=''
8e07c86e 943loclibpth=''
2304df62
AD
944plibpth=''
945xlibpth=''
1cfa4ec7 946ignore_versioned_solibs=''
2304df62 947libs=''
43999f95
JH
948libsdirs=''
949libsfiles=''
950libsfound=''
13b3f787 951libspath=''
85e6fe83 952lns=''
b4eb6b3d
JH
953d_PRIEUldbl=''
954d_PRIFUldbl=''
955d_PRIGUldbl=''
956d_PRIeldbl=''
957d_PRIfldbl=''
958d_PRIgldbl=''
959d_SCNfldbl=''
960sPRIEUldbl=''
961sPRIFUldbl=''
962sPRIGUldbl=''
963sPRIeldbl=''
964sPRIfldbl=''
965sPRIgldbl=''
966sSCNfldbl=''
967lseeksize=''
968lseektype=''
d620c7b3 969mad=''
00e74f14
NC
970madlyh=''
971madlyobj=''
972madlysrc=''
f3f1a2d8
MB
973make_set_make=''
974d_mymalloc=''
975freetype=''
b4eb6b3d
JH
976mallocobj=''
977mallocsrc=''
978malloctype=''
9df442c2 979usemallocwrap=''
b4eb6b3d
JH
980usemymalloc=''
981installman1dir=''
982man1dir=''
983man1direxp=''
984man1ext=''
985installman3dir=''
986man3dir=''
987man3direxp=''
988man3ext=''
989modetype=''
990multiarch=''
991mydomain=''
992myhostname=''
993phostname=''
2304df62
AD
994c=''
995n=''
b4eb6b3d
JH
996d_eofnblk=''
997eagain=''
998o_nonblock=''
999rd_nodata=''
2cc61e15 1000need_va_copy=''
b4eb6b3d
JH
1001netdb_hlen_type=''
1002netdb_host_type=''
1003netdb_name_type=''
1004netdb_net_type=''
1005groupcat=''
1006hostcat=''
1007passcat=''
1008orderlib=''
1009ranlib=''
1010d_perl_otherlibdirs=''
1011otherlibdirs=''
2304df62
AD
1012package=''
1013spackage=''
b4eb6b3d
JH
1014pager=''
1015api_revision=''
1016api_subversion=''
1017api_version=''
1018api_versionstring=''
1019patchlevel=''
151e6568 1020perl_patchlevel=''
b4eb6b3d
JH
1021revision=''
1022subversion=''
1023version=''
861eb78d 1024version_patchlevel_string=''
b4eb6b3d
JH
1025perl5=''
1026perladmin=''
1027perlpath=''
1028d_nv_preserves_uv=''
f607920a 1029d_nv_zero_is_allbits_zero=''
b4eb6b3d
JH
1030i16size=''
1031i16type=''
1032i32size=''
1033i32type=''
1034i64size=''
1035i64type=''
1036i8size=''
1037i8type=''
1038ivsize=''
1039ivtype=''
53133ed1 1040nv_preserves_uv_bits=''
b4eb6b3d
JH
1041nvsize=''
1042nvtype=''
1043u16size=''
1044u16type=''
1045u32size=''
1046u32type=''
1047u64size=''
1048u64type=''
1049u8size=''
1050u8type=''
1051uvsize=''
1052uvtype=''
1053ivdformat=''
1054nvEUformat=''
1055nvFUformat=''
1056nvGUformat=''
1057nveformat=''
1058nvfformat=''
1059nvgformat=''
1060uvXUformat=''
1061uvoformat=''
1062uvuformat=''
1063uvxformat=''
1064pidtype=''
1065prefix=''
1066prefixexp=''
1067installprivlib=''
1068privlib=''
1069privlibexp=''
1070prototype=''
1071ptrsize=''
1072d_PRIXU64=''
1073d_PRId64=''
1074d_PRIi64=''
1075d_PRIo64=''
1076d_PRIu64=''
1077d_PRIx64=''
1078sPRIXU64=''
1079sPRId64=''
1080sPRIi64=''
1081sPRIo64=''
1082sPRIu64=''
1083sPRIx64=''
1084d_quad=''
1085quadkind=''
1086quadtype=''
1087uquadtype=''
1088drand01=''
1089randbits=''
1090randfunc=''
1091randseedtype=''
1092seedfunc=''
1093installscript=''
1094scriptdir=''
1095scriptdirexp=''
1096selectminbits=''
1097selecttype=''
8ff267be 1098sh=''
b4eb6b3d
JH
1099sig_count=''
1100sig_name=''
1101sig_name_init=''
1102sig_num=''
1103sig_num_init=''
76d3c696 1104sig_size=''
f3f1a2d8 1105d_sitearch=''
b4eb6b3d
JH
1106installsitearch=''
1107sitearch=''
1108sitearchexp=''
1109installsitebin=''
1110sitebin=''
1111sitebinexp=''
8d2cbf27
JH
1112installsitehtml1dir=''
1113sitehtml1dir=''
1114sitehtml1direxp=''
1115installsitehtml3dir=''
1116sitehtml3dir=''
1117sitehtml3direxp=''
b4eb6b3d
JH
1118installsitelib=''
1119sitelib=''
1120sitelib_stem=''
1121sitelibexp=''
91e123a8
JH
1122installsiteman1dir=''
1123siteman1dir=''
1124siteman1direxp=''
1125installsiteman3dir=''
1126siteman3dir=''
1127siteman3direxp=''
b4eb6b3d
JH
1128siteprefix=''
1129siteprefixexp=''
6e1038e0
MB
1130installsitescript=''
1131sitescript=''
1132sitescriptexp=''
b4eb6b3d
JH
1133sizesize=''
1134sizetype=''
a0d0e21e 1135so=''
b4eb6b3d 1136socksizetype=''
2304df62
AD
1137sharpbang=''
1138shsharp=''
1139spitshell=''
dfe9444c 1140src=''
b4eb6b3d
JH
1141ssizetype=''
1142startperl=''
2304df62 1143startsh=''
b4eb6b3d
JH
1144stdchar=''
1145d_stdio_stream_array=''
1146stdio_stream_array=''
1147sysman=''
5ff3f7a4 1148trnl=''
b4eb6b3d
JH
1149uidformat=''
1150uidsign=''
1151uidsize=''
1152uidtype=''
1153archname64=''
1154use64bitall=''
1155use64bitint=''
15b61c98 1156usefaststdio=''
b4eb6b3d
JH
1157ccflags_uselargefiles=''
1158ldflags_uselargefiles=''
1159libswanted_uselargefiles=''
1160uselargefiles=''
1161uselongdouble=''
1162usemorebits=''
1163usemultiplicity=''
2304df62 1164nm_opt=''
40a7a20a 1165nm_so_opt=''
2304df62
AD
1166runnm=''
1167usenm=''
b4eb6b3d 1168useperlio=''
29209bc5 1169usesocks=''
b4eb6b3d
JH
1170d_oldpthreads=''
1171use5005threads=''
1172useithreads=''
9514c62b 1173usereentrant=''
b4eb6b3d 1174usethreads=''
2304df62 1175incpath=''
2304df62
AD
1176mips_type=''
1177usrinc=''
b4eb6b3d
JH
1178d_vendorarch=''
1179installvendorarch=''
1180vendorarch=''
1181vendorarchexp=''
1182d_vendorbin=''
1183installvendorbin=''
1184vendorbin=''
1185vendorbinexp=''
8d2cbf27
JH
1186installvendorhtml1dir=''
1187vendorhtml1dir=''
1188vendorhtml1direxp=''
1189installvendorhtml3dir=''
1190vendorhtml3dir=''
1191vendorhtml3direxp=''
b4eb6b3d
JH
1192d_vendorlib=''
1193installvendorlib=''
1194vendorlib=''
1195vendorlib_stem=''
1196vendorlibexp=''
91e123a8
JH
1197installvendorman1dir=''
1198vendorman1dir=''
1199vendorman1direxp=''
1200installvendorman3dir=''
1201vendorman3dir=''
1202vendorman3direxp=''
b4eb6b3d
JH
1203usevendorprefix=''
1204vendorprefix=''
1205vendorprefixexp=''
6e1038e0
MB
1206d_vendorscript=''
1207installvendorscript=''
1208vendorscript=''
1209vendorscriptexp=''
d56c5707 1210versiononly=''
b4eb6b3d
JH
1211defvoidused=''
1212voidflags=''
3659ebf1
JH
1213yacc=''
1214yaccflags=''
2304df62
AD
1215CONFIG=''
1216
ecfc5424
AD
1217define='define'
1218undef='undef'
1219smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1220rmlist=''
1221
1222: We must find out about Eunice early
1223eunicefix=':'
1224if test -f /etc/unixtovms; then
1225 eunicefix=/etc/unixtovms
1226fi
1227if test -f /etc/unixtovms.exe; then
1228 eunicefix=/etc/unixtovms.exe
1229fi
1230
cfb04860 1231: Set executable suffix now -- needed before hints available
6153ba32
PG
1232if test -f "/libs/version.library"; then
1233: Amiga OS
1234 _exe=""
1235elif test -f "/system/gnu_library/bin/ar.pm"; then
1236: Stratus VOS
cfb04860 1237 _exe=".pm"
6153ba32
PG
1238elif test -n "$DJGPP"; then
1239: DOS DJGPP
cfb04860 1240 _exe=".exe"
5c728af0 1241elif test -d c:/. -o -n "$is_os2" ; then
506faf56 1242: OS/2 or cygwin
ba863942
JH
1243 _exe=".exe"
1244fi
868439a2 1245
b4eb6b3d 1246i_whoami=''
9da7673b
MB
1247ccname=''
1248ccversion=''
1249perllibs=''
1250: set useposix=false in your hint file to disable the POSIX extension.
1251useposix=true
1252: set useopcode=false in your hint file to disable the Opcode extension.
1253useopcode=true
1254: Trailing extension. Override this in a hint file, if needed.
1255: Extra object files, if any, needed on this platform.
1256archobjs=''
1257archname=''
ff935051
JH
1258: Possible local include directories to search.
1259: Set locincpth to "" in a hint file to defeat local include searches.
1260locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1261locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1262:
1263: no include file wanted by default
1264inclwanted=''
1265
eaf812ae
MB
1266: Enable -DEBUGGING and -DDEBUGGING from the command line
1267EBUGGING=''
1268DEBUGGING=old
1269
b4eb6b3d 1270groupstype=''
64615a5e 1271libnames=''
732c9516
JH
1272: change the next line if compiling for Xenix/286 on Xenix/386
1273xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1274: Possible local library directories to search.
1275loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1276loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1277
1278: general looking path for locating libraries
5869b1f1 1279glibpth="/lib /usr/lib $xlibpth"
732c9516 1280glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1281test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1282test -f /shlib/libc.so && glibpth="/shlib $glibpth"
732c9516
JH
1283
1284: Private path used by Configure to find libraries. Its value
1285: is prepended to libpth. This variable takes care of special
1286: machines, like the mips. Usually, it should be empty.
1287plibpth=''
1288
1cfa4ec7
GS
1289: default library list
1290libswanted=''
921b2963 1291: some systems want to use only the non-versioned libso:s
1cfa4ec7 1292ignore_versioned_solibs=''
9da7673b
MB
1293siteman1dir=''
1294siteman3dir=''
1295sitescript=''
b4eb6b3d
JH
1296archname64=''
1297ccflags_uselargefiles=''
1298ldflags_uselargefiles=''
1299libswanted_uselargefiles=''
1300: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1301: set usesocks on the Configure command line to enable socks.
b4eb6b3d 1302: set usethreads on the Configure command line to enable threads.
cd040c5e 1303usereentrant='undef'
9da7673b
MB
1304: full support for void wanted by default
1305defvoidused=15
1306
ecfc5424 1307: List of libraries we want.
15431986 1308: If anyone needs extra -lxxx, put those in a hint file.
6bdd71ef
AB
1309libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1310libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1aef975c 1311: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1312: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1313glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1314glibpth="/usr/shlib $glibpth"
1315: Do not use vfork unless overridden by a hint file.
1316usevfork=false
1317
8ff267be 1318: Find the basic shell for Bourne shell scripts
1319case "$sh" in
1320'')
8ff267be 1321 case "$SYSTYPE" in
1322 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1323 *) xxx='/bin/sh';;
1324 esac
1325 if test -f "$xxx"; then
1326 sh="$xxx"
1327 else
1328 : Build up a list and do a single loop so we can 'break' out.
1329 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1330 for xxx in sh bash ksh pdksh ash; do
1331 for p in $pth; do
1332 try="$try ${p}/${xxx}"
1333 done
1334 done
1335 for xxx in $try; do
1336 if test -f "$xxx"; then
1337 sh="$xxx";
8ff267be 1338 break
a5a94ea5
JH
1339 elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1340 sh="$xxx";
1341 break
8ff267be 1342 elif test -f "$xxx.exe"; then
1343 sh="$xxx";
8ff267be 1344 break
1345 fi
1346 done
1347 fi
1348 ;;
1349esac
1350
1351case "$sh" in
a33c94aa 1352'') cat >&2 <<EOM
8ff267be 1353$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1354
8ff267be 1355Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1356Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1357we'll try to straighten this all out.
8ff267be 1358EOM
1359 exit 1
1360 ;;
1361esac
1362
760ac839 1363: see if sh knows # comments
73614538 1364if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1365 shsharp=true
1366 spitshell=cat
760ac839 1367 xcat=/bin/cat
a931254c
JH
1368 test -f $xcat$_exe || xcat=/usr/bin/cat
1369 if test ! -f $xcat$_exe; then
4bdb8fb5 1370 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
a931254c 1371 if test -f $p/cat$_exe; then
1deb0a86 1372 xcat=$p/cat
3c728e00
JH
1373 break
1374 fi
1375 done
1deb0a86
JH
1376 if test ! -f $xcat$_exe; then
1377 echo "Can't find cat anywhere!"
3c728e00
JH
1378 exit 1
1379 fi
1380 fi
5440bc8e
JH
1381 echo "#!$xcat" >sharp
1382 $eunicefix sharp
1383 chmod +x sharp
1384 ./sharp > today
760ac839 1385 if test -s today; then
760ac839
LW
1386 sharpbang='#!'
1387 else
5440bc8e
JH
1388 echo "#! $xcat" > sharp
1389 $eunicefix sharp
1390 chmod +x sharp
1391 ./sharp > today
760ac839 1392 if test -s today; then
760ac839
LW
1393 sharpbang='#! '
1394 else
760ac839
LW
1395 sharpbang=': use '
1396 fi
1397 fi
1398else
dfe9444c 1399 echo " "
8ff267be 1400 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1401 shsharp=false
1402 cd ..
1403 echo "exec grep -v '^[ ]*#'" >spitshell
1404 chmod +x spitshell
1405 $eunicefix spitshell
1406 spitshell=`pwd`/spitshell
1407 cd UU
1408 echo "I presume that if # doesn't work, #! won't work either!"
1409 sharpbang=': use '
1410fi
5440bc8e 1411rm -f sharp today
760ac839
LW
1412
1413: figure out how to guarantee sh startup
8ff267be 1414case "$startsh" in
1415'') startsh=${sharpbang}${sh} ;;
1416*)
760ac839 1417esac
5440bc8e 1418cat >sharp <<EOSS
760ac839
LW
1419$startsh
1420set abc
1421test "$?abc" != 1
1422EOSS
1423
5440bc8e
JH
1424chmod +x sharp
1425$eunicefix sharp
1426if ./sharp; then
8ff267be 1427 : echo "Yup, it does."
760ac839 1428else
dfe9444c
AD
1429 echo "Hmm... '$startsh' does not guarantee sh startup..."
1430 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839 1431fi
5440bc8e 1432rm -f sharp
760ac839 1433
aebf16e7
AD
1434
1435: Save command line options in file UU/cmdline.opt for later use in
1436: generating config.sh.
1437cat > cmdline.opt <<EOSH
1438# Configure command line arguments.
1439config_arg0='$0'
1440config_args='$*'
1441config_argc=$#
1442EOSH
1443argn=1
ee45ea83
IZ
1444args_exp=''
1445args_sep=''
aebf16e7
AD
1446for arg in "$@"; do
1447 cat >>cmdline.opt <<EOSH
1448config_arg$argn='$arg'
1449EOSH
ee45ea83
IZ
1450 # Extreme backslashitis: replace each ' by '"'"'
1451 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1452$arg
1453EOC
1454 arg_exp=`cat cmdl.opt`
1455 args_exp="$args_exp$args_sep'$arg_exp'"
aebf16e7 1456 argn=`expr $argn + 1`
ee45ea83 1457 args_sep=' '
aebf16e7 1458done
ee45ea83
IZ
1459# args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1460# used by ./hints/os2.sh
1461rm -f cmdl.opt
aebf16e7 1462
2304df62
AD
1463: produce awk script to parse command line options
1464cat >options.awk <<'EOF'
1465BEGIN {
02e93a22 1466 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1467
1468 len = length(optstr);
1469 for (i = 1; i <= len; i++) {
1470 c = substr(optstr, i, 1);
1471 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1472 if (a == ":") {
1473 arg[c] = 1;
1474 i++;
1475 }
1476 opt[c] = 1;
1477 }
1478}
1479{
1480 expect = 0;
1481 str = $0;
1482 if (substr(str, 1, 1) != "-") {
1483 printf("'%s'\n", str);
1484 next;
1485 }
1486 len = length($0);
1487 for (i = 2; i <= len; i++) {
1488 c = substr(str, i, 1);
1489 if (!opt[c]) {
1490 printf("-%s\n", substr(str, i));
1491 next;
1492 }
1493 printf("-%s\n", c);
1494 if (arg[c]) {
1495 if (i < len)
1496 printf("'%s'\n", substr(str, i + 1));
1497 else
1498 expect = 1;
1499 next;
1500 }
1501 }
1502}
1503END {
1504 if (expect)
1505 print "?";
1506}
1507EOF
1508
1509: process the command line options
4633a7c4
LW
1510set X `for arg in "$@"; do echo "X$arg"; done |
1511 sed -e s/X// | awk -f options.awk`
2304df62
AD
1512eval "set $*"
1513shift
1514rm -f options.awk
1515
1516: set up default values
1517fastread=''
1518reuseval=false
1519config_sh=''
1520alldone=''
1521error=''
1522silent=''
1523extractsh=''
ecfc5424 1524override=''
16d20bd9 1525knowitall=''
02e93a22 1526rm -f optdef.sh posthint.sh
28757baa 1527cat >optdef.sh <<EOS
1528$startsh
1529EOS
2304df62 1530
dfe9444c 1531
2304df62
AD
1532: option parsing
1533while test $# -gt 0; do
1534 case "$1" in
1535 -d) shift; fastread=yes;;
1536 -e) shift; alldone=cont;;
1537 -f)
1538 shift
1539 cd ..
1540 if test -r "$1"; then
1541 config_sh="$1"
1542 else
a0d0e21e 1543 echo "$me: cannot read config file $1." >&2
2304df62
AD
1544 error=true
1545 fi
1546 cd UU
1547 shift;;
1548 -h) shift; error=true;;
1549 -r) shift; reuseval=true;;
dfe9444c 1550 -s) shift; silent=true; realsilent=true;;
2304df62 1551 -E) shift; alldone=exit;;
16d20bd9 1552 -K) shift; knowitall=true;;
ecfc5424 1553 -O) shift; override=true;;
dfe9444c 1554 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1555 -D)
1556 shift
1557 case "$1" in
1558 *=)
1559 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1560 echo "$me: ignoring -D $1" >&2
1561 ;;
ecfc5424 1562 *=*) echo "$1" | \
1aef975c
AD
1563 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1564 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1565 esac
1566 shift
1567 ;;
1568 -U)
1569 shift
1570 case "$1" in
1aef975c 1571 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1572 *=*)
1573 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1574 echo "$me: ignoring -U $1" >&2
1575 ;;
1aef975c 1576 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1577 esac
1578 shift
1579 ;;
02e93a22
JH
1580 -A)
1581 shift
1582 xxx=''
1583 yyy="$1"
02e93a22 1584 zzz=''
5f83a3e9 1585 uuu=undef
02e93a22 1586 case "$yyy" in
f7c31117 1587 *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
5f83a3e9
JH
1588 case "$zzz" in
1589 *:*) zzz='' ;;
1590 *) xxx=append
f7c31117
JH
1591 zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1592 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
5f83a3e9
JH
1593 esac
1594 ;;
1595 esac
1596 case "$xxx" in
1597 '') case "$yyy" in
f7c31117
JH
1598 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1599 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1600 zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1601 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1602 *) xxx=`echo "$yyy"|sed 's!:.*!!'`
1603 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
5f83a3e9
JH
1604 esac
1605 ;;
1606 esac
02e93a22
JH
1607 case "$xxx" in
1608 append)
5f83a3e9 1609 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1610 clear)
5f83a3e9 1611 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1612 define)
1613 case "$zzz" in
1614 '') zzz=define ;;
1615 esac
5f83a3e9 1616 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1617 eval)
5f83a3e9 1618 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1619 prepend)
5f83a3e9 1620 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1621 undef)
1622 case "$zzz" in
1623 '') zzz="$uuu" ;;
1624 esac
5f83a3e9
JH
1625 echo "$yyy=$zzz" >> posthint.sh ;;
1626 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1627 esac
bde6b06b 1628 shift
02e93a22 1629 ;;
dfe9444c 1630 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
5f83a3e9 1631 exit 0;;
2304df62 1632 --) break;;
a0d0e21e 1633 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1634 *) break;;
1635 esac
1636done
1637
1638case "$error" in
1639true)
1640 cat >&2 <<EOM
2afac517 1641Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1642 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1643 -d : use defaults for all answers.
1644 -e : go on without questioning past the production of config.sh.
1645 -f : specify an alternate default configuration file.
1646 -h : print this help message and exit (with an error status).
1647 -r : reuse C symbols value if possible (skips costly nm extraction).
1648 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1649 -D : define symbol to have some value:
1650 -D symbol symbol gets the value 'define'
1651 -D symbol=value symbol gets the value 'value'
2304df62 1652 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1653 -K : do not use unless you know what you are doing.
ecfc5424 1654 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1655 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1656 -U : undefine symbol:
1657 -U symbol symbol gets the value 'undef'
1658 -U symbol= symbol gets completely empty
02e93a22 1659 -A : manipulate symbol after the platform specific hints have been applied:
5f83a3e9 1660 -A symbol=value append " "value to symbol
02e93a22
JH
1661 -A append:symbol=value append value to symbol
1662 -A define:symbol=value define symbol to have value
02e93a22
JH
1663 -A clear:symbol define symbol to be ''
1664 -A define:symbol define symbol to be 'define'
1665 -A eval:symbol=value define symbol to be eval of value
1666 -A prepend:symbol=value prepend value to symbol
1667 -A undef:symbol define symbol to be 'undef'
1668 -A undef:symbol= define symbol to be ''
2304df62
AD
1669 -V : print version number and exit (with a zero status).
1670EOM
1671 exit 1
1672 ;;
1673esac
1674
dfe9444c
AD
1675: Sanity checks
1676case "$fastread$alldone" in
1677yescont|yesexit) ;;
1678*)
aaeb8e51
GS
1679 case "$extractsh" in
1680 true) ;;
1681 *)
1682 if test ! -t 0; then
1683 echo "Say 'sh Configure', not 'sh <Configure'"
1684 exit 1
1685 fi
1686 ;;
1687 esac
dfe9444c
AD
1688 ;;
1689esac
1690
2304df62
AD
1691exec 4>&1
1692case "$silent" in
1693true) exec 1>/dev/null;;
1694esac
1695
ecfc5424 1696: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1697touch optdef.sh
1698. ./optdef.sh
02e93a22
JH
1699: create the posthint manipulation script and leave the file out there...
1700touch posthint.sh
a0d0e21e 1701
2304df62 1702: set package name
85e6fe83 1703package=perl5
b4eb6b3d
JH
1704first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1705last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1706case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1707ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1708*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1709esac
2304df62 1710
2304df62
AD
1711: Some greps do not return status, grrr.
1712echo "grimblepritz" >grimble
1713if grep blurfldyick grimble >/dev/null 2>&1 ; then
1714 contains=contains
1715elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1716 contains=grep
1717else
1718 contains=contains
1719fi
1720rm -f grimble
1721: the following should work in any shell
1722case "$contains" in
1723contains*)
1724 echo " "
1725 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1726 cat >contains <<'EOSS'
1727grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1728EOSS
1729chmod +x contains
1730esac
1731
dfe9444c
AD
1732: Find the path to the source tree
1733case "$src" in
1734'') case "$0" in
b233458b
JH
1735 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1736 case "$src" in
1737 /*) ;;
8504afb7 1738 .) ;;
b233458b
JH
1739 *) src=`cd ../$src && pwd` ;;
1740 esac
1741 ;;
dfe9444c
AD
1742 *) src='.';;
1743 esac;;
1744esac
1745case "$src" in
1746'') src=/
1747 rsrc=/
1748 ;;
1749/*) rsrc="$src";;
1750*) rsrc="../$src";;
1751esac
1752if test -f $rsrc/Configure && \
1753 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1754then
1755 : found it, so we are ok.
1756else
1757 rsrc=''
1758 for src in . .. ../.. ../../.. ../../../..; do
1759 if test -f ../$src/Configure && \
1760 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1761 then
1762 rsrc=../$src
1763 break
1764 fi
1765 done
1766fi
1767case "$rsrc" in
1768'')
1769 cat <<EOM >&4
1770
1771Sorry, I can't seem to locate the source dir for $package. Please start
1772Configure with an explicit path -- i.e. /some/path/Configure.
1773
1774EOM
1775 exit 1
1776 ;;
1777../.) rsrc='..';;
1778*)
1779 echo " "
1780 echo "Sources for $package found in \"$src\"." >&4
1781 ;;
1782esac
1783
1784: script used to extract .SH files with variable substitutions
1785cat >extract <<'EOS'
a02608de 1786PERL_CONFIG_SH=true
dfe9444c 1787echo "Doing variable substitutions on .SH files..."
24ccb310
JH
1788if test -f MANIFEST; then
1789 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
dfe9444c
AD
1790else
1791 echo "(Looking for .SH files under the source directory.)"
6904989c 1792 set x `(cd "$src"; find . -name "*.SH" -print)`
dfe9444c
AD
1793fi
1794shift
1795case $# in
6904989c 17960) set x `(cd "$src"; echo *.SH)`; shift;;
dfe9444c 1797esac
6904989c 1798if test ! -f "$src/$1"; then
dfe9444c
AD
1799 shift
1800fi
1801mkdir_p='
1802name=$1;
1803create="";
1804while test $name; do
1805 if test ! -d "$name"; then
1806 create="$name $create";
1807 name=`echo $name | sed -e "s|^[^/]*$||"`;
1808 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1809 else
1810 name="";
1811 fi;
1812done;
1813for file in $create; do
1814 mkdir $file;
1815done
1816'
1817for file in $*; do
1818 case "$src" in
1819 ".")
1820 case "$file" in
1821 */*)
1822 dir=`expr X$file : 'X\(.*\)/'`
1823 file=`expr X$file : 'X.*/\(.*\)'`
6904989c 1824 (cd "$dir" && . ./$file)
dfe9444c
AD
1825 ;;
1826 *)
1827 . ./$file
1828 ;;
1829 esac
1830 ;;
1831 *)
1832 case "$file" in
1833 */*)
1834 dir=`expr X$file : 'X\(.*\)/'`
1835 file=`expr X$file : 'X.*/\(.*\)'`
1836 (set x $dir; shift; eval $mkdir_p)
6904989c 1837 sh <"$src/$dir/$file"
dfe9444c
AD
1838 ;;
1839 *)
6904989c 1840 sh <"$src/$file"
dfe9444c
AD
1841 ;;
1842 esac
1843 ;;
1844 esac
1845done
6904989c 1846if test -f "$src/config_h.SH"; then
dfe9444c
AD
1847 if test ! -f config.h; then
1848 : oops, they left it out of MANIFEST, probably, so do it anyway.
6904989c 1849 . "$src/config_h.SH"
dfe9444c
AD
1850 fi
1851fi
1852EOS
1853
1854: extract files and exit if asked to do so
1855case "$extractsh" in
1856true)
1857 case "$realsilent" in
1858 true) ;;
1859 *) exec 1>&4;;
1860 esac
1861 case "$config_sh" in
1862 '') config_sh='config.sh';;
1863 esac
1864 echo " "
1865 echo "Fetching answers from $config_sh..."
1866 cd ..
1867 . $config_sh
1868 test "$override" && . ./optdef.sh
1869 echo " "
1870 . UU/extract
1871 rm -rf UU
24ccb310 1872 echo "Extraction done."
dfe9444c
AD
1873 exit 0
1874 ;;
1875esac
1876
1877: Eunice requires " " instead of "", can you believe it
1878echo " "
1879: Here we go...
1880echo "Beginning of configuration questions for $package."
1881
1882trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1883
2304df62
AD
1884: first determine how to suppress newline on echo command
1885echo " "
1886echo "Checking echo to see how to suppress newlines..."
1887(echo "hi there\c" ; echo " ") >.echotmp
1888if $contains c .echotmp >/dev/null 2>&1 ; then
1889 echo "...using -n."
1890 n='-n'
1891 c=''
1892else
1893 cat <<'EOM'
1894...using \c
1895EOM
1896 n=''
1897 c='\c'
1898fi
1899echo $n "The star should be here-->$c"
1900echo '*'
1901rm -f .echotmp
1902
1903: Now test for existence of everything in MANIFEST
1904echo " "
6904989c 1905if test -f "$rsrc/MANIFEST"; then
2304df62 1906 echo "First let's make sure your kit is complete. Checking..." >&4
4242830c 1907 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
2304df62 1908 rm -f missing
dfe9444c 1909 tmppwd=`pwd`
2304df62 1910 for filelist in x??; do
6904989c 1911 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
2304df62
AD
1912 done
1913 if test -s missing; then
1914 cat missing >&4
1915 cat >&4 <<'EOM'
1916
1917THIS PACKAGE SEEMS TO BE INCOMPLETE.
1918
1919You have the option of continuing the configuration process, despite the
1920distinct possibility that your kit is damaged, by typing 'y'es. If you
1921do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1922and contact the author (perlbug@perl.org).
2304df62
AD
1923
1924EOM
1925 echo $n "Continue? [n] $c" >&4
1926 read ans
1927 case "$ans" in
1928 y*)
1929 echo "Continuing..." >&4
1930 rm -f missing
1931 ;;
1932 *)
1933 echo "ABORTING..." >&4
1934 kill $$
1935 ;;
1936 esac
1937 else
dfe9444c 1938 echo "Looks good..."
2304df62
AD
1939 fi
1940else
1941 echo "There is no MANIFEST file. I hope your kit is complete !"
1942fi
1943rm -f missing x??
1944
5ff3f7a4
GS
1945echo " "
1946: Find the appropriate value for a newline for tr
1947if test -n "$DJGPP"; then
1948 trnl='\012'
1949fi
1950if test X"$trnl" = X; then
1951 case "`echo foo|tr '\n' x 2>/dev/null`" in
1952 foox) trnl='\n' ;;
1953 esac
1954fi
1955if test X"$trnl" = X; then
1956 case "`echo foo|tr '\012' x 2>/dev/null`" in
1957 foox) trnl='\012' ;;
1958 esac
1959fi
1960if test X"$trnl" = X; then
8be2c24c
JH
1961 case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1962 fooxy) trnl='\n\r' ;;
1963 esac
1964fi
1965if test X"$trnl" = X; then
5ff3f7a4
GS
1966 cat <<EOM >&2
1967
1968$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1969
1970EOM
1971 exit 1
1972fi
1973
2304df62
AD
1974: compute the number of columns on the terminal for proper question formatting
1975case "$COLUMNS" in
1976'') COLUMNS='80';;
1977esac
1978
1979: set up the echo used in my read
1980myecho="case \"\$xxxm\" in
1981'') echo $n \"\$rp $c\" >&4;;
1982*) case \"\$rp\" in
1983 '') echo $n \"[\$xxxm] $c\";;
1984 *)
1985 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1986 echo \"\$rp\" >&4
1987 echo $n \"[\$xxxm] $c\" >&4
1988 else
1989 echo $n \"\$rp [\$xxxm] $c\" >&4
1990 fi
1991 ;;
1992 esac;;
1993esac"
1994
1995: now set up to do reads with possible shell escape and default assignment
1996cat <<EOSC >myread
28757baa 1997$startsh
2304df62
AD
1998xxxm=\$dflt
1999$myecho
2000ans='!'
2001case "\$fastread" in
2002yes) case "\$dflt" in
2003 '') ;;
2004 *) ans='';
2005 case "\$silent-\$rp" in
2006 true-) ;;
2007 *) echo " " >&4;;
2008 esac;;
2009 esac;;
2010*) case "\$silent" in
2011 true) case "\$rp" in
2012 '') ans='';;
2013 esac;;
2014 esac;;
2015esac
2016while expr "X\$ans" : "X!" >/dev/null; do
2017 read answ
2018 set x \$xxxm
2019 shift
dfe9444c 2020 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 2021 case "\$answ" in
dfe9444c
AD
2022 "!")
2023 sh 1>&4
2024 echo " "
2025 $myecho
2026 ;;
2027 !*)
2028 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2029 shift
2030 sh 1>&4 -c "\$*"
2031 echo " "
2032 $myecho
2033 ;;
2304df62
AD
2034 "\$ans")
2035 case "\$ans" in
ecfc5424
AD
2036 \\&*)
2037 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2038 shift
2039 case "\$1" in
2040 -d)
2041 fastread=yes
40a7a20a 2042 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
2043 ;;
2044 -*)
40a7a20a 2045 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
2046 ;;
2047 esac
2048 $myecho
2049 ans=!
2050 ;;
2304df62
AD
2051 esac;;
2052 *)
2053 case "\$aok" in
2054 y)
2055 echo "*** Substitution done -- please confirm."
2056 xxxm="\$ans"
c9795ab7 2057 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
2058 xxxm="\$ans"
2059 ans=!
2060 ;;
2061 *)
2062 echo "*** Error -- try again."
2063 ans=!
2064 ;;
2065 esac
2066 $myecho
2067 ;;
2068 esac
2069 case "\$ans\$xxxm\$nostick" in
2070 '')
2071 ans=!
2072 $myecho
2073 ;;
2074 esac
2075done
2076case "\$ans" in
2077'') ans="\$xxxm";;
2078esac
2079EOSC
2080
2081: create .config dir to save info across Configure sessions
2082test -d ../.config || mkdir ../.config
2083cat >../.config/README <<EOF
2084This directory created by Configure to save information that should
dfe9444c 2085persist across sessions for $package.
2304df62
AD
2086
2087You may safely delete it if you wish.
2088EOF
2089
9507cadf 2090xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 2091case "$usedevel" in
0107c034 2092$define|true|[yY]*) ;;
9507cadf 2093*) case "$xversion" in
0107c034
JH
2094 *[13579])
2095 cat >&4 <<EOH
2096*** WHOA THERE!!! ***
2097
2098 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
2099 The version of this $package distribution is $xversion, that is, odd,
2100 (as opposed to even) and that signifies a development release.
3d5d58b1 2101 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
2102
2103 Do ***NOT*** install this into production use.
2104 Data corruption and crashes are possible.
2105
2106 It is most seriously suggested that you do not continue any further
2107 unless you want to help in developing and debugging Perl.
2108
6adc6a45
JH
2109 If you *still* want to build perl, you can answer 'y' now,
2110 or pass -Dusedevel to Configure.
2111
0107c034
JH
2112EOH
2113 rp='Do you really want to continue?'
2114 dflt='n'
2115 . ./myread
2116 case "$ans" in
8feeef0e
JH
2117 [yY]) echo >&4 "Okay, continuing."
2118 usedevel="$define" ;;
0107c034
JH
2119 *) echo >&4 "Okay, bye."
2120 exit 1
2121 ;;
2122 esac
2123 ;;
2124 esac
2125 ;;
2126esac
8feeef0e
JH
2127case "$usedevel" in
2128$define|true|[yY]*)
2129 case "$versiononly" in
2130 '') versiononly="$define" ;;
2131 esac
2132 case "$installusrbinperl" in
2133 '') installusrbinperl="$undef" ;;
2134 esac
2135 ;;
2136esac
0107c034 2137
2304df62
AD
2138: general instructions
2139needman=true
2140firsttime=true
760ac839 2141user=`(logname) 2>/dev/null`
dfe9444c
AD
2142case "$user" in
2143'') user=`whoami 2>&1`;;
760ac839 2144esac
2304df62
AD
2145if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2146 firsttime=false
2147 echo " "
2148 rp='Would you like to see the instructions?'
2149 dflt=n
2150 . ./myread
2151 case "$ans" in
2152 [yY]*) ;;
2153 *) needman=false;;
2154 esac
2155fi
2156if $needman; then
2157 cat <<EOH
4e2a5f63 2158
2304df62 2159This installation shell script will examine your system and ask you questions
a0d0e21e 2160to determine how the perl5 package should be installed. If you get
2304df62
AD
2161stuck on a question, you may use a ! shell escape to start a subshell or
2162execute a command. Many of the questions will have default answers in square
2163brackets; typing carriage return will give you the default.
2164
2165On some of the questions which ask for file or directory names you are allowed
2166to use the ~name construct to specify the login directory belonging to "name",
2167even if you don't have a shell which knows about that. Questions where this is
2168allowed will be marked "(~name ok)".
2169
2170EOH
2171 rp=''
2172 dflt='Type carriage return to continue'
2173 . ./myread
2174 cat <<'EOH'
2175
2176The prompter used in this script allows you to use shell variables and
2177backticks in your answers. You may use $1, $2, etc... to refer to the words
2178in the default answer, as if the default line was a set of arguments given to a
2179script shell. This means you may also use $* to repeat the whole default line,
2180so you do not have to re-type everything to add something to the default.
2181
2182Everytime there is a substitution, you will have to confirm. If there is an
2183error (e.g. an unmatched backtick), the default answer will remain unchanged
2184and you will be prompted again.
2185
2186If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
2187the questions and use the computed defaults (or the previous answers if there
2188was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 2189You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 2190on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
2191
2192EOH
2193 . ./myread
2194 cat <<EOH
2195
2196Much effort has been expended to ensure that this shell script will run on any
2197Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
2198Configure and run it again. If you can't run Configure for some reason,
2199you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 2200have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
2201
2202This installation script affects things in two ways:
2203
22041) it may do direct variable substitutions on some of the files included
2205 in this kit.
22062) it builds a config.h file for inclusion in C programs. You may edit
2207 any of these files as the need arises after running this script.
2208
2209If you make a mistake on a question, there is no easy way to back up to it
2210currently. The easiest thing to do is to edit config.sh and rerun all the SH
2211files. Configure will offer to let you do this before it runs the SH files.
2212
2213EOH
2214 dflt='Type carriage return to continue'
2215 . ./myread
2216 case "$firsttime" in
2217 true) echo $user >>../.config/instruct;;
2218 esac
2219fi
2220
2304df62
AD
2221: find out where common programs are
2222echo " "
2223echo "Locating common programs..." >&4
2224cat <<EOSC >loc
2225$startsh
2226case \$# in
22270) exit 1;;
2228esac
2229thing=\$1
2230shift
2231dflt=\$1
2232shift
2233for dir in \$*; do
2234 case "\$thing" in
2235 .)
2236 if test -d \$dir/\$thing; then
2237 echo \$dir
2238 exit 0
2239 fi
2240 ;;
2241 *)
a0d0e21e 2242 for thisthing in \$dir/\$thing; do
ecfc5424 2243 : just loop through to pick last item
a0d0e21e 2244 done
25f94b33 2245 if test -f \$thisthing; then
a0d0e21e 2246 echo \$thisthing
2304df62 2247 exit 0
a5a94ea5
JH
2248 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2249 echo \$thisthing
2250 exit 0
2304df62 2251 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
2252 if test -n "$DJGPP"; then
2253 echo \$dir/\$thing.exe
b921d661 2254 elif test "$eunicefix" != ":"; then
c4f23d77
AD
2255 : on Eunice apparently
2256 echo \$dir/\$thing
b921d661 2257 exit 0
c4f23d77 2258 fi
2d736872 2259 exit 0
2304df62
AD
2260 fi
2261 ;;
2262 esac
2263done
2264echo \$dflt
2265exit 1
2266EOSC
2267chmod +x loc
2268$eunicefix loc
2269loclist="
2270awk
2271cat
f8006fac 2272chmod
b4eb6b3d
JH
2273comm
2274cp
2304df62
AD
2275echo
2276expr
2277grep
a0d0e21e 2278ls
b4eb6b3d 2279mkdir
2304df62
AD
2280rm
2281sed
b4eb6b3d 2282sort
85e6fe83 2283touch
2304df62 2284tr
b4eb6b3d 2285uniq
2304df62
AD
2286"
2287trylist="
2288Mcc
dfe9444c 2289ar
3659ebf1 2290bison
b4eb6b3d 2291byacc
2304df62 2292cpp
b4eb6b3d 2293csh
2304df62
AD
2294date
2295egrep
1fef16b3 2296gmake
8ff267be 2297gzip
b4eb6b3d 2298less
8ff267be 2299ln
3c728e00 2300make
b4eb6b3d 2301more
693762b4 2302nm
b4eb6b3d
JH
2303nroff
2304pg
2304df62
AD
2305test
2306uname
8ff267be 2307zip
2304df62 2308"
8e07c86e 2309pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2310pth="$pth /lib /usr/lib"
2311for file in $loclist; do
dfe9444c
AD
2312 eval xxx=\$$file
2313 case "$xxx" in
2314 /*|?:[\\/]*)
2315 if test -f "$xxx"; then
2316 : ok
2317 else
2318 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2319 xxx=`./loc $file $file $pth`
2320 fi
2321 ;;
2322 '') xxx=`./loc $file $file $pth`;;
2323 *) xxx=`./loc $xxx $xxx $pth`;;
2324 esac
a5a94ea5 2325 eval $file=$xxx$_exe
2304df62
AD
2326 eval _$file=$xxx
2327 case "$xxx" in
2328 /*)
2329 echo $file is in $xxx.
2330 ;;
8e07c86e
AD
2331 ?:[\\/]*)
2332 echo $file is in $xxx.
2333 ;;
2304df62 2334 *)
25f94b33
AD
2335 echo "I don't know where '$file' is, and my life depends on it." >&4
2336 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2337 exit 1
2304df62
AD
2338 ;;
2339 esac
2340done
2341echo " "
2342echo "Don't worry if any of the following aren't found..."
2343say=offhand
2344for file in $trylist; do
dfe9444c
AD
2345 eval xxx=\$$file
2346 case "$xxx" in
2347 /*|?:[\\/]*)
2348 if test -f "$xxx"; then
2349 : ok
2350 else
2351 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2352 xxx=`./loc $file $file $pth`
2353 fi
2354 ;;
2355 '') xxx=`./loc $file $file $pth`;;
2356 *) xxx=`./loc $xxx $xxx $pth`;;
2357 esac
306a8474 2358 eval $file=$xxx$_exe
2304df62
AD
2359 eval _$file=$xxx
2360 case "$xxx" in
2361 /*)
2362 echo $file is in $xxx.
2363 ;;
8e07c86e
AD
2364 ?:[\\/]*)
2365 echo $file is in $xxx.
2366 ;;
2304df62
AD
2367 *)
2368 echo "I don't see $file out there, $say."
2369 say=either
2370 ;;
2371 esac
2372done
2373case "$egrep" in
1fef16b3 2374egrep)
2304df62
AD
2375 echo "Substituting grep for egrep."
2376 egrep=$grep
868439a2 2377 _egrep=$grep
2304df62
AD
2378 ;;
2379esac
8ff267be 2380case "$ln" in
1fef16b3 2381ln)
8ff267be 2382 echo "Substituting cp for ln."
2383 ln=$cp
868439a2 2384 _ln=$cp
8ff267be 2385 ;;
2386esac
2e26f1d5
JH
2387case "$make" in
2388make)
2389 case "$gmake" in
2390 gmake)
2391 echo "I can't find make or gmake, and my life depends on it." >&4
2392 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2393 exit 1
2394 ;;
2395 esac
2396 ;;
2397esac
2398case "$gmake" in
2399gmake) ;;
2400*) # We can't have osname yet.
1fef16b3
JH
2401 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2402 # Assume that gmake, if found, is definitely GNU make
2403 # and prefer it over the system make.
2404 echo "Substituting gmake for make."
2405 make=$gmake
868439a2 2406 _make=$gmake
1fef16b3
JH
2407 fi
2408 ;;
a5a94ea5 2409esac
2304df62
AD
2410case "$test" in
2411test)
2412 echo "Hopefully test is built into your sh."
2413 ;;
2414*)
73614538 2415 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2416 echo "Using the test built into your sh."
2304df62
AD
2417 test=test
2418 _test=test
2419 fi
2420 ;;
2421esac
2422case "$echo" in
2423echo)
2424 echo "Hopefully echo is built into your sh."
2425 ;;
2426'') ;;
2427*)
2428 echo " "
2429echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2430 $echo $n "hi there$c" >foo1
2431 echo $n "hi there$c" >foo2
2432 if cmp foo1 foo2 >/dev/null 2>&1; then
2433 echo "They are compatible. In fact, they may be identical."
2434 else
2435 case "$n" in
2436 '-n') n='' c='\c';;
2437 *) n='-n' c='';;
2438 esac
2439 cat <<FOO
2440They are not compatible! You are probably running ksh on a non-USG system.
2441I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2442have echo built in and we may have to run some Bourne shell scripts. That
2443means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2444
2445FOO
2446 $echo $n "The star should be here-->$c"
2447 $echo "*"
2448 fi
2449 $rm -f foo1 foo2
2450 ;;
2451esac
2452
6b769f8f 2453cat <<EOS >trygcc
2573c5f9
JH
2454$startsh
2455EOS
6b769f8f 2456cat <<'EOSC' >>trygcc
2573c5f9
JH
2457case "$cc" in
2458'') ;;
2459*) $rm -f try try.*
2460 $cat >try.c <<EOM
2461int main(int argc, char *argv[]) {
2462 return 0;
2463}
2464EOM
e4778687 2465 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2466 :
2467 else
2468 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2469 despair=yes
2470 trygcc=yes
2471 case "$cc" in
2472 *gcc*) trygcc=no ;;
2473 esac
2474 case "`$cc -v -c try.c 2>&1`" in
2475 *gcc*) trygcc=no ;;
2476 esac
2477 if $test X"$trygcc" = Xyes; then
2478 if gcc -o try -c try.c; then
2479 echo " "
2480 echo "You seem to have a working gcc, though." >&4
2481 rp="Would you like to use it?"
2482 dflt=y
2483 if $test -f myread; then
2484 . ./myread
2485 else
2486 if $test -f UU/myread; then
2487 . ./UU/myread
2488 else
2489 echo "Cannot find myread, sorry. Aborting." >&2
2490 exit 1
2491 fi
2492 fi
2493 case "$ans" in
6371411c
RB
2494 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2495 if $test -f usethreads.cbu; then
2496 $cat >&4 <<EOM
2497
2498*** However, any setting of the C compiler flags (e.g. for thread support)
2499*** has been lost. It may be necessary to pass -Dcc=gcc to Configure
2500*** (together with e.g. -Dusethreads).
2501
2502EOM
2503 fi;;
2573c5f9
JH
2504 esac
2505 fi
2506 fi
6b769f8f
RB
2507 fi
2508 $rm -f try try.*
2509 ;;
2510esac
2511EOSC
2512
2513cat <<EOS >checkcc
2514$startsh
2515EOS
2516cat <<'EOSC' >>checkcc
2517case "$cc" in
2518'') ;;
2519*) $rm -f try try.*
2520 $cat >try.c <<EOM
2521int main(int argc, char *argv[]) {
2522 return 0;
2523}
2524EOM
2525 if $cc -o try $ccflags $ldflags try.c; then
2526 :
2527 else
2573c5f9 2528 if $test X"$despair" = Xyes; then
6b769f8f
RB
2529 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2530 fi
2531 $cat >&4 <<EOM
5dd4fbdf
MB
2532You need to find a working C compiler.
2533Either (purchase and) install the C compiler supplied by your OS vendor,
2534or for a free C compiler try http://gcc.gnu.org/
2535I cannot continue any further, aborting.
2536EOM
6b769f8f 2537 exit 1
2573c5f9
JH
2538 fi
2539 $rm -f try try.*
2540 ;;
2541esac
2542EOSC
2543
a0d0e21e
LW
2544: determine whether symbolic links are supported
2545echo " "
2546$touch blurfl
2547if $ln -s blurfl sym > /dev/null 2>&1 ; then
2548 echo "Symbolic links are supported." >&4
818f00be 2549 lns="$ln -s"
a0d0e21e
LW
2550else
2551 echo "Symbolic links are NOT supported." >&4
2552 lns="$ln"
2553fi
2554$rm -f blurfl sym
2555
dafca956
JH
2556: determine whether symbolic links are supported
2557echo " "
2558case "$lns" in
18ea2752 2559*"ln"*" -s")
dafca956
JH
2560 echo "Checking how to test for symbolic links..." >&4
2561 $lns blurfl sym
4b661809 2562 if $test "X$issymlink" = X; then
2e2a97a6
JH
2563 case "$newsh" in
2564 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2565 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2566 esac
5d644a95
MB
2567 if test $? = 0; then
2568 issymlink="test -h"
2e2a97a6
JH
2569 else
2570 echo "Your builtin 'test -h' may be broken." >&4
2571 case "$test" in
2572 /*) ;;
2573 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2574 for p in $pth
2575 do
2576 if test -f "$p/$test"; then
2577 test="$p/$test"
2578 break
2579 fi
2580 done
2581 ;;
2582 esac
2583 case "$test" in
2584 /*)
2585 echo "Trying external '$test -h'." >&4
2586 issymlink="$test -h"
2587 if $test ! -h sym >/dev/null 2>&1; then
3c728e00 2588 echo "External '$test -h' is broken, too." >&4
2e2a97a6
JH
2589 issymlink=''
2590 fi
2591 ;;
2592 *) issymlink='' ;;
2593 esac
5d644a95
MB
2594 fi
2595 fi
4b661809 2596 if $test "X$issymlink" = X; then
dafca956 2597 if $test -L sym 2>/dev/null; then
5d644a95 2598 issymlink="$test -L"
2e2a97a6 2599 echo "The builtin '$test -L' worked." >&4
dafca956
JH
2600 fi
2601 fi
4b661809 2602 if $test "X$issymlink" != X; then
5d644a95 2603 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2604 else
2605 echo "I do not know how you can test for symbolic links." >&4
2606 fi
2607 $rm -f blurfl sym
2608 ;;
2609*) echo "No symbolic links, so not testing for their testing..." >&4
2610 ;;
2611esac
2612echo " "
2613
2614
2615case "$mksymlinks" in
2616$define|true|[yY]*)
2617 case "$src" in
2618 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2619 exit 1
2620 ;;
4b661809 2621 *) case "$lns:$issymlink" in
f314eb9f 2622 *"ln"*" -s:"*"test -"?)
dafca956
JH
2623 echo "Creating the symbolic links..." >&4
2624 echo "(First creating the subdirectories...)" >&4
2625 cd ..
2626 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2627 read directory
2628 test -z "$directory" && break
2629 mkdir -p $directory
2630 done
2631 # Sanity check 1.
2632 if test ! -d t/base; then
2633 echo "Failed to create the subdirectories. Aborting." >&4
2634 exit 1
2635 fi
2636 echo "(Then creating the symlinks...)" >&4
2637 awk '{print $1}' $src/MANIFEST | while true; do
2638 read filename
2639 test -z "$filename" && break
2640 if test -f $filename; then
5d644a95 2641 if $issymlink $filename; then
dafca956
JH
2642 rm -f $filename
2643 fi
2644 fi
2645 if test -f $filename; then
2646 echo "$filename already exists, not symlinking."
2647 else
2648 ln -s $src/$filename $filename
2649 fi
2650 done
2651 # Sanity check 2.
a0d24b8a
JH
2652 if test ! -f t/base/lex.t; then
2653 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
dafca956
JH
2654 exit 1
2655 fi
2656 cd UU
2657 ;;
2658 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2659 ;;
2660 esac
2661 ;;
2662 esac
2663 ;;
2664esac
2665
5440bc8e
JH
2666
2667case "$usecrosscompile" in
2668$define|true|[yY]*)
93bc48fa 2669 $echo "Cross-compiling..."
5440bc8e
JH
2670 croak=''
2671 case "$cc" in
2672 *-*-gcc) # A cross-compiling gcc, probably.
93bc48fa 2673 targetarch=`$echo $cc|$sed 's/-gcc$//'`
5440bc8e
JH
2674 ar=$targetarch-ar
2675 # leave out ld, choosing it is more complex
2676 nm=$targetarch-nm
2677 ranlib=$targetarch-ranlib
93bc48fa 2678 $echo 'extern int foo;' > try.c
f8006fac 2679 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
93bc48fa
JH
2680 shift
2681 if $test $# -gt 0; then
2682 incpth="$incpth $*"
f8006fac
JH
2683 incpth="`$echo $incpth|$sed 's/^ //'`"
2684 echo "Guessing incpth '$incpth'." >&4
93bc48fa 2685 for i in $*; do
f8006fac 2686 j="`$echo $i|$sed 's,/include$,/lib,'`"
93bc48fa
JH
2687 if $test -d $j; then
2688 libpth="$libpth $j"
2689 fi
2690 done
f8006fac
JH
2691 libpth="`$echo $libpth|$sed 's/^ //'`"
2692 echo "Guessing libpth '$libpth'." >&4
93bc48fa
JH
2693 fi
2694 $rm -f try.c
5440bc8e
JH
2695 ;;
2696 esac
2697 case "$targetarch" in
93bc48fa
JH
2698 '') echo "Targetarch not defined." >&4; croak=y ;;
2699 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e
JH
2700 esac
2701 case "$incpth" in
93bc48fa 2702 '') echo "Incpth not defined." >&4; croak=y ;;
f8006fac 2703 *) echo "Using incpth '$incpth'." >&4 ;;
5440bc8e
JH
2704 esac
2705 case "$libpth" in
93bc48fa 2706 '') echo "Libpth not defined." >&4; croak=y ;;
f8006fac 2707 *) echo "Using libpth '$libpth'." >&4 ;;
5440bc8e 2708 esac
93bc48fa
JH
2709 case "$usrinc" in
2710 '') for i in $incpth; do
2711 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2712 usrinc=$i
2713 echo "Guessing usrinc $usrinc." >&4
2714 break
2715 fi
2716 done
2717 case "$usrinc" in
2718 '') echo "Usrinc not defined." >&4; croak=y ;;
2719 esac
2720 ;;
2721 *) echo "Using usrinc $usrinc." >&4 ;;
5440bc8e 2722 esac
93bc48fa
JH
2723 case "$targethost" in
2724 '') echo "Targethost not defined." >&4; croak=y ;;
2725 *) echo "Using targethost $targethost." >&4
5440bc8e 2726 esac
93bc48fa
JH
2727 locincpth=' '
2728 loclibpth=' '
5440bc8e 2729 case "$croak" in
93bc48fa 2730 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e
JH
2731 esac
2732 case "$src" in
2733 /*) run=$src/Cross/run
93c0359c 2734 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2735 to=$src/Cross/to
2736 from=$src/Cross/from
2737 ;;
93bc48fa 2738 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2739 run=$pwd/Cross/run
f8006fac 2740 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2741 to=$pwd/Cross/to
2742 from=$pwd/Cross/from
2743 ;;
2744 esac
2745 case "$targetrun" in
2746 '') targetrun=ssh ;;
2747 esac
2748 case "$targetto" in
2749 '') targetto=scp ;;
2750 esac
2751 case "$targetfrom" in
2752 '') targetfrom=scp ;;
2753 esac
2754 run=$run-$targetrun
2755 to=$to-$targetto
2756 from=$from-$targetfrom
93bc48fa
JH
2757 case "$targetdir" in
2758 '') targetdir=/tmp
2759 echo "Guessing targetdir $targetdir." >&4
2760 ;;
2761 esac
5440bc8e 2762 case "$targetuser" in
93bc48fa
JH
2763 '') targetuser=root
2764 echo "Guessing targetuser $targetuser." >&4
2765 ;;
5440bc8e
JH
2766 esac
2767 case "$targetfrom" in
2768 scp) q=-q ;;
2769 *) q='' ;;
2770 esac
2771 case "$targetrun" in
2772 ssh|rsh)
2773 cat >$run <<EOF
2774#!/bin/sh
93c0359c
JH
2775case "\$1" in
2776-cwd)
2777 shift
2778 cwd=\$1
2779 shift
2780 ;;
2781esac
2782case "\$cwd" in
2783'') cwd=$targetdir ;;
2784esac
5440bc8e
JH
2785exe=\$1
2786shift
93c0359c
JH
2787if $test ! -f \$exe.xok; then
2788 $to \$exe
2789 $touch \$exe.xok
2790fi
2791$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
5440bc8e
JH
2792EOF
2793 ;;
93bc48fa 2794 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
2795 exit 1
2796 ;;
2797 esac
93c0359c
JH
2798 case "$targetmkdir" in
2799 */Cross/mkdir)
2800 cat >$targetmkdir <<EOF
2801#!/bin/sh
2802$targetrun -l $targetuser $targethost "mkdir -p \$@"
2803EOF
f8006fac 2804 $chmod a+rx $targetmkdir
93c0359c
JH
2805 ;;
2806 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
2807 exit 1
2808 ;;
2809 esac
5440bc8e
JH
2810 case "$targetto" in
2811 scp|rcp)
2812 cat >$to <<EOF
2813#!/bin/sh
2814for f in \$@
2815do
93c0359c
JH
2816 case "\$f" in
2817 /*)
2818 $targetmkdir \`dirname \$f\`
2819 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
2820 ;;
2821 *)
2822 $targetmkdir $targetdir/\`dirname \$f\`
2823 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2824 ;;
2825 esac
5440bc8e
JH
2826done
2827exit 0
2828EOF
2829 ;;
2830 cp) cat >$to <<EOF
2831#!/bin/sh
93c0359c
JH
2832for f in \$@
2833do
2834 case "\$f" in
2835 /*)
2836 $mkdir -p $targetdir/\`dirname \$f\`
2837 $cp \$f $targetdir/\$f || exit 1
2838 ;;
2839 *)
2840 $targetmkdir $targetdir/\`dirname \$f\`
2841 $cp \$f $targetdir/\$f || exit 1
2842 ;;
2843 esac
2844done
2845exit 0
5440bc8e
JH
2846EOF
2847 ;;
93bc48fa 2848 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
2849 exit 1
2850 ;;
2851 esac
2852 case "$targetfrom" in
2853 scp|rcp)
2854 cat >$from <<EOF
2855#!/bin/sh
2856for f in \$@
2857do
93c0359c 2858 $rm -f \$f
5440bc8e
JH
2859 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2860done
2861exit 0
2862EOF
2863 ;;
2864 cp) cat >$from <<EOF
2865#!/bin/sh
2866for f in \$@
2867do
93c0359c 2868 $rm -f \$f
5440bc8e
JH
2869 cp $targetdir/\$f . || exit 1
2870done
2871exit 0
2872EOF
2873 ;;
93bc48fa 2874 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
2875 exit 1
2876 ;;
2877 esac
93bc48fa
JH
2878 if $test ! -f $run; then
2879 echo "Target 'run' script '$run' not found." >&4
5440bc8e 2880 else
f8006fac 2881 $chmod a+rx $run
5440bc8e 2882 fi
93bc48fa
JH
2883 if $test ! -f $to; then
2884 echo "Target 'to' script '$to' not found." >&4
5440bc8e 2885 else
f8006fac 2886 $chmod a+rx $to
5440bc8e 2887 fi
93bc48fa
JH
2888 if $test ! -f $from; then
2889 echo "Target 'from' script '$from' not found." >&4
5440bc8e 2890 else
f8006fac 2891 $chmod a+rx $from
5440bc8e 2892 fi
93bc48fa 2893 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
2894 exit 1
2895 fi
2896 cat >&4 <<EOF
f8006fac
JH
2897Using '$run' for remote execution,
2898and '$from' and '$to'
93bc48fa 2899for remote file transfer.
5440bc8e
JH
2900EOF
2901 ;;
2902*) run=''
2903 to=:
2904 from=:
2905 usecrosscompile='undef'
2906 targetarch=''
2907 ;;
2908esac
2909
ecfc5424
AD
2910: see whether [:lower:] and [:upper:] are supported character classes
2911echo " "
ecfc5424
AD
2912case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2913ABYZ)
2914 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2915 up='[:upper:]'
2916 low='[:lower:]'
2917 ;;
416d0bea
MB
2918*) # There is a discontinuity in EBCDIC between 'R' and 'S'
2919 # (0xd9 and 0xe2), therefore that is a nice testing point.
2920 if test "X$up" = X -o "X$low" = X; then
2921 case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2922 rs) up='[A-Z]'
2923 low='[a-z]'
28e8609d
JH
2924 ;;
2925 esac
416d0bea 2926 fi
28e8609d 2927 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2928 case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2929 rs) up='A-Z'
28e8609d
JH
2930 low='a-z'
2931 ;;
2932 esac
416d0bea 2933 fi
28e8609d 2934 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2935 case "`echo RS | od -x 2>/dev/null`" in
2936 *D9E2*|*d9e2*)
28e8609d
JH
2937 echo "Hey, this might be EBCDIC." >&4
2938 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2939 case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2940 rs) up='[A-IJ-RS-Z]'
2941 low='[a-ij-rs-z]'
28e8609d
JH
2942 ;;
2943 esac
2944 fi
2945 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2946 case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2947 rs) up='A-IJ-RS-Z'
2948 low='a-ij-rs-z'
28e8609d
JH
2949 ;;
2950 esac
2951 fi
2952 ;;
2953 esac
2954 fi
2955esac
416d0bea
MB
2956case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2957rs)
28e8609d
JH
2958 echo "Using $up and $low to convert case." >&4
2959 ;;
ecfc5424 2960*)
28e8609d
JH
2961 echo "I don't know how to translate letters from upper to lower case." >&4
2962 echo "Your tr is not acting any way I know of." >&4
2963 exit 1
2964 ;;
ecfc5424
AD
2965esac
2966: set up the translation script tr, must be called with ./tr of course
2967cat >tr <<EOSC
2968$startsh
2969case "\$1\$2" in
2970'[A-Z][a-z]') exec $tr '$up' '$low';;
2971'[a-z][A-Z]') exec $tr '$low' '$up';;
2972esac
2973exec $tr "\$@"
2974EOSC
2975chmod +x tr
2976$eunicefix tr
2977
2304df62
AD
2978: Try to determine whether config.sh was made on this system
2979case "$config_sh" in
2980'')
43999f95
JH
2981myuname=`$uname -a 2>/dev/null`
2982$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
2983# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2984# because the A-Z/a-z are not consecutive.
a0d0e21e 2985myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2986 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2987newmyuname="$myuname"
2304df62 2988dflt=n
16d20bd9
AD
2989case "$knowitall" in
2990'')
2991 if test -f ../config.sh; then
2992 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2993 eval "`grep myuname= ../config.sh`"
2994 fi
2995 if test "X$myuname" = "X$newmyuname"; then
2996 dflt=y
2997 fi
2304df62 2998 fi
16d20bd9
AD
2999 ;;
3000*) dflt=y;;
3001esac
2304df62
AD
3002
3003: Get old answers from old config file if Configure was run on the
3004: same system, otherwise use the hints.
3005hint=default
3006cd ..
3007if test -f config.sh; then
16d20bd9
AD
3008 echo " "
3009 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
3010 . UU/myread
3011 case "$ans" in
f83701cd
AD
3012 n*|N*) echo "OK, I'll ignore it."
3013 mv config.sh config.sh.old
3014 myuname="$newmyuname"
3015 ;;
2304df62 3016 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
3017 tmp_n="$n"
3018 tmp_c="$c"
85cad39c 3019 tmp_sh="$sh"
2304df62
AD
3020 . ./config.sh
3021 cp config.sh UU
ecfc5424
AD
3022 n="$tmp_n"
3023 c="$tmp_c"
85cad39c 3024 : Older versions did not always set $sh. Catch re-use of such
3025 : an old config.sh.
3026 case "$sh" in
3027 '') sh="$tmp_sh" ;;
3028 esac
2304df62
AD
3029 hint=previous
3030 ;;
3031 esac
3032fi
2573c5f9 3033. ./UU/checkcc
2304df62
AD
3034if test ! -f config.sh; then
3035 $cat <<EOM
3036
4e2a5f63
AD
3037First time through, eh? I have some defaults handy for some systems
3038that need some extra help getting the Configure answers right:
2304df62
AD
3039
3040EOM
dfe9444c 3041 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
3042 dflt=''
3043 : Half the following guesses are probably wrong... If you have better
7f2de2d2 3044 : tests or hints, please send them to perlbug@perl.org
2304df62 3045 : The metaconfig authors would also appreciate a copy...
a0d0e21e 3046 $test -f /irix && osname=irix
85e6fe83
LW
3047 $test -f /xenix && osname=sco_xenix
3048 $test -f /dynix && osname=dynix
3049 $test -f /dnix && osname=dnix
5f05dabc 3050 $test -f /lynx.os && osname=lynxos
3051 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 3052 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 3053 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 3054 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
3055 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3056 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
3057 $test -d /usr/apollo/bin && osname=apollo
3058 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 3059 $test -d /usr/include/minix && osname=minix
d54344fc 3060 $test -f /system/gnu_library/bin/ar.pm && osname=vos
e060872b 3061 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 3062 osname=machten
4633a7c4 3063 if $test -x /sbin/version; then
dfe9444c 3064 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
3065 $sed -e 's/[A-Za-z]$//'`
3066 elif $test -x /usr/etc/version; then
dfe9444c 3067 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
3068 $sed -e 's/[A-Za-z]$//'`
3069 else
3070 osvers="$2.$3"
3071 fi
3072 fi
aaacdc8b
GS
3073
3074 $test -f /sys/posix.dll &&
3075 $test -f /usr/bin/what &&
3076 set X `/usr/bin/what /sys/posix.dll` &&
3077 $test "$3" = UWIN &&
3078 osname=uwin &&
3079 osvers="$5"
3080
2304df62
AD
3081 if $test -f $uname; then
3082 set X $myuname
3083 shift
3084
2304df62 3085 case "$5" in
85e6fe83 3086 fps*) osname=fps ;;
2304df62
AD
3087 mips*)
3088 case "$4" in
85e6fe83
LW
3089 umips) osname=umips ;;
3090 *) osname=mips ;;
2304df62 3091 esac;;
85e6fe83
LW
3092 [23]100) osname=mips ;;
3093 next*) osname=next ;;
ecfc5424 3094 i386*)
c6912327
JH
3095 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3096 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
3097 osname='sco'
3098 osvers=$tmp
3099 elif $test -f /etc/kconfig; then
ecfc5424 3100 osname=isc
bd628c73 3101 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
3102 osvers=4
3103 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3104 osvers=3
2304df62 3105 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 3106 osvers=2
ecfc5424
AD
3107 fi
3108 fi
2000072c 3109 tmp=''
ecfc5424 3110 ;;
c4f23d77
AD
3111 pc*)
3112 if test -n "$DJGPP"; then
3113 osname=dos
3114 osvers=djgpp
3115 fi
3116 ;;
2304df62
AD
3117 esac
3118
3119 case "$1" in
a0d0e21e
LW
3120 aix) osname=aix
3121 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3122 case "$tmp" in
e81c5c2a
NC
3123 # oslevel can fail with:
3124 # oslevel: Unable to acquire lock.
3125 *not\ found) osvers="$4"."$3" ;;
a0d0e21e
LW
3126 '<3240'|'<>3240') osvers=3.2.0 ;;
3127 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3128 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 3129 *) osvers=$tmp;;
a0d0e21e
LW
3130 esac
3131 ;;
aaacdc8b
GS
3132 bsd386) osname=bsd386
3133 osvers=`$uname -r`
3134 ;;
3135 cygwin*) osname=cygwin
3136 osvers="$3"
3137 ;;
23f87696
SZ
3138 *dc.osx) osname=dcosx
3139 osvers="$3"
3140 ;;
a0d0e21e
LW
3141 dnix) osname=dnix
3142 osvers="$3"
3143 ;;
3144 domainos) osname=apollo
3145 osvers="$3"
3146 ;;
a774dfe6
RSG
3147 dgux) osname=dgux
3148 osvers="$3"
3149 ;;
3150 dragonfly) osname=dragonfly
a0d0e21e
LW
3151 osvers="$3"
3152 ;;
760ac839 3153 dynixptx*) osname=dynixptx
e58e581d 3154 osvers=`echo "$4"|sed 's/^v//'`
760ac839 3155 ;;
a774dfe6 3156 freebsd) osname=freebsd
a0d0e21e 3157 osvers="$3" ;;
761ee4e8
BD
3158 genix) osname=genix ;;
3159 gnu) osname=gnu
3160 osvers="$3" ;;
a774dfe6 3161 hp*) osname=hpux
bfb7748a 3162 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 3163 ;;
761ee4e8 3164 irix*) osname=irix
a0d0e21e
LW
3165 case "$3" in
3166 4*) osvers=4 ;;
3167 5*) osvers=5 ;;
ecfc5424 3168 *) osvers="$3" ;;
a0d0e21e
LW
3169 esac
3170 ;;
761ee4e8 3171 linux) osname=linux
a0d0e21e 3172 case "$3" in
a0d0e21e
LW
3173 *) osvers="$3" ;;
3174 esac
3175 ;;
761ee4e8 3176 MiNT) osname=mint
28e8609d
JH
3177 ;;
3178 netbsd*) osname=netbsd
ecfc5424
AD
3179 osvers="$3"
3180 ;;
4e81affe
MM
3181 news-os) osvers="$3"
3182 case "$3" in
3183 4*) osname=newsos4 ;;
3184 *) osname=newsos ;;
3185 esac
3186 ;;
aaacdc8b 3187 next*) osname=next ;;
28bb1e2c 3188 nonstop-ux) osname=nonstopux ;;
65dc58a1
TM
3189 openbsd) osname=openbsd
3190 osvers="$3"
3191 ;;
5c728af0
IZ
3192 os2) osname=os2
3193 osvers="$4"
3194 ;;
aaacdc8b
GS
3195 POSIX-BC | posix-bc ) osname=posix-bc
3196 osvers="$3"
a0d0e21e 3197 ;;
ae3afa4e
TH
3198 powerux | power_ux | powermax_os | powermaxos | \
3199 powerunix | power_unix) osname=powerux
3200 osvers="$3"
3201 ;;
aaacdc8b
GS
3202 qnx) osname=qnx
3203 osvers="$4"
3204 ;;
a0d0e21e
LW
3205 solaris) osname=solaris
3206 case "$3" in
3207 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 3208 *) osvers="$3" ;;
a0d0e21e
LW
3209 esac
3210 ;;
85e6fe83
LW
3211 sunos) osname=sunos
3212 case "$3" in
85e6fe83
LW
3213 5*) osname=solaris
3214 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 3215 *) osvers="$3" ;;
2304df62
AD
3216 esac
3217 ;;
a0d0e21e 3218 titanos) osname=titanos
85e6fe83 3219 case "$3" in
a0d0e21e
LW
3220 1*) osvers=1 ;;
3221 2*) osvers=2 ;;
3222 3*) osvers=3 ;;
3223 4*) osvers=4 ;;
ecfc5424 3224 *) osvers="$3" ;;
2304df62
AD
3225 esac
3226 ;;
85e6fe83 3227 ultrix) osname=ultrix
ecfc5424 3228 osvers="$3"
2304df62 3229 ;;
28757baa 3230 osf1|mls+) case "$5" in
fed7345c
AD
3231 alpha)
3232 osname=dec_osf
fdd85a03 3233 osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2aa76180
JH
3234 case "$osvers" in
3235 [1-9].[0-9]*) ;;
3236 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3237 esac
ecfc5424
AD
3238 ;;
3239 hp*) osname=hp_osf1 ;;
3240 mips) osname=mips_osf1 ;;
85e6fe83
LW
3241 esac
3242 ;;
af1ff193 3243 # UnixWare 7.1.2 is known as Open UNIX 8
381c1bae 3244 openunix|unixware) osname=svr5
0337d152
BG
3245 osvers="$4"
3246 ;;
3c728e00 3247 uts) osname=uts
a0d0e21e
LW
3248 osvers="$3"
3249 ;;
3c728e00
JH
3250 vos) osvers="$3"
3251 ;;
85e6fe83 3252 $2) case "$osname" in
2304df62 3253 *isc*) ;;
a0d0e21e 3254 *freebsd*) ;;
5f05dabc 3255 svr*)
a0d0e21e 3256 : svr4.x or possibly later
a774dfe6 3257 case "svr$3" in
a0d0e21e
LW
3258 ${osname}*)
3259 osname=svr$3
3260 osvers=$4
3261 ;;
3262 esac
3263 case "$osname" in
3264 svr4.0)
3265 : Check for ESIX
3266 if test -f /stand/boot ; then
3267 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
3268 if test -n "$INITPROG" -a -f "$INITPROG"; then
3269 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3270 if test -n "$isesix"; then
a0d0e21e
LW
3271 osname=esix4
3272 fi
3273 fi
3274 fi
3275 ;;
3276 esac
3277 ;;
2304df62 3278 *) if test -f /etc/systemid; then
a0d0e21e
LW
3279 osname=sco
3280 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 3281 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 3282 osvers=$1.$2.$3
c4f23d77 3283 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 3284 osvers=$1.$2
c4f23d77 3285 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 3286 osvers=$1
2304df62 3287 fi
a0d0e21e
LW
3288 else
3289 case "$osname" in
3290 '') : Still unknown. Probably a generic Sys V.
3291 osname="sysv"
3292 osvers="$3"
3293 ;;
3294 esac
2304df62
AD
3295 fi
3296 ;;
3297 esac
3298 ;;
a0d0e21e
LW
3299 *) case "$osname" in
3300 '') : Still unknown. Probably a generic BSD.
3301 osname="$1"
3302 osvers="$3"
3303 ;;
3304 esac
3305 ;;
2304df62
AD
3306 esac
3307 else
dfe9444c
AD
3308 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3309 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3310 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3311 osname=news_os
2304df62 3312 fi
dfe9444c 3313 $rm -f UU/kernel.what
5c728af0 3314 elif test -d c:/. -o -n "$is_os2" ; then
8e07c86e
AD
3315 set X $myuname
3316 osname=os2
3317 osvers="$5"
2304df62
AD
3318 fi
3319 fi
a774dfe6 3320
5440bc8e
JH
3321 case "$targetarch" in
3322 '') ;;
3323 *) hostarch=$osname
3324 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3325 osvers=''
3326 ;;
3327 esac
3328
a0d0e21e
LW
3329 : Now look for a hint file osname_osvers, unless one has been
3330 : specified already.
3331 case "$hintfile" in
3332 ''|' ')
1e127011 3333 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 3334 : Also try without trailing minor version numbers.
1e127011
DD
3335 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3336 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3337 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3338 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
3339 case "$file" in
3340 '') dflt=none ;;
3341 *) case "$osvers" in
3342 '') dflt=$file
3343 ;;
dfe9444c 3344 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 3345 dflt=$file
dfe9444c 3346 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 3347 dflt=$xfile
dfe9444c 3348 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 3349 dflt=$xxfile
dfe9444c 3350 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 3351 dflt=$xxxfile
dfe9444c 3352 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 3353 dflt=$xxxxfile
dfe9444c 3354 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
3355 dflt="${osname}"
3356 else
3357 dflt=none
3358 fi
3359 ;;
3360 esac
85e6fe83
LW
3361 ;;
3362 esac
4e2a5f63
AD
3363 if $test -f Policy.sh ; then
3364 case "$dflt" in
3365 *Policy*) ;;
3366 none) dflt="Policy" ;;
3367 *) dflt="Policy $dflt" ;;
3368 esac
3369 fi
85e6fe83 3370 ;;
a0d0e21e 3371 *)
ecfc5424 3372 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3373 ;;
2304df62 3374 esac
1aef975c 3375
4e2a5f63
AD
3376 if $test -f Policy.sh ; then
3377 $cat <<EOM
3378
3379There's also a Policy hint file available, which should make the
3380site-specific (policy) questions easier to answer.
3381EOM
3382
3383 fi
3384
2304df62
AD
3385 $cat <<EOM
3386
3387You may give one or more space-separated answers, or "none" if appropriate.
a2d23ec2
MB
3388If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3389previous run of Configure, you may specify it as well as or instead of
3390OS-specific hints. If hints are provided for your OS, you should use them:
3391although Perl can probably be built without hints on many platforms, using
3392hints often improve performance and may enable features that Configure can't
3393set up on its own. If there are no hints that match your OS, specify "none";
3394DO NOT give a wrong version or a wrong OS.
2304df62
AD
3395
3396EOM
4e2a5f63 3397
2304df62 3398 rp="Which of these apply, if any?"
dfe9444c 3399 . UU/myread
85e6fe83
LW
3400 tans=$ans
3401 for file in $tans; do
4e2a5f63
AD
3402 if $test X$file = XPolicy -a -f Policy.sh; then
3403 . Policy.sh
3404 $cat Policy.sh >> UU/config.sh
3405 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3406 . $src/hints/$file.sh
3407 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3408 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3409 : nothing
3410 else
85e6fe83
LW
3411 : Give one chance to correct a possible typo.
3412 echo "$file.sh does not exist"
3413 dflt=$file
3414 rp="hint to use instead?"
dfe9444c 3415 . UU/myread
85e6fe83 3416 for file in $ans; do
dfe9444c
AD
3417 if $test -f "$src/hints/$file.sh"; then
3418 . $src/hints/$file.sh
3419 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3420 elif $test X$ans = X -o X$ans = Xnone ; then
3421 : nothing
3422 else
3423 echo "$file.sh does not exist -- ignored."
3424 fi
3425 done
2304df62
AD
3426 fi
3427 done
85e6fe83 3428
2304df62 3429 hint=recommended
85e6fe83 3430 : Remember our hint file for later.
dfe9444c 3431 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3432 hintfile="$file"
85e6fe83 3433 else
a0d0e21e 3434 hintfile=''
85e6fe83 3435 fi
2304df62
AD
3436fi
3437cd UU
3438;;
3439*)
3440 echo " "
3441 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3442 tmp_n="$n"
3443 tmp_c="$c"
2304df62
AD
3444 cd ..
3445 cp $config_sh config.sh 2>/dev/null
a78b0d02 3446 chmod +w config.sh
2304df62
AD
3447 . ./config.sh
3448 cd UU
3449 cp ../config.sh .
ecfc5424
AD
3450 n="$tmp_n"
3451 c="$tmp_c"
2304df62
AD
3452 hint=previous
3453 ;;
3454esac
1aef975c 3455test "$override" && . ./optdef.sh
2304df62
AD
3456
3457: Restore computed paths
3458for file in $loclist $trylist; do
3459 eval $file="\$_$file"
3460done
3461
85e6fe83 3462cat << EOM
a0d0e21e 3463
85e6fe83 3464Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3465The default value is probably right if the name rings a bell. Otherwise,
3466since spelling matters for me, either accept the default or answer "none"
3467to leave it blank.
a0d0e21e 3468
85e6fe83 3469EOM
85e6fe83 3470case "$osname" in
a0d0e21e 3471 ''|' ')
85e6fe83 3472 case "$hintfile" in
a0d0e21e 3473 ''|' '|none) dflt=none ;;
ecfc5424 3474 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3475 esac
3476 ;;
3477 *) dflt="$osname" ;;
3478esac
3479rp="Operating system name?"
3480. ./myread
3481case "$ans" in
ecfc5424
AD
3482none) osname='' ;;
3483*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3484esac
8ff267be 3485echo " "
3486case "$osvers" in
3487 ''|' ')
3488 case "$hintfile" in
3489 ''|' '|none) dflt=none ;;
3490 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3491 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3492 case "$dflt" in
3493 ''|' ') dflt=none ;;
3494 esac
3495 ;;
3496 esac
3497 ;;
3498 *) dflt="$osvers" ;;
3499esac
3500rp="Operating system version?"
3501. ./myread
3502case "$ans" in
3503none) osvers='' ;;
3504*) osvers="$ans" ;;
3505esac
3506
02e93a22
JH
3507
3508. ./posthint.sh
3509
2304df62 3510: who configured the system
59b83a6f 3511cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
dfe9444c
AD
3512case "$cf_by" in
3513"")
7c04078e 3514 cf_by=`(logname) 2>/dev/null`
dfe9444c 3515 case "$cf_by" in
7c04078e
GA
3516 "")
3517 cf_by=`(whoami) 2>/dev/null`
3518 case "$cf_by" in
3519 "") cf_by=unknown ;;
3520 esac ;;
8ff267be 3521 esac ;;
3522esac
2304df62 3523
f3f1a2d8
MB
3524: decide how portable to be. Allow command line overrides.
3525case "$d_portable" in
3526"$undef") ;;
3527*) d_portable="$define" ;;
b4eb6b3d 3528esac
b4eb6b3d 3529
f3f1a2d8
MB
3530: set up shell script to do ~ expansion
3531cat >filexp <<EOSS
3532$startsh
3533: expand filename
3534case "\$1" in
3535 ~/*|~)
3536 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3537 ;;
3538 ~*)
3539 if $test -f /bin/csh; then
3540 /bin/csh -f -c "glob \$1"
3541 failed=\$?
3542 echo ""
3543 exit \$failed
3544 else
3545 name=\`$expr x\$1 : '..\([^/]*\)'\`
3546 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3547 if $test ! -d "\$dir"; then
3548 me=\`basename \$0\`
3549 echo "\$me: can't locate home directory for: \$name" >&2
3550 exit 1
3551 fi
3552 case "\$1" in
3553 */*)
3554 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3555 ;;
3556 *)
3557 echo \$dir
3558 ;;
3559 esac
3560 fi
3561 ;;
3562*)
3563 echo \$1
3564 ;;
b29b105d 3565esac
f3f1a2d8
MB
3566EOSS
3567chmod +x filexp
3568$eunicefix filexp
b29b105d 3569
f3f1a2d8
MB
3570: now set up to get a file name
3571cat <<EOS >getfile
3572$startsh
3573EOS
3574cat <<'EOSC' >>getfile
3575tilde=''
3576fullpath=''
3577already=''
3578skip=''
3579none_ok=''
3580exp_file=''
3581nopath_ok=''
3582orig_rp="$rp"
3583orig_dflt="$dflt"
3584case "$gfpth" in
3585'') gfpth='.' ;;
b29b105d 3586esac
b29b105d 3587
f3f1a2d8
MB
3588case "$fn" in
3589*\(*)
3590 : getfile will accept an answer from the comma-separated list
3591 : enclosed in parentheses even if it does not meet other criteria.
3592 expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3593 fn=`echo $fn | sed 's/(.*)//'`
3594 ;;
b29b105d
JH
3595esac
3596
f3f1a2d8
MB
3597case "$fn" in
3598*:*)
3599 loc_file=`expr $fn : '.*:\(.*\)'`
3600 fn=`expr $fn : '\(.*\):.*'`
3601 ;;
b29b105d 3602esac
b29b105d 3603
f3f1a2d8
MB
3604case "$fn" in
3605*~*) tilde=true;;
3606esac
3607case "$fn" in
3608*/*) fullpath=true;;
3609esac
3610case "$fn" in
3611*+*) skip=true;;
3612esac
3613case "$fn" in
3614*n*) none_ok=true;;
3615esac
3616case "$fn" in
3617*e*) exp_file=true;;
3618esac
3619case "$fn" in
3620*p*) nopath_ok=true;;
b29b105d 3621esac
b29b105d 3622
f3f1a2d8
MB
3623case "$fn" in
3624*f*) type='File';;
3625*d*) type='Directory';;
3626*l*) type='Locate';;
3627esac
b29b105d 3628
f3f1a2d8
MB
3629what="$type"
3630case "$what" in
3631Locate) what='File';;
3632esac
b29b105d 3633
f3f1a2d8
MB
3634case "$exp_file" in
3635'')
3636 case "$d_portable" in
3637 "$define") ;;
3638 *) exp_file=true;;
b29b105d
JH
3639 esac
3640 ;;
3641esac
3642
f3f1a2d8
MB
3643cd ..
3644while test "$type"; do
3645 redo=''
3646 rp="$orig_rp"
3647 dflt="$orig_dflt"
3648 case "$tilde" in
3649 true) rp="$rp (~name ok)";;
3650 esac
3651 . UU/myread
3652 if test -f UU/getfile.ok && \
3653 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3654 then
3655 value="$ans"
3656 ansexp="$ans"
3657 break
3658 fi
3659 case "$ans" in
3660 none)
3661 value=''
3662 ansexp=''
3663 case "$none_ok" in
3664 true) type='';;
b29b105d
JH
3665 esac
3666 ;;
f3f1a2d8
MB
3667 *)
3668 case "$tilde" in
3669 '') value="$ans"
3670 ansexp="$ans";;
3671 *)
3672 value=`UU/filexp $ans`
3673 case $? in
3674 0)
3675 if test "$ans" != "$value"; then
3676 echo "(That expands to $value on this system.)"
3677 fi
3678 ;;
3679 *) value="$ans";;
3680 esac
3681 ansexp="$value"
3682 case "$exp_file" in
3683 '') value="$ans";;
3684 esac
3685 ;;
3686 esac
3687 case "$fullpath" in
3688 true)
3689 case "$ansexp" in
3690 /*) value="$ansexp" ;;
3691 [a-zA-Z]:/*) value="$ansexp" ;;
3692 *)
3693 redo=true
3694 case "$already" in
3695 true)
3696 echo "I shall only accept a full path name, as in /bin/ls." >&4
3697 echo "Use a ! shell escape if you wish to check pathnames." >&4
3698 ;;
3699 *)
3700 echo "Please give a full path name, starting with slash." >&4
3701 case "$tilde" in
3702 true)
3703 echo "Note that using ~name is ok provided it expands well." >&4
3704 already=true
3705 ;;
3706 esac
3707 esac
3708 ;;
3709 esac
3710 ;;
3711 esac
3712 case "$redo" in
3713 '')
3714 case "$type" in
3715 File)
3716 for fp in $gfpth; do
3717 if test "X$fp" = X.; then
3718 pf="$ansexp"
3719 else
3720 pf="$fp/$ansexp"
3721 fi
3722 if test -f "$pf"; then
3723 type=''
3724 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3725 then
3726 echo "($value is not a plain file, but that's ok.)"
3727 type=''
3728 fi
3729 if test X"$type" = X; then
3730 value="$pf"
3731 break
3732 fi
3733 done
3734 ;;
3735 Directory)
3736 for fp in $gfpth; do
3737 if test "X$fp" = X.; then
3738 dir="$ans"
3739 direxp="$ansexp"
3740 else
3741 dir="$fp/$ansexp"
3742 direxp="$fp/$ansexp"
3743 fi
3744 if test -d "$direxp"; then
3745 type=''
3746 value="$dir"
3747 break
3748 fi
3749 done
3750 ;;
3751 Locate)
3752 if test -d "$ansexp"; then
3753 echo "(Looking for $loc_file in directory $value.)"
3754 value="$value/$loc_file"
3755 ansexp="$ansexp/$loc_file"
3756 fi
3757 if test -f "$ansexp"; then
3758 type=''
3759 fi
3760 case "$nopath_ok" in
3761 true) case "$value" in
3762 */*) ;;
3763 *) echo "Assuming $value will be in people's path."
3764 type=''
3765 ;;
3766 esac
3767 ;;
3768 esac
3769 ;;
3770 esac
b4eb6b3d 3771
f3f1a2d8
MB
3772 case "$skip" in
3773 true) type='';
3774 esac
3775
3776 case "$type" in
3777 '') ;;
3778 *)
3779 if test "$fastread" = yes; then
3780 dflt=y
3781 else
3782 dflt=n
3783 fi
3784 rp="$what $value doesn't exist. Use that name anyway?"
3785 . UU/myread
3786 dflt=''
3787 case "$ans" in
3788 y*) type='';;
3789 *) echo " ";;
3790 esac
3791 ;;
3792 esac
3793 ;;
3794 esac
3795 ;;
b4eb6b3d 3796 esac
f3f1a2d8
MB
3797done
3798cd UU
3799ans="$value"
3800rp="$orig_rp"
3801dflt="$orig_dflt"
3802rm -f getfile.ok
3803test "X$gfpthkeep" != Xy && gfpth=""
3804EOSC
3805
3806: determine root of directory hierarchy where package will be installed.
3807case "$prefix" in
3808'')
3809 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3810 ;;
3811*?/)
3812 dflt=`echo "$prefix" | sed 's/.$//'`
b4eb6b3d
JH
3813 ;;
3814*)
f3f1a2d8 3815 dflt="$prefix"
b4eb6b3d
JH
3816 ;;
3817esac
f3f1a2d8 3818$cat <<EOM
b4eb6b3d 3819
f3f1a2d8
MB
3820By default, $package will be installed in $dflt/bin, manual pages
3821under $dflt/man, etc..., i.e. with $dflt as prefix for all
3822installation directories. Typically this is something like /usr/local.
3823If you wish to have binaries under /usr/bin but other parts of the
3824installation under /usr/local, that's ok: you will be prompted
3825separately for each of the installation directories, the prefix being
3826only used to set the defaults.
c915ce7f
JH
3827
3828EOM
f3f1a2d8
MB
3829fn=d~
3830rp='Installation prefix to use?'
3831. ./getfile
3832oldprefix=''
3833case "$prefix" in
3834'') ;;
3835*)
3836 case "$ans" in
3837 "$prefix") ;;
3838 *) oldprefix="$prefix";;
3839 esac
c915ce7f
JH
3840 ;;
3841esac
f3f1a2d8
MB
3842prefix="$ans"
3843prefixexp="$ansexp"
c915ce7f 3844
f3f1a2d8
MB
3845case "$afsroot" in
3846'') afsroot=/afs ;;
3847*) afsroot=$afsroot ;;
b4eb6b3d 3848esac
b4eb6b3d 3849
f3f1a2d8
MB
3850: is AFS running?
3851echo " "
3852case "$afs" in
3853$define|true) afs=true ;;
3854$undef|false) afs=false ;;
3855*) if test -d $afsroot; then
3856 afs=true
3857 else
3858 afs=false
3859 fi
b4eb6b3d 3860 ;;
f3f1a2d8
MB
3861esac
3862if $afs; then
3863 echo "AFS may be running... I'll be extra cautious then..." >&4
3864else
3865 echo "AFS does not seem to be running..." >&4
9da7673b 3866fi
b4eb6b3d 3867
f3f1a2d8
MB
3868: determine installation prefix for where package is to be installed.
3869if $afs; then
3870$cat <<EOM
3871
3872Since you are running AFS, I need to distinguish the directory in which
3873files will reside from the directory in which they are installed (and from
3874which they are presumably copied to the former directory by occult means).
b4eb6b3d 3875
b4eb6b3d 3876EOM
f3f1a2d8
MB
3877 case "$installprefix" in
3878 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3879 *) dflt="$installprefix";;
3880 esac
3881else
3882$cat <<EOM
b4eb6b3d 3883
f3f1a2d8
MB
3884In some special cases, particularly when building $package for distribution,
3885it is convenient to distinguish the directory in which files should be
3886installed from the directory ($prefix) in which they will
3887eventually reside. For most users, these two directories are the same.
3888
3889EOM
3890 case "$installprefix" in
3891 '') dflt=$prefix ;;
3892 *) dflt=$installprefix;;
3893 esac
3894fi
3895fn=d~
3896rp='What installation prefix should I use for installing files?'
3897. ./getfile
3898installprefix="$ans"
3899installprefixexp="$ansexp"
3900
3901: Perform the prefixexp/installprefixexp correction if necessary
3902cat <<EOS >installprefix
3903$startsh
3904EOS
3905cat <<'EOSC' >>installprefix
3906: Change installation prefix, if necessary.
3907if $test X"$prefix" != X"$installprefix"; then
3908 eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3909else
3910 eval "install${prefixvar}=\"\$${prefixvar}exp\""
3911fi
3912EOSC
3913chmod +x installprefix
3914$eunicefix installprefix
3915
3916: Set variables such as privlib and privlibexp from the output of ./getfile
3917: performing the prefixexp/installprefixexp correction if necessary.
3918cat <<EOS >setprefixvar
3919$startsh
3920EOS
3921cat <<'EOSC' >>setprefixvar
3922eval "${prefixvar}=\"\$ans\""
3923eval "${prefixvar}exp=\"\$ansexp\""
3924. ./installprefix
3925EOSC
3926chmod +x setprefixvar
3927$eunicefix setprefixvar
3928
3929: set up the script used to warn in case of inconsistency
3930cat <<EOS >whoa
3931$startsh
3932EOS
3933cat <<'EOSC' >>whoa
3934dflt=y
3935echo " "
3936echo "*** WHOA THERE!!! ***" >&4
3937echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
3938rp=" Keep the $hint value?"
3939. ./myread
3940case "$ans" in
3941y) td=$was; tu=$was;;
3942esac
3943EOSC
3944
3945: function used to set $1 to $val
3946setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3947case "$val$was" in
3948$define$undef) . ./whoa; eval "$var=\$td";;
3949$undef$define) . ./whoa; eval "$var=\$tu";;
3950*) eval "$var=$val";;
3951esac'
3952
3953case "$usesocks" in
3954$define|true|[yY]*) dflt='y';;
3955*) dflt='n';;
3956esac
3957cat <<EOM
3958
3959Perl can be built to use the SOCKS proxy protocol library. To do so,
3960Configure must be run with -Dusesocks. If you use SOCKS you also need
3961to use the PerlIO abstraction layer, this will be implicitly selected.
3962
3963If this doesn't make any sense to you, just accept the default '$dflt'.
3964EOM
3965rp='Build Perl for SOCKS?'
3966. ./myread
3967case "$ans" in
3968y|Y) val="$define" ;;
3969*) val="$undef" ;;
3970esac
3971set usesocks
3972eval $setvar
3973
3974case "$usesocks" in
3975$define|true|[yY]*) useperlio="$define";;
3976esac
3977
3978case "$useperlio" in
3979$define|true|[yY]*|'') dflt='y';;
3980*) dflt='n';;
3981esac
3982cat <<EOM
3983
3984Previous version of $package used the standard IO mechanisms as
3985defined in <stdio.h>. Versions 5.003_02 and later of $package allow
3986alternate IO mechanisms via the PerlIO abstraction layer, but the
3987stdio mechanism is still available if needed. The abstraction layer
3988can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3989Using PerlIO with sfio may cause problems with some extension modules.
3990
3991If this doesn't make any sense to you, just accept the default '$dflt'.
b4eb6b3d 3992EOM
f3f1a2d8
MB
3993rp='Use the PerlIO abstraction layer?'
3994. ./myread
3995case "$ans" in
3996y|Y)
b4eb6b3d
JH
3997 val="$define"
3998 ;;
f3f1a2d8
MB
3999*)
4000 echo "Ok, doing things the stdio way."
4001 val="$undef"
4002 ;;
4003esac
4004set useperlio
4005eval $setvar
4006
4007case "$usesocks" in
4008$define|true|[yY]*)
4009 case "$useperlio" in
4010 $define|true|[yY]*) ;;
4011 *) cat >&4 <<EOM
4012
4013You are using the SOCKS proxy protocol library which means that you
4014should also use the PerlIO layer. You may be headed for trouble.
4015
4016EOM
4017 ;;
b4eb6b3d 4018 esac
f3f1a2d8
MB
4019 ;;
4020esac
4021
4022
4023case "$usethreads" in
4024$define|true|[yY]*) dflt='y';;
4025*) # Catch case where user specified ithreads or 5005threads but
4026 # forgot -Dusethreads (A.D. 4/2002)
4027 case "$useithreads$use5005threads" in
4028 *$define*)
4029 case "$useperlio" in
4030 "$define") dflt='y' ;;
4031 *) dflt='n' ;;
4032 esac
4033 ;;
4034 *) dflt='n';;
4035 esac
4036 ;;
4037esac
4038cat <<EOM
4039
4040Perl can be built to take advantage of threads on some systems.
4041To do so, Configure can be run with -Dusethreads.
4042
4043Note that Perl built with threading support runs slightly slower
4044and uses more memory than plain Perl. The current implementation
4045is believed to be stable, but it is fairly new, and so should be
4046treated with caution.
4047
4048If this doesn't make any sense to you, just accept the default '$dflt'.
4049EOM
4050rp='Build a threading Perl?'
4051. ./myread
4052case "$ans" in
4053y|Y) val="$define" ;;
4054*) val="$undef" ;;
4055esac
4056set usethreads
4057eval $setvar
4058
4059case "$usethreads" in
4060$define)
4061 $cat <<EOM
4062
4063Since release 5.6, Perl has had two different threading implementations,
4064the newer interpreter-based version (ithreads) with one interpreter per
4065thread, and the older 5.005 version (5005threads).
4066The 5005threads version is effectively unmaintained and will probably be
4067removed in Perl 5.10, so there should be no need to build a Perl using it
4068unless needed for backwards compatibility with some existing 5.005threads
4069code.
4070
4071EOM
4072 : Default to ithreads unless overridden on command line or with
4073 : old config.sh
4074 dflt='y'
4075 case "$use5005threads" in
4076 $define|true|[yY]*) dflt='n';;
4077 esac
4078 case "$useithreads" in
4079 $undef|false|[nN]*) dflt='n';;
4080 esac
4081 rp='Use the newer interpreter-based ithreads?'
b4eb6b3d
JH
4082 . ./myread
4083 case "$ans" in
f3f1a2d8 4084 y|Y) val="$define" ;;
b4eb6b3d
JH
4085 *) val="$undef" ;;
4086 esac
f3f1a2d8
MB
4087 set useithreads
4088 eval $setvar
4089 : Now set use5005threads to the opposite value.
4090 case "$useithreads" in
4091 $define) val="$undef" ;;
4092 *) val="$define" ;;
4093 esac
4094 set use5005threads
4095 eval $setvar
4096 ;;
4097*)
4098 useithreads="$undef"
4099 use5005threads="$undef"
b4eb6b3d
JH
4100 ;;
4101esac
b4eb6b3d 4102
f3f1a2d8
MB
4103case "$useithreads$use5005threads" in
4104"$define$define")
4105 $cat >&4 <<EOM
96056487 4106
f3f1a2d8
MB
4107You cannot have both the ithreads and the 5.005 threads enabled
4108at the same time. Disabling the 5.005 threads since they are
4109much less stable than the ithreads.
4110
4111EOM
4112 use5005threads="$undef"
96056487
JH
4113 ;;
4114esac
4115
f3f1a2d8
MB
4116if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4117 cat >&4 <<EOF
4118***
4119*** To build with ithreads you must also use the PerlIO layer.
4120*** Cannot continue, aborting.
4121***
4122EOF
4123 exit 1
4124fi
4125
4126case "$d_oldpthreads" in
4127'') : Configure tests would be welcome here. For now, assume undef.
4128 val="$undef" ;;
4129*) val="$d_oldpthreads" ;;
4130esac
4131set d_oldpthreads
4132eval $setvar
4133
4134
4135: Look for a hint-file generated 'call-back-unit'. If the
4136: user has specified that a threading perl is to be built,
4137: we may need to set or change some other defaults.
4138if $test -f usethreads.cbu; then
4139 echo "Your platform has some specific hints regarding threaded builds, using them..."
4140 . ./usethreads.cbu
4141else
4142 case "$usethreads" in
4143 "$define"|true|[yY]*)
4144 $cat <<EOM
4145(Your platform does not have any specific hints for threaded builds.
4146 Assuming POSIX threads, then.)
4147EOM
4148 ;;
4149 esac
4150fi
4151
4152cat <<EOM
4153
4154Perl can be built so that multiple Perl interpreters can coexist
4155within the same Perl executable.
4156EOM
4157
4158case "$useithreads" in
4159$define)
4160 cat <<EOM
4161This multiple interpreter support is required for interpreter-based threads.
4162EOM
4163 val="$define"
4164 ;;
4165*) case "$usemultiplicity" in
4166 $define|true|[yY]*) dflt='y';;
4167 *) dflt='n';;
4168 esac
4169 echo " "
4170 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4171 rp='Build Perl for multiplicity?'
4172 . ./myread
4173 case "$ans" in
4174 y|Y) val="$define" ;;
4175 *) val="$undef" ;;
4176 esac
4177 ;;
4178esac
4179set usemultiplicity
4180eval $setvar
4181
4182
4183case "$usemorebits" in
4184"$define"|true|[yY]*)
4185 use64bitint="$define"
4186 uselongdouble="$define"
4187 usemorebits="$define"
4188 ;;
4189*) usemorebits="$undef"
4190 ;;
4191esac
4192
4193: make some quick guesses about what we are up against
4194echo " "
4195$echo $n "Hmm... $c"
4196echo exit 1 >bsd
4197echo exit 1 >usg
4198echo exit 1 >v7
4199echo exit 1 >osf1
4200echo exit 1 >eunice
4201echo exit 1 >xenix
4202echo exit 1 >venix
4203echo exit 1 >os2
4204d_bsd="$undef"
4205$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4206if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
e5e20432
JH
4207then
4208 echo "Looks kind of like an OSF/1 system, but we'll see..."
4209 echo exit 0 >osf1
381aa1ff 4210elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
4211 xxx=`./loc addbib blurfl $pth`
4212 if $test -f $xxx; then
4213 echo "Looks kind of like a USG system with BSD features, but we'll see..."
4214 echo exit 0 >bsd
4215 echo exit 0 >usg
4216 else
4217 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4218 echo "Looks kind of like an extended USG system, but we'll see..."
4219 else
4220 echo "Looks kind of like a USG system, but we'll see..."
4221 fi
4222 echo exit 0 >usg
4223 fi
4224elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4225 echo "Looks kind of like a BSD system, but we'll see..."
4226 d_bsd="$define"
4227 echo exit 0 >bsd
4228else
4229 echo "Looks kind of like a Version 7 system, but we'll see..."
4230 echo exit 0 >v7
4231fi
4232case "$eunicefix" in
4233*unixtovms*)
4234 $cat <<'EOI'
4235There is, however, a strange, musty smell in the air that reminds me of
4236something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4237EOI
4238 echo exit 0 >eunice
4239 d_eunice="$define"
4240: it so happens the Eunice I know will not run shell scripts in Unix format
4241 ;;
4242*)
4243 echo " "
4244 echo "Congratulations. You aren't running Eunice."
4245 d_eunice="$undef"
4246 ;;
4247esac
4248: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
4249: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4250: semicolon as a patch separator
e5e20432
JH
4251case "$p_" in
4252:) ;;
4253*)
4254 $cat <<'EOI'
4255I have the feeling something is not exactly right, however...don't tell me...
4256lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 4257(Or you may be running DOS with DJGPP.)
e5e20432
JH
4258EOI
4259 echo exit 0 >os2
4260 ;;
4261esac
4262if test -f /xenix; then
4263 echo "Actually, this looks more like a XENIX system..."
4264 echo exit 0 >xenix
4265 d_xenix="$define"
4266else
4267 echo " "
4268 echo "It's not Xenix..."
4269 d_xenix="$undef"
4270fi
4271chmod +x xenix
4272$eunicefix xenix
4273if test -f /venix; then
4274 echo "Actually, this looks more like a VENIX system..."
4275 echo exit 0 >venix
4276else
4277 echo " "
4278 if ./xenix; then
4279 : null
4280 else
4281 echo "Nor is it Venix..."
4282 fi
4283fi
4284chmod +x bsd usg v7 osf1 eunice xenix venix os2
4285$eunicefix bsd usg v7 osf1 eunice xenix venix os2
4286$rm -f foo
4287
5869b1f1
JH
4288case "$cc" in
4289'') dflt=cc;;
4290*) dflt="$cc";;
4291esac
4292rp="Use which C compiler?"
4293. ./myread
4294cc="$ans"
6b769f8f
RB
4295
4296: See if they have not cc but they do have gcc
4297. ./trygcc
e5e20432
JH
4298: Look for a hint-file generated 'call-back-unit'. Now that the
4299: user has specified the compiler, we may need to set or change some
4300: other defaults.
4301if $test -f cc.cbu; then
4302 . ./cc.cbu
4303fi
2573c5f9 4304. ./checkcc
8a27cf78 4305
e5e20432
JH
4306echo " "
4307echo "Checking for GNU cc in disguise and/or its version number..." >&4
5440bc8e 4308$cat >try.c <<EOM
e5e20432
JH
4309#include <stdio.h>
4310int main() {
4311#ifdef __GNUC__
4312#ifdef __VERSION__
4313 printf("%s\n", __VERSION__);
4314#else
4315 printf("%s\n", "1");
4316#endif
4317#endif
073b6de5 4318 return(0);
e5e20432
JH
4319}
4320EOM
5440bc8e
JH
4321if $cc -o try $ccflags $ldflags try.c; then
4322 gccversion=`$run ./try`
f3f1a2d8
MB
4323 case "$gccversion" in
4324 '') echo "You are not using GNU cc." ;;
4325 *) echo "You are using GNU cc $gccversion."
4326 ccname=gcc
4327 ;;
4328 esac
4329else
4330 echo " "
4331 echo "*** WHOA THERE!!! ***" >&4
4332 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
4333 case "$knowitall" in
4334 '')
4335 echo " You'd better start hunting for one and let me know about it." >&4
4336 exit 1
2304df62
AD
4337 ;;
4338 esac
f3f1a2d8
MB
4339fi
4340$rm -f try try.*
4341case "$gccversion" in
43421*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4343esac
4344case "$gccversion" in
4345'') gccosandvers='' ;;
4346*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4347 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4348 gccshortvers=''
4349 case "$gccosandvers" in
4350 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4351 $osname$osvers) ;; # looking good
4352 $osname*) cat <<EOM >&4
4353
4354*** WHOA THERE!!! ***
4355
4356 Your gcc has not been compiled for the exact release of
4357 your operating system ($gccosandvers versus $osname$osvers).
4358
4359 In general it is a good idea to keep gcc synchronized with
4360 the operating system because otherwise serious problems
4361 may ensue when trying to compile software, like Perl.
4362
4363 I'm trying to be optimistic here, though, and will continue.
4364 If later during the configuration and build icky compilation
4365 problems appear (headerfile conflicts being the most common
4366 manifestation), I suggest reinstalling the gcc to match
4367 your operating system release.
4368
4369EOM
4370 ;;
4371 *) gccosandvers='' ;; # failed to parse, better be silent
4372 esac
4373 ;;
4374esac
4375case "$ccname" in
4376'') ccname="$cc" ;;
4377esac
4378
4379# gcc 3.* complain about adding -Idirectories that they already know about,
4380# so we will take those off from locincpth.
4381case "$gccversion" in
43823*)
4383 echo "main(){}">try.c
4384 for incdir in $locincpth; do
4385 warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4386 grep '^c[cp]p*[01]: warning: changing search order '`
4387 if test "X$warn" != X; then
4388 locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4389 fi
4390 done
4391 $rm -f try try.*
4392esac
2304df62 4393
bd9b35c9
JH
4394: What should the include directory be ?
4395echo " "
4396$echo $n "Hmm... $c"
4397dflt='/usr/include'
4398incpath=''
4399mips_type=''
4400if $test -f /bin/mips && /bin/mips; then
4401 echo "Looks like a MIPS system..."
4402 $cat >usr.c <<'EOCP'
4403#ifdef SYSTYPE_BSD43
4404/bsd43
4405#endif
4406EOCP
8a27cf78 4407 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
4408 dflt='/bsd43/usr/include'
4409 incpath='/bsd43'
4410 mips_type='BSD 4.3'
4411 else
4412 mips_type='System V'
4413 fi
4414 $rm -f usr.c usr.out
4415 echo "and you're compiling with the $mips_type compiler and libraries."
4416 xxx_prompt=y
4417 echo "exit 0" >mips
4418else
4419 echo "Doesn't look like a MIPS system."
4420 xxx_prompt=n
4421 echo "exit 1" >mips
4422fi
4423chmod +x mips
4424$eunicefix mips
4425case "$usrinc" in
4426'') ;;
4427*) dflt="$usrinc";;
4428esac
4429case "$xxx_prompt" in
4430y) fn=d/
4431 echo " "
4432 rp='Where are the include files you want to use?'
4433 . ./getfile
4434 usrinc="$ans"
8e07c86e 4435 ;;
bd9b35c9 4436*) usrinc="$dflt"
8e07c86e
AD
4437 ;;
4438esac
2304df62 4439
96056487
JH
4440: see how we invoke the C preprocessor
4441echo " "
4442echo "Now, how can we feed standard input to your C preprocessor..." >&4
4443cat <<'EOT' >testcpp.c
4444#define ABC abc
4445#define XYZ xyz
4446ABC.XYZ
4447EOT
4448cd ..
4449if test ! -f cppstdin; then
4450 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4451 # AIX cc -E doesn't show the absolute headerfile
4452 # locations but we'll cheat by using the -M flag.
4453 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
4454 else
4455 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4456 fi
4457else
4458 echo "Keeping your $hint cppstdin wrapper."
4459fi
4460chmod 755 cppstdin
4461wrapper=`pwd`/cppstdin
4462ok='false'
4463cd UU
4464
4465if $test "X$cppstdin" != "X" && \
4466 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4467 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4468then
4469 echo "You used to use $cppstdin $cppminus so we'll use that again."
4470 case "$cpprun" in
4471 '') echo "But let's see if we can live without a wrapper..." ;;
4472 *)
4473 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4474 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4475 then
4476 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4477 ok='true'
4478 else
4479 echo "(However, $cpprun $cpplast does not work, let's see...)"
4480 fi
4481 ;;
4482 esac
4483else
4484 case "$cppstdin" in
4485 '') ;;
4486 *)
4487 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4488 ;;
4489 esac
4490fi
4491
4492if $ok; then
4493 : nothing
4494elif echo 'Maybe "'"$cc"' -E" will work...'; \
4495 $cc -E <testcpp.c >testcpp.out 2>&1; \
4496 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4497 echo "Yup, it does."
4498 x_cpp="$cc -E"
4499 x_minus='';
4500elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4501 $cc -E - <testcpp.c >testcpp.out 2>&1; \
4502 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4503 echo "Yup, it does."
4504 x_cpp="$cc -E"
4505 x_minus='-';
4506elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4507 $cc -P <testcpp.c >testcpp.out 2>&1; \
4508 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4509 echo "Yipee, that works!"
4510 x_cpp="$cc -P"
4511 x_minus='';
4512elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4513 $cc -P - <testcpp.c >testcpp.out 2>&1; \
4514 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4515 echo "At long last!"
4516 x_cpp="$cc -P"
4517 x_minus='-';
4518elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4519 $cpp <testcpp.c >testcpp.out 2>&1; \
4520 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4521 echo "It works!"
4522 x_cpp="$cpp"
4523 x_minus='';
4524elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4525 $cpp - <testcpp.c >testcpp.out 2>&1; \
4526 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4527 echo "Hooray, it works! I was beginning to wonder."
4528 x_cpp="$cpp"
4529 x_minus='-';
4530elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
4531 $wrapper <testcpp.c >testcpp.out 2>&1; \
4532 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4533 x_cpp="$wrapper"
4534 x_minus=''
4535 echo "Eureka!"
4536else
4537 dflt=''
4538 rp="No dice. I can't find a C preprocessor. Name one:"
4539 . ./myread
4540 x_cpp="$ans"
4541 x_minus=''
4542 $x_cpp <testcpp.c >testcpp.out 2>&1
4543 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4544 echo "OK, that will do." >&4
4545 else
4546echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
4547 exit 1
4548 fi
4549fi
4550
4551case "$ok" in
4552false)
4553 cppstdin="$x_cpp"
4554 cppminus="$x_minus"
4555 cpprun="$x_cpp"
4556 cpplast="$x_minus"
4557 set X $x_cpp
4558 shift
4559 case "$1" in
4560 "$cpp")
4561 echo "Perhaps can we force $cc -E using a wrapper..."
4562 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4563 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4564 then
4565 echo "Yup, we can."
4566 cppstdin="$wrapper"
4567 cppminus='';
4568 else
4569 echo "Nope, we'll have to live without it..."
4570 fi
4571 ;;
4572 esac
4573 case "$cpprun" in
4574 "$wrapper")
4575 cpprun=''
4576 cpplast=''
4577 ;;
4578 esac
4579 ;;
4580esac
4581
4582case "$cppstdin" in
4583"$wrapper"|'cppstdin') ;;
4584*) $rm -f $wrapper;;
4585esac
4586$rm -f testcpp.c testcpp.out
4587
bd9b35c9
JH
4588: Set private lib path
4589case "$plibpth" in
4590'') if ./mips; then
4591 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4592 fi;;
4593esac
4594case "$libpth" in
4595' ') dlist='';;
4596'') dlist="$loclibpth $plibpth $glibpth";;
4597*) dlist="$libpth";;
4598esac
4599
4600: Now check and see which directories actually exist, avoiding duplicates
4601libpth=''
4602for xxx in $dlist
4603do
4604 if $test -d $xxx; then
4605 case " $libpth " in
4606 *" $xxx "*) ;;
4607 *) libpth="$libpth $xxx";;
4608 esac
4609 fi
4610done
4611$cat <<'EOM'
4612
4613Some systems have incompatible or broken versions of libraries. Among
4614the directories listed in the question below, please remove any you
4615know not to be holding relevant libraries, and add any that are needed.
4616Say "none" for none.
8e07c86e
AD
4617
4618EOM
bd9b35c9
JH
4619case "$libpth" in
4620'') dflt='none';;
8e07c86e 4621*)
bd9b35c9
JH
4622 set X $libpth
4623 shift
4624 dflt=${1+"$@"}
8e07c86e 4625 ;;
a0d0e21e 4626esac
bd9b35c9
JH
4627rp="Directories to use for library searches?"
4628. ./myread
4629case "$ans" in
4630none) libpth=' ';;
4631*) libpth="$ans";;
4632esac
a0d0e21e 4633
bd9b35c9
JH
4634: compute shared library extension
4635case "$so" in
4636'')
4637 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4638 dflt='sl'
dd4e71fd 4639 else
bd9b35c9 4640 dflt='so'
dd4e71fd
JH
4641 fi
4642 ;;
bd9b35c9 4643*) dflt="$so";;
dd4e71fd 4644esac
dd4e71fd
JH
4645$cat <<EOM
4646
bd9b35c9 4647On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 4648you want to suppress searching of shared libraries for the remainder
bd9b35c9 4649of this configuration.
dd4e71fd
JH
4650
4651EOM
bd9b35c9
JH
4652rp='What is the file extension used for shared libraries?'
4653. ./myread
4654so="$ans"
dd4e71fd 4655
bd9b35c9
JH
4656: Define several unixisms.
4657: Hints files or command line option can be used to override them.
4658: The convoluted testing is in case hints files set either the old
4659: or the new name.
4660case "$_exe" in
4661'') case "$exe_ext" in
1fef16b3 4662 '') ;;
bd9b35c9 4663 *) _exe="$exe_ext" ;;
dd4e71fd 4664 esac
bd9b35c9 4665 ;;
bfb7748a 4666esac
bd9b35c9
JH
4667case "$_a" in
4668'') case "$lib_ext" in
4669 '') _a='.a';;
4670 *) _a="$lib_ext" ;;
dd4e71fd
JH
4671 esac
4672 ;;
dd4e71fd 4673esac
bd9b35c9
JH
4674case "$_o" in
4675'') case "$obj_ext" in
4676 '') _o='.o';;
4677 *) _o="$obj_ext";;
4678 esac
4679 ;;
4680esac
4681case "$p_" in
4682'') case "$path_sep" in
4683 '') p_=':';;
4684 *) p_="$path_sep";;
4685 esac
4686 ;;
4687esac
4688exe_ext=$_exe
4689lib_ext=$_a
4690obj_ext=$_o
4691path_sep=$p_
dd4e71fd 4692
b4eb6b3d
JH
4693: Which makefile gets called first. This is used by make depend.
4694case "$firstmakefile" in
4695'') firstmakefile='makefile';;
4633a7c4 4696esac
4633a7c4 4697
1f603089
JH
4698case "$ccflags" in
4699*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4700esac
4701
4702case "$uselongdouble" in
4703$define|true|[yY]*) dflt='y';;
4704*) dflt='n';;
4705esac
4706cat <<EOM
4707
4708Perl can be built to take advantage of long doubles which
4709(if available) may give more accuracy and range for floating point numbers.
4710
4711If this doesn't make any sense to you, just accept the default '$dflt'.
4712EOM
4713rp='Try to use long doubles if available?'
4714. ./myread
4715case "$ans" in
4716y|Y) val="$define" ;;
4717*) val="$undef" ;;
4718esac
4719set uselongdouble
4720eval $setvar
4721
4722case "$uselongdouble" in
4723true|[yY]*) uselongdouble="$define" ;;
4724esac
4725
1f603089
JH
4726: Look for a hint-file generated 'call-back-unit'. If the
4727: user has specified that long doubles should be used,
4728: we may need to set or change some other defaults.
9da7673b
MB
4729if $test -f uselongdouble.cbu; then
4730 echo "Your platform has some specific hints regarding long doubles, using them..."
4731 . ./uselongdouble.cbu
4732else
4733 case "$uselongdouble" in
4734 $define)
1f603089 4735 $cat <<EOM
9da7673b 4736(Your platform does not have any specific hints for long doubles.)
1f603089 4737EOM
1f603089 4738 ;;
9da7673b
MB
4739 esac
4740fi
1f603089 4741
bd9b35c9
JH
4742: Looking for optional libraries
4743echo " "
4744echo "Checking for optional libraries..." >&4
4745case "$libs" in
4746' '|'') dflt='';;
4747*) dflt="$libs";;
4748esac
4749case "$libswanted" in
4750'') libswanted='c_s';;
4751esac
4752case "$usesocks" in
923fc586 4753"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 4754esac
68435ea7
JH
4755libsfound=''
4756libsfiles=''
4757libsdirs=''
13b3f787
JH
4758libspath=''
4759for thisdir in $libpth $xlibpth; do
4760 test -d $thisdir && libspath="$libspath $thisdir"
4761done
bd9b35c9 4762for thislib in $libswanted; do
13b3f787 4763 for thisdir in $libspath; do
f7dd4e7f
JH
4764 xxx=''
4765 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
eade9b71 4766 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
f7dd4e7f
JH
4767 $test -f "$xxx" && eval $libscheck
4768 $test -f "$xxx" && libstyle=shared
4769 fi
4770 if test ! -f "$xxx"; then
4771 xxx=$thisdir/lib$thislib.$so
4772 $test -f "$xxx" && eval $libscheck
4773 $test -f "$xxx" && libstyle=shared
4774 fi
4775 if test ! -f "$xxx"; then
4776 xxx=$thisdir/lib$thislib$_a
4777 $test -f "$xxx" && eval $libscheck
4778 $test -f "$xxx" && libstyle=static
4779 fi
4780 if test ! -f "$xxx"; then
4781 xxx=$thisdir/$thislib$_a
4782 $test -f "$xxx" && eval $libscheck
4783 $test -f "$xxx" && libstyle=static
4784 fi
4785 if test ! -f "$xxx"; then
4786 xxx=$thisdir/lib${thislib}_s$_a
4787 $test -f "$xxx" && eval $libscheck
4788 $test -f "$xxx" && libstyle=static
09ea5ba9 4789 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
4790 fi
4791 if test ! -f "$xxx"; then
4792 xxx=$thisdir/Slib$thislib$_a
4793 $test -f "$xxx" && eval $libscheck
4794 $test -f "$xxx" && libstyle=static
4795 fi
4796 if $test -f "$xxx"; then
43999f95 4797 case "$libstyle" in
f7dd4e7f
JH
4798 shared) echo "Found -l$thislib (shared)." ;;
4799 static) echo "Found -l$thislib." ;;
4800 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 4801 esac
bd9b35c9
JH
4802 case " $dflt " in
4803 *"-l$thislib "*);;
f7dd4e7f 4804 *) dflt="$dflt -l$thislib"
43999f95
JH
4805 libsfound="$libsfound $xxx"
4806 yyy=`basename $xxx`
4807 libsfiles="$libsfiles $yyy"
1e127011 4808 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
4809 case " $libsdirs " in
4810 *" $yyy "*) ;;
4811 *) libsdirs="$libsdirs $yyy" ;;
4812 esac
4813 ;;
bd9b35c9 4814 esac
f7dd4e7f
JH
4815 break
4816 fi
4817 done
4818 if $test ! -f "$xxx"; then
4819 echo "No -l$thislib."
bd9b35c9
JH
4820 fi
4821done
4822set X $dflt
4823shift
4824dflt="$*"
4825case "$libs" in
4826'') dflt="$dflt";;
4827*) dflt="$libs";;
4828esac
4829case "$dflt" in
4830' '|'') dflt='none';;
4831esac
4633a7c4 4832
bd9b35c9 4833$cat <<EOM
4633a7c4 4834
bd9b35c9
JH
4835In order to compile $package on your machine, a number of libraries
4836are usually needed. Include any other special libraries here as well.
4837Say "none" for none. The default list is almost always right.
8e07c86e 4838EOM
8e07c86e 4839
bd9b35c9
JH
4840echo " "
4841rp="What libraries to use?"
4842. ./myread
4843case "$ans" in
4844none) libs=' ';;
4845*) libs="$ans";;
4846esac
d71b2b6b 4847
bd9b35c9
JH
4848: determine optimization, if desired, or use for debug flag also
4849case "$optimize" in
4850' '|$undef) dflt='none';;
4851'') dflt='-O';;
4852*) dflt="$optimize";;
4853esac
4854$cat <<EOH
d71b2b6b 4855
bd9b35c9
JH
4856By default, $package compiles with the -O flag to use the optimizer.
4857Alternately, you might want to use the symbolic debugger, which uses
4858the -g flag (on traditional Unix systems). Either flag can be
4859specified here. To use neither flag, specify the word "none".
d71b2b6b 4860
bd9b35c9
JH
4861EOH
4862rp="What optimizer/debugger flag should be used?"
4863. ./myread
4864optimize="$ans"
4865case "$optimize" in
4866'none') optimize=" ";;
4867esac
4868
eaf812ae
MB
4869: Check what DEBUGGING is required from the command line
4870: -DEBUGGING or -DDEBUGGING or
4871: -DEBUGGING=both = -g + -DDEBUGGING
4872: -DEBUGGING=-g or -Doptimize=-g = -g
4873: -DEBUGGING=none or -UDEBUGGING =
4874: -DEBUGGING=old or -DEBUGGING=default = ? $optimize
4875case "$EBUGGING" in
4876'') ;;
4877*) DEBUGGING=$EBUGGING ;;
4878esac
4879
4880case "$DEBUGGING" in
4881-g|$define)
4882 case "$optimize" in
4883 *-g*) ;;
4884 *) optimize="$optimize -g" ;;
4885 esac ;;
4886none|$undef)
4887 case "$optimize" in
4888 *-g*) set `echo "X $optimize " | sed 's/ -g / /'`
4889 shift
4890 optimize="$*"
4891 ;;
4892 esac ;;
4893esac
4894
bd9b35c9 4895dflt=''
eaf812ae
MB
4896case "$DEBUGGING" in
4897both|$define) dflt='-DDEBUGGING'
4898esac
4899
bd9b35c9
JH
4900: We will not override a previous value, but we might want to
4901: augment a hint file
4902case "$hint" in
4903default|recommended)
4904 case "$gccversion" in
eaf812ae 4905 1*) dflt="$dflt -fpcc-struct-return" ;;
d71b2b6b 4906 esac
eaf812ae
MB
4907 case "$optimize:$DEBUGGING" in
4908 *-g*:old) dflt="$dflt -DDEBUGGING";;
d71b2b6b 4909 esac
bd9b35c9
JH
4910 case "$gccversion" in
4911 2*) if test -d /etc/conf/kconfig.d &&
4912 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4913 then
00e89ad4 4914 # Interactive Systems (ISC) POSIX mode.
bd9b35c9
JH
4915 dflt="$dflt -posix"
4916 fi
f0d04425 4917 ;;
bd9b35c9
JH
4918 esac
4919 case "$gccversion" in
4920 1*) ;;
4921 2.[0-8]*) ;;
4922 ?*) echo " "
4923 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4924 echo 'int main(void) { return 0; }' > gcctest.c
4925 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4926 echo "Yes, it does." 2>&1
4927 case "$ccflags" in
00e89ad4 4928 *strict-aliasing*)
bd9b35c9
JH
4929 echo "Leaving current flags $ccflags alone." 2>&1
4930 ;;
4931 *) dflt="$dflt -fno-strict-aliasing" ;;
4932 esac
4933 else
4934 echo "Nope, it doesn't, but that's ok." 2>&1
4935 fi
f0d04425 4936 ;;
e5e20432 4937 esac
00e89ad4
AD
4938 # For gcc, adding -pipe speeds up compilations for some, but apparently
4939 # some assemblers can't read from stdin. (It also slows down compilations
4940 # in other cases, but those are apparently rarer these days.) AD 5/2004.
4941 case "$gccversion" in
4942 ?*) echo " "
4943 echo "Checking if your compiler accepts -pipe" 2>&1
4944 echo 'int main(void) { return 0; }' > gcctest.c
6347b5be 4945 if $cc -pipe -o gcctest gcctest.c; then
00e89ad4
AD
4946 echo "Yes, it does." 2>&1
4947 case "$ccflags" in
4948 *-pipe*)
4949 echo "Leaving current flags $ccflags alone." 2>&1
4950 ;;
4951 *) dflt="$dflt -pipe" ;;
4952 esac
4953 else
4954 echo "Nope, it doesn't, but that's ok." 2>&1
4955 fi
6347b5be
SP
4956
4957 echo "Checking if your compiler accepts -Wdeclaration-after-statement" 2>&1
4958 echo 'int main(void) { return 0; }' > gcctest.c
4959 if $cc -Wdeclaration-after-statement -o gcctest gcctest.c; then
4960 echo "Yes, it does." 2>&1
4961 case "$ccflags" in
4962 *-Wdeclaration-after-statement*)
4963 echo "Leaving current flags $ccflags alone." 2>&1
4964 ;;
4965 *) dflt="$dflt -Wdeclaration-after-statement" ;;
4966 esac
4967 else
4968 echo "Nope, it doesn't, but that's ok." 2>&1
4969 fi
00e89ad4
AD
4970 ;;
4971 esac
e5e20432
JH
4972 ;;
4973esac
4974
bd9b35c9
JH
4975case "$mips_type" in
4976*BSD*|'') inclwanted="$locincpth $usrinc";;
4977*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4978esac
4979for thisincl in $inclwanted; do
4980 if $test -d $thisincl; then
4981 if $test x$thisincl != x$usrinc; then
4982 case "$dflt" in
00e89ad4
AD
4983 *" -I$thisincl "*);;
4984 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
4985 esac
4986 fi
4987 fi
4988done
40a7a20a 4989
bd9b35c9
JH
4990inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4991 xxx=true;
4992elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4993 xxx=true;
4994else
4995 xxx=false;
4996fi;
4997if $xxx; then
4998 case "$dflt" in
4999 *$2*);;
5000 *) dflt="$dflt -D$2";;
5001 esac;
5002fi'
40a7a20a 5003
bd9b35c9 5004set signal.h LANGUAGE_C; eval $inctest
40a7a20a 5005
bd9b35c9
JH
5006case "$usesocks" in
5007$define)
5008 ccflags="$ccflags -DSOCKS"
5009 ;;
5010esac
40a7a20a 5011
bd9b35c9
JH
5012case "$hint" in
5013default|recommended) dflt="$ccflags $dflt" ;;
5014*) dflt="$ccflags";;
5015esac
40a7a20a 5016
bd9b35c9
JH
5017case "$dflt" in
5018''|' ') dflt=none;;
5019esac
422af00a 5020
bd9b35c9 5021$cat <<EOH
40a7a20a 5022
bd9b35c9
JH
5023Your C compiler may want other flags. For this question you should include
5024-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5025but you should NOT include libraries or ld flags like -lwhatever. If you
5026want $package to honor its debug switch, you should include -DDEBUGGING here.
5027Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 5028
bd9b35c9 5029To use no flags, specify the word "none".
40a7a20a 5030
bd9b35c9
JH
5031EOH
5032set X $dflt
5033shift
5034dflt=${1+"$@"}
5035rp="Any additional cc flags?"
5036. ./myread
5037case "$ans" in
5038none) ccflags='';;
5039*) ccflags="$ans";;
5040esac
8e07c86e 5041
bd9b35c9 5042: the following weeds options from ccflags that are of no interest to cpp
58e77565
JH
5043case "$cppflags" in
5044'') cppflags="$ccflags" ;;
5045*) cppflags="$cppflags $ccflags" ;;
5046esac
bd9b35c9
JH
5047case "$gccversion" in
50481*) cppflags="$cppflags -D__GNUC__"
4633a7c4 5049esac
bd9b35c9
JH
5050case "$mips_type" in
5051'');;
5052*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5053esac
5054case "$cppflags" in
5055'');;
5056*)
5057 echo " "
5058 echo "Let me guess what the preprocessor flags are..." >&4
5059 set X $cppflags
5060 shift
5061 cppflags=''
5062 $cat >cpp.c <<'EOM'
5063#define BLURFL foo
8e07c86e 5064
bd9b35c9
JH
5065BLURFL xx LFRULB
5066EOM
5067 previous=''
5068 for flag in $*
5069 do
5070 case "$flag" in
5071 -*) ftry="$flag";;
5072 *) ftry="$previous $flag";;
5073 esac
5074 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5075 >cpp1.out 2>/dev/null && \
5076 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5077 >cpp2.out 2>/dev/null && \
5078 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5079 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5080 then
5081 cppflags="$cppflags $ftry"
5082 previous=''
5083 else
5084 previous="$flag"
5085 fi
5086 done
5087 set X $cppflags
5088 shift
5089 cppflags=${1+"$@"}
5090 case "$cppflags" in
5091 *-*) echo "They appear to be: $cppflags";;
5092 esac
5093 $rm -f cpp.c cpp?.out
2afac517 5094 ;;
5095esac
8e07c86e 5096
bd9b35c9
JH
5097: flags used in final linking phase
5098case "$ldflags" in
5099'') if ./venix; then
5100 dflt='-i -z'
10a23457 5101 else
bd9b35c9 5102 dflt=''
10a23457 5103 fi
bd9b35c9
JH
5104 case "$ccflags" in
5105 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 5106 esac
bd9b35c9
JH
5107 ;;
5108*) dflt="$ldflags";;
5109esac
5110
5111: Try to guess additional flags to pick up local libraries.
5112for thislibdir in $libpth; do
5113 case " $loclibpth " in
5114 *" $thislibdir "*)
00e89ad4 5115 case "$dflt " in
bd9b35c9
JH
5116 *"-L$thislibdir "*) ;;
5117 *) dflt="$dflt -L$thislibdir" ;;
5118 esac
c4f23d77
AD
5119 ;;
5120 esac
bd9b35c9 5121done
c4f23d77 5122
bd9b35c9
JH
5123case "$dflt" in
5124'') dflt='none' ;;
5125esac
c4f23d77 5126
bd9b35c9
JH
5127$cat <<EOH
5128
5129Your C linker may need flags. For this question you should
5130include -L/whatever and any other flags used by the C linker, but you
5131should NOT include libraries like -lwhatever.
5132
5133Make sure you include the appropriate -L/path flags if your C linker
5134does not normally search all of the directories you specified above,
5135namely
5136 $libpth
5137To use no flags, specify the word "none".
5138
5139EOH
5140
5141rp="Any additional ld flags (NOT including libraries)?"
5142. ./myread
5143case "$ans" in
5144none) ldflags='';;
5145*) ldflags="$ans";;
5146esac
5147rmlist="$rmlist pdp11"
5148
5149: coherency check
5150echo " "
5151echo "Checking your choice of C compiler and flags for coherency..." >&4
5152$cat > try.c <<'EOF'
5153#include <stdio.h>
55954f19 5154int main() { printf("Ok\n"); return(0); }
bd9b35c9 5155EOF
7a282f6d 5156set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
5157shift
5158$cat >try.msg <<'EOM'
5159I've tried to compile and run the following simple program:
5160
5161EOM
5162$cat try.c >> try.msg
5163
5164$cat >> try.msg <<EOM
5165
5166I used the command:
5167
5168 $*
5440bc8e 5169 $run ./try
bd9b35c9
JH
5170
5171and I got the following output:
5172
5173EOM
5174dflt=y
73614538 5175if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5440bc8e
JH
5176 if $sh -c "$run ./try" >>try.msg 2>&1; then
5177 xxx=`$run ./try`
bd9b35c9
JH
5178 case "$xxx" in
5179 "Ok") dflt=n ;;
5180 *) echo 'The program compiled OK, but produced no output.' >> try.msg
5181 case " $libs " in
5182 *" -lsfio "*)
5183 cat >> try.msg <<'EOQS'
5184If $libs contains -lsfio, and sfio is mis-configured, then it
5185sometimes (apparently) runs and exits with a 0 status, but with no
5186output! It may have to do with sfio's use of _exit vs. exit.
5187
5188EOQS
5189 rp="You have a big problem. Shall I abort Configure"
5190 dflt=y
5191 ;;
5192 esac
5193 ;;
5194 esac
5195 else
5196 echo "The program compiled OK, but exited with status $?." >>try.msg
5197 rp="You have a problem. Shall I abort Configure"
5198 dflt=y
5199 fi
5200else
5201 echo "I can't compile the test program." >>try.msg
5202 rp="You have a BIG problem. Shall I abort Configure"
5203 dflt=y
5204fi
5205case "$dflt" in
5206y)
5207 $cat try.msg >&4
5208 case "$knowitall" in
5209 '')
5210 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 5211 ;;
bd9b35c9 5212 *) dflt=n;;
c4f23d77 5213 esac
bd9b35c9
JH
5214 echo " "
5215 . ./myread
5216 case "$ans" in
5217 n*|N*) ;;
5218 *) echo "Ok. Stopping Configure." >&4
5219 exit 1
c4f23d77
AD
5220 ;;
5221 esac
5222 ;;
bd9b35c9 5223n) echo "OK, that should do.";;
c4f23d77 5224esac
bd9b35c9 5225$rm -f try try.* core
c4f23d77 5226
bd9b35c9
JH
5227: define a shorthand compile call
5228compile='
5229mc_file=$1;
5230shift;
08413ebc 5231$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
5232: define a shorthand compile call for compilations that should be ok.
5233compile_ok='
5234mc_file=$1;
5235shift;
7a282f6d 5236$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 5237
8dfa8df9
JH
5238: determine filename position in cpp output
5239echo " "
5240echo "Computing filename position in cpp output for #include directives..." >&4
a5a94ea5
JH
5241case "$osname" in
5242vos) testaccess=-e ;;
5243*) testaccess=-r ;;
5244esac
8dfa8df9
JH
5245echo '#include <stdio.h>' > foo.c
5246$cat >fieldn <<EOF
5247$startsh
5248$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5249$grep '^[ ]*#.*stdio\.h' | \
5250while read cline; do
5251 pos=1
5252 set \$cline
5253 while $test \$# -gt 0; do
a5a94ea5 5254 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
8dfa8df9
JH
5255 echo "\$pos"
5256 exit 0
5257 fi
5258 shift
5259 pos=\`expr \$pos + 1\`
5260 done
5261done
5262EOF
5263chmod +x fieldn
5264fieldn=`./fieldn`
5265$rm -f foo.c fieldn
5266case $fieldn in
5267'') pos='???';;
52681) pos=first;;
52692) pos=second;;
52703) pos=third;;
5271*) pos="${fieldn}th";;
5272esac
5273echo "Your cpp writes the filename in the $pos field of the line."
5274
3c728e00
JH
5275case "$osname" in
5276vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5c728af0 5277os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
3c728e00
JH
5278*) cppfilter='' ;;
5279esac
8dfa8df9
JH
5280: locate header file
5281$cat >findhdr <<EOF
5282$startsh
5283wanted=\$1
5284name=''
5285for usrincdir in $usrinc
5286do
5287 if test -f \$usrincdir/\$wanted; then
5288 echo "\$usrincdir/\$wanted"
5289 exit 0
5290 fi
5291done
5292awkprg='{ print \$$fieldn }'
5293echo "#include <\$wanted>" > foo\$\$.c
5294$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3c728e00 5295$cppfilter $grep "^[ ]*#.*\$wanted" | \
8dfa8df9
JH
5296while read cline; do
5297 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5298 case "\$name" in
5299 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5300 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5301 *) exit 2;;
5302 esac;
5303done;
5304#
5305# status = 0: grep returned 0 lines, case statement not executed
5306# status = 1: headerfile found
5307# status = 2: while loop executed, no headerfile found
5308#
5309status=\$?
5310$rm -f foo\$\$.c;
5311if test \$status -eq 1; then
5312 exit 0;
5313fi
5314exit 1
5315EOF
5316chmod +x findhdr
5317
5318: define an alternate in-header-list? function
5319inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5320cont=true; xxf="echo \"<\$1> found.\" >&4";
5321case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5322*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5323esac;
5324case $# in 4) instead=instead;; *) instead="at last";; esac;
5325while $test "$cont"; do
5326 xxx=`./findhdr $1`
5327 var=$2; eval "was=\$$2";
5328 if $test "$xxx" && $test -r "$xxx";
5329 then eval $xxf;
5330 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5331 cont="";
5332 else eval $xxnf;
5333 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5334 set $yyy; shift; shift; yyy=$@;
5335 case $# in 0) cont="";;
5336 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5337 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5338 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5339 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5340 esac;
5341done;
5342while $test "$yyy";
5343do set $yyy; var=$2; eval "was=\$$2";
5344 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5345 set $yyy; shift; shift; yyy=$@;
5346done'
5347
d1daaddf
JH
5348: see if stdlib is available
5349set stdlib.h i_stdlib
5350eval $inhdr
5351
5352: check for lengths of integral types
5353echo " "
5354case "$intsize" in
5355'')
5356 echo "Checking to see how big your integers are..." >&4
c63dfae1 5357 $cat >try.c <<EOCP
d1daaddf
JH
5358#include <stdio.h>
5359#$i_stdlib I_STDLIB
5360#ifdef I_STDLIB
5361#include <stdlib.h>
5362#endif
5363int main()
5364{
5365 printf("intsize=%d;\n", (int)sizeof(int));
5366 printf("longsize=%d;\n", (int)sizeof(long));
5367 printf("shortsize=%d;\n", (int)sizeof(short));
5368 exit(0);
5369}
5370EOCP
5371 set try
5372 if eval $compile_ok && $run ./try > /dev/null; then
5373 eval `$run ./try`
5374 echo "Your integers are $intsize bytes long."
5375 echo "Your long integers are $longsize bytes long."
5376 echo "Your short integers are $shortsize bytes long."
5377 else
5378 $cat >&4 <<EOM
5379!
5380Help! I can't compile and run the intsize test program: please enlighten me!
5381(This is probably a misconfiguration in your system or libraries, and
5382you really ought to fix it. Still, I'll try anyway.)
5383!
5384EOM
5385 dflt=4
5386 rp="What is the size of an integer (in bytes)?"
5387 . ./myread
5388 intsize="$ans"
5389 dflt=$intsize
5390 rp="What is the size of a long integer (in bytes)?"
5391 . ./myread
5392 longsize="$ans"
5393 dflt=2
5394 rp="What is the size of a short integer (in bytes)?"
5395 . ./myread
5396 shortsize="$ans"
5397 fi
5398 ;;
5399esac
5400$rm -f try try.*
5401
5402: check for long long
5403echo " "
5404echo "Checking to see if you have long long..." >&4
5405echo 'int main() { long long x = 7; return 0; }' > try.c
5406set try
5407if eval $compile; then
5408 val="$define"
5409 echo "You have long long."
5410else
5411 val="$undef"
5412 echo "You do not have long long."
5413fi
5414$rm try.*
5415set d_longlong
5416eval $setvar
5417
5418: check for length of long long
5419case "${d_longlong}${longlongsize}" in
5420$define)
5421 echo " "
5422 echo "Checking to see how big your long longs are..." >&4
5423 $cat >try.c <<'EOCP'
5424#include <stdio.h>
5425int main()
5426{
5427 printf("%d\n", (int)sizeof(long long));
5428 return(0);
5429}
5430EOCP
5431 set try
5432 if eval $compile_ok; then
5433 longlongsize=`$run ./try`
5434 echo "Your long longs are $longlongsize bytes long."
5435 else
5436 dflt='8'
5437 echo " "
5438 echo "(I can't seem to compile the test program. Guessing...)"
5439 rp="What is the size of a long long (in bytes)?"
5440 . ./myread
5441 longlongsize="$ans"
5442 fi
5443 if $test "X$longsize" = "X$longlongsize"; then
5444 echo "(That isn't any different from an ordinary long.)"
5445 fi
5446 ;;
5447esac
5448$rm -f try.* try
5449
8dfa8df9
JH
5450: see if inttypes.h is available
5451: we want a real compile instead of Inhdr because some systems
5452: have an inttypes.h which includes non-existent headers
5453echo " "
5454$cat >try.c <<EOCP
5455#include <inttypes.h>
5456int main() {
5457 static int32_t foo32 = 0x12345678;
5458}
5459EOCP
5460set try
5461if eval $compile; then
5462 echo "<inttypes.h> found." >&4
5463 val="$define"
5464else
5465 echo "<inttypes.h> NOT found." >&4
5466 val="$undef"
5467fi
5468$rm -f try.c try
5469set i_inttypes
5470eval $setvar
5471
5472: check for int64_t
5473echo " "
5474echo "Checking to see if you have int64_t..." >&4
5475$cat >try.c <<EOCP
5476#include <sys/types.h>
5477#$i_inttypes I_INTTYPES
5478#ifdef I_INTTYPES
5479#include <inttypes.h>
5480#endif
5481int main() { int64_t x = 7; }
5482EOCP
5483set try
5484if eval $compile; then
5485 val="$define"
5486 echo "You have int64_t."
5487else
5488 val="$undef"
5489 echo "You do not have int64_t."
5490fi
5491$rm -f try try.*
5492set d_int64_t
5493eval $setvar
5494
5495
5496echo " "
5497echo "Checking which 64-bit integer type we could use..." >&4
5498
5499case "$intsize" in
55008) val=int
5501 set quadtype
5502 eval $setvar
5503 val='"unsigned int"'
5504 set uquadtype
5505 eval $setvar
5506 quadkind=1
5507 ;;
5508*) case "$longsize" in
5509 8) val=long
5510 set quadtype
5511 eval $setvar
5512 val='"unsigned long"'
5513 set uquadtype
5514 eval $setvar
5515 quadkind=2
5516 ;;
5517 *) case "$d_longlong:$longlongsize" in
5518 define:8)
5519 val='"long long"'
5520 set quadtype
5521 eval $setvar
5522 val='"unsigned long long"'
5523 set uquadtype
5524 eval $setvar
5525 quadkind=3
5526 ;;
5527 *) case "$d_int64_t" in
5528 define)
5529 val=int64_t
5530 set quadtype
5531 eval $setvar
5532 val=uint64_t
5533 set uquadtype
5534 eval $setvar
5535 quadkind=4
5536 ;;
5537 esac
5538 ;;
5539 esac
5540 ;;
5541 esac
5542 ;;
5543esac
5544
5545case "$quadtype" in
5546'') echo "Alas, no 64-bit integer types in sight." >&4
5547 d_quad="$undef"
5548 ;;
5549*) echo "We could use '$quadtype' for 64-bit integers." >&4
5550 d_quad="$define"
5551 ;;
5552esac
5553
b4eb6b3d
JH
5554
5555case "$uselonglong" in
5556"$define"|true|[yY]*)
5557 cat <<EOM >&4
5558
5559*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5560EOM
5561 use64bitint="$define"
5562 ;;
5563esac
5564case "$use64bits" in
5565"$define"|true|[yY]*)
5566 cat <<EOM >&4
5567
5568*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5569EOM
5570 use64bitint="$define"
5571 ;;
5572esac
5573case "$use64bitints" in
5574"$define"|true|[yY]*)
5575 cat <<EOM >&4
5576
5577*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5578EOM
5579 use64bitint="$define"
5580 ;;
5581esac
5582case "$use64bitsint" in
5583"$define"|true|[yY]*)
5584 cat <<EOM >&4
5585
5586*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5587EOM
5588 use64bitint="$define"
5589 ;;
5590esac
5591case "$uselonglongs" in
5592"$define"|true|[yY]*)
5593 cat <<EOM >&4
5594
5595*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5596EOM
5597 use64bitint="$define"
5598 ;;
5599esac
5600case "$use64bitsall" in
5601"$define"|true|[yY]*)
5602 cat <<EOM >&4
5603
5604*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5605EOM
5606 use64bitall="$define"
5607 ;;
5608esac
5609
5610case "$ccflags" in
5611*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5612esac
5613case "$use64bitall" in
5614"$define"|true|[yY]*) use64bitint="$define" ;;
5615esac
5616
5617case "$longsize" in
56188) cat <<EOM
5619
5620You have natively 64-bit long integers.
5621EOM
5622 val="$define"
5623 ;;
5624*) case "$use64bitint" in
5625 "$define"|true|[yY]*) dflt='y';;
5626 *) dflt='n';;
5627 esac
8dfa8df9
JH
5628 case "$d_quad" in
5629 "$define") ;;
5630 *) dflt='n' ;;
5631 esac
b4eb6b3d
JH
5632 cat <<EOM
5633
5634Perl can be built to take advantage of 64-bit integer types
5635on some systems. To do so, Configure can be run with -Duse64bitint.
5636Choosing this option will most probably introduce binary incompatibilities.
5637
5638If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5639(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5640EOM
5641 rp='Try to use 64-bit integers, if available?'
5642 . ./myread
5643 case "$ans" in
5644 [yY]*) val="$define" ;;
5645 *) val="$undef" ;;
5646 esac
5647 ;;
5648esac
5649set use64bitint
5650eval $setvar
5651
5652case "$use64bitall" in
5653"$define"|true|[yY]*) dflt='y' ;;
5654*) case "$longsize" in
5655 8) dflt='y' ;;
5656 *) dflt='n' ;;
5657 esac
5658 ;;
5659esac
5660cat <<EOM
5661
5662You may also choose to try maximal 64-bitness. It means using as much
566364-bitness as possible on the platform. This in turn means even more
5664binary incompatibilities. On the other hand, your platform may not
5665have any more 64-bitness available than what you already have chosen.
5666
5667If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5668(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5669EOM
5670rp='Try to use maximal 64-bit support, if available?'
5671. ./myread
5672case "$ans" in
5673[yY]*) val="$define" ;;
5674*) val="$undef" ;;
5675esac
5676set use64bitall
5677eval $setvar
5678case "$use64bitall" in
5679"$define")
5680 case "$use64bitint" in
5681 "$undef")
5682 cat <<EOM
5683
5684Since you have chosen a maximally 64-bit build, I'm also turning on
5685the use of 64-bit integers.
5686EOM
5687 use64bitint="$define" ;;
5688 esac
5689 ;;
5690esac
5691
b4eb6b3d
JH
5692: Look for a hint-file generated 'call-back-unit'. If the
5693: user has specified that a 64-bit perl is to be built,
5694: we may need to set or change some other defaults.
19a100ff 5695if $test -f use64bitint.cbu; then
9da7673b 5696 echo "Your platform has some specific hints regarding 64-bit integers, using them..."
19a100ff
MB
5697 . ./use64bitint.cbu
5698fi
9da7673b
MB
5699case "$use64bitint" in
5700"$define"|true|[yY]*)
b4eb6b3d
JH
5701 case "$longsize" in
5702 4) case "$archname64" in
5703 '') archname64=64int ;;
5704 esac
5705 ;;
5706 esac
5707 ;;
5708esac
5709
b4eb6b3d
JH
5710: Look for a hint-file generated 'call-back-unit'. If the
5711: user has specified that a maximally 64-bit perl is to be built,
5712: we may need to set or change some other defaults.
19a100ff 5713if $test -f use64bitall.cbu; then
9da7673b 5714 echo "Your platform has some specific hints regarding 64-bit builds, using them..."
19a100ff
MB
5715 . ./use64bitall.cbu
5716fi
9da7673b
MB
5717case "$use64bitall" in
5718"$define"|true|[yY]*)
b4eb6b3d
JH
5719 case "$longsize" in
5720 4) case "$archname64" in
5721 ''|64int) archname64=64all ;;
5722 esac
5723 ;;
5724 esac
5725 ;;
5726esac
5727
1911a026
JH
5728case "$d_quad:$use64bitint" in
5729$undef:$define)
5730 cat >&4 <<EOF
5731
5732*** You have chosen to use 64-bit integers,
19a100ff 5733*** but none can be found.
09b58c7b 5734*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
1911a026
JH
5735*** Cannot continue, aborting.
5736
5737EOF
5738 exit 1
5739 ;;
5740esac
5741
36adc09b
JH
5742: check for length of double
5743echo " "
5744case "$doublesize" in
5745'')
5746 echo "Checking to see how big your double precision numbers are..." >&4
5747 $cat >try.c <<EOCP
5748#include <stdio.h>
1911a026
JH
5749#$i_stdlib I_STDLIB
5750#ifdef I_STDLIB
5751#include <stdlib.h>
5752#endif
36adc09b
JH
5753int main()
5754{
5755 printf("%d\n", (int)sizeof(double));
1911a026 5756 exit(0);
36adc09b
JH
5757}
5758EOCP
5759 set try
5760 if eval $compile_ok; then
5761 doublesize=`$run ./try`
5762 echo "Your double is $doublesize bytes long."
5763 else
5764 dflt='8'
5765 echo "(I can't seem to compile the test program. Guessing...)"
5766 rp="What is the size of a double precision number (in bytes)?"
5767 . ./myread
5768 doublesize="$ans"
5769 fi
5770 ;;
5771esac
5772$rm -f try.c try
5773
5774: check for long doubles
5775echo " "
5776echo "Checking to see if you have long double..." >&4
5777echo 'int main() { long double x = 7.0; }' > try.c
5778set try
5779if eval $compile; then
5780 val="$define"
5781 echo "You have long double."
5782else
5783 val="$undef"
5784 echo "You do not have long double."
5785fi
5786$rm try.*
5787set d_longdbl
5788eval $setvar
5789
5790: check for length of long double
5791case "${d_longdbl}${longdblsize}" in
5792$define)
5793 echo " "
5794 echo "Checking to see how big your long doubles are..." >&4
5795 $cat >try.c <<'EOCP'
5796#include <stdio.h>
5797int main()
5798{
5799 printf("%d\n", sizeof(long double));
5800}
5801EOCP
5802 set try
5803 set try
5804 if eval $compile; then
5805 longdblsize=`$run ./try`
5806 echo "Your long doubles are $longdblsize bytes long."
5807 else
5808 dflt='8'
5809 echo " "
5810 echo "(I can't seem to compile the test program. Guessing...)" >&4
5811 rp="What is the size of a long double (in bytes)?"
5812 . ./myread
5813 longdblsize="$ans"
5814 fi
5815 if $test "X$doublesize" = "X$longdblsize"; then
7ad90562
AD
5816 echo "That isn't any different from an ordinary double."
5817 echo "I'll keep your setting anyway, but you may see some"
5818 echo "harmless compilation warnings."
36adc09b
JH
5819 fi
5820 ;;
5821esac
5822$rm -f try.* try
5823
89ce900e 5824: determine the architecture name
b4eb6b3d 5825echo " "
89ce900e
JH
5826if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5827 tarch=`arch`"-$osname"
5828elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5829 if uname -m > tmparch 2>&1 ; then
5830 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5831 -e 's/$/'"-$osname/" tmparch`
5832 else
5833 tarch="$osname"
5834 fi
5835 $rm -f tmparch
b4eb6b3d 5836else
89ce900e 5837 tarch="$osname"
b4eb6b3d 5838fi
89ce900e
JH
5839case "$myarchname" in
5840''|"$tarch") ;;
5841*)
5842 echo "(Your architecture name used to be $myarchname.)"
5843 archname=''
5844 ;;
5845esac
5846case "$targetarch" in
5847'') ;;
5848*) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5849esac
5850myarchname="$tarch"
5851case "$archname" in
5852'') dflt="$tarch";;
5853*) dflt="$archname";;
5854esac
5855rp='What is your architecture name'
5856. ./myread
5857archname="$ans"
5858case "$usethreads" in
5859$define)
5860 echo "Threads selected." >&4
5861 case "$archname" in
5862 *-thread*) echo "...and architecture name already has -thread." >&4
5863 ;;
5864 *) archname="$archname-thread"
5865 echo "...setting architecture name to $archname." >&4
5866 ;;
5867 esac
5868 ;;
5869esac
5870case "$usemultiplicity" in
5871$define)
5872 echo "Multiplicity selected." >&4
5873 case "$archname" in
5874 *-multi*) echo "...and architecture name already has -multi." >&4
5875 ;;
5876 *) archname="$archname-multi"
5877 echo "...setting architecture name to $archname." >&4
5878 ;;
5879 esac
5880 ;;
5881esac
5882case "$use64bitint$use64bitall" in
5883*"$define"*)
5884 case "$archname64" in
5885 '')
5886 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
bd9b35c9 5887 ;;
89ce900e
JH
5888 *)
5889 case "$use64bitint" in
5890 "$define") echo "64 bit integers selected." >&4 ;;
5891 esac
5892 case "$use64bitall" in
5893 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5894 esac
5895 case "$archname" in
5896 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5897 ;;
5898 *) archname="$archname-$archname64"
5899 echo "...setting architecture name to $archname." >&4
5900 ;;
5901 esac
c1a7f87b
JH
5902 ;;
5903 esac
89ce900e
JH
5904esac
5905case "$uselongdouble" in
5906$define)
5907 echo "Long doubles selected." >&4
5908 case "$longdblsize" in
5909 $doublesize)
5910 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5911 ;;
5912 *)
5913 case "$archname" in
5914 *-ld*) echo "...and architecture name already has -ld." >&4
5915 ;;
5916 *) archname="$archname-ld"
5917 echo "...setting architecture name to $archname." >&4
5918 ;;
5919 esac
bd9b35c9
JH
5920 ;;
5921 esac
bd9b35c9 5922 ;;
89ce900e
JH
5923esac
5924case "$useperlio" in
5925$define)
5926 echo "Perlio selected." >&4
5927 ;;
bd9b35c9 5928*)
89ce900e
JH
5929 echo "Perlio not selected, using stdio." >&4
5930 case "$archname" in
5931 *-stdio*) echo "...and architecture name already has -stdio." >&4
5932 ;;
5933 *) archname="$archname-stdio"
5934 echo "...setting architecture name to $archname." >&4
5935 ;;
5936 esac
bd9b35c9
JH
5937 ;;
5938esac
d2e0c6f7
JH
5939if $test -f archname.cbu; then
5940 echo "Your platform has some specific hints for architecture name, using them..."
5941 . ./archname.cbu
5942fi
bd9b35c9 5943
b4eb6b3d
JH
5944: set the prefixit variable, to compute a suitable default value
5945prefixit='case "$3" in
5946""|none)
5947 case "$oldprefix" in
5948 "") eval "$1=\"\$$2\"";;
5949 *)
5950 case "$3" in
5951 "") eval "$1=";;
5952 none)
5953 eval "tp=\"\$$2\"";
5954 case "$tp" in
5955 ""|" ") eval "$1=\"\$$2\"";;
5956 *) eval "$1=";;
5957 esac;;
5958 esac;;
5959 esac;;
5960*)
5961 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5962 case "$tp" in
5963 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5964 /*-$oldprefix/*|\~*-$oldprefix/*)
5965 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5966 *) eval "$1=\"\$$2\"";;
5967 esac;;
5968esac'
5969
b4eb6b3d
JH
5970: get the patchlevel
5971echo " "
5972echo "Getting the current patchlevel..." >&4
5973if $test -r $rsrc/patchlevel.h;then
5974 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5975 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5976 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5977 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5978 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5979 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
35918792 5980 perl_patchlevel=`egrep 'define PERL_PATCHNUM [0-9][0-9]|,"MAINT[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
b4eb6b3d
JH
5981else
5982 revision=0
5983 patchlevel=0
5984 subversion=0
5985 api_revision=0
5986 api_version=0
5987 api_subversion=0
151e6568
MB
5988 perl_patchlevel=0
5989 $echo "(You do not have patchlevel.h. Eek.)"
b4eb6b3d 5990fi
35918792
YST
5991if $test -r $rsrc/.patch ; then
5992 if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
151e6568
MB
5993 perl_patchlevel=`cat $rsrc/.patch`
5994 fi
5995fi
861eb78d 5996: Define a handy string here to avoid duplication in myconfig.SH and configpm.
f3f1a2d8
MB
5997version_patchlevel_string="version $patchlevel subversion $subversion"
5998case "$perl_patchlevel" in
59990|'') ;;
6000*) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4d20abad 6001esac
4d20abad 6002
f3f1a2d8 6003$echo "(You have $package $version_patchlevel_string.)"
4d20abad 6004
f3f1a2d8
MB
6005case "$osname" in
6006dos|vms)
6007 : XXX Should be a Configure test for double-dots in filenames.
6008 version=`echo $revision $patchlevel $subversion | \
6009 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6010 api_versionstring=`echo $api_revision $api_version $api_subversion | \
6011 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6012 ;;
6013*)
6014 version=`echo $revision $patchlevel $subversion | \
6015 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6016 api_versionstring=`echo $api_revision $api_version $api_subversion | \
6017 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6018 ;;
4d20abad 6019esac
f3f1a2d8
MB
6020: Special case the 5.005_xx maintenance series, which used 5.005
6021: without any subversion label as a subdirectory in $sitelib
6022if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6023 api_versionstring='5.005'
6024fi
4d20abad 6025
f3f1a2d8
MB
6026: determine installation style
6027: For now, try to deduce it from prefix unless it is already set.
6028: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6029case "$installstyle" in
6030'') case "$prefix" in
6031 *perl*) dflt='lib';;
6032 *) dflt='lib/perl5' ;;
6033 esac
6034 ;;
6035*) dflt="$installstyle" ;;
4d20abad 6036esac
f3f1a2d8
MB
6037: Probably not worth prompting for this since we prompt for all
6038: the directories individually, and the prompt would be too long and
6039: confusing anyway.
6040installstyle=$dflt
4d20abad 6041
eaf812ae
MB
6042: determine where public executables go
6043echo " "
6044set dflt bin bin
6045eval $prefixit
6046fn=d~
6047rp='Pathname where the public executables will reside?'
6048. ./getfile
6049if $test "X$ansexp" != "X$binexp"; then
6050 installbin=''
6051fi
6052prefixvar=bin
6053: XXX Bug? -- ignores Configure -Dinstallprefix setting.
d0e36aa9 6054: XXX If this is fixed, also fix the "start perl" hunk below, which relies on
a2d23ec2 6055: this via initialinstalllocation
eaf812ae
MB
6056. ./setprefixvar
6057
6058case "$userelocatableinc" in
6059$define|true|[yY]*) dflt='y' ;;
6060*) dflt='n' ;;
6061esac
6062cat <<EOM
6063
6064Would you like to build Perl so that the installation is relocatable, so that
6065library paths in @INC are determined relative to the path of the perl binary?
6066This is not advised for system Perl installs, or if you need to run setid
6067scripts or scripts under taint mode.
6068
6069If this doesn't make any sense to you, just accept the default '$dflt'.
6070EOM
6071rp='Use relocatable @INC?'
6072. ./myread
6073case "$ans" in
6074y|Y) val="$define" ;;
6075*) val="$undef" ;;
6076esac
6077set userelocatableinc
6078eval $setvar
6079
ea7d701d 6080initialinstalllocation="$binexp"
eaf812ae
MB
6081: Default prefix is now "up one level from where the binaries are"
6082case "$userelocatableinc" in
6083$define|true|[yY]*)
eaf812ae
MB
6084 bin=".../"
6085 binexp=".../"
6086 prefix=".../.."
6087 prefixexp=".../.."
6088 installprefixexp=".../.."
6089 ;;
6090esac
6091
b4eb6b3d
JH
6092: determine where private library files go
6093: Usual default is /usr/local/lib/perl5/$version.
f3f1a2d8 6094: Also allow things like /opt/perl/lib/$version, since
b4eb6b3d
JH
6095: /opt/perl/lib/perl5... would be redundant.
6096: The default "style" setting is made in installstyle.U
6097case "$installstyle" in
6098*lib/perl5*) set dflt privlib lib/$package/$version ;;
6099*) set dflt privlib lib/$version ;;
6100esac
6101eval $prefixit
6102$cat <<EOM
6103
6104There are some auxiliary files for $package that need to be put into a
6105private library directory that is accessible by everyone.
6106
6107EOM
eaf812ae 6108fn=$binexp
b4eb6b3d
JH
6109fn=d~+
6110rp='Pathname where the private library files will reside?'
6111. ./getfile
79522dd2
NC
6112prefixvar=privlib
6113. ./setprefixvar
b4eb6b3d
JH
6114
6115: set the prefixup variable, to restore leading tilda escape
6116prefixup='case "$prefixexp" in
6117"$prefix") ;;
6118*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6119esac'
6120
6121: determine where public architecture dependent libraries go
6122set archlib archlib
6123eval $prefixit
6124: privlib default is /usr/local/lib/$package/$version
6125: archlib default is /usr/local/lib/$package/$version/$archname
6126: privlib may have an optional trailing /share.
6127tdflt=`echo $privlib | $sed 's,/share$,,'`
6128tdflt=$tdflt/$archname
6129case "$archlib" in
6130'') dflt=$tdflt
6131 ;;
6132*) dflt="$archlib"
6133 ;;
6134esac
6135$cat <<EOM
6136
6137$spackage contains architecture-dependent library files. If you are
6138sharing libraries in a heterogeneous environment, you might store
6139these files in a separate location. Otherwise, you can just include
6140them with the rest of the public library files.
6141
6142EOM
eaf812ae 6143fn=$binexp
b4eb6b3d
JH
6144fn=d+~
6145rp='Where do you want to put the public architecture-dependent libraries?'
6146. ./getfile
79522dd2
NC
6147prefixvar=archlib
6148. ./setprefixvar
b4eb6b3d
JH
6149if $test X"$archlib" = X"$privlib"; then
6150 d_archlib="$undef"
6151else
6152 d_archlib="$define"
6153fi
b4eb6b3d 6154
b4eb6b3d
JH
6155: see if setuid scripts can be secure
6156$cat <<EOM
6157
6158Some kernels have a bug that prevents setuid #! scripts from being
6159secure. Some sites have disabled setuid #! scripts because of this.
6160
6161First let's decide if your kernel supports secure setuid #! scripts.
6162(If setuid #! scripts would be secure but have been disabled anyway,
6163don't say that they are secure if asked.)
6164
6165EOM
6166
6167val="$undef"
6168if $test -d /dev/fd; then
6169 echo "#!$ls" >reflect
6170 chmod +x,u+s reflect
6171 ./reflect >flect 2>&1
6172 if $contains "/dev/fd" flect >/dev/null; then
6173 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6174 val="$define"
6175 else
6176 $cat <<EOM
6177If you are not sure if they are secure, I can check but I'll need a
6178username and password different from the one you are using right now.
6179If you don't have such a username or don't want me to test, simply
6180enter 'none'.
6181
6182EOM
6183 rp='Other username to test security of setuid scripts with?'
6184 dflt='none'
6185 . ./myread
6186 case "$ans" in
6187 n|none)
6188 case "$d_suidsafe" in
6189 '') echo "I'll assume setuid scripts are *not* secure." >&4
6190 dflt=n;;
6191 "$undef")
6192 echo "Well, the $hint value is *not* secure." >&4
6193 dflt=n;;
6194 *) echo "Well, the $hint value *is* secure." >&4
6195 dflt=y;;
6196 esac
c1a7f87b 6197 ;;
b4eb6b3d
JH
6198 *)
6199 $rm -f reflect flect
6200 echo "#!$ls" >reflect
6201 chmod +x,u+s reflect
6202 echo >flect
6203 chmod a+w flect
6204 echo '"su" will (probably) prompt you for '"$ans's password."
6205 su $ans -c './reflect >flect'
6206 if $contains "/dev/fd" flect >/dev/null; then
6207 echo "Okay, it looks like setuid scripts are secure." >&4
6208 dflt=y
6209 else
6210 echo "I don't think setuid scripts are secure." >&4
6211 dflt=n
6212 fi
6213 ;;
6214 esac
6215 rp='Does your kernel have *secure* setuid scripts?'
6216 . ./myread
6217 case "$ans" in
6218 [yY]*) val="$define";;
6219 *) val="$undef";;
6220 esac
6221 fi
6222else
6223 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6224 echo "(That's for file descriptors, not floppy disks.)"
6225 val="$undef"
6226fi
6227set d_suidsafe
6228eval $setvar
6229
6230$rm -f reflect flect
6231
6232: now see if they want to do setuid emulation
6233echo " "
6234val="$undef"
6235case "$d_suidsafe" in
6236"$define")
6237 val="$undef"
3c728e00 6238 echo "No need to emulate SUID scripts since they are secure here." >&4
b4eb6b3d 6239 ;;
f3f1a2d8
MB
6240*)
6241 $cat <<EOM
6242Some systems have disabled setuid scripts, especially systems where
6243setuid scripts cannot be secure. On systems where setuid scripts have
6244been disabled, the setuid/setgid bits on scripts are currently
6245useless. It is possible for $package to detect those bits and emulate
6246setuid/setgid in a secure fashion. This emulation will only work if
6247setuid scripts have been disabled in your kernel.
6248
6249EOM
6250 case "$d_dosuid" in
6251 "$define") dflt=y ;;
6252 *) dflt=n ;;
6253 esac
6254 rp="Do you want to do setuid/setgid emulation?"
6255 . ./myread
6256 case "$ans" in
6257 [yY]*) val="$define";;
6258 *) val="$undef";;
6259 esac
6260 ;;
6261esac
6262set d_dosuid
6263eval $setvar
6264
f3f1a2d8
MB
6265: Find perl5.005 or later.
6266echo "Looking for a previously installed perl5.005 or later... "
6267case "$perl5" in
6268'') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6269 : Check if this perl is recent and can load a simple module
6270 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6271 perl5=$tdir/perl
6272 break;
6273 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6274 perl5=$tdir/perl5
6275 break;
6276 fi
6277 done
6278 ;;
6279*) perl5="$perl5"
6280 ;;
6281esac
6282case "$perl5" in
6283'') echo "None found. That's ok.";;
6284*) echo "Using $perl5." ;;
6285esac
6286
6287$cat <<EOM
6288
6289After $package is installed, you may wish to install various
6290add-on modules and utilities. Typically, these add-ons will
6291be installed under $prefix with the rest
6292of this package. However, you may wish to install such add-ons
6293elsewhere under a different prefix.
6294
6295If you do not wish to put everything under a single prefix, that's
6296ok. You will be prompted for the individual locations; this siteprefix
6297is only used to suggest the defaults.
6298
6299The default should be fine for most people.
6300
6301EOM
6302fn=d~+
6303rp='Installation prefix to use for add-on modules and utilities?'
6304: XXX Here might be another good place for an installstyle setting.
6305case "$siteprefix" in
6306'') dflt=$prefix ;;
6307*) dflt=$siteprefix ;;
6308esac
6309. ./getfile
6310: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6311oldsiteprefix=''
6312case "$siteprefix" in
6313'') ;;
6314*) case "$ans" in
6315 "$prefix") ;;
6316 *) oldsiteprefix="$prefix";;
6317 esac
6318 ;;
6319esac
6320siteprefix="$ans"
6321siteprefixexp="$ansexp"
6322
6323: determine where site specific libraries go.
6324: Usual default is /usr/local/lib/perl5/site_perl/$version
6325: The default "style" setting is made in installstyle.U
6326: XXX No longer works with Prefixit stuff.
6327prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6328case "$sitelib" in
6329'') case "$installstyle" in
6330 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6331 *) dflt=$siteprefix/lib/site_$prog/$version ;;
6332 esac
6333 ;;
6334*) dflt="$sitelib"
6335 ;;
6336esac
6337$cat <<EOM
6338
6339The installation process will create a directory for
6340site-specific extensions and modules. Most users find it convenient
6341to place all site-specific files in this directory rather than in the
6342main distribution directory.
6343
6344EOM
6345fn=d~+
6346rp='Pathname for the site-specific library files?'
6347. ./getfile
6348prefixvar=sitelib
6349. ./setprefixvar
6350sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6351
6352: Determine list of previous versions to include in @INC
6353$cat > getverlist <<EOPL
6354#!$perl5 -w
6355use File::Basename;
6356\$api_versionstring = "$api_versionstring";
6357\$version = "$version";
6358\$stem = "$sitelib_stem";
6359\$archname = "$archname";
6360EOPL
6361 $cat >> getverlist <<'EOPL'
6362# Can't have leading @ because metaconfig interprets it as a command!
6363;@inc_version_list=();
6364# XXX Redo to do opendir/readdir?
6365if (-d $stem) {
6366 chdir($stem);
6367 ;@candidates = glob("5.*");
6368}
6369else {
6370 ;@candidates = ();
6371}
6372
6373# XXX ToDo: These comparisons must be reworked when two-digit
6374# subversions come along, so that 5.7.10 compares as greater than
6375# 5.7.3! By that time, hope that 5.6.x is sufficiently
6376# widespread that we can use the built-in version vectors rather
6377# than reinventing them here. For 5.6.0, however, we must
6378# assume this script will likely be run by 5.005_0x. --AD 1/2000.
6379foreach $d (@candidates) {
6380 if ($d lt $version) {
6381 if ($d ge $api_versionstring) {
6382 unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6383 }
6384 elsif ($d ge "5.005") {
6385 unshift(@inc_version_list, grep { -d } $d);
6386 }
6387 }
6388 else {
6389 # Skip newer version. I.e. don't look in
6390 # 5.7.0 if we're installing 5.6.1.
6391 }
6392}
6393
6394if (@inc_version_list) {
6395 print join(' ', @inc_version_list);
6396}
6397else {
6398 # Blank space to preserve value for next Configure run.
6399 print " ";
6400}
6401EOPL
6402chmod +x getverlist
6403case "$inc_version_list" in
6404'') if test -x "$perl5$exe_ext"; then
6405 dflt=`$perl5 getverlist`
6406 else
6407 dflt='none'
6408 fi
6409 ;;
6410$undef) dflt='none' ;;
6411*) eval dflt=\"$inc_version_list\" ;;
6412esac
6413case "$dflt" in
6414''|' ') dflt=none ;;
6415esac
6416case "$dflt" in
64175.005) dflt=none ;;
6418esac
6419$cat <<EOM
6420
6421In order to ease the process of upgrading, this version of perl
6422can be configured to use modules built and installed with earlier
6423versions of perl that were installed under $prefix. Specify here
6424the list of earlier versions that this version of perl should check.
6425If Configure detected no earlier versions of perl installed under
6426$prefix, then the list will be empty. Answer 'none' to tell perl
6427to not search earlier versions.
b4eb6b3d 6428
f3f1a2d8
MB
6429The default should almost always be sensible, so if you're not sure,
6430just accept the default.
b4eb6b3d 6431EOM
f3f1a2d8
MB
6432
6433rp='List of earlier versions to include in @INC?'
6434. ./myread
6435case "$ans" in
6436[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6437*) inc_version_list="$ans" ;;
6438esac
6439case "$inc_version_list" in
6440''|' ')
6441 inc_version_list_init='0'
6442 d_inc_version_list="$undef"
6443 ;;
6444*) inc_version_list_init=`echo $inc_version_list |
6445 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6446 d_inc_version_list="$define"
b4eb6b3d
JH
6447 ;;
6448esac
f3f1a2d8 6449$rm -f getverlist
b4eb6b3d 6450
b4eb6b3d 6451: see if this is a malloc.h system
01d07975
YST
6452: we want a real compile instead of Inhdr because some systems have a
6453: malloc.h that just gives a compile error saying to use stdlib.h instead
6454echo " "
6455$cat >try.c <<EOCP
6456#include <stdlib.h>
6457#include <malloc.h>
6458int main () { return 0; }
6459EOCP
6460set try
6461if eval $compile; then
6462 echo "<malloc.h> found." >&4
6463 val="$define"
6464else
6465 echo "<malloc.h> NOT found." >&4
6466 val="$undef"
6467fi
6468$rm -f try.c try
6469set i_malloc
6470eval $setvar
b4eb6b3d 6471
c8b93cf9
JH
6472: check for void type
6473echo " "
6474echo "Checking to see how well your C compiler groks the void type..." >&4
6475case "$voidflags" in
6476'')
c727eafa 6477 $cat >try.c <<EOCP
d1daaddf
JH
6478#$i_stdlib I_STDLIB
6479#ifdef I_STDLIB
6480#include <stdlib.h>
6481#endif
c8b93cf9
JH
6482#if TRY & 1
6483void sub() {
6484#else
6485sub() {
6486#endif
6487 extern void moo(); /* function returning void */
6488 void (*goo)(); /* ptr to func returning void */
6489#if TRY & 8
6490 void *hue; /* generic ptr */
6491#endif
6492#if TRY & 2
6493 void (*foo[10])();
6494#endif
6495
6496#if TRY & 4
6497 if(goo == moo) {
6498 exit(0);
6499 }
6500#endif
6501 exit(0);
6502}
6503int main() { sub(); }
6504EOCP
6505 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6506 voidflags=$defvoidused
6507 echo "Good. It appears to support void to the level $package wants.">&4
6508 if $contains warning .out >/dev/null 2>&1; then
6509 echo "However, you might get some warnings that look like this:"
6510 $cat .out
6511 fi
6512 else
6513echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6514 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6515 echo "It supports 1..."
6516 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6517 echo "It also supports 2..."
6518 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6519 voidflags=7
6520 echo "And it supports 4 but not 8 definitely."
6521 else
6522 echo "It doesn't support 4..."
6523 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6524 voidflags=11
6525 echo "But it supports 8."
6526 else
6527 voidflags=3
6528 echo "Neither does it support 8."
6529 fi
6530 fi
6531 else
6532 echo "It does not support 2..."
6533 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6534 voidflags=13
6535 echo "But it supports 4 and 8."
6536 else
6537 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6538 voidflags=5
6539 echo "And it supports 4 but has not heard about 8."
6540 else
6541 echo "However it supports 8 but not 4."
6542 fi
6543 fi
6544 fi
6545 else
6546 echo "There is no support at all for void."
6547 voidflags=0
6548 fi
6549 fi
6550esac
6551case "$voidflags" in
6552"$defvoidused") ;;
6553*) $cat >&4 <<'EOM'
6554 Support flag bits are:
6555 1: basic void declarations.
6556 2: arrays of pointers to functions returning void.
6557 4: operations between pointers to and addresses of void functions.
6558 8: generic void pointers.
6559EOM
6560 dflt="$voidflags";
6561 rp="Your void support flags add up to what?"
6562 . ./myread
6563 voidflags="$ans"
6564 ;;
6565esac
6566$rm -f try.* .out
6567
6568: check for length of pointer
6569echo " "
6570case "$ptrsize" in
6571'')
6572 echo "Checking to see how big your pointers are..." >&4
6573 if test "$voidflags" -gt 7; then
6574 echo '#define VOID_PTR char *' > try.c
6575 else
6576 echo '#define VOID_PTR void *' > try.c
6577 fi
74d00865 6578 $cat >>try.c <<EOCP
c8b93cf9 6579#include <stdio.h>
d1daaddf
JH
6580#$i_stdlib I_STDLIB
6581#ifdef I_STDLIB
6582#include <stdlib.h>
6583#endif
c8b93cf9
JH
6584int main()
6585{
6586 printf("%d\n", (int)sizeof(VOID_PTR));
6587 exit(0);
6588}
6589EOCP
6590 set try
6591 if eval $compile_ok; then
6592 ptrsize=`$run ./try`
6593 echo "Your pointers are $ptrsize bytes long."
6594 else
6595 dflt='4'
6596 echo "(I can't seem to compile the test program. Guessing...)" >&4
6597 rp="What is the size of a pointer (in bytes)?"
6598 . ./myread
6599 ptrsize="$ans"
6600 fi
6601 ;;
6602esac
6603$rm -f try.c try
6604case "$use64bitall" in
6605"$define"|true|[yY]*)
6606 case "$ptrsize" in
6607 4) cat <<EOM >&4
6608
1911a026
JH
6609*** You have chosen a maximally 64-bit build,
6610*** but your pointers are only 4 bytes wide.
09b58c7b
JH
6611*** Please rerun Configure without -Duse64bitall.
6612EOM
6613 case "$d_quad" in
6614 define)
6615 cat <<EOM >&4
6616*** Since you have quads, you could possibly try with -Duse64bitint.
6617EOM
6618 ;;
6619 esac
6620 cat <<EOM >&4
1911a026 6621*** Cannot continue, aborting.
c8b93cf9
JH
6622
6623EOM
09b58c7b 6624
1911a026 6625 exit 1
c8b93cf9
JH
6626 ;;
6627 esac
6628 ;;
6629esac
6630
19a100ff 6631
9df442c2
NC
6632: determine whether to use malloc wrapping
6633echo " "
6634case "$usemallocwrap" in
6635[yY]*|true|$define) dflt='y' ;;
6636[nN]*|false|$undef) dflt='n' ;;
6637*) case "$usedevel" in
6638 [yY]*|true|$define) dflt='y' ;;
6639 *) dflt='n' ;;
6640 esac
6641 ;;
6642esac
6643rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6644. ./myread
6645usemallocwrap="$ans"
6646case "$ans" in
6647y*|true)
6648 usemallocwrap="$define" ;;
6649*)
6650 usemallocwrap="$undef" ;;
6651esac
c8b93cf9 6652
b4eb6b3d
JH
6653: determine which malloc to compile in
6654echo " "
6655case "$usemymalloc" in
c4163172
JH
6656[yY]*|true|$define) dflt='y' ;;
6657[nN]*|false|$undef) dflt='n' ;;
6658*) case "$ptrsize" in
6659 4) dflt='y' ;;
6660 *) dflt='n' ;;
6661 esac
6662 ;;
8dfa8df9 6663esac
b4eb6b3d
JH
6664rp="Do you wish to attempt to use the malloc that comes with $package?"
6665. ./myread
6666usemymalloc="$ans"
6667case "$ans" in
6668y*|true)
6669 usemymalloc='y'
6670 mallocsrc='malloc.c'
6671 mallocobj="malloc$_o"
6672 d_mymalloc="$define"
6673 case "$libs" in
6674 *-lmalloc*)
6675 : Remove malloc from list of libraries to use
6676 echo "Removing unneeded -lmalloc from library list" >&4
6677 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6678 shift
6679 libs="$*"
6680 echo "libs = $libs" >&4
6681 ;;
6682 esac
6683 ;;
6684*)
6685 usemymalloc='n'
6686 mallocsrc=''
6687 mallocobj=''
6688 d_mymalloc="$undef"
6689 ;;
6690esac
6691
6692: compute the return types of malloc and free
6693echo " "
6694$cat >malloc.c <<END
6695#$i_malloc I_MALLOC
6696#$i_stdlib I_STDLIB
6697#include <stdio.h>
6698#include <sys/types.h>
6699#ifdef I_MALLOC
6700#include <malloc.h>
6701#endif
6702#ifdef I_STDLIB
6703#include <stdlib.h>
6704#endif
6705#ifdef TRY_MALLOC
6706void *malloc();
6707#endif
6708#ifdef TRY_FREE
6709void free();
6710#endif
6711END
6712case "$malloctype" in
6713'')
6714 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6715 malloctype='void *'
6716 else
6717 malloctype='char *'
6718 fi
6719 ;;
6720esac
6721echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6722
6723case "$freetype" in
6724'')
6725 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6726 freetype='void'
6727 else
6728 freetype='int'
6729 fi
6730 ;;
6731esac
6732echo "Your system uses $freetype free(), it would seem." >&4
6733$rm -f malloc.[co]
b4eb6b3d
JH
6734: determine where site specific architecture-dependent libraries go.
6735: sitelib default is /usr/local/lib/perl5/site_perl/$version
6736: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6737: sitelib may have an optional trailing /share.
6738case "$sitearch" in
6739'') dflt=`echo $sitelib | $sed 's,/share$,,'`
6740 dflt="$dflt/$archname"
6741 ;;
6742*) dflt="$sitearch"
6743 ;;
6744esac
6745set sitearch sitearch none
6746eval $prefixit
6747$cat <<EOM
6748
6749The installation process will also create a directory for
6750architecture-dependent site-specific extensions and modules.
6751
6752EOM
6753fn=d~+
6754rp='Pathname for the site-specific architecture-dependent library files?'
6755. ./getfile
79522dd2
NC
6756prefixvar=sitearch
6757. ./setprefixvar
c95d0e17
GA
6758if $test X"$sitearch" = X"$sitelib"; then
6759 d_sitearch="$undef"
6760else
6761 d_sitearch="$define"
6762fi
b4eb6b3d
JH
6763
6764$cat <<EOM
6765
6766The installation process will also create a directory for
6767vendor-supplied add-ons. Vendors who supply perl with their system
6768may find it convenient to place all vendor-supplied files in this
6769directory rather than in the main distribution directory. This will
6770ease upgrades between binary-compatible maintenance versions of perl.
6771
6772Of course you may also use these directories in whatever way you see
6773fit. For example, you might use them to access modules shared over a
6774company-wide network.
6775
6776The default answer should be fine for most people.
6777This causes further questions about vendor add-ons to be skipped
6778and no vendor-specific directories will be configured for perl.
6779
6780EOM
6781rp='Do you want to configure vendor-specific add-on directories?'
6782case "$usevendorprefix" in
6783define|true|[yY]*) dflt=y ;;
6784*) : User may have set vendorprefix directly on Configure command line.
6785 case "$vendorprefix" in
6786 ''|' ') dflt=n ;;
6787 *) dflt=y ;;
6788 esac
6789 ;;
6790esac
6791. ./myread
6792case "$ans" in
6793[yY]*) fn=d~+
6794 rp='Installation prefix to use for vendor-supplied add-ons?'
6795 case "$vendorprefix" in
6796 '') dflt='' ;;
6797 *) dflt=$vendorprefix ;;
6798 esac
6799 . ./getfile
6800 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6801 oldvendorprefix=''
6802 case "$vendorprefix" in
6803 '') ;;
6804 *) case "$ans" in
6805 "$prefix") ;;
6806 *) oldvendorprefix="$prefix";;
6807 esac
6808 ;;
6809 esac
6810 usevendorprefix="$define"
6811 vendorprefix="$ans"
6812 vendorprefixexp="$ansexp"
6813 ;;
6814*) usevendorprefix="$undef"
6815 vendorprefix=''
6816 vendorprefixexp=''
6817 ;;
6818esac
6819
6820case "$vendorprefix" in
6821'') d_vendorlib="$undef"
6822 vendorlib=''
6823 vendorlibexp=''
6824 ;;
6825*) d_vendorlib="$define"
6826 : determine where vendor-supplied modules go.
6827 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6828 case "$vendorlib" in
6829 '')
6830 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6831 case "$installstyle" in
6832 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6833 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6834 esac
6835 ;;
6836 *) dflt="$vendorlib"
6837 ;;
6838 esac
6839 fn=d~+
6840 rp='Pathname for the vendor-supplied library files?'
6841 . ./getfile
6842 vendorlib="$ans"
6843 vendorlibexp="$ansexp"
6844 ;;
6845esac
6846vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
a092d240
NC
6847prefixvar=vendorlib
6848. ./installprefix
b4eb6b3d
JH
6849
6850case "$vendorprefix" in
6851'') d_vendorarch="$undef"
6852 vendorarch=''
6853 vendorarchexp=''
6854 ;;
6855*) d_vendorarch="$define"
6856 : determine where vendor-supplied architecture-dependent libraries go.
6857 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
6858 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6859 : vendorlib may have an optional trailing /share.
6860 case "$vendorarch" in
6861 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
6862 dflt="$dflt/$archname"
6863 ;;
6864 *) dflt="$vendorarch" ;;
6865 esac
6866 fn=d~+
6867 rp='Pathname for vendor-supplied architecture-dependent files?'
6868 . ./getfile
6869 vendorarch="$ans"
6870 vendorarchexp="$ansexp"
6871 ;;
6872esac
a092d240
NC
6873prefixvar=vendorarch
6874. ./installprefix
b4eb6b3d
JH
6875
6876: Final catch-all directories to search
6877$cat <<EOM
6878
6879Lastly, you can have perl look in other directories for extensions and
6880modules in addition to those already specified.
6881These directories will be searched after
6882 $sitearch
6883 $sitelib
6884EOM
6885test X"$vendorlib" != "X" && echo ' ' $vendorlib
6886test X"$vendorarch" != "X" && echo ' ' $vendorarch
6887echo ' '
6888case "$otherlibdirs" in
6889''|' ') dflt='none' ;;
6890*) dflt="$otherlibdirs" ;;
6891esac
6892$cat <<EOM
6893Enter a colon-separated set of extra paths to include in perl's @INC
6894search path, or enter 'none' for no extra paths.
6895
6896EOM
6897
6898rp='Colon-separated list of additional directories for perl to search?'
6899. ./myread
6900case "$ans" in
6901' '|''|none) otherlibdirs=' ' ;;
6902*) otherlibdirs="$ans" ;;
6903esac
6904case "$otherlibdirs" in
6905' ') val=$undef ;;
6906*) val=$define ;;
6907esac
6908set d_perl_otherlibdirs
6909eval $setvar
6910
6911: Cruising for prototypes
6912echo " "
6913echo "Checking out function prototypes..." >&4
55954f19
JH
6914$cat >prototype.c <<EOCP
6915#$i_stdlib I_STDLIB
6916#ifdef I_STDLIB
6917#include <stdlib.h>
6918#endif
b4eb6b3d
JH
6919int main(int argc, char *argv[]) {
6920 exit(0);}
6921EOCP
6922if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6923 echo "Your C compiler appears to support function prototypes."
6924 val="$define"
6925else
6926 echo "Your C compiler doesn't seem to understand function prototypes."
6927 val="$undef"
6928fi
6929set prototype
6930eval $setvar
6931$rm -f prototype*
6932
6933case "$prototype" in
6934"$define") ;;
6935*) ansi2knr='ansi2knr'
6936 echo " "
6937 cat <<EOM >&4
6938
6939$me: FATAL ERROR:
6940This version of $package can only be compiled by a compiler that
6941understands function prototypes. Unfortunately, your C compiler
6942 $cc $ccflags
6943doesn't seem to understand them. Sorry about that.
6944
6945If GNU cc is available for your system, perhaps you could try that instead.
6946
6947Eventually, we hope to support building Perl with pre-ANSI compilers.
6948If you would like to help in that effort, please contact <perlbug@perl.org>.
6949
6950Aborting Configure now.
6951EOM
6952 exit 2
6953 ;;
6954esac
6955
6fcddf3b 6956echo " "
6fcddf3b 6957case "$extras" in
bf35c3f6
JH
6958'') dflt='n';;
6959*) dflt='y';;
6fcddf3b
JH
6960esac
6961cat <<EOM
6962Perl can be built with extra modules or bundles of modules which
6963will be fetched from the CPAN and installed alongside Perl.
6964
6965Notice that you will need access to the CPAN; either via the Internet,
6966or a local copy, for example a CD-ROM or a local CPAN mirror. (You will
6967be asked later to configure the CPAN.pm module which will in turn do
6968the installation of the rest of the extra modules or bundles.)
6969
6970Notice also that if the modules require any external software such as
dd2de242
JH
6971libraries and headers (the libz library and the zlib.h header for the
6972Compress::Zlib module, for example) you MUST have any such software
6973already installed, this configuration process will NOT install such
6974things for you.
6fcddf3b
JH
6975
6976If this doesn't make any sense to you, just accept the default '$dflt'.
6977EOM
dd2de242 6978rp='Install any extra modules (y or n)?'
6fcddf3b
JH
6979. ./myread
6980case "$ans" in
6981y|Y)
6982 cat <<EOM
6983
6984Please list any extra modules or bundles to be installed from CPAN,
6985with spaces between the names. The names can be in any format the
dd2de242
JH
6986'install' command of CPAN.pm will understand. (Answer 'none',
6987without the quotes, to install no extra modules or bundles.)
6fcddf3b
JH
6988EOM
6989 rp='Extras?'
6990 dflt="$extras"
6991 . ./myread
6992 extras="$ans"
6993esac
6994case "$extras" in
6995''|'none')
6996 val=''
6997 $rm -f ../extras.lst
6998 ;;
6999*) echo "(Saving the list of extras for later...)"
dd2de242
JH
7000 echo "$extras" > ../extras.lst
7001 val="'$extras'"
6fcddf3b
JH
7002 ;;
7003esac
7004set extras
7005eval $setvar
7006echo " "
7007
6e1038e0
MB
7008: determine where html pages for programs go
7009set html1dir html1dir none
7010eval $prefixit
7011$cat <<EOM
7012
f3f1a2d8 7013If you wish to install html files for programs in $spackage, indicate
6e1038e0
MB
7014the appropriate directory here. To skip installing html files,
7015answer "none".
7016EOM
7017case "$html1dir" in
7018''|none|$undef|' ') dflt=none ;;
7019*) dflt=$html1dir ;;
7020esac
7021fn=dn+~
7022rp="Directory for the main $spackage html pages?"
7023. ./getfile
79522dd2
NC
7024prefixvar=html1dir
7025. ./setprefixvar
6e1038e0
MB
7026: Use ' ' for none so value is preserved next time through Configure
7027$test X"$html1dir" = "X" && html1dir=' '
6e1038e0
MB
7028
7029: determine where html pages for libraries and modules go
7030set html3dir html3dir none
7031eval $prefixit
7032$cat <<EOM
7033
7034If you wish to install html files for modules associated with $spackage,
7035indicate the appropriate directory here. To skip installing html files,
7036answer "none".
7037EOM
7038: There is no obvious default. If they have specified html1dir, then
7039: try to key off that, possibly changing .../html1 into .../html3.
7040case "$html3dir" in
7041'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7042*) dflt=$html3dir ;;
7043esac
7044fn=dn+~
7045rp="Directory for the $spackage module html pages?"
7046. ./getfile
79522dd2
NC
7047prefixvar=html3dir
7048. ./setprefixvar
6e1038e0
MB
7049: Use ' ' for none so value is preserved next time through Configure
7050$test X"$html3dir" = "X" && html3dir=' '
6e1038e0 7051
89ce900e
JH
7052: determine whether to install perl also as /usr/bin/perl
7053
7054echo " "
7055if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7056 $cat <<EOM
7057Many scripts expect perl to be installed as /usr/bin/perl.
7058
7059If you want to, I can install the perl you are about to compile
7060as /usr/bin/perl (in addition to $bin/perl).
7061EOM
7062 if test -f /usr/bin/perl; then
7063 $cat <<EOM
7064
7065However, please note that because you already have a /usr/bin/perl,
7066overwriting that with a new Perl would very probably cause problems.
7067Therefore I'm assuming you don't want to do that (unless you insist).
7068
7069EOM
7070 case "$installusrbinperl" in
7071 "$define"|[yY]*) dflt='y';;
7072 *) dflt='n';;
7073 esac
7074 else
7075 $cat <<EOM
7076
7077Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7078
7079EOM
7080 case "$installusrbinperl" in
7081 "$undef"|[nN]*) dflt='n';;
7082 *) dflt='y';;
7083 esac
7084 fi
7085 rp="Do you want to install perl as /usr/bin/perl?"
7086 . ./myread
7087 case "$ans" in
7088 [yY]*) val="$define";;
7089 *) val="$undef" ;;
7090 esac
7091else
7092 val="$undef"
7093fi
7094set installusrbinperl
7095eval $setvar
7096
7097echo " "
7098echo "Checking for GNU C Library..." >&4
7099cat >try.c <<'EOCP'
7100/* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__
7101 alone are insufficient to distinguish different versions, such as
7102 2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in
7103 libc version 2.1.0. A. Dougherty, June 3, 2002.
7104*/
7105#include <stdio.h>
7106int main(void)
7107{
7108#ifdef __GLIBC__
7109# ifdef __GLIBC_MINOR__
7110# if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
7111# include <gnu/libc-version.h>
7112 printf("%s\n", gnu_get_libc_version());
7113# else
7114 printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__);
7115# endif
7116# else
7117 printf("%d\n", __GLIBC__);
7118# endif
7119 return 0;
7120#else
7121 return 1;
7122#endif
7123}
7124EOCP
7125set try
7126if eval $compile_ok && $run ./try > glibc.ver; then
7127 val="$define"
7128 gnulibc_version=`$cat glibc.ver`
7129 echo "You are using the GNU C Library version $gnulibc_version"
7130else
7131 val="$undef"
7132 gnulibc_version=''
7133 echo "You are not using the GNU C Library"
7134fi
7135$rm -f try try.* glibc.ver
7136set d_gnulibc
7137eval $setvar
7138
7139: see if nm is to be used to determine whether a symbol is defined or not
7140case "$usenm" in
7141'')
7142 dflt=''
7143 case "$d_gnulibc" in
7144 "$define")
7145 echo " "
7146 echo "nm probably won't work on the GNU C Library." >&4
7147 dflt=n
7148 ;;
7149 esac
7150 case "$dflt" in
7151 '')
7152 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7153 echo " "
7154 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
7155 echo "'nm' won't be sufficient on this sytem." >&4
7156 dflt=n
7157 fi
7158 ;;
7159 esac
7160 case "$dflt" in
7161 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7162 if $test $dflt -gt 20; then
7163 dflt=y
7164 else
7165 dflt=n
7166 fi
7167 ;;
7168 esac
b4eb6b3d 7169 ;;
89ce900e
JH
7170*)
7171 case "$usenm" in
7172 true|$define) dflt=y;;
7173 *) dflt=n;;
7174 esac
b4eb6b3d
JH
7175 ;;
7176esac
89ce900e 7177$cat <<EOM
b4eb6b3d 7178
89ce900e
JH
7179I can use $nm to extract the symbols from your C libraries. This
7180is a time consuming task which may generate huge output on the disk (up
7181to 3 megabytes) but that should make the symbols extraction faster. The
7182alternative is to skip the 'nm' extraction part and to compile a small
7183test program instead to determine whether each symbol is present. If
7184you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7185this may be the best solution.
b4eb6b3d 7186
89ce900e 7187You probably shouldn't let me use 'nm' if you are using the GNU C Library.
b4eb6b3d 7188
89ce900e
JH
7189EOM
7190rp="Shall I use $nm to extract C symbols from the libraries?"
7191. ./myread
7192case "$ans" in
7193[Nn]*) usenm=false;;
7194*) usenm=true;;
b4eb6b3d 7195esac
89ce900e
JH
7196
7197runnm=$usenm
7198case "$reuseval" in
7199true) runnm=false;;
b4eb6b3d 7200esac
b4eb6b3d 7201
89ce900e
JH
7202: nm options which may be necessary
7203case "$nm_opt" in
7204'') if $test -f /mach_boot; then
7205 nm_opt='' # Mach
7206 elif $test -d /usr/ccs/lib; then
7207 nm_opt='-p' # Solaris (and SunOS?)
7208 elif $test -f /dgux; then
7209 nm_opt='-p' # DG-UX
7210 elif $test -f /lib64/rld; then
7211 nm_opt='-p' # 64-bit Irix
7212 else
7213 nm_opt=''
7214 fi;;
7215esac
b4eb6b3d 7216
89ce900e
JH
7217: nm options which may be necessary for shared libraries but illegal
7218: for archive libraries. Thank you, Linux.
7219case "$nm_so_opt" in
7220'') case "$myuname" in
fb2e1bc0 7221 *linux*|gnu*)
89ce900e
JH
7222 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7223 nm_so_opt='--dynamic'
7224 fi
7225 ;;
7226 esac
7227 ;;
7228esac
b4eb6b3d 7229
89ce900e
JH
7230case "$runnm" in
7231true)
7232: get list of predefined functions in a handy place
7233echo " "
7234case "$libc" in
7235'') libc=unknown
7236 case "$libs" in
7237 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7238 esac
7239 ;;
b4eb6b3d 7240esac
89ce900e
JH
7241case "$libs" in
7242'') ;;
7243*) for thislib in $libs; do
7244 case "$thislib" in
7245 -lc|-lc_s)
7246 : Handle C library specially below.
7247 ;;
7248 -l*)
7249 thislib=`echo $thislib | $sed -e 's/^-l//'`
7250 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7251 :
7252 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7253 :
7254 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7255 :
7256 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7257 :
7258 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7259 :
7260 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7261 :
7262 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7263 :
7264 else
7265 try=''
7266 fi
7267 libnames="$libnames $try"
7268 ;;
7269 *) libnames="$libnames $thislib" ;;
7270 esac
7271 done
b4eb6b3d
JH
7272 ;;
7273esac
89ce900e
JH
7274xxx=normal
7275case "$libc" in
7276unknown)
7277 set /lib/libc.$so
7278 for xxx in $libpth; do
7279 $test -r $1 || set $xxx/libc.$so
7280 : The messy sed command sorts on library version numbers.
7281 $test -r $1 || \
7282 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7283 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7284 h
7285 s/[0-9][0-9]*/0000&/g
7286 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7287 G
7288 s/\n/ /' | \
7289 $sort | $sed -e 's/^.* //'`
7290 eval set \$$#
7291 done
7292 $test -r $1 || set /usr/ccs/lib/libc.$so
7293 $test -r $1 || set /lib/libsys_s$_a
7294 ;;
7295*)
7296 set blurfl
7297 ;;
7298esac
7299if $test -r "$1"; then
7300 echo "Your (shared) C library seems to be in $1."
7301 libc="$1"
7302elif $test -r /lib/libc && $test -r /lib/clib; then
7303 echo "Your C library seems to be in both /lib/clib and /lib/libc."
7304 xxx=apollo
7305 libc='/lib/clib /lib/libc'
7306 if $test -r /lib/syslib; then
7307 echo "(Your math library is in /lib/syslib.)"
7308 libc="$libc /lib/syslib"
7309 fi
7310elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7311 echo "Your C library seems to be in $libc, as you said before."
7312elif $test -r $incpath/usr/lib/libc$_a; then
7313 libc=$incpath/usr/lib/libc$_a;
7314 echo "Your C library seems to be in $libc. That's fine."
7315elif $test -r /lib/libc$_a; then
7316 libc=/lib/libc$_a;
7317 echo "Your C library seems to be in $libc. You're normal."
7318else
7319 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7320 :
7321 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7322 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7323 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7324 :
7325 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7326 :
7327 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7328 :
7329 else
7330 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7331 fi
7332 if $test -r "$tans"; then
7333 echo "Your C library seems to be in $tans, of all places."
7334 libc=$tans
7335 else
7336 libc='blurfl'
7337 fi
7338fi
7339if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7340 dflt="$libc"
7341 cat <<EOM
b4eb6b3d 7342
89ce900e
JH
7343If the guess above is wrong (which it might be if you're using a strange
7344compiler, or your machine supports multiple models), you can override it here.
b4eb6b3d 7345
89ce900e
JH
7346EOM
7347else
7348 dflt=''
7349 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7350 cat >&4 <<EOM
7351I can't seem to find your C library. I've looked in the following places:
5e366f65 7352
b4eb6b3d 7353EOM
89ce900e
JH
7354 $sed 's/^/ /' libpath
7355 cat <<EOM
5e366f65 7356
89ce900e 7357None of these seems to contain your C library. I need to get its name...
5e366f65
JH
7358
7359EOM
89ce900e
JH
7360fi
7361fn=f
7362rp='Where is your C library?'
7363. ./getfile
7364libc="$ans"
5e366f65 7365
89ce900e
JH
7366echo " "
7367echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7368set X `cat libnames`
7369shift
7370xxx=files
7371case $# in 1) xxx=file; esac
7372echo "Extracting names from the following $xxx for later perusal:" >&4
7373echo " "
7374$sed 's/^/ /' libnames >&4
7375echo " "
7376$echo $n "This may take a while...$c" >&4
5e366f65 7377
89ce900e
JH
7378for file in $*; do
7379 case $file in
7380 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7381 *) $nm $nm_opt $file 2>/dev/null;;
b4eb6b3d 7382 esac
89ce900e
JH
7383done >libc.tmp
7384
7385$echo $n ".$c"
7386$grep fprintf libc.tmp > libc.ptf
7387xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7388xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7389xxx='[ADTSIW]'
ab900c53 7390if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *//p'";\
89ce900e
JH
7391 eval $xscan;\
7392 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7393 eval $xrun
7394elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7395 eval $xscan;\
7396 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7397 eval $xrun
7398elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7399 eval $xscan;\
7400 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7401 eval $xrun
7402elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7403 eval $xscan;\
7404 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7405 eval $xrun
7406elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7407 eval $xscan;\
7408 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7409 eval $xrun
7410elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7411 eval $xscan;\
7412 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7413 eval $xrun
7414elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7415 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
7416 eval $xscan;\
7417 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7418 eval $xrun
7419elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7420 eval $xscan;\
7421 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7422 eval $xrun
7423elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7424 eval $xscan;\
7425 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7426 eval $xrun
7427elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7428 eval $xscan;\
7429 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7430 eval $xrun
7431elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7432 eval $xscan;\
7433 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7434 eval $xrun
7435elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7436 eval $xscan;\
7437 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7438 eval $xrun
7439elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7440 eval $xscan;\
7441 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7442 eval $xrun
7443elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
7444 eval $xscan;\
7445 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7446 eval $xrun
b4eb6b3d 7447else
89ce900e
JH
7448 $nm -p $* 2>/dev/null >libc.tmp
7449 $grep fprintf libc.tmp > libc.ptf
7450 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7451 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7452 then
7453 nm_opt='-p'
7454 eval $xrun
7455 else
7456 echo " "
7457 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7458 com=''
7459 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7460 for thisname in $libnames $libc; do
7461 $ar t $thisname >>libc.tmp
7462 done
7463 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7464 echo "Ok." >&4
7465 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7466 # Repeat libc to extract forwarders to DLL entries too
7467 for thisname in $libnames $libc; do
7468 $ar tv $thisname >>libc.tmp
7469 # Revision 50 of EMX has bug in $ar.
7470 # it will not extract forwarders to DLL entries
7471 # Use emximp which will extract exactly them.
7472 emximp -o tmp.imp $thisname \
7473 2>/dev/null && \
7474 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7475 < tmp.imp >>libc.tmp
7476 $rm tmp.imp
7477 done
7478 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7479 echo "Ok." >&4
7480 else
7481 echo "$ar didn't seem to work right." >&4
7482 echo "Maybe this is a Cray...trying bld instead..." >&4
7483 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7484 then
7485 for thisname in $libnames; do
7486 bld t $libnames | \
7487 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7488 $ar t $thisname >>libc.tmp
7489 done
7490 echo "Ok." >&4
7491 else
7492 echo "That didn't work either. Giving up." >&4
7493 exit 1
7494 fi
7495 fi
7496 fi
b4eb6b3d 7497fi
89ce900e
JH
7498nm_extract="$com"
7499case "$PASE" in
7500define)
7501 echo " "
7502 echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7503 dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7504 ;;
7505*) if $test -f /lib/syscalls.exp; then
7506 echo " "
7507 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7508 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' /lib/syscalls.exp >>libc.list
7509 fi
7510 ;;
7511esac
7512;;
7513esac
7514$rm -f libnames libpath
b4eb6b3d
JH
7515
7516: see if dld is available
7517set dld.h i_dld
7518eval $inhdr
7519
89ce900e
JH
7520: is a C symbol defined?
7521csym='tlook=$1;
7522case "$3" in
373dfab3
JH
7523-v) tf=libc.tmp; tdc="";;
7524-a) tf=libc.tmp; tdc="[]";;
7525*) tlook="^$1\$"; tf=libc.list; tdc="()";;
89ce900e
JH
7526esac;
7527tx=yes;
7528case "$reuseval-$4" in
7529true-) ;;
7530true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7531esac;
7532case "$tx" in
7533yes)
ab900c53 7534 tval=false;
5129fff4
JH
7535 if $test "$runnm" = true; then
7536 if $contains $tlook $tf >/dev/null 2>&1; then
ab900c53 7537 tval=true;
5129fff4 7538 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
373dfab3 7539 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7540 $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
373dfab3
JH
7541 $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7542 $rm -f try$_exe try.c core core.* try.core;
89ce900e 7543 fi;
5129fff4 7544 else
373dfab3 7545 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7546 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
373dfab3 7547 $rm -f try$_exe try.c;
ab900c53
AB
7548 fi;
7549 ;;
89ce900e
JH
7550*)
7551 case "$tval" in
7552 $define) tval=true;;
7553 *) tval=false;;
ab900c53
AB
7554 esac;
7555 ;;
89ce900e
JH
7556esac;
7557eval "$2=$tval"'
7558
7559: define an is-in-libc? function
7560inlibc='echo " "; td=$define; tu=$undef;
7561sym=$1; var=$2; eval "was=\$$2";
7562tx=yes;
7563case "$reuseval$was" in
7564true) ;;
7565true*) tx=no;;
7566esac;
7567case "$tx" in
7568yes)
7569 set $sym tres -f;
7570 eval $csym;
7571 case "$tres" in
7572 true)
7573 echo "$sym() found." >&4;
7574 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7575 *)
7576 echo "$sym() NOT found." >&4;
7577 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7578 esac;;
7579*)
7580 case "$was" in
7581 $define) echo "$sym() found." >&4;;
7582 *) echo "$sym() NOT found." >&4;;
7583 esac;;
7584esac'
7585
b4eb6b3d
JH
7586: see if dlopen exists
7587xxx_runnm="$runnm"
7588runnm=false
7589set dlopen d_dlopen
7590eval $inlibc
7591runnm="$xxx_runnm"
7592
7593: determine which dynamic loading, if any, to compile in
7594echo " "
7595dldir="ext/DynaLoader"
7596case "$usedl" in
7597$define|y|true)
7598 dflt='y'
7599 usedl="$define"
7600 ;;
7601$undef|n|false)
7602 dflt='n'
7603 usedl="$undef"
7604 ;;
7605*)
7606 dflt='n'
7607 case "$d_dlopen" in
7608 $define) dflt='y' ;;
7609 esac
7610 case "$i_dld" in
7611 $define) dflt='y' ;;
7612 esac
7613 : Does a dl_xxx.xs file exist for this operating system
7614 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7615 ;;
7616esac
7617rp="Do you wish to use dynamic loading?"
7618. ./myread
7619usedl="$ans"
7620case "$ans" in
7621y*) usedl="$define"
7622 case "$dlsrc" in
7623 '')
7624 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7625 dflt="$dldir/dl_${osname}.xs"
7626 elif $test "$d_dlopen" = "$define" ; then
7627 dflt="$dldir/dl_dlopen.xs"
7628 elif $test "$i_dld" = "$define" ; then
7629 dflt="$dldir/dl_dld.xs"
7630 else
7631 dflt=''
7632 fi
7633 ;;
7634 *) dflt="$dldir/$dlsrc"
7635 ;;
7636 esac
7637 echo "The following dynamic loading files are available:"
7638 : Can not go over to $dldir because getfile has path hard-coded in.
6904989c 7639 tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
b4eb6b3d
JH
7640 rp="Source file to use for dynamic loading"
7641 fn="fne"
7642 gfpth="$src"
7643 . ./getfile
7644 usedl="$define"
7645 : emulate basename
7646 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7647
7648 $cat << EOM
7649
7650Some systems may require passing special flags to $cc -c to
7651compile modules that will be used to create a shared library.
7652To use no flags, say "none".
7653
7654EOM
7655 case "$cccdlflags" in
7656 '') case "$gccversion" in
7657 '') case "$osname" in
7658 hpux) dflt='+z' ;;
7659 next) dflt='none' ;;
7660 irix*) dflt='-KPIC' ;;
48bcfe03 7661 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
7662 sunos) dflt='-pic' ;;
7663 *) dflt='none' ;;
7664 esac
7665 ;;
7666 *) case "$osname" in
b6cc0f4c 7667 darwin) dflt='none' ;;
48bcfe03 7668 svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
7669 *) dflt='-fpic' ;;
7670 esac ;;
7671 esac ;;
7672 ' ') dflt='none' ;;
7673 *) dflt="$cccdlflags" ;;
7674 esac
7675 rp="Any special flags to pass to $cc -c to compile shared library modules?"
7676 . ./myread
7677 case "$ans" in
7678 none) cccdlflags=' ' ;;
7679 *) cccdlflags="$ans" ;;
7680 esac
7681
7682 cat << EOM
7683
7684Some systems use ld to create libraries that can be dynamically loaded,
7685while other systems (such as those using ELF) use $cc.
7686
7687EOM
7688 case "$ld" in
55954f19 7689 '') $cat >try.c <<EOM
b4eb6b3d
JH
7690/* Test for whether ELF binaries are produced */
7691#include <fcntl.h>
55954f19
JH
7692#$i_stdlib I_STDLIB
7693#ifdef I_STDLIB
b4eb6b3d 7694#include <stdlib.h>
55954f19 7695#endif
b4eb6b3d
JH
7696int main() {
7697 char b[4];
7698 int i = open("a.out",O_RDONLY);
7699 if(i == -1)
7700 exit(1); /* fail */
7701 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7702 exit(0); /* succeed (yes, it's ELF) */
7703 else
7704 exit(1); /* fail */
7705}
7706EOM
5440bc8e 7707 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
b4eb6b3d
JH
7708 cat <<EOM
7709You appear to have ELF support. I'll use $cc to build dynamic libraries.
7710EOM
7711 dflt="$cc"
7712 else
7713 echo "I'll use ld to build dynamic libraries."
7714 dflt='ld'
7715 fi
7716 rm -f try.c a.out
7717 ;;
7718 *) dflt="$ld"
7719 ;;
7720 esac
7721
7722 rp="What command should be used to create dynamic libraries?"
7723 . ./myread
7724 ld="$ans"
7725
7726 cat << EOM
7727
7728Some systems may require passing special flags to $ld to create a
7729library that can be dynamically loaded. If your ld flags include
7730-L/other/path options to locate libraries outside your loader's normal
7731search path, you may need to specify those -L options here as well. To
7732use no flags, say "none".
7733
7734EOM
7735 case "$lddlflags" in
7736 '') case "$osname" in
7737 beos) dflt='-nostart' ;;
7738 hpux) dflt='-b';
7739 case "$gccversion" in
7740 '') dflt="$dflt +vnocompatwarnings" ;;
7741 esac
7742 ;;
fb2e1bc0 7743 linux|irix*|gnu*) dflt='-shared' ;;
b4eb6b3d
JH
7744 next) dflt='none' ;;
7745 solaris) dflt='-G' ;;
7746 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 7747 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
7748 *) dflt='none' ;;
7749 esac
7750 ;;
7751 *) dflt="$lddlflags" ;;
7752 esac
7753
7754 : Try to guess additional flags to pick up local libraries.
7755 : Be careful not to append to a plain 'none'
7756 case "$dflt" in
7757 none) dflt='' ;;
7758 esac
7759 for thisflag in $ldflags; do
7760 case "$thisflag" in
b5b9f165 7761 -L*|-R*|-Wl,-R*)
b4eb6b3d
JH
7762 case " $dflt " in
7763 *" $thisflag "*) ;;
7764 *) dflt="$dflt $thisflag" ;;
7765 esac
7766 ;;
7767 esac
7768 done
7769
7770 case "$dflt" in
7771 ''|' ') dflt='none' ;;
7772 esac
7773
7774 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7775 . ./myread
7776 case "$ans" in
7777 none) lddlflags=' ' ;;
7778 *) lddlflags="$ans" ;;
7779 esac
7780
7781 cat <<EOM
7782
7783Some systems may require passing special flags to $cc to indicate that
7784the resulting executable will use dynamic linking. To use no flags,
7785say "none".
7786
7787EOM
7788 case "$ccdlflags" in
7789 '') case "$osname" in
fb2e1bc0 7790 linux|hpux|gnu*) dflt='-Wl,-E' ;;
91fc0aa5
AH
7791 next|sunos) dflt='none' ;;
7792 *) dflt='none' ;;
b4eb6b3d
JH
7793 esac ;;
7794 ' ') dflt='none' ;;
7795 *) dflt="$ccdlflags" ;;
7796 esac
7797 rp="Any special flags to pass to $cc to use dynamic linking?"
7798 . ./myread
7799 case "$ans" in
7800 none) ccdlflags=' ' ;;
7801 *) ccdlflags="$ans" ;;
7802 esac
7803 ;;
7804*) usedl="$undef"
7805 ld='ld'
7806 dlsrc='dl_none.xs'
7807 lddlflags=''
7808 ccdlflags=''
7809 ;;
7810esac
7811
7812also=''
7813case "$usedl" in
7814$undef)
7815 # No dynamic loading being used, so don't bother even to prompt.
7816 useshrplib='false'
7817 ;;
7818*) case "$useshrplib" in
7819 '') case "$osname" in
48bcfe03 7820 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
b4eb6b3d
JH
7821 dflt=y
7822 also='Building a shared libperl is required for dynamic loading to work on your system.'
7823 ;;
7824 next*)
7825 case "$osvers" in
7826 4*) dflt=y
7827 also='Building a shared libperl is needed for MAB support.'
7828 ;;
7829 *) dflt=n
7830 ;;
7831 esac
7832 ;;
7833 *) dflt=n
7834 ;;
7835 esac
7836 ;;
7837 $define|true|[Yy]*)
7838 dflt=y
7839 ;;
7840 *) dflt=n
7841 ;;
7842 esac
7843 $cat << EOM
7844
7845The perl executable is normally obtained by linking perlmain.c with
7846libperl${_a}, any static extensions (usually just DynaLoader), and
7847any other libraries needed on this system (such as -lm, etc.). Since
7848your system supports dynamic loading, it is probably possible to build
7849a shared libperl.$so. If you will have more than one executable linked
7850to libperl.$so, this will significantly reduce the size of each
5cadb3f3 7851executable, but it may have a noticeable effect on performance. The
b4eb6b3d
JH
7852default is probably sensible for your system.
7853$also
7854
7855EOM
7856 rp="Build a shared libperl.$so (y/n)"
7857 . ./myread
7858 case "$ans" in
7859 true|$define|[Yy]*)
7860 useshrplib='true' ;;
7861 *) useshrplib='false' ;;
7862 esac
7863 ;;
7864esac
7865
7866case "$useshrplib" in
7867true)
7868 case "$libperl" in
7869 '')
7870 # Figure out a good name for libperl.so. Since it gets stored in
7871 # a version-specific architecture-dependent library, the version
7872 # number isn't really that important, except for making cc/ld happy.
7873 #
7874 # A name such as libperl.so.3.1
7875 majmin="libperl.$so.$patchlevel.$subversion"
7876 # A name such as libperl.so.301
7877 majonly=`echo $patchlevel $subversion |
7878 $awk '{printf "%d%02d", $1, $2}'`
7879 majonly=libperl.$so.$majonly
7880 # I'd prefer to keep the os-specific stuff here to a minimum, and
7881 # rely on figuring it out from the naming of libc.
7882 case "${osname}${osvers}" in
7883 next4*)
7884 dflt=libperl.5.$so
7885 # XXX How handle the --version stuff for MAB?
7886 ;;
fb2e1bc0 7887 linux*|gnu*) # ld won't link with a bare -lperl otherwise.
b4eb6b3d
JH
7888 dflt=libperl.$so
7889 ;;
b53432e4
GH
7890 cygwin*) # ld links against an importlib
7891 dflt=libperl$lib_ext
b4eb6b3d
JH
7892 ;;
7893 *) # Try to guess based on whether libc has major.minor.
7894 case "$libc" in
7895 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7896 *libc.$so.[0-9]*) dflt=$majonly ;;
7897 *) dflt=libperl.$so ;;
7898 esac
7899 ;;
7900 esac
7901 ;;
7902 *) dflt=$libperl
7903 ;;
7904 esac
7905 cat << EOM
7906
7907I need to select a good name for the shared libperl. If your system uses
7908library names with major and minor numbers, then you might want something
7909like $majmin. Alternatively, if your system uses a single version
7910number for shared libraries, then you might want to use $majonly.
7911Or, your system might be quite happy with a simple libperl.$so.
7912
7913Since the shared libperl will get installed into a version-specific
7914architecture-dependent directory, the version number of the shared perl
7915library probably isn't important, so the default should be o.k.
7916
7917EOM
7918 rp='What name do you want to give to the shared libperl?'
7919 . ./myread
7920 libperl=$ans
7921 echo "Ok, I'll use $libperl"
7922 ;;
7923*)
7924 libperl="libperl${_a}"
7925 ;;
7926esac
7927
7928# Detect old use of shrpdir via undocumented Configure -Dshrpdir
7929case "$shrpdir" in
7930'') ;;
7931*) $cat >&4 <<EOM
7932WARNING: Use of the shrpdir variable for the installation location of
7933the shared $libperl is not supported. It was never documented and
7934will not work in this version. Let me (perlbug@perl.org)
7935know of any problems this may cause.
7936
7937EOM
7938 case "$shrpdir" in
7939 "$archlibexp/CORE")
7940 $cat >&4 <<EOM
7941But your current setting of $shrpdir is
7942the default anyway, so it's harmless.
7943EOM
7944 ;;
7945 *)
7946 $cat >&4 <<EOM
7947Further, your current attempted setting of $shrpdir
7948conflicts with the value of $archlibexp/CORE
7949that installperl will use.
7950EOM
7951 ;;
7952 esac
7953 ;;
7954esac
7955
7956# How will the perl executable find the installed shared $libperl?
7957# Add $xxx to ccdlflags.
7958# If we can't figure out a command-line option, use $shrpenv to
7959# set env LD_RUN_PATH. The main perl makefile uses this.
7960shrpdir=$archlibexp/CORE
7961xxx=''
7962tmp_shrpenv=''
7963if "$useshrplib"; then
7964 case "$osname" in
7965 aix)
7966 # We'll set it in Makefile.SH...
7967 ;;
b5b9f165 7968 solaris)
b4eb6b3d
JH
7969 xxx="-R $shrpdir"
7970 ;;
a774dfe6 7971 freebsd|netbsd|openbsd|interix|dragonfly)
b4eb6b3d
JH
7972 xxx="-Wl,-R$shrpdir"
7973 ;;
fb2e1bc0 7974 bsdos|linux|irix*|dec_osf|gnu*)
b4eb6b3d
JH
7975 xxx="-Wl,-rpath,$shrpdir"
7976 ;;
7977 next)
7978 # next doesn't like the default...
7979 ;;
7980 beos)
7981 # beos doesn't like the default, either.
7982 ;;
7983 hpux*)
7984 # hpux doesn't like the default, either.
7985 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7986 ;;
7987 *)
7988 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7989 ;;
7990 esac
7991 case "$xxx" in
7992 '') ;;
7993 *)
7994 # Only add $xxx if it isn't already in ccdlflags.
7995 case " $ccdlflags " in
7996 *" $xxx "*) ;;
7997 *) ccdlflags="$ccdlflags $xxx"
7998 cat <<EOM >&4
7999
8000Adding $xxx to the flags
8001passed to $ld so that the perl executable will find the
8002installed shared $libperl.
8003
8004EOM
8005 ;;
8006 esac
8007 ;;
8008 esac
8009fi
8010# Fix ccdlflags in AIX for building external extensions.
8011# (For building Perl itself bare -bE:perl.exp is needed,
8012# Makefile.SH takes care of this.)
8013case "$osname" in
8014aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8015esac
8016# Respect a hint or command-line value.
8017case "$shrpenv" in
8018'') shrpenv="$tmp_shrpenv" ;;
8019esac
8020case "$ldlibpthname" in
8021'') ldlibpthname=LD_LIBRARY_PATH ;;
8022none) ldlibpthname='' ;;
8023esac
8024
8025: determine where manual pages are on this system
8026echo " "
8027case "$sysman" in
8028'')
4a0a3829
SD
8029 syspath='/usr/share/man/man1 /usr/man/man1'
8030 syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8031 syspath="$syspath /usr/man/u_man/man1"
b4eb6b3d
JH
8032 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8033 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8034 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8035 sysman=`./loc . /usr/man/man1 $syspath`
8036 ;;
8037esac
8038if $test -d "$sysman"; then
8039 echo "System manual is in $sysman." >&4
8040else
8041 echo "Could not find manual pages in source form." >&4
8042fi
8043
8044: determine where manual pages go
8045set man1dir man1dir none
8046eval $prefixit
8047$cat <<EOM
8048
8049$spackage has manual pages available in source form.
8050EOM
8051case "$nroff" in
8052nroff)
8053 echo "However, you don't have nroff, so they're probably useless to you."
8054 case "$man1dir" in
8055 '') man1dir="none";;
8056 esac;;
8057esac
8058echo "If you don't want the manual sources installed, answer 'none'."
8059case "$man1dir" in
8060' ') dflt=none
8061 ;;
8062'')
4a0a3829
SD
8063 lookpath="$prefixexp/share/man/man1"
8064 lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
b4eb6b3d
JH
8065 lookpath="$lookpath $prefixexp/man/p_man/man1"
8066 lookpath="$lookpath $prefixexp/man/u_man/man1"
8067 lookpath="$lookpath $prefixexp/man/man.1"
8068 case "$sysman" in
8069 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8070 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8071 esac
8072 set dflt
8073 eval $prefixup
8074 ;;
8075*) dflt="$man1dir"
8076 ;;
8077esac
8078echo " "
8079fn=dn+~
8080rp="Where do the main $spackage manual pages (source) go?"
8081. ./getfile
8082if $test "X$man1direxp" != "X$ansexp"; then
8083 installman1dir=''
8084fi
79522dd2
NC
8085prefixvar=man1dir
8086. ./setprefixvar
8087
477140ee
NC
8088case "$man1dir" in
8089'') man1dir=' '
8090 installman1dir='';;
8091esac
b4eb6b3d
JH
8092
8093: What suffix to use on installed man pages
8094
8095case "$man1dir" in
8096' ')
8097 man1ext='0'
8098 ;;
8099*)
8100 rp="What suffix should be used for the main $spackage man pages?"
8101 case "$man1ext" in
8102 '') case "$man1dir" in
8103 *1) dflt=1 ;;
8104 *1p) dflt=1p ;;
8105 *1pm) dflt=1pm ;;
8106 *l) dflt=l;;
8107 *n) dflt=n;;
8108 *o) dflt=o;;
8109 *p) dflt=p;;
8110 *C) dflt=C;;
8111 *L) dflt=L;;
8112 *L1) dflt=L1;;
8113 *) dflt=1;;
8114 esac
8115 ;;
8116 *) dflt="$man1ext";;
8117 esac
8118 . ./myread
8119 man1ext="$ans"
8120 ;;
8121esac
8122
8123: see if we can have long filenames
8124echo " "
8125first=123456789abcdef
8126$rm -f $first
8127if (echo hi >$first) 2>/dev/null; then
8128 if $test -f 123456789abcde; then
8129 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
8130 val="$undef"
8131 else
8132 echo 'You can have filenames longer than 14 characters.'>&4
8133 val="$define"
8134 fi
8135else
8136 $cat <<'EOM'
8137You can't have filenames longer than 14 chars.
8138You can't even think about them!
8139EOM
8140 val="$undef"
8141fi
8142set d_flexfnam
8143eval $setvar
8144$rm -rf 123456789abcde*
8145
8146: determine where library module manual pages go
8147set man3dir man3dir none
8148eval $prefixit
8149$cat <<EOM
8150
8151$spackage has manual pages for many of the library modules.
8152EOM
8153
8154case "$nroff" in
8155nroff)
8156 $cat <<'EOM'
8157However, you don't have nroff, so they're probably useless to you.
8158EOM
8159 case "$man3dir" in
8160 '') man3dir="none";;
8161 esac;;
8162esac
8163
8164case "$d_flexfnam" in
8165undef)
8166 $cat <<'EOM'
f3f1a2d8 8167However, your system can't handle the long file names like File::Basename.3.
b4eb6b3d
JH
8168EOM
8169 case "$man3dir" in
8170 '') man3dir="none";;
8171 esac;;
8172esac
8173
8174echo "If you don't want the manual sources installed, answer 'none'."
8175prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8176case "$man3dir" in
8177'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8178 if $test -d "$privlib/man/man3"; then
8179 cat <<EOM >&4
8180
8181WARNING: Previous versions of perl installed man3 pages into
f3f1a2d8
MB
8182$privlib/man/man3. This version will suggest a
8183new default of $dflt.
b4eb6b3d
JH
8184EOM
8185 tdflt=$dflt
8186 dflt='n'
8187 rp='Do you wish to preserve the old behavior?(y/n)'
8188 . ./myread
8189 case "$ans" in
8190 y*) dflt="$privlib/man/man3" ;;
8191 *) dflt=$tdflt ;;
8192 esac
8193 fi
8194 ;;
8195*) dflt="$man3dir" ;;
8196esac
8197case "$dflt" in
8198' ') dflt=none ;;
8199esac
8200echo " "
8201fn=dn+~
8202rp="Where do the $package library man pages (source) go?"
8203. ./getfile
79522dd2
NC
8204prefixvar=man3dir
8205. ./setprefixvar
8206
477140ee
NC
8207case "$man3dir" in
8208'') man3dir=' '
8209 installman3dir='';;
8210esac
b4eb6b3d
JH
8211
8212: What suffix to use on installed man pages
8213case "$man3dir" in
8214' ')
8215 man3ext='0'
8216 ;;
8217*)
8218 rp="What suffix should be used for the $package library man pages?"
8219 case "$man3ext" in
8220 '') case "$man3dir" in
8221 *3) dflt=3 ;;
8222 *3p) dflt=3p ;;
8223 *3pm) dflt=3pm ;;
8224 *l) dflt=l;;
8225 *n) dflt=n;;
8226 *o) dflt=o;;
8227 *p) dflt=p;;
8228 *C) dflt=C;;
8229 *L) dflt=L;;
8230 *L3) dflt=L3;;
8231 *) dflt=3;;
8232 esac
8233 ;;
8234 *) dflt="$man3ext";;
8235 esac
8236 . ./myread
8237 man3ext="$ans"
8238 ;;
8239esac
8240
8241: see if we have to deal with yellow pages, now NIS.
0384a54a 8242if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
b4eb6b3d
JH
8243 if $test -f /usr/etc/nibindd; then
8244 echo " "
8245 echo "I'm fairly confident you're on a NeXT."
8246 echo " "
8247 rp='Do you get the hosts file via NetInfo?'
8248 dflt=y
8249 case "$hostcat" in
8250 nidump*) ;;
8251 '') ;;
8252 *) dflt=n;;
8253 esac
8254 . ./myread
8255 case "$ans" in
8256 y*) hostcat='nidump hosts .';;
8257 *) case "$hostcat" in
8258 nidump*) hostcat='';;
8259 esac
8260 ;;
8261 esac
8262 fi
8263 case "$hostcat" in
8264 nidump*) ;;
8265 *)
8266 case "$hostcat" in
8267 *ypcat*) dflt=y;;
8268 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8269 dflt=y
8270 else
8271 dflt=n
8272 fi;;
8273 *) dflt=n;;
8274 esac
8275 echo " "
8276 rp='Are you getting the hosts file via yellow pages?'
8277 . ./myread
8278 case "$ans" in
8279 y*) hostcat='ypcat hosts';;
8280 *) hostcat='cat /etc/hosts';;
8281 esac
8282 ;;
8283 esac
8284fi
8285case "$hostcat" in
8286'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8287esac
8288case "$groupcat" in
8289'') test -f /etc/group && groupcat='cat /etc/group';;
8290esac
8291case "$passcat" in
8292'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8293esac
8294
8295: now get the host name
8296echo " "
8297echo "Figuring out host name..." >&4
8298case "$myhostname" in
8299'') cont=true
8300 echo 'Maybe "hostname" will work...'
73614538 8301 if tans=`sh -c hostname 2>&1` ; then
b4eb6b3d
JH
8302 myhostname=$tans
8303 phostname=hostname
8304 cont=''
8305 fi
8306 ;;
8307*) cont='';;
8308esac
8309if $test "$cont"; then
8310 if ./xenix; then
8311 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
8312 if tans=`cat /etc/systemid 2>&1` ; then
8313 myhostname=$tans
8314 phostname='cat /etc/systemid'
8315 echo "Whadyaknow. Xenix always was a bit strange..."
8316 cont=''
8317 fi
8318 elif $test -r /etc/systemid; then
8319 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8320 fi
8321fi
8322if $test "$cont"; then
8323 echo 'No, maybe "uuname -l" will work...'
73614538 8324 if tans=`sh -c 'uuname -l' 2>&1` ; then
b4eb6b3d
JH
8325 myhostname=$tans
8326 phostname='uuname -l'
8327 else
8328 echo 'Strange. Maybe "uname -n" will work...'
73614538 8329 if tans=`sh -c 'uname -n' 2>&1` ; then
b4eb6b3d
JH
8330 myhostname=$tans
8331 phostname='uname -n'
8332 else
8333 echo 'Oh well, maybe I can mine it out of whoami.h...'
73614538 8334 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
b4eb6b3d
JH
8335 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8336 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8337 else
8338 case "$myhostname" in
8339 '') echo "Does this machine have an identity crisis or something?"
8340 phostname='';;
8341 *)
8342 echo "Well, you said $myhostname before..."
8343 phostname='echo $myhostname';;
8344 esac
8345 fi
8346 fi
8347 fi
8348fi
52a549d0
JH
8349case "$myhostname" in
8350'') myhostname=noname ;;
8351esac
b4eb6b3d
JH
8352: you do not want to know about this
8353set $myhostname
8354myhostname=$1
8355
8356: verify guess
8357if $test "$myhostname" ; then
8358 dflt=y
8359 rp='Your host name appears to be "'$myhostname'".'" Right?"
8360 . ./myread
8361 case "$ans" in
8362 y*) ;;
8363 *) myhostname='';;
8364 esac
8365fi
8366
8367: bad guess or no guess
8368while $test "X$myhostname" = X ; do
8369 dflt=''
8370 rp="Please type the (one word) name of your host:"
8371 . ./myread
8372 myhostname="$ans"
8373done
8374
8375: translate upper to lower if necessary
8376case "$myhostname" in
8377*[A-Z]*)
8378 echo "(Normalizing case in your host name)"
8379 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8380 ;;
8381esac
8382
8383case "$myhostname" in
8384*.*)
8385 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8386 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8387 echo "(Trimming domain name from host name--host name is now $myhostname)"
8388 ;;
8389*) case "$mydomain" in
8390 '')
8391 {
8392 test "X$hostcat" = "Xypcat hosts" &&
8393 ypmatch "$myhostname" hosts 2>/dev/null |\
8394 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
8395 $test -s hosts
8396 } || {
8397 test "X$hostcat" != "X" &&
8398 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
8399 /[ ]$myhostname[ . ]/p" > hosts
8400 }
8401 tmp_re="[ . ]"
f08cbdd1
PP
8402 if $test -f hosts; then
8403 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 8404 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
8405 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8406 hosts | $sort | $uniq | \
8407 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8408 case `$echo X$dflt` in
8409 X*\ *) echo "(Several hosts in the database matched hostname)"
8410 dflt=.
8411 ;;
8412 X.) echo "(You do not have fully-qualified names in the hosts database)"
8413 ;;
8414 esac
8415 else
8416 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 8417 dflt=.
f08cbdd1 8418 fi
b4eb6b3d
JH
8419 case "$dflt" in
8420 .)
8421 tans=`./loc resolv.conf X /etc /usr/etc`
8422 if $test -f "$tans"; then
8423 echo "(Attempting domain name extraction from $tans)"
8424 dflt=.`$sed -n -e 's/ / /g' \
8425 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
8426 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8427 case "$dflt" in
8428 .) dflt=.`$sed -n -e 's/ / /g' \
8429 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
8430 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8431 ;;
8432 esac
8433 fi
8434 ;;
8435 esac
8436 case "$dflt" in
8437 .) echo "(No help from resolv.conf either -- attempting clever guess)"
73614538 8438 dflt=.`sh -c domainname 2>/dev/null`
b4eb6b3d
JH
8439 case "$dflt" in
8440 '') dflt='.';;
8441 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8442 esac
8443 ;;
8444 esac
59c9e5d6
PP
8445 case "$dflt$osname" in
8446 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
caf85fe8 8447 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
59c9e5d6
PP
8448 ;;
8449 esac
b4eb6b3d
JH
8450 case "$dflt" in
8451 .) echo "(Lost all hope -- silly guess then)"
52a549d0 8452 dflt='.nonet'
b4eb6b3d
JH
8453 ;;
8454 esac
8455 $rm -f hosts
8456 ;;
8457 *) dflt="$mydomain";;
8458 esac;;
8459esac
8460echo " "
8461rp="What is your domain name?"
8462. ./myread
8463tans="$ans"
8464case "$ans" in
8465'') ;;
8466.*) ;;
8467*) tans=".$tans";;
8468esac
8469mydomain="$tans"
8470
8471: translate upper to lower if necessary
8472case "$mydomain" in
8473*[A-Z]*)
8474 echo "(Normalizing case in your domain name)"
8475 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8476 ;;
8477esac
8478
8479: a little sanity check here
8480case "$phostname" in
8481'') ;;
8482*)
8483 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8484 $myhostname$mydomain|$myhostname) ;;
8485 *)
8486 case "$phostname" in
8487 sed*)
8488 echo "(That doesn't agree with your whoami.h file, by the way.)"
8489 ;;
8490 *)
8491 echo "(That doesn't agree with your $phostname command, by the way.)"
8492 ;;
8493 esac
8494 ;;
8495 esac
8496 ;;
8497esac
8498
8499$cat <<EOM
8500
8501I need to get your e-mail address in Internet format if possible, i.e.
8502something like user@host.domain. Please answer accurately since I have
8503no easy means to double check it. The default value provided below
8504is most probably close to reality but may not be valid from outside
8505your organization...
8506
8507EOM
8508cont=x
8509while test "$cont"; do
8510 case "$cf_email" in
8511 '') dflt="$cf_by@$myhostname$mydomain";;
8512 *) dflt="$cf_email";;
8513 esac
8514 rp='What is your e-mail address?'
8515 . ./myread
8516 cf_email="$ans"
8517 case "$cf_email" in
8518 *@*.*) cont='' ;;
8519 *)
8520 rp='Address does not look like an Internet one. Use it anyway?'
8521 case "$fastread" in
8522 yes) dflt=y ;;
8523 *) dflt=n ;;
8524 esac
8525 . ./myread
8526 case "$ans" in
8527 y*) cont='' ;;
8528 *) echo " " ;;
8529 esac
8530 ;;
8531 esac
8532done
8533
8534$cat <<EOM
8535
8536If you or somebody else will be maintaining perl at your site, please
8537fill in the correct e-mail address here so that they may be contacted
8538if necessary. Currently, the "perlbug" program included with perl
8539will send mail to this address in addition to perlbug@perl.org. You may
8540enter "none" for no administrator.
8541
8542EOM
8543case "$perladmin" in
8544'') dflt="$cf_email";;
8545*) dflt="$perladmin";;
8546esac
8547rp='Perl administrator e-mail address'
8548. ./myread
8549perladmin="$ans"
8550
674912d7
RB
8551: determine whether to only install version-specific parts.
8552echo " "
8553$cat <<EOM
8554Do you want to install only the version-specific parts of the perl
8555distribution? Usually you do *not* want to do this.
8556EOM
8557case "$versiononly" in
8558"$define"|[Yy]*|true) dflt='y' ;;
8559*) dflt='n';
8560esac
8561rp="Do you want to install only the version-specific parts of perl?"
8562. ./myread
8563case "$ans" in
8564[yY]*) val="$define";;
8565*) val="$undef" ;;
8566esac
8567set versiononly
8568eval $setvar
8569
ad493445
MB
8570case "$versiononly" in
8571"$define") inc_version_list=''
8572 inc_version_list_init=0
8573 ;;
8574esac
8575
b4eb6b3d 8576: figure out how to guarantee perl startup
d0e36aa9 8577: XXX Note that this currently takes advantage of the bug that binexp ignores
a2d23ec2
MB
8578: the Configure -Dinstallprefix setting, which in turn means that under
8579: relocatable @INC, initialinstalllocation is what binexp started as.
b4eb6b3d
JH
8580case "$startperl" in
8581'')
8582 case "$sharpbang" in
8583 *!)
8584 $cat <<EOH
8585
8586I can use the #! construct to start perl on your system. This will
8587make startup of perl scripts faster, but may cause problems if you
8588want to share those scripts and perl is not in a standard place
a2d23ec2
MB
8589($initialinstalllocation/perl) on all your platforms. The alternative
8590is to force a shell by starting the script with a single ':' character.
b4eb6b3d
JH
8591
8592EOH
674912d7 8593 case "$versiononly" in
a2d23ec2 8594 "$define") dflt="$initialinstalllocation/perl$version";;
d0e36aa9 8595 *) dflt="$initialinstalllocation/perl";;
674912d7 8596 esac
b4eb6b3d
JH
8597 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8598 . ./myread
8599 case "$ans" in
8600 none) startperl=": # use perl";;
8601 *) startperl="#!$ans"
8602 if $test 30 -lt `echo "$ans" | wc -c`; then
8603 $cat >&4 <<EOM
8604
8605WARNING: Some systems limit the #! command to 32 characters.
8606If you experience difficulty running Perl scripts with #!, try
8607installing Perl in a directory with a shorter pathname.
8608
8609EOM
8610 fi ;;
8611 esac
8612 ;;
8613 *) startperl=": # use perl"
8614 ;;
8615 esac
8616 ;;
8617esac
8618echo "I'll use $startperl to start perl scripts."
8619
8620: figure best path for perl in scripts
8621case "$perlpath" in
8622'')
5e20a8ca 8623 case "$versiononly" in
d0e36aa9
NC
8624 "$define") perlpath="$initialinstalllocation/perl$version";;
8625 *) perlpath="$initialinstalllocation/perl";;
5e20a8ca 8626 esac
b4eb6b3d
JH
8627 case "$startperl" in
8628 *!*) ;;
8629 *)
8630 $cat <<EOH
8631
8632I will use the "eval 'exec'" idiom to start Perl on your system.
8633I can use the full path of your Perl binary for this purpose, but
8634doing so may cause problems if you want to share those scripts and
d0e36aa9 8635Perl is not always in a standard place ($initialinstalllocation/perl).
b4eb6b3d
JH
8636
8637EOH
d0e36aa9 8638 dflt="$initialinstalllocation/perl"
b4eb6b3d
JH
8639 rp="What path shall I use in \"eval 'exec'\"?"
8640 . ./myread
8641 perlpath="$ans"
8642 ;;
8643 esac
8644 ;;
8645esac
8646case "$startperl" in
8647*!*) ;;
8648*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8649esac
8650
8651: determine where public executable scripts go
8652set scriptdir scriptdir
8653eval $prefixit
8654case "$scriptdir" in
8655'')
8656 dflt="$bin"
8657 : guess some guesses
8658 $test -d /usr/share/scripts && dflt=/usr/share/scripts
8659 $test -d /usr/share/bin && dflt=/usr/share/bin
8660 $test -d /usr/local/script && dflt=/usr/local/script
8661 $test -d /usr/local/scripts && dflt=/usr/local/scripts
8662 $test -d $prefixexp/script && dflt=$prefixexp/script
8663 set dflt
8664 eval $prefixup
8665 ;;
8666*) dflt="$scriptdir"
8667 ;;
8668esac
8669$cat <<EOM
f3f1a2d8 8670
b4eb6b3d
JH
8671Some installations have a separate directory just for executable scripts so
8672that they can mount it across multiple architectures but keep the scripts in
8673one spot. You might, for example, have a subdirectory of /usr/share for this.
8674Or you might just lump your scripts in with all your other executables.
f3f1a2d8 8675
b4eb6b3d
JH
8676EOM
8677fn=d~
8678rp='Where do you keep publicly executable scripts?'
8679. ./getfile
8680if $test "X$ansexp" != "X$scriptdirexp"; then
8681 installscript=''
8682fi
f3f1a2d8 8683installscriptdir=''
79522dd2
NC
8684prefixvar=scriptdir
8685. ./setprefixvar
8686: A little fix up for an irregularly named variable.
8687installscript="$installscriptdir"
8688
b4eb6b3d
JH
8689: determine where add-on public executables go
8690case "$sitebin" in
8691'') dflt=$siteprefix/bin ;;
8692*) dflt=$sitebin ;;
8693esac
8694fn=d~
8695rp='Pathname where the add-on public executables should be installed?'
8696. ./getfile
79522dd2
NC
8697prefixvar=sitebin
8698. ./setprefixvar
b4eb6b3d 8699
6e1038e0 8700: determine where add-on html pages go
8d2cbf27 8701: There is no standard location, so try to copy the previously-selected
6e1038e0 8702: directory structure for the core html pages.
8d2cbf27
JH
8703case "$sitehtml1dir" in
8704'') dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8705*) dflt=$sitehtml1dir ;;
6e1038e0
MB
8706esac
8707case "$dflt" in
8708''|' ') dflt=none ;;
8709esac
8710fn=dn+~
8711rp='Pathname where the site-specific html pages should be installed?'
8712. ./getfile
79522dd2
NC
8713prefixvar=sitehtml1dir
8714. ./setprefixvar
6e1038e0
MB
8715
8716: determine where add-on library html pages go
8717: There is no standard location, so try to copy the previously-selected
8718: directory structure for the core html pages.
8d2cbf27
JH
8719case "$sitehtml3dir" in
8720'') dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8721*) dflt=$sitehtml3dir ;;
6e1038e0
MB
8722esac
8723case "$dflt" in
8724''|' ') dflt=none ;;
8725esac
8726fn=dn+~
8727rp='Pathname where the site-specific library html pages should be installed?'
8728. ./getfile
79522dd2
NC
8729prefixvar=sitehtml3dir
8730. ./setprefixvar
6e1038e0
MB
8731
8732: determine where add-on manual pages go
91e123a8
JH
8733case "$siteman1dir" in
8734'') dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
f3f1a2d8 8735*) dflt=$siteman1dir ;;
6e1038e0 8736esac
257059b5
JH
8737case "$dflt" in
8738''|' ') dflt=none ;;
8739esac
6e1038e0
MB
8740fn=dn+~
8741rp='Pathname where the site-specific manual pages should be installed?'
8742. ./getfile
79522dd2
NC
8743prefixvar=siteman1dir
8744. ./setprefixvar
6e1038e0
MB
8745
8746: determine where add-on library man pages go
91e123a8
JH
8747case "$siteman3dir" in
8748'') dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
f3f1a2d8 8749*) dflt=$siteman3dir ;;
6e1038e0 8750esac
257059b5
JH
8751case "$dflt" in
8752''|' ') dflt=none ;;
8753esac
6e1038e0
MB
8754fn=dn+~
8755rp='Pathname where the site-specific library manual pages should be installed?'
8756. ./getfile
79522dd2
NC
8757prefixvar=siteman3dir
8758. ./setprefixvar
6e1038e0
MB
8759
8760: determine where add-on public executable scripts go
8761case "$sitescript" in
8762'') dflt=$siteprefix/script
8763 $test -d $dflt || dflt=$sitebin ;;
8764*) dflt="$sitescript" ;;
8765esac
8766fn=d~+
8767rp='Pathname where add-on public executable scripts should be installed?'
8768. ./getfile
79522dd2
NC
8769prefixvar=sitescript
8770. ./setprefixvar
6e1038e0 8771
15b61c98
JH
8772case "$usefaststdio" in
8773$define|true|[yY]*|'')
8774 xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8775 case "$xversion" in
8776 [68]) dflt='y' ;;
8777 *) dflt='n' ;;
8778 esac
8779 ;;
8780*) dflt='n';;
8781esac
8782cat <<EOM
8783
8784Perl can be built to use 'fast stdio', which means using the stdio
8785library but also directly manipulating the stdio buffers to enable
8786faster I/O. Using stdio is better for backward compatibility (especially
8787for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8788interface has been preferred instead of stdio.
8789
8790If this doesn't make any sense to you, just accept the default '$dflt'.
8791EOM
8792rp='Use the "fast stdio" if available?'
8793. ./myread
8794case "$ans" in
8795y|Y) val="$define" ;;
8796*) val="$undef" ;;
8797esac
8798set usefaststdio
8799eval $setvar
8800
8801
96056487
JH
8802: define an is-a-typedef? function
8803typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8804case "$inclist" in
8805"") inclist="sys/types.h";;
8806esac;
8807eval "varval=\$$var";
8808case "$varval" in
8809"")
8810 $rm -f temp.c;
8811 for inc in $inclist; do
8812 echo "#include <$inc>" >>temp.c;
8813 done;
8814 echo "#ifdef $type" >> temp.c;
8815 echo "printf(\"We have $type\");" >> temp.c;
8816 echo "#endif" >> temp.c;
8817 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8818 if $contains $type temp.E >/dev/null 2>&1; then
8819 eval "$var=\$type";
8820 else
8821 eval "$var=\$def";
8822 fi;
8823 $rm -f temp.?;;
8824*) eval "$var=\$varval";;
8825esac'
8826
8827: define an is-a-typedef? function that prompts if the type is not available.
8828typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8829case "$inclist" in
8830"") inclist="sys/types.h";;
8831esac;
8832eval "varval=\$$var";
8833case "$varval" in
8834"")
8835 $rm -f temp.c;
8836 for inc in $inclist; do
8837 echo "#include <$inc>" >>temp.c;
8838 done;
8839 echo "#ifdef $type" >> temp.c;
8840 echo "printf(\"We have $type\");" >> temp.c;
8841 echo "#endif" >> temp.c;
8842 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8843 echo " " ;
8844 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8845 if $contains $type temp.E >/dev/null 2>&1; then
8846 echo "$type found." >&4;
8847 eval "$var=\$type";
8848 else
8849 echo "$type NOT found." >&4;
8850 dflt="$def";
8851 . ./myread ;
8852 eval "$var=\$ans";
8853 fi;
8854 $rm -f temp.?;;
8855*) eval "$var=\$varval";;
8856esac'
8857
8858: see what type lseek is declared as in the kernel
8859rp="What is the type used for lseek's offset on this system?"
8860set off_t lseektype long stdio.h sys/types.h
8861eval $typedef_ask
8862
8863echo " "
8864echo "Checking to see how big your file offsets are..." >&4
8865$cat >try.c <<EOCP
8866#include <sys/types.h>
8867#include <stdio.h>
8868int main()
8869{
8870 printf("%d\n", (int)sizeof($lseektype));
8871 return(0);
8872}
8873EOCP
8874set try
8875if eval $compile_ok; then
8876 lseeksize=`$run ./try`
8877 echo "Your file offsets are $lseeksize bytes long."
8878else
8879 dflt=$longsize
8880 echo " "
8881 echo "(I can't seem to compile the test program. Guessing...)"
8882 rp="What is the size of your file offsets (in bytes)?"
8883 . ./myread
8884 lseeksize="$ans"
8885fi
8886$rm -f try.c try
8887
8888: see what type file positions are declared as in the library
8889rp="What is the type for file position used by fsetpos()?"
8890set fpos_t fpostype long stdio.h sys/types.h
8891eval $typedef_ask
8892
8893echo " "
8894case "$fpostype" in
8895*_t) zzz="$fpostype" ;;
8896*) zzz="fpos_t" ;;
8897esac
8898echo "Checking the size of $zzz..." >&4
8899cat > try.c <<EOCP
8900#include <sys/types.h>
8901#include <stdio.h>
d1daaddf
JH
8902#$i_stdlib I_STDLIB
8903#ifdef I_STDLIB
8904#include <stdlib.h>
8905#endif
96056487
JH
8906int main() {
8907 printf("%d\n", (int)sizeof($fpostype));
8908 exit(0);
8909}
8910EOCP
8911set try
8912if eval $compile_ok; then
8913 yyy=`$run ./try`
8914 case "$yyy" in
8915 '') fpossize=4
8916 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8917 ;;
8918 *) fpossize=$yyy
8919 echo "Your $zzz is $fpossize bytes long."
8920 ;;
8921 esac
8922else
8923 dflt="$longsize"
8924 echo " " >&4
8925 echo "(I can't compile the test program. Guessing...)" >&4
8926 rp="What is the size of your file positions (in bytes)?"
8927 . ./myread
8928 fpossize="$ans"
8929fi
8930
96056487
JH
8931# Backward compatibility (uselfs is deprecated).
8932case "$uselfs" in
8933"$define"|true|[yY]*)
8934 cat <<EOM >&4
8935
8936*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8937EOM
8938 uselargefiles="$define"
8939 ;;
8940esac
8941
8942case "$lseeksize:$fpossize" in
89438:8) cat <<EOM
8944
8945You can have files larger than 2 gigabytes.
8946EOM
8947 val="$define" ;;
8948*) case "$uselargefiles" in
8949 "$undef"|false|[nN]*) dflt='n' ;;
8950 *) dflt='y' ;;
8951 esac
8952 cat <<EOM
8953
8954Perl can be built to understand large files (files larger than 2 gigabytes)
8955on some systems. To do so, Configure can be run with -Duselargefiles.
8956
8957If this doesn't make any sense to you, just accept the default '$dflt'.
8958EOM
8959 rp='Try to understand large files, if available?'
8960 . ./myread
8961 case "$ans" in
8962 y|Y) val="$define" ;;
8963 *) val="$undef" ;;
8964 esac
8965 ;;
8966esac
8967set uselargefiles
8968eval $setvar
96056487
JH
8969: Look for a hint-file generated 'call-back-unit'. If the
8970: user has specified that a large files perl is to be built,
8971: we may need to set or change some other defaults.
9da7673b
MB
8972if $test -f uselargefiles.cbu; then
8973 echo "Your platform has some specific hints regarding large file builds, using them..."
8974 . ./uselargefiles.cbu
8975fi
8976case "$uselargefiles" in
8977"$define")
96056487 8978 if $test -f uselargefiles.cbu; then
96056487
JH
8979 echo " "
8980 echo "Rechecking to see how big your file offsets are..." >&4
8981 $cat >try.c <<EOCP
8982#include <sys/types.h>
8983#include <stdio.h>
8984int main()
8985{
8986 printf("%d\n", (int)sizeof($lseektype));
8987 return(0);
8988}
8989EOCP
8990 set try
8991 if eval $compile_ok; then
8992 lseeksize=`$run ./try`
8993 $echo "Your file offsets are now $lseeksize bytes long."
8994 else
8995 dflt="$lseeksize"
8996 echo " "
8997 echo "(I can't seem to compile the test program. Guessing...)"
8998 rp="What is the size of your file offsets (in bytes)?"
8999 . ./myread
9000 lseeksize="$ans"
9001 fi
9002 case "$fpostype" in
9003 *_t) zzz="$fpostype" ;;
9004 *) zzz="fpos_t" ;;
9005 esac
9006 $echo $n "Rechecking the size of $zzz...$c" >&4
9007 $cat > try.c <<EOCP
9008#include <sys/types.h>
9009#include <stdio.h>
55954f19
JH
9010#$i_stdlib I_STDLIB
9011#ifdef I_STDLIB
9012#include <stdlib.h>
9013#endif
96056487
JH
9014int main() {
9015 printf("%d\n", (int)sizeof($fpostype));
073b6de5 9016 return(0);
96056487
JH
9017}
9018EOCP
9019 set try
9020 if eval $compile_ok; then
9021 yyy=`$run ./try`
9022 dflt="$lseeksize"
9023 case "$yyy" in
9024 '') echo " "
9025 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9026 ;;
9027 *) fpossize=$yyy
9028 echo " $fpossize bytes." >&4
9029 ;;
9030 esac
9031 else
9032 dflt="$fpossize"
9033 echo " "
9034 echo "(I can't compile the test program. Guessing...)" >&4
9035 rp="What is the size of your file positions (in bytes)?"
9036 . ./myread
9037 fpossize="$ans"
9038 fi
9039 $rm -f try.c try
9040 fi
9041 ;;
9042esac
9043
b4eb6b3d
JH
9044case "$vendorprefix" in
9045'') d_vendorbin="$undef"
9046 vendorbin=''
9047 vendorbinexp=''
9048 ;;
9049*) d_vendorbin="$define"
9050 : determine where vendor-supplied executables go.
9051 case "$vendorbin" in
9052 '') dflt=$vendorprefix/bin ;;
9053 *) dflt="$vendorbin" ;;
9054 esac
9055 fn=d~+
9056 rp='Pathname for the vendor-supplied executables directory?'
9057 . ./getfile
9058 vendorbin="$ans"
9059 vendorbinexp="$ansexp"
9060 ;;
9061esac
a092d240
NC
9062prefixvar=vendorbin
9063. ./installprefix
b4eb6b3d 9064
6e1038e0 9065case "$vendorprefix" in
8d2cbf27
JH
9066'') vendorhtml1dir=''
9067 vendorhtml1direxp=''
6e1038e0
MB
9068 ;;
9069*) : determine where vendor-supplied html pages go.
9070 : There is no standard location, so try to copy the previously-selected
9071 : directory structure for the core html pages.
9072 : XXX Better default suggestions would be welcome.
8d2cbf27 9073 case "$vendorhtml1dir" in
6e1038e0 9074 '') dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9075 *) dflt=$vendorhtml1dir ;;
6e1038e0
MB
9076 esac
9077 case "$dflt" in
9078 ''|' ') dflt=none ;;
9079 esac
9080 fn=dn+~
9081 rp='Pathname for the vendor-supplied html pages?'
9082 . ./getfile
8d2cbf27
JH
9083 vendorhtml1dir="$ans"
9084 vendorhtml1direxp="$ansexp"
6e1038e0
MB
9085 ;;
9086esac
9087: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9088$test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
a092d240
NC
9089prefixvar=vendorhtml1dir
9090. ./installprefix
6e1038e0
MB
9091
9092case "$vendorprefix" in
8d2cbf27
JH
9093'') vendorhtml3dir=''
9094 vendorhtml3direxp=''
6e1038e0
MB
9095 ;;
9096*) : determine where vendor-supplied module html pages go.
9097 : There is no standard location, so try to copy the previously-selected
9098 : directory structure for the core html pages.
9099 : XXX Better default suggestions would be welcome.
8d2cbf27 9100 case "$vendorhtml3dir" in
6e1038e0 9101 '') dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9102 *) dflt=$vendorhtml3dir ;;
6e1038e0
MB
9103 esac
9104 case "$dflt" in
9105 ''|' ') dflt=none ;;
9106 esac
9107 fn=dn+~
9108 rp='Pathname for the vendor-supplied html pages?'
9109 . ./getfile
8d2cbf27
JH
9110 vendorhtml3dir="$ans"
9111 vendorhtml3direxp="$ansexp"
6e1038e0
MB
9112 ;;
9113esac
9114: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9115$test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
a092d240
NC
9116prefixvar=vendorhtml3dir
9117. ./installprefix
6e1038e0
MB
9118
9119case "$vendorprefix" in
91e123a8
JH
9120'') vendorman1dir=''
9121 vendorman1direxp=''
6e1038e0
MB
9122 ;;
9123*) : determine where vendor-supplied manual pages go.
91e123a8 9124 case "$vendorman1dir" in
6e1038e0 9125 '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9126 *) dflt=$vendorman1dir ;;
6e1038e0
MB
9127 esac
9128 case "$dflt" in
9129 ''|' ') dflt=none ;;
9130 esac
9131 fn=nd~+
9132 rp='Pathname for the vendor-supplied manual section 1 pages?'
9133 . ./getfile
91e123a8
JH
9134 vendorman1dir="$ans"
9135 vendorman1direxp="$ansexp"
6e1038e0
MB
9136 ;;
9137esac
9138: Use ' ' for none so value is preserved next time through Configure
91e123a8 9139$test X"$vendorman1dir" = "X" && vendorman1dir=' '
a092d240
NC
9140prefixvar=vendorman1dir
9141. ./installprefix
6e1038e0
MB
9142
9143case "$vendorprefix" in
91e123a8
JH
9144'') vendorman3dir=''
9145 vendorman3direxp=''
6e1038e0
MB
9146 ;;
9147*) : determine where vendor-supplied module manual pages go.
91e123a8 9148 case "$vendorman3dir" in
6e1038e0 9149 '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9150 *) dflt=$vendorman3dir ;;
6e1038e0
MB
9151 esac
9152 case "$dflt" in
9153 ''|' ') dflt=none ;;
9154 esac
9155 fn=nd~+
9156 rp='Pathname for the vendor-supplied manual section 3 pages?'
9157 . ./getfile
91e123a8
JH
9158 vendorman3dir="$ans"
9159 vendorman3direxp="$ansexp"
6e1038e0
MB
9160 ;;
9161esac
9162: Use ' ' for none so value is preserved next time through Configure
91e123a8 9163$test X"$vendorman3dir" = "X" && vendorman3dir=' '
a092d240
NC
9164prefixvar=vendorman3dir
9165. ./installprefix
6e1038e0
MB
9166
9167case "$vendorprefix" in
9168'') d_vendorscript="$undef"
9169 vendorscript=''
9170 vendorscriptexp=''
9171 ;;
9172*) d_vendorscript="$define"
9173 : determine where vendor-supplied scripts go.
9174 case "$vendorscript" in
9175 '') dflt=$vendorprefix/script
9176 $test -d $dflt || dflt=$vendorbin ;;
9177 *) dflt="$vendorscript" ;;
9178 esac
9179 $cat <<EOM
9180
f3f1a2d8 9181The installation process will create a directory for
6e1038e0
MB
9182vendor-supplied scripts.
9183
9184EOM
9185 fn=d~+
9186 rp='Pathname for the vendor-supplied scripts directory?'
9187 . ./getfile
9188 vendorscript="$ans"
9189 vendorscriptexp="$ansexp"
9190 ;;
9191esac
a092d240
NC
9192prefixvar=vendorscript
9193. ./installprefix
6e1038e0 9194
b4eb6b3d
JH
9195: see if qgcvt exists
9196set qgcvt d_qgcvt
9197eval $inlibc
9198
89ce900e
JH
9199echo " "
9200
9201if $test X"$d_longdbl" = X"$define"; then
9202
9203echo "Checking how to print long doubles..." >&4
9204
9205if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9206 $cat >try.c <<'EOCP'
9207#include <sys/types.h>
9208#include <stdio.h>
9209int main() {
9210 double d = 123.456;
9211 printf("%.3f\n", d);
9212}
9213EOCP
9214 set try
9215 if eval $compile; then
9216 yyy=`$run ./try`
9217 case "$yyy" in
9218 123.456)
9219 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9220 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9221 echo "We will use %f."
9222 ;;
9223 esac
9224 fi
9225fi
9226
9227if $test X"$sPRIfldbl" = X; then
9228 $cat >try.c <<'EOCP'
9229#include <sys/types.h>
9230#include <stdio.h>
9231int main() {
9232 long double d = 123.456;
9233 printf("%.3Lf\n", d);
9234}
9235EOCP
9236 set try
9237 if eval $compile; then
9238 yyy=`$run ./try`
9239 case "$yyy" in
9240 123.456)
9241 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9242 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9243 echo "We will use %Lf."
9244 ;;
9245 esac
9246 fi
9247fi
9248
9249if $test X"$sPRIfldbl" = X; then
9250 $cat >try.c <<'EOCP'
9251#include <sys/types.h>
9252#include <stdio.h>
9253int main() {
9254 long double d = 123.456;
9255 printf("%.3llf\n", d);
9256}
9257EOCP
9258 set try
9259 if eval $compile; then
9260 yyy=`$run ./try`
9261 case "$yyy" in
9262 123.456)
9263 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9264 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9265 echo "We will use %llf."
9266 ;;
9267 esac
9268 fi
9269fi
9270
9271if $test X"$sPRIfldbl" = X; then
9272 $cat >try.c <<'EOCP'
9273#include <sys/types.h>
9274#include <stdio.h>
9275int main() {
9276 long double d = 123.456;
9277 printf("%.3lf\n", d);
9278}
9279EOCP
9280 set try
9281 if eval $compile; then
9282 yyy=`$run ./try`
9283 case "$yyy" in
9284 123.456)
9285 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9286 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9287 echo "We will use %lf."
9288 ;;
9289 esac
9290 fi
9291fi
9292
9293if $test X"$sPRIfldbl" = X; then
9294 echo "Cannot figure out how to print long doubles." >&4
9295else
9296 sSCNfldbl=$sPRIfldbl # expect consistency
9297fi
9298
9299$rm -f try try.*
9300
9301fi # d_longdbl
9302
9303case "$sPRIfldbl" in
9304'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9305 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9306 d_SCNfldbl="$undef";
9307 ;;
9308*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9309 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9310 d_SCNfldbl="$define";
9311 ;;
9312esac
9313
b4eb6b3d 9314: Check how to convert floats to strings.
a5b10d80
YST
9315
9316if test "X$d_Gconvert" = X; then
9317
b4eb6b3d
JH
9318echo " "
9319echo "Checking for an efficient way to convert floats to strings."
9320echo " " > try.c
9321case "$uselongdouble" in
9322"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9323esac
9324case "$d_longdbl" in
9325"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9326esac
9327case "$d_PRIgldbl" in
9328"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
9329esac
9330$cat >>try.c <<EOP
9331#ifdef TRY_gconvert
9332#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9333char *myname = "gconvert";
9334#endif
9335#ifdef TRY_gcvt
9336#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9337char *myname = "gcvt";
9338#endif
9339#ifdef TRY_qgcvt
9340#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9341char *myname = "qgcvt";
9342#define DOUBLETYPE long double
9343#endif
9344#ifdef TRY_sprintf
a5b10d80
YST
9345#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9346#ifdef HAS_PRIgldbl
b4eb6b3d
JH
9347#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9348#else
a5b10d80
YST
9349#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9350#endif
9351#else
b4eb6b3d
JH
9352#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9353#endif
9354char *myname = "sprintf";
9355#endif
9356
9357#ifndef DOUBLETYPE
9358#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9359#define DOUBLETYPE long double
9360#else
9361#define DOUBLETYPE double
9362#endif
9363#endif
9364
9365#include <stdio.h>
9366
9367#define I_STDLIB $i_stdlib
9368#ifdef I_STDLIB
9369#include <stdlib.h>
9370#endif
9371
9372int
9373checkit(expect, got)
9374char *expect;
9375char *got;
9376{
9377 if (strcmp(expect, got)) {
9378 printf("%s oddity: Expected %s, got %s\n",
9379 myname, expect, got);
9380 exit(1);
9381 }
9382}
9383
9384int main()
9385{
9386 char buf[64];
9387 buf[63] = '\0';
9388
9389 /* This must be 1st test on (which?) platform */
9390 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9391 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9392 checkit("0.1", buf);
9393
a5b10d80
YST
9394 Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9395 checkit("0.01", buf);
9396
9397 Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9398 checkit("0.001", buf);
9399
9400 Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9401 checkit("0.0001", buf);
9402
9403 Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9404 if (strlen(buf) > 5)
9405 checkit("9e-005", buf); /* for Microsoft ?? */
9406 else
9407 checkit("9e-05", buf);
9408
b4eb6b3d
JH
9409 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9410 checkit("1", buf);
9411
9412 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9413 checkit("1.1", buf);
9414
9415 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9416 checkit("1.01", buf);
9417
9418 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9419 checkit("1.001", buf);
9420
9421 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9422 checkit("1.0001", buf);
9423
9424 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9425 checkit("1.00001", buf);
9426
9427 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9428 checkit("1.000001", buf);
9429
9430 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9431 checkit("0", buf);
9432
9433 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9434 checkit("-1", buf);
9435
9436 /* Some Linux gcvt's give 1.e+5 here. */
9437 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9438 checkit("100000", buf);
9439
9440 /* Some Linux gcvt's give -1.e+5 here. */
9441 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9442 checkit("-100000", buf);
9443
9444 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9445 checkit("123.456", buf);
9446
ab6ca9f4 9447 /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
94b339ad
YST
9448 Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9449 /* 34 should be enough to scare even long double
9450 * places into using the e notation. */
ab6ca9f4 9451 if (strlen(buf) > 5)
94b339ad 9452 checkit("1e+034", buf); /* for Microsoft */
ab6ca9f4 9453 else
94b339ad 9454 checkit("1e+34", buf);
8e2a5ede 9455
d1eb8299
YST
9456 /* For Perl, if you add additional tests here, also add them to
9457 * t/base/num.t for benefit of platforms not using Configure or
9458 * overriding d_Gconvert */
9459
b4eb6b3d
JH
9460 exit(0);
9461}
9462EOP
ab6ca9f4 9463: first add preferred functions to our list
a5b10d80 9464xxx_list=""
ab6ca9f4 9465for xxx_convert in $gconvert_preference; do
a5b10d80
YST
9466 case $xxx_convert in
9467 gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
ab6ca9f4 9468 *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
a5b10d80
YST
9469 esac
9470done
9471: then add any others
9472for xxx_convert in gconvert gcvt sprintf; do
9473 case "$xxx_list" in
9474 *$xxx_convert*) ;;
9475 *) xxx_list="$xxx_list $xxx_convert" ;;
9476 esac
9477done
9478
9479case "$d_longdbl$uselongdouble" in
9480"$define$define")
9481 : again, add prefered functions to our list first
9482 xxx_ld_list=""
ab6ca9f4 9483 for xxx_convert in $gconvert_ld_preference; do
a5b10d80
YST
9484 case $xxx_convert in
9485 qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
ab6ca9f4 9486 *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
a5b10d80
YST
9487 esac
9488 done
9489 : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9490 for xxx_convert in qgcvt sprintf $xxx_list; do
9491 case "$xxx_ld_list" in
9492 $xxx_convert*|*" $xxx_convert"*) ;;
9493 *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9494 esac
9495 done
9496 : if sprintf cannot do long doubles, move it to the end
9497 if test "$d_PRIgldbl" != "$define"; then
9498 xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9499 fi
9500 : if no qgcvt, remove it
9501 if test "$d_qgcvt" != "$define"; then
9502 xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9503 fi
9504 : use the ld_list
9505 xxx_list="$xxx_ld_list"
b4eb6b3d
JH
9506 ;;
9507esac
9508
9509for xxx_convert in $xxx_list; do
9510 echo "Trying $xxx_convert..."
9511 $rm -f try try$_o
9512 set try -DTRY_$xxx_convert
9513 if eval $compile; then
9514 echo "$xxx_convert() found." >&4
5440bc8e 9515 if $run ./try; then
b4eb6b3d
JH
9516 echo "I'll use $xxx_convert to convert floats into a string." >&4
9517 break;
9518 else
9519 echo "...But $xxx_convert didn't work as I expected."
a5b10d80 9520 xxx_convert=''
b4eb6b3d
JH
9521 fi
9522 else
9523 echo "$xxx_convert NOT found." >&4
9524 fi
9525done
ab6ca9f4 9526
a5b10d80
YST
9527if test X$xxx_convert = X; then
9528 echo "*** WHOA THERE!!! ***" >&4
9529 echo "None of ($xxx_list) seemed to work properly. I'll use sprintf." >&4
9530 xxx_convert=sprintf
9531fi
9532
b4eb6b3d
JH
9533case "$xxx_convert" in
9534gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9535gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9536qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9537*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9538 "$define$define$define")
9539 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
a5b10d80
YST
9540 "$define$define$undef")
9541 d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
b4eb6b3d
JH
9542 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9543 esac
9544 ;;
9545esac
9546
a5b10d80
YST
9547fi
9548
74cac757
JH
9549: see if _fwalk exists
9550set fwalk d__fwalk
9551eval $inlibc
9552
b4eb6b3d
JH
9553: Initialize h_fcntl
9554h_fcntl=false
9555
9556: Initialize h_sysfile
9557h_sysfile=false
9558
9559: access call always available on UNIX
9560set access d_access
9561eval $inlibc
9562
9563: locate the flags for 'access()'
9564case "$d_access" in
9565"$define")
9566 echo " "
55954f19 9567 $cat >access.c <<EOCP
b4eb6b3d
JH
9568#include <sys/types.h>
9569#ifdef I_FCNTL
9570#include <fcntl.h>
9571#endif
9572#ifdef I_SYS_FILE
9573#include <sys/file.h>
9574#endif
9575#ifdef I_UNISTD
9576#include <unistd.h>
9577#endif
55954f19
JH
9578#$i_stdlib I_STDLIB
9579#ifdef I_STDLIB
9580#include <stdlib.h>
9581#endif
b4eb6b3d
JH
9582int main() {
9583 exit(R_OK);
9584}
9585EOCP
9586 : check sys/file.h first, no particular reason here
9587 if $test `./findhdr sys/file.h` && \
7a282f6d 9588 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9589 h_sysfile=true;
9590 echo "<sys/file.h> defines the *_OK access constants." >&4
9591 elif $test `./findhdr fcntl.h` && \
7a282f6d 9592 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9593 h_fcntl=true;
9594 echo "<fcntl.h> defines the *_OK access constants." >&4
9595 elif $test `./findhdr unistd.h` && \
7a282f6d 9596 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9597 echo "<unistd.h> defines the *_OK access constants." >&4
9598 else
9599 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9600 fi
9601 ;;
9602esac
9603$rm -f access*
9604
9605: see if accessx exists
9606set accessx d_accessx
9607eval $inlibc
9608
89ce900e
JH
9609: see if aintl exists
9610set aintl d_aintl
9611eval $inlibc
9612
b4eb6b3d
JH
9613: see if alarm exists
9614set alarm d_alarm
9615eval $inlibc
9616
a9dade78
JH
9617: see if POSIX threads are available
9618set pthread.h i_pthread
9619eval $inhdr
9620
10bc17b6
JH
9621: define a fucntion to check prototypes
9622$cat > protochk <<EOSH
9623$startsh
9624cc="$cc"
9625optimize="$optimize"
9626ccflags="$ccflags"
9627prototype="$prototype"
9628define="$define"
9629rm=$rm
a9dade78
JH
9630usethreads=$usethreads
9631i_pthread=$i_pthread
9632pthread_h_first=$pthread_h_first
10bc17b6
JH
9633EOSH
9634
9635$cat >> protochk <<'EOSH'
9636
9637$rm -f try.c
9638foo="$1"
9639shift
9640while test $# -ge 2; do
9641 case "$1" in
9642 $define) echo "#include <$2>" >> try.c ;;
9643 literal) echo "$2" >> try.c ;;
9644 esac
cce6a207
MB
9645 # Extra magic for the benefit of systems that need pthread.h
9646 # to be included early to correctly detect threadsafe functions.
9647 # Such functions must guarantee themselves, though, that the usethreads
9648 # and i_pthread have been defined, before calling protochk.
9649 if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9650 echo "#include <pthread.h>" >> try.c
9651 pthread_h_done=yes
9652 fi
10bc17b6
JH
9653 shift 2
9654done
9655test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
9656cat >> try.c <<'EOCP'
9657#ifdef CAN_PROTOTYPE
9658#define _(args) args
9659#else
9660#define _(args) ()
9661#endif
9662EOCP
9663echo "$foo" >> try.c
9664echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9665$cc $optimize $ccflags -c try.c > /dev/null 2>&1
9666status=$?
9667$rm -f try.[co]
9668exit $status
9669EOSH
9670chmod +x protochk
9671$eunicefix protochk
9672
89ce900e
JH
9673hasproto='varname=$1; func=$2; shift; shift;
9674while $test $# -ge 2; do
9675 case "$1" in
9676 $define) echo "#include <$2>";;
9677 esac ;
9678 shift 2;
9679done > try.c;
9680$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9681if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9682 echo "$func() prototype found.";
9683 val="$define";
9684else
9685 echo "$func() prototype NOT found.";
9686 val="$undef";
9687fi;
9688set $varname;
9689eval $setvar;
9690$rm -f try.c tryout.c'
9691
10bc17b6
JH
9692: see if sys/types.h has to be included
9693set sys/types.h i_systypes
9694eval $inhdr
9695
9696: see if sys/select.h has to be included
9697set sys/select.h i_sysselct
9698eval $inhdr
9699
9700hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9701while $test $# -ge 2; do
9702 case "$1" in
9703 $define) echo "#include <$2>";;
9704 esac ;
9705 shift 2;
9706done > try.c;
9707echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9708set try;
9709if eval $compile; then
9710 val="$define";
9711else
9712 val="$undef";
9713fi;
9714set $varname;
9715eval $setvar;
9716$rm -f try.c try.o'
9717
9718: see if we should include time.h, sys/time.h, or both
9719echo " "
9720if test "X$timeincl" = X; then
9721 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9722 $echo $n "I'm now running the test program...$c"
55954f19 9723 $cat >try.c <<EOCP
10bc17b6
JH
9724#include <sys/types.h>
9725#ifdef I_TIME
9726#include <time.h>
9727#endif
9728#ifdef I_SYSTIME
9729#ifdef SYSTIMEKERNEL
9730#define KERNEL
9731#endif
9732#include <sys/time.h>
9733#endif
9734#ifdef I_SYSSELECT
9735#include <sys/select.h>
9736#endif
55954f19
JH
9737#$i_stdlib I_STDLIB
9738#ifdef I_STDLIB
9739#include <stdlib.h>
9740#endif
10bc17b6
JH
9741int main()
9742{
9743 struct tm foo;
9744#ifdef S_TIMEVAL
9745 struct timeval bar;
9746#endif
9747#ifdef S_TIMEZONE
9748 struct timezone tzp;
9749#endif
9750 if (foo.tm_sec == foo.tm_sec)
9751 exit(0);
9752#ifdef S_TIMEVAL
9753 if (bar.tv_sec == bar.tv_sec)
9754 exit(0);
9755#endif
9756 exit(1);
9757}
9758EOCP
9759 flags=''
9760 for s_timezone in '-DS_TIMEZONE' ''; do
9761 sysselect=''
9762 for s_timeval in '-DS_TIMEVAL' ''; do
9763 for i_systimek in '' '-DSYSTIMEKERNEL'; do
9764 for i_time in '' '-DI_TIME'; do
9765 for i_systime in '-DI_SYSTIME' ''; do
9766 case "$flags" in
9767 '') $echo $n ".$c"
9768 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9769 if eval $compile; then
9770 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9771 shift
9772 flags="$*"
9773 echo " "
9774 $echo $n "Succeeded with $flags$c"
9775 fi
9776 ;;
9777 esac
9778 done
9779 done
9780 done
9781 done
9782 done
9783 timeincl=''
9784 echo " "
9785 case "$flags" in
9786 *SYSTIMEKERNEL*) i_systimek="$define"
9787 timeincl=`./findhdr sys/time.h`
9788 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9789 *) i_systimek="$undef";;
9790 esac
9791 case "$flags" in
9792 *I_TIME*) i_time="$define"
9793 timeincl=`./findhdr time.h`" $timeincl"
9794 echo "We'll include <time.h>." >&4;;
9795 *) i_time="$undef";;
9796 esac
9797 case "$flags" in
9798 *I_SYSTIME*) i_systime="$define"
9799 timeincl=`./findhdr sys/time.h`" $timeincl"
9800 echo "We'll include <sys/time.h>." >&4;;
9801 *) i_systime="$undef";;
9802 esac
9803 $rm -f try.c try
9804fi
9805: see if struct tm knows about tm_zone
9806case "$i_systime$i_time" in
9807*$define*)
9808 echo " "
9809 echo "Checking to see if your struct tm has tm_zone field..." >&4
9810 set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9811 eval $hasfield
9812 ;;
9813*) val="$undef"
9814 set d_tm_tm_zone
9815 eval $setvar
9816 ;;
9817esac
9818case "$d_tm_tm_zone" in
9819"$define") echo "Yes, it does." ;;
9820*) echo "No, it doesn't." ;;
9821esac
9822: see if struct tm knows about tm_gmtoff
9823case "$i_systime$i_time" in
9824*$define*)
9825 echo " "
9826 echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9827 set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9828 eval $hasfield
9829 ;;
9830*) val="$undef"
9831 set d_tm_tm_gmtoff
9832 eval $setvar
9833 ;;
9834esac
9835case "$d_tm_tm_gmtoff" in
9836"$define") echo "Yes, it does." ;;
9837*) echo "No, it doesn't." ;;
9838esac
9839
9840: see if asctime_r exists
9841set asctime_r d_asctime_r
9842eval $inlibc
9843case "$d_asctime_r" in
9844"$define")
d63eadf0 9845 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
9846 case "$d_asctime_r_proto:$usethreads" in
9847 ":define") d_asctime_r_proto=define
a48ec845
JH
9848 set d_asctime_r_proto asctime_r $hdrs
9849 eval $hasproto ;;
9850 *) ;;
9851 esac
9852 case "$d_asctime_r_proto" in
9853 define)
10bc17b6
JH
9854 case "$asctime_r_proto" in
9855 ''|0) try='char* asctime_r(const struct tm*, char*);'
9856 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9857 esac
9858 case "$asctime_r_proto" in
9859 ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9860 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9861 esac
9862 case "$asctime_r_proto" in
9863 ''|0) try='int asctime_r(const struct tm*, char*);'
9864 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9865 esac
9866 case "$asctime_r_proto" in
9867 ''|0) try='int asctime_r(const struct tm*, char*, int);'
9868 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9869 esac
9870 case "$asctime_r_proto" in
90e831dc 9871 ''|0) d_asctime_r=undef
10bc17b6 9872 asctime_r_proto=0
a48ec845 9873 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
9874 * ) case "$asctime_r_proto" in
9875 REENTRANT_PROTO*) ;;
9876 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9877 esac
9878 echo "Prototype: $try" ;;
9879 esac
9880 ;;
c18e646a
JH
9881 *) case "$usethreads" in
9882 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9883 esac
90e831dc
SB
9884 d_asctime_r=undef
9885 asctime_r_proto=0
c18e646a 9886 ;;
a48ec845
JH
9887 esac
9888 ;;
10bc17b6
JH
9889*) asctime_r_proto=0
9890 ;;
9891esac
9892
b4eb6b3d
JH
9893: see if atolf exists
9894set atolf d_atolf
9895eval $inlibc
9896
9897: see if atoll exists
9898set atoll d_atoll
9899eval $inlibc
9900
0dbb1585
AL
9901: Look for GCC-style attribute format
9902case "$d_attribute_format" in
bde30f85 9903'')
b4eb6b3d 9904echo " "
0dbb1585 9905echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
b4eb6b3d
JH
9906$cat >attrib.c <<'EOCP'
9907#include <stdio.h>
0dbb1585 9908void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
b4eb6b3d
JH
9909EOCP
9910if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9911 if $contains 'warning' attrib.out >/dev/null 2>&1; then
0dbb1585 9912 echo "Your C compiler doesn't support __attribute__((format))."
b4eb6b3d
JH
9913 val="$undef"
9914 else
0dbb1585 9915 echo "Your C compiler supports __attribute__((format))."
b4eb6b3d
JH
9916 val="$define"
9917 fi
9918else
9919 echo "Your C compiler doesn't seem to understand __attribute__ at all."
9920 val="$undef"
9921fi
bde30f85 9922;;
0dbb1585 9923*) val="$d_attribute_format" ;;
bde30f85 9924esac
0dbb1585
AL
9925set d_attribute_format
9926eval $setvar
9927$rm -f attrib*
9928
9929: Look for GCC-style attribute malloc
9930case "$d_attribute_malloc" in
9931'')
9932echo " "
9933echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
9934$cat >attrib.c <<'EOCP'
9935#include <stdio.h>
9936char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
9937EOCP
9938if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9939 if $contains 'warning' attrib.out >/dev/null 2>&1; then
9940 echo "Your C compiler doesn't support __attribute__((malloc))."
9941 val="$undef"
9942 else
9943 echo "Your C compiler supports __attribute__((malloc))."
9944 val="$define"
9945 fi
9946else
9947 echo "Your C compiler doesn't seem to understand __attribute__ at all."
9948 val="$undef"
9949fi
9950;;
9951*) val="$d_attribute_malloc" ;;
9952esac
9953set d_attribute_malloc
9954eval $setvar
9955$rm -f attrib*
9956
9957: Look for GCC-style attribute nonnull
9958case "$d_attribute_nonnull" in
9959'')
9960echo " "
9961echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
9962$cat >attrib.c <<'EOCP'
9963#include <stdio.h>
9964void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
9965EOCP
9966if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9967 if $contains 'warning' attrib.out >/dev/null 2>&1; then
9968 echo "Your C compiler doesn't support __attribute__((nonnull))."
9969 val="$undef"
9970 else
9971 echo "Your C compiler supports __attribute__((nonnull))."
9972 val="$define"
9973 fi
9974else
9975 echo "Your C compiler doesn't seem to understand __attribute__ at all."
9976 val="$undef"
9977fi
9978;;
9979*) val="$d_attribute_nonnull" ;;
9980esac
9981set d_attribute_nonnull
9982eval $setvar
9983$rm -f attrib*
9984
9985: Look for GCC-style attribute noreturn
9986case "$d_attribute_noreturn" in
9987'')
9988echo " "
9989echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
9990$cat >attrib.c <<'EOCP'
9991#include <stdio.h>
9992void fall_over_dead( void ) __attribute__((noreturn));
9993EOCP
9994if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9995 if $contains 'warning' attrib.out >/dev/null 2>&1; then
9996 echo "Your C compiler doesn't support __attribute__((noreturn))."
9997 val="$undef"
9998 else
9999 echo "Your C compiler supports __attribute__((noreturn))."
10000 val="$define"
10001 fi
10002else
10003 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10004 val="$undef"
10005fi
10006;;
10007*) val="$d_attribute_noreturn" ;;
10008esac
10009set d_attribute_noreturn
10010eval $setvar
10011$rm -f attrib*
10012
10013: Look for GCC-style attribute pure
10014case "$d_attribute_pure" in
10015'')
10016echo " "
10017echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10018$cat >attrib.c <<'EOCP'
10019#include <stdio.h>
10020int square( int n ) __attribute__((pure));
10021EOCP
10022if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10023 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10024 echo "Your C compiler doesn't support __attribute__((pure))."
10025 val="$undef"
10026 else
10027 echo "Your C compiler supports __attribute__((pure))."
10028 val="$define"
10029 fi
10030else
10031 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10032 val="$undef"
10033fi
10034;;
10035*) val="$d_attribute_pure" ;;
10036esac
10037set d_attribute_pure
10038eval $setvar
10039$rm -f attrib*
10040
10041: Look for GCC-style attribute unused
10042case "$d_attribute_unused" in
10043'')
10044echo " "
10045echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10046$cat >attrib.c <<'EOCP'
10047#include <stdio.h>
10048int do_something( int dummy __attribute__((unused)), int n );
10049EOCP
10050if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10051 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10052 echo "Your C compiler doesn't support __attribute__((unused))."
10053 val="$undef"
10054 else
10055 echo "Your C compiler supports __attribute__((unused))."
10056 val="$define"
10057 fi
10058else
10059 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10060 val="$undef"
10061fi
10062;;
10063*) val="$d_attribute_unused" ;;
10064esac
10065set d_attribute_unused
10066eval $setvar
10067$rm -f attrib*
10068
10069: Look for GCC-style attribute warn_unused_result
10070case "$d_attribute_warn_unused_result" in
10071'')
10072echo " "
10073echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10074$cat >attrib.c <<'EOCP'
10075#include <stdio.h>
10076int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10077EOCP
10078if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10079 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10080 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10081 val="$undef"
10082 else
10083 echo "Your C compiler supports __attribute__((warn_unused_result))."
10084 val="$define"
10085 fi
10086else
10087 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10088 val="$undef"
10089fi
10090;;
10091*) val="$d_attribute_warn_unused_result" ;;
10092esac
10093set d_attribute_warn_unused_result
b4eb6b3d
JH
10094eval $setvar
10095$rm -f attrib*
10096
10097: see if bcmp exists
10098set bcmp d_bcmp
10099eval $inlibc
10100
10101: see if bcopy exists
10102set bcopy d_bcopy
10103eval $inlibc
10104
10105: see if this is a unistd.h system
10106set unistd.h i_unistd
10107eval $inhdr
10108
10109: see if getpgrp exists
10110set getpgrp d_getpgrp
10111eval $inlibc
10112
10113case "$d_getpgrp" in
10114"$define")
10115 echo " "
10116 echo "Checking to see which flavor of getpgrp is in use..."
5440bc8e 10117 $cat >try.c <<EOP
b4eb6b3d
JH
10118#$i_unistd I_UNISTD
10119#include <sys/types.h>
10120#ifdef I_UNISTD
10121# include <unistd.h>
10122#endif
55954f19
JH
10123#$i_stdlib I_STDLIB
10124#ifdef I_STDLIB
10125#include <stdlib.h>
10126#endif
b4eb6b3d
JH
10127int main()
10128{
10129 if (getuid() == 0) {
10130 printf("(I see you are running Configure as super-user...)\n");
10131 setuid(1);
10132 }
10133#ifdef TRY_BSD_PGRP
10134 if (getpgrp(1) == 0)
10135 exit(0);
10136#else
10137 if (getpgrp() > 0)
10138 exit(0);
10139#endif
10140 exit(1);
10141}
10142EOP
5440bc8e 10143 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10144 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10145 val="$define"
5440bc8e 10146 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10147 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10148 val="$undef"
10149 else
10150 echo "I can't seem to compile and run the test program."
10151 if ./usg; then
10152 xxx="a USG one, i.e. you use getpgrp()."
10153 else
10154 # SVR4 systems can appear rather BSD-ish.
10155 case "$i_unistd" in
10156 $undef)
10157 xxx="a BSD one, i.e. you use getpgrp(pid)."
10158 val="$define"
10159 ;;
10160 $define)
10161 xxx="probably a USG one, i.e. you use getpgrp()."
10162 val="$undef"
10163 ;;
10164 esac
10165 fi
10166 echo "Assuming your getpgrp is $xxx" >&4
10167 fi
10168 ;;
10169*) val="$undef";;
10170esac
10171set d_bsdgetpgrp
10172eval $setvar
5440bc8e 10173$rm -f try try.*
b4eb6b3d
JH
10174
10175: see if setpgrp exists
10176set setpgrp d_setpgrp
10177eval $inlibc
10178
10179case "$d_setpgrp" in
10180"$define")
10181 echo " "
10182 echo "Checking to see which flavor of setpgrp is in use..."
5440bc8e 10183 $cat >try.c <<EOP
b4eb6b3d
JH
10184#$i_unistd I_UNISTD
10185#include <sys/types.h>
10186#ifdef I_UNISTD
10187# include <unistd.h>
10188#endif
55954f19
JH
10189#$i_stdlib I_STDLIB
10190#ifdef I_STDLIB
10191#include <stdlib.h>
10192#endif
b4eb6b3d
JH
10193int main()
10194{
10195 if (getuid() == 0) {
10196 printf("(I see you are running Configure as super-user...)\n");
10197 setuid(1);
10198 }
10199#ifdef TRY_BSD_PGRP
10200 if (-1 == setpgrp(1, 1))
10201 exit(0);
10202#else
10203 if (setpgrp() != -1)
10204 exit(0);
10205#endif
10206 exit(1);
10207}
10208EOP
5440bc8e 10209 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10210 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10211 val="$define"
5440bc8e 10212 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10213 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10214 val="$undef"
10215 else
10216 echo "(I can't seem to compile and run the test program.)"
10217 if ./usg; then
10218 xxx="a USG one, i.e. you use setpgrp()."
10219 else
10220 # SVR4 systems can appear rather BSD-ish.
10221 case "$i_unistd" in
10222 $undef)
10223 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10224 val="$define"
10225 ;;
10226 $define)
10227 xxx="probably a USG one, i.e. you use setpgrp()."
10228 val="$undef"
10229 ;;
10230 esac
10231 fi
10232 echo "Assuming your setpgrp is $xxx" >&4
10233 fi
10234 ;;
10235*) val="$undef";;
10236esac
10237set d_bsdsetpgrp
10238eval $setvar
5440bc8e 10239$rm -f try try.*
635aebb7
AL
10240: Look for GCC-style __builtin_choose_expr
10241case "$d_builtin_choose_expr" in
10242'')
10243 echo " "
10244 echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10245 $cat >try.c <<'EOCP'
10246#include <assert.h>
10247#include <stdlib.h>
10248#include <stdio.h>
10249
10250#define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10251
10252int main(void) {
10253 assert( SYRINX(1) == 2112 );
10254 assert( SYRINX(1) != 5150 );
10255 assert( SYRINX(0) == 5150 );
10256 assert( SYRINX(0) != 2112 );
10257 puts( "All good!" );
10258 exit(0);
10259}
10260
10261EOCP
10262 set try
10263 if eval $compile; then
10264 echo "Your C compiler supports __builtin_choose_expr."
10265 val="$define"
10266 else
10267 echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10268 val="$undef"
10269 fi
10270;;
10271*) val="$d_builtin_choose_expr" ;;
10272esac
10273
10274set d_builtin_choose_expr
10275eval $setvar
10276$rm -f try.* try core core.try.*
10277
10278: Look for GCC-style __builtin_expect
10279case "$d_builtin_expect" in
10280'')
10281 echo " "
10282 echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10283 $cat >builtin.c <<'EOCP'
10284int main(void) {
10285 int n = 50;
10286 if ( __builtin_expect(n, 0) ) n = 1;
10287}
10288EOCP
10289 set try
10290 if eval $compile; then
10291 echo "Your C compiler supports __builtin_choose_expr."
10292 val="$define"
10293 else
10294 echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10295 val="$undef"
10296 fi
10297 ;;
10298*) val="$d_builtin_expect" ;;
10299esac
10300
10301set d_builtin_expect
10302eval $setvar
10303$rm -f try.* try core core.try.*
10304
b4eb6b3d
JH
10305: see if bzero exists
10306set bzero d_bzero
10307eval $inlibc
10308
a2d23ec2
MB
10309: see if stdarg is available
10310echo " "
10311if $test `./findhdr stdarg.h`; then
10312 echo "<stdarg.h> found." >&4
10313 valstd="$define"
10314else
10315 echo "<stdarg.h> NOT found." >&4
10316 valstd="$undef"
10317fi
10318
10319: see if varags is available
10320echo " "
10321if $test `./findhdr varargs.h`; then
10322 echo "<varargs.h> found." >&4
10323else
10324 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10325fi
10326
10327: set up the varargs testing programs
10328$cat > varargs.c <<EOP
10329#ifdef I_STDARG
10330#include <stdarg.h>
10331#endif
10332#ifdef I_VARARGS
10333#include <varargs.h>
10334#endif
10335
10336#ifdef I_STDARG
10337int f(char *p, ...)
10338#else
10339int f(va_alist)
10340va_dcl
10341#endif
10342{
10343 va_list ap;
10344#ifndef I_STDARG
10345 char *p;
10346#endif
10347#ifdef I_STDARG
10348 va_start(ap,p);
10349#else
10350 va_start(ap);
10351 p = va_arg(ap, char *);
10352#endif
10353 va_end(ap);
10354}
10355EOP
10356$cat > varargs <<EOP
10357$startsh
10358if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10359 echo "true"
10360else
10361 echo "false"
10362fi
10363$rm -f varargs$_o
10364EOP
10365chmod +x varargs
10366
10367: now check which varargs header should be included
10368echo " "
10369i_varhdr=''
10370case "$valstd" in
10371"$define")
10372 if `./varargs I_STDARG`; then
10373 val='stdarg.h'
10374 elif `./varargs I_VARARGS`; then
10375 val='varargs.h'
10376 fi
10377 ;;
10378*)
10379 if `./varargs I_VARARGS`; then
10380 val='varargs.h'
10381 fi
10382 ;;
10383esac
10384case "$val" in
10385'')
10386echo "I could not find the definition for va_dcl... You have problems..." >&4
10387 val="$undef"; set i_stdarg; eval $setvar
10388 val="$undef"; set i_varargs; eval $setvar
10389 ;;
10390*)
10391 set i_varhdr
10392 eval $setvar
10393 case "$i_varhdr" in
10394 stdarg.h)
10395 val="$define"; set i_stdarg; eval $setvar
10396 val="$undef"; set i_varargs; eval $setvar
10397 ;;
10398 varargs.h)
10399 val="$undef"; set i_stdarg; eval $setvar
10400 val="$define"; set i_varargs; eval $setvar
10401 ;;
10402 esac
10403 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10404esac
10405$rm -f varargs*
10406
10407: see if the Compiler supports C99 variadic macros
10408case "$i_stdarg$i_stdlib" in
10409 "$define$define")
10410 echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10411 $cat >try.c <<EOCP
10412#include <stdio.h>
10413#include <stdarg.h>
10414
10415#define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10416
10417int main() {
10418 char buf[20];
10419 foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10420 puts(buf);
10421 return 0;
10422}
10423EOCP
10424 set try
10425 if eval $compile && $run ./try 2>&1 >/dev/null; then
10426 case "`$run ./try`" in
10427 "123 456 789")
10428 echo "You have C99 variadic macros." >&4
10429 d_c99_variadic_macros="$define"
10430 ;;
10431 *)
10432 echo "You don't have functional C99 variadic macros." >&4
10433 d_c99_variadic_macros="$undef"
10434 ;;
10435 esac
10436 else
10437 echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10438 d_c99_variadic_macros="$undef"
10439 fi
10440 $rm -f try.* try core core.try.*
10441 ;;
10442 *)
10443 echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10444 d_c99_variadic_macros="$undef"
10445 ;;
10446esac
10447
b4eb6b3d
JH
10448: see if signal is declared as pointer to function returning int or void
10449echo " "
10450xxx=`./findhdr signal.h`
10451$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10452if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10453 echo "You have int (*signal())() instead of void." >&4
10454 val="$undef"
10455elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10456 echo "You have void (*signal())()." >&4
10457 val="$define"
10458elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10459 echo "You have int (*signal())() instead of void." >&4
10460 val="$undef"
10461elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10462 echo "You have void (*signal())()." >&4
10463 val="$define"
10464else
10465 case "$d_voidsig" in
10466 '')
10467 echo "I can't determine whether signal handler returns void or int..." >&4
10468 dflt=void
10469 rp="What type does your signal handler return?"
10470 . ./myread
10471 case "$ans" in
10472 v*) val="$define";;
10473 *) val="$undef";;
10474 esac;;
10475 "$define")
10476 echo "As you already told me, signal handler returns void." >&4
10477 val="$define"
10478 ;;
10479 *) echo "As you already told me, signal handler returns int." >&4
10480 val="$undef"
10481 ;;
10482 esac
10483fi
10484set d_voidsig
10485eval $setvar
10486case "$d_voidsig" in
10487"$define") signal_t="void";;
10488*) signal_t="int";;
10489esac
10490$rm -f $$.tmp
10491
10492: check for ability to cast large floats to 32-bit ints.
10493echo " "
10494echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10495if $test "$intsize" -ge 4; then
10496 xxx=int
10497else
10498 xxx=long
10499fi
10500$cat >try.c <<EOCP
10501#include <stdio.h>
d1daaddf
JH
10502#$i_stdlib I_STDLIB
10503#ifdef I_STDLIB
10504#include <stdlib.h>
10505#endif
b4eb6b3d
JH
10506#include <sys/types.h>
10507#include <signal.h>
10508$signal_t blech(s) int s; { exit(3); }
10509int main()
10510{
10511 $xxx i32;
10512 double f, g;
10513 int result = 0;
10514 char str[16];
10515 signal(SIGFPE, blech);
10516
10517 /* Don't let compiler optimize the test away. Store the number
10518 in a writable string for gcc to pass to sscanf under HP/UX.
10519 */
10520 sprintf(str, "2147483647");
10521 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10522 g = 10 * f;
10523 i32 = ($xxx) g;
10524
10525 /* x86 processors will probably give 0x8000 0000, which is a
4a39fcde 10526 sign change. We don't want that. We want to mimic SPARC
b4eb6b3d
JH
10527 behavior here, which is to preserve the sign and give
10528 back 0x7fff ffff.
10529 */
10530 if (i32 != ($xxx) f)
10531 result |= 1;
10532 exit(result);
10533}
10534EOCP
10535set try
10536if eval $compile_ok; then
5440bc8e 10537 $run ./try
b4eb6b3d
JH
10538 yyy=$?
10539else
10540 echo "(I can't seem to compile the test program--assuming it can't)"
10541 yyy=1
10542fi
10543case "$yyy" in
105440) val="$define"
10545 echo "Yup, it can."
10546 ;;
10547*) val="$undef"
10548 echo "Nope, it can't."
10549 ;;
10550esac
10551set d_casti32
10552eval $setvar
10553$rm -f try try.*
10554
10555: check for ability to cast negative floats to unsigned
10556echo " "
10557echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10558$cat >try.c <<EOCP
10559#include <stdio.h>
d1daaddf
JH
10560#$i_stdlib I_STDLIB
10561#ifdef I_STDLIB
10562#include <stdlib.h>
10563#endif
b4eb6b3d
JH
10564#include <sys/types.h>
10565#include <signal.h>
10566$signal_t blech(s) int s; { exit(7); }
10567$signal_t blech_in_list(s) int s; { exit(4); }
10568unsigned long dummy_long(p) unsigned long p; { return p; }
10569unsigned int dummy_int(p) unsigned int p; { return p; }
10570unsigned short dummy_short(p) unsigned short p; { return p; }
10571int main()
10572{
10573 double f;
10574 unsigned long along;
10575 unsigned int aint;
10576 unsigned short ashort;
10577 int result = 0;
10578 char str[16];
10579
10580 /* Frustrate gcc-2.7.2's optimizer which failed this test with
10581 a direct f = -123. assignment. gcc-2.8.0 reportedly
10582 optimized the whole file away
10583 */
10584 /* Store the number in a writable string for gcc to pass to
10585 sscanf under HP/UX.
10586 */
10587 sprintf(str, "-123");
10588 sscanf(str, "%lf", &f); /* f = -123.; */
10589
10590 signal(SIGFPE, blech);
10591 along = (unsigned long)f;
10592 aint = (unsigned int)f;
10593 ashort = (unsigned short)f;
10594 if (along != (unsigned long)-123)
10595 result |= 1;
10596 if (aint != (unsigned int)-123)
10597 result |= 1;
10598 if (ashort != (unsigned short)-123)
10599 result |= 1;
10600 sprintf(str, "1073741824.");
10601 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10602 f = f + f;
10603 along = 0;
10604 along = (unsigned long)f;
10605 if (along != 0x80000000)
10606 result |= 2;
10607 f -= 1.;
10608 along = 0;
10609 along = (unsigned long)f;
10610 if (along != 0x7fffffff)
10611 result |= 1;
10612 f += 2.;
10613 along = 0;
10614 along = (unsigned long)f;
10615 if (along != 0x80000001)
10616 result |= 2;
10617 if (result)
10618 exit(result);
10619 signal(SIGFPE, blech_in_list);
10620 sprintf(str, "123.");
10621 sscanf(str, "%lf", &f); /* f = 123.; */
10622 along = dummy_long((unsigned long)f);
10623 aint = dummy_int((unsigned int)f);
10624 ashort = dummy_short((unsigned short)f);
10625 if (along != (unsigned long)123)
10626 result |= 4;
10627 if (aint != (unsigned int)123)
10628 result |= 4;
10629 if (ashort != (unsigned short)123)
10630 result |= 4;
10631 exit(result);
10632
10633}
10634EOCP
10635set try
10636if eval $compile_ok; then
5440bc8e 10637 $run ./try
b4eb6b3d
JH
10638 castflags=$?
10639else
10640 echo "(I can't seem to compile the test program--assuming it can't)"
10641 castflags=7
10642fi
10643case "$castflags" in
106440) val="$define"
10645 echo "Yup, it can."
10646 ;;
10647*) val="$undef"
10648 echo "Nope, it can't."
10649 ;;
10650esac
10651set d_castneg
10652eval $setvar
10653$rm -f try.*
10654
10655: see if vprintf exists
10656echo " "
10657if set vprintf val -f d_vprintf; eval $csym; $val; then
10658 echo 'vprintf() found.' >&4
10659 val="$define"
55954f19 10660 $cat >try.c <<EOF
b4eb6b3d 10661#include <varargs.h>
55954f19
JH
10662#$i_stdlib I_STDLIB
10663#ifdef I_STDLIB
10664#include <stdlib.h>
10665#endif
b4eb6b3d
JH
10666
10667int main() { xxx("foo"); }
10668
10669xxx(va_alist)
10670va_dcl
10671{
10672 va_list args;
10673 char buf[10];
10674
10675 va_start(args);
10676 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10677}
10678EOF
5440bc8e
JH
10679 set try
10680 if eval $compile && $run ./try; then
b4eb6b3d
JH
10681 echo "Your vsprintf() returns (int)." >&4
10682 val2="$undef"
10683 else
10684 echo "Your vsprintf() returns (char*)." >&4
10685 val2="$define"
10686 fi
10687else
10688 echo 'vprintf() NOT found.' >&4
10689 val="$undef"
10690 val2="$undef"
10691fi
5440bc8e 10692$rm -f try try.*
b4eb6b3d
JH
10693set d_vprintf
10694eval $setvar
10695val=$val2
10696set d_charvspr
10697eval $setvar
10698
10699: see if chown exists
10700set chown d_chown
10701eval $inlibc
10702
10703: see if chroot exists
10704set chroot d_chroot
10705eval $inlibc
10706
10707: see if chsize exists
10708set chsize d_chsize
10709eval $inlibc
10710
758a5d79
JH
10711: see if class exists
10712set class d_class
10713eval $inlibc
10714
b0a2e8e6
MB
10715: see if clearenv exists
10716set clearenv d_clearenv
10717eval $inlibc
10718
4e0554ec
JH
10719hasstruct='varname=$1; struct=$2; shift; shift;
10720while $test $# -ge 2; do
10721 case "$1" in
10722 $define) echo "#include <$2>";;
10723 esac ;
10724 shift 2;
10725done > try.c;
10726echo "int main () { struct $struct foo; }" >> try.c;
10727set try;
10728if eval $compile; then
10729 val="$define";
10730else
10731 val="$undef";
10732fi;
10733set $varname;
10734eval $setvar;
10735$rm -f try.c try.o'
10736
4e0554ec
JH
10737socketlib=''
10738sockethdr=''
10739: see whether socket exists
10740echo " "
10741$echo $n "Hmm... $c" >&4
10742if set socket val -f d_socket; eval $csym; $val; then
10743 echo "Looks like you have Berkeley networking support." >&4
10744 d_socket="$define"
10745 if set setsockopt val -f; eval $csym; $val; then
10746 d_oldsock="$undef"
10747 else
10748 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10749 d_oldsock="$define"
10750 fi
10751else
10752 if $contains socklib libc.list >/dev/null 2>&1; then
10753 echo "Looks like you have Berkeley networking support." >&4
10754 d_socket="$define"
10755 : we will have to assume that it supports the 4.2 BSD interface
10756 d_oldsock="$undef"
10757 else
10758 echo "You don't have Berkeley networking in libc$_a..." >&4
10759 if test "X$d_socket" = "X$define"; then
10760 echo "...but you seem to believe that you have sockets." >&4
10761 else
10762 for net in net socket
10763 do
10764 if test -f /usr/lib/lib$net$_a; then
10765 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
10766 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10767 if $contains socket libc.list >/dev/null 2>&1; then
10768 d_socket="$define"
10769 socketlib="-l$net"
10770 case "$net" in
10771 net)
10772 echo "...but the Wollongong group seems to have hacked it in." >&4
10773 sockethdr="-I/usr/netinclude"
10774 ;;
10775 esac
3c728e00 10776 echo "Found Berkeley sockets interface in lib$net." >&4
4e0554ec
JH
10777 if $contains setsockopt libc.list >/dev/null 2>&1; then
10778 d_oldsock="$undef"
10779 else
10780 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10781 d_oldsock="$define"
10782 fi
10783 break
10784 fi
10785 fi
10786 done
10787 if test "X$d_socket" != "X$define"; then
10788 echo "or anywhere else I see." >&4
10789 d_socket="$undef"
10790 d_oldsock="$undef"
10791 fi
10792 fi
10793 fi
10794fi
10795
10796: see if socketpair exists
10797set socketpair d_sockpair
10798eval $inlibc
10799
10800
10801echo " "
3c728e00 10802echo "Checking the availability of certain socket constants..." >&4
4e0554ec
JH
10803for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10804 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10805 $cat >try.c <<EOF
10806#include <sys/types.h>
10807#include <sys/socket.h>
10808int main() {
10809 int i = $ENUM;
10810}
10811EOF
10812 val="$undef"
10813 set try; if eval $compile; then
10814 val="$define"
10815 fi
10816 set d_${enum}; eval $setvar
10817 $rm -f try.c try
10818done
10819
10820: see if this is a sys/uio.h system
10821set sys/uio.h i_sysuio
10822eval $inhdr
10823
10824
10825echo " "
10826echo "Checking to see if your system supports struct cmsghdr..." >&4
10827set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10828eval $hasstruct
10829case "$d_cmsghdr_s" in
10830"$define") echo "Yes, it does." ;;
10831*) echo "No, it doesn't." ;;
10832esac
10833
10834
b4eb6b3d
JH
10835: check for const keyword
10836echo " "
10837echo 'Checking to see if your C compiler knows about "const"...' >&4
10838$cat >const.c <<'EOCP'
10839typedef struct spug { int drokk; } spug;
76f47787 10840int main()
b4eb6b3d
JH
10841{
10842 const char *foo;
10843 const spug y;
10844}
10845EOCP
10846if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10847 val="$define"
10848 echo "Yup, it does."
10849else
10850 val="$undef"
10851 echo "Nope, it doesn't."
10852fi
10853set d_const
10854eval $setvar
10855
89ce900e
JH
10856: see if copysignl exists
10857set copysignl d_copysignl
10858eval $inlibc
10859
b4eb6b3d
JH
10860: see if crypt exists
10861echo " "
a5a94ea5
JH
10862set crypt d_crypt
10863eval $inlibc
10864case "$d_crypt" in
10865$define) cryptlib='' ;;
10866*) if set crypt val -f d_crypt; eval $csym; $val; then
10867 echo 'crypt() found.' >&4
b4eb6b3d 10868 val="$define"
a5a94ea5
JH
10869 cryptlib=''
10870 else
10871 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10872 if $test -z "$cryptlib"; then
10873 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10874 else
10875 cryptlib=-lcrypt
10876 fi
10877 if $test -z "$cryptlib"; then
10878 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10879 else
10880 cryptlib=-lcrypt
10881 fi
10882 if $test -z "$cryptlib"; then
10883 cryptlib=`./loc libcrypt$_a "" $libpth`
10884 else
10885 cryptlib=-lcrypt
10886 fi
10887 if $test -z "$cryptlib"; then
10888 echo 'crypt() NOT found.' >&4
10889 val="$undef"
10890 else
10891 val="$define"
10892 fi
b4eb6b3d 10893 fi
a5a94ea5
JH
10894 set d_crypt
10895 eval $setvar
10896 ;;
10897esac
b4eb6b3d 10898
10bc17b6
JH
10899: see if this is a crypt.h system
10900set crypt.h i_crypt
10901eval $inhdr
10902
10903: see if crypt_r exists
10904set crypt_r d_crypt_r
10905eval $inlibc
10906case "$d_crypt_r" in
10907"$define")
10908 hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
c18e646a
JH
10909 case "$d_crypt_r_proto:$usethreads" in
10910 ":define") d_crypt_r_proto=define
a48ec845
JH
10911 set d_crypt_r_proto crypt_r $hdrs
10912 eval $hasproto ;;
10913 *) ;;
10914 esac
10915 case "$d_crypt_r_proto" in
10916 define)
10bc17b6
JH
10917 case "$crypt_r_proto" in
10918 ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10919 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10920 esac
10921 case "$crypt_r_proto" in
b430fd04
JH
10922 ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10923 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10924 esac
10925 case "$crypt_r_proto" in
90e831dc 10926 ''|0) d_crypt_r=undef
10bc17b6 10927 crypt_r_proto=0
a48ec845 10928 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10929 * ) case "$crypt_r_proto" in
10930 REENTRANT_PROTO*) ;;
10931 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10932 esac
10933 echo "Prototype: $try" ;;
10934 esac
10935 ;;
c18e646a
JH
10936 *) case "$usethreads" in
10937 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10938 esac
90e831dc
SB
10939 d_crypt_r=undef
10940 crypt_r_proto=0
c18e646a 10941 ;;
a48ec845
JH
10942 esac
10943 ;;
10bc17b6
JH
10944*) crypt_r_proto=0
10945 ;;
10946esac
10947
b4eb6b3d
JH
10948: get csh whereabouts
10949case "$csh" in
10950'csh') val="$undef" ;;
10951*) val="$define" ;;
10952esac
10953set d_csh
10954eval $setvar
10955: Respect a hint or command line value for full_csh.
10956case "$full_csh" in
10957'') full_csh=$csh ;;
10958esac
10959
10bc17b6
JH
10960: see if ctermid_r exists
10961set ctermid_r d_ctermid_r
10962eval $inlibc
10963case "$d_ctermid_r" in
10964"$define")
31ee0cb7 10965 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
10966 case "$d_ctermid_r_proto:$usethreads" in
10967 ":define") d_ctermid_r_proto=define
a48ec845
JH
10968 set d_ctermid_r_proto ctermid_r $hdrs
10969 eval $hasproto ;;
10970 *) ;;
10971 esac
10972 case "$d_ctermid_r_proto" in
10973 define)
10bc17b6
JH
10974 case "$ctermid_r_proto" in
10975 ''|0) try='char* ctermid_r(char*);'
10976 ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10977 esac
10978 case "$ctermid_r_proto" in
90e831dc 10979 ''|0) d_ctermid_r=undef
10bc17b6 10980 ctermid_r_proto=0
a48ec845 10981 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10982 * ) case "$ctermid_r_proto" in
10983 REENTRANT_PROTO*) ;;
10984 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10985 esac
10986 echo "Prototype: $try" ;;
10987 esac
10988 ;;
c18e646a
JH
10989 *) case "$usethreads" in
10990 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10991 esac
90e831dc
SB
10992 d_ctermid_r=undef
10993 ctermid_r_proto=0
c18e646a 10994 ;;
a48ec845
JH
10995 esac
10996 ;;
10bc17b6
JH
10997*) ctermid_r_proto=0
10998 ;;
10999esac
11000
11001: see if ctime_r exists
11002set ctime_r d_ctime_r
11003eval $inlibc
11004case "$d_ctime_r" in
11005"$define")
d63eadf0 11006 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
11007 case "$d_ctime_r_proto:$usethreads" in
11008 ":define") d_ctime_r_proto=define
a48ec845
JH
11009 set d_ctime_r_proto ctime_r $hdrs
11010 eval $hasproto ;;
11011 *) ;;
11012 esac
11013 case "$d_ctime_r_proto" in
11014 define)
10bc17b6
JH
11015 case "$ctime_r_proto" in
11016 ''|0) try='char* ctime_r(const time_t*, char*);'
11017 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11018 esac
11019 case "$ctime_r_proto" in
11020 ''|0) try='char* ctime_r(const time_t*, char*, int);'
11021 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11022 esac
11023 case "$ctime_r_proto" in
11024 ''|0) try='int ctime_r(const time_t*, char*);'
11025 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11026 esac
11027 case "$ctime_r_proto" in
11028 ''|0) try='int ctime_r(const time_t*, char*, int);'
11029 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11030 esac
11031 case "$ctime_r_proto" in
90e831dc 11032 ''|0) d_ctime_r=undef
10bc17b6 11033 ctime_r_proto=0
a48ec845 11034 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11035 * ) case "$ctime_r_proto" in
11036 REENTRANT_PROTO*) ;;
11037 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11038 esac
11039 echo "Prototype: $try" ;;
11040 esac
11041 ;;
c18e646a
JH
11042 *) case "$usethreads" in
11043 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11044 esac
90e831dc
SB
11045 d_ctime_r=undef
11046 ctime_r_proto=0
c18e646a 11047 ;;
a48ec845
JH
11048 esac
11049 ;;
10bc17b6
JH
11050*) ctime_r_proto=0
11051 ;;
11052esac
11053
b4eb6b3d
JH
11054: see if cuserid exists
11055set cuserid d_cuserid
11056eval $inlibc
11057
11058: see if this is a limits.h system
11059set limits.h i_limits
11060eval $inhdr
11061
11062: see if this is a float.h system
11063set float.h i_float
11064eval $inhdr
11065
11066: See if number of significant digits in a double precision number is known
11067echo " "
11068$cat >dbl_dig.c <<EOM
11069#$i_limits I_LIMITS
11070#$i_float I_FLOAT
11071#ifdef I_LIMITS
11072#include <limits.h>
11073#endif
11074#ifdef I_FLOAT
11075#include <float.h>
11076#endif
11077#ifdef DBL_DIG
11078printf("Contains DBL_DIG");
11079#endif
11080EOM
11081$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11082if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11083 echo "DBL_DIG found." >&4
11084 val="$define"
11085else
11086 echo "DBL_DIG NOT found." >&4
11087 val="$undef"
11088fi
11089$rm -f dbl_dig.?
11090set d_dbl_dig
11091eval $setvar
11092
2ef53570
JH
11093: see if dbm.h is available
11094: see if dbmclose exists
11095set dbmclose d_dbmclose
11096eval $inlibc
11097
11098case "$d_dbmclose" in
11099$define)
11100 set dbm.h i_dbm
11101 eval $inhdr
11102 case "$i_dbm" in
11103 $define)
11104 val="$undef"
11105 set i_rpcsvcdbm
11106 eval $setvar
11107 ;;
11108 *) set rpcsvc/dbm.h i_rpcsvcdbm
11109 eval $inhdr
11110 ;;
11111 esac
11112 ;;
11113*) echo "We won't be including <dbm.h>"
11114 val="$undef"
11115 set i_dbm
11116 eval $setvar
11117 val="$undef"
11118 set i_rpcsvcdbm
11119 eval $setvar
11120 ;;
11121esac
11122
11123: see if prototype for dbminit is available
11124echo " "
11125set d_dbminitproto dbminit $i_dbm dbm.h
11126eval $hasproto
11127
b4eb6b3d
JH
11128: see if difftime exists
11129set difftime d_difftime
11130eval $inlibc
11131
11132: see if this is a dirent system
11133echo " "
11134if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11135 val="$define"
11136 echo "<dirent.h> found." >&4
11137else
11138 val="$undef"
11139 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11140 echo "<sys/dir.h> found." >&4
11141 echo " "
11142 else
11143 xinc=`./findhdr sys/ndir.h`
11144 fi
11145 echo "<dirent.h> NOT found." >&4
11146fi
11147set i_dirent
11148eval $setvar
11149
11150: Look for type of directory structure.
11151echo " "
11152$cppstdin $cppflags $cppminus < "$xinc" > try.c
11153
11154case "$direntrytype" in
11155''|' ')
11156 case "$i_dirent" in
11157 $define) guess1='struct dirent' ;;
11158 *) guess1='struct direct' ;;
11159 esac
11160 ;;
11161*) guess1="$direntrytype"
11162 ;;
11163esac
11164
11165case "$guess1" in
11166'struct dirent') guess2='struct direct' ;;
11167*) guess2='struct dirent' ;;
11168esac
11169
11170if $contains "$guess1" try.c >/dev/null 2>&1; then
11171 direntrytype="$guess1"
11172 echo "Your directory entries are $direntrytype." >&4
11173elif $contains "$guess2" try.c >/dev/null 2>&1; then
11174 direntrytype="$guess2"
11175 echo "Your directory entries seem to be $direntrytype." >&4
11176else
11177 echo "I don't recognize your system's directory entries." >&4
11178 rp="What type is used for directory entries on this system?"
11179 dflt="$guess1"
11180 . ./myread
11181 direntrytype="$ans"
11182fi
11183$rm -f try.c
11184
11185
11186: see if the directory entry stores field length
11187echo " "
11188$cppstdin $cppflags $cppminus < "$xinc" > try.c
11189if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11190 echo "Good, your directory entry keeps length information in d_namlen." >&4
11191 val="$define"
11192else
11193 echo "Your directory entry does not know about the d_namlen field." >&4
11194 val="$undef"
11195fi
11196set d_dirnamlen
11197eval $setvar
11198$rm -f try.c
11199
ae0e3d3b
JH
11200: see if this is an sysdir system
11201set sys/dir.h i_sysdir
11202eval $inhdr
11203
11204: see if this is an sysndir system
11205set sys/ndir.h i_sysndir
11206eval $inhdr
11207
11208: Look for dirfd
11209echo " "
11210$cat >dirfd.c <<EOM
11211#include <stdio.h>
55954f19
JH
11212#$i_stdlib I_STDLIB
11213#ifdef I_STDLIB
11214#include <stdlib.h>
11215#endif
ae0e3d3b
JH
11216#$i_dirent I_DIRENT /**/
11217#$i_sysdir I_SYS_DIR /**/
11218#$i_sysndir I_SYS_NDIR /**/
11219#$i_systypes I_SYS_TYPES /**/
11220#if defined(I_SYS_TYPES)
11221#include <sys/types.h>
11222#endif
11223#if defined(I_DIRENT)
11224#include <dirent.h>
11225#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11226#include <sys/dir.h>
11227#endif
11228#else
11229#ifdef I_SYS_NDIR
11230#include <sys/ndir.h>
11231#else
11232#ifdef I_SYS_DIR
11233#ifdef hp9000s500
11234#include <ndir.h> /* may be wrong in the future */
11235#else
11236#include <sys/dir.h>
11237#endif
11238#endif
11239#endif
11240#endif
11241int main() {
11242 DIR *dirp = opendir(".");
11243 if (dirfd(dirp) >= 0)
11244 exit(0);
11245 else
11246 exit(1);
11247}
11248EOM
5cadb3f3 11249val=$undef
ae0e3d3b
JH
11250set dirfd
11251if eval $compile; then
11252 val="$define"
11253fi
11254case "$val" in
11255$define) echo "dirfd() found." >&4 ;;
11256*) echo "dirfd() NOT found." >&4 ;;
11257esac
11258set d_dirfd
11259eval $setvar
11260$rm -f dirfd*
11261
b4eb6b3d
JH
11262: see if dlerror exists
11263xxx_runnm="$runnm"
11264runnm=false
11265set dlerror d_dlerror
11266eval $inlibc
11267runnm="$xxx_runnm"
11268
11269: see if dlfcn is available
11270set dlfcn.h i_dlfcn
11271eval $inhdr
11272
11273case "$usedl" in
11274$define|y|true)
11275 $cat << EOM
11276
11277On a few systems, the dynamically loaded modules that perl generates and uses
11278will need a different extension than shared libs. The default will probably
11279be appropriate.
11280
11281EOM
11282 case "$dlext" in
11283 '') dflt="$so" ;;
11284 *) dflt="$dlext" ;;
11285 esac
11286 rp='What is the extension of dynamically loaded modules'
11287 . ./myread
11288 dlext="$ans"
11289 ;;
11290*)
11291 dlext="none"
11292 ;;
11293esac
11294
11295: Check if dlsym need a leading underscore
11296echo " "
11297val="$undef"
11298
11299case "$dlsrc" in
11300dl_dlopen.xs)
11301 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11302 $cat >dyna.c <<'EOM'
11303fred () { }
11304EOM
11305
11306$cat >fred.c<<EOM
11307
11308#include <stdio.h>
55954f19
JH
11309#$i_stdlib I_STDLIB
11310#ifdef I_STDLIB
11311#include <stdlib.h>
11312#endif
b4eb6b3d
JH
11313#$i_dlfcn I_DLFCN
11314#ifdef I_DLFCN
5440bc8e 11315#include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
b4eb6b3d
JH
11316#else
11317#include <sys/types.h>
11318#include <nlist.h>
11319#include <link.h>
11320#endif
11321
11322extern int fred() ;
11323
11324int main()
11325{
11326 void * handle ;
11327 void * symbol ;
11328#ifndef RTLD_LAZY
11329 int mode = 1 ;
11330#else
11331 int mode = RTLD_LAZY ;
11332#endif
11333 handle = dlopen("./dyna.$dlext", mode) ;
11334 if (handle == NULL) {
11335 printf ("1\n") ;
11336 fflush (stdout) ;
11337 exit(0);
11338 }
11339 symbol = dlsym(handle, "fred") ;
11340 if (symbol == NULL) {
11341 /* try putting a leading underscore */
11342 symbol = dlsym(handle, "_fred") ;
11343 if (symbol == NULL) {
11344 printf ("2\n") ;
11345 fflush (stdout) ;
11346 exit(0);
11347 }
11348 printf ("3\n") ;
11349 }
11350 else
11351 printf ("4\n") ;
11352 fflush (stdout) ;
11353 exit(0);
11354}
11355EOM
11356 : Call the object file tmp-dyna.o in case dlext=o.
11357 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11358 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
e4778687 11359 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
5440bc8e
JH
11360 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11361 xxx=`$run ./fred`
b4eb6b3d
JH
11362 case $xxx in
11363 1) echo "Test program failed using dlopen." >&4
11364 echo "Perhaps you should not use dynamic loading." >&4;;
11365 2) echo "Test program failed using dlsym." >&4
11366 echo "Perhaps you should not use dynamic loading." >&4;;
11367 3) echo "dlsym needs a leading underscore" >&4
11368 val="$define" ;;
11369 4) echo "dlsym doesn't need a leading underscore." >&4;;
11370 esac
11371 else
11372 echo "I can't compile and run the test program." >&4
11373 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11374 fi
11375 ;;
11376esac
11377
3c728e00 11378$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
b4eb6b3d
JH
11379
11380set d_dlsymun
11381eval $setvar
11382
10bc17b6
JH
11383: see if drand48_r exists
11384set drand48_r d_drand48_r
11385eval $inlibc
11386case "$d_drand48_r" in
11387"$define")
11388 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
11389 case "$d_drand48_r_proto:$usethreads" in
11390 ":define") d_drand48_r_proto=define
a48ec845
JH
11391 set d_drand48_r_proto drand48_r $hdrs
11392 eval $hasproto ;;
11393 *) ;;
11394 esac
11395 case "$d_drand48_r_proto" in
11396 define)
10bc17b6
JH
11397 case "$drand48_r_proto" in
11398 ''|0) try='int drand48_r(struct drand48_data*, double*);'
11399 ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11400 esac
11401 case "$drand48_r_proto" in
90e831dc 11402 ''|0) d_drand48_r=undef
10bc17b6 11403 drand48_r_proto=0
a48ec845 11404 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11405 * ) case "$drand48_r_proto" in
11406 REENTRANT_PROTO*) ;;
11407 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11408 esac
11409 echo "Prototype: $try" ;;
11410 esac
11411 ;;
c18e646a
JH
11412 *) case "$usethreads" in
11413 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11414 esac
90e831dc
SB
11415 d_drand48_r=undef
11416 drand48_r_proto=0
c18e646a 11417 ;;
a48ec845
JH
11418 esac
11419 ;;
10bc17b6
JH
11420*) drand48_r_proto=0
11421 ;;
11422esac
11423
11424: see if prototype for drand48 is available
11425echo " "
11426set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11427eval $hasproto
11428
b4eb6b3d
JH
11429: see if dup2 exists
11430set dup2 d_dup2
11431eval $inlibc
11432
11433: see if eaccess exists
11434set eaccess d_eaccess
11435eval $inlibc
11436
11437: see if endgrent exists
11438set endgrent d_endgrent
11439eval $inlibc
11440
10bc17b6
JH
11441: see if this is an grp system
11442set grp.h i_grp
11443eval $inhdr
11444
11445case "$i_grp" in
11446$define)
11447 xxx=`./findhdr grp.h`
11448 $cppstdin $cppflags $cppminus < $xxx >$$.h
11449
11450 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11451 val="$define"
11452 else
11453 val="$undef"
11454 fi
11455 set d_grpasswd
11456 eval $setvar
11457
11458 $rm -f $$.h
11459 ;;
11460*)
11461 val="$undef";
11462 set d_grpasswd; eval $setvar
11463 ;;
11464esac
11465
11466: see if endgrent_r exists
11467set endgrent_r d_endgrent_r
11468eval $inlibc
11469case "$d_endgrent_r" in
11470"$define")
11471 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
11472 case "$d_endgrent_r_proto:$usethreads" in
11473 ":define") d_endgrent_r_proto=define
a48ec845
JH
11474 set d_endgrent_r_proto endgrent_r $hdrs
11475 eval $hasproto ;;
11476 *) ;;
11477 esac
11478 case "$d_endgrent_r_proto" in
11479 define)
10bc17b6
JH
11480 case "$endgrent_r_proto" in
11481 ''|0) try='int endgrent_r(FILE**);'
11482 ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11483 esac
11484 case "$endgrent_r_proto" in
11485 ''|0) try='void endgrent_r(FILE**);'
11486 ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11487 esac
11488 case "$endgrent_r_proto" in
90e831dc 11489 ''|0) d_endgrent_r=undef
10bc17b6 11490 endgrent_r_proto=0
a48ec845 11491 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11492 * ) case "$endgrent_r_proto" in
11493 REENTRANT_PROTO*) ;;
11494 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11495 esac
11496 echo "Prototype: $try" ;;
11497 esac
11498 ;;
c18e646a
JH
11499 *) case "$usethreads" in
11500 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11501 esac
90e831dc
SB
11502 d_endgrent_r=undef
11503 endgrent_r_proto=0
c18e646a 11504 ;;
a48ec845
JH
11505 esac
11506 ;;
10bc17b6
JH
11507*) endgrent_r_proto=0
11508 ;;
11509esac
11510
b4eb6b3d
JH
11511: see if endhostent exists
11512set endhostent d_endhent
11513eval $inlibc
11514
10bc17b6
JH
11515: see if this is a netdb.h system
11516set netdb.h i_netdb
11517eval $inhdr
11518
11519: see if endhostent_r exists
11520set endhostent_r d_endhostent_r
11521eval $inlibc
11522case "$d_endhostent_r" in
11523"$define")
11524 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11525 case "$d_endhostent_r_proto:$usethreads" in
11526 ":define") d_endhostent_r_proto=define
a48ec845
JH
11527 set d_endhostent_r_proto endhostent_r $hdrs
11528 eval $hasproto ;;
11529 *) ;;
11530 esac
11531 case "$d_endhostent_r_proto" in
11532 define)
10bc17b6
JH
11533 case "$endhostent_r_proto" in
11534 ''|0) try='int endhostent_r(struct hostent_data*);'
31ee0cb7 11535 ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
10bc17b6
JH
11536 esac
11537 case "$endhostent_r_proto" in
11538 ''|0) try='void endhostent_r(struct hostent_data*);'
31ee0cb7 11539 ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
10bc17b6
JH
11540 esac
11541 case "$endhostent_r_proto" in
90e831dc 11542 ''|0) d_endhostent_r=undef
10bc17b6 11543 endhostent_r_proto=0
a48ec845 11544 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11545 * ) case "$endhostent_r_proto" in
11546 REENTRANT_PROTO*) ;;
11547 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11548 esac
11549 echo "Prototype: $try" ;;
11550 esac
11551 ;;
c18e646a
JH
11552 *) case "$usethreads" in
11553 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11554 esac
90e831dc
SB
11555 d_endhostent_r=undef
11556 endhostent_r_proto=0
c18e646a 11557 ;;
a48ec845
JH
11558 esac
11559 ;;
10bc17b6
JH
11560*) endhostent_r_proto=0
11561 ;;
11562esac
11563
b4eb6b3d
JH
11564: see if endnetent exists
11565set endnetent d_endnent
11566eval $inlibc
11567
10bc17b6
JH
11568: see if endnetent_r exists
11569set endnetent_r d_endnetent_r
11570eval $inlibc
11571case "$d_endnetent_r" in
11572"$define")
11573 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11574 case "$d_endnetent_r_proto:$usethreads" in
11575 ":define") d_endnetent_r_proto=define
a48ec845
JH
11576 set d_endnetent_r_proto endnetent_r $hdrs
11577 eval $hasproto ;;
11578 *) ;;
11579 esac
11580 case "$d_endnetent_r_proto" in
11581 define)
10bc17b6
JH
11582 case "$endnetent_r_proto" in
11583 ''|0) try='int endnetent_r(struct netent_data*);'
31ee0cb7 11584 ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
10bc17b6
JH
11585 esac
11586 case "$endnetent_r_proto" in
11587 ''|0) try='void endnetent_r(struct netent_data*);'
31ee0cb7 11588 ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
10bc17b6
JH
11589 esac
11590 case "$endnetent_r_proto" in
90e831dc 11591 ''|0) d_endnetent_r=undef
10bc17b6 11592 endnetent_r_proto=0
a48ec845 11593 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11594 * ) case "$endnetent_r_proto" in
11595 REENTRANT_PROTO*) ;;
11596 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11597 esac
11598 echo "Prototype: $try" ;;
11599 esac
11600 ;;
c18e646a
JH
11601 *) case "$usethreads" in
11602 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11603 esac
90e831dc
SB
11604 d_endnetent_r=undef
11605 endnetent_r_proto=0
c18e646a 11606 ;;
a48ec845
JH
11607 esac
11608 ;;
10bc17b6
JH
11609*) endnetent_r_proto=0
11610 ;;
11611esac
11612
b4eb6b3d
JH
11613: see if endprotoent exists
11614set endprotoent d_endpent
11615eval $inlibc
11616
10bc17b6
JH
11617: see if endprotoent_r exists
11618set endprotoent_r d_endprotoent_r
11619eval $inlibc
11620case "$d_endprotoent_r" in
11621"$define")
11622 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11623 case "$d_endprotoent_r_proto:$usethreads" in
11624 ":define") d_endprotoent_r_proto=define
a48ec845
JH
11625 set d_endprotoent_r_proto endprotoent_r $hdrs
11626 eval $hasproto ;;
11627 *) ;;
11628 esac
11629 case "$d_endprotoent_r_proto" in
11630 define)
10bc17b6
JH
11631 case "$endprotoent_r_proto" in
11632 ''|0) try='int endprotoent_r(struct protoent_data*);'
31ee0cb7 11633 ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
10bc17b6
JH
11634 esac
11635 case "$endprotoent_r_proto" in
11636 ''|0) try='void endprotoent_r(struct protoent_data*);'
31ee0cb7 11637 ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
10bc17b6
JH
11638 esac
11639 case "$endprotoent_r_proto" in
90e831dc 11640 ''|0) d_endprotoent_r=undef
10bc17b6 11641 endprotoent_r_proto=0
a48ec845 11642 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11643 * ) case "$endprotoent_r_proto" in
11644 REENTRANT_PROTO*) ;;
11645 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11646 esac
11647 echo "Prototype: $try" ;;
11648 esac
11649 ;;
c18e646a
JH
11650 *) case "$usethreads" in
11651 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11652 esac
90e831dc
SB
11653 d_endprotoent_r=undef
11654 endprotoent_r_proto=0
c18e646a 11655 ;;
a48ec845
JH
11656 esac
11657 ;;
10bc17b6
JH
11658*) endprotoent_r_proto=0
11659 ;;
11660esac
11661
b4eb6b3d
JH
11662: see if endpwent exists
11663set endpwent d_endpwent
11664eval $inlibc
11665
10bc17b6
JH
11666: see if this is a pwd.h system
11667set pwd.h i_pwd
11668eval $inhdr
11669
11670case "$i_pwd" in
11671$define)
11672 xxx=`./findhdr pwd.h`
11673 $cppstdin $cppflags $cppminus < $xxx >$$.h
11674
11675 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11676 val="$define"
11677 else
11678 val="$undef"
11679 fi
11680 set d_pwquota
11681 eval $setvar
11682
11683 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11684 val="$define"
11685 else
11686 val="$undef"
11687 fi
11688 set d_pwage
11689 eval $setvar
11690
11691 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11692 val="$define"
11693 else
11694 val="$undef"
11695 fi
11696 set d_pwchange
11697 eval $setvar
11698
11699 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11700 val="$define"
11701 else
11702 val="$undef"
11703 fi
11704 set d_pwclass
11705 eval $setvar
11706
11707 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11708 val="$define"
11709 else
11710 val="$undef"
11711 fi
11712 set d_pwexpire
11713 eval $setvar
11714
11715 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11716 val="$define"
11717 else
11718 val="$undef"
11719 fi
11720 set d_pwcomment
11721 eval $setvar
11722
11723 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11724 val="$define"
11725 else
11726 val="$undef"
11727 fi
11728 set d_pwgecos
11729 eval $setvar
11730
11731 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11732 val="$define"
11733 else
11734 val="$undef"
11735 fi
11736 set d_pwpasswd
11737 eval $setvar
11738
11739 $rm -f $$.h
11740 ;;
11741*)
11742 val="$undef";
11743 set d_pwquota; eval $setvar
11744 set d_pwage; eval $setvar
11745 set d_pwchange; eval $setvar
11746 set d_pwclass; eval $setvar
11747 set d_pwexpire; eval $setvar
11748 set d_pwcomment; eval $setvar
11749 set d_pwgecos; eval $setvar
11750 set d_pwpasswd; eval $setvar
11751 ;;
11752esac
11753
11754: see if endpwent_r exists
11755set endpwent_r d_endpwent_r
11756eval $inlibc
11757case "$d_endpwent_r" in
11758"$define")
11759 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
11760 case "$d_endpwent_r_proto:$usethreads" in
11761 ":define") d_endpwent_r_proto=define
a48ec845
JH
11762 set d_endpwent_r_proto endpwent_r $hdrs
11763 eval $hasproto ;;
11764 *) ;;
11765 esac
11766 case "$d_endpwent_r_proto" in
11767 define)
10bc17b6
JH
11768 case "$endpwent_r_proto" in
11769 ''|0) try='int endpwent_r(FILE**);'
11770 ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11771 esac
11772 case "$endpwent_r_proto" in
11773 ''|0) try='void endpwent_r(FILE**);'
11774 ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11775 esac
11776 case "$endpwent_r_proto" in
90e831dc 11777 ''|0) d_endpwent_r=undef
10bc17b6 11778 endpwent_r_proto=0
a48ec845 11779 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11780 * ) case "$endpwent_r_proto" in
11781 REENTRANT_PROTO*) ;;
11782 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11783 esac
11784 echo "Prototype: $try" ;;
11785 esac
11786 ;;
c18e646a
JH
11787 *) case "$usethreads" in
11788 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11789 esac
90e831dc
SB
11790 d_endpwent_r=undef
11791 endpwent_r_proto=0
c18e646a 11792 ;;
a48ec845
JH
11793 esac
11794 ;;
10bc17b6
JH
11795*) endpwent_r_proto=0
11796 ;;
11797esac
11798
b4eb6b3d
JH
11799: see if endservent exists
11800set endservent d_endsent
11801eval $inlibc
11802
10bc17b6
JH
11803: see if endservent_r exists
11804set endservent_r d_endservent_r
11805eval $inlibc
11806case "$d_endservent_r" in
11807"$define")
11808 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11809 case "$d_endservent_r_proto:$usethreads" in
11810 ":define") d_endservent_r_proto=define
a48ec845
JH
11811 set d_endservent_r_proto endservent_r $hdrs
11812 eval $hasproto ;;
11813 *) ;;
11814 esac
11815 case "$d_endservent_r_proto" in
11816 define)
10bc17b6
JH
11817 case "$endservent_r_proto" in
11818 ''|0) try='int endservent_r(struct servent_data*);'
31ee0cb7 11819 ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
10bc17b6
JH
11820 esac
11821 case "$endservent_r_proto" in
11822 ''|0) try='void endservent_r(struct servent_data*);'
31ee0cb7 11823 ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
10bc17b6
JH
11824 esac
11825 case "$endservent_r_proto" in
90e831dc 11826 ''|0) d_endservent_r=undef
10bc17b6 11827 endservent_r_proto=0
a48ec845 11828 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11829 * ) case "$endservent_r_proto" in
11830 REENTRANT_PROTO*) ;;
11831 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11832 esac
11833 echo "Prototype: $try" ;;
11834 esac
11835 ;;
c18e646a
JH
11836 *) case "$usethreads" in
11837 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11838 esac
90e831dc
SB
11839 d_endservent_r=undef
11840 endservent_r_proto=0
c18e646a 11841 ;;
a48ec845
JH
11842 esac
11843 ;;
10bc17b6
JH
11844*) endservent_r_proto=0
11845 ;;
11846esac
11847
b4eb6b3d
JH
11848: Locate the flags for 'open()'
11849echo " "
55954f19 11850$cat >try.c <<EOCP
b4eb6b3d
JH
11851#include <sys/types.h>
11852#ifdef I_FCNTL
11853#include <fcntl.h>
11854#endif
11855#ifdef I_SYS_FILE
11856#include <sys/file.h>
11857#endif
55954f19
JH
11858#$i_stdlib I_STDLIB
11859#ifdef I_STDLIB
11860#include <stdlib.h>
11861#endif
b4eb6b3d
JH
11862int main() {
11863 if(O_RDONLY);
11864#ifdef O_TRUNC
11865 exit(0);
11866#else
11867 exit(1);
11868#endif
11869}
11870EOCP
11871: check sys/file.h first to get FREAD on Sun
11872if $test `./findhdr sys/file.h` && \
5440bc8e 11873 set try -DI_SYS_FILE && eval $compile; then
b4eb6b3d
JH
11874 h_sysfile=true;
11875 echo "<sys/file.h> defines the O_* constants..." >&4
5440bc8e 11876 if $run ./try; then
b4eb6b3d
JH
11877 echo "and you have the 3 argument form of open()." >&4
11878 val="$define"
11879 else
11880 echo "but not the 3 argument form of open(). Oh, well." >&4
11881 val="$undef"
11882 fi
11883elif $test `./findhdr fcntl.h` && \
5440bc8e 11884 set try -DI_FCNTL && eval $compile; then
b4eb6b3d
JH
11885 h_fcntl=true;
11886 echo "<fcntl.h> defines the O_* constants..." >&4
5440bc8e 11887 if $run ./try; then
b4eb6b3d
JH
11888 echo "and you have the 3 argument form of open()." >&4
11889 val="$define"
11890 else
11891 echo "but not the 3 argument form of open(). Oh, well." >&4
11892 val="$undef"
11893 fi
11894else
11895 val="$undef"
11896 echo "I can't find the O_* constant definitions! You got problems." >&4
11897fi
11898set d_open3
11899eval $setvar
5440bc8e 11900$rm -f try try.*
b4eb6b3d
JH
11901
11902: see which of string.h or strings.h is needed
11903echo " "
11904strings=`./findhdr string.h`
11905if $test "$strings" && $test -r "$strings"; then
11906 echo "Using <string.h> instead of <strings.h>." >&4
11907 val="$define"
11908else
11909 val="$undef"
11910 strings=`./findhdr strings.h`
11911 if $test "$strings" && $test -r "$strings"; then
11912 echo "Using <strings.h> instead of <string.h>." >&4
11913 else
11914 echo "No string header found -- You'll surely have problems." >&4
11915 fi
11916fi
11917set i_string
11918eval $setvar
11919case "$i_string" in
11920"$undef") strings=`./findhdr strings.h`;;
11921*) strings=`./findhdr string.h`;;
11922esac
11923
3c728e00
JH
11924: see if this is a sys/file.h system
11925val=''
11926set sys/file.h val
11927eval $inhdr
11928
11929: do we need to include sys/file.h ?
11930case "$val" in
11931"$define")
11932 echo " "
11933 if $h_sysfile; then
11934 val="$define"
11935 echo "We'll be including <sys/file.h>." >&4
11936 else
11937 val="$undef"
11938 echo "We won't be including <sys/file.h>." >&4
11939 fi
11940 ;;
11941*)
11942 h_sysfile=false
11943 ;;
11944esac
11945set i_sysfile
11946eval $setvar
11947
11948: see if fcntl.h is there
11949val=''
11950set fcntl.h val
11951eval $inhdr
11952
11953: see if we can include fcntl.h
11954case "$val" in
11955"$define")
11956 echo " "
11957 if $h_fcntl; then
11958 val="$define"
11959 echo "We'll be including <fcntl.h>." >&4
11960 else
11961 val="$undef"
11962 if $h_sysfile; then
11963 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11964 else
11965 echo "We won't be including <fcntl.h>." >&4
11966 fi
11967 fi
11968 ;;
11969*)
11970 h_fcntl=false
11971 val="$undef"
11972 ;;
11973esac
11974set i_fcntl
11975eval $setvar
11976
b4eb6b3d
JH
11977: check for non-blocking I/O stuff
11978case "$h_sysfile" in
a0acbdc3
JH
11979true) echo "#include <sys/file.h>" > head.c;;
11980*)
11981 case "$h_fcntl" in
11982 true) echo "#include <fcntl.h>" > head.c;;
11983 *) echo "#include <sys/fcntl.h>" > head.c;;
11984 esac
11985 ;;
b4eb6b3d
JH
11986esac
11987echo " "
11988echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11989case "$o_nonblock" in
11990'')
11991 $cat head.c > try.c
3c728e00 11992 $cat >>try.c <<EOCP
b4eb6b3d 11993#include <stdio.h>
55954f19
JH
11994#$i_stdlib I_STDLIB
11995#ifdef I_STDLIB
80b3ef99 11996#include <stdlib.h>
55954f19 11997#endif
3c728e00
JH
11998#$i_fcntl I_FCNTL
11999#ifdef I_FCNTL
12000#include <fcntl.h>
12001#endif
b4eb6b3d
JH
12002int main() {
12003#ifdef O_NONBLOCK
12004 printf("O_NONBLOCK\n");
12005 exit(0);
12006#endif
12007#ifdef O_NDELAY
12008 printf("O_NDELAY\n");
12009 exit(0);
12010#endif
12011#ifdef FNDELAY
12012 printf("FNDELAY\n");
12013 exit(0);
12014#endif
12015 exit(0);
12016}
12017EOCP
12018 set try
12019 if eval $compile_ok; then
5440bc8e 12020 o_nonblock=`$run ./try`
b4eb6b3d
JH
12021 case "$o_nonblock" in
12022 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12023 *) echo "Seems like we can use $o_nonblock.";;
12024 esac
12025 else
12026 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12027 fi
12028 ;;
12029*) echo "Using $hint value $o_nonblock.";;
12030esac
12031$rm -f try try.* .out core
12032
12033echo " "
12034echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12035case "$eagain" in
12036'')
12037 $cat head.c > try.c
12038 $cat >>try.c <<EOCP
12039#include <errno.h>
12040#include <sys/types.h>
12041#include <signal.h>
12042#include <stdio.h>
55954f19
JH
12043#$i_stdlib I_STDLIB
12044#ifdef I_STDLIB
12045#include <stdlib.h>
12046#endif
1deb0a86
JH
12047#$i_fcntl I_FCNTL
12048#ifdef I_FCNTL
12049#include <fcntl.h>
12050#endif
b4eb6b3d
JH
12051#define MY_O_NONBLOCK $o_nonblock
12052#ifndef errno /* XXX need better Configure test */
12053extern int errno;
12054#endif
12055#$i_unistd I_UNISTD
12056#ifdef I_UNISTD
12057#include <unistd.h>
12058#endif
12059#$i_string I_STRING
12060#ifdef I_STRING
12061#include <string.h>
12062#else
12063#include <strings.h>
12064#endif
12065$signal_t blech(x) int x; { exit(3); }
12066EOCP
12067 $cat >> try.c <<'EOCP'
12068int main()
12069{
12070 int pd[2];
12071 int pu[2];
12072 char buf[1];
12073 char string[100];
12074
12075 pipe(pd); /* Down: child -> parent */
12076 pipe(pu); /* Up: parent -> child */
12077 if (0 != fork()) {
12078 int ret;
12079 close(pd[1]); /* Parent reads from pd[0] */
12080 close(pu[0]); /* Parent writes (blocking) to pu[1] */
a0acbdc3 12081#ifdef F_SETFL
b4eb6b3d
JH
12082 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12083 exit(1);
a0acbdc3
JH
12084#else
12085 exit(4);
12086#endif
b4eb6b3d
JH
12087 signal(SIGALRM, blech);
12088 alarm(5);
12089 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
12090 exit(2);
12091 sprintf(string, "%d\n", ret);
12092 write(2, string, strlen(string));
12093 alarm(0);
12094#ifdef EAGAIN
12095 if (errno == EAGAIN) {
12096 printf("EAGAIN\n");
12097 goto ok;
12098 }
12099#endif
12100#ifdef EWOULDBLOCK
12101 if (errno == EWOULDBLOCK)
12102 printf("EWOULDBLOCK\n");
12103#endif
12104 ok:
12105 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
12106 sleep(2); /* Give it time to close our pipe */
12107 alarm(5);
12108 ret = read(pd[0], buf, 1); /* Should read EOF */
12109 alarm(0);
12110 sprintf(string, "%d\n", ret);
868439a2 12111 write(4, string, strlen(string));
b4eb6b3d
JH
12112 exit(0);
12113 }
12114
12115 close(pd[0]); /* We write to pd[1] */
12116 close(pu[1]); /* We read from pu[0] */
12117 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
12118 close(pd[1]); /* Pipe pd is now fully closed! */
12119 exit(0); /* Bye bye, thank you for playing! */
12120}
12121EOCP
12122 set try
12123 if eval $compile_ok; then
12124 echo "$startsh" >mtry
868439a2 12125 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
b4eb6b3d
JH
12126 chmod +x mtry
12127 ./mtry >/dev/null 2>&1
12128 case $? in
12129 0) eagain=`$cat try.out`;;
12130 1) echo "Could not perform non-blocking setting!";;
12131 2) echo "I did a successful read() for something that was not there!";;
12132 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
a0acbdc3 12133 4) echo "Could not find F_SETFL!";;
b4eb6b3d
JH
12134 *) echo "Something terribly wrong happened during testing.";;
12135 esac
12136 rd_nodata=`$cat try.ret`
12137 echo "A read() system call with no data present returns $rd_nodata."
12138 case "$rd_nodata" in
12139 0|-1) ;;
12140 *)
12141 echo "(That's peculiar, fixing that to be -1.)"
12142 rd_nodata=-1
12143 ;;
12144 esac
12145 case "$eagain" in
12146 '')
12147 echo "Forcing errno EAGAIN on read() with no data available."
12148 eagain=EAGAIN
12149 ;;
12150 *)
12151 echo "Your read() sets errno to $eagain when no data is available."
12152 ;;
12153 esac
12154 status=`$cat try.err`
12155 case "$status" in
12156 0) echo "And it correctly returns 0 to signal EOF.";;
12157 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12158 *) echo "However, your read() returns '$status' on EOF??";;
12159 esac
12160 val="$define"
12161 if test "$status" = "$rd_nodata"; then
12162 echo "WARNING: you can't distinguish between EOF and no data!"
12163 val="$undef"
12164 fi
12165 else
12166 echo "I can't compile the test program--assuming errno EAGAIN will do."
12167 eagain=EAGAIN
12168 fi
12169 set d_eofnblk
12170 eval $setvar
12171 ;;
12172*)
12173 echo "Using $hint value $eagain."
12174 echo "Your read() returns $rd_nodata when no data is present."
12175 case "$d_eofnblk" in
12176 "$define") echo "And you can see EOF because read() returns 0.";;
12177 "$undef") echo "But you can't see EOF status from read() returned value.";;
12178 *)
12179 echo "(Assuming you can't see EOF status from read anyway.)"
12180 d_eofnblk=$undef
12181 ;;
12182 esac
12183 ;;
12184esac
12185$rm -f try try.* .out core head.c mtry
12186
15b61c98
JH
12187: see if _ptr and _cnt from stdio act std
12188echo " "
b4eb6b3d 12189
15b61c98
JH
12190if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12191 echo "(Looks like you have stdio.h from BSD.)"
12192 case "$stdio_ptr" in
12193 '') stdio_ptr='((fp)->_p)'
12194 ptr_lval=$define
12195 ;;
12196 *) ptr_lval=$d_stdio_ptr_lval;;
12197 esac
12198 case "$stdio_cnt" in
12199 '') stdio_cnt='((fp)->_r)'
12200 cnt_lval=$define
12201 ;;
12202 *) cnt_lval=$d_stdio_cnt_lval;;
12203 esac
12204 case "$stdio_base" in
12205 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12206 esac
12207 case "$stdio_bufsiz" in
12208 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12209 esac
12210elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12211 echo "(Looks like you have stdio.h from Linux.)"
12212 case "$stdio_ptr" in
12213 '') stdio_ptr='((fp)->_IO_read_ptr)'
12214 ptr_lval=$define
12215 ;;
12216 *) ptr_lval=$d_stdio_ptr_lval;;
12217 esac
12218 case "$stdio_cnt" in
12219 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12220 cnt_lval=$undef
12221 ;;
12222 *) cnt_lval=$d_stdio_cnt_lval;;
12223 esac
12224 case "$stdio_base" in
12225 '') stdio_base='((fp)->_IO_read_base)';;
12226 esac
12227 case "$stdio_bufsiz" in
12228 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12229 esac
12230else
12231 case "$stdio_ptr" in
12232 '') stdio_ptr='((fp)->_ptr)'
12233 ptr_lval=$define
12234 ;;
12235 *) ptr_lval=$d_stdio_ptr_lval;;
12236 esac
12237 case "$stdio_cnt" in
12238 '') stdio_cnt='((fp)->_cnt)'
12239 cnt_lval=$define
12240 ;;
12241 *) cnt_lval=$d_stdio_cnt_lval;;
12242 esac
12243 case "$stdio_base" in
12244 '') stdio_base='((fp)->_base)';;
12245 esac
12246 case "$stdio_bufsiz" in
12247 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12248 esac
12249fi
b4eb6b3d 12250
15b61c98
JH
12251: test whether _ptr and _cnt really work
12252echo "Checking how std your stdio is..." >&4
12253$cat >try.c <<EOP
12254#include <stdio.h>
55954f19
JH
12255#$i_stdlib I_STDLIB
12256#ifdef I_STDLIB
9d9004a9 12257#include <stdlib.h>
55954f19 12258#endif
15b61c98
JH
12259#define FILE_ptr(fp) $stdio_ptr
12260#define FILE_cnt(fp) $stdio_cnt
9d9004a9 12261int main() {
15b61c98
JH
12262 FILE *fp = fopen("try.c", "r");
12263 char c = getc(fp);
12264 if (
12265 18 <= FILE_cnt(fp) &&
12266 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12267 )
12268 exit(0);
12269 exit(1);
9d9004a9 12270}
15b61c98
JH
12271EOP
12272val="$undef"
12273set try
12274if eval $compile && $to try.c; then
12275 if $run ./try; then
12276 echo "Your stdio acts pretty std."
12277 val="$define"
9d9004a9 12278 else
15b61c98 12279 echo "Your stdio isn't very std."
9d9004a9 12280 fi
15b61c98
JH
12281else
12282 echo "Your stdio doesn't appear very std."
12283fi
12284$rm -f try.c try
12285
12286# glibc 2.2.90 and above apparently change stdio streams so Perl's
12287# direct buffer manipulation no longer works. The Configure tests
12288# should be changed to correctly detect this, but until then,
12289# the following check should at least let perl compile and run.
12290# (This quick fix should be updated before 5.8.1.)
12291# To be defensive, reject all unknown versions, and all versions > 2.2.9.
12292# A. Dougherty, June 3, 2002.
12293case "$d_gnulibc" in
12294$define)
12295 case "$gnulibc_version" in
12296 2.[01]*) ;;
12297 2.2) ;;
12298 2.2.[0-9]) ;;
12299 *) echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12300 val="$undef"
12301 ;;
12302 esac
9d9004a9
AD
12303 ;;
12304esac
15b61c98 12305set d_stdstdio
9d9004a9 12306eval $setvar
9d9004a9 12307
15b61c98
JH
12308: Can _ptr be used as an lvalue?
12309case "$d_stdstdio$ptr_lval" in
12310$define$define) val=$define ;;
12311*) val=$undef ;;
12312esac
12313set d_stdio_ptr_lval
12314eval $setvar
9d9004a9 12315
15b61c98
JH
12316: Can _cnt be used as an lvalue?
12317case "$d_stdstdio$cnt_lval" in
12318$define$define) val=$define ;;
12319*) val=$undef ;;
12320esac
12321set d_stdio_cnt_lval
12322eval $setvar
b4eb6b3d 12323
15b61c98
JH
12324
12325: test whether setting _ptr sets _cnt as a side effect
12326d_stdio_ptr_lval_sets_cnt="$undef"
12327d_stdio_ptr_lval_nochange_cnt="$undef"
12328case "$d_stdio_ptr_lval$d_stdstdio" in
12329$define$define)
12330 echo "Checking to see what happens if we set the stdio ptr..." >&4
12331$cat >try.c <<EOP
12332#include <stdio.h>
12333/* Can we scream? */
12334/* Eat dust sed :-) */
12335/* In the buffer space, no one can hear you scream. */
55954f19
JH
12336#$i_stdlib I_STDLIB
12337#ifdef I_STDLIB
12338#include <stdlib.h>
12339#endif
15b61c98
JH
12340#define FILE_ptr(fp) $stdio_ptr
12341#define FILE_cnt(fp) $stdio_cnt
b4eb6b3d 12342#include <sys/types.h>
b4eb6b3d 12343int main() {
15b61c98
JH
12344 FILE *fp = fopen("try.c", "r");
12345 int c;
12346 char *ptr;
12347 size_t cnt;
12348 if (!fp) {
12349 puts("Fail even to read");
12350 exit(1);
12351 }
12352 c = getc(fp); /* Read away the first # */
12353 if (c == EOF) {
12354 puts("Fail even to read");
12355 exit(1);
12356 }
12357 if (!(
12358 18 <= FILE_cnt(fp) &&
12359 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12360 )) {
12361 puts("Fail even to read");
12362 exit (1);
12363 }
12364 ptr = (char*) FILE_ptr(fp);
12365 cnt = (size_t)FILE_cnt(fp);
12366
12367 FILE_ptr(fp) += 42;
12368
12369 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12370 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12371 exit (1);
12372 }
12373 if (FILE_cnt(fp) <= 20) {
12374 printf ("Fail (<20 chars to test)");
12375 exit (1);
12376 }
12377 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12378 puts("Fail compare");
12379 exit (1);
12380 }
12381 if (cnt == FILE_cnt(fp)) {
12382 puts("Pass_unchanged");
12383 exit (0);
12384 }
12385 if (FILE_cnt(fp) == (cnt - 42)) {
12386 puts("Pass_changed");
12387 exit (0);
12388 }
12389 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12390 return 1;
12391
12392}
12393EOP
12394 set try
12395 if eval $compile && $to try.c; then
12396 case `$run ./try` in
12397 Pass_changed)
12398 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
12399 d_stdio_ptr_lval_sets_cnt="$define" ;;
12400 Pass_unchanged)
12401 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
12402 d_stdio_ptr_lval_nochange_cnt="$define" ;;
12403 Fail*)
12404 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
12405 *)
12406 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12407 esac
12408 else
12409 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
12410 fi
12411 $rm -f try.c try
12412 ;;
12413esac
12414
12415: see if _base is also standard
12416val="$undef"
12417case "$d_stdstdio" in
12418$define)
12419 $cat >try.c <<EOP
12420#include <stdio.h>
12421#$i_stdlib I_STDLIB
12422#ifdef I_STDLIB
12423#include <stdlib.h>
12424#endif
12425#define FILE_base(fp) $stdio_base
12426#define FILE_bufsiz(fp) $stdio_bufsiz
12427int main() {
12428 FILE *fp = fopen("try.c", "r");
12429 char c = getc(fp);
12430 if (
12431 19 <= FILE_bufsiz(fp) &&
12432 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12433 )
12434 exit(0);
12435 exit(1);
12436}
12437EOP
12438 set try
12439 if eval $compile && $to try.c; then
12440 if $run ./try; then
12441 echo "And its _base field acts std."
12442 val="$define"
12443 else
12444 echo "But its _base field isn't std."
12445 fi
12446 else
12447 echo "However, it seems to be lacking the _base field."
12448 fi
12449 $rm -f try.c try
12450 ;;
12451esac
12452set d_stdiobase
12453eval $setvar
12454
12455: see if fast_stdio exists
12456val="$undef"
12457case "$d_stdstdio:$d_stdio_ptr_lval" in
12458"$define:$define")
12459 case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12460 *$define*)
12461 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12462 val="$define"
12463 ;;
12464 esac
12465 ;;
12466esac
12467set d_faststdio
12468eval $setvar
12469
12470
12471
12472: see if fchdir exists
12473set fchdir d_fchdir
12474eval $inlibc
12475
12476: see if fchmod exists
12477set fchmod d_fchmod
12478eval $inlibc
12479
12480: see if fchown exists
12481set fchown d_fchown
12482eval $inlibc
12483
12484: see if this is an fcntl system
12485set fcntl d_fcntl
12486eval $inlibc
12487
12488echo " "
12489: See if fcntl-based locking works.
12490$cat >try.c <<EOCP
12491#$i_stdlib I_STDLIB
12492#ifdef I_STDLIB
12493#include <stdlib.h>
12494#endif
12495#include <unistd.h>
12496#include <fcntl.h>
12497#include <signal.h>
12498$signal_t blech(x) int x; { exit(3); }
12499int main() {
12500#if defined(F_SETLK) && defined(F_SETLKW)
12501 struct flock flock;
12502 int retval, fd;
12503 fd = open("try.c", O_RDONLY);
12504 flock.l_type = F_RDLCK;
12505 flock.l_whence = SEEK_SET;
12506 flock.l_start = flock.l_len = 0;
12507 signal(SIGALRM, blech);
12508 alarm(10);
12509 retval = fcntl(fd, F_SETLK, &flock);
12510 close(fd);
12511 (retval < 0 ? exit(2) : exit(0));
12512#else
12513 exit(2);
12514#endif
12515}
12516EOCP
12517echo "Checking if fcntl-based file locking works... "
12518case "$d_fcntl" in
12519"$define")
12520 set try
12521 if eval $compile_ok; then
12522 if $run ./try; then
12523 echo "Yes, it seems to work."
12524 val="$define"
12525 else
12526 echo "Nope, it didn't work."
12527 val="$undef"
12528 case "$?" in
12529 3) $cat >&4 <<EOM
12530***
12531*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12532*** This is (almost) impossible.
12533*** If your NFS lock daemons are not feeling well, something like
12534*** this may happen, please investigate. Cannot continue, aborting.
12535***
12536EOM
12537 exit 1
12538 ;;
12539 esac
12540 fi
12541 else
12542 echo "I'm unable to compile the test program, so I'll assume not."
12543 val="$undef"
12544 fi
12545 ;;
12546*) val="$undef";
12547 echo "Nope, since you don't even have fcntl()."
12548 ;;
12549esac
12550set d_fcntl_can_lock
12551eval $setvar
12552$rm -f try*
12553
12554
12555: check for fd_set items
12556$cat <<EOM
12557
12558Checking to see how well your C compiler handles fd_set and friends ...
12559EOM
12560$cat >try.c <<EOCP
12561#$i_stdlib I_STDLIB
12562#ifdef I_STDLIB
12563#include <stdlib.h>
12564#endif
12565#$i_systime I_SYS_TIME
12566#$i_sysselct I_SYS_SELECT
12567#$d_socket HAS_SOCKET
12568#include <sys/types.h>
12569#ifdef HAS_SOCKET
12570#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12571#endif
12572#ifdef I_SYS_TIME
12573#include <sys/time.h>
12574#endif
12575#ifdef I_SYS_SELECT
12576#include <sys/select.h>
12577#endif
12578int main() {
12579 fd_set fds;
12580
12581#ifdef TRYBITS
12582 if(fds.fds_bits);
12583#endif
12584
12585#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12586 exit(0);
12587#else
12588 exit(1);
12589#endif
12590}
12591EOCP
12592set try -DTRYBITS
12593if eval $compile; then
12594 d_fds_bits="$define"
12595 d_fd_set="$define"
12596 echo "Well, your system knows about the normal fd_set typedef..." >&4
12597 if $run ./try; then
b4eb6b3d
JH
12598 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12599 d_fd_macros="$define"
12600 else
12601 $cat >&4 <<'EOM'
12602but not the normal fd_set macros! Gaaack! I'll have to cover for you.
12603EOM
12604 d_fd_macros="$undef"
12605 fi
12606else
12607 $cat <<'EOM'
12608Hmm, your compiler has some difficulty with fd_set. Checking further...
12609EOM
5440bc8e 12610 set try
b4eb6b3d
JH
12611 if eval $compile; then
12612 d_fds_bits="$undef"
12613 d_fd_set="$define"
12614 echo "Well, your system has some sort of fd_set available..." >&4
5440bc8e 12615 if $run ./try; then
b4eb6b3d
JH
12616 echo "and you have the normal fd_set macros." >&4
12617 d_fd_macros="$define"
12618 else
12619 $cat <<'EOM'
12620but not the normal fd_set macros! Gross! More work for me...
12621EOM
12622 d_fd_macros="$undef"
12623 fi
12624 else
12625 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
12626 d_fd_set="$undef"
12627 d_fds_bits="$undef"
12628 d_fd_macros="$undef"
12629 fi
12630fi
5440bc8e 12631$rm -f try try.*
b4eb6b3d
JH
12632
12633: see if fgetpos exists
12634set fgetpos d_fgetpos
12635eval $inlibc
12636
758a5d79
JH
12637: see if finite exists
12638set finite d_finite
12639eval $inlibc
12640
12641: see if finitel exists
12642set finitel d_finitel
12643eval $inlibc
12644
b4eb6b3d
JH
12645: see if flock exists
12646set flock d_flock
12647eval $inlibc
12648
2ef53570
JH
12649: see if prototype for flock is available
12650echo " "
12651set d_flockproto flock $i_sysfile sys/file.h
12652eval $hasproto
12653
b4eb6b3d
JH
12654: see if fork exists
12655set fork d_fork
12656eval $inlibc
12657
758a5d79
JH
12658: see if fp_class exists
12659set fp_class d_fp_class
12660eval $inlibc
12661
b4eb6b3d
JH
12662: see if pathconf exists
12663set pathconf d_pathconf
12664eval $inlibc
12665
12666: see if fpathconf exists
12667set fpathconf d_fpathconf
12668eval $inlibc
12669
758a5d79
JH
12670: see if fpclass exists
12671set fpclass d_fpclass
12672eval $inlibc
12673
12674: see if fpclassify exists
12675set fpclassify d_fpclassify
12676eval $inlibc
12677
12678: see if fpclassl exists
12679set fpclassl d_fpclassl
12680eval $inlibc
12681
b4eb6b3d
JH
12682
12683: check for fpos64_t
12684echo " "
12685echo "Checking to see if you have fpos64_t..." >&4
12686$cat >try.c <<EOCP
12687#include <stdio.h>
12688int main() { fpos64_t x = 7; }
12689EOCP
12690set try
12691if eval $compile; then
12692 val="$define"
12693 echo "You have fpos64_t."
12694else
12695 val="$undef"
12696 echo "You do not have fpos64_t."
12697 case "$fpossize" in
12698 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12699 esac
12700fi
12701$rm -f try.* try
12702set d_fpos64_t
12703eval $setvar
12704
12705: see if frexpl exists
12706set frexpl d_frexpl
12707eval $inlibc
12708
b4eb6b3d
JH
12709: see if this is a sys/param system
12710set sys/param.h i_sysparam
12711eval $inhdr
12712
12713: see if this is a sys/mount.h system
12714set sys/mount.h i_sysmount
12715eval $inhdr
12716
b4eb6b3d
JH
12717
12718echo " "
12719echo "Checking to see if your system supports struct fs_data..." >&4
12720set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12721eval $hasstruct
12722case "$d_fs_data_s" in
12723"$define") echo "Yes, it does." ;;
12724*) echo "No, it doesn't." ;;
12725esac
12726
12727: see if fseeko exists
12728set fseeko d_fseeko
12729eval $inlibc
12730case "$longsize" in
127318) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12732esac
12733
12734: see if fsetpos exists
12735set fsetpos d_fsetpos
12736eval $inlibc
12737
12738
12739: see if fstatfs exists
12740set fstatfs d_fstatfs
12741eval $inlibc
12742
12743
12744: see if statvfs exists
12745set statvfs d_statvfs
12746eval $inlibc
12747
12748: see if fstatvfs exists
12749set fstatvfs d_fstatvfs
12750eval $inlibc
12751
12752
411ab01c
JH
12753: see if fsync exists
12754set fsync d_fsync
12755eval $inlibc
12756
b4eb6b3d
JH
12757: see if ftello exists
12758set ftello d_ftello
12759eval $inlibc
12760case "$longsize" in
127618) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12762esac
12763
bff98e24
SP
12764d_futimes="$undef"
12765: check for a working futimes
12766echo " "
12767echo "Checking for a working futimes()" >&4
12768$cat >try.c <<EOCP
12769#include <stdio.h>
12770#include <sys/time.h>
12771#include <errno.h>
12772#include <fcntl.h>
12773
12774int main ()
12775{
12776 int fd, rv;
12777 fd = open ("try.c", O_RDWR);
12778 if (-1 == fd) exit (1);
12779 rv = futimes (fd, NULL);
12780 exit (rv == -1 ? errno : 0);
12781}
12782EOCP
12783set try
12784if eval $compile; then
12785 `$run ./try`
12786 rc=$?
12787 case "$rc" in
12788 0) echo "Yes, it does" >&4
12789 d_futimes="$define"
12790 ;;
12791 *) echo "No, it has futimes, but it isn't working ($rc) (probably harmless)\n" >&4
12792 ;;
12793 esac
12794else
12795 echo "No, it does not (probably harmless)\n" >&4
12796fi
12797$rm -f try.* try core core.try.*
dc814df1 12798
b4eb6b3d
JH
12799: see if getcwd exists
12800set getcwd d_getcwd
12801eval $inlibc
12802
12803: see if getespwnam exists
12804set getespwnam d_getespwnam
12805eval $inlibc
12806
12807
12808: see if getfsstat exists
12809set getfsstat d_getfsstat
12810eval $inlibc
12811
12812: see if getgrent exists
12813set getgrent d_getgrent
12814eval $inlibc
12815
10bc17b6
JH
12816: see if getgrent_r exists
12817set getgrent_r d_getgrent_r
12818eval $inlibc
12819case "$d_getgrent_r" in
12820"$define")
12821 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12822 case "$d_getgrent_r_proto:$usethreads" in
12823 ":define") d_getgrent_r_proto=define
a48ec845
JH
12824 set d_getgrent_r_proto getgrent_r $hdrs
12825 eval $hasproto ;;
12826 *) ;;
12827 esac
12828 case "$d_getgrent_r_proto" in
12829 define)
10bc17b6
JH
12830 case "$getgrent_r_proto" in
12831 ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12832 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12833 esac
12834 case "$getgrent_r_proto" in
12835 ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12836 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12837 esac
12838 case "$getgrent_r_proto" in
12839 ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12840 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12841 esac
12842 case "$getgrent_r_proto" in
12843 ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12844 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12845 esac
12846 case "$getgrent_r_proto" in
12847 ''|0) try='int getgrent_r(struct group*, char*, int);'
12848 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12849 esac
12850 case "$getgrent_r_proto" in
12851 ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12852 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12853 esac
12854 case "$getgrent_r_proto" in
90e831dc 12855 ''|0) d_getgrent_r=undef
10bc17b6 12856 getgrent_r_proto=0
a48ec845 12857 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12858 * ) case "$getgrent_r_proto" in
12859 REENTRANT_PROTO*) ;;
12860 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12861 esac
12862 echo "Prototype: $try" ;;
12863 esac
12864 ;;
c18e646a
JH
12865 *) case "$usethreads" in
12866 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12867 esac
90e831dc
SB
12868 d_getgrent_r=undef
12869 getgrent_r_proto=0
c18e646a 12870 ;;
a48ec845
JH
12871 esac
12872 ;;
10bc17b6
JH
12873*) getgrent_r_proto=0
12874 ;;
12875esac
12876
12877: see if getgrgid_r exists
12878set getgrgid_r d_getgrgid_r
12879eval $inlibc
12880case "$d_getgrgid_r" in
12881"$define")
12882 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12883 case "$d_getgrgid_r_proto:$usethreads" in
12884 ":define") d_getgrgid_r_proto=define
a48ec845
JH
12885 set d_getgrgid_r_proto getgrgid_r $hdrs
12886 eval $hasproto ;;
12887 *) ;;
12888 esac
12889 case "$d_getgrgid_r_proto" in
12890 define)
10bc17b6
JH
12891 case "$getgrgid_r_proto" in
12892 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12893 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12894 esac
12895 case "$getgrgid_r_proto" in
12896 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12897 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12898 esac
12899 case "$getgrgid_r_proto" in
12900 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12901 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12902 esac
12903 case "$getgrgid_r_proto" in
12904 ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12905 ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12906 esac
12907 case "$getgrgid_r_proto" in
90e831dc 12908 ''|0) d_getgrgid_r=undef
10bc17b6 12909 getgrgid_r_proto=0
a48ec845 12910 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12911 * ) case "$getgrgid_r_proto" in
12912 REENTRANT_PROTO*) ;;
12913 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12914 esac
12915 echo "Prototype: $try" ;;
12916 esac
12917 ;;
c18e646a
JH
12918 *) case "$usethreads" in
12919 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12920 esac
90e831dc
SB
12921 d_getgrgid_r=undef
12922 getgrgid_r_proto=0
c18e646a 12923 ;;
a48ec845
JH
12924 esac
12925 ;;
10bc17b6
JH
12926*) getgrgid_r_proto=0
12927 ;;
12928esac
12929
12930: see if getgrnam_r exists
12931set getgrnam_r d_getgrnam_r
12932eval $inlibc
12933case "$d_getgrnam_r" in
12934"$define")
12935 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12936 case "$d_getgrnam_r_proto:$usethreads" in
12937 ":define") d_getgrnam_r_proto=define
a48ec845
JH
12938 set d_getgrnam_r_proto getgrnam_r $hdrs
12939 eval $hasproto ;;
12940 *) ;;
12941 esac
12942 case "$d_getgrnam_r_proto" in
12943 define)
10bc17b6
JH
12944 case "$getgrnam_r_proto" in
12945 ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12946 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12947 esac
12948 case "$getgrnam_r_proto" in
12949 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12950 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12951 esac
12952 case "$getgrnam_r_proto" in
12953 ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12954 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12955 esac
12956 case "$getgrnam_r_proto" in
12957 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12958 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12959 esac
12960 case "$getgrnam_r_proto" in
12961 ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12962 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12963 esac
12964 case "$getgrnam_r_proto" in
90e831dc 12965 ''|0) d_getgrnam_r=undef
10bc17b6 12966 getgrnam_r_proto=0
a48ec845 12967 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12968 * ) case "$getgrnam_r_proto" in
12969 REENTRANT_PROTO*) ;;
12970 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12971 esac
12972 echo "Prototype: $try" ;;
12973 esac
12974 ;;
c18e646a
JH
12975 *) case "$usethreads" in
12976 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12977 esac
90e831dc
SB
12978 d_getgrnam_r=undef
12979 getgrnam_r_proto=0
c18e646a 12980 ;;
a48ec845
JH
12981 esac
12982 ;;
10bc17b6
JH
12983*) getgrnam_r_proto=0
12984 ;;
12985esac
12986
b4eb6b3d
JH
12987: see if gethostbyaddr exists
12988set gethostbyaddr d_gethbyaddr
12989eval $inlibc
12990
12991: see if gethostbyname exists
12992set gethostbyname d_gethbyname
12993eval $inlibc
12994
12995: see if gethostent exists
12996set gethostent d_gethent
12997eval $inlibc
12998
12999: see how we will look up host name
13000echo " "
13001call=''
13002if set gethostname val -f d_gethname; eval $csym; $val; then
13003 echo 'gethostname() found.' >&4
13004 d_gethname="$define"
13005 call=gethostname
13006fi
13007if set uname val -f d_uname; eval $csym; $val; then
13008 if ./xenix; then
13009 $cat <<'EOM'
13010uname() was found, but you're running xenix, and older versions of xenix
13011have a broken uname(). If you don't really know whether your xenix is old
13012enough to have a broken system call, use the default answer.
13013
13014EOM
13015 dflt=y
13016 case "$d_uname" in
13017 "$define") dflt=n;;
13018 esac
13019 rp='Is your uname() broken?'
13020 . ./myread
13021 case "$ans" in
13022 n*) d_uname="$define"; call=uname;;
13023 esac
13024 else
13025 echo 'uname() found.' >&4
13026 d_uname="$define"
13027 case "$call" in
13028 '') call=uname ;;
13029 esac
13030 fi
13031fi
13032case "$d_gethname" in
13033'') d_gethname="$undef";;
13034esac
13035case "$d_uname" in
13036'') d_uname="$undef";;
13037esac
13038case "$d_uname$d_gethname" in
13039*define*)
13040 dflt=n
13041 cat <<EOM
13042
13043Every now and then someone has a $call() that lies about the hostname
13044but can't be fixed for political or economic reasons. If you wish, I can
13045pretend $call() isn't there and maybe compute hostname at run-time
13046thanks to the '$phostname' command.
13047
13048EOM
13049 rp="Shall I ignore $call() from now on?"
13050 . ./myread
13051 case "$ans" in
13052 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13053 esac;;
13054esac
13055case "$phostname" in
13056'') aphostname='';;
13057*) case "$aphostname" in
13058 /*) ;;
13059 *) set X $phostname
13060 shift
13061 file=$1
13062 shift
13063 file=`./loc $file $file $pth`
13064 aphostname=`echo $file $*`
13065 ;;
13066 esac
13067 ;;
13068esac
13069case "$d_uname$d_gethname" in
13070*define*) ;;
13071*)
13072 case "$phostname" in
13073 '')
13074 echo "There will be no way for $package to get your hostname." >&4;;
13075 *)
13076 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13077 ;;
13078 esac;;
13079esac
13080case "$d_phostname" in
13081'') d_phostname="$undef";;
13082esac
13083
10bc17b6
JH
13084: see if gethostbyaddr_r exists
13085set gethostbyaddr_r d_gethostbyaddr_r
13086eval $inlibc
13087case "$d_gethostbyaddr_r" in
13088"$define")
13089 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13090 case "$d_gethostbyaddr_r_proto:$usethreads" in
13091 ":define") d_gethostbyaddr_r_proto=define
a48ec845
JH
13092 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13093 eval $hasproto ;;
13094 *) ;;
13095 esac
13096 case "$d_gethostbyaddr_r_proto" in
13097 define)
10bc17b6
JH
13098 case "$gethostbyaddr_r_proto" in
13099 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13100 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13101 esac
13102 case "$gethostbyaddr_r_proto" in
13103 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13104 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13105 esac
13106 case "$gethostbyaddr_r_proto" in
13107 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13108 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13109 esac
13110 case "$gethostbyaddr_r_proto" in
13111 ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13112 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13113 esac
13114 case "$gethostbyaddr_r_proto" in
13115 ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13116 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13117 esac
13118 case "$gethostbyaddr_r_proto" in
13119 ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13120 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13121 esac
13122 case "$gethostbyaddr_r_proto" in
13123 ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13124 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13125 esac
13126 case "$gethostbyaddr_r_proto" in
13127 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13128 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13129 esac
13130 case "$gethostbyaddr_r_proto" in
13131 ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13132 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13133 esac
13134 case "$gethostbyaddr_r_proto" in
13135 ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13136 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13137 esac
13138 case "$gethostbyaddr_r_proto" in
a845a0d4
JH
13139 ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13140 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13141 esac
13142 case "$gethostbyaddr_r_proto" in
90e831dc 13143 ''|0) d_gethostbyaddr_r=undef
10bc17b6 13144 gethostbyaddr_r_proto=0
a48ec845 13145 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13146 * ) case "$gethostbyaddr_r_proto" in
13147 REENTRANT_PROTO*) ;;
13148 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13149 esac
13150 echo "Prototype: $try" ;;
13151 esac
13152 ;;
c18e646a
JH
13153 *) case "$usethreads" in
13154 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13155 esac
90e831dc
SB
13156 d_gethostbyaddr_r=undef
13157 gethostbyaddr_r_proto=0
c18e646a 13158 ;;
a48ec845
JH
13159 esac
13160 ;;
10bc17b6
JH
13161*) gethostbyaddr_r_proto=0
13162 ;;
13163esac
13164
13165: see if gethostbyname_r exists
13166set gethostbyname_r d_gethostbyname_r
13167eval $inlibc
13168case "$d_gethostbyname_r" in
13169"$define")
13170 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13171 case "$d_gethostbyname_r_proto:$usethreads" in
13172 ":define") d_gethostbyname_r_proto=define
a48ec845
JH
13173 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13174 eval $hasproto ;;
13175 *) ;;
13176 esac
13177 case "$d_gethostbyname_r_proto" in
13178 define)
10bc17b6
JH
13179 case "$gethostbyname_r_proto" in
13180 ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13181 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13182 esac
13183 case "$gethostbyname_r_proto" in
13184 ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13185 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13186 esac
13187 case "$gethostbyname_r_proto" in
13188 ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13189 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13190 esac
13191 case "$gethostbyname_r_proto" in
90e831dc 13192 ''|0) d_gethostbyname_r=undef
10bc17b6 13193 gethostbyname_r_proto=0
a48ec845 13194 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13195 * ) case "$gethostbyname_r_proto" in
13196 REENTRANT_PROTO*) ;;
13197 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13198 esac
13199 echo "Prototype: $try" ;;
13200 esac
13201 ;;
c18e646a
JH
13202 *) case "$usethreads" in
13203 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13204 esac
90e831dc
SB
13205 d_gethostbyname_r=undef
13206 gethostbyname_r_proto=0
c18e646a 13207 ;;
a48ec845
JH
13208 esac
13209 ;;
10bc17b6
JH
13210*) gethostbyname_r_proto=0
13211 ;;
13212esac
13213
13214: see if gethostent_r exists
13215set gethostent_r d_gethostent_r
13216eval $inlibc
13217case "$d_gethostent_r" in
13218"$define")
13219 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13220 case "$d_gethostent_r_proto:$usethreads" in
13221 ":define") d_gethostent_r_proto=define
a48ec845
JH
13222 set d_gethostent_r_proto gethostent_r $hdrs
13223 eval $hasproto ;;
13224 *) ;;
13225 esac
13226 case "$d_gethostent_r_proto" in
13227 define)
10bc17b6
JH
13228 case "$gethostent_r_proto" in
13229 ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13230 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13231 esac
13232 case "$gethostent_r_proto" in
13233 ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13234 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13235 esac
13236 case "$gethostent_r_proto" in
13237 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13238 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13239 esac
13240 case "$gethostent_r_proto" in
13241 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13242 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13243 esac
13244 case "$gethostent_r_proto" in
13245 ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13246 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13247 esac
13248 case "$gethostent_r_proto" in
13249 ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13250 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13251 esac
13252 case "$gethostent_r_proto" in
90e831dc 13253 ''|0) d_gethostent_r=undef
10bc17b6 13254 gethostent_r_proto=0
a48ec845 13255 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13256 * ) case "$gethostent_r_proto" in
13257 REENTRANT_PROTO*) ;;
13258 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13259 esac
13260 echo "Prototype: $try" ;;
13261 esac
13262 ;;
c18e646a
JH
13263 *) case "$usethreads" in
13264 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13265 esac
90e831dc
SB
13266 d_gethostent_r=undef
13267 gethostent_r_proto=0
c18e646a 13268 ;;
a48ec845
JH
13269 esac
13270 ;;
10bc17b6
JH
13271*) gethostent_r_proto=0
13272 ;;
13273esac
b4eb6b3d
JH
13274
13275: see if prototypes for various gethostxxx netdb.h functions are available
13276echo " "
13277set d_gethostprotos gethostent $i_netdb netdb.h
13278eval $hasproto
13279
4e0554ec
JH
13280: see if getitimer exists
13281set getitimer d_getitimer
13282eval $inlibc
13283
b4eb6b3d
JH
13284: see if getlogin exists
13285set getlogin d_getlogin
13286eval $inlibc
13287
10bc17b6
JH
13288: see if getlogin_r exists
13289set getlogin_r d_getlogin_r
13290eval $inlibc
13291case "$d_getlogin_r" in
13292"$define")
13293 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
13294 case "$d_getlogin_r_proto:$usethreads" in
13295 ":define") d_getlogin_r_proto=define
a48ec845
JH
13296 set d_getlogin_r_proto getlogin_r $hdrs
13297 eval $hasproto ;;
13298 *) ;;
13299 esac
13300 case "$d_getlogin_r_proto" in
13301 define)
10bc17b6
JH
13302 case "$getlogin_r_proto" in
13303 ''|0) try='int getlogin_r(char*, size_t);'
13304 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13305 esac
13306 case "$getlogin_r_proto" in
13307 ''|0) try='int getlogin_r(char*, int);'
13308 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13309 esac
13310 case "$getlogin_r_proto" in
13311 ''|0) try='char* getlogin_r(char*, size_t);'
13312 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13313 esac
13314 case "$getlogin_r_proto" in
13315 ''|0) try='char* getlogin_r(char*, int);'
13316 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13317 esac
13318 case "$getlogin_r_proto" in
90e831dc 13319 ''|0) d_getlogin_r=undef
10bc17b6 13320 getlogin_r_proto=0
a48ec845 13321 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13322 * ) case "$getlogin_r_proto" in
13323 REENTRANT_PROTO*) ;;
13324 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13325 esac
13326 echo "Prototype: $try" ;;
13327 esac
13328 ;;
c18e646a
JH
13329 *) case "$usethreads" in
13330 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13331 esac
90e831dc
SB
13332 d_getlogin_r=undef
13333 getlogin_r_proto=0
c18e646a 13334 ;;
a48ec845
JH
13335 esac
13336 ;;
10bc17b6
JH
13337*) getlogin_r_proto=0
13338 ;;
13339esac
13340
b4eb6b3d
JH
13341: see if getmnt exists
13342set getmnt d_getmnt
13343eval $inlibc
13344
13345: see if getmntent exists
13346set getmntent d_getmntent
13347eval $inlibc
13348
13349: see if getnetbyaddr exists
13350set getnetbyaddr d_getnbyaddr
13351eval $inlibc
13352
13353: see if getnetbyname exists
13354set getnetbyname d_getnbyname
13355eval $inlibc
13356
13357: see if getnetent exists
13358set getnetent d_getnent
13359eval $inlibc
13360
10bc17b6
JH
13361: see if getnetbyaddr_r exists
13362set getnetbyaddr_r d_getnetbyaddr_r
13363eval $inlibc
13364case "$d_getnetbyaddr_r" in
13365"$define")
13366 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13367 case "$d_getnetbyaddr_r_proto:$usethreads" in
13368 ":define") d_getnetbyaddr_r_proto=define
a48ec845
JH
13369 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13370 eval $hasproto ;;
13371 *) ;;
13372 esac
13373 case "$d_getnetbyaddr_r_proto" in
13374 define)
10bc17b6
JH
13375 case "$getnetbyaddr_r_proto" in
13376 ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13377 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13378 esac
13379 case "$getnetbyaddr_r_proto" in
13380 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13381 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13382 esac
13383 case "$getnetbyaddr_r_proto" in
13384 ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13385 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13386 esac
13387 case "$getnetbyaddr_r_proto" in
13388 ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13389 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13390 esac
13391 case "$getnetbyaddr_r_proto" in
13392 ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13393 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13394 esac
13395 case "$getnetbyaddr_r_proto" in
13396 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13397 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13398 esac
13399 case "$getnetbyaddr_r_proto" in
13400 ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13401 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13402 esac
13403 case "$getnetbyaddr_r_proto" in
a845a0d4
JH
13404 ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13405 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13406 esac
13407 case "$getnetbyaddr_r_proto" in
90e831dc 13408 ''|0) d_getnetbyaddr_r=undef
10bc17b6 13409 getnetbyaddr_r_proto=0
a48ec845 13410 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13411 * ) case "$getnetbyaddr_r_proto" in
13412 REENTRANT_PROTO*) ;;
13413 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13414 esac
13415 echo "Prototype: $try" ;;
13416 esac
13417 ;;
c18e646a
JH
13418 *) case "$usethreads" in
13419 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13420 esac
90e831dc
SB
13421 d_getnetbyaddr_r=undef
13422 getnetbyaddr_r_proto=0
c18e646a 13423 ;;
a48ec845
JH
13424 esac
13425 ;;
10bc17b6
JH
13426*) getnetbyaddr_r_proto=0
13427 ;;
13428esac
13429
13430: see if getnetbyname_r exists
13431set getnetbyname_r d_getnetbyname_r
13432eval $inlibc
13433case "$d_getnetbyname_r" in
13434"$define")
13435 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13436 case "$d_getnetbyname_r_proto:$usethreads" in
13437 ":define") d_getnetbyname_r_proto=define
a48ec845
JH
13438 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13439 eval $hasproto ;;
13440 *) ;;
13441 esac
13442 case "$d_getnetbyname_r_proto" in
13443 define)
10bc17b6
JH
13444 case "$getnetbyname_r_proto" in
13445 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13446 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13447 esac
13448 case "$getnetbyname_r_proto" in
13449 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13450 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13451 esac
13452 case "$getnetbyname_r_proto" in
13453 ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13454 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13455 esac
13456 case "$getnetbyname_r_proto" in
13457 ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13458 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13459 esac
13460 case "$getnetbyname_r_proto" in
90e831dc 13461 ''|0) d_getnetbyname_r=undef
10bc17b6 13462 getnetbyname_r_proto=0
a48ec845 13463 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13464 * ) case "$getnetbyname_r_proto" in
13465 REENTRANT_PROTO*) ;;
13466 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13467 esac
13468 echo "Prototype: $try" ;;
13469 esac
13470 ;;
c18e646a
JH
13471 *) case "$usethreads" in
13472 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13473 esac
90e831dc
SB
13474 d_getnetbyname_r=undef
13475 getnetbyname_r_proto=0
c18e646a 13476 ;;
a48ec845
JH
13477 esac
13478 ;;
10bc17b6
JH
13479*) getnetbyname_r_proto=0
13480 ;;
13481esac
13482
13483: see if getnetent_r exists
13484set getnetent_r d_getnetent_r
13485eval $inlibc
13486case "$d_getnetent_r" in
13487"$define")
13488 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13489 case "$d_getnetent_r_proto:$usethreads" in
13490 ":define") d_getnetent_r_proto=define
a48ec845
JH
13491 set d_getnetent_r_proto getnetent_r $hdrs
13492 eval $hasproto ;;
13493 *) ;;
13494 esac
13495 case "$d_getnetent_r_proto" in
13496 define)
10bc17b6
JH
13497 case "$getnetent_r_proto" in
13498 ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13499 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13500 esac
13501 case "$getnetent_r_proto" in
13502 ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13503 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13504 esac
13505 case "$getnetent_r_proto" in
13506 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13507 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13508 esac
13509 case "$getnetent_r_proto" in
13510 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13511 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13512 esac
13513 case "$getnetent_r_proto" in
13514 ''|0) try='int getnetent_r(struct netent*, char*, int);'
13515 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13516 esac
13517 case "$getnetent_r_proto" in
13518 ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13519 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13520 esac
13521 case "$getnetent_r_proto" in
90e831dc 13522 ''|0) d_getnetent_r=undef
10bc17b6 13523 getnetent_r_proto=0
a48ec845 13524 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13525 * ) case "$getnetent_r_proto" in
13526 REENTRANT_PROTO*) ;;
13527 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13528 esac
13529 echo "Prototype: $try" ;;
13530 esac
13531 ;;
c18e646a
JH
13532 *) case "$usethreads" in
13533 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13534 esac
90e831dc
SB
13535 d_getnetent_r=undef
13536 getnetent_r_proto=0
c18e646a 13537 ;;
a48ec845
JH
13538 esac
13539 ;;
10bc17b6
JH
13540*) getnetent_r_proto=0
13541 ;;
13542esac
13543
b4eb6b3d
JH
13544: see if prototypes for various getnetxxx netdb.h functions are available
13545echo " "
13546set d_getnetprotos getnetent $i_netdb netdb.h
13547eval $hasproto
13548
0c0643d0
JH
13549: see if getpagesize exists
13550set getpagesize d_getpagsz
13551eval $inlibc
13552
b4eb6b3d
JH
13553
13554: see if getprotobyname exists
13555set getprotobyname d_getpbyname
13556eval $inlibc
13557
13558: see if getprotobynumber exists
13559set getprotobynumber d_getpbynumber
13560eval $inlibc
13561
13562: see if getprotoent exists
13563set getprotoent d_getpent
13564eval $inlibc
13565
13566: see if getpgid exists
13567set getpgid d_getpgid
13568eval $inlibc
13569
13570: see if getpgrp2 exists
13571set getpgrp2 d_getpgrp2
13572eval $inlibc
13573
13574: see if getppid exists
13575set getppid d_getppid
13576eval $inlibc
13577
13578: see if getpriority exists
13579set getpriority d_getprior
13580eval $inlibc
13581
10bc17b6
JH
13582: see if getprotobyname_r exists
13583set getprotobyname_r d_getprotobyname_r
13584eval $inlibc
13585case "$d_getprotobyname_r" in
13586"$define")
13587 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13588 case "$d_getprotobyname_r_proto:$usethreads" in
13589 ":define") d_getprotobyname_r_proto=define
a48ec845
JH
13590 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13591 eval $hasproto ;;
13592 *) ;;
13593 esac
13594 case "$d_getprotobyname_r_proto" in
13595 define)
10bc17b6
JH
13596 case "$getprotobyname_r_proto" in
13597 ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13598 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13599 esac
13600 case "$getprotobyname_r_proto" in
13601 ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13602 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13603 esac
13604 case "$getprotobyname_r_proto" in
13605 ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13606 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13607 esac
13608 case "$getprotobyname_r_proto" in
90e831dc 13609 ''|0) d_getprotobyname_r=undef
10bc17b6 13610 getprotobyname_r_proto=0
a48ec845 13611 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13612 * ) case "$getprotobyname_r_proto" in
13613 REENTRANT_PROTO*) ;;
13614 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13615 esac
13616 echo "Prototype: $try" ;;
13617 esac
13618 ;;
c18e646a
JH
13619 *) case "$usethreads" in
13620 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13621 esac
90e831dc
SB
13622 d_getprotobyname_r=undef
13623 getprotobyname_r_proto=0
c18e646a 13624 ;;
a48ec845
JH
13625 esac
13626 ;;
10bc17b6
JH
13627*) getprotobyname_r_proto=0
13628 ;;
13629esac
13630
13631: see if getprotobynumber_r exists
13632set getprotobynumber_r d_getprotobynumber_r
13633eval $inlibc
13634case "$d_getprotobynumber_r" in
13635"$define")
13636 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13637 case "$d_getprotobynumber_r_proto:$usethreads" in
13638 ":define") d_getprotobynumber_r_proto=define
a48ec845
JH
13639 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13640 eval $hasproto ;;
13641 *) ;;
13642 esac
13643 case "$d_getprotobynumber_r_proto" in
13644 define)
10bc17b6
JH
13645 case "$getprotobynumber_r_proto" in
13646 ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13647 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13648 esac
13649 case "$getprotobynumber_r_proto" in
13650 ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13651 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13652 esac
13653 case "$getprotobynumber_r_proto" in
13654 ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13655 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13656 esac
13657 case "$getprotobynumber_r_proto" in
90e831dc 13658 ''|0) d_getprotobynumber_r=undef
10bc17b6 13659 getprotobynumber_r_proto=0
a48ec845 13660 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13661 * ) case "$getprotobynumber_r_proto" in
13662 REENTRANT_PROTO*) ;;
13663 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13664 esac
13665 echo "Prototype: $try" ;;
13666 esac
13667 ;;
c18e646a
JH
13668 *) case "$usethreads" in
13669 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13670 esac
90e831dc
SB
13671 d_getprotobynumber_r=undef
13672 getprotobynumber_r_proto=0
c18e646a 13673 ;;
a48ec845
JH
13674 esac
13675 ;;
10bc17b6
JH
13676*) getprotobynumber_r_proto=0
13677 ;;
13678esac
13679
13680: see if getprotoent_r exists
13681set getprotoent_r d_getprotoent_r
13682eval $inlibc
13683case "$d_getprotoent_r" in
13684"$define")
13685 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13686 case "$d_getprotoent_r_proto:$usethreads" in
13687 ":define") d_getprotoent_r_proto=define
a48ec845
JH
13688 set d_getprotoent_r_proto getprotoent_r $hdrs
13689 eval $hasproto ;;
13690 *) ;;
13691 esac
13692 case "$d_getprotoent_r_proto" in
13693 define)
10bc17b6
JH
13694 case "$getprotoent_r_proto" in
13695 ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13696 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13697 esac
13698 case "$getprotoent_r_proto" in
13699 ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13700 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13701 esac
13702 case "$getprotoent_r_proto" in
13703 ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13704 ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13705 esac
13706 case "$getprotoent_r_proto" in
13707 ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13708 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13709 esac
13710 case "$getprotoent_r_proto" in
90e831dc 13711 ''|0) d_getprotoent_r=undef
10bc17b6 13712 getprotoent_r_proto=0
a48ec845 13713 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13714 * ) case "$getprotoent_r_proto" in
13715 REENTRANT_PROTO*) ;;
13716 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13717 esac
13718 echo "Prototype: $try" ;;
13719 esac
13720 ;;
c18e646a
JH
13721 *) case "$usethreads" in
13722 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13723 esac
90e831dc
SB
13724 d_getprotoent_r=undef
13725 getprotoent_r_proto=0
c18e646a 13726 ;;
a48ec845
JH
13727 esac
13728 ;;
10bc17b6
JH
13729*) getprotoent_r_proto=0
13730 ;;
13731esac
13732
b4eb6b3d
JH
13733: see if prototypes for various getprotoxxx netdb.h functions are available
13734echo " "
13735set d_getprotoprotos getprotoent $i_netdb netdb.h
13736eval $hasproto
13737
13738: see if getprpwnam exists
13739set getprpwnam d_getprpwnam
13740eval $inlibc
13741
13742: see if getpwent exists
13743set getpwent d_getpwent
13744eval $inlibc
13745
10bc17b6
JH
13746: see if getpwent_r exists
13747set getpwent_r d_getpwent_r
13748eval $inlibc
13749case "$d_getpwent_r" in
13750"$define")
13751 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13752 case "$d_getpwent_r_proto:$usethreads" in
13753 ":define") d_getpwent_r_proto=define
a48ec845
JH
13754 set d_getpwent_r_proto getpwent_r $hdrs
13755 eval $hasproto ;;
13756 *) ;;
13757 esac
13758 case "$d_getpwent_r_proto" in
13759 define)
10bc17b6
JH
13760 case "$getpwent_r_proto" in
13761 ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13762 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13763 esac
13764 case "$getpwent_r_proto" in
13765 ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13766 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13767 esac
13768 case "$getpwent_r_proto" in
13769 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13770 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13771 esac
13772 case "$getpwent_r_proto" in
13773 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13774 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13775 esac
13776 case "$getpwent_r_proto" in
13777 ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13778 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13779 esac
13780 case "$getpwent_r_proto" in
13781 ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13782 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13783 esac
13784 case "$getpwent_r_proto" in
90e831dc 13785 ''|0) d_getpwent_r=undef
10bc17b6 13786 getpwent_r_proto=0
a48ec845 13787 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13788 * ) case "$getpwent_r_proto" in
13789 REENTRANT_PROTO*) ;;
13790 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13791 esac
13792 echo "Prototype: $try" ;;
13793 esac
13794 ;;
c18e646a
JH
13795 *) case "$usethreads" in
13796 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13797 esac
90e831dc
SB
13798 d_getpwent_r=undef
13799 getpwent_r_proto=0
c18e646a 13800 ;;
a48ec845
JH
13801 esac
13802 ;;
10bc17b6
JH
13803*) getpwent_r_proto=0
13804 ;;
13805esac
13806
13807: see if getpwnam_r exists
13808set getpwnam_r d_getpwnam_r
13809eval $inlibc
13810case "$d_getpwnam_r" in
13811"$define")
13812 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13813 case "$d_getpwnam_r_proto:$usethreads" in
13814 ":define") d_getpwnam_r_proto=define
a48ec845
JH
13815 set d_getpwnam_r_proto getpwnam_r $hdrs
13816 eval $hasproto ;;
13817 *) ;;
13818 esac
13819 case "$d_getpwnam_r_proto" in
13820 define)
10bc17b6
JH
13821 case "$getpwnam_r_proto" in
13822 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13823 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13824 esac
13825 case "$getpwnam_r_proto" in
13826 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13827 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13828 esac
13829 case "$getpwnam_r_proto" in
13830 ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13831 ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13832 esac
13833 case "$getpwnam_r_proto" in
13834 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13835 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13836 esac
13837 case "$getpwnam_r_proto" in
90e831dc 13838 ''|0) d_getpwnam_r=undef
10bc17b6 13839 getpwnam_r_proto=0
a48ec845 13840 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13841 * ) case "$getpwnam_r_proto" in
13842 REENTRANT_PROTO*) ;;
13843 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13844 esac
13845 echo "Prototype: $try" ;;
13846 esac
13847 ;;
c18e646a
JH
13848 *) case "$usethreads" in
13849 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13850 esac
90e831dc
SB
13851 d_getpwnam_r=undef
13852 getpwnam_r_proto=0
c18e646a 13853 ;;
a48ec845
JH
13854 esac
13855 ;;
10bc17b6
JH
13856*) getpwnam_r_proto=0
13857 ;;
13858esac
13859
13860: see if getpwuid_r exists
13861set getpwuid_r d_getpwuid_r
13862eval $inlibc
13863case "$d_getpwuid_r" in
13864"$define")
13865 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13866 case "$d_getpwuid_r_proto:$usethreads" in
13867 ":define") d_getpwuid_r_proto=define
a48ec845
JH
13868 set d_getpwuid_r_proto getpwuid_r $hdrs
13869 eval $hasproto ;;
13870 *) ;;
13871 esac
13872 case "$d_getpwuid_r_proto" in
13873 define)
10bc17b6
JH
13874 case "$getpwuid_r_proto" in
13875 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13876 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13877 esac
13878 case "$getpwuid_r_proto" in
13879 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13880 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13881 esac
13882 case "$getpwuid_r_proto" in
13883 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13884 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13885 esac
13886 case "$getpwuid_r_proto" in
13887 ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13888 ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13889 esac
13890 case "$getpwuid_r_proto" in
90e831dc 13891 ''|0) d_getpwuid_r=undef
10bc17b6 13892 getpwuid_r_proto=0
a48ec845 13893 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13894 * ) case "$getpwuid_r_proto" in
13895 REENTRANT_PROTO*) ;;
13896 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13897 esac
13898 echo "Prototype: $try" ;;
13899 esac
13900 ;;
c18e646a
JH
13901 *) case "$usethreads" in
13902 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13903 esac
90e831dc
SB
13904 d_getpwuid_r=undef
13905 getpwuid_r_proto=0
c18e646a 13906 ;;
a48ec845
JH
13907 esac
13908 ;;
10bc17b6
JH
13909*) getpwuid_r_proto=0
13910 ;;
13911esac
13912
b4eb6b3d
JH
13913
13914: see if getservbyname exists
13915set getservbyname d_getsbyname
13916eval $inlibc
13917
13918: see if getservbyport exists
13919set getservbyport d_getsbyport
13920eval $inlibc
13921
13922: see if getservent exists
13923set getservent d_getsent
13924eval $inlibc
13925
10bc17b6
JH
13926: see if getservbyname_r exists
13927set getservbyname_r d_getservbyname_r
13928eval $inlibc
13929case "$d_getservbyname_r" in
13930"$define")
13931 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13932 case "$d_getservbyname_r_proto:$usethreads" in
13933 ":define") d_getservbyname_r_proto=define
a48ec845
JH
13934 set d_getservbyname_r_proto getservbyname_r $hdrs
13935 eval $hasproto ;;
13936 *) ;;
13937 esac
13938 case "$d_getservbyname_r_proto" in
13939 define)
10bc17b6
JH
13940 case "$getservbyname_r_proto" in
13941 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13942 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13943 esac
13944 case "$getservbyname_r_proto" in
13945 ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13946 ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13947 esac
13948 case "$getservbyname_r_proto" in
13949 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13950 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13951 esac
13952 case "$getservbyname_r_proto" in
90e831dc 13953 ''|0) d_getservbyname_r=undef
10bc17b6 13954 getservbyname_r_proto=0
a48ec845 13955 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13956 * ) case "$getservbyname_r_proto" in
13957 REENTRANT_PROTO*) ;;
13958 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13959 esac
13960 echo "Prototype: $try" ;;
13961 esac
13962 ;;
c18e646a
JH
13963 *) case "$usethreads" in
13964 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13965 esac
90e831dc
SB
13966 d_getservbyname_r=undef
13967 getservbyname_r_proto=0
c18e646a 13968 ;;
a48ec845
JH
13969 esac
13970 ;;
10bc17b6
JH
13971*) getservbyname_r_proto=0
13972 ;;
13973esac
13974
13975: see if getservbyport_r exists
13976set getservbyport_r d_getservbyport_r
13977eval $inlibc
13978case "$d_getservbyport_r" in
13979"$define")
13980 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13981 case "$d_getservbyport_r_proto:$usethreads" in
13982 ":define") d_getservbyport_r_proto=define
a48ec845
JH
13983 set d_getservbyport_r_proto getservbyport_r $hdrs
13984 eval $hasproto ;;
13985 *) ;;
13986 esac
13987 case "$d_getservbyport_r_proto" in
13988 define)
10bc17b6
JH
13989 case "$getservbyport_r_proto" in
13990 ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13991 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13992 esac
13993 case "$getservbyport_r_proto" in
13994 ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13995 ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13996 esac
13997 case "$getservbyport_r_proto" in
13998 ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13999 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14000 esac
14001 case "$getservbyport_r_proto" in
90e831dc 14002 ''|0) d_getservbyport_r=undef
10bc17b6 14003 getservbyport_r_proto=0
a48ec845 14004 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14005 * ) case "$getservbyport_r_proto" in
14006 REENTRANT_PROTO*) ;;
14007 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14008 esac
14009 echo "Prototype: $try" ;;
14010 esac
14011 ;;
c18e646a
JH
14012 *) case "$usethreads" in
14013 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14014 esac
90e831dc
SB
14015 d_getservbyport_r=undef
14016 getservbyport_r_proto=0
c18e646a 14017 ;;
a48ec845
JH
14018 esac
14019 ;;
10bc17b6
JH
14020*) getservbyport_r_proto=0
14021 ;;
14022esac
14023
14024: see if getservent_r exists
14025set getservent_r d_getservent_r
14026eval $inlibc
14027case "$d_getservent_r" in
14028"$define")
14029 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14030 case "$d_getservent_r_proto:$usethreads" in
14031 ":define") d_getservent_r_proto=define
a48ec845
JH
14032 set d_getservent_r_proto getservent_r $hdrs
14033 eval $hasproto ;;
14034 *) ;;
14035 esac
14036 case "$d_getservent_r_proto" in
14037 define)
10bc17b6
JH
14038 case "$getservent_r_proto" in
14039 ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14040 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14041 esac
14042 case "$getservent_r_proto" in
14043 ''|0) try='int getservent_r(struct servent*, char*, int);'
14044 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14045 esac
14046 case "$getservent_r_proto" in
14047 ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14048 ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14049 esac
14050 case "$getservent_r_proto" in
14051 ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14052 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14053 esac
14054 case "$getservent_r_proto" in
90e831dc 14055 ''|0) d_getservent_r=undef
10bc17b6 14056 getservent_r_proto=0
a48ec845 14057 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14058 * ) case "$getservent_r_proto" in
14059 REENTRANT_PROTO*) ;;
14060 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14061 esac
14062 echo "Prototype: $try" ;;
14063 esac
14064 ;;
c18e646a
JH
14065 *) case "$usethreads" in
14066 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14067 esac
90e831dc
SB
14068 d_getservent_r=undef
14069 getservent_r_proto=0
c18e646a 14070 ;;
a48ec845
JH
14071 esac
14072 ;;
10bc17b6
JH
14073*) getservent_r_proto=0
14074 ;;
14075esac
14076
b4eb6b3d
JH
14077: see if prototypes for various getservxxx netdb.h functions are available
14078echo " "
14079set d_getservprotos getservent $i_netdb netdb.h
14080eval $hasproto
14081
14082: see if getspnam exists
14083set getspnam d_getspnam
14084eval $inlibc
14085
10bc17b6
JH
14086: see if this is a shadow.h system
14087set shadow.h i_shadow
14088eval $inhdr
14089
14090: see if getspnam_r exists
14091set getspnam_r d_getspnam_r
14092eval $inlibc
14093case "$d_getspnam_r" in
14094"$define")
14095 hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
c18e646a
JH
14096 case "$d_getspnam_r_proto:$usethreads" in
14097 ":define") d_getspnam_r_proto=define
a48ec845
JH
14098 set d_getspnam_r_proto getspnam_r $hdrs
14099 eval $hasproto ;;
14100 *) ;;
14101 esac
14102 case "$d_getspnam_r_proto" in
14103 define)
10bc17b6
JH
14104 case "$getspnam_r_proto" in
14105 ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14106 ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14107 esac
14108 case "$getspnam_r_proto" in
14109 ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14110 ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14111 esac
14112 case "$getspnam_r_proto" in
90e831dc 14113 ''|0) d_getspnam_r=undef
10bc17b6 14114 getspnam_r_proto=0
a48ec845 14115 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14116 * ) case "$getspnam_r_proto" in
14117 REENTRANT_PROTO*) ;;
14118 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14119 esac
14120 echo "Prototype: $try" ;;
14121 esac
14122 ;;
c18e646a
JH
14123 *) case "$usethreads" in
14124 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14125 esac
90e831dc
SB
14126 d_getspnam_r=undef
14127 getspnam_r_proto=0
c18e646a 14128 ;;
a48ec845
JH
14129 esac
14130 ;;
10bc17b6
JH
14131*) getspnam_r_proto=0
14132 ;;
14133esac
14134
b4eb6b3d
JH
14135: see if gettimeofday or ftime exists
14136set gettimeofday d_gettimeod
14137eval $inlibc
14138case "$d_gettimeod" in
14139"$undef")
14140 set ftime d_ftime
14141 eval $inlibc
14142 ;;
14143*)
14144 val="$undef"; set d_ftime; eval $setvar
14145 ;;
14146esac
14147case "$d_gettimeod$d_ftime" in
14148"$undef$undef")
14149 echo " "
14150 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14151 ;;
14152esac
14153
10bc17b6
JH
14154: see if gmtime_r exists
14155set gmtime_r d_gmtime_r
14156eval $inlibc
14157case "$d_gmtime_r" in
14158"$define")
d63eadf0 14159 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
14160 case "$d_gmtime_r_proto:$usethreads" in
14161 ":define") d_gmtime_r_proto=define
a48ec845
JH
14162 set d_gmtime_r_proto gmtime_r $hdrs
14163 eval $hasproto ;;
14164 *) ;;
14165 esac
14166 case "$d_gmtime_r_proto" in
14167 define)
10bc17b6
JH
14168 case "$gmtime_r_proto" in
14169 ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14170 ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14171 esac
14172 case "$gmtime_r_proto" in
14173 ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14174 ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14175 esac
14176 case "$gmtime_r_proto" in
90e831dc 14177 ''|0) d_gmtime_r=undef
10bc17b6 14178 gmtime_r_proto=0
a48ec845 14179 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14180 * ) case "$gmtime_r_proto" in
14181 REENTRANT_PROTO*) ;;
14182 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14183 esac
14184 echo "Prototype: $try" ;;
14185 esac
b4eb6b3d 14186 ;;
c18e646a
JH
14187 *) case "$usethreads" in
14188 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14189 esac
90e831dc
SB
14190 d_gmtime_r=undef
14191 gmtime_r_proto=0
c18e646a 14192 ;;
a48ec845
JH
14193 esac
14194 ;;
10bc17b6 14195*) gmtime_r_proto=0
b4eb6b3d
JH
14196 ;;
14197esac
14198
14199: see if hasmntopt exists
14200set hasmntopt d_hasmntopt
14201eval $inlibc
14202
14203: see if this is a netinet/in.h or sys/in.h system
14204set netinet/in.h i_niin sys/in.h i_sysin
14205eval $inhdr
14206
14207: see if arpa/inet.h has to be included
14208set arpa/inet.h i_arpainet
14209eval $inhdr
14210
14211: see if htonl --and friends-- exists
14212val=''
14213set htonl val
14214eval $inlibc
14215
14216: Maybe they are macros.
14217case "$val" in
14218$undef)
14219 $cat >htonl.c <<EOM
14220#include <stdio.h>
14221#include <sys/types.h>
14222#$i_niin I_NETINET_IN
14223#$i_sysin I_SYS_IN
14224#$i_arpainet I_ARPA_INET
14225#ifdef I_NETINET_IN
14226#include <netinet/in.h>
14227#endif
14228#ifdef I_SYS_IN
14229#include <sys/in.h>
14230#endif
14231#ifdef I_ARPA_INET
14232#include <arpa/inet.h>
14233#endif
14234#ifdef htonl
14235printf("Defined as a macro.");
14236#endif
14237EOM
14238 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14239 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14240 val="$define"
14241 echo "But it seems to be defined as a macro." >&4
14242 fi
14243 $rm -f htonl.?
14244 ;;
14245esac
14246set d_htonl
14247eval $setvar
14248
36adc09b
JH
14249: see if ilogbl exists
14250set ilogbl d_ilogbl
14251eval $inlibc
14252
b4eb6b3d
JH
14253: index or strchr
14254echo " "
14255if set index val -f; eval $csym; $val; then
14256 if set strchr val -f d_strchr; eval $csym; $val; then
14257 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14258 val="$define"
14259 vali="$undef"
14260 echo "strchr() found." >&4
14261 else
14262 val="$undef"
14263 vali="$define"
14264 echo "index() found." >&4
14265 fi
14266 else
14267 val="$undef"
14268 vali="$define"
8dfa8df9
JH
14269 echo "index() found." >&4
14270 fi
b4eb6b3d 14271else
8dfa8df9
JH
14272 if set strchr val -f d_strchr; eval $csym; $val; then
14273 val="$define"
14274 vali="$undef"
14275 echo "strchr() found." >&4
14276 else
14277 echo "No index() or strchr() found!" >&4
14278 val="$undef"
14279 vali="$undef"
14280 fi
b4eb6b3d 14281fi
8dfa8df9
JH
14282set d_strchr; eval $setvar
14283val="$vali"
14284set d_index; eval $setvar
14285
14286: check whether inet_aton exists
14287set inet_aton d_inetaton
14288eval $inlibc
b4eb6b3d
JH
14289
14290: Look for isascii
14291echo " "
36adc09b 14292$cat >isascii.c <<EOCP
b4eb6b3d
JH
14293#include <stdio.h>
14294#include <ctype.h>
55954f19
JH
14295#$i_stdlib I_STDLIB
14296#ifdef I_STDLIB
14297#include <stdlib.h>
14298#endif
b4eb6b3d
JH
14299int main() {
14300 int c = 'A';
14301 if (isascii(c))
14302 exit(0);
14303 else
14304 exit(1);
14305}
14306EOCP
14307set isascii
14308if eval $compile; then
14309 echo "isascii() found." >&4
14310 val="$define"
14311else
14312 echo "isascii() NOT found." >&4
14313 val="$undef"
14314fi
14315set d_isascii
14316eval $setvar
14317$rm -f isascii*
14318
758a5d79
JH
14319: see if isfinite exists
14320set isfinite d_isfinite
14321eval $inlibc
14322
14323: see if isinf exists
14324set isinf d_isinf
14325eval $inlibc
14326
b4eb6b3d
JH
14327: see if isnan exists
14328set isnan d_isnan
14329eval $inlibc
14330
14331: see if isnanl exists
14332set isnanl d_isnanl
14333eval $inlibc
14334
14335: see if killpg exists
14336set killpg d_killpg
14337eval $inlibc
14338
14339: see if lchown exists
14340echo " "
14341$cat > try.c <<'EOCP'
14342/* System header to define __stub macros and hopefully few prototypes,
14343 which can conflict with char lchown(); below. */
14344#include <assert.h>
14345/* Override any gcc2 internal prototype to avoid an error. */
14346/* We use char because int might match the return type of a gcc2
14347 builtin and then its argument prototype would still apply. */
14348char lchown();
14349int main() {
14350 /* The GNU C library defines this for functions which it implements
14351 to always fail with ENOSYS. Some functions are actually named
14352 something starting with __ and the normal name is an alias. */
14353#if defined (__stub_lchown) || defined (__stub___lchown)
14354choke me
14355#else
14356lchown();
14357#endif
14358; return 0; }
14359EOCP
14360set try
14361if eval $compile; then
14362 $echo "lchown() found." >&4
14363 val="$define"
14364else
14365 $echo "lchown() NOT found." >&4
14366 val="$undef"
14367fi
14368set d_lchown
14369eval $setvar
14370
14371: See if number of significant digits in a double precision number is known
14372echo " "
14373$cat >ldbl_dig.c <<EOM
14374#$i_limits I_LIMITS
14375#$i_float I_FLOAT
14376#ifdef I_LIMITS
14377#include <limits.h>
14378#endif
14379#ifdef I_FLOAT
14380#include <float.h>
14381#endif
14382#ifdef LDBL_DIG
14383printf("Contains LDBL_DIG");
14384#endif
14385EOM
14386$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14387if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14388 echo "LDBL_DIG found." >&4
14389 val="$define"
14390else
14391 echo "LDBL_DIG NOT found." >&4
14392 val="$undef"
14393fi
14394$rm -f ldbl_dig.?
14395set d_ldbl_dig
14396eval $setvar
14397
0a0abfba
MB
14398: see if this is a math.h system
14399set math.h i_math
14400eval $inhdr
14401
14402d_libm_lib_version="$undef"
14403case $i_math in
14404 $define)
14405 : check to see if math.h defines _LIB_VERSION
14406 echo " "
14407 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14408 $cat >try.c <<EOCP
14409#include <unistd.h>
14410#include <math.h>
14411int main (int argc, char *argv[])
14412{
14413 printf ("%d\n", _LIB_VERSION);
14414 return (0);
14415 } /* main */
14416EOCP
14417 set try
14418 if eval $compile; then
14419 foo=`$run ./try`
14420 echo "Yes, it does ($foo)" >&4
14421 d_libm_lib_version="$define"
14422 else
14423 echo "No, it does not (probably harmless)\n" >&4
14424 fi
14425 $rm -f try.* try core core.try.*
14426 ;;
14427
14428 esac
14429
b4eb6b3d
JH
14430: see if link exists
14431set link d_link
14432eval $inlibc
14433
10bc17b6
JH
14434: see if localtime_r exists
14435set localtime_r d_localtime_r
14436eval $inlibc
14437case "$d_localtime_r" in
14438"$define")
d63eadf0 14439 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
14440 case "$d_localtime_r_proto:$usethreads" in
14441 ":define") d_localtime_r_proto=define
a48ec845
JH
14442 set d_localtime_r_proto localtime_r $hdrs
14443 eval $hasproto ;;
14444 *) ;;
14445 esac
14446 case "$d_localtime_r_proto" in
14447 define)
10bc17b6
JH
14448 case "$localtime_r_proto" in
14449 ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14450 ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14451 esac
14452 case "$localtime_r_proto" in
14453 ''|0) try='int localtime_r(const time_t*, struct tm*);'
14454 ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14455 esac
14456 case "$localtime_r_proto" in
90e831dc 14457 ''|0) d_localtime_r=undef
10bc17b6 14458 localtime_r_proto=0
a48ec845 14459 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14460 * ) case "$localtime_r_proto" in
14461 REENTRANT_PROTO*) ;;
14462 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14463 esac
14464 echo "Prototype: $try" ;;
14465 esac
14466 ;;
c18e646a
JH
14467 *) case "$usethreads" in
14468 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14469 esac
90e831dc
SB
14470 d_localtime_r=undef
14471 localtime_r_proto=0
c18e646a 14472 ;;
a48ec845
JH
14473 esac
14474 ;;
10bc17b6
JH
14475*) localtime_r_proto=0
14476 ;;
14477esac
14478
b4eb6b3d
JH
14479: see if localeconv exists
14480set localeconv d_locconv
14481eval $inlibc
14482
14483: see if lockf exists
14484set lockf d_lockf
14485eval $inlibc
14486
b4eb6b3d
JH
14487: see if prototype for lseek is available
14488echo " "
4786929f 14489set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
b4eb6b3d
JH
14490eval $hasproto
14491
14492: see if lstat exists
14493set lstat d_lstat
14494eval $inlibc
14495
14496: see if madvise exists
14497set madvise d_madvise
14498eval $inlibc
14499
7dd121ae
MB
14500: see if malloc_size exists
14501set malloc_size d_malloc_size
14502eval $inlibc
14503
14504: see if malloc_size_good exists
14505set malloc_good_size d_malloc_good_size
14506eval $inlibc
14507
b4eb6b3d
JH
14508: see if mblen exists
14509set mblen d_mblen
14510eval $inlibc
14511
14512: see if mbstowcs exists
14513set mbstowcs d_mbstowcs
14514eval $inlibc
14515
14516: see if mbtowc exists
14517set mbtowc d_mbtowc
14518eval $inlibc
14519
14520: see if memchr exists
14521set memchr d_memchr
14522eval $inlibc
14523
14524: see if memcmp exists
14525set memcmp d_memcmp
14526eval $inlibc
14527
14528: see if memcpy exists
14529set memcpy d_memcpy
14530eval $inlibc
14531
14532: see if memmove exists
14533set memmove d_memmove
14534eval $inlibc
14535
14536: see if memset exists
14537set memset d_memset
14538eval $inlibc
14539
14540: see if mkdir exists
14541set mkdir d_mkdir
14542eval $inlibc
14543
14544: see if mkdtemp exists
14545set mkdtemp d_mkdtemp
14546eval $inlibc
14547
14548: see if mkfifo exists
14549set mkfifo d_mkfifo
14550eval $inlibc
14551
14552: see if mkstemp exists
14553set mkstemp d_mkstemp
14554eval $inlibc
14555
14556: see if mkstemps exists
14557set mkstemps d_mkstemps
14558eval $inlibc
14559
14560: see if mktime exists
14561set mktime d_mktime
14562eval $inlibc
14563
14564: see if this is a sys/mman.h system
14565set sys/mman.h i_sysmman
14566eval $inhdr
14567
14568: see if mmap exists
14569set mmap d_mmap
14570eval $inlibc
14571: see what shmat returns
14572: default to something harmless
14573mmaptype='void *'
14574case "$i_sysmman$d_mmap" in
14575"$define$define")
14576 $cat >mmap.c <<'END'
14577#include <sys/mman.h>
14578void *mmap();
14579END
14580 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14581 mmaptype='void *'
14582 else
14583 mmaptype='caddr_t'
14584 fi
14585 echo "and it returns ($mmaptype)." >&4
14586 ;;
14587esac
14588
14589
14590
89ce900e
JH
14591: see if sqrtl exists
14592set sqrtl d_sqrtl
14593eval $inlibc
14594
af1ff193
JH
14595: see if scalbnl exists
14596set scalbnl d_scalbnl
14597eval $inlibc
14598
89ce900e
JH
14599: see if modfl exists
14600set modfl d_modfl
14601eval $inlibc
14602
14603: see if prototype for modfl is available
14604echo " "
3a794506 14605set d_modflproto modfl $i_math math.h
89ce900e
JH
14606eval $hasproto
14607
14608d_modfl_pow32_bug="$undef"
14609
14610case "$d_longdbl$d_modfl" in
14611$define$define)
14612 $cat <<EOM
14613Checking to see whether your modfl() is okay for large values...
14614EOM
14615$cat >try.c <<EOCP
14616#include <math.h>
14617#include <stdio.h>
14618EOCP
14619if $test "X$d_modflproto" != "X$define"; then
14620 $cat >>try.c <<EOCP
14621/* Sigh. many current glibcs provide the function, but do not prototype it. */
14622long double modfl (long double, long double *);
14623EOCP
14624fi
14625$cat >>try.c <<EOCP
14626int main() {
14627 long double nv = 4294967303.15;
14628 long double v, w;
14629 v = modfl(nv, &w);
14630#ifdef __GLIBC__
14631 printf("glibc");
14632#endif
14633 printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14634 return 0;
14635}
14636EOCP
14637 case "$osname:$gccversion" in
14638 aix:) saveccflags="$ccflags"
14639 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14640 esac
14641 set try
14642 if eval $compile; then
14643 foo=`$run ./try`
14644 case "$foo" in
14645 *" 4294967303.150000 1.150000 4294967302.000000")
14646 echo >&4 "Your modfl() is broken for large values."
14647 d_modfl_pow32_bug="$define"
14648 case "$foo" in
14649 glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14650 ;;
14651 esac
14652 ;;
14653 *" 4294967303.150000 0.150000 4294967303.000000")
14654 echo >&4 "Your modfl() seems okay for large values."
14655 ;;
14656 *) echo >&4 "I don't understand your modfl() at all."
14657 d_modfl="$undef"
14658 ;;
14659 esac
14660 $rm -f try.* try core core.try.*
14661 else
14662 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14663 d_modfl="$undef"
14664 fi
14665 case "$osname:$gccversion" in
14666 aix:) ccflags="$saveccflags" ;; # restore
14667 esac
14668 ;;
14669esac
14670
14671if $test "$uselongdouble" = "$define"; then
af1ff193
JH
14672 message=""
14673 if $test "$d_sqrtl" != "$define"; then
14674 message="$message sqrtl"
14675 fi
14676 if $test "$d_modfl" != "$define"; then
89ce900e
JH
14677 if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14678 echo "You have both aintl and copysignl, so I can emulate modfl."
14679 else
af1ff193 14680 message="$message modfl"
89ce900e 14681 fi
af1ff193
JH
14682 fi
14683 if $test "$d_frexpl" != "$define"; then
14684 if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14685 echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14686 else
14687 message="$message frexpl"
14688 fi
14689 fi
89ce900e 14690
af1ff193 14691 if $test "$message" != ""; then
89ce900e
JH
14692 $cat <<EOM >&4
14693
14694*** You requested the use of long doubles but you do not seem to have
af1ff193
JH
14695*** the following mathematical functions needed for long double support:
14696*** $message
fe63a0b4
JH
14697*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14698*** Cannot continue, aborting.
89ce900e
JH
14699
14700EOM
14701
fe63a0b4 14702 exit 1
89ce900e
JH
14703 fi
14704fi
14705
b4eb6b3d
JH
14706: see if mprotect exists
14707set mprotect d_mprotect
14708eval $inlibc
14709
14710: see if msgctl exists
14711set msgctl d_msgctl
14712eval $inlibc
14713
14714: see if msgget exists
14715set msgget d_msgget
14716eval $inlibc
14717
14718: see if msgsnd exists
14719set msgsnd d_msgsnd
14720eval $inlibc
14721
14722: see if msgrcv exists
14723set msgrcv d_msgrcv
14724eval $inlibc
14725
14726: see how much of the 'msg*(2)' library is present.
14727h_msg=true
14728echo " "
14729case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14730*"$undef"*) h_msg=false;;
14731esac
14732case "$osname" in
14733freebsd)
14734 case "`ipcs 2>&1`" in
14735 "SVID messages"*"not configured"*)
14736 echo "Your $osname does not have the msg*(2) configured." >&4
14737 h_msg=false
14738 val="$undef"
14739 set msgctl d_msgctl
14740 eval $setvar
14741 set msgget d_msgget
14742 eval $setvar
14743 set msgsnd d_msgsnd
14744 eval $setvar
14745 set msgrcv d_msgrcv
14746 eval $setvar
14747 ;;
14748 esac
14749 ;;
14750esac
14751: we could also check for sys/ipc.h ...
14752if $h_msg && $test `./findhdr sys/msg.h`; then
14753 echo "You have the full msg*(2) library." >&4
14754 val="$define"
14755else
14756 echo "You don't have the full msg*(2) library." >&4
14757 val="$undef"
14758fi
14759set d_msg
14760eval $setvar
14761
4e0554ec
JH
14762
14763echo " "
14764echo "Checking to see if your system supports struct msghdr..." >&4
14765set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14766eval $hasstruct
14767case "$d_msghdr_s" in
14768"$define") echo "Yes, it does." ;;
14769*) echo "No, it doesn't." ;;
14770esac
14771
14772
b4eb6b3d
JH
14773: see if msync exists
14774set msync d_msync
14775eval $inlibc
14776
14777: see if munmap exists
14778set munmap d_munmap
14779eval $inlibc
14780
14781: see if nice exists
14782set nice d_nice
14783eval $inlibc
14784
2765b840
JH
14785: see if this is a langinfo.h system
14786set langinfo.h i_langinfo
14787eval $inhdr
14788
14789: see if nl_langinfo exists
14790set nl_langinfo d_nl_langinfo
14791eval $inlibc
14792
b4eb6b3d
JH
14793: check for length of character
14794echo " "
14795case "$charsize" in
14796'')
14797 echo "Checking to see how big your characters are (hey, you never know)..." >&4
74d00865 14798 $cat >try.c <<EOCP
b4eb6b3d 14799#include <stdio.h>
d1daaddf
JH
14800#$i_stdlib I_STDLIB
14801#ifdef I_STDLIB
14802#include <stdlib.h>
14803#endif
b4eb6b3d
JH
14804int main()
14805{
14806 printf("%d\n", (int)sizeof(char));
14807 exit(0);
14808}
14809EOCP
14810 set try
14811 if eval $compile_ok; then
5440bc8e 14812 dflt=`$run ./try`
b4eb6b3d
JH
14813 else
14814 dflt='1'
14815 echo "(I can't seem to compile the test program. Guessing...)"
14816 fi
14817 ;;
14818*)
14819 dflt="$charsize"
14820 ;;
14821esac
14822rp="What is the size of a character (in bytes)?"
14823. ./myread
14824charsize="$ans"
14825$rm -f try.c try
14826
1d1be0dc
NC
14827: check for volatile keyword
14828echo " "
14829echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14830$cat >try.c <<'EOCP'
76f47787 14831int main()
1d1be0dc
NC
14832{
14833 typedef struct _goo_struct goo_struct;
14834 goo_struct * volatile goo = ((goo_struct *)0);
14835 struct _goo_struct {
14836 long long_int;
14837 int reg_int;
14838 char char_var;
14839 };
14840 typedef unsigned short foo_t;
14841 char *volatile foo;
14842 volatile int bar;
14843 volatile foo_t blech;
14844 foo = foo;
14845}
14846EOCP
14847if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14848 val="$define"
14849 echo "Yup, it does."
14850else
14851 val="$undef"
14852 echo "Nope, it doesn't."
14853fi
14854set d_volatile
14855eval $setvar
14856$rm -f try.*
14857
b4eb6b3d
JH
14858
14859echo " "
14860$echo "Choosing the C types to be used for Perl's internal types..." >&4
14861
14862case "$use64bitint:$d_quad:$quadtype" in
14863define:define:?*)
14864 ivtype="$quadtype"
14865 uvtype="$uquadtype"
14866 ivsize=8
14867 uvsize=8
14868 ;;
14869*) ivtype="long"
14870 uvtype="unsigned long"
14871 ivsize=$longsize
14872 uvsize=$longsize
14873 ;;
14874esac
14875
14876case "$uselongdouble:$d_longdbl" in
14877define:define)
14878 nvtype="long double"
14879 nvsize=$longdblsize
14880 ;;
14881*) nvtype=double
14882 nvsize=$doublesize
14883 ;;
14884esac
14885
14886$echo "(IV will be "$ivtype", $ivsize bytes)"
14887$echo "(UV will be "$uvtype", $uvsize bytes)"
14888$echo "(NV will be "$nvtype", $nvsize bytes)"
14889
14890$cat >try.c <<EOCP
14891#$i_inttypes I_INTTYPES
14892#ifdef I_INTTYPES
14893#include <inttypes.h>
14894#endif
14895#include <stdio.h>
14896int main() {
14897#ifdef INT8
14898 int8_t i = INT8_MAX;
14899 uint8_t u = UINT8_MAX;
14900 printf("int8_t\n");
14901#endif
14902#ifdef INT16
14903 int16_t i = INT16_MAX;
14904 uint16_t i = UINT16_MAX;
14905 printf("int16_t\n");
14906#endif
14907#ifdef INT32
14908 int32_t i = INT32_MAX;
14909 uint32_t u = UINT32_MAX;
14910 printf("int32_t\n");
14911#endif
14912}
14913EOCP
14914
14915case "$i8type" in
14916'') case "$charsize" in
14917 1) i8type=char
14918 u8type="unsigned char"
14919 i8size=$charsize
14920 u8size=$charsize
14921 ;;
14922 esac
14923 ;;
14924esac
14925case "$i8type" in
14926'') set try -DINT8
14927 if eval $compile; then
5440bc8e 14928 case "`$run ./try`" in
b4eb6b3d
JH
14929 int8_t) i8type=int8_t
14930 u8type=uint8_t
14931 i8size=1
14932 u8size=1
14933 ;;
14934 esac
14935 fi
14936 ;;
14937esac
14938case "$i8type" in
14939'') if $test $charsize -ge 1; then
14940 i8type=char
14941 u8type="unsigned char"
14942 i8size=$charsize
14943 u8size=$charsize
14944 fi
14945 ;;
14946esac
14947
14948case "$i16type" in
14949'') case "$shortsize" in
14950 2) i16type=short
14951 u16type="unsigned short"
14952 i16size=$shortsize
14953 u16size=$shortsize
14954 ;;
14955 esac
14956 ;;
14957esac
14958case "$i16type" in
14959'') set try -DINT16
14960 if eval $compile; then
5440bc8e 14961 case "`$run ./try`" in
b4eb6b3d
JH
14962 int16_t)
14963 i16type=int16_t
14964 u16type=uint16_t
14965 i16size=2
14966 u16size=2
14967 ;;
14968 esac
14969 fi
14970 ;;
14971esac
14972case "$i16type" in
14973'') if $test $shortsize -ge 2; then
14974 i16type=short
14975 u16type="unsigned short"
14976 i16size=$shortsize
14977 u16size=$shortsize
14978 fi
14979 ;;
14980esac
14981
14982case "$i32type" in
14983'') case "$longsize" in
14984 4) i32type=long
14985 u32type="unsigned long"
14986 i32size=$longsize
14987 u32size=$longsize
14988 ;;
14989 *) case "$intsize" in
14990 4) i32type=int
14991 u32type="unsigned int"
14992 i32size=$intsize
14993 u32size=$intsize
14994 ;;
14995 esac
14996 ;;
14997 esac
14998 ;;
14999esac
15000case "$i32type" in
15001'') set try -DINT32
15002 if eval $compile; then
5440bc8e 15003 case "`$run ./try`" in
b4eb6b3d
JH
15004 int32_t)
15005 i32type=int32_t
15006 u32type=uint32_t
15007 i32size=4
15008 u32size=4
15009 ;;
15010 esac
15011 fi
15012 ;;
15013esac
15014case "$i32type" in
15015'') if $test $intsize -ge 4; then
15016 i32type=int
15017 u32type="unsigned int"
15018 i32size=$intsize
15019 u32size=$intsize
15020 fi
15021 ;;
15022esac
15023
15024case "$i64type" in
15025'') case "$d_quad:$quadtype" in
15026 define:?*)
15027 i64type="$quadtype"
15028 u64type="$uquadtype"
15029 i64size=8
15030 u64size=8
15031 ;;
15032 esac
15033 ;;
15034esac
15035
1d1be0dc
NC
15036$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15037: volatile so that the compiler has to store it out to memory.
15038if test X"$d_volatile" = X"$define"; then
15039 volatile=volatile
15040fi
b4eb6b3d
JH
15041$cat <<EOP >try.c
15042#include <stdio.h>
55954f19
JH
15043#$i_stdlib I_STDLIB
15044#ifdef I_STDLIB
15045#include <stdlib.h>
15046#endif
1d1be0dc
NC
15047#include <sys/types.h>
15048#include <signal.h>
15049#ifdef SIGFPE
15050$volatile int bletched = 0;
15051$signal_t blech(s) int s; { bletched = 1; }
15052#endif
b4eb6b3d
JH
15053int main() {
15054 $uvtype u = 0;
1d1be0dc 15055 $nvtype d;
b4eb6b3d
JH
15056 int n = 8 * $uvsize;
15057 int i;
1d1be0dc
NC
15058#ifdef SIGFPE
15059 signal(SIGFPE, blech);
15060#endif
15061
b4eb6b3d
JH
15062 for (i = 0; i < n; i++) {
15063 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
15064 d = ($nvtype)u;
15065 if (($uvtype)d != u)
b4eb6b3d 15066 break;
1d1be0dc
NC
15067 if (d <= 0)
15068 break;
15069 d = ($nvtype)(u - 1);
15070 if (($uvtype)d != (u - 1))
15071 break;
15072#ifdef SIGFPE
15073 if (bletched) {
15074 break;
15075#endif
15076 }
b4eb6b3d 15077 }
efd1522b 15078 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
15079 exit(0);
15080}
15081EOP
1d1be0dc
NC
15082set try
15083
15084d_nv_preserves_uv="$undef"
15085if eval $compile; then
53133ed1 15086 nv_preserves_uv_bits="`$run ./try`"
1d1be0dc 15087fi
53133ed1 15088case "$nv_preserves_uv_bits" in
1d1be0dc 15089\-[1-9]*)
53133ed1
NC
15090 nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15091 $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc 15092 d_nv_preserves_uv="$define"
b4eb6b3d 15093 ;;
53133ed1 15094[1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc
NC
15095 d_nv_preserves_uv="$undef" ;;
15096*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
53133ed1 15097 nv_preserves_uv_bits="$undef" ;;
b4eb6b3d
JH
15098esac
15099
1d1be0dc
NC
15100$rm -f try.* try
15101
f607920a
CB
15102$echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15103: volatile so that the compiler has to store it out to memory.
15104if test X"$d_volatile" = X"$define"; then
15105 volatile=volatile
15106fi
15107$cat <<EOP >try.c
15108#include <stdio.h>
15109#$i_stdlib I_STDLIB
15110#ifdef I_STDLIB
15111#include <stdlib.h>
15112#endif
15113#$i_string I_STRING
15114#ifdef I_STRING
15115# include <string.h>
15116#else
15117# include <strings.h>
15118#endif
15119#include <sys/types.h>
15120#include <signal.h>
15121#ifdef SIGFPE
15122$volatile int bletched = 0;
15123$signal_t blech(s) int s; { bletched = 1; }
15124#endif
15125
15126int checkit($nvtype d, char *where) {
15127 unsigned char *p = (char *)&d;
15128 unsigned char *end = p + sizeof(d);
15129 int fail = 0;
15130
15131 while (p < end)
15132 fail += *p++;
15133
15134 if (!fail)
17f6277d 15135 return 0;
f607920a
CB
15136
15137 p = (char *)&d;
15138 printf("No - %s: 0x", where);
15139 while (p < end)
15140 printf ("%02X", *p++);
15141 printf("\n");
15142 return 1;
15143}
15144
15145int main(int argc, char **argv) {
15146 $nvtype d = 0.0;
15147 int fail = 0;
15148 fail += checkit(d, "0.0");
15149
15150 /* The compiler shouldn't be assuming that bletched is 0 */
15151 d = bletched;
15152
15153 fail += checkit(d, "bleched");
15154
15155#ifdef SIGFPE
15156 signal(SIGFPE, blech);
15157#endif
15158
15159 /* Paranoia - the compiler should have no way of knowing that ANSI says
15160 that argv[argc] will always be NULL. Actually, if it did assume this it
15161 would be buggy, as this is C and main() can be called from elsewhere in
15162 the program. */
15163 d = argv[argc] ? 1 : 0;
15164
15165 if (d) {
15166 printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15167 }
15168
15169 fail += checkit(d, "ternary");
15170
15171 memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15172
15173 if (d != 0.0) {
15174 printf("No - memset doesn't give 0.0\n");
15175 /* This might just blow up: */
15176 printf("(gives %g)\n", d);
15177 return 1;
15178 }
15179
15180#ifdef SIGFPE
15181 if (bletched) {
15182 printf("No - something bleched\n");
15183 return 1;
15184 }
15185#endif
15186 if (fail) {
15187 printf("No - %d fail(s)\n", fail);
15188 return 1;
15189 }
15190 printf("Yes\n");
15191 return 0;
15192}
15193EOP
15194set try
15195
15196d_nv_zero_is_allbits_zero="$undef"
15197if eval $compile; then
15198 xxx="`$run ./try`"
15199 case "$?" in
15200 0)
15201 case "$xxx" in
15202 Yes) cat >&4 <<EOM
152030.0 is represented as all bits zero in memory
15204EOM
15205 d_nv_zero_is_allbits_zero="$define"
15206 ;;
15207 *) cat >&4 <<EOM
152080.0 is not represented as all bits zero in memory
15209EOM
15210 d_nv_zero_is_allbits_zero="$undef"
15211 ;;
15212 esac
15213 ;;
15214 *) cat >&4 <<EOM
152150.0 is not represented as all bits zero in memory
15216EOM
15217 d_nv_zero_is_allbits_zero="$undef"
15218 ;;
15219 esac
15220fi
15221
15222$rm -f try.* try
15223
b4eb6b3d
JH
15224
15225: check for off64_t
15226echo " "
15227echo "Checking to see if you have off64_t..." >&4
15228$cat >try.c <<EOCP
15229#include <sys/types.h>
15230#include <unistd.h>
15231int main() { off64_t x = 7; }
15232EOCP
15233set try
15234if eval $compile; then
15235 val="$define"
15236 echo "You have off64_t."
15237else
15238 val="$undef"
15239 echo "You do not have off64_t."
15240 case "$lseeksize" in
15241 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15242 esac
15243fi
15244$rm -f try.* try
15245set d_off64_t
15246eval $setvar
15247
b4eb6b3d
JH
15248: how to create joinable pthreads
15249if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15250 echo " "
15251 echo "Checking what constant to use for creating joinable pthreads..." >&4
15252 $cat >try.c <<'EOCP'
15253#include <pthread.h>
15254int main() {
15255 int detachstate = JOINABLE;
15256}
15257EOCP
15258 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15259 if eval $compile; then
15260 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15261 val="$undef" # Yes, undef.
15262 set d_old_pthread_create_joinable
15263 eval $setvar
15264 val=""
15265 set old_pthread_create_joinable
15266 eval $setvar
15267 else
15268 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15269 if eval $compile; then
15270 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15271 val="$define"
15272 set d_old_pthread_create_joinable
15273 eval $setvar
15274 val=PTHREAD_CREATE_UNDETACHED
15275 set old_pthread_create_joinable
15276 eval $setvar
15277 else
15278 set try -DJOINABLE=__UNDETACHED
15279 if eval $compile; then
15280 echo "You seem to use __UNDETACHED." >&4
15281 val="$define"
15282 set d_old_pthread_create_joinable
15283 eval $setvar
15284 val=__UNDETACHED
15285 set old_pthread_create_joinable
15286 eval $setvar
15287 else
15288 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
15289 val="$define"
15290 set d_old_pthread_create_joinable
15291 eval $setvar
15292 val=0
15293 set old_pthread_create_joinable
15294 eval $setvar
15295 fi
15296 fi
15297 fi
15298 $rm -f try try.*
15299else
15300 d_old_pthread_create_joinable="$undef"
15301 old_pthread_create_joinable=""
15302fi
15303
15304: see if pause exists
15305set pause d_pause
15306eval $inlibc
15307
15308: see if pipe exists
15309set pipe d_pipe
15310eval $inlibc
15311
15312: see if poll exists
15313set poll d_poll
15314eval $inlibc
15315
c7aff470
NIS
15316: see if readlink exists
15317set readlink d_readlink
15318eval $inlibc
15319
15320echo " "
f24dbf84 15321procselfexe=''
c7aff470 15322val="$undef"
a33c94aa
JH
15323case "$d_readlink" in
15324"$define")
c7aff470
NIS
15325 if $issymlink /proc/self/exe ; then
15326 $ls -l /proc/self/exe > reflect
51660ed5 15327 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
a33c94aa 15328 echo "You have Linux-like /proc/self/exe."
92236451 15329 procselfexe='"/proc/self/exe"'
f24dbf84 15330 val="$define"
f24dbf84
JH
15331 fi
15332 fi
15333 if $issymlink /proc/curproc/file ; then
15334 $ls -l /proc/curproc/file > reflect
15335 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15336 echo "You have BSD-like /proc/curproc/file."
92236451 15337 procselfexe='"/proc/curproc/file"'
f24dbf84 15338 val="$define"
c7aff470 15339 fi
c7aff470 15340 fi
a33c94aa
JH
15341 ;;
15342esac
428dc699 15343$rm -f reflect
c7aff470
NIS
15344set d_procselfexe
15345eval $setvar
15346
263fee3f
JH
15347: see whether the pthread_atfork exists
15348$cat >try.c <<EOP
15349#include <pthread.h>
15350#include <stdio.h>
15351int main() {
15352#ifdef PTHREAD_ATFORK
15353 pthread_atfork(NULL,NULL,NULL);
15354#endif
15355}
15356EOP
15357
d6483fcc 15358: see if pthread_atfork exists
263fee3f
JH
15359set try -DPTHREAD_ATFORK
15360if eval $compile; then
15361 val="$define"
15362else
15363 val="$undef"
15364fi
15365case "$usethreads" in
15366$define)
15367 case "$val" in
15368 $define) echo 'pthread_atfork found.' >&4 ;;
15369 *) echo 'pthread_atfork NOT found.' >&4 ;;
15370 esac
15371esac
15372set d_pthread_atfork
15373eval $setvar
d6483fcc 15374
58d975c3
JH
15375: see if pthread_attr_setscope exists
15376set pthread_attr_setscope d_pthread_attr_setscope
15377eval $inlibc
15378
b4eb6b3d
JH
15379
15380: see whether the various POSIXish _yields exist
15381$cat >try.c <<EOP
15382#include <pthread.h>
15383#include <stdio.h>
15384int main() {
15385#ifdef SCHED_YIELD
15386 sched_yield();
15387#else
15388#ifdef PTHREAD_YIELD
15389 pthread_yield();
15390#else
15391#ifdef PTHREAD_YIELD_NULL
15392 pthread_yield(NULL);
15393#endif
15394#endif
15395#endif
15396}
15397EOP
15398: see if sched_yield exists
15399set try -DSCHED_YIELD
15400if eval $compile; then
15401 val="$define"
15402 sched_yield='sched_yield()'
15403else
15404 val="$undef"
15405fi
15406case "$usethreads" in
15407$define)
15408 case "$val" in
15409 $define) echo 'sched_yield() found.' >&4 ;;
15410 *) echo 'sched_yield() NOT found.' >&4 ;;
15411 esac
15412esac
10bc17b6
JH
15413set d_sched_yield
15414eval $setvar
b4eb6b3d 15415
10bc17b6
JH
15416: see if pthread_yield exists
15417set try -DPTHREAD_YIELD
15418if eval $compile; then
15419 val="$define"
15420 case "$sched_yield" in
15421 '') sched_yield='pthread_yield()' ;;
15422 esac
15423else
15424 set try -DPTHREAD_YIELD_NULL
15425 if eval $compile; then
15426 val="$define"
15427 case "$sched_yield" in
15428 '') sched_yield='pthread_yield(NULL)' ;;
15429 esac
15430 else
15431 val="$undef"
15432 fi
15433fi
15434case "$usethreads" in
15435$define)
15436 case "$val" in
15437 $define) echo 'pthread_yield() found.' >&4 ;;
15438 *) echo 'pthread_yield() NOT found.' >&4 ;;
15439 esac
15440 ;;
15441esac
15442set d_pthread_yield
15443eval $setvar
b4eb6b3d 15444
10bc17b6
JH
15445case "$sched_yield" in
15446'') sched_yield=undef ;;
15447esac
b4eb6b3d 15448
10bc17b6
JH
15449$rm -f try try.*
15450
15451: see if random_r exists
15452set random_r d_random_r
15453eval $inlibc
15454case "$d_random_r" in
15455"$define")
15456 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
15457 case "$d_random_r_proto:$usethreads" in
15458 ":define") d_random_r_proto=define
a48ec845
JH
15459 set d_random_r_proto random_r $hdrs
15460 eval $hasproto ;;
15461 *) ;;
15462 esac
15463 case "$d_random_r_proto" in
15464 define)
10bc17b6
JH
15465 case "$random_r_proto" in
15466 ''|0) try='int random_r(int*, struct random_data*);'
a845a0d4
JH
15467 ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15468 esac
15469 case "$random_r_proto" in
15470 ''|0) try='int random_r(long*, struct random_data*);'
15471 ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15472 esac
15473 case "$random_r_proto" in
15474 ''|0) try='int random_r(struct random_data*, int32_t*);'
15475 ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
10bc17b6
JH
15476 esac
15477 case "$random_r_proto" in
90e831dc 15478 ''|0) d_random_r=undef
10bc17b6 15479 random_r_proto=0
a48ec845 15480 echo "Disabling random_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15481 * ) case "$random_r_proto" in
15482 REENTRANT_PROTO*) ;;
15483 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15484 esac
15485 echo "Prototype: $try" ;;
15486 esac
b4eb6b3d 15487 ;;
c18e646a
JH
15488 *) case "$usethreads" in
15489 define) echo "random_r has no prototype, not using it." >&4 ;;
15490 esac
90e831dc
SB
15491 d_random_r=undef
15492 random_r_proto=0
c18e646a 15493 ;;
a48ec845
JH
15494 esac
15495 ;;
10bc17b6 15496*) random_r_proto=0
b4eb6b3d
JH
15497 ;;
15498esac
15499
15500: see if readdir and friends exist
15501set readdir d_readdir
15502eval $inlibc
15503set seekdir d_seekdir
15504eval $inlibc
15505set telldir d_telldir
15506eval $inlibc
15507set rewinddir d_rewinddir
15508eval $inlibc
15509
10bc17b6
JH
15510: see if readdir64_r exists
15511set readdir64_r d_readdir64_r
15512eval $inlibc
15513case "$d_readdir64_r" in
15514"$define")
15515 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
15516 case "$d_readdir64_r_proto:$usethreads" in
15517 ":define") d_readdir64_r_proto=define
a48ec845
JH
15518 set d_readdir64_r_proto readdir64_r $hdrs
15519 eval $hasproto ;;
15520 *) ;;
15521 esac
15522 case "$d_readdir64_r_proto" in
15523 define)
10bc17b6
JH
15524 case "$readdir64_r_proto" in
15525 ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15526 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15527 esac
15528 case "$readdir64_r_proto" in
15529 ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15530 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15531 esac
15532 case "$readdir64_r_proto" in
90e831dc 15533 ''|0) d_readdir64_r=undef
10bc17b6 15534 readdir64_r_proto=0
a48ec845 15535 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15536 * ) case "$readdir64_r_proto" in
15537 REENTRANT_PROTO*) ;;
15538 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15539 esac
15540 echo "Prototype: $try" ;;
15541 esac
15542 ;;
c18e646a
JH
15543 *) case "$usethreads" in
15544 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15545 esac
90e831dc
SB
15546 d_readdir64_r=undef
15547 readdir64_r_proto=0
c18e646a 15548 ;;
a48ec845
JH
15549 esac
15550 ;;
10bc17b6
JH
15551*) readdir64_r_proto=0
15552 ;;
15553esac
15554
15555: see if readdir_r exists
15556set readdir_r d_readdir_r
15557eval $inlibc
15558case "$d_readdir_r" in
15559"$define")
15560 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
15561 case "$d_readdir_r_proto:$usethreads" in
15562 ":define") d_readdir_r_proto=define
a48ec845
JH
15563 set d_readdir_r_proto readdir_r $hdrs
15564 eval $hasproto ;;
15565 *) ;;
15566 esac
15567 case "$d_readdir_r_proto" in
15568 define)
10bc17b6
JH
15569 case "$readdir_r_proto" in
15570 ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15571 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15572 esac
15573 case "$readdir_r_proto" in
15574 ''|0) try='int readdir_r(DIR*, struct dirent*);'
15575 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15576 esac
15577 case "$readdir_r_proto" in
90e831dc 15578 ''|0) d_readdir_r=undef
10bc17b6 15579 readdir_r_proto=0
a48ec845 15580 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15581 * ) case "$readdir_r_proto" in
15582 REENTRANT_PROTO*) ;;
15583 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15584 esac
15585 echo "Prototype: $try" ;;
15586 esac
15587 ;;
c18e646a
JH
15588 *) case "$usethreads" in
15589 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15590 esac
90e831dc
SB
15591 d_readdir_r=undef
15592 readdir_r_proto=0
c18e646a 15593 ;;
a48ec845
JH
15594 esac
15595 ;;
10bc17b6
JH
15596*) readdir_r_proto=0
15597 ;;
15598esac
15599
4e0554ec
JH
15600: see if readv exists
15601set readv d_readv
15602eval $inlibc
15603
15604: see if recvmsg exists
15605set recvmsg d_recvmsg
15606eval $inlibc
15607
b4eb6b3d
JH
15608: see if rename exists
15609set rename d_rename
15610eval $inlibc
15611
15612: see if rmdir exists
15613set rmdir d_rmdir
15614eval $inlibc
15615
15616: see if memory.h is available.
15617val=''
15618set memory.h val
15619eval $inhdr
15620
15621: See if it conflicts with string.h
15622case "$val" in
15623$define)
15624 case "$strings" in
15625 '') ;;
15626 *)
15627 $cppstdin $cppflags $cppminus < $strings > mem.h
15628 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15629 echo " "
15630 echo "We won't be including <memory.h>."
15631 val="$undef"
15632 fi
15633 $rm -f mem.h
15634 ;;
15635 esac
15636esac
15637set i_memory
15638eval $setvar
15639
15640: can bcopy handle overlapping blocks?
b6cc3bc4 15641echo " "
b4eb6b3d 15642val="$undef"
b6cc3bc4
AD
15643case "$d_memmove" in
15644"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15645*) case "$d_bcopy" in
15646 "$define")
15647 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15648 $cat >try.c <<EOCP
b4eb6b3d
JH
15649#$i_memory I_MEMORY
15650#$i_stdlib I_STDLIB
15651#$i_string I_STRING
15652#$i_unistd I_UNISTD
15653EOCP
15654 $cat >>try.c <<'EOCP'
15655#include <stdio.h>
15656#ifdef I_MEMORY
15657# include <memory.h>
15658#endif
15659#ifdef I_STDLIB
15660# include <stdlib.h>
15661#endif
15662#ifdef I_STRING
15663# include <string.h>
15664#else
15665# include <strings.h>
15666#endif
15667#ifdef I_UNISTD
15668# include <unistd.h> /* Needed for NetBSD */
15669#endif
15670int main()
15671{
15672char buf[128], abc[128];
15673char *b;
15674int len;
15675int off;
15676int align;
15677
b6cc3bc4
AD
15678/* Copy "abcde..." string to char abc[] so that gcc doesn't
15679 try to store the string in read-only memory. */
b4eb6b3d
JH
15680bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15681
15682for (align = 7; align >= 0; align--) {
15683 for (len = 36; len; len--) {
15684 b = buf+align;
15685 bcopy(abc, b, len);
15686 for (off = 1; off <= len; off++) {
15687 bcopy(b, b+off, len);
15688 bcopy(b+off, b, len);
15689 if (bcmp(b, abc, len))
15690 exit(1);
15691 }
15692 }
15693}
15694exit(0);
15695}
15696EOCP
b6cc3bc4
AD
15697 set try
15698 if eval $compile_ok; then
15699 if ./try 2>/dev/null; then
15700 echo "Yes, it can."
15701 val="$define"
15702 else
15703 echo "It can't, sorry."
15704 fi
b4eb6b3d 15705 else
b6cc3bc4 15706 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 15707 fi
b6cc3bc4
AD
15708 ;;
15709 esac
15710 $rm -f try.* try core
b4eb6b3d
JH
15711 ;;
15712esac
b4eb6b3d
JH
15713set d_safebcpy
15714eval $setvar
15715
15716: can memcpy handle overlapping blocks?
b6cc3bc4 15717echo " "
b4eb6b3d 15718val="$undef"
b6cc3bc4
AD
15719case "$d_memmove" in
15720"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15721*) case "$d_memcpy" in
15722 "$define")
15723 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15724 $cat >try.c <<EOCP
b4eb6b3d
JH
15725#$i_memory I_MEMORY
15726#$i_stdlib I_STDLIB
15727#$i_string I_STRING
15728#$i_unistd I_UNISTD
15729EOCP
15730 $cat >>try.c <<'EOCP'
15731#include <stdio.h>
15732#ifdef I_MEMORY
15733# include <memory.h>
15734#endif
15735#ifdef I_STDLIB
15736# include <stdlib.h>
15737#endif
15738#ifdef I_STRING
15739# include <string.h>
15740#else
15741# include <strings.h>
15742#endif
15743#ifdef I_UNISTD
15744# include <unistd.h> /* Needed for NetBSD */
15745#endif
15746int main()
15747{
15748char buf[128], abc[128];
15749char *b;
15750int len;
15751int off;
15752int align;
15753
15754/* Copy "abcde..." string to char abc[] so that gcc doesn't
15755 try to store the string in read-only memory. */
15756memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15757
15758for (align = 7; align >= 0; align--) {
15759 for (len = 36; len; len--) {
15760 b = buf+align;
15761 memcpy(b, abc, len);
15762 for (off = 1; off <= len; off++) {
15763 memcpy(b+off, b, len);
15764 memcpy(b, b+off, len);
15765 if (memcmp(b, abc, len))
15766 exit(1);
15767 }
15768 }
15769}
15770exit(0);
15771}
15772EOCP
b6cc3bc4
AD
15773 set try
15774 if eval $compile_ok; then
15775 if ./try 2>/dev/null; then
15776 echo "Yes, it can."
15777 val="$define"
15778 else
15779 echo "It can't, sorry."
15780 fi
b4eb6b3d 15781 else
b6cc3bc4 15782 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 15783 fi
b6cc3bc4
AD
15784 ;;
15785 esac
15786 $rm -f try.* try core
b4eb6b3d
JH
15787 ;;
15788esac
b4eb6b3d
JH
15789set d_safemcpy
15790eval $setvar
15791
15792: can memcmp be trusted to compare relative magnitude?
15793val="$undef"
15794case "$d_memcmp" in
15795"$define")
15796 echo " "
15797 echo "Checking if your memcmp() can compare relative magnitude..." >&4
15798 $cat >try.c <<EOCP
15799#$i_memory I_MEMORY
15800#$i_stdlib I_STDLIB
15801#$i_string I_STRING
15802#$i_unistd I_UNISTD
15803EOCP
15804 $cat >>try.c <<'EOCP'
15805#include <stdio.h>
15806#ifdef I_MEMORY
15807# include <memory.h>
15808#endif
15809#ifdef I_STDLIB
36adc09b 15810# include <stdlib.h>
b4eb6b3d
JH
15811#endif
15812#ifdef I_STRING
15813# include <string.h>
15814#else
15815# include <strings.h>
15816#endif
15817#ifdef I_UNISTD
15818# include <unistd.h> /* Needed for NetBSD */
15819#endif
15820int main()
15821{
15822char a = -1;
15823char b = 0;
15824if ((a < b) && memcmp(&a, &b, 1) < 0)
15825 exit(1);
15826exit(0);
15827}
15828EOCP
15829 set try
15830 if eval $compile_ok; then
5440bc8e 15831 if $run ./try 2>/dev/null; then
b4eb6b3d
JH
15832 echo "Yes, it can."
15833 val="$define"
15834 else
15835 echo "No, it can't (it uses signed chars)."
15836 fi
15837 else
15838 echo "(I can't compile the test program, so we'll assume not...)"
15839 fi
15840 ;;
15841esac
15842$rm -f try.* try core
15843set d_sanemcmp
15844eval $setvar
15845
ef9f17be
JH
15846: see if prototype for sbrk is available
15847echo " "
15848set d_sbrkproto sbrk $i_unistd unistd.h
15849eval $hasproto
15850
b4eb6b3d
JH
15851: see if select exists
15852set select d_select
15853eval $inlibc
15854
15855: see if semctl exists
15856set semctl d_semctl
15857eval $inlibc
15858
15859: see if semget exists
15860set semget d_semget
15861eval $inlibc
15862
15863: see if semop exists
15864set semop d_semop
15865eval $inlibc
15866
15867: see how much of the 'sem*(2)' library is present.
15868h_sem=true
15869echo " "
15870case "$d_semctl$d_semget$d_semop" in
15871*"$undef"*) h_sem=false;;
15872esac
15873case "$osname" in
15874freebsd)
15875 case "`ipcs 2>&1`" in
15876 "SVID messages"*"not configured"*)
15877 echo "Your $osname does not have the sem*(2) configured." >&4
15878 h_sem=false
15879 val="$undef"
15880 set semctl d_semctl
15881 eval $setvar
15882 set semget d_semget
15883 eval $setvar
15884 set semop d_semop
15885 eval $setvar
15886 ;;
15887 esac
15888 ;;
15889esac
15890: we could also check for sys/ipc.h ...
15891if $h_sem && $test `./findhdr sys/sem.h`; then
15892 echo "You have the full sem*(2) library." >&4
15893 val="$define"
15894else
15895 echo "You don't have the full sem*(2) library." >&4
15896 val="$undef"
15897fi
15898set d_sem
15899eval $setvar
15900
15901: see whether sys/sem.h defines union semun
15902echo " "
15903$cat > try.c <<'END'
15904#include <sys/types.h>
15905#include <sys/ipc.h>
15906#include <sys/sem.h>
15907int main () { union semun semun; semun.buf = 0; }
15908END
15909set try
15910if eval $compile; then
15911 echo "You have union semun in <sys/sem.h>." >&4
15912 val="$define"
15913else
15914 echo "You do not have union semun in <sys/sem.h>." >&4
15915 val="$undef"
15916fi
2fad75a1 15917$rm -f try try.c
b4eb6b3d
JH
15918set d_union_semun
15919eval $setvar
15920
15921: see how to do semctl IPC_STAT
15922case "$d_sem" in
15923$define)
b4eb6b3d
JH
15924 echo " "
15925 $cat > try.h <<END
15926#ifndef S_IRUSR
15927# ifdef S_IREAD
15928# define S_IRUSR S_IREAD
15929# define S_IWUSR S_IWRITE
15930# define S_IXUSR S_IEXEC
15931# else
15932# define S_IRUSR 0400
15933# define S_IWUSR 0200
15934# define S_IXUSR 0100
15935# endif
15936# define S_IRGRP (S_IRUSR>>3)
15937# define S_IWGRP (S_IWUSR>>3)
15938# define S_IXGRP (S_IXUSR>>3)
15939# define S_IROTH (S_IRUSR>>6)
15940# define S_IWOTH (S_IWUSR>>6)
15941# define S_IXOTH (S_IXUSR>>6)
15942#endif
15943#ifndef S_IRWXU
15944# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15945# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15946# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15947#endif
15948END
2fad75a1 15949 : see whether semctl IPC_STAT can use union semun
2fad75a1
JH
15950 case "$d_semctl_semun" in
15951 '')
35918792 15952 val="$undef"
2fad75a1 15953 $cat > try.c <<END
b4eb6b3d
JH
15954#include <sys/types.h>
15955#include <sys/ipc.h>
15956#include <sys/sem.h>
15957#include <sys/stat.h>
15958#include <stdio.h>
15959#include <errno.h>
15960#include "try.h"
15961#ifndef errno
15962extern int errno;
15963#endif
15964#$d_union_semun HAS_UNION_SEMUN
15965int main() {
15966 union semun
15967#ifndef HAS_UNION_SEMUN
15968 {
15969 int val;
15970 struct semid_ds *buf;
15971 unsigned short *array;
15972 }
15973#endif
15974 arg;
15975 int sem, st;
15976
15977#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15978 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15979 if (sem > -1) {
15980 struct semid_ds argbuf;
15981 arg.buf = &argbuf;
15982# ifdef IPC_STAT
15983 st = semctl(sem, 0, IPC_STAT, arg);
15984 if (st == 0)
15985 printf("semun\n");
15986 else
15987# endif /* IPC_STAT */
15988 printf("semctl IPC_STAT failed: errno = %d\n", errno);
15989# ifdef IPC_RMID
15990 if (semctl(sem, 0, IPC_RMID, arg) != 0)
35918792 15991# endif /* IPC_RMID */
b4eb6b3d
JH
15992 printf("semctl IPC_RMID failed: errno = %d\n", errno);
15993 } else
15994#endif /* IPC_PRIVATE && ... */
15995 printf("semget failed: errno = %d\n", errno);
15996 return 0;
15997}
15998END
2fad75a1
JH
15999 set try
16000 if eval $compile; then
16001 xxx=`$run ./try`
16002 case "$xxx" in
16003 semun) val="$define" ;;
16004 esac
16005 fi
16006 $rm -f try try.c
35918792
YST
16007 set d_semctl_semun
16008 eval $setvar
2fad75a1
JH
16009 ;;
16010 esac
b4eb6b3d
JH
16011 case "$d_semctl_semun" in
16012 $define)
16013 echo "You can use union semun for semctl IPC_STAT." >&4
16014 also='also'
16015 ;;
16016 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
16017 also=''
16018 ;;
16019 esac
16020
16021 : see whether semctl IPC_STAT can use struct semid_ds pointer
2fad75a1
JH
16022 case "$d_semctl_semid_ds" in
16023 '')
35918792 16024 val="$undef"
2fad75a1 16025 $cat > try.c <<'END'
b4eb6b3d
JH
16026#include <sys/types.h>
16027#include <sys/ipc.h>
16028#include <sys/sem.h>
16029#include <sys/stat.h>
16030#include "try.h"
16031#include <stdio.h>
16032#include <errno.h>
16033#ifndef errno
16034extern int errno;
16035#endif
16036int main() {
16037 struct semid_ds arg;
16038 int sem, st;
16039
16040#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16041 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16042 if (sem > -1) {
16043# ifdef IPC_STAT
16044 st = semctl(sem, 0, IPC_STAT, &arg);
16045 if (st == 0)
16046 printf("semid_ds\n");
16047 else
16048# endif /* IPC_STAT */
16049 printf("semctl IPC_STAT failed: errno = %d\n", errno);
16050# ifdef IPC_RMID
16051 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16052# endif /* IPC_RMID */
16053 printf("semctl IPC_RMID failed: errno = %d\n", errno);
16054 } else
16055#endif /* IPC_PRIVATE && ... */
16056 printf("semget failed: errno = %d\n", errno);
16057
16058 return 0;
16059}
16060END
2fad75a1
JH
16061 set try
16062 if eval $compile; then
16063 xxx=`$run ./try`
16064 case "$xxx" in
16065 semid_ds) val="$define" ;;
16066 esac
16067 fi
16068 $rm -f try try.c
35918792
YST
16069 set d_semctl_semid_ds
16070 eval $setvar
2fad75a1
JH
16071 ;;
16072 esac
b4eb6b3d
JH
16073 case "$d_semctl_semid_ds" in
16074 $define)
16075 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16076 ;;
16077 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16078 ;;
16079 esac
16080 $rm -f try.h
16081 ;;
16082*) val="$undef"
16083
16084 # We do not have the full sem*(2) library, so assume we can not
16085 # use either.
16086
16087 set d_semctl_semun
16088 eval $setvar
16089
16090 set d_semctl_semid_ds
16091 eval $setvar
16092 ;;
16093esac
16094
4e0554ec
JH
16095: see if sendmsg exists
16096set sendmsg d_sendmsg
16097eval $inlibc
16098
b4eb6b3d
JH
16099: see if setegid exists
16100set setegid d_setegid
16101eval $inlibc
16102
16103: see if seteuid exists
16104set seteuid d_seteuid
16105eval $inlibc
16106
16107: see if setgrent exists
16108set setgrent d_setgrent
16109eval $inlibc
16110
10bc17b6
JH
16111: see if setgrent_r exists
16112set setgrent_r d_setgrent_r
16113eval $inlibc
16114case "$d_setgrent_r" in
16115"$define")
16116 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
16117 case "$d_setgrent_r_proto:$usethreads" in
16118 ":define") d_setgrent_r_proto=define
a48ec845
JH
16119 set d_setgrent_r_proto setgrent_r $hdrs
16120 eval $hasproto ;;
16121 *) ;;
16122 esac
16123 case "$d_setgrent_r_proto" in
16124 define)
10bc17b6
JH
16125 case "$setgrent_r_proto" in
16126 ''|0) try='int setgrent_r(FILE**);'
16127 ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16128 esac
16129 case "$setgrent_r_proto" in
16130 ''|0) try='void setgrent_r(FILE**);'
16131 ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16132 esac
16133 case "$setgrent_r_proto" in
90e831dc 16134 ''|0) d_setgrent_r=undef
10bc17b6 16135 setgrent_r_proto=0
a48ec845 16136 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16137 * ) case "$setgrent_r_proto" in
16138 REENTRANT_PROTO*) ;;
16139 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16140 esac
16141 echo "Prototype: $try" ;;
16142 esac
16143 ;;
c18e646a
JH
16144 *) case "$usethreads" in
16145 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16146 esac
90e831dc
SB
16147 d_setgrent_r=undef
16148 setgrent_r_proto=0
c18e646a 16149 ;;
a48ec845
JH
16150 esac
16151 ;;
10bc17b6
JH
16152*) setgrent_r_proto=0
16153 ;;
16154esac
16155
b4eb6b3d
JH
16156: see if sethostent exists
16157set sethostent d_sethent
16158eval $inlibc
16159
10bc17b6
JH
16160: see if sethostent_r exists
16161set sethostent_r d_sethostent_r
16162eval $inlibc
16163case "$d_sethostent_r" in
16164"$define")
16165 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16166 case "$d_sethostent_r_proto:$usethreads" in
16167 ":define") d_sethostent_r_proto=define
a48ec845
JH
16168 set d_sethostent_r_proto sethostent_r $hdrs
16169 eval $hasproto ;;
16170 *) ;;
16171 esac
16172 case "$d_sethostent_r_proto" in
16173 define)
10bc17b6
JH
16174 case "$sethostent_r_proto" in
16175 ''|0) try='int sethostent_r(int, struct hostent_data*);'
16176 ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16177 esac
16178 case "$sethostent_r_proto" in
16179 ''|0) try='void sethostent_r(int, struct hostent_data*);'
16180 ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16181 esac
16182 case "$sethostent_r_proto" in
90e831dc 16183 ''|0) d_sethostent_r=undef
10bc17b6 16184 sethostent_r_proto=0
a48ec845 16185 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16186 * ) case "$sethostent_r_proto" in
16187 REENTRANT_PROTO*) ;;
16188 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16189 esac
16190 echo "Prototype: $try" ;;
16191 esac
16192 ;;
c18e646a
JH
16193 *) case "$usethreads" in
16194 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16195 esac
90e831dc
SB
16196 d_sethostent_r=undef
16197 sethostent_r_proto=0
c18e646a 16198 ;;
a48ec845
JH
16199 esac
16200 ;;
10bc17b6
JH
16201*) sethostent_r_proto=0
16202 ;;
16203esac
16204
4e0554ec
JH
16205: see if setitimer exists
16206set setitimer d_setitimer
16207eval $inlibc
16208
b4eb6b3d
JH
16209: see if setlinebuf exists
16210set setlinebuf d_setlinebuf
16211eval $inlibc
16212
16213: see if setlocale exists
16214set setlocale d_setlocale
16215eval $inlibc
16216
10bc17b6
JH
16217: see if locale.h is available
16218set locale.h i_locale
16219eval $inhdr
16220
16221: see if setlocale_r exists
16222set setlocale_r d_setlocale_r
16223eval $inlibc
16224case "$d_setlocale_r" in
16225"$define")
16226 hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
c18e646a
JH
16227 case "$d_setlocale_r_proto:$usethreads" in
16228 ":define") d_setlocale_r_proto=define
a48ec845
JH
16229 set d_setlocale_r_proto setlocale_r $hdrs
16230 eval $hasproto ;;
16231 *) ;;
16232 esac
16233 case "$d_setlocale_r_proto" in
16234 define)
10bc17b6
JH
16235 case "$setlocale_r_proto" in
16236 ''|0) try='int setlocale_r(int, const char*, char*, int);'
16237 ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16238 esac
16239 case "$setlocale_r_proto" in
90e831dc 16240 ''|0) d_setlocale_r=undef
10bc17b6 16241 setlocale_r_proto=0
a48ec845 16242 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16243 * ) case "$setlocale_r_proto" in
16244 REENTRANT_PROTO*) ;;
16245 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16246 esac
16247 echo "Prototype: $try" ;;
16248 esac
16249 ;;
c18e646a
JH
16250 *) case "$usethreads" in
16251 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16252 esac
90e831dc
SB
16253 d_setlocale_r=undef
16254 setlocale_r_proto=0
c18e646a 16255 ;;
a48ec845
JH
16256 esac
16257 ;;
10bc17b6
JH
16258*) setlocale_r_proto=0
16259 ;;
16260esac
16261
b4eb6b3d
JH
16262: see if setnetent exists
16263set setnetent d_setnent
16264eval $inlibc
16265
10bc17b6
JH
16266: see if setnetent_r exists
16267set setnetent_r d_setnetent_r
16268eval $inlibc
16269case "$d_setnetent_r" in
16270"$define")
16271 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16272 case "$d_setnetent_r_proto:$usethreads" in
16273 ":define") d_setnetent_r_proto=define
a48ec845
JH
16274 set d_setnetent_r_proto setnetent_r $hdrs
16275 eval $hasproto ;;
16276 *) ;;
16277 esac
16278 case "$d_setnetent_r_proto" in
16279 define)
10bc17b6
JH
16280 case "$setnetent_r_proto" in
16281 ''|0) try='int setnetent_r(int, struct netent_data*);'
16282 ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16283 esac
16284 case "$setnetent_r_proto" in
16285 ''|0) try='void setnetent_r(int, struct netent_data*);'
16286 ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16287 esac
16288 case "$setnetent_r_proto" in
90e831dc 16289 ''|0) d_setnetent_r=undef
10bc17b6 16290 setnetent_r_proto=0
a48ec845 16291 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16292 * ) case "$setnetent_r_proto" in
16293 REENTRANT_PROTO*) ;;
16294 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16295 esac
16296 echo "Prototype: $try" ;;
16297 esac
16298 ;;
c18e646a
JH
16299 *) case "$usethreads" in
16300 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16301 esac
90e831dc
SB
16302 d_setnetent_r=undef
16303 setnetent_r_proto=0
c18e646a 16304 ;;
a48ec845
JH
16305 esac
16306 ;;
10bc17b6
JH
16307*) setnetent_r_proto=0
16308 ;;
16309esac
16310
b4eb6b3d
JH
16311: see if setprotoent exists
16312set setprotoent d_setpent
16313eval $inlibc
16314
16315: see if setpgid exists
16316set setpgid d_setpgid
16317eval $inlibc
16318
16319: see if setpgrp2 exists
16320set setpgrp2 d_setpgrp2
16321eval $inlibc
16322
16323: see if setpriority exists
16324set setpriority d_setprior
16325eval $inlibc
16326
16327: see if setproctitle exists
16328set setproctitle d_setproctitle
16329eval $inlibc
16330
10bc17b6
JH
16331: see if setprotoent_r exists
16332set setprotoent_r d_setprotoent_r
16333eval $inlibc
16334case "$d_setprotoent_r" in
16335"$define")
16336 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16337 case "$d_setprotoent_r_proto:$usethreads" in
16338 ":define") d_setprotoent_r_proto=define
a48ec845
JH
16339 set d_setprotoent_r_proto setprotoent_r $hdrs
16340 eval $hasproto ;;
16341 *) ;;
16342 esac
16343 case "$d_setprotoent_r_proto" in
16344 define)
10bc17b6
JH
16345 case "$setprotoent_r_proto" in
16346 ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16347 ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16348 esac
16349 case "$setprotoent_r_proto" in
16350 ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16351 ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16352 esac
16353 case "$setprotoent_r_proto" in
90e831dc 16354 ''|0) d_setprotoent_r=undef
10bc17b6 16355 setprotoent_r_proto=0
a48ec845 16356 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16357 * ) case "$setprotoent_r_proto" in
16358 REENTRANT_PROTO*) ;;
16359 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16360 esac
16361 echo "Prototype: $try" ;;
16362 esac
16363 ;;
c18e646a
JH
16364 *) case "$usethreads" in
16365 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16366 esac
90e831dc
SB
16367 d_setprotoent_r=undef
16368 setprotoent_r_proto=0
c18e646a 16369 ;;
a48ec845
JH
16370 esac
16371 ;;
10bc17b6
JH
16372*) setprotoent_r_proto=0
16373 ;;
16374esac
16375
b4eb6b3d
JH
16376: see if setpwent exists
16377set setpwent d_setpwent
16378eval $inlibc
16379
10bc17b6
JH
16380: see if setpwent_r exists
16381set setpwent_r d_setpwent_r
16382eval $inlibc
16383case "$d_setpwent_r" in
16384"$define")
16385 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
16386 case "$d_setpwent_r_proto:$usethreads" in
16387 ":define") d_setpwent_r_proto=define
a48ec845
JH
16388 set d_setpwent_r_proto setpwent_r $hdrs
16389 eval $hasproto ;;
16390 *) ;;
16391 esac
16392 case "$d_setpwent_r_proto" in
16393 define)
10bc17b6
JH
16394 case "$setpwent_r_proto" in
16395 ''|0) try='int setpwent_r(FILE**);'
16396 ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16397 esac
16398 case "$setpwent_r_proto" in
16399 ''|0) try='void setpwent_r(FILE**);'
16400 ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16401 esac
16402 case "$setpwent_r_proto" in
90e831dc 16403 ''|0) d_setpwent_r=undef
10bc17b6 16404 setpwent_r_proto=0
a48ec845 16405 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16406 * ) case "$setpwent_r_proto" in
16407 REENTRANT_PROTO*) ;;
16408 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16409 esac
16410 echo "Prototype: $try" ;;
16411 esac
16412 ;;
c18e646a
JH
16413 *) case "$usethreads" in
16414 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16415 esac
90e831dc
SB
16416 d_setpwent_r=undef
16417 setpwent_r_proto=0
c18e646a 16418 ;;
a48ec845
JH
16419 esac
16420 ;;
10bc17b6
JH
16421*) setpwent_r_proto=0
16422 ;;
16423esac
16424
b4eb6b3d
JH
16425: see if setregid exists
16426set setregid d_setregid
16427eval $inlibc
16428set setresgid d_setresgid
16429eval $inlibc
16430
16431: see if setreuid exists
16432set setreuid d_setreuid
16433eval $inlibc
16434set setresuid d_setresuid
16435eval $inlibc
16436
16437: see if setrgid exists
16438set setrgid d_setrgid
16439eval $inlibc
16440
16441: see if setruid exists
16442set setruid d_setruid
16443eval $inlibc
16444
16445: see if setservent exists
16446set setservent d_setsent
16447eval $inlibc
16448
10bc17b6
JH
16449: see if setservent_r exists
16450set setservent_r d_setservent_r
16451eval $inlibc
16452case "$d_setservent_r" in
16453"$define")
16454 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16455 case "$d_setservent_r_proto:$usethreads" in
16456 ":define") d_setservent_r_proto=define
a48ec845
JH
16457 set d_setservent_r_proto setservent_r $hdrs
16458 eval $hasproto ;;
16459 *) ;;
16460 esac
16461 case "$d_setservent_r_proto" in
16462 define)
10bc17b6
JH
16463 case "$setservent_r_proto" in
16464 ''|0) try='int setservent_r(int, struct servent_data*);'
16465 ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16466 esac
16467 case "$setservent_r_proto" in
16468 ''|0) try='void setservent_r(int, struct servent_data*);'
16469 ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16470 esac
16471 case "$setservent_r_proto" in
90e831dc 16472 ''|0) d_setservent_r=undef
10bc17b6 16473 setservent_r_proto=0
a48ec845 16474 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16475 * ) case "$setservent_r_proto" in
16476 REENTRANT_PROTO*) ;;
16477 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16478 esac
16479 echo "Prototype: $try" ;;
16480 esac
16481 ;;
c18e646a
JH
16482 *) case "$usethreads" in
16483 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16484 esac
90e831dc
SB
16485 d_setservent_r=undef
16486 setservent_r_proto=0
c18e646a 16487 ;;
a48ec845
JH
16488 esac
16489 ;;
10bc17b6
JH
16490*) setservent_r_proto=0
16491 ;;
16492esac
16493
b4eb6b3d
JH
16494: see if setsid exists
16495set setsid d_setsid
16496eval $inlibc
16497
16498: see if setvbuf exists
16499set setvbuf d_setvbuf
16500eval $inlibc
16501
16502: see if sfio.h is available
16503set sfio.h i_sfio
16504eval $inhdr
16505
16506
16507: see if sfio library is available
16508case "$i_sfio" in
16509$define)
16510 val=''
16511 set sfreserve val
16512 eval $inlibc
16513 ;;
16514*)
16515 val="$undef"
16516 ;;
16517esac
16518: Ok, but do we want to use it.
16519case "$val" in
16520$define)
16521 case "$usesfio" in
16522 true|$define|[yY]*) dflt='y';;
16523 *) dflt='n';;
16524 esac
16525 echo "$package can use the sfio library, but it is experimental."
16526 case "$useperlio" in
16527 "$undef")
16528 echo "For sfio also the PerlIO abstraction layer is needed."
16529 echo "Earlier you said you wouldn't want that."
16530 ;;
16531 esac
16532 rp="You seem to have sfio available, do you want to try using it?"
16533 . ./myread
16534 case "$ans" in
16535 y|Y) echo "Ok, turning on both sfio and PerlIO, then."
16536 useperlio="$define"
16537 val="$define"
16538 ;;
16539 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
16540 val="$undef"
b4eb6b3d
JH
16541 ;;
16542 esac
16543 ;;
16544*) case "$usesfio" in
16545 true|$define|[yY]*)
16546 echo "Sorry, cannot find sfio on this machine." >&4
16547 echo "Ignoring your setting of usesfio=$usesfio." >&4
16548 val="$undef"
16549 ;;
16550 esac
16551 ;;
16552esac
16553set d_sfio
16554eval $setvar
16555case "$d_sfio" in
16556$define) usesfio='true';;
16557*) usesfio='false';;
16558esac
3659ebf1
JH
16559case "$d_sfio" in
16560$define) ;;
16561*) : Remove sfio from list of libraries to use
7483f793
JH
16562 case "$libs" in
16563 *-lsfio*)
16564 echo "Removing unneeded -lsfio from library list" >&4
16565 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16566 shift
16567 libs="$*"
16568 echo "libs = $libs" >&4
16569 ;;
16570 esac
3659ebf1
JH
16571;;
16572esac
16573
b4eb6b3d
JH
16574
16575: see if shmctl exists
16576set shmctl d_shmctl
16577eval $inlibc
16578
16579: see if shmget exists
16580set shmget d_shmget
16581eval $inlibc
16582
16583: see if shmat exists
16584set shmat d_shmat
16585eval $inlibc
16586: see what shmat returns
16587case "$d_shmat" in
16588"$define")
16589 $cat >shmat.c <<'END'
16590#include <sys/shm.h>
16591void *shmat();
16592END
16593 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16594 shmattype='void *'
16595 else
16596 shmattype='char *'
16597 fi
16598 echo "and it returns ($shmattype)." >&4
16599 : see if a prototype for shmat is available
16600 xxx=`./findhdr sys/shm.h`
16601 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16602 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16603 val="$define"
16604 else
16605 val="$undef"
16606 fi
16607 $rm -f shmat.[co]
16608 ;;
16609*)
16610 val="$undef"
16611 ;;
16612esac
16613set d_shmatprototype
16614eval $setvar
16615
16616: see if shmdt exists
16617set shmdt d_shmdt
16618eval $inlibc
16619
16620: see how much of the 'shm*(2)' library is present.
16621h_shm=true
16622echo " "
16623case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16624*"$undef"*) h_shm=false;;
16625esac
16626case "$osname" in
16627freebsd)
16628 case "`ipcs 2>&1`" in
16629 "SVID shared memory"*"not configured"*)
16630 echo "Your $osname does not have the shm*(2) configured." >&4
16631 h_shm=false
16632 val="$undef"
16633 set shmctl d_shmctl
16634 evat $setvar
16635 set shmget d_shmget
16636 evat $setvar
16637 set shmat d_shmat
16638 evat $setvar
16639 set shmdt d_shmdt
16640 evat $setvar
16641 ;;
16642 esac
16643 ;;
16644esac
16645: we could also check for sys/ipc.h ...
16646if $h_shm && $test `./findhdr sys/shm.h`; then
16647 echo "You have the full shm*(2) library." >&4
16648 val="$define"
16649else
16650 echo "You don't have the full shm*(2) library." >&4
16651 val="$undef"
16652fi
16653set d_shm
16654eval $setvar
16655
16656echo " "
16657: see if we have sigaction
16658if set sigaction val -f d_sigaction; eval $csym; $val; then
16659 echo 'sigaction() found.' >&4
073b6de5 16660 $cat > try.c <<EOP
b4eb6b3d
JH
16661#include <stdio.h>
16662#include <sys/types.h>
16663#include <signal.h>
073b6de5
JH
16664#$i_stdlib I_STDLIB
16665#ifdef I_STDLIB
16666#include <stdlib.h>
16667#endif
b4eb6b3d
JH
16668int main()
16669{
16670 struct sigaction act, oact;
16671 act.sa_flags = 0;
16672 oact.sa_handler = 0;
16673 /* so that act and oact are used */
16674 exit(act.sa_flags == 0 && oact.sa_handler == 0);
16675}
16676EOP
16677 set try
16678 if eval $compile_ok; then
16679 val="$define"
16680 else
16681 echo "But you don't seem to have a useable struct sigaction." >&4
16682 val="$undef"
16683 fi
16684else
16685 echo 'sigaction NOT found.' >&4
16686 val="$undef"
16687fi
16688set d_sigaction; eval $setvar
16689$rm -f try try$_o try.c
16690
983dbef6
JH
16691: see if sigprocmask exists
16692set sigprocmask d_sigprocmask
16693eval $inlibc
16694
b4eb6b3d
JH
16695: see if sigsetjmp exists
16696echo " "
16697case "$d_sigsetjmp" in
16698'')
c727eafa 16699 $cat >try.c <<EOP
b4eb6b3d 16700#include <setjmp.h>
d1daaddf
JH
16701#$i_stdlib I_STDLIB
16702#ifdef I_STDLIB
16703#include <stdlib.h>
16704#endif
b4eb6b3d
JH
16705sigjmp_buf env;
16706int set = 1;
16707int main()
16708{
16709 if (sigsetjmp(env,1))
16710 exit(set);
16711 set = 0;
16712 siglongjmp(env, 1);
16713 exit(1);
16714}
16715EOP
16716 set try
16717 if eval $compile; then
5440bc8e 16718 if $run ./try >/dev/null 2>&1; then
b4eb6b3d
JH
16719 echo "POSIX sigsetjmp found." >&4
16720 val="$define"
16721 else
16722 $cat >&4 <<EOM
16723Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16724I'll ignore them.
16725EOM
16726 val="$undef"
16727 fi
16728 else
16729 echo "sigsetjmp not found." >&4
16730 val="$undef"
16731 fi
16732 ;;
16733*) val="$d_sigsetjmp"
16734 case "$d_sigsetjmp" in
16735 $define) echo "POSIX sigsetjmp found." >&4;;
16736 $undef) echo "sigsetjmp not found." >&4;;
16737 esac
16738 ;;
16739esac
16740set d_sigsetjmp
16741eval $setvar
16742$rm -f try.c try
16743
4f5da3e9
SP
16744: see if snprintf exists
16745set snprintf d_snprintf
16746eval $inlibc
16747
16748: see if vsnprintf exists
16749set vsnprintf d_vsnprintf
16750eval $inlibc
16751
2478f7a0
MB
16752case "$d_snprintf-$d_vsnprintf" in
16753"$define-$define")
16754 $cat <<EOM
16755Checking whether your snprintf() and vsnprintf() work okay...
16756EOM
16757 $cat >try.c <<'EOCP'
16758/* v?snprintf testing logic courtesy of Russ Allbery.
16759 * According to C99:
16760 * - if the buffer is too short it still must be \0-terminated
16761 * - if the buffer is too short the potentially required length
16762 * must be returned and not -1
16763 * - if the buffer is NULL the potentially required length
16764 * must be returned and not -1 or core dump
16765 */
16766#include <stdio.h>
16767#include <stdarg.h>
16768
16769char buf[2];
16770
16771int test (char *format, ...)
16772{
16773 va_list args;
16774 int count;
16775
16776 va_start (args, format);
16777 count = vsnprintf (buf, sizeof buf, format, args);
16778 va_end (args);
16779 return count;
16780}
16781
16782int main ()
16783{
16784 return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
16785 && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
16786}
16787EOCP
16788 set try
16789 if eval $compile; then
16790 `$run ./try`
16791 case "$?" in
16792 0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
16793 *) cat <<EOM >&4
16794Your snprintf() and snprintf() don't seem to be working okay.
16795EOM
16796 d_snprintf="$undef"
16797 d_vsnprintf="$undef"
16798 ;;
16799 esac
16800 else
16801 echo "(I can't seem to compile the test program--assuming they don't)"
16802 d_snprintf="$undef"
16803 d_vsnprintf="$undef"
16804 fi
16805 $rm -f try.* try core core.try.*
16806 ;;
16807esac
16808
49a78c82
JH
16809: see if sockatmark exists
16810set sockatmark d_sockatmark
16811eval $inlibc
16812
2ef53570
JH
16813: see if prototype for sockatmark is available
16814echo " "
16815set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16816eval $hasproto
16817
b4eb6b3d
JH
16818: see if socks5_init exists
16819set socks5_init d_socks5_init
16820eval $inlibc
16821
360321b3
YST
16822: see if sprintf returns the length of the string in the buffer as per ANSI
16823$echo "Checking whether sprintf returns the length of the string..." >&4
16824$cat <<EOP >try.c
16825#include <stdio.h>
16826#$i_stdlib I_STDLIB
16827#ifdef I_STDLIB
16828#include <stdlib.h>
16829#endif
16830#$i_string I_STRING
16831#ifdef I_STRING
16832# include <string.h>
16833#else
16834# include <strings.h>
16835#endif
16836#$i_math I_MATH
16837#ifdef I_MATH
16838#include <math.h>
16839#endif
16840
16841char buffer[256];
16842
16843int check (size_t expect, int test) {
16844 size_t got = strlen(buffer);
16845 if (expect == got)
16846 return 0;
16847
16848 printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
16849 test, buffer);
16850 exit (test);
16851}
16852
16853int main(int argc, char **argv) {
16854 int test = 0;
16855
16856 check(sprintf(buffer, ""), ++test);
16857 check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
16858 check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
16859
16860 return 0;
16861}
16862EOP
16863set try
16864
16865d_sprintf_returns_strlen="$undef"
16866if eval $compile; then
16867 xxx="`$run ./try`"
16868 case "$?" in
16869 0) cat >&4 <<EOM
16870sprintf returns the length of the string (as ANSI says it should)
16871EOM
16872 d_sprintf_returns_strlen="$define"
16873 ;;
16874 *) cat >&4 <<EOM
16875sprintf does not return the length of the string (how old is this system?)
16876EOM
16877 d_sprintf_returns_strlen="$undef"
16878 ;;
16879 esac
16880fi
16881
16882$rm -f try.* try
16883
10bc17b6
JH
16884: see if srand48_r exists
16885set srand48_r d_srand48_r
16886eval $inlibc
16887case "$d_srand48_r" in
16888"$define")
16889 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
16890 case "$d_srand48_r_proto:$usethreads" in
16891 ":define") d_srand48_r_proto=define
a48ec845
JH
16892 set d_srand48_r_proto srand48_r $hdrs
16893 eval $hasproto ;;
16894 *) ;;
16895 esac
16896 case "$d_srand48_r_proto" in
16897 define)
10bc17b6
JH
16898 case "$srand48_r_proto" in
16899 ''|0) try='int srand48_r(long, struct drand48_data*);'
16900 ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16901 esac
16902 case "$srand48_r_proto" in
90e831dc 16903 ''|0) d_srand48_r=undef
10bc17b6 16904 srand48_r_proto=0
a48ec845 16905 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16906 * ) case "$srand48_r_proto" in
16907 REENTRANT_PROTO*) ;;
16908 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16909 esac
16910 echo "Prototype: $try" ;;
16911 esac
16912 ;;
c18e646a
JH
16913 *) case "$usethreads" in
16914 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16915 esac
90e831dc
SB
16916 d_srand48_r=undef
16917 srand48_r_proto=0
c18e646a 16918 ;;
a48ec845
JH
16919 esac
16920 ;;
10bc17b6
JH
16921*) srand48_r_proto=0
16922 ;;
16923esac
16924
16925: see if srandom_r exists
16926set srandom_r d_srandom_r
16927eval $inlibc
16928case "$d_srandom_r" in
16929"$define")
16930 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
16931 case "$d_srandom_r_proto:$usethreads" in
16932 ":define") d_srandom_r_proto=define
a48ec845
JH
16933 set d_srandom_r_proto srandom_r $hdrs
16934 eval $hasproto ;;
16935 *) ;;
16936 esac
16937 case "$d_srandom_r_proto" in
16938 define)
10bc17b6
JH
16939 case "$srandom_r_proto" in
16940 ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16941 ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16942 esac
16943 case "$srandom_r_proto" in
90e831dc 16944 ''|0) d_srandom_r=undef
10bc17b6 16945 srandom_r_proto=0
a48ec845 16946 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16947 * ) case "$srandom_r_proto" in
16948 REENTRANT_PROTO*) ;;
16949 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16950 esac
16951 echo "Prototype: $try" ;;
16952 esac
16953 ;;
c18e646a
JH
16954 *) case "$usethreads" in
16955 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16956 esac
90e831dc
SB
16957 d_srandom_r=undef
16958 srandom_r_proto=0
c18e646a 16959 ;;
a48ec845
JH
16960 esac
16961 ;;
10bc17b6
JH
16962*) srandom_r_proto=0
16963 ;;
16964esac
16965
eef837ea
JH
16966: see if prototype for setresgid is available
16967echo " "
16968set d_sresgproto setresgid $i_unistd unistd.h
16969eval $hasproto
16970
640374d0
JH
16971: see if prototype for setresuid is available
16972echo " "
16973set d_sresuproto setresuid $i_unistd unistd.h
16974eval $hasproto
16975
b4eb6b3d
JH
16976: see if sys/stat.h is available
16977set sys/stat.h i_sysstat
16978eval $inhdr
16979
16980
16981: see if stat knows about block sizes
16982echo " "
16983echo "Checking to see if your struct stat has st_blocks field..." >&4
16984set d_statblks stat st_blocks $i_sysstat sys/stat.h
16985eval $hasfield
16986
16987
16988: see if this is a sys/vfs.h system
16989set sys/vfs.h i_sysvfs
16990eval $inhdr
16991
16992
16993: see if this is a sys/statfs.h system
16994set sys/statfs.h i_sysstatfs
16995eval $inhdr
16996
16997
16998echo " "
16999echo "Checking to see if your system supports struct statfs..." >&4
17000set 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
17001eval $hasstruct
17002case "$d_statfs_s" in
17003"$define") echo "Yes, it does." ;;
17004*) echo "No, it doesn't." ;;
17005esac
17006
17007
17008
17009: see if struct statfs knows about f_flags
17010case "$d_statfs_s" in
17011define)
17012 echo " "
17013 echo "Checking to see if your struct statfs has f_flags field..." >&4
17014 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
17015 eval $hasfield
17016 ;;
17017*) val="$undef"
17018 set d_statfs_f_flags
17019 eval $setvar
17020 ;;
17021esac
17022case "$d_statfs_f_flags" in
17023"$define") echo "Yes, it does." ;;
17024*) echo "No, it doesn't." ;;
17025esac
17026
b4eb6b3d
JH
17027$cat >&4 <<EOM
17028Checking how to access stdio streams by file descriptor number...
17029EOM
17030case "$stdio_stream_array" in
17031'') $cat >try.c <<EOCP
17032#include <stdio.h>
17033int main() {
17034 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17035 printf("yes\n");
17036}
17037EOCP
17038 for s in _iob __iob __sF
17039 do
17040 set try -DSTDIO_STREAM_ARRAY=$s
17041 if eval $compile; then
5440bc8e 17042 case "`$run ./try`" in
b4eb6b3d
JH
17043 yes) stdio_stream_array=$s; break ;;
17044 esac
17045 fi
17046 done
17047 $rm -f try.* try$exe_ext
17048esac
17049case "$stdio_stream_array" in
17050'') $cat >&4 <<EOM
17051I can't figure out how to access stdio streams by file descriptor number.
17052EOM
17053 d_stdio_stream_array="$undef"
17054 ;;
17055*) $cat >&4 <<EOM
17056You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17057EOM
17058 d_stdio_stream_array="$define"
17059 ;;
17060esac
17061
17062: see if strcoll exists
17063set strcoll d_strcoll
17064eval $inlibc
17065
17066: check for structure copying
17067echo " "
17068echo "Checking to see if your C compiler can copy structs..." >&4
17069$cat >try.c <<'EOCP'
76f47787 17070int main()
b4eb6b3d
JH
17071{
17072 struct blurfl {
17073 int dyick;
17074 } foo, bar;
17075
17076 foo = bar;
17077}
17078EOCP
17079if $cc -c try.c >/dev/null 2>&1 ; then
17080 val="$define"
17081 echo "Yup, it can."
17082else
17083 val="$undef"
17084 echo "Nope, it can't."
17085fi
17086set d_strctcpy
17087eval $setvar
17088$rm -f try.*
17089
17090: see if strerror and/or sys_errlist[] exist
17091echo " "
17092if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17093 if set strerror val -f d_strerror; eval $csym; $val; then
17094 echo 'strerror() found.' >&4
17095 d_strerror="$define"
17096 d_strerrm='strerror(e)'
17097 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17098 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
17099 d_syserrlst="$define"
17100 else
17101 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17102 d_syserrlst="$undef"
17103 fi
17104 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17105 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17106 echo 'strerror() found in string header.' >&4
17107 d_strerror="$define"
17108 d_strerrm='strerror(e)'
17109 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17110 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17111 d_syserrlst="$define"
17112 else
17113 echo "(You don't appear to have any sys_errlist[], how can this be?)"
17114 d_syserrlst="$undef"
17115 fi
17116 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17117 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17118 d_strerror="$undef"
17119 d_syserrlst="$define"
17120 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17121 else
17122 echo 'strerror() and sys_errlist[] NOT found.' >&4
17123 d_strerror="$undef"
17124 d_syserrlst="$undef"
17125 d_strerrm='"unknown"'
17126 fi
17127fi
17128
10bc17b6
JH
17129: see if strerror_r exists
17130set strerror_r d_strerror_r
17131eval $inlibc
17132case "$d_strerror_r" in
17133"$define")
17134 hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
c18e646a
JH
17135 case "$d_strerror_r_proto:$usethreads" in
17136 ":define") d_strerror_r_proto=define
a48ec845
JH
17137 set d_strerror_r_proto strerror_r $hdrs
17138 eval $hasproto ;;
17139 *) ;;
17140 esac
17141 case "$d_strerror_r_proto" in
17142 define)
10bc17b6
JH
17143 case "$strerror_r_proto" in
17144 ''|0) try='int strerror_r(int, char*, size_t);'
17145 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17146 esac
17147 case "$strerror_r_proto" in
17148 ''|0) try='int strerror_r(int, char*, int);'
17149 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17150 esac
17151 case "$strerror_r_proto" in
17152 ''|0) try='char* strerror_r(int, char*, size_t);'
17153 ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17154 esac
17155 case "$strerror_r_proto" in
90e831dc 17156 ''|0) d_strerror_r=undef
10bc17b6 17157 strerror_r_proto=0
a48ec845 17158 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17159 * ) case "$strerror_r_proto" in
17160 REENTRANT_PROTO*) ;;
17161 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17162 esac
17163 echo "Prototype: $try" ;;
17164 esac
17165 ;;
c18e646a
JH
17166 *) case "$usethreads" in
17167 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17168 esac
90e831dc
SB
17169 d_strerror_r=undef
17170 strerror_r_proto=0
c18e646a 17171 ;;
a48ec845
JH
17172 esac
17173 ;;
10bc17b6
JH
17174*) strerror_r_proto=0
17175 ;;
17176esac
17177
b3c85772
JH
17178: see if strftime exists
17179set strftime d_strftime
17180eval $inlibc
17181
08c92000
MB
17182: see if strlcat exists
17183set strlcat d_strlcat
17184eval $inlibc
17185
17186: see if strlcpy exists
17187set strlcpy d_strlcpy
17188eval $inlibc
17189
b4eb6b3d
JH
17190: see if strtod exists
17191set strtod d_strtod
17192eval $inlibc
17193
17194: see if strtol exists
17195set strtol d_strtol
17196eval $inlibc
17197
17198: see if strtold exists
17199set strtold d_strtold
17200eval $inlibc
17201
17202: see if strtoll exists
17203set strtoll d_strtoll
17204eval $inlibc
17205
17206case "$d_longlong-$d_strtoll" in
17207"$define-$define")
17208 $cat <<EOM
17209Checking whether your strtoll() works okay...
17210EOM
17211 $cat >try.c <<'EOCP'
17212#include <errno.h>
17213#ifdef __hpux
17214#define strtoll __strtoll
17215#endif
e75931a7
YST
17216#ifdef __EMX__
17217#define strtoll _strtoll
17218#endif
b4eb6b3d
JH
17219#include <stdio.h>
17220extern long long int strtoll(char *s, char **, int);
17221static int bad = 0;
17222int check(char *s, long long ell, int een) {
17223 long long gll;
17224 errno = 0;
17225 gll = strtoll(s, 0, 10);
17226 if (!((gll == ell) && (errno == een)))
17227 bad++;
17228}
17229int main() {
17230 check(" 1", 1LL, 0);
17231 check(" 0", 0LL, 0);
17232 check("-1", -1LL, 0);
17233 check("-9223372036854775808", -9223372036854775808LL, 0);
17234 check("-9223372036854775808", -9223372036854775808LL, 0);
17235 check(" 9223372036854775807", 9223372036854775807LL, 0);
17236 check("-9223372036854775808", -9223372036854775808LL, 0);
17237 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
17238 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17239 if (!bad)
17240 printf("ok\n");
17241}
17242EOCP
17243 set try
17244 if eval $compile; then
5440bc8e 17245 yyy=`$run ./try`
e75931a7 17246 case "$yyy" in
b4eb6b3d
JH
17247 ok) echo "Your strtoll() seems to be working okay." ;;
17248 *) cat <<EOM >&4
17249Your strtoll() doesn't seem to be working okay.
17250EOM
17251 d_strtoll="$undef"
17252 ;;
69eadf66 17253 esac
e75931a7
YST
17254 else
17255 echo "(I can't seem to compile the test program--assuming it doesn't)"
17256 d_strtoll="$undef"
b4eb6b3d
JH
17257 fi
17258 ;;
17259esac
17260
28e5dec8
JH
17261: see if strtoq exists
17262set strtoq d_strtoq
17263eval $inlibc
17264
b4eb6b3d
JH
17265: see if strtoul exists
17266set strtoul d_strtoul
17267eval $inlibc
17268
d0e6d399
NC
17269case "$d_strtoul" in
17270"$define")
17271 $cat <<EOM
17272Checking whether your strtoul() works okay...
17273EOM
17274 $cat >try.c <<'EOCP'
17275#include <errno.h>
17276#include <stdio.h>
17277extern unsigned long int strtoul(char *s, char **, int);
17278static int bad = 0;
17279void check(char *s, unsigned long eul, int een) {
17280 unsigned long gul;
17281 errno = 0;
17282 gul = strtoul(s, 0, 10);
17283 if (!((gul == eul) && (errno == een)))
17284 bad++;
17285}
17286int main() {
17287 check(" 1", 1L, 0);
17288 check(" 0", 0L, 0);
17289EOCP
17290 case "$longsize" in
17291 8)
17292 $cat >>try.c <<'EOCP'
09c0d2c4
JH
17293 check("18446744073709551615", 18446744073709551615UL, 0);
17294 check("18446744073709551616", 18446744073709551615UL, ERANGE);
c11ecd62 17295#if 0 /* strtoul() for /^-/ strings is undefined. */
09c0d2c4 17296 check("-1", 18446744073709551615UL, 0);
d0e6d399
NC
17297 check("-18446744073709551614", 2, 0);
17298 check("-18446744073709551615", 1, 0);
09c0d2c4
JH
17299 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17300 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
c11ecd62 17301#endif
d0e6d399
NC
17302EOCP
17303 ;;
17304 4)
17305 $cat >>try.c <<'EOCP'
17306 check("4294967295", 4294967295UL, 0);
17307 check("4294967296", 4294967295UL, ERANGE);
c11ecd62 17308#if 0 /* strtoul() for /^-/ strings is undefined. */
d0e6d399
NC
17309 check("-1", 4294967295UL, 0);
17310 check("-4294967294", 2, 0);
17311 check("-4294967295", 1, 0);
17312 check("-4294967296", 4294967295UL, ERANGE);
17313 check("-4294967297", 4294967295UL, ERANGE);
c11ecd62 17314#endif
d0e6d399
NC
17315EOCP
17316 ;;
17317 *)
17318: Should we write these tests to be more portable by sprintf-ing
17319: ~0 and then manipulating that char string as input for strtol?
17320 ;;
17321 esac
17322 $cat >>try.c <<'EOCP'
17323 if (!bad)
17324 printf("ok\n");
17325 return 0;
17326}
17327EOCP
17328 set try
17329 if eval $compile; then
5440bc8e 17330 case "`$run ./try`" in
d0e6d399
NC
17331 ok) echo "Your strtoul() seems to be working okay." ;;
17332 *) cat <<EOM >&4
17333Your strtoul() doesn't seem to be working okay.
17334EOM
17335 d_strtoul="$undef"
17336 ;;
17337 esac
17338 fi
17339 ;;
17340esac
17341
b4eb6b3d
JH
17342: see if strtoull exists
17343set strtoull d_strtoull
17344eval $inlibc
17345
17346case "$d_longlong-$d_strtoull" in
17347"$define-$define")
17348 $cat <<EOM
17349Checking whether your strtoull() works okay...
17350EOM
17351 $cat >try.c <<'EOCP'
17352#include <errno.h>
17353#ifdef __hpux
17354#define strtoull __strtoull
17355#endif
17356#include <stdio.h>
17357extern unsigned long long int strtoull(char *s, char **, int);
17358static int bad = 0;
17359int check(char *s, long long eull, int een) {
17360 long long gull;
17361 errno = 0;
17362 gull = strtoull(s, 0, 10);
17363 if (!((gull == eull) && (errno == een)))
17364 bad++;
17365}
17366int main() {
d0e6d399
NC
17367 check(" 1", 1LL, 0);
17368 check(" 0", 0LL, 0);
17369 check("18446744073709551615", 18446744073709551615ULL, 0);
17370 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 17371#if 0 /* strtoull() for /^-/ strings is undefined. */
d0e6d399
NC
17372 check("-1", 18446744073709551615ULL, 0);
17373 check("-18446744073709551614", 2LL, 0);
17374 check("-18446744073709551615", 1LL, 0);
17375 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17376 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 17377#endif
b4eb6b3d
JH
17378 if (!bad)
17379 printf("ok\n");
17380}
17381EOCP
17382 set try
17383 if eval $compile; then
5440bc8e 17384 case "`$run ./try`" in
b4eb6b3d
JH
17385 ok) echo "Your strtoull() seems to be working okay." ;;
17386 *) cat <<EOM >&4
17387Your strtoull() doesn't seem to be working okay.
17388EOM
17389 d_strtoull="$undef"
17390 ;;
17391 esac
17392 fi
17393 ;;
17394esac
17395
17396: see if strtouq exists
17397set strtouq d_strtouq
17398eval $inlibc
17399
d0e6d399
NC
17400case "$d_strtouq" in
17401"$define")
17402 $cat <<EOM
17403Checking whether your strtouq() works okay...
17404EOM
17405 $cat >try.c <<'EOCP'
17406#include <errno.h>
17407#include <stdio.h>
17408extern unsigned long long int strtouq(char *s, char **, int);
17409static int bad = 0;
17410void check(char *s, unsigned long long eull, int een) {
17411 unsigned long long gull;
17412 errno = 0;
17413 gull = strtouq(s, 0, 10);
17414 if (!((gull == eull) && (errno == een)))
17415 bad++;
17416}
17417int main() {
17418 check(" 1", 1LL, 0);
17419 check(" 0", 0LL, 0);
17420 check("18446744073709551615", 18446744073709551615ULL, 0);
17421 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 17422#if 0 /* strtouq() for /^-/ strings is undefined. */
d0e6d399
NC
17423 check("-1", 18446744073709551615ULL, 0);
17424 check("-18446744073709551614", 2LL, 0);
17425 check("-18446744073709551615", 1LL, 0);
17426 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17427 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 17428#endif
d0e6d399
NC
17429 if (!bad)
17430 printf("ok\n");
17431 return 0;
17432}
17433EOCP
17434 set try
17435 if eval $compile; then
5440bc8e 17436 case "`$run ./try`" in
d0e6d399
NC
17437 ok) echo "Your strtouq() seems to be working okay." ;;
17438 *) cat <<EOM >&4
17439Your strtouq() doesn't seem to be working okay.
17440EOM
17441 d_strtouq="$undef"
17442 ;;
17443 esac
17444 fi
17445 ;;
17446esac
17447
b4eb6b3d
JH
17448: see if strxfrm exists
17449set strxfrm d_strxfrm
17450eval $inlibc
17451
17452: see if symlink exists
17453set symlink d_symlink
17454eval $inlibc
17455
17456: see if syscall exists
17457set syscall d_syscall
17458eval $inlibc
17459
2ef53570
JH
17460: see if prototype for syscall is available
17461echo " "
17462set d_syscallproto syscall $i_unistd unistd.h
17463eval $hasproto
17464
b4eb6b3d
JH
17465: see if sysconf exists
17466set sysconf d_sysconf
17467eval $inlibc
17468
17469: see if system exists
17470set system d_system
17471eval $inlibc
17472
17473: see if tcgetpgrp exists
17474set tcgetpgrp d_tcgetpgrp
17475eval $inlibc
17476
17477: see if tcsetpgrp exists
17478set tcsetpgrp d_tcsetpgrp
17479eval $inlibc
17480
17481: see if prototype for telldir is available
17482echo " "
17483set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17484eval $hasproto
17485
ad493445
MB
17486: see if time exists
17487echo " "
17488if test "X$d_time" = X -o X"$timetype" = X; then
17489 if set time val -f d_time; eval $csym; $val; then
17490 echo 'time() found.' >&4
17491 val="$define"
17492 rp="What is the type returned by time() on this system?"
17493 set time_t timetype long stdio.h sys/types.h
17494 eval $typedef_ask
17495 else
17496 echo 'time() not found, hope that will do.' >&4
17497 val="$undef"
17498 timetype='int';
17499 fi
17500 set d_time
17501 eval $setvar
17502fi
17503
b4eb6b3d
JH
17504: see if this is a sys/times.h system
17505set sys/times.h i_systimes
17506eval $inhdr
17507
17508: see if times exists
17509echo " "
17510if set times val -f d_times; eval $csym; $val; then
17511 echo 'times() found.' >&4
17512 d_times="$define"
17513 inc=''
17514 case "$i_systimes" in
17515 "$define") inc='sys/times.h';;
17516 esac
17517 rp="What is the type returned by times() on this system?"
17518 set clock_t clocktype long stdio.h sys/types.h $inc
17519 eval $typedef_ask
17520else
17521 echo 'times() NOT found, hope that will do.' >&4
17522 d_times="$undef"
17523 clocktype='int'
17524fi
17525
10bc17b6
JH
17526: see if tmpnam_r exists
17527set tmpnam_r d_tmpnam_r
17528eval $inlibc
17529case "$d_tmpnam_r" in
17530"$define")
31ee0cb7 17531 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
17532 case "$d_tmpnam_r_proto:$usethreads" in
17533 ":define") d_tmpnam_r_proto=define
a48ec845
JH
17534 set d_tmpnam_r_proto tmpnam_r $hdrs
17535 eval $hasproto ;;
17536 *) ;;
17537 esac
17538 case "$d_tmpnam_r_proto" in
17539 define)
10bc17b6
JH
17540 case "$tmpnam_r_proto" in
17541 ''|0) try='char* tmpnam_r(char*);'
17542 ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17543 esac
17544 case "$tmpnam_r_proto" in
90e831dc 17545 ''|0) d_tmpnam_r=undef
10bc17b6 17546 tmpnam_r_proto=0
a48ec845 17547 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17548 * ) case "$tmpnam_r_proto" in
17549 REENTRANT_PROTO*) ;;
17550 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17551 esac
17552 echo "Prototype: $try" ;;
17553 esac
17554 ;;
c18e646a
JH
17555 *) case "$usethreads" in
17556 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17557 esac
90e831dc
SB
17558 d_tmpnam_r=undef
17559 tmpnam_r_proto=0
c18e646a 17560 ;;
a48ec845
JH
17561 esac
17562 ;;
10bc17b6
JH
17563*) tmpnam_r_proto=0
17564 ;;
17565esac
17566
b4eb6b3d
JH
17567: see if truncate exists
17568set truncate d_truncate
17569eval $inlibc
17570
10bc17b6
JH
17571: see if ttyname_r exists
17572set ttyname_r d_ttyname_r
17573eval $inlibc
17574case "$d_ttyname_r" in
17575"$define")
17576 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
17577 case "$d_ttyname_r_proto:$usethreads" in
17578 ":define") d_ttyname_r_proto=define
a48ec845
JH
17579 set d_ttyname_r_proto ttyname_r $hdrs
17580 eval $hasproto ;;
17581 *) ;;
17582 esac
17583 case "$d_ttyname_r_proto" in
17584 define)
10bc17b6
JH
17585 case "$ttyname_r_proto" in
17586 ''|0) try='int ttyname_r(int, char*, size_t);'
17587 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17588 esac
17589 case "$ttyname_r_proto" in
17590 ''|0) try='int ttyname_r(int, char*, int);'
17591 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17592 esac
17593 case "$ttyname_r_proto" in
17594 ''|0) try='char* ttyname_r(int, char*, int);'
17595 ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17596 esac
17597 case "$ttyname_r_proto" in
90e831dc 17598 ''|0) d_ttyname_r=undef
10bc17b6 17599 ttyname_r_proto=0
a48ec845 17600 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17601 * ) case "$ttyname_r_proto" in
17602 REENTRANT_PROTO*) ;;
17603 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17604 esac
17605 echo "Prototype: $try" ;;
17606 esac
17607 ;;
c18e646a
JH
17608 *) case "$usethreads" in
17609 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17610 esac
90e831dc
SB
17611 d_ttyname_r=undef
17612 ttyname_r_proto=0
c18e646a 17613 ;;
a48ec845
JH
17614 esac
17615 ;;
10bc17b6
JH
17616*) ttyname_r_proto=0
17617 ;;
17618esac
17619
b4eb6b3d
JH
17620: see if tzname[] exists
17621echo " "
17622if set tzname val -a d_tzname; eval $csym; $val; then
17623 val="$define"
17624 echo 'tzname[] found.' >&4
17625else
17626 val="$undef"
17627 echo 'tzname[] NOT found.' >&4
17628fi
17629set d_tzname
17630eval $setvar
17631
4e0554ec
JH
17632case "$osname" in
17633next|rhapsody|darwin) multiarch="$define" ;;
17634esac
17635case "$multiarch" in
17636''|[nN]*) multiarch="$undef" ;;
17637esac
17638
24412007 17639: check for ordering of bytes in a UV
4e0554ec 17640echo " "
5440bc8e 17641case "$usecrosscompile$multiarch" in
4e0554ec
JH
17642*$define*)
17643 $cat <<EOM
17644You seem to be either cross-compiling or doing a multiarchitecture build,
17645skipping the byteorder check.
17646
17647EOM
5440bc8e 17648 byteorder='ffff'
4e0554ec
JH
17649 ;;
17650*)
17651 case "$byteorder" in
17652 '')
17653 $cat <<'EOM'
17654In the following, larger digits indicate more significance. A big-endian
17655machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17656little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17657machines may have weird orders like 3412. A Cray will report 87654321,
17658an Alpha will report 12345678. If the test program works the default is
17659probably right.
17660I'm now running the test program...
17661EOM
24412007 17662 $cat >try.c <<EOCP
4e0554ec 17663#include <stdio.h>
55954f19
JH
17664#$i_stdlib I_STDLIB
17665#ifdef I_STDLIB
17666#include <stdlib.h>
17667#endif
24412007
JH
17668#include <sys/types.h>
17669typedef $uvtype UV;
4e0554ec
JH
17670int main()
17671{
17672 int i;
17673 union {
24412007
JH
17674 UV l;
17675 char c[$uvsize];
4e0554ec
JH
17676 } u;
17677
24412007 17678 if ($uvsize > 4)
b5ded3e5 17679 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
4e0554ec 17680 else
a4c53327 17681 u.l = (UV)0x04030201;
24412007 17682 for (i = 0; i < $uvsize; i++)
4e0554ec
JH
17683 printf("%c", u.c[i]+'0');
17684 printf("\n");
17685 exit(0);
17686}
17687EOCP
17688 xxx_prompt=y
17689 set try
17690 if eval $compile && ./try > /dev/null; then
5440bc8e 17691 dflt=`$run ./try`
4e0554ec
JH
17692 case "$dflt" in
17693 [1-4][1-4][1-4][1-4]|12345678|87654321)
17694 echo "(The test program ran ok.)"
17695 echo "byteorder=$dflt"
17696 xxx_prompt=n
17697 ;;
17698 ????|????????) echo "(The test program ran ok.)" ;;
17699 *) echo "(The test program didn't run right for some reason.)" ;;
17700 esac
17701 else
17702 dflt='4321'
17703 cat <<'EOM'
17704(I can't seem to compile the test program. Guessing big-endian...)
17705EOM
17706 fi
17707 case "$xxx_prompt" in
17708 y)
24412007 17709 rp="What is the order of bytes in $uvtype?"
4e0554ec
JH
17710 . ./myread
17711 byteorder="$ans"
17712 ;;
17713 *) byteorder=$dflt
17714 ;;
17715 esac
17716 ;;
17717 esac
17718 $rm -f try.c try
17719 ;;
17720esac
17721
17722
17723$cat <<EOM
17724
17725Checking to see whether you can access character data unalignedly...
17726EOM
dc7b0a4f
JH
17727case "$d_u32align" in
17728'') $cat >try.c <<EOCP
4e0554ec 17729#include <stdio.h>
d1daaddf
JH
17730#$i_stdlib I_STDLIB
17731#ifdef I_STDLIB
17732#include <stdlib.h>
17733#endif
4e0554ec 17734#define U32 $u32type
d308175a
JH
17735#define BYTEORDER 0x$byteorder
17736#define U8 $u8type
9958dc3c
JH
17737#include <signal.h>
17738#ifdef SIGBUS
17739$signal_t bletch(s) int s; { exit(4); }
17740#endif
4e0554ec
JH
17741int main() {
17742#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
8906a23e 17743 U8 buf[8];
4e0554ec
JH
17744 U32 *up;
17745 int i;
17746
17747 if (sizeof(U32) != 4) {
17748 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17749 exit(1);
17750 }
17751
17752 fflush(stdout);
17753
9958dc3c
JH
17754#ifdef SIGBUS
17755 signal(SIGBUS, bletch);
17756#endif
17757
8906a23e
JH
17758 buf[0] = 0;
17759 buf[1] = 0;
17760 buf[2] = 0;
17761 buf[3] = 1;
7eac3fd6 17762 buf[4] = 0;
8906a23e
JH
17763 buf[5] = 0;
17764 buf[6] = 0;
7eac3fd6 17765 buf[7] = 1;
8906a23e 17766
4e0554ec
JH
17767 for (i = 0; i < 4; i++) {
17768 up = (U32*)(buf + i);
17769 if (! ((*up == 1 << (8*i)) || /* big-endian */
17770 (*up == 1 << (8*(3-i))) /* little-endian */
17771 )
17772 )
17773 {
17774 printf("read failed (%x)\n", *up);
17775 exit(2);
17776 }
17777 }
17778
17779 /* write test */
17780 for (i = 0; i < 4; i++) {
17781 up = (U32*)(buf + i);
17782 *up = 0xBeef;
17783 if (*up != 0xBeef) {
17784 printf("write failed (%x)\n", *up);
17785 exit(3);
17786 }
17787 }
17788
17789 exit(0);
17790#else
17791 printf("1\n");
17792 exit(1);
17793#endif
17794 return 0;
17795}
17796EOCP
17797set try
17798if eval $compile_ok; then
d308175a 17799 echo "(Testing for character data alignment may crash the test. That's okay.)" >&4
5440bc8e 17800 $run ./try 2>&1 >/dev/null
4e0554ec
JH
17801 case "$?" in
17802 0) cat >&4 <<EOM
17803You can access character data pretty unalignedly.
17804EOM
17805 d_u32align="$undef"
17806 ;;
17807 *) cat >&4 <<EOM
17808It seems that you must access character data in an aligned manner.
17809EOM
17810 d_u32align="$define"
17811 ;;
17812 esac
4e0554ec
JH
17813else
17814 rp='Can you access character data at unaligned addresses?'
17815 dflt='n'
17816 . ./myread
17817 case "$ans" in
17818 [yY]*) d_u32align="$undef" ;;
17819 *) d_u32align="$define" ;;
17820 esac
17821fi
e36b5403 17822$rm -f core core.try.* try.core
dc7b0a4f
JH
17823;;
17824esac
4e0554ec
JH
17825
17826: see if ualarm exists
17827set ualarm d_ualarm
17828eval $inlibc
17829
b4eb6b3d
JH
17830: see if umask exists
17831set umask d_umask
17832eval $inlibc
17833
758a5d79
JH
17834: see if unordered exists
17835set unordered d_unordered
17836eval $inlibc
17837
bdf33aa7
SP
17838: see if unsetenv exists
17839set unsetenv d_unsetenv
17840eval $inlibc
17841
4e0554ec
JH
17842: see if usleep exists
17843set usleep d_usleep
17844eval $inlibc
17845
2ef53570
JH
17846: see if prototype for usleep is available
17847echo " "
17848set d_usleepproto usleep $i_unistd unistd.h
17849eval $hasproto
17850
b4eb6b3d
JH
17851: see if ustat exists
17852set ustat d_ustat
17853eval $inlibc
17854
17855: backward compatibility for d_hvfork
17856if test X$d_hvfork != X; then
17857 d_vfork="$d_hvfork"
17858 d_hvfork=''
17859fi
17860: see if there is a vfork
17861val=''
17862set vfork val
17863eval $inlibc
17864
17865: Ok, but do we want to use it. vfork is reportedly unreliable in
17866: perl on Solaris 2.x, and probably elsewhere.
17867case "$val" in
17868$define)
17869 echo " "
17870 case "$usevfork" in
17871 false) dflt='n';;
17872 *) dflt='y';;
17873 esac
17874 cat <<'EOM'
17875
17876Perl can only use a vfork() that doesn't suffer from strict
17877restrictions on calling functions or modifying global data in
17878the child. For example, glibc-2.1 contains such a vfork()
17879that is unsuitable. If your system provides a proper fork()
17880call, chances are that you do NOT want perl to use vfork().
17881
17882EOM
17883 rp="Do you still want to use vfork()?"
17884 . ./myread
17885 case "$ans" in
17886 y|Y) ;;
17887 *)
17888 echo "Ok, we won't use vfork()."
17889 val="$undef"
17890 ;;
17891 esac
17892 ;;
17893esac
17894set d_vfork
17895eval $setvar
17896case "$d_vfork" in
17897$define) usevfork='true';;
17898*) usevfork='false';;
17899esac
17900
b4eb6b3d
JH
17901: see if closedir exists
17902set closedir d_closedir
17903eval $inlibc
17904
17905case "$d_closedir" in
17906"$define")
17907 echo " "
17908 echo "Checking whether closedir() returns a status..." >&4
5440bc8e 17909 cat > try.c <<EOM
b4eb6b3d
JH
17910#$i_dirent I_DIRENT /**/
17911#$i_sysdir I_SYS_DIR /**/
17912#$i_sysndir I_SYS_NDIR /**/
17913#$i_systypes I_SYS_TYPES /**/
17914
17915#if defined(I_SYS_TYPES)
17916#include <sys/types.h>
17917#endif
17918#if defined(I_DIRENT)
17919#include <dirent.h>
17920#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17921#include <sys/dir.h>
17922#endif
17923#else
17924#ifdef I_SYS_NDIR
17925#include <sys/ndir.h>
17926#else
17927#ifdef I_SYS_DIR
17928#ifdef hp9000s500
17929#include <ndir.h> /* may be wrong in the future */
17930#else
17931#include <sys/dir.h>
17932#endif
17933#endif
17934#endif
17935#endif
17936int main() { return closedir(opendir(".")); }
17937EOM
5440bc8e 17938 set try
b4eb6b3d 17939 if eval $compile_ok; then
5440bc8e 17940 if $run ./try > /dev/null 2>&1 ; then
b4eb6b3d
JH
17941 echo "Yes, it does."
17942 val="$undef"
17943 else
17944 echo "No, it doesn't."
17945 val="$define"
17946 fi
17947 else
17948 echo "(I can't seem to compile the test program--assuming it doesn't)"
17949 val="$define"
17950 fi
17951 ;;
17952*)
17953 val="$undef";
17954 ;;
17955esac
17956set d_void_closedir
17957eval $setvar
5440bc8e 17958$rm -f try try.*
b4eb6b3d
JH
17959: see if there is a wait4
17960set wait4 d_wait4
17961eval $inlibc
17962
17963: see if waitpid exists
17964set waitpid d_waitpid
17965eval $inlibc
17966
17967: see if wcstombs exists
17968set wcstombs d_wcstombs
17969eval $inlibc
17970
17971: see if wctomb exists
17972set wctomb d_wctomb
17973eval $inlibc
17974
4e0554ec
JH
17975: see if writev exists
17976set writev d_writev
17977eval $inlibc
17978
b4eb6b3d
JH
17979: preserve RCS keywords in files with variable substitution, grrr
17980Date='$Date'
17981Id='$Id'
17982Log='$Log'
17983RCSfile='$RCSfile'
17984Revision='$Revision'
17985
b4eb6b3d
JH
17986: check for alignment requirements
17987echo " "
5440bc8e 17988case "$usecrosscompile$multiarch" in
b4eb6b3d
JH
17989*$define*)
17990 $cat <<EOM
17991You seem to be either cross-compiling or doing a multiarchitecture build,
17992skipping the memory alignment check.
17993
17994EOM
17995 case "$alignbytes" in
17996 '') alignbytes=8 ;;
17997 esac
17998 ;;
17999*)
18000 case "$alignbytes" in
18001 '') echo "Checking alignment constraints..." >&4
18002 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18003 $cat >try.c <<'EOCP'
18004typedef long double NV;
18005EOCP
18006 else
18007 $cat >try.c <<'EOCP'
18008typedef double NV;
18009EOCP
18010 fi
18011 $cat >>try.c <<'EOCP'
18012#include <stdio.h>
18013struct foobar {
18014 char foo;
18015 NV bar;
18016} try_algn;
18017int main()
18018{
18019 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18020 return(0);
18021}
18022EOCP
18023 set try
18024 if eval $compile_ok; then
5440bc8e 18025 dflt=`$run ./try`
b4eb6b3d
JH
18026 else
18027 dflt='8'
18028 echo "(I can't seem to compile the test program...)"
18029 fi
18030 ;;
18031 *) dflt="$alignbytes"
18032 ;;
18033 esac
18034 rp="Doubles must be aligned on a how-many-byte boundary?"
18035 . ./myread
18036 alignbytes="$ans"
18037 $rm -f try.c try
18038 ;;
18039esac
18040
18041
18042: set the base revision
18043baserev=5.0
18044
3099fc99 18045: how do we concatenate cpp tokens here?
b4eb6b3d 18046echo " "
3099fc99 18047echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
b4eb6b3d
JH
18048$cat >cpp_stuff.c <<'EOCP'
18049#define RCAT(a,b)a/**/b
18050#define ACAT(a,b)a ## b
18051RCAT(Rei,ser)
18052ACAT(Cir,cus)
18053EOCP
18054$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18055if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18056 echo "Oh! Smells like ANSI's been here." >&4
18057 echo "We can catify or stringify, separately or together!"
18058 cpp_stuff=42
18059elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18060 echo "Ah, yes! The good old days!" >&4
18061 echo "However, in the good old days we don't know how to stringify and"
18062 echo "catify at the same time."
18063 cpp_stuff=1
18064else
18065 $cat >&4 <<EOM
3099fc99
CW
18066Hmm, I don't seem to be able to concatenate tokens with your cpp.
18067You're going to have to edit the values of CAT[2-5] in config.h...
b4eb6b3d
JH
18068EOM
18069 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18070fi
18071$rm -f cpp_stuff.*
18072
18073: see if this is a db.h system
18074set db.h i_db
18075eval $inhdr
18076
18077case "$i_db" in
18078$define)
18079 : Check db version.
18080 echo " "
18081 echo "Checking Berkeley DB version ..." >&4
18082 $cat >try.c <<EOCP
18083#$d_const HASCONST
18084#ifndef HASCONST
18085#define const
18086#endif
18087#include <sys/types.h>
18088#include <stdio.h>
55954f19
JH
18089#$i_stdlib I_STDLIB
18090#ifdef I_STDLIB
18091#include <stdlib.h>
18092#endif
b4eb6b3d 18093#include <db.h>
640374d0 18094int main(int argc, char *argv[])
b4eb6b3d
JH
18095{
18096#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18097 int Major, Minor, Patch ;
18098 unsigned long Version ;
18099 (void)db_version(&Major, &Minor, &Patch) ;
640374d0
JH
18100 if (argc == 2) {
18101 printf("%d %d %d %d %d %d\n",
18102 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18103 Major, Minor, Patch);
18104 exit(0);
18105 }
18106 printf("You have Berkeley DB Version 2 or greater.\n");
b4eb6b3d
JH
18107
18108 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18109 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18110 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18111 Major, Minor, Patch) ;
18112
18113 /* check that db.h & libdb are compatible */
18114 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
640374d0 18115 printf("db.h and libdb are incompatible.\n") ;
b4eb6b3d
JH
18116 exit(3);
18117 }
18118
640374d0 18119 printf("db.h and libdb are compatible.\n") ;
b4eb6b3d
JH
18120
18121 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18122 + DB_VERSION_PATCH ;
18123
18124 /* needs to be >= 2.3.4 */
18125 if (Version < 2003004) {
18126 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
640374d0 18127 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
b4eb6b3d
JH
18128 exit(2);
18129 }
18130
18131 exit(0);
18132#else
18133#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
640374d0
JH
18134 if (argc == 2) {
18135 printf("1 0 0\n");
18136 exit(0);
18137 }
18138 printf("You have Berkeley DB Version 1.\n");
b4eb6b3d
JH
18139 exit(0); /* DB version < 2: the coast is clear. */
18140#else
18141 exit(1); /* <db.h> not Berkeley DB? */
18142#endif
18143#endif
18144}
18145EOCP
18146 set try
5440bc8e 18147 if eval $compile_ok && $run ./try; then
b4eb6b3d 18148 echo 'Looks OK.' >&4
5440bc8e 18149 set `$run ./try 1`
640374d0
JH
18150 db_version_major=$1
18151 db_version_minor=$2
18152 db_version_patch=$3
b4eb6b3d
JH
18153 else
18154 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
18155 i_db=$undef
18156 case " $libs " in
18157 *"-ldb "*)
18158 : Remove db from list of libraries to use
18159 echo "Removing unusable -ldb from library list" >&4
18160 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18161 shift
18162 libs="$*"
18163 echo "libs = $libs" >&4
18164 ;;
18165 esac
18166 fi
18167 $rm -f try.*
18168 ;;
18169esac
18170
18171case "$i_db" in
18172define)
18173 : Check the return type needed for hash
18174 echo " "
18175 echo "Checking return type needed for hash for Berkeley DB ..." >&4
18176 $cat >try.c <<EOCP
18177#$d_const HASCONST
18178#ifndef HASCONST
18179#define const
18180#endif
18181#include <sys/types.h>
18182#include <db.h>
18183
18184#ifndef DB_VERSION_MAJOR
18185u_int32_t hash_cb (ptr, size)
18186const void *ptr;
18187size_t size;
18188{
18189}
18190HASHINFO info;
18191int main()
18192{
18193 info.hash = hash_cb;
18194}
18195#endif
18196EOCP
18197 if $cc $ccflags -c try.c >try.out 2>&1 ; then
18198 if $contains warning try.out >>/dev/null 2>&1 ; then
18199 db_hashtype='int'
18200 else
18201 db_hashtype='u_int32_t'
18202 fi
18203 else
18204 : XXX Maybe we should just give up here.
18205 db_hashtype=u_int32_t
18206 $cat try.out >&4
18207 echo "Help: I can't seem to compile the db test program." >&4
18208 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18209 fi
18210 $rm -f try.*
18211 echo "Your version of Berkeley DB uses $db_hashtype for hash."
18212 ;;
18213*) db_hashtype=u_int32_t
18214 ;;
18215esac
18216case "$i_db" in
18217define)
18218 : Check the return type needed for prefix
18219 echo " "
18220 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18221 cat >try.c <<EOCP
18222#$d_const HASCONST
18223#ifndef HASCONST
18224#define const
18225#endif
18226#include <sys/types.h>
18227#include <db.h>
18228
18229#ifndef DB_VERSION_MAJOR
18230size_t prefix_cb (key1, key2)
18231const DBT *key1;
18232const DBT *key2;
18233{
18234}
18235BTREEINFO info;
18236int main()
18237{
18238 info.prefix = prefix_cb;
18239}
18240#endif
18241EOCP
18242 if $cc $ccflags -c try.c >try.out 2>&1 ; then
18243 if $contains warning try.out >>/dev/null 2>&1 ; then
18244 db_prefixtype='int'
18245 else
18246 db_prefixtype='size_t'
18247 fi
18248 else
18249 db_prefixtype='size_t'
18250 : XXX Maybe we should just give up here.
18251 $cat try.out >&4
18252 echo "Help: I can't seem to compile the db test program." >&4
18253 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18254 fi
18255 $rm -f try.*
18256 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18257 ;;
18258*) db_prefixtype='size_t'
18259 ;;
18260esac
18261
b4eb6b3d
JH
18262
18263: How can we generate normalized random numbers ?
18264echo " "
18265echo "Looking for a random number function..." >&4
18266case "$randfunc" in
18267'')
18268 if set drand48 val -f; eval $csym; $val; then
18269 dflt="drand48"
18270 echo "Good, found drand48()." >&4
18271 elif set random val -f; eval $csym; $val; then
18272 dflt="random"
18273 echo "OK, found random()." >&4
18274 else
18275 dflt="rand"
18276 echo "Yick, looks like I have to use rand()." >&4
18277 fi
18278 echo " "
18279 ;;
18280*)
18281 dflt="$randfunc"
18282 ;;
18283esac
18284cont=true
18285
18286case "$ccflags" in
18287*-Dmy_rand=*|*-Dmy_srand=*)
18288 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18289 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18290 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18291 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18292 ;;
18293esac
18294
18295while $test "$cont"; do
18296 rp="Use which function to generate random numbers?"
18297 . ./myread
18298 if $test "$ans" = "$dflt"; then
18299 : null
18300 else
18301 randbits=''
18302 fi
18303 randfunc="$ans"
18304 if set $ans val -f; eval $csym; $val; then
18305 cont=''
18306 else
18307 dflt=y
18308 rp="I cannot find function $ans. Use that name anyway?"
18309 . ./myread
18310 dflt=rand
18311 case "$ans" in
18312 [yY]*) cont='';;
18313 esac
18314 fi
18315 case "$cont" in
18316 '')
18317 case "$randfunc" in
18318 drand48)
18319 drand01="drand48()"
18320 seedfunc="srand48"
18321 randbits=48
18322 randseedtype=long
18323 ;;
18324 rand|random)
18325 case "$randbits" in
18326 '')
18327echo "Checking to see how many bits your $randfunc() function produces..." >&4
18328 $cat >try.c <<EOCP
18329#$i_unistd I_UNISTD
18330#$i_stdlib I_STDLIB
18331#include <stdio.h>
18332#ifdef I_UNISTD
18333# include <unistd.h>
18334#endif
18335#ifdef I_STDLIB
18336# include <stdlib.h>
18337#endif
18338int main()
18339{
18340 register int i;
18341 register unsigned long tmp;
18342 register unsigned long max = 0L;
18343
18344 for (i = 1000; i; i--) {
18345 tmp = (unsigned long) $randfunc();
18346 if (tmp > max) max = tmp;
18347 }
18348 for (i = 0; max; i++)
18349 max /= 2;
18350 printf("%d\n",i);
18351}
18352EOCP
18353 set try
18354 if eval $compile_ok; then
18355 dflt=`try`
18356 else
18357 dflt='?'
18358 echo "(I can't seem to compile the test program...)"
18359 fi
18360 ;;
18361 *)
18362 dflt="$randbits"
18363 ;;
18364 esac
18365 rp="How many bits does your $randfunc() function produce?"
18366 . ./myread
18367 randbits="$ans"
18368 $rm -f try.c try
18369 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18370 seedfunc="s$randfunc"
18371 randseedtype=unsigned
18372 ;;
18373 *)
18374 dflt="31"
18375 rp="How many bits does your $randfunc() function produce?"
18376 . ./myread
18377 randbits="$ans"
18378 seedfunc="s$randfunc"
18379 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18380 if set $seedfunc val -f; eval $csym; $val; then
18381 echo "(Using $seedfunc() to seed random generator)"
18382 else
18383 echo "(Warning: no $seedfunc() to seed random generator)"
18384 seedfunc=rand
18385 fi
18386 randseedtype=unsigned
18387 ;;
18388 esac
18389 ;;
18390 esac
18391done
18392
18393echo " "
18394echo "Determining whether or not we are on an EBCDIC system..." >&4
5440bc8e 18395$cat >try.c <<'EOM'
b4eb6b3d
JH
18396int main()
18397{
18398 if ('M'==0xd4) return 0;
18399 return 1;
18400}
18401EOM
18402
18403val=$undef
5440bc8e 18404set try
b4eb6b3d 18405if eval $compile_ok; then
5440bc8e 18406 if $run ./try; then
b4eb6b3d
JH
18407 echo "You seem to speak EBCDIC." >&4
18408 val="$define"
18409 else
5440bc8e 18410 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
b4eb6b3d
JH
18411 fi
18412else
18413 echo "I'm unable to compile the test program." >&4
18414 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18415fi
5440bc8e 18416$rm -f try try.*
b4eb6b3d
JH
18417set ebcdic
18418eval $setvar
18419
18420echo " "
18421$cat >&4 <<EOM
18422Checking how to flush all pending stdio output...
18423EOM
18424# I only know how to find the first 32 possibly open files on SunOS.
18425# See also hints/sunos_4_1.sh and util.c --AD
18426case "$osname" in
18427sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18428esac
18429$cat >>try.c <<EOCP
18430#include <stdio.h>
55954f19
JH
18431#$i_stdlib I_STDLIB
18432#ifdef I_STDLIB
18433#include <stdlib.h>
18434#endif
b4eb6b3d
JH
18435#$i_unistd I_UNISTD
18436#ifdef I_UNISTD
18437# include <unistd.h>
18438#endif
18439#$d_sysconf HAS_SYSCONF
18440#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18441#ifdef HAS_STDIO_STREAM_ARRAY
18442# define STDIO_STREAM_ARRAY $stdio_stream_array
18443#endif
18444int main() {
5440bc8e
JH
18445 FILE* p;
18446 unlink("try.out");
18447 p = fopen("try.out", "w");
b4eb6b3d
JH
18448#ifdef TRY_FPUTC
18449 fputc('x', p);
18450#else
18451# ifdef TRY_FPRINTF
18452 fprintf(p, "x");
18453# endif
18454#endif
18455#ifdef TRY_FFLUSH_NULL
18456 fflush(NULL);
18457#endif
18458#ifdef TRY_FFLUSH_ALL
18459 {
18460 long open_max = -1;
18461# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18462 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18463# else
18464# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18465 open_max = sysconf(_SC_OPEN_MAX);
18466# else
18467# ifdef FOPEN_MAX
18468 open_max = FOPEN_MAX;
18469# else
18470# ifdef OPEN_MAX
18471 open_max = OPEN_MAX;
18472# else
18473# ifdef _NFILE
18474 open_max = _NFILE;
18475# endif
18476# endif
18477# endif
18478# endif
18479# endif
18480# ifdef HAS_STDIO_STREAM_ARRAY
18481 if (open_max > 0) {
18482 long i;
18483 for (i = 0; i < open_max; i++)
18484 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18485 STDIO_STREAM_ARRAY[i]._file < open_max &&
18486 STDIO_STREAM_ARRAY[i]._flag)
18487 fflush(&STDIO_STREAM_ARRAY[i]);
18488 }
18489 }
18490# endif
18491#endif
18492 _exit(42);
18493}
18494EOCP
18495: first we have to find out how _not_ to flush
5440bc8e 18496$to try.c
b4eb6b3d
JH
18497if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18498 output=''
18499 set try -DTRY_FPUTC
18500 if eval $compile; then
fbe73d74 18501 $run ./try 2>/dev/null
28f5ac64 18502 code="$?"
5440bc8e 18503 $from try.out
28f5ac64 18504 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
18505 output=-DTRY_FPUTC
18506 fi
18507 fi
18508 case "$output" in
18509 '')
18510 set try -DTRY_FPRINTF
b4eb6b3d 18511 if eval $compile; then
fbe73d74 18512 $run ./try 2>/dev/null
28f5ac64 18513 code="$?"
5440bc8e 18514 $from try.out
28f5ac64 18515 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
18516 output=-DTRY_FPRINTF
18517 fi
18518 fi
18519 ;;
18520 esac
18521fi
18522: check for fflush NULL behaviour
18523case "$fflushNULL" in
18524'') set try -DTRY_FFLUSH_NULL $output
18525 if eval $compile; then
5440bc8e 18526 $run ./try 2>/dev/null
b4eb6b3d 18527 code="$?"
5440bc8e 18528 $from try.out
b4eb6b3d
JH
18529 if $test -s try.out -a "X$code" = X42; then
18530 fflushNULL="`$cat try.out`"
18531 else
18532 if $test "X$code" != X42; then
18533 $cat >&4 <<EOM
18534(If this test failed, don't worry, we'll try another method shortly.)
18535EOM
18536 fi
18537 fi
18538 fi
18539 $rm -f core try.core core.try.*
18540 case "$fflushNULL" in
18541 x) $cat >&4 <<EOM
18542Your fflush(NULL) works okay for output streams.
18543Let's see if it clobbers input pipes...
18544EOM
18545# As of mid-March 2000 all versions of Solaris appear to have a stdio
18546# bug that improperly flushes the input end of pipes. So we avoid the
18547# autoflush on fork/system/exec support for now. :-(
18548$cat >tryp.c <<EOCP
18549#include <stdio.h>
18550int
18551main(int argc, char **argv)
18552{
18553 char buf[1024];
18554 int i;
18555 char *bp = buf;
18556 while (1) {
18557 while ((i = getc(stdin)) != -1
18558 && (*bp++ = i) != '\n'
18559 && bp < &buf[1024])
18560 /* DO NOTHING */ ;
18561 *bp = '\0';
18562 fprintf(stdout, "%s", buf);
18563 fflush(NULL);
18564 if (i == -1)
18565 return 0;
18566 bp = buf;
18567 }
18568}
18569EOCP
18570 fflushNULL="$define"
18571 set tryp
18572 if eval $compile; then
18573 $rm -f tryp.out
5440bc8e 18574 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
18575 if cmp tryp.c tryp.out >/dev/null 2>&1; then
18576 $cat >&4 <<EOM
18577fflush(NULL) seems to behave okay with input streams.
18578EOM
18579 fflushNULL="$define"
18580 else
18581 $cat >&4 <<EOM
18582Ouch, fflush(NULL) clobbers input pipes! We will not use it.
18583EOM
18584 fflushNULL="$undef"
18585 fi
18586 fi
18587 $rm -f core tryp.c tryp.core core.tryp.*
18588 ;;
18589 '') $cat >&4 <<EOM
18590Your fflush(NULL) isn't working (contrary to ANSI C).
18591EOM
18592 fflushNULL="$undef"
18593 ;;
18594 *) $cat >&4 <<EOM
18595Cannot figure out whether your fflush(NULL) works or not.
18596I'm assuming it doesn't (contrary to ANSI C).
18597EOM
18598 fflushNULL="$undef"
18599 ;;
18600 esac
18601 ;;
18602$define|true|[yY]*)
18603 fflushNULL="$define"
18604 ;;
18605*)
18606 fflushNULL="$undef"
18607 ;;
18608esac
18609: check explicit looping only if NULL did not work, and if the pipe
18610: bug does not show up on an explicit flush too
18611case "$fflushNULL" in
18612"$undef")
18613 $cat >tryp.c <<EOCP
18614#include <stdio.h>
18615int
18616main(int argc, char **argv)
18617{
18618 char buf[1024];
18619 int i;
18620 char *bp = buf;
18621 while (1) {
18622 while ((i = getc(stdin)) != -1
18623 && (*bp++ = i) != '\n'
18624 && bp < &buf[1024])
18625 /* DO NOTHING */ ;
18626 *bp = '\0';
18627 fprintf(stdout, "%s", buf);
18628 fflush(stdin);
18629 if (i == -1)
18630 return 0;
18631 bp = buf;
18632 }
18633}
18634EOCP
18635 set tryp
18636 if eval $compile; then
18637 $rm -f tryp.out
5440bc8e 18638 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
18639 if cmp tryp.c tryp.out >/dev/null 2>&1; then
18640 $cat >&4 <<EOM
18641Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18642EOM
18643 : now check for fflushall behaviour
18644 case "$fflushall" in
18645 '') set try -DTRY_FFLUSH_ALL $output
18646 if eval $compile; then
18647 $cat >&4 <<EOM
18648(Now testing the other method--but note that this also may fail.)
18649EOM
5440bc8e 18650 $run ./try 2>/dev/null
28f5ac64 18651 code=$?
fbe73d74 18652 $from try.out
28f5ac64 18653 if $test -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
18654 fflushall="`$cat try.out`"
18655 fi
18656 fi
18657 $rm -f core try.core core.try.*
18658 case "$fflushall" in
18659 x) $cat >&4 <<EOM
18660Whew. Flushing explicitly all the stdio streams works.
18661EOM
18662 fflushall="$define"
18663 ;;
18664 '') $cat >&4 <<EOM
18665Sigh. Flushing explicitly all the stdio streams doesn't work.
18666EOM
18667 fflushall="$undef"
18668 ;;
18669 *) $cat >&4 <<EOM
18670Cannot figure out whether flushing stdio streams explicitly works or not.
18671I'm assuming it doesn't.
18672EOM
18673 fflushall="$undef"
18674 ;;
18675 esac
18676 ;;
18677 "$define"|true|[yY]*)
18678 fflushall="$define"
18679 ;;
18680 *)
18681 fflushall="$undef"
18682 ;;
18683 esac
18684 else
18685 $cat >&4 <<EOM
18686All is futile. Even fflush(stdin) clobbers input pipes!
18687EOM
18688 fflushall="$undef"
18689 fi
18690 else
18691 fflushall="$undef"
18692 fi
18693 $rm -f core tryp.c tryp.core core.tryp.*
18694 ;;
18695*) fflushall="$undef"
18696 ;;
18697esac
18698
18699case "$fflushNULL$fflushall" in
18700undefundef)
18701 $cat <<EOM
18702OK, I give up. I cannot figure out how to flush pending stdio output.
18703We won't be flushing handles at all before fork/exec/popen.
18704EOM
18705 ;;
18706esac
18707$rm -f try.* try$exe_ext
18708
18709: Store the full pathname to the ar program for use in the C program
18710: Respect a hint or command line value for full_ar.
18711case "$full_ar" in
18712'') full_ar=$ar ;;
18713esac
18714
18715: Store the full pathname to the sed program for use in the C program
18716full_sed=$sed
18717
18718: see what type gids are declared as in the kernel
18719echo " "
18720echo "Looking for the type for group ids returned by getgid()."
18721set gid_t gidtype xxx stdio.h sys/types.h
18722eval $typedef
18723case "$gidtype" in
18724xxx)
18725 xxx=`./findhdr sys/user.h`
18726 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18727 case $1 in
18728 unsigned) dflt="$1 $2" ;;
18729 *) dflt="$1" ;;
18730 esac
18731 ;;
18732*) dflt="$gidtype";;
18733esac
18734case "$gidtype" in
18735gid_t) echo "gid_t found." ;;
18736*) rp="What is the type for group ids returned by getgid()?"
18737 . ./myread
18738 gidtype="$ans"
18739 ;;
18740esac
18741
18742echo " "
18743case "$gidtype" in
18744*_t) zzz="$gidtype" ;;
18745*) zzz="gid" ;;
18746esac
18747echo "Checking the size of $zzz..." >&4
18748cat > try.c <<EOCP
18749#include <sys/types.h>
18750#include <stdio.h>
d1daaddf
JH
18751#$i_stdlib I_STDLIB
18752#ifdef I_STDLIB
18753#include <stdlib.h>
18754#endif
b4eb6b3d
JH
18755int main() {
18756 printf("%d\n", (int)sizeof($gidtype));
18757 exit(0);
18758}
18759EOCP
18760set try
18761if eval $compile_ok; then
5440bc8e 18762 yyy=`$run ./try`
b4eb6b3d
JH
18763 case "$yyy" in
18764 '') gidsize=4
18765 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18766 ;;
18767 *) gidsize=$yyy
18768 echo "Your $zzz is $gidsize bytes long."
18769 ;;
18770 esac
18771else
18772 gidsize=4
18773 echo "(I can't compile the test program--guessing $gidsize.)" >&4
18774fi
18775
18776
18777echo " "
18778case "$gidtype" in
18779*_t) zzz="$gidtype" ;;
18780*) zzz="gid" ;;
18781esac
18782echo "Checking the sign of $zzz..." >&4
18783cat > try.c <<EOCP
18784#include <sys/types.h>
18785#include <stdio.h>
18786int main() {
18787 $gidtype foo = -1;
18788 if (foo < 0)
18789 printf("-1\n");
18790 else
18791 printf("1\n");
18792}
18793EOCP
18794set try
18795if eval $compile; then
5440bc8e 18796 yyy=`$run ./try`
b4eb6b3d
JH
18797 case "$yyy" in
18798 '') gidsign=1
18799 echo "(I can't execute the test program--guessing unsigned.)" >&4
18800 ;;
18801 *) gidsign=$yyy
18802 case "$gidsign" in
18803 1) echo "Your $zzz is unsigned." ;;
18804 -1) echo "Your $zzz is signed." ;;
18805 esac
18806 ;;
18807 esac
18808else
18809 gidsign=1
18810 echo "(I can't compile the test program--guessing unsigned.)" >&4
18811fi
18812
18813
18814echo " "
18815
18816if $test X"$quadtype" != X; then
18817
18818echo "Checking how to print 64-bit integers..." >&4
18819
18820if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18821 $cat >try.c <<'EOCP'
18822#include <sys/types.h>
18823#include <stdio.h>
18824int main() {
18825 int q = 12345678901;
18826 printf("%ld\n", q);
18827}
18828EOCP
18829 set try
18830 if eval $compile; then
5440bc8e 18831 yyy=`$run ./try`
b4eb6b3d
JH
18832 case "$yyy" in
18833 12345678901)
18834 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18835 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18836 echo "We will use %d."
18837 ;;
18838 esac
18839 fi
18840fi
18841
18842if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18843 $cat >try.c <<'EOCP'
18844#include <sys/types.h>
18845#include <stdio.h>
18846int main() {
18847 long q = 12345678901;
18848 printf("%ld\n", q);
18849}
18850EOCP
18851 set try
18852 if eval $compile; then
5440bc8e 18853 yyy=`$run ./try`
b4eb6b3d
JH
18854 case "$yyy" in
18855 12345678901)
18856 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18857 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18858 echo "We will use %ld."
18859 ;;
18860 esac
18861 fi
18862fi
18863
18864if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18865 $cat >try.c <<'EOCP'
18866#include <sys/types.h>
18867#include <inttypes.h>
18868#include <stdio.h>
18869int main() {
18870 int64_t q = 12345678901;
18871 printf("%" PRId64 "\n", q);
18872}
18873EOCP
18874 set try
18875 if eval $compile; then
5440bc8e 18876 yyy=`$run ./try`
b4eb6b3d
JH
18877 case "$yyy" in
18878 12345678901)
18879 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18880 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18881 echo "We will use the C9X style."
18882 ;;
18883 esac
18884 fi
18885fi
18886
2ef53570
JH
18887if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18888 $cat >try.c <<EOCP
b4eb6b3d
JH
18889#include <sys/types.h>
18890#include <stdio.h>
18891int main() {
2ef53570
JH
18892 $quadtype q = 12345678901;
18893 printf("%Ld\n", q);
b4eb6b3d
JH
18894}
18895EOCP
18896 set try
18897 if eval $compile; then
5440bc8e 18898 yyy=`$run ./try`
b4eb6b3d
JH
18899 case "$yyy" in
18900 12345678901)
2ef53570
JH
18901 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18902 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18903 echo "We will use %Ld."
b4eb6b3d
JH
18904 ;;
18905 esac
18906 fi
18907fi
18908
2ef53570
JH
18909if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18910 $cat >try.c <<'EOCP'
b4eb6b3d
JH
18911#include <sys/types.h>
18912#include <stdio.h>
18913int main() {
2ef53570
JH
18914 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18915 printf("%lld\n", q);
b4eb6b3d
JH
18916}
18917EOCP
18918 set try
18919 if eval $compile; then
5440bc8e 18920 yyy=`$run ./try`
b4eb6b3d
JH
18921 case "$yyy" in
18922 12345678901)
2ef53570
JH
18923 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18924 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18925 echo "We will use the %lld style."
b4eb6b3d
JH
18926 ;;
18927 esac
18928 fi
18929fi
18930
18931if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18932 $cat >try.c <<EOCP
18933#include <sys/types.h>
18934#include <stdio.h>
18935int main() {
18936 $quadtype q = 12345678901;
18937 printf("%qd\n", q);
18938}
18939EOCP
18940 set try
18941 if eval $compile; then
5440bc8e 18942 yyy=`$run ./try`
b4eb6b3d
JH
18943 case "$yyy" in
18944 12345678901)
18945 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18946 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18947 echo "We will use %qd."
18948 ;;
18949 esac
18950 fi
18951fi
18952
18953if $test X"$sPRId64" = X; then
18954 echo "Cannot figure out how to print 64-bit integers." >&4
18955fi
18956
18957$rm -f try try.*
18958
18959fi
18960
18961case "$sPRId64" in
18962'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
18963 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
18964 ;;
18965*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
18966 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
18967 ;;
18968esac
18969
18970
18971echo " "
18972$echo "Checking the format strings to be used for Perl's internal types..." >&4
18973
18974if $test X"$ivsize" = X8; then
18975 ivdformat="$sPRId64"
18976 uvuformat="$sPRIu64"
18977 uvoformat="$sPRIo64"
18978 uvxformat="$sPRIx64"
18979 uvXUformat="$sPRIXU64"
18980else
18981 if $test X"$ivsize" = X"$longsize"; then
18982 ivdformat='"ld"'
18983 uvuformat='"lu"'
18984 uvoformat='"lo"'
18985 uvxformat='"lx"'
18986 uvXUformat='"lX"'
18987 else
18988 if $test X"$ivsize" = X"$intsize"; then
18989 ivdformat='"d"'
18990 uvuformat='"u"'
18991 uvoformat='"o"'
18992 uvxformat='"x"'
18993 uvXUformat='"X"'
18994 else
18995 : far out
18996 if $test X"$ivsize" = X"$shortsize"; then
18997 ivdformat='"hd"'
18998 uvuformat='"hu"'
18999 uvoformat='"ho"'
19000 uvxformat='"hx"'
19001 uvXUformat='"hX"'
19002 fi
19003 fi
19004 fi
19005fi
19006
19007if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19008 nveformat="$sPRIeldbl"
19009 nvfformat="$sPRIfldbl"
19010 nvgformat="$sPRIgldbl"
19011 nvEUformat="$sPRIEUldbl"
19012 nvFUformat="$sPRIFUldbl"
19013 nvGUformat="$sPRIGUldbl"
19014else
19015 nveformat='"e"'
19016 nvfformat='"f"'
19017 nvgformat='"g"'
19018 nvEUformat='"E"'
19019 nvFUformat='"F"'
19020 nvGUformat='"G"'
19021fi
19022
19023case "$ivdformat" in
3c728e00 19024'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
b4eb6b3d
JH
19025 exit 1
19026 ;;
19027esac
19028
19029
19030echo " "
19031$echo "Checking the format string to be used for gids..." >&4
19032
19033case "$gidsign" in
19034-1) if $test X"$gidsize" = X"$ivsize"; then
19035 gidformat="$ivdformat"
19036 else
19037 if $test X"$gidsize" = X"$longsize"; then
19038 gidformat='"ld"'
19039 else
19040 if $test X"$gidsize" = X"$intsize"; then
19041 gidformat='"d"'
19042 else
19043 if $test X"$gidsize" = X"$shortsize"; then
19044 gidformat='"hd"'
19045 fi
19046 fi
19047 fi
19048 fi
19049 ;;
19050*) if $test X"$gidsize" = X"$uvsize"; then
19051 gidformat="$uvuformat"
19052 else
19053 if $test X"$gidsize" = X"$longsize"; then
19054 gidformat='"lu"'
19055 else
19056 if $test X"$gidsize" = X"$intsize"; then
19057 gidformat='"u"'
19058 else
19059 if $test X"$gidsize" = X"$shortsize"; then
19060 gidformat='"hu"'
19061 fi
19062 fi
19063 fi
19064 fi
19065 ;;
19066esac
19067
19068: see if getgroups exists
19069set getgroups d_getgrps
19070eval $inlibc
19071
19072: see if setgroups exists
19073set setgroups d_setgrps
19074eval $inlibc
19075
19076
19077: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19078echo " "
19079case "$d_getgrps$d_setgrps" in
19080*define*)
19081 case "$groupstype" in
19082 '') dflt="$gidtype" ;;
19083 *) dflt="$groupstype" ;;
19084 esac
19085 $cat <<EOM
19086What type of pointer is the second argument to getgroups() and setgroups()?
19087Usually this is the same as group ids, $gidtype, but not always.
19088
19089EOM
19090 rp='What type pointer is the second argument to getgroups() and setgroups()?'
19091 . ./myread
19092 groupstype="$ans"
19093 ;;
19094*) groupstype="$gidtype";;
19095esac
19096
d620c7b3 19097
fd655d33
NC
19098if $test $patchlevel -lt 9; then
19099: MAD is not available in 5.8.x or earlier.
19100 ans=n;
19101else
19102 case "$mad" in
19103 $define|true|[yY]*) dflt='y' ;;
19104 *) dflt='n' ;;
19105 esac
19106 cat <<EOM
d620c7b3
MB
19107
19108Would you like to build with Misc Attribute Decoration? This is development
19109work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19110overhead on the interpreter.
19111
19112If this doesn't make any sense to you, just accept the default '$dflt'.
19113EOM
fd655d33
NC
19114 rp='Build Perl with MAD?'
19115 . ./myread
19116fi
d620c7b3 19117case "$ans" in
00e74f14
NC
19118y|Y) val="$define"
19119 madlyh='madly.h madly.act madly.tab'
19120 madlysrc='madly.c'
19121 madlyobj="madly$_o" ;;
19122*) val="$undef"
19123 madlyh=''
19124 madlysrc=''
19125 madlyobj='' ;;
d620c7b3
MB
19126esac
19127set mad
19128eval $setvar
19129
b4eb6b3d
JH
19130echo " "
19131echo "Checking if your $make program sets \$(MAKE)..." >&4
19132case "$make_set_make" in
19133'')
19134 $sed 's/^X //' > testmake.mak << 'EOF'
19135Xall:
19136X @echo 'maketemp="$(MAKE)"'
19137EOF
19138 case "`$make -f testmake.mak 2>/dev/null`" in
19139 *maketemp=*) make_set_make='#' ;;
19140 *) make_set_make="MAKE=$make" ;;
19141 esac
19142 $rm -f testmake.mak
19143 ;;
19144esac
19145case "$make_set_make" in
19146'#') echo "Yup, it does.";;
19147*) echo "Nope, it doesn't.";;
19148esac
19149
19150: see what type is used for mode_t
19151rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19152set mode_t modetype int stdio.h sys/types.h
19153eval $typedef_ask
19154
2cc61e15
DD
19155: see if we need va_copy
19156echo " "
19157case "$i_stdarg" in
19158"$define")
19159 $cat >try.c <<EOCP
19160#include <stdarg.h>
19161#include <stdio.h>
85c8a686
DD
19162#$i_stdlib I_STDLIB
19163#ifdef I_STDLIB
19164#include <stdlib.h>
19165#endif
19166#include <signal.h>
2cc61e15
DD
19167
19168int
19169ivfprintf(FILE *f, const char *fmt, va_list *valp)
19170{
19171 return vfprintf(f, fmt, *valp);
19172}
19173
19174int
19175myvfprintf(FILE *f, const char *fmt, va_list val)
19176{
19177 return ivfprintf(f, fmt, &val);
19178}
19179
19180int
19181myprintf(char *fmt, ...)
19182{
19183 va_list val;
19184 va_start(val, fmt);
19185 return myvfprintf(stdout, fmt, val);
19186}
19187
19188int
19189main(int ac, char **av)
19190{
85c8a686
DD
19191 signal(SIGSEGV, exit);
19192
2cc61e15
DD
19193 myprintf("%s%cs all right, then\n", "that", '\'');
19194 exit(0);
19195}
19196EOCP
19197 set try
5440bc8e
JH
19198 if eval $compile && $run ./try 2>&1 >/dev/null; then
19199 case "`$run ./try`" in
2cc61e15
DD
19200 "that's all right, then")
19201 okay=yes
19202 ;;
19203 esac
19204 fi
19205 case "$okay" in
19206 yes) echo "It seems that you don't need va_copy()." >&4
19207 need_va_copy="$undef"
19208 ;;
19209 *) echo "It seems that va_copy() or similar will be needed." >&4
19210 need_va_copy="$define"
19211 ;;
19212 esac
19213 $rm -f try.* core core.* *.core *.core.*
19214 ;;
19215*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19216 ;;
19217esac
19218
b4eb6b3d
JH
19219: see what type is used for size_t
19220rp="What is the type used for the length parameter for string functions?"
19221set size_t sizetype 'unsigned int' stdio.h sys/types.h
19222eval $typedef_ask
19223
19224: check for type of arguments to gethostbyaddr.
19225if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19226 case "$d_gethbyaddr" in
19227 $define)
19228 $cat <<EOM
19229
19230Checking to see what type of arguments are accepted by gethostbyaddr().
19231EOM
19232 hdrs="$define sys/types.h
19233 $d_socket sys/socket.h
19234 $i_niin netinet/in.h
19235 $i_netdb netdb.h
19236 $i_unistd unistd.h"
19237 : The first arg can 'char *' or 'void *'
19238 : The second arg is some of integral type
19239 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19240 for yyy in size_t long int; do
19241 case "$netdb_host_type" in
19242 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19243 if ./protochk "$try" $hdrs; then
19244 echo "Your system accepts $xxx for the first arg."
19245 echo "...and $yyy for the second arg."
19246 netdb_host_type="$xxx"
19247 netdb_hlen_type="$yyy"
19248 fi
19249 ;;
19250 esac
19251 done
19252 done
19253 : In case none of those worked, prompt the user.
19254 case "$netdb_host_type" in
19255 '') rp='What is the type for the 1st argument to gethostbyaddr?'
19256 dflt='char *'
19257 . ./myread
19258 netdb_host_type=$ans
19259 rp='What is the type for the 2nd argument to gethostbyaddr?'
19260 dflt="$sizetype"
19261 . ./myread
19262 netdb_hlen_type=$ans
19263 ;;
19264 esac
19265 ;;
19266 *) : no gethostbyaddr, so pick harmless defaults
19267 netdb_host_type='char *'
19268 netdb_hlen_type="$sizetype"
19269 ;;
19270 esac
19271 # Remove the "const" if needed. -- but then we'll have a
19272 # prototype clash!
19273 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19274fi
19275
19276: check for type of argument to gethostbyname.
19277if test "X$netdb_name_type" = X ; then
19278 case "$d_gethbyname" in
19279 $define)
19280 $cat <<EOM
19281
19282Checking to see what type of argument is accepted by gethostbyname().
19283EOM
19284 hdrs="$define sys/types.h
19285 $d_socket sys/socket.h
19286 $i_niin netinet/in.h
19287 $i_netdb netdb.h
19288 $i_unistd unistd.h"
19289 for xxx in "const char *" "char *"; do
19290 case "$netdb_name_type" in
19291 '') try="extern struct hostent *gethostbyname($xxx);"
19292 if ./protochk "$try" $hdrs; then
19293 echo "Your system accepts $xxx."
19294 netdb_name_type="$xxx"
19295 fi
19296 ;;
19297 esac
19298 done
19299 : In case none of those worked, prompt the user.
19300 case "$netdb_name_type" in
19301 '') rp='What is the type for the 1st argument to gethostbyname?'
19302 dflt='char *'
19303 . ./myread
19304 netdb_name_type=$ans
19305 ;;
19306 esac
19307 ;;
19308 *) : no gethostbyname, so pick harmless default
19309 netdb_name_type='char *'
19310 ;;
19311 esac
19312fi
19313
19314: check for type of 1st argument to getnetbyaddr.
19315if test "X$netdb_net_type" = X ; then
19316 case "$d_getnbyaddr" in
19317 $define)
19318 $cat <<EOM
19319
19320Checking to see what type of 1st argument is accepted by getnetbyaddr().
19321EOM
19322 hdrs="$define sys/types.h
19323 $d_socket sys/socket.h
19324 $i_niin netinet/in.h
19325 $i_netdb netdb.h
19326 $i_unistd unistd.h"
19327 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19328 case "$netdb_net_type" in
19329 '') try="extern struct netent *getnetbyaddr($xxx, int);"
19330 if ./protochk "$try" $hdrs; then
19331 echo "Your system accepts $xxx."
19332 netdb_net_type="$xxx"
19333 fi
19334 ;;
19335 esac
19336 done
19337 : In case none of those worked, prompt the user.
19338 case "$netdb_net_type" in
19339 '') rp='What is the type for the 1st argument to getnetbyaddr?'
19340 dflt='long'
19341 . ./myread
19342 netdb_net_type=$ans
19343 ;;
19344 esac
19345 ;;
19346 *) : no getnetbyaddr, so pick harmless default
19347 netdb_net_type='long'
19348 ;;
19349 esac
19350fi
19351: locate the preferred pager for this system
d604bb53 19352fn=f/
b4eb6b3d
JH
19353case "$pager" in
19354'')
19355 dflt=''
19356 case "$pg" in
19357 /*) dflt=$pg;;
19358 [a-zA-Z]:/*) dflt=$pg;;
19359 esac
19360 case "$more" in
19361 /*) dflt=$more;;
19362 [a-zA-Z]:/*) dflt=$more;;
19363 esac
19364 case "$less" in
19365 /*) dflt=$less;;
19366 [a-zA-Z]:/*) dflt=$less;;
19367 esac
19368 case "$dflt" in
19369 '') dflt=/usr/ucb/more;;
19370 esac
19371 ;;
d604bb53
JH
19372*) dflt="$pager"
19373 : Instruct ./getfile to trust the hinted or previous pager value,
19374 : even if it does not begin with a slash. For example, on os2,
19375 : pager might be cmd /c more. See comments in UU/getfile.
19376 fn="f/($pager)"
19377 ;;
b4eb6b3d
JH
19378esac
19379echo " "
b4eb6b3d
JH
19380rp='What pager is used on your system?'
19381. ./getfile
19382pager="$ans"
19383
19384: see what type pids are declared as in the kernel
19385rp="What is the type of process ids on this system?"
19386set pid_t pidtype int stdio.h sys/types.h
19387eval $typedef_ask
19388
b4eb6b3d
JH
19389: see if ar generates random libraries by itself
19390echo " "
19391echo "Checking how to generate random libraries on your machine..." >&4
19392echo 'int bar1() { return bar2(); }' > bar1.c
19393echo 'int bar2() { return 2; }' > bar2.c
55954f19
JH
19394$cat > foo.c <<EOP
19395#$i_stdlib I_STDLIB
19396#ifdef I_STDLIB
19397#include <stdlib.h>
19398#endif
b4eb6b3d
JH
19399int main() { printf("%d\n", bar1()); exit(0); }
19400EOP
19401$cc $ccflags -c bar1.c >/dev/null 2>&1
19402$cc $ccflags -c bar2.c >/dev/null 2>&1
19403$cc $ccflags -c foo.c >/dev/null 2>&1
19404$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 19405if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 19406 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
19407 echo "$ar appears to generate random libraries itself."
19408 orderlib=false
e39a9d84
LC
19409 if [ "X$ranlib" = "X" ]; then
19410 ranlib=":"
19411 fi
88d4d47b
PC
19412elif $ar s bar$_a >/dev/null 2>&1 &&
19413 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19414 $run ./foobar >/dev/null 2>&1; then
19415 echo "a table of contents needs to be added with '$ar s'."
19416 orderlib=false
19417 ranlib="$ar s"
b4eb6b3d 19418elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 19419 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 19420 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
19421 echo "a table of contents needs to be added with '$ar ts'."
19422 orderlib=false
19423 ranlib="$ar ts"
19424else
19425 case "$ranlib" in
19426 :) ranlib='';;
19427 '')
19428 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19429 $test -f $ranlib || ranlib=''
19430 ;;
19431 esac
19432 if $test -n "$ranlib"; then
19433 echo "your system has '$ranlib'; we'll use that."
19434 orderlib=false
19435 else
19436 echo "your system doesn't seem to support random libraries"
19437 echo "so we'll use lorder and tsort to order the libraries."
19438 orderlib=true
19439 ranlib=":"
19440 fi
19441fi
88d4d47b 19442$rm -f foo* bar*
b4eb6b3d
JH
19443
19444: check for type of arguments to select.
19445case "$selecttype" in
19446'') case "$d_select" in
19447 $define)
19448 echo " "
19449 $cat <<EOM
19450Checking to see what type of arguments are accepted by select().
19451EOM
19452 hdrs="$define sys/types.h
19453 $i_systime sys/time.h
19454 $i_sysselct sys/select.h
19455 $d_socket sys/socket.h"
19456 : The first arg can be int, unsigned, or size_t
19457 : The last arg may or may not be 'const'
19458 val=''
19459 : void pointer has been seen but using that
19460 : breaks the selectminbits test
19461 for xxx in 'fd_set *' 'int *'; do
19462 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19463 for tmo in 'struct timeval *' 'const struct timeval *'; do
19464 case "$val" in
19465 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19466 if ./protochk "$try" $hdrs; then
19467 echo "Your system accepts $xxx."
19468 val="$xxx"
19469 fi
19470 ;;
19471 esac
19472 done
19473 done
19474 done
19475 case "$val" in
19476 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19477 case "$d_fd_set" in
19478 $define) dflt="fd_set *" ;;
19479 *) dflt="int *" ;;
19480 esac
19481 . ./myread
19482 val=$ans
19483 ;;
19484 esac
19485 selecttype="$val"
19486 ;;
19487 *) : no select, so pick a harmless default
19488 selecttype='int *'
19489 ;;
19490 esac
19491 ;;
19492esac
19493
19494: check for the select 'width'
19495case "$selectminbits" in
e6e7e605
JH
19496'') safebits=`expr $ptrsize \* 8`
19497 case "$d_select" in
b4eb6b3d
JH
19498 $define)
19499 $cat <<EOM
19500
19501Checking to see on how many bits at a time your select() operates...
19502EOM
19503 $cat >try.c <<EOCP
19504#include <sys/types.h>
19505#$i_time I_TIME
19506#$i_systime I_SYS_TIME
19507#$i_systimek I_SYS_TIME_KERNEL
19508#ifdef I_TIME
19509# include <time.h>
19510#endif
19511#ifdef I_SYS_TIME
19512# ifdef I_SYS_TIME_KERNEL
19513# define KERNEL
19514# endif
19515# include <sys/time.h>
19516# ifdef I_SYS_TIME_KERNEL
19517# undef KERNEL
19518# endif
19519#endif
19520#$i_sysselct I_SYS_SELECT
19521#ifdef I_SYS_SELECT
19522#include <sys/select.h>
19523#endif
19524#$d_socket HAS_SOCKET
19525#ifdef HAS_SOCKET
19526# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19527#endif
19528#include <stdio.h>
d1daaddf
JH
19529#$i_stdlib I_STDLIB
19530#ifdef I_STDLIB
19531#include <stdlib.h>
19532#endif
b4eb6b3d
JH
19533$selecttype b;
19534#define S sizeof(*(b))
19535#define MINBITS 64
19536#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19537#define NBITS (NBYTES * 8)
19538int main() {
e6e7e605 19539 char *s = malloc(NBYTES);
b4eb6b3d
JH
19540 struct timeval t;
19541 int i;
19542 FILE* fp;
19543 int fd;
19544
e6e7e605
JH
19545 if (!s)
19546 exit(1);
b4eb6b3d
JH
19547 fclose(stdin);
19548 fp = fopen("try.c", "r");
19549 if (fp == 0)
e6e7e605 19550 exit(2);
b4eb6b3d
JH
19551 fd = fileno(fp);
19552 if (fd < 0)
e6e7e605 19553 exit(3);
b4eb6b3d
JH
19554 b = ($selecttype)s;
19555 for (i = 0; i < NBITS; i++)
19556 FD_SET(i, b);
19557 t.tv_sec = 0;
19558 t.tv_usec = 0;
19559 select(fd + 1, b, 0, 0, &t);
19560 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
e6e7e605 19561 free(s);
b4eb6b3d
JH
19562 printf("%d\n", i + 1);
19563 return 0;
19564}
19565EOCP
19566 set try
19567 if eval $compile_ok; then
5440bc8e 19568 selectminbits=`$run ./try`
b4eb6b3d
JH
19569 case "$selectminbits" in
19570 '') cat >&4 <<EOM
19571Cannot figure out on how many bits at a time your select() operates.
e6e7e605 19572I'll play safe and guess it is $safebits bits.
b4eb6b3d 19573EOM
e6e7e605
JH
19574 selectminbits=$safebits
19575 bits="$safebits bits"
b4eb6b3d
JH
19576 ;;
19577 1) bits="1 bit" ;;
19578 *) bits="$selectminbits bits" ;;
19579 esac
19580 echo "Your select() operates on $bits at a time." >&4
19581 else
19582 rp='What is the minimum number of bits your select() operates on?'
19583 case "$byteorder" in
e6e7e605
JH
19584 12345678) dflt=64 ;;
19585 1234) dflt=32 ;;
b4eb6b3d
JH
19586 *) dflt=1 ;;
19587 esac
19588 . ./myread
19589 val=$ans
19590 selectminbits="$val"
19591 fi
19592 $rm -f try.* try
19593 ;;
19594 *) : no select, so pick a harmless default
e6e7e605 19595 selectminbits=$safebits
b4eb6b3d
JH
19596 ;;
19597 esac
19598 ;;
19599esac
19600
19601: Trace out the files included by signal.h, then look for SIGxxx names.
19602: Remove SIGARRAYSIZE used by HPUX.
19603: Remove SIGSTKSIZE used by Linux.
19604: Remove SIGSTKSZ used by Posix.
19605: Remove SIGTYP void lines used by OS2.
19606: Some cpps, like os390, dont give the file name anywhere
19607if [ "X$fieldn" = X ]; then
19608 : Just make some guesses. We check them later.
19609 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19610else
19611 xxx=`echo '#include <signal.h>' |
19612 $cppstdin $cppminus $cppflags 2>/dev/null |
19613 $grep '^[ ]*#.*include' |
a938a3bb 19614 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
b4eb6b3d
JH
19615fi
19616: Check this list of files to be sure we have parsed the cpp output ok.
19617: This will also avoid potentially non-existent files, such
19618: as ../foo/bar.h
19619xxxfiles=''
19620for xx in $xxx /dev/null ; do
19621 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19622done
19623: If we have found no files, at least try signal.h
19624case "$xxxfiles" in
19625'') xxxfiles=`./findhdr signal.h` ;;
19626esac
19627xxx=`awk '
19628$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19629 print substr($2, 4, 20)
19630}
19631$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19632 print substr($3, 4, 20)
19633}' $xxxfiles`
19634: Append some common names just in case the awk scan failed.
19635xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19636xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19637xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19638xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19639xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19640
19641: generate a few handy files for later
55954f19 19642$cat > signal.c <<EOCP
b4eb6b3d
JH
19643#include <sys/types.h>
19644#include <signal.h>
55954f19
JH
19645#$i_stdlib I_STDLIB
19646#ifdef I_STDLIB
19647#include <stdlib.h>
19648#endif
b4eb6b3d
JH
19649#include <stdio.h>
19650int main() {
19651
19652/* Strange style to avoid deeply-nested #if/#else/#endif */
19653#ifndef NSIG
19654# ifdef _NSIG
19655# define NSIG (_NSIG)
19656# endif
19657#endif
19658
19659#ifndef NSIG
19660# ifdef SIGMAX
19661# define NSIG (SIGMAX+1)
19662# endif
19663#endif
19664
19665#ifndef NSIG
19666# ifdef SIG_MAX
19667# define NSIG (SIG_MAX+1)
19668# endif
19669#endif
19670
19671#ifndef NSIG
3609ea0d
JH
19672# ifdef _SIG_MAX
19673# define NSIG (_SIG_MAX+1)
19674# endif
19675#endif
19676
19677#ifndef NSIG
b4eb6b3d
JH
19678# ifdef MAXSIG
19679# define NSIG (MAXSIG+1)
19680# endif
19681#endif
19682
19683#ifndef NSIG
19684# ifdef MAX_SIG
19685# define NSIG (MAX_SIG+1)
19686# endif
19687#endif
19688
19689#ifndef NSIG
19690# ifdef SIGARRAYSIZE
3609ea0d 19691# define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
b4eb6b3d
JH
19692# endif
19693#endif
19694
19695#ifndef NSIG
19696# ifdef _sys_nsig
19697# define NSIG (_sys_nsig) /* Solaris 2.5 */
19698# endif
19699#endif
19700
19701/* Default to some arbitrary number that's big enough to get most
19702 of the common signals.
19703*/
19704#ifndef NSIG
19705# define NSIG 50
19706#endif
19707
19708printf("NSIG %d\n", NSIG);
19709
19710#ifndef JUST_NSIG
19711
19712EOCP
19713
19714echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19715{
19716 printf "#ifdef SIG"; printf $1; printf "\n"
65197d93 19717 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
b4eb6b3d
JH
19718 printf $1; printf ");\n"
19719 printf "#endif\n"
19720}
19721END {
19722 printf "#endif /* JUST_NSIG */\n";
19723 printf "exit(0);\n}\n";
19724}
19725' >>signal.c
19726$cat >signal.awk <<'EOP'
19727BEGIN { ndups = 0 }
65197d93 19728$1 ~ /^NSIG$/ { nsig = $2 }
1ebe1ffb 19729($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
65197d93
JH
19730 if ($2 > maxsig) { maxsig = $2 }
19731 if (sig_name[$2]) {
19732 dup_name[ndups] = $1
19733 dup_num[ndups] = $2
b4eb6b3d
JH
19734 ndups++
19735 }
1ebe1ffb 19736 else {
65197d93
JH
19737 sig_name[$2] = $1
19738 sig_num[$2] = $2
b4eb6b3d
JH
19739 }
19740}
19741END {
19742 if (nsig == 0) {
19743 nsig = maxsig + 1
19744 }
19745 printf("NSIG %d\n", nsig);
19746 for (n = 1; n < nsig; n++) {
19747 if (sig_name[n]) {
19748 printf("%s %d\n", sig_name[n], sig_num[n])
19749 }
19750 else {
19751 printf("NUM%d %d\n", n, n)
19752 }
19753 }
19754 for (n = 0; n < ndups; n++) {
19755 printf("%s %d\n", dup_name[n], dup_num[n])
19756 }
19757}
19758EOP
19759$cat >signal_cmd <<EOS
19760$startsh
19761if $test -s signal.lst; then
19762 echo "Using your existing signal.lst file"
19763 exit 0
19764fi
19765xxx="$xxx"
19766EOS
19767$cat >>signal_cmd <<'EOS'
19768
19769set signal
19770if eval $compile_ok; then
1eb9ad5b 19771 $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
19772else
19773 echo "(I can't seem be able to compile the whole test program)" >&4
19774 echo "(I'll try it in little pieces.)" >&4
19775 set signal -DJUST_NSIG
19776 if eval $compile_ok; then
5440bc8e 19777 $run ./signal$_exe > signal.nsg
b4eb6b3d
JH
19778 $cat signal.nsg
19779 else
19780 echo "I can't seem to figure out how many signals you have." >&4
19781 echo "Guessing 50." >&4
19782 echo 'NSIG 50' > signal.nsg
19783 fi
19784 : Now look at all the signal names, one at a time.
19785 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19786 $cat > signal.c <<EOCP
19787#include <sys/types.h>
19788#include <signal.h>
19789#include <stdio.h>
19790int main() {
19791printf("$xx %d\n", SIG${xx});
19792return 0;
19793}
19794EOCP
19795 set signal
19796 if eval $compile; then
19797 echo "SIG${xx} found."
5440bc8e 19798 $run ./signal$_exe >> signal.ls1
b4eb6b3d
JH
19799 else
19800 echo "SIG${xx} NOT found."
19801 fi
19802 done
19803 if $test -s signal.ls1; then
19804 $cat signal.nsg signal.ls1 |
65197d93 19805 $sort -n | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
19806 fi
19807
19808fi
19809if $test -s signal.lst; then
19810 :
19811else
19812 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19813 echo 'kill -l' >signal
19814 set X `csh -f <signal`
19815 $rm -f signal
19816 shift
19817 case $# in
19818 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19819 esac
19820 echo $@ | $tr ' ' $trnl | \
19821 $awk '{ printf "%s %d\n", $1, ++s; }
19822 END { printf "NSIG %d\n", ++s }' >signal.lst
19823fi
19824$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19825EOS
19826chmod a+x signal_cmd
19827$eunicefix signal_cmd
19828
19829: generate list of signal names
19830echo " "
19831case "$sig_name_init" in
19832'') doinit=yes ;;
19833*) case "$sig_num_init" in
19834 ''|*,*) doinit=yes ;;
19835 esac ;;
19836esac
19837case "$doinit" in
19838yes)
19839 echo "Generating a list of signal names and numbers..." >&4
19840 . ./signal_cmd
19841 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19842 sig_name=`$awk 'BEGIN { printf "ZERO " }
19843 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19844 sig_num=`$awk 'BEGIN { printf "0 " }
19845 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19846 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
19847 !/^NSIG/ { printf "\"%s\", ", $1 }
19848 END { printf "0\n" }' signal.lst`
19849 sig_num_init=`$awk 'BEGIN { printf "0, " }
19850 !/^NSIG/ { printf "%d, ", $2}
19851 END { printf "0\n"}' signal.lst`
19852 ;;
19853esac
19854echo "The following $sig_count signals are available:"
19855echo " "
19856echo $sig_name | $awk \
19857'BEGIN { linelen = 0 }
19858{
19859 for (i = 1; i <= NF; i++) {
19860 name = "SIG" $i " "
19861 linelen = linelen + length(name)
19862 if (linelen > 70) {
19863 printf "\n"
19864 linelen = length(name)
19865 }
19866 printf "%s", name
19867 }
19868 printf "\n"
19869}'
76d3c696 19870sig_size=`echo $sig_name | awk '{print NF}'`
b4eb6b3d
JH
19871$rm -f signal signal.c signal.awk signal.lst signal_cmd
19872
19873echo " "
19874case "$sizetype" in
19875*_t) zzz="$sizetype" ;;
19876*) zzz="filesize" ;;
19877esac
19878echo "Checking the size of $zzz..." >&4
19879cat > try.c <<EOCP
19880#include <sys/types.h>
19881#include <stdio.h>
d1daaddf
JH
19882#$i_stdlib I_STDLIB
19883#ifdef I_STDLIB
19884#include <stdlib.h>
19885#endif
b4eb6b3d
JH
19886int main() {
19887 printf("%d\n", (int)sizeof($sizetype));
19888 exit(0);
19889}
19890EOCP
19891set try
19892if eval $compile_ok; then
5440bc8e 19893 yyy=`$run ./try`
b4eb6b3d
JH
19894 case "$yyy" in
19895 '') sizesize=4
19896 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19897 ;;
19898 *) sizesize=$yyy
19899 echo "Your $zzz size is $sizesize bytes."
19900 ;;
19901 esac
19902else
19903 sizesize=4
19904 echo "(I can't compile the test program--guessing $sizesize.)" >&4
19905fi
19906
19907
19908: check for socklen_t
19909echo " "
19910echo "Checking to see if you have socklen_t..." >&4
19911$cat >try.c <<EOCP
19912#include <sys/types.h>
19913#$d_socket HAS_SOCKET
19914#ifdef HAS_SOCKET
19915#include <sys/socket.h>
19916#endif
19917int main() { socklen_t x = 16; }
19918EOCP
19919set try
19920if eval $compile; then
19921 val="$define"
19922 echo "You have socklen_t."
19923else
19924 val="$undef"
19925 echo "You do not have socklen_t."
19926 case "$sizetype" in
19927 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19928 esac
19929fi
19930$rm -f try try.*
19931set d_socklen_t
19932eval $setvar
19933
a7710f8d
JH
19934: see if this is a socks.h system
19935set socks.h i_socks
19936eval $inhdr
19937
b4eb6b3d
JH
19938: check for type of the size argument to socket calls
19939case "$d_socket" in
19940"$define")
19941 $cat <<EOM
19942
19943Checking to see what type is the last argument of accept().
19944EOM
b4eb6b3d
JH
19945 yyy=''
19946 case "$d_socklen_t" in
19947 "$define") yyy="$yyy socklen_t"
19948 esac
19949 yyy="$yyy $sizetype int long unsigned"
19950 for xxx in $yyy; do
19951 case "$socksizetype" in
19952 '') try="extern int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
19953 case "$usesocks" in
19954 "$define")
19955 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19956 echo "Your system accepts '$xxx *' for the last argument of accept()."
19957 socksizetype="$xxx"
19958 fi
19959 ;;
19960 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
19961 echo "Your system accepts '$xxx *' for the last argument of accept()."
19962 socksizetype="$xxx"
19963 fi
19964 ;;
19965 esac
b4eb6b3d
JH
19966 ;;
19967 esac
19968 done
19969: In case none of those worked, prompt the user.
19970 case "$socksizetype" in
19971 '') rp='What is the type for socket address structure sizes?'
19972 dflt='int'
19973 . ./myread
19974 socksizetype=$ans
19975 ;;
19976 esac
19977 ;;
19978*) : no sockets, so pick relatively harmless default
19979 socksizetype='int'
19980 ;;
19981esac
19982
19983: see what type is used for signed size_t
19984set ssize_t ssizetype int stdio.h sys/types.h
19985eval $typedef
19986dflt="$ssizetype"
5440bc8e 19987$cat > try.c <<EOM
b4eb6b3d 19988#include <stdio.h>
d1daaddf
JH
19989#$i_stdlib I_STDLIB
19990#ifdef I_STDLIB
19991#include <stdlib.h>
19992#endif
b4eb6b3d
JH
19993#include <sys/types.h>
19994#define Size_t $sizetype
19995#define SSize_t $dflt
19996int main()
19997{
19998 if (sizeof(Size_t) == sizeof(SSize_t))
19999 printf("$dflt\n");
20000 else if (sizeof(Size_t) == sizeof(int))
20001 printf("int\n");
20002 else
20003 printf("long\n");
20004 exit(0);
20005}
20006EOM
20007echo " "
5440bc8e
JH
20008set try
20009if eval $compile_ok && $run ./try > /dev/null; then
20010 ssizetype=`$run ./try`
b4eb6b3d
JH
20011 echo "I'll be using $ssizetype for functions returning a byte count." >&4
20012else
20013 $cat >&4 <<EOM
20014Help! I can't compile and run the ssize_t test program: please enlighten me!
20015(This is probably a misconfiguration in your system or libraries, and
20016you really ought to fix it. Still, I'll try anyway.)
20017
20018I need a type that is the same size as $sizetype, but is guaranteed to
20019be signed. Common values are ssize_t, int and long.
20020
20021EOM
20022 rp="What signed type is the same size as $sizetype?"
20023 . ./myread
20024 ssizetype="$ans"
20025fi
5440bc8e 20026$rm -f try try.*
b4eb6b3d
JH
20027
20028: see what type of char stdio uses.
20029echo " "
359842a5
JH
20030echo '#include <stdio.h>' > stdio.c
20031$cppstdin $cppminus < stdio.c > stdioh
aa517f50 20032if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
20033 echo "Your stdio uses unsigned chars." >&4
20034 stdchar="unsigned char"
20035else
aa517f50
JH
20036 echo "Your stdio uses signed chars." >&4
20037 stdchar="char"
b4eb6b3d 20038fi
359842a5 20039$rm -f stdio.* stdioh
b4eb6b3d 20040
b4eb6b3d
JH
20041: see what type uids are declared as in the kernel
20042echo " "
20043echo "Looking for the type for user ids returned by getuid()."
20044set uid_t uidtype xxx stdio.h sys/types.h
20045eval $typedef
20046case "$uidtype" in
20047xxx)
20048 xxx=`./findhdr sys/user.h`
20049 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20050 case $1 in
20051 unsigned) dflt="$1 $2" ;;
20052 *) dflt="$1" ;;
20053 esac
20054 ;;
20055*) dflt="$uidtype";;
20056esac
20057case "$uidtype" in
20058uid_t) echo "uid_t found." ;;
20059*) rp="What is the type for user ids returned by getuid()?"
20060 . ./myread
20061 uidtype="$ans"
20062 ;;
20063esac
20064
20065echo " "
20066case "$uidtype" in
20067*_t) zzz="$uidtype" ;;
20068*) zzz="uid" ;;
20069esac
20070echo "Checking the size of $zzz..." >&4
20071cat > try.c <<EOCP
20072#include <sys/types.h>
20073#include <stdio.h>
d1daaddf
JH
20074#$i_stdlib I_STDLIB
20075#ifdef I_STDLIB
20076#include <stdlib.h>
20077#endif
b4eb6b3d
JH
20078int main() {
20079 printf("%d\n", (int)sizeof($uidtype));
20080 exit(0);
20081}
20082EOCP
20083set try
20084if eval $compile_ok; then
5440bc8e 20085 yyy=`$run ./try`
b4eb6b3d
JH
20086 case "$yyy" in
20087 '') uidsize=4
20088 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20089 ;;
20090 *) uidsize=$yyy
20091 echo "Your $zzz is $uidsize bytes long."
20092 ;;
20093 esac
20094else
20095 uidsize=4
20096 echo "(I can't compile the test program--guessing $uidsize.)" >&4
20097fi
20098
20099echo " "
20100case "$uidtype" in
20101*_t) zzz="$uidtype" ;;
20102*) zzz="uid" ;;
20103esac
20104echo "Checking the sign of $zzz..." >&4
20105cat > try.c <<EOCP
20106#include <sys/types.h>
20107#include <stdio.h>
20108int main() {
20109 $uidtype foo = -1;
20110 if (foo < 0)
20111 printf("-1\n");
20112 else
20113 printf("1\n");
20114}
20115EOCP
20116set try
20117if eval $compile; then
5440bc8e 20118 yyy=`$run ./try`
b4eb6b3d
JH
20119 case "$yyy" in
20120 '') uidsign=1
20121 echo "(I can't execute the test program--guessing unsigned.)" >&4
20122 ;;
20123 *) uidsign=$yyy
20124 case "$uidsign" in
20125 1) echo "Your $zzz is unsigned." ;;
20126 -1) echo "Your $zzz is signed." ;;
20127 esac
20128 ;;
20129 esac
20130else
20131 uidsign=1
20132 echo "(I can't compile the test program--guessing unsigned.)" >&4
20133fi
20134
20135
20136
20137echo " "
20138$echo "Checking the format string to be used for uids..." >&4
20139
20140case "$uidsign" in
20141-1) if $test X"$uidsize" = X"$ivsize"; then
20142 uidformat="$ivdformat"
20143 else
20144 if $test X"$uidsize" = X"$longsize"; then
20145 uidformat='"ld"'
20146 else
20147 if $test X"$uidsize" = X"$intsize"; then
20148 uidformat='"d"'
20149 else
20150 if $test X"$uidsize" = X"$shortsize"; then
20151 uidformat='"hd"'
20152 fi
20153 fi
20154 fi
20155 fi
20156 ;;
20157*) if $test X"$uidsize" = X"$uvsize"; then
20158 uidformat="$uvuformat"
20159 else
20160 if $test X"$uidsize" = X"$longsize"; then
20161 uidformat='"lu"'
20162 else
20163 if $test X"$uidsize" = X"$intsize"; then
20164 uidformat='"u"'
20165 else
20166 if $test X"$uidsize" = X"$shortsize"; then
20167 uidformat='"hu"'
20168 fi
20169 fi
20170 fi
20171 fi
20172 ;;
20173esac
20174
4afd418c
MB
20175
20176case "$usesitecustomize" in
20177 $define|true|[Yy]*)
20178 usesitecustomize="$define"
20179 ;;
20180 *)
20181 usesitecustomize="$undef"
20182 ;;
20183 esac
20184
3659ebf1
JH
20185: determine compiler compiler
20186case "$yacc" in
20187'')
20188 dflt=yacc;;
20189*)
20190 dflt="$yacc";;
20191esac
20192echo " "
20193comp='yacc'
3c728e00 20194if $test -f "$byacc$_exe"; then
3659ebf1
JH
20195 dflt="$byacc"
20196 comp="byacc or $comp"
20197fi
3c728e00 20198if $test -f "$bison$_exe"; then
3659ebf1
JH
20199 comp="$comp or bison -y"
20200fi
20201rp="Which compiler compiler ($comp) shall I use?"
20202. ./myread
20203yacc="$ans"
20204case "$yacc" in
20205*bis*)
20206 case "$yacc" in
20207 *-y*) ;;
20208 *)
20209 yacc="$yacc -y"
20210 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20211 ;;
20212 esac
20213 ;;
20214esac
20215
758a5d79
JH
20216: see if this is a fp.h system
20217set fp.h i_fp
20218eval $inhdr
20219
20220: see if this is a fp_class.h system
20221set fp_class.h i_fp_class
20222eval $inhdr
20223
b4eb6b3d 20224: see if this is a ieeefp.h system
b5b9f165
JH
20225case "$i_ieeefp" in
20226'' ) set ieeefp.h i_ieeefp
20227 eval $inhdr
20228 ;;
20229esac
b4eb6b3d
JH
20230
20231: see if this is a libutil.h system
20232set libutil.h i_libutil
20233eval $inhdr
20234
b4eb6b3d
JH
20235: see if mach cthreads are available
20236if test "X$usethreads" = "X$define"; then
20237 set mach/cthreads.h i_machcthr
20238 eval $inhdr
20239else
20240 i_machcthr="$undef"
20241fi
20242
20243
20244
b4eb6b3d
JH
20245: see if this is a mntent.h system
20246set mntent.h i_mntent
20247eval $inhdr
20248
20249: see if ndbm.h is available
20250set ndbm.h t_ndbm
20251eval $inhdr
1c6861ad
JS
20252
20253case "$t_ndbm" in
20254$undef)
20255 # Some Linux distributions such as RedHat 7.1 put the
20256 # ndbm.h header in /usr/include/gdbm/ndbm.h.
20257 if $test -f /usr/include/gdbm/ndbm.h; then
d11b91bf 20258 echo '<gdbm/ndbm.h> found.'
1c6861ad
JS
20259 ccflags="$ccflags -I/usr/include/gdbm"
20260 cppflags="$cppflags -I/usr/include/gdbm"
20261 t_ndbm=$define
20262 fi
20263 ;;
20264esac
20265
b4eb6b3d
JH
20266case "$t_ndbm" in
20267$define)
20268 : see if dbm_open exists
20269 set dbm_open d_dbm_open
20270 eval $inlibc
20271 case "$d_dbm_open" in
20272 $undef)
20273 t_ndbm="$undef"
20274 echo "We won't be including <ndbm.h>"
20275 ;;
20276 esac
20277 ;;
20278esac
20279val="$t_ndbm"
20280set i_ndbm
20281eval $setvar
20282
20283: see if net/errno.h is available
20284val=''
20285set net/errno.h val
20286eval $inhdr
20287
20288: Unfortunately, it causes problems on some systems. Arrgh.
20289case "$val" in
20290$define)
20291 cat > try.c <<'EOM'
20292#include <stdio.h>
20293#include <errno.h>
20294#include <net/errno.h>
20295int func()
20296{
20297 return ENOTSOCK;
20298}
20299EOM
20300 if $cc $ccflags -c try.c >/dev/null 2>&1; then
20301 echo "We'll be including <net/errno.h>." >&4
20302 else
20303 echo "We won't be including <net/errno.h>." >&4
20304 val="$undef"
20305 fi
20306 $rm -f try.* try
20307 ;;
20308esac
20309set i_neterrno
20310eval $setvar
20311
20312: see if netinet/tcp.h is available
20313set netinet/tcp.h i_netinettcp
20314eval $inhdr
20315
20316: see if this is a poll.h system
20317set poll.h i_poll
20318eval $inhdr
20319
20320: see if this is a prot.h system
20321set prot.h i_prot
20322eval $inhdr
20323
20324echo " "
ddfca5da 20325$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
b4eb6b3d
JH
20326$cat <<'EOSH' > Cppsym.know
20327a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20328AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
44c87379 20329alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
d46c9a2d
JH
20330ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20331BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
b4eb6b3d
JH
20332BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20333bull c cadmus clipper CMU COFF COMPILER_VERSION
20334concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
8b7d8421 20335CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
4f17444b
JH
20336Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20337FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20338GLIBC GLIBC_MINOR
20339GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
b4eb6b3d
JH
20340H3050R H3050RX hbullx20 hcx host_mips
20341hp200 hp300 hp700 HP700 hp800 hp9000
20342hp9000s200 hp9000s300 hp9000s400 hp9000s500
20343hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20344i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
d46c9a2d 20345IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
b4eb6b3d
JH
20346INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20347LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20348LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20349Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20350LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20351M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20352M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20353M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20354MATH_HAS_NO_SIDE_EFFECTS
20355mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20356mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20357mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20358MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20359mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20360NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 20361news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
20362ns32016 ns32332 ns32k nsc32000
20363OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20364pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20365pc532 pdp11 PGC PIC plexus PORTAR posix
20366POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20367POSIX_C_SOURCE POSIX_SOURCE POWER
20368PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
d46c9a2d 20369riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
b4eb6b3d
JH
20370SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20371sony sony_news sonyrisc sparc sparclite spectrum
20372stardent stdc STDC_EXT stratos sun sun3 sun386
20373Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20374SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20375SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20376sysV68 sysV88 Tek4132 Tek4300 titan
d46c9a2d 20377TM3200 TM5400 TM5600
b4eb6b3d
JH
20378tower tower32 tower32_200 tower32_600 tower32_700
20379tower32_800 tower32_850 tss
20380u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20381ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
4f17444b
JH
20382unix UNIX95 UNIX99 unixpc unos
20383USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20384USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20385USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20386USGr4 USGr4_2
44c87379 20387Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
b4eb6b3d
JH
20388XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20389XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20390z8000
20391EOSH
20392# Maybe put other stuff here too.
20393cat <<EOSH >>Cppsym.know
20394$osname
20395EOSH
20396./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20397./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20398$cat Cppsym.know > Cppsym.c
381aa1ff 20399$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
20400$rm -f Cppsym.a Cppsym.b Cppsym.c
20401cat <<EOSH > Cppsym
20402$startsh
20403if $test \$# -gt 0; then
20404 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20405 if $test -s Cppsym.got; then
20406 $rm -f Cppsym.got
20407 exit 0
20408 fi
20409 $rm -f Cppsym.got
20410 exit 1
20411else
20412 $tr " " "$trnl" | ./Cppsym.try
20413 exit 0
20414fi
20415EOSH
20416chmod +x Cppsym
20417$eunicefix Cppsym
20418cat <<EOSH > Cppsym.try
20419$startsh
20420cat <<'EOCP' > try.c
20421#include <stdio.h>
360321b3
YST
20422#if cpp_stuff == 1
20423#define STRINGIFY(a) "a"
20424#endif
20425#if cpp_stuff == 42
20426#define StGiFy(a) #a
20427#define STRINGIFY(a) StGiFy(a)
20428#endif
20429#if $cpp_stuff != 1 && $cpp_stuff != 42
20430# include "Bletch: How does this C preprocessor stringify macros?"
20431#endif
b4eb6b3d
JH
20432int main() {
20433EOCP
20434$awk \\
20435EOSH
20436cat <<'EOSH' >> Cppsym.try
20437'length($1) > 0 {
360321b3
YST
20438 printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20439 printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20440 printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20441 printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
b4eb6b3d 20442}' >> try.c
2ef53570 20443echo 'return 0;}' >> try.c
b4eb6b3d
JH
20444EOSH
20445cat <<EOSH >> Cppsym.try
20446ccflags="$ccflags"
20447case "$osname-$gccversion" in
20448irix-) ccflags="\$ccflags -woff 1178" ;;
20449os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20450esac
360321b3 20451$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
b4eb6b3d
JH
20452EOSH
20453chmod +x Cppsym.try
20454$eunicefix Cppsym.try
20455./Cppsym < Cppsym.know > Cppsym.true
ddfca5da 20456: Add in any linux cpp "predefined macros":
b6a7163e
MB
20457case "$osname::$gccversion" in
20458 *linux*::*.*)
20459 tHdrH=_tmpHdr
20460 rm -f $tHdrH'.h' $tHdrH
20461 touch $tHdrH'.h'
20462 if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20463 sed 's/#define[\ \ ]*//;s/[\ \ ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20464 if [ -s $tHdrH'_cppsym.real' ]; then
20465 cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20466 fi
20467 fi
20468 rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20469 ;;
20470esac
b4eb6b3d
JH
20471: now check the C compiler for additional symbols
20472postprocess_cc_v=''
20473case "$osname" in
20474aix) postprocess_cc_v="|$tr , ' '" ;;
20475esac
20476$cat >ccsym <<EOS
20477$startsh
20478$cat >tmp.c <<EOF
20479extern int foo;
20480EOF
20481for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20482do
20483 case "\$i" in
20484 -D*) echo "\$i" | $sed 's/^-D//';;
b2a76591 20485 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
b4eb6b3d
JH
20486 esac
20487done
20488$rm -f try.c
20489EOS
20490postprocess_cc_v=''
20491chmod +x ccsym
20492$eunicefix ccsym
20493./ccsym > ccsym1.raw
20494if $test -s ccsym1.raw; then
20495 $sort ccsym1.raw | $uniq >ccsym.raw
20496else
20497 mv ccsym1.raw ccsym.raw
20498fi
20499
20500$awk '/\=/ { print $0; next }
20501 { print $0"=1" }' ccsym.raw >ccsym.list
360321b3
YST
20502$comm -13 Cppsym.true ccsym.list >ccsym.own
20503$comm -12 Cppsym.true ccsym.list >ccsym.com
20504$comm -23 Cppsym.true ccsym.list >ccsym.cpp
b4eb6b3d
JH
20505also=''
20506if $test -z ccsym.raw; then
20507 echo "Your C compiler doesn't seem to define any symbols!" >&4
20508 echo " "
20509 echo "However, your C preprocessor defines the following symbols:"
20510 $cat Cppsym.true
20511 ccsymbols=''
20512 cppsymbols=`$cat Cppsym.true`
20513 cppsymbols=`echo $cppsymbols`
20514 cppccsymbols="$cppsymbols"
20515else
20516 if $test -s ccsym.com; then
20517 echo "Your C compiler and pre-processor define these symbols:"
20518 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20519 also='also '
20520 symbols='ones'
20521 cppccsymbols=`$cat ccsym.com`
20522 cppccsymbols=`echo $cppccsymbols`
20523 $test "$silent" || sleep 1
20524 fi
20525 if $test -s ccsym.cpp; then
20526 $test "$also" && echo " "
20527 echo "Your C pre-processor ${also}defines the following symbols:"
20528 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20529 also='further '
20530 cppsymbols=`$cat ccsym.cpp`
20531 cppsymbols=`echo $cppsymbols`
20532 $test "$silent" || sleep 1
20533 fi
20534 if $test -s ccsym.own; then
20535 $test "$also" && echo " "
20536 echo "Your C compiler ${also}defines the following cpp symbols:"
20537 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20538 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20539 ccsymbols=`$cat ccsym.own`
20540 ccsymbols=`echo $ccsymbols`
20541 $test "$silent" || sleep 1
20542 fi
20543fi
b4eb6b3d
JH
20544
20545: see if this is a termio system
20546val="$undef"
20547val2="$undef"
20548val3="$undef"
20549if $test `./findhdr termios.h`; then
20550 set tcsetattr i_termios
20551 eval $inlibc
20552 val3="$i_termios"
20553fi
20554echo " "
20555case "$val3" in
20556"$define") echo "You have POSIX termios.h... good!" >&4;;
20557*) if ./Cppsym pyr; then
20558 case "`/bin/universe`" in
20559 ucb) if $test `./findhdr sgtty.h`; then
20560 val2="$define"
20561 echo "<sgtty.h> found." >&4
20562 else
20563 echo "System is pyramid with BSD universe."
20564 echo "<sgtty.h> not found--you could have problems." >&4
20565 fi;;
20566 *) if $test `./findhdr termio.h`; then
20567 val="$define"
20568 echo "<termio.h> found." >&4
20569 else
20570 echo "System is pyramid with USG universe."
20571 echo "<termio.h> not found--you could have problems." >&4
20572 fi;;
20573 esac
20574 elif ./usg; then
20575 if $test `./findhdr termio.h`; then
20576 echo "<termio.h> found." >&4
20577 val="$define"
20578 elif $test `./findhdr sgtty.h`; then
20579 echo "<sgtty.h> found." >&4
20580 val2="$define"
20581 else
20582echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20583 fi
20584 else
20585 if $test `./findhdr sgtty.h`; then
20586 echo "<sgtty.h> found." >&4
20587 val2="$define"
20588 elif $test `./findhdr termio.h`; then
20589 echo "<termio.h> found." >&4
20590 val="$define"
20591 else
20592echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20593 fi
20594 fi;;
20595esac
20596set i_termio; eval $setvar
20597val=$val2; set i_sgtty; eval $setvar
20598val=$val3; set i_termios; eval $setvar
20599
b4eb6b3d
JH
20600: see if stddef is available
20601set stddef.h i_stddef
20602eval $inhdr
923fc586 20603
b4eb6b3d
JH
20604: see if this is a sunmath.h system
20605set sunmath.h i_sunmath
20606eval $inhdr
5f80c64f 20607
b4eb6b3d
JH
20608: see if sys/access.h is available
20609set sys/access.h i_sysaccess
20610eval $inhdr
20611
20612: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20613set sys/filio.h i_sysfilio
20614eval $inhdr
20615echo " "
20616if $test `./findhdr sys/ioctl.h`; then
20617 val="$define"
20618 echo '<sys/ioctl.h> found.' >&4
20619else
20620 val="$undef"
20621 if $test $i_sysfilio = "$define"; then
20622 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 20623 else
b4eb6b3d
JH
20624 $test $i_sgtty = "$define" && xxx="sgtty.h"
20625 $test $i_termio = "$define" && xxx="termio.h"
20626 $test $i_termios = "$define" && xxx="termios.h"
20627echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20628 fi
20629fi
20630set i_sysioctl
20631eval $setvar
20632
49a78c82
JH
20633: see if socket ioctl defs are in sys/sockio.h
20634echo " "
20635xxx=`./findhdr sys/sockio.h`
20636if $test "$xxx"; then
20637 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20638 val="$define"
20639 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20640 else
20641 val="$undef"
20642 echo "No socket ioctls found in <sys/sockio.h>." >&4
20643 fi
20644else
20645 val="$undef"
20646 $cat <<EOM
20647<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20648EOM
20649fi
20650set i_syssockio
20651eval $setvar
20652
b4eb6b3d
JH
20653
20654: see if this is a syslog.h system
20655set syslog.h i_syslog
20656eval $inhdr
20657
20658
20659: see if this is a sys/mode.h system
20660set sys/mode.h i_sysmode
20661eval $inhdr
20662
20663: see if sys/resource.h has to be included
20664set sys/resource.h i_sysresrc
20665eval $inhdr
20666
20667: see if sys/security.h is available
20668set sys/security.h i_syssecrt
20669eval $inhdr
20670
20671: see if this is a sys/statvfs.h system
20672set sys/statvfs.h i_sysstatvfs
20673eval $inhdr
20674
b4eb6b3d
JH
20675: see if this is a sys/un.h system
20676set sys/un.h i_sysun
20677eval $inhdr
20678
20679
20680: see if this is a sys/utsname.h system
20681set sys/utsname.h i_sysutsname
20682eval $inhdr
20683
20684: see if this is a syswait system
20685set sys/wait.h i_syswait
20686eval $inhdr
20687
20688: see if this is a ustat.h system
20689set ustat.h i_ustat
20690eval $inhdr
20691
20692: see if this is an utime system
20693set utime.h i_utime
20694eval $inhdr
20695
20696: see if this is a values.h system
20697set values.h i_values
20698eval $inhdr
20699
20700: see if this is a vfork system
20701case "$d_vfork" in
20702"$define")
20703 set vfork.h i_vfork
20704 eval $inhdr
20705 ;;
20706*)
20707 i_vfork="$undef"
20708 ;;
20709esac
20710
20711: see if gdbm.h is available
20712set gdbm.h t_gdbm
20713eval $inhdr
20714case "$t_gdbm" in
20715$define)
20716 : see if gdbm_open exists
20717 set gdbm_open d_gdbm_open
20718 eval $inlibc
20719 case "$d_gdbm_open" in
20720 $undef)
20721 t_gdbm="$undef"
20722 echo "We won't be including <gdbm.h>"
5f80c64f 20723 ;;
b4eb6b3d
JH
20724 esac
20725 ;;
20726esac
20727val="$t_gdbm"
20728set i_gdbm
20729eval $setvar
20730
20731echo " "
20732echo "Looking for extensions..." >&4
20733: If we are using the old config.sh, known_extensions may contain
20734: old or inaccurate or duplicate values.
20735known_extensions=''
20736nonxs_extensions=''
20737: We do not use find because it might not be available.
20738: We do not just use MANIFEST because the user may have dropped
20739: some additional extensions into the source tree and expect them
20740: to be built.
20741
20742: Function to recursively find available extensions, ignoring DynaLoader
20743: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20744find_extensions='
20745 for xxx in *; do
20746 case "$xxx" in
20747 DynaLoader|dynaload) ;;
20748 *)
20749 if $test -f $xxx/$xxx.xs; then
20750 known_extensions="$known_extensions $1$xxx";
20751 elif $test -f $xxx/Makefile.PL; then
20752 nonxs_extensions="$nonxs_extensions $1$xxx";
20753 else
20754 if $test -d $xxx -a $# -lt 10; then
20755 set $1$xxx/ $*;
6904989c 20756 cd "$xxx";
b4eb6b3d
JH
20757 eval $find_extensions;
20758 cd ..;
20759 shift;
20760 fi;
20761 fi
20762 ;;
20763 esac;
20764 done'
20765tdir=`pwd`
6904989c 20766cd "$rsrc/ext"
b4eb6b3d
JH
20767set X
20768shift
20769eval $find_extensions
4e1a6d26
AD
20770# Special case: Add in threads/shared since it is not picked up by the
20771# recursive find above (and adding in general recursive finding breaks
20772# SDBM_File/sdbm). A.D. 10/25/2001.
998b396c 20773known_extensions="$known_extensions threads/shared"
b4eb6b3d
JH
20774set X $nonxs_extensions
20775shift
20776nonxs_extensions="$*"
20777set X $known_extensions
20778shift
20779known_extensions="$*"
6904989c 20780cd "$tdir"
b4eb6b3d
JH
20781
20782: Now see which are supported on this system.
20783avail_ext=''
20784for xxx in $known_extensions ; do
20785 case "$xxx" in
20786 DB_File|db_file)
20787 case "$i_db" in
20788 $define) avail_ext="$avail_ext $xxx" ;;
20789 esac
20790 ;;
20791 GDBM_File|gdbm_fil)
20792 case "$i_gdbm" in
20793 $define) avail_ext="$avail_ext $xxx" ;;
20794 esac
20795 ;;
1d59c593 20796 I18N/Langinfo|i18n_lan)
4bbcc6e8
JH
20797 case "$i_langinfo$d_nl_langinfo" in
20798 $define$define) avail_ext="$avail_ext $xxx" ;;
20799 esac
20800 ;;
b4eb6b3d
JH
20801 NDBM_File|ndbm_fil)
20802 case "$i_ndbm" in
20803 $define)
20804 case "$osname-$use64bitint" in
0be9fa5d 20805 hpux-define)
b4eb6b3d
JH
20806 case "$libs" in
20807 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20808 esac
20809 ;;
20810 *) avail_ext="$avail_ext $xxx" ;;
20811 esac
20812 ;;
20813 esac
20814 ;;
20815 ODBM_File|odbm_fil)
20816 case "${i_dbm}${i_rpcsvcdbm}" in
20817 *"${define}"*)
20818 case "$osname-$use64bitint" in
0be9fa5d 20819 hpux-define)
b4eb6b3d
JH
20820 case "$libs" in
20821 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20822 esac
20823 ;;
20824 *) avail_ext="$avail_ext $xxx" ;;
20825 esac
20826 ;;
20827 esac
20828 ;;
20829 POSIX|posix)
20830 case "$useposix" in
20831 true|define|y) avail_ext="$avail_ext $xxx" ;;
20832 esac
20833 ;;
20834 Opcode|opcode)
20835 case "$useopcode" in
20836 true|define|y) avail_ext="$avail_ext $xxx" ;;
20837 esac
20838 ;;
20839 Socket|socket)
20840 case "$d_socket" in
4a9f028c
JH
20841 true|$define|y)
20842 case "$osname" in
20843 beos) ;; # not unless BONE
20844 *) avail_ext="$avail_ext $xxx" ;;
20845 esac
20846 ;;
b4eb6b3d
JH
20847 esac
20848 ;;
20849 Sys/Syslog|sys/syslog)
20850 : XXX syslog requires socket
20851 case "$d_socket" in
20852 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20853 esac
20854 ;;
20855 Thread|thread)
b00ec89b
AB
20856 case "$usethreads" in
20857 true|$define|y)
20858 case "$useithreads" in
20859 $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20860 esac
b4eb6b3d
JH
20861 esac
20862 ;;
f9b6ed1c
AD
20863 XS/APItest|xs/apitest)
20864 # This is just for testing. Skip it unless we have dynamic loading.
20865
20866 case "$usedl" in
20867 $define) avail_ext="$avail_ext $xxx" ;;
20868 esac
20869 ;;
20870 XS/Typemap|xs/typemap)
20871 # This is just for testing. Skip it unless we have dynamic loading.
20872 case "$usedl" in
20873 $define) avail_ext="$avail_ext $xxx" ;;
20874 esac
20875 ;;
7deadc5f 20876 threads|threads/shared)
73e09c8f
JH
20877 # threads and threads::shared are special cases.
20878 # To stop people from asking "Perl 5.8.0 was supposed
20879 # to have this new fancy threads implementation but my
20880 # perl doesn't have it" and from people trying to
20881 # (re)install the threads module using CPAN.pm and
20882 # CPAN.pm then offering to reinstall Perl 5.8.0,
20883 # the threads.pm and threads/shared.pm will always be
20884 # there, croaking informatively ("you need to rebuild
20885 # all of Perl with threads, sorry") when threads haven't
20886 # been compiled in.
20887 # --jhi
20888 avail_ext="$avail_ext $xxx"
1dca008a 20889 ;;
b4eb6b3d
JH
20890 IPC/SysV|ipc/sysv)
20891 : XXX Do we need a useipcsysv variable here
20892 case "${d_msg}${d_sem}${d_shm}" in
20893 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20894 esac
20895 ;;
20896 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
20897 ;;
20898 esac
b4eb6b3d 20899done
5f80c64f 20900
b4eb6b3d
JH
20901set X $avail_ext
20902shift
20903avail_ext="$*"
5f80c64f 20904
ef0c5be8
JH
20905case "$onlyextensions" in
20906'') ;;
20907*) keepextensions=''
20908 echo "You have requested that only certains extensions be included..." >&4
20909 for i in $onlyextensions; do
20910 case " $avail_ext " in
20911 *" $i "*)
20912 echo "Keeping extension $i."
20913 keepextensions="$keepextensions $i"
20914 ;;
20915 *) echo "Ignoring extension $i." ;;
20916 esac
20917 done
20918 avail_ext="$keepextensions"
20919 ;;
20920esac
20921
20922case "$noextensions" in
20923'') ;;
20924*) keepextensions=''
20925 echo "You have requested that certain extensions be ignored..." >&4
20926 for i in $avail_ext; do
c3dadc13
AD
20927 case " $noextensions " in
20928 *" $i "*) echo "Ignoring extension $i." ;;
ef0c5be8
JH
20929 *) echo "Keeping extension $i.";
20930 keepextensions="$keepextensions $i"
20931 ;;
20932 esac
20933 done
20934 avail_ext="$keepextensions"
20935 ;;
20936esac
20937
b4eb6b3d
JH
20938: Now see which nonxs extensions are supported on this system.
20939: For now assume all are.
20940nonxs_ext=''
20941for xxx in $nonxs_extensions ; do
20942 case "$xxx" in
20943 *) nonxs_ext="$nonxs_ext $xxx"
20944 ;;
20945 esac
20946done
5f80c64f 20947
b4eb6b3d
JH
20948set X $nonxs_ext
20949shift
20950nonxs_ext="$*"
20951
20952case $usedl in
20953$define)
20954 $cat <<EOM
20955A number of extensions are supplied with $package. You may choose to
20956compile these extensions for dynamic loading (the default), compile
20957them into the $package executable (static loading), or not include
20958them at all. Answer "none" to include no extensions.
20959Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
20960
20961EOM
b4eb6b3d 20962 case "$dynamic_ext" in
736accd3
YST
20963 '')
20964 : Exclude those listed in static_ext
20965 dflt=''
20966 for xxx in $avail_ext; do
20967 case " $static_ext " in
20968 *" $xxx "*) ;;
20969 *) dflt="$dflt $xxx" ;;
20970 esac
20971 done
20972 set X $dflt
20973 shift
20974 dflt="$*"
20975 ;;
b4eb6b3d
JH
20976 *) dflt="$dynamic_ext"
20977 # Perhaps we are reusing an old out-of-date config.sh.
20978 case "$hint" in
20979 previous)
20980 if test X"$dynamic_ext" != X"$avail_ext"; then
20981 $cat <<EOM
20982NOTICE: Your previous config.sh list may be incorrect.
20983The extensions now available to you are
20984 ${avail_ext}
20985but the default list from your previous config.sh is
20986 ${dynamic_ext}
9c839522 20987
b4eb6b3d
JH
20988EOM
20989 fi
9c839522
PM
20990 ;;
20991 esac
b4eb6b3d
JH
20992 ;;
20993 esac
5f80c64f 20994 case "$dflt" in
b4eb6b3d
JH
20995 '') dflt=none;;
20996 esac
20997 rp="What extensions do you wish to load dynamically?"
20998 . ./myread
20999 case "$ans" in
21000 none) dynamic_ext=' ' ;;
21001 *) dynamic_ext="$ans" ;;
5f80c64f 21002 esac
5f80c64f 21003
b4eb6b3d
JH
21004 case "$static_ext" in
21005 '')
21006 : Exclude those already listed in dynamic linking
21007 dflt=''
21008 for xxx in $avail_ext; do
21009 case " $dynamic_ext " in
21010 *" $xxx "*) ;;
21011 *) dflt="$dflt $xxx" ;;
21012 esac
21013 done
21014 set X $dflt
21015 shift
21016 dflt="$*"
21017 ;;
21018 *) dflt="$static_ext"
21019 ;;
21020 esac
9c839522 21021
b4eb6b3d
JH
21022 case "$dflt" in
21023 '') dflt=none;;
21024 esac
21025 rp="What extensions do you wish to load statically?"
21026 . ./myread
21027 case "$ans" in
21028 none) static_ext=' ' ;;
21029 *) static_ext="$ans" ;;
21030 esac
21031 ;;
21032*)
21033 $cat <<EOM
21034A number of extensions are supplied with $package. Answer "none"
21035to include no extensions.
21036Note that DynaLoader is always built and need not be mentioned here.
9c839522 21037
b4eb6b3d
JH
21038EOM
21039 case "$static_ext" in
21040 '') dflt="$avail_ext" ;;
21041 *) dflt="$static_ext"
21042 # Perhaps we are reusing an old out-of-date config.sh.
21043 case "$hint" in
21044 previous)
21045 if test X"$static_ext" != X"$avail_ext"; then
21046 $cat <<EOM
21047NOTICE: Your previous config.sh list may be incorrect.
21048The extensions now available to you are
21049 ${avail_ext}
21050but the default list from your previous config.sh is
21051 ${static_ext}
5f80c64f
JH
21052
21053EOM
b4eb6b3d
JH
21054 fi
21055 ;;
21056 esac
21057 ;;
21058 esac
21059 : Exclude those that are not xs extensions
21060 case "$dflt" in
21061 '') dflt=none;;
21062 esac
21063 rp="What extensions do you wish to include?"
21064 . ./myread
21065 case "$ans" in
21066 none) static_ext=' ' ;;
21067 *) static_ext="$ans" ;;
21068 esac
21069 ;;
5f80c64f 21070esac
f1f6834f
AD
21071#
21072# Encode is a special case. If we are building Encode as a static
21073# extension, we need to explicitly list its subextensions as well.
21074# For other nested extensions, this is handled automatically by
21075# the appropriate Makefile.PL.
21076case " $static_ext " in
21077 *" Encode "*) # Add the subextensions of Encode
21078 cd "$rsrc/ext"
21079 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21080 static_ext="$static_ext Encode/$xxx"
21081 done
21082 cd "$tdir"
21083 ;;
21084esac
5f80c64f 21085
b4eb6b3d
JH
21086set X $dynamic_ext $static_ext $nonxs_ext
21087shift
21088extensions="$*"
21089
93a2cd18
AD
21090# Sanity check: We require an extension suitable for use with
21091# AnyDBM_File, as well as Fcntl and IO. (Failure to have these
21092# should show up as failures in the test suite, but it's helpful to
21093# catch them now.) The 'extensions' list is normally sorted
21094# alphabetically, so we need to accept either
21095# DB_File ... Fcntl ... IO ....
21096# or something like
21097# Fcntl ... NDBM_File ... IO ....
42fde7b2
JH
21098case " $extensions" in
21099*"_File "*" Fcntl "*" IO "*) ;; # DB_File
21100*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21101*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
7a8675bc
JH
21102*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21103 echo "WARNING: The Perl you are building will be quite crippled." >& 4
21104 ;;
21105esac
21106
9c839522
PM
21107: Remove libraries needed only for extensions
21108: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
21109: The exception is SunOS 4.x, which needs them.
21110case "${osname}X${osvers}" in
21111sunos*X4*)
21112 perllibs="$libs"
21113 ;;
21114*) case "$usedl" in
21115 $define|true|[yY]*)
21116 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
21117 shift
21118 perllibs="$*"
21119 ;;
21120 *) perllibs="$libs"
21121 ;;
21122 esac
21123 ;;
9c839522 21124esac
5f80c64f
JH
21125
21126: Remove build directory name from cppstdin so it can be used from
21127: either the present location or the final installed location.
21128echo " "
21129: Get out of the UU directory to get correct path name.
21130cd ..
21131case "$cppstdin" in
21132`pwd`/cppstdin)
21133 echo "Stripping down cppstdin path name"
21134 cppstdin=cppstdin
21135 ;;
21136esac
21137cd UU
21138
21139: end of configuration questions
21140echo " "
21141echo "End of configuration questions."
21142echo " "
21143
21144: back to where it started
21145if test -d ../UU; then
21146 cd ..
21147fi
21148
48370efc
JH
21149: configuration may be patched via a 'config.arch' file
21150if $test -f config.arch; then
21151 echo "I see a config.arch file, loading it."
21152 . ./config.arch
21153fi
21154
5f80c64f
JH
21155: configuration may be patched via a 'config.over' file
21156if $test -f config.over; then
21157 echo " "
21158 dflt=y
21159 rp='I see a config.over file. Do you wish to load it?'
21160 . UU/myread
21161 case "$ans" in
21162 n*) echo "OK, I'll ignore it.";;
21163 *) . ./config.over
21164 echo "Configuration override changes have been loaded."
21165 ;;
21166 esac
21167fi
21168
21169: in case they want portability, strip down executable paths
21170case "$d_portable" in
21171"$define")
21172 echo " "
21173 echo "Stripping down executable paths..." >&4
21174 for file in $loclist $trylist; do
534ac15a
JH
21175 eval temp=\$$file
21176 eval $file=`basename $temp`
5f80c64f
JH
21177 done
21178 ;;
21179esac
21180
21181: create config.sh file
21182echo " "
21183echo "Creating config.sh..." >&4
21184$spitshell <<EOT >config.sh
21185$startsh
21186#
21187# This file was produced by running the Configure script. It holds all the
21188# definitions figured out by Configure. Should you modify one of these values,
21189# do not forget to propagate your changes by running "Configure -der". You may
21190# instead choose to run each of the .SH files by yourself, or "Configure -S".
21191#
21192
21193# Package name : $package
21194# Source directory : $src
21195# Configuration time: $cf_time
21196# Configured by : $cf_by
21197# Target system : $myuname
21198
21199Author='$Author'
21200Date='$Date'
21201Header='$Header'
21202Id='$Id'
21203Locker='$Locker'
21204Log='$Log'
21205Mcc='$Mcc'
21206RCSfile='$RCSfile'
21207Revision='$Revision'
21208Source='$Source'
21209State='$State'
21210_a='$_a'
21211_exe='$_exe'
21212_o='$_o'
b4eb6b3d 21213afs='$afs'
a6d26a0d 21214afsroot='$afsroot'
b4eb6b3d
JH
21215alignbytes='$alignbytes'
21216ansi2knr='$ansi2knr'
21217aphostname='$aphostname'
21218api_revision='$api_revision'
21219api_subversion='$api_subversion'
21220api_version='$api_version'
21221api_versionstring='$api_versionstring'
5f80c64f 21222ar='$ar'
b4eb6b3d
JH
21223archlib='$archlib'
21224archlibexp='$archlibexp'
21225archname64='$archname64'
21226archname='$archname'
5f80c64f 21227archobjs='$archobjs'
10bc17b6 21228asctime_r_proto='$asctime_r_proto'
5f80c64f 21229awk='$awk'
b4eb6b3d 21230baserev='$baserev'
5f80c64f 21231bash='$bash'
b4eb6b3d 21232bin='$bin'
b4eb6b3d 21233binexp='$binexp'
5f80c64f
JH
21234bison='$bison'
21235byacc='$byacc'
b4eb6b3d 21236byteorder='$byteorder'
5f80c64f 21237c='$c'
b4eb6b3d 21238castflags='$castflags'
5f80c64f
JH
21239cat='$cat'
21240cc='$cc'
21241cccdlflags='$cccdlflags'
21242ccdlflags='$ccdlflags'
21243ccflags='$ccflags'
b4eb6b3d 21244ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 21245ccname='$ccname'
b4eb6b3d 21246ccsymbols='$ccsymbols'
6b356c8e 21247ccversion='$ccversion'
5f80c64f 21248cf_by='$cf_by'
b4eb6b3d 21249cf_email='$cf_email'
5f80c64f 21250cf_time='$cf_time'
b4eb6b3d 21251charsize='$charsize'
5f80c64f
JH
21252chgrp='$chgrp'
21253chmod='$chmod'
21254chown='$chown'
b4eb6b3d 21255clocktype='$clocktype'
5f80c64f
JH
21256comm='$comm'
21257compress='$compress'
21258contains='$contains'
21259cp='$cp'
21260cpio='$cpio'
21261cpp='$cpp'
b4eb6b3d
JH
21262cpp_stuff='$cpp_stuff'
21263cppccsymbols='$cppccsymbols'
5f80c64f
JH
21264cppflags='$cppflags'
21265cpplast='$cpplast'
21266cppminus='$cppminus'
21267cpprun='$cpprun'
21268cppstdin='$cppstdin'
b4eb6b3d 21269cppsymbols='$cppsymbols'
10bc17b6 21270crypt_r_proto='$crypt_r_proto'
b4eb6b3d 21271cryptlib='$cryptlib'
5f80c64f 21272csh='$csh'
10bc17b6
JH
21273ctermid_r_proto='$ctermid_r_proto'
21274ctime_r_proto='$ctime_r_proto'
b4eb6b3d
JH
21275d_Gconvert='$d_Gconvert'
21276d_PRIEUldbl='$d_PRIEUldbl'
21277d_PRIFUldbl='$d_PRIFUldbl'
21278d_PRIGUldbl='$d_PRIGUldbl'
21279d_PRIXU64='$d_PRIXU64'
21280d_PRId64='$d_PRId64'
21281d_PRIeldbl='$d_PRIeldbl'
21282d_PRIfldbl='$d_PRIfldbl'
21283d_PRIgldbl='$d_PRIgldbl'
21284d_PRIi64='$d_PRIi64'
21285d_PRIo64='$d_PRIo64'
21286d_PRIu64='$d_PRIu64'
21287d_PRIx64='$d_PRIx64'
21288d_SCNfldbl='$d_SCNfldbl'
74cac757 21289d__fwalk='$d__fwalk'
b4eb6b3d
JH
21290d_access='$d_access'
21291d_accessx='$d_accessx'
55954f19 21292d_aintl='$d_aintl'
b4eb6b3d
JH
21293d_alarm='$d_alarm'
21294d_archlib='$d_archlib'
10bc17b6 21295d_asctime_r='$d_asctime_r'
b4eb6b3d
JH
21296d_atolf='$d_atolf'
21297d_atoll='$d_atoll'
0dbb1585
AL
21298d_attribute_format='$d_attribute_format'
21299d_attribute_malloc='$d_attribute_malloc'
21300d_attribute_nonnull='$d_attribute_nonnull'
21301d_attribute_noreturn='$d_attribute_noreturn'
21302d_attribute_pure='$d_attribute_pure'
21303d_attribute_unused='$d_attribute_unused'
21304d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
b4eb6b3d
JH
21305d_bcmp='$d_bcmp'
21306d_bcopy='$d_bcopy'
5f80c64f 21307d_bsd='$d_bsd'
b4eb6b3d
JH
21308d_bsdgetpgrp='$d_bsdgetpgrp'
21309d_bsdsetpgrp='$d_bsdsetpgrp'
635aebb7
AL
21310d_builtin_choose_expr='$d_builtin_choose_expr'
21311d_builtin_expect='$d_builtin_expect'
b4eb6b3d 21312d_bzero='$d_bzero'
a2d23ec2 21313d_c99_variadic_macros='$d_c99_variadic_macros'
b4eb6b3d
JH
21314d_casti32='$d_casti32'
21315d_castneg='$d_castneg'
21316d_charvspr='$d_charvspr'
21317d_chown='$d_chown'
21318d_chroot='$d_chroot'
21319d_chsize='$d_chsize'
758a5d79 21320d_class='$d_class'
b0a2e8e6 21321d_clearenv='$d_clearenv'
b4eb6b3d 21322d_closedir='$d_closedir'
4e0554ec 21323d_cmsghdr_s='$d_cmsghdr_s'
b4eb6b3d 21324d_const='$d_const'
55954f19 21325d_copysignl='$d_copysignl'
b4eb6b3d 21326d_crypt='$d_crypt'
10bc17b6 21327d_crypt_r='$d_crypt_r'
b4eb6b3d 21328d_csh='$d_csh'
10bc17b6
JH
21329d_ctermid_r='$d_ctermid_r'
21330d_ctime_r='$d_ctime_r'
b4eb6b3d
JH
21331d_cuserid='$d_cuserid'
21332d_dbl_dig='$d_dbl_dig'
2ef53570 21333d_dbminitproto='$d_dbminitproto'
b4eb6b3d 21334d_difftime='$d_difftime'
ae0e3d3b 21335d_dirfd='$d_dirfd'
b4eb6b3d
JH
21336d_dirnamlen='$d_dirnamlen'
21337d_dlerror='$d_dlerror'
5f80c64f 21338d_dlopen='$d_dlopen'
b4eb6b3d
JH
21339d_dlsymun='$d_dlsymun'
21340d_dosuid='$d_dosuid'
10bc17b6 21341d_drand48_r='$d_drand48_r'
b4eb6b3d
JH
21342d_drand48proto='$d_drand48proto'
21343d_dup2='$d_dup2'
21344d_eaccess='$d_eaccess'
21345d_endgrent='$d_endgrent'
10bc17b6 21346d_endgrent_r='$d_endgrent_r'
b4eb6b3d 21347d_endhent='$d_endhent'
10bc17b6 21348d_endhostent_r='$d_endhostent_r'
b4eb6b3d 21349d_endnent='$d_endnent'
10bc17b6 21350d_endnetent_r='$d_endnetent_r'
b4eb6b3d 21351d_endpent='$d_endpent'
10bc17b6 21352d_endprotoent_r='$d_endprotoent_r'
b4eb6b3d 21353d_endpwent='$d_endpwent'
10bc17b6 21354d_endpwent_r='$d_endpwent_r'
b4eb6b3d 21355d_endsent='$d_endsent'
10bc17b6 21356d_endservent_r='$d_endservent_r'
b4eb6b3d 21357d_eofnblk='$d_eofnblk'
5f80c64f 21358d_eunice='$d_eunice'
15b61c98 21359d_faststdio='$d_faststdio'
b363b713 21360d_fchdir='$d_fchdir'
b4eb6b3d
JH
21361d_fchmod='$d_fchmod'
21362d_fchown='$d_fchown'
21363d_fcntl='$d_fcntl'
9d9004a9 21364d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
21365d_fd_macros='$d_fd_macros'
21366d_fd_set='$d_fd_set'
21367d_fds_bits='$d_fds_bits'
21368d_fgetpos='$d_fgetpos'
758a5d79
JH
21369d_finite='$d_finite'
21370d_finitel='$d_finitel'
b4eb6b3d
JH
21371d_flexfnam='$d_flexfnam'
21372d_flock='$d_flock'
2ef53570 21373d_flockproto='$d_flockproto'
b4eb6b3d 21374d_fork='$d_fork'
758a5d79 21375d_fp_class='$d_fp_class'
b4eb6b3d 21376d_fpathconf='$d_fpathconf'
758a5d79
JH
21377d_fpclass='$d_fpclass'
21378d_fpclassify='$d_fpclassify'
21379d_fpclassl='$d_fpclassl'
b4eb6b3d
JH
21380d_fpos64_t='$d_fpos64_t'
21381d_frexpl='$d_frexpl'
21382d_fs_data_s='$d_fs_data_s'
21383d_fseeko='$d_fseeko'
21384d_fsetpos='$d_fsetpos'
21385d_fstatfs='$d_fstatfs'
21386d_fstatvfs='$d_fstatvfs'
411ab01c 21387d_fsync='$d_fsync'
b4eb6b3d
JH
21388d_ftello='$d_ftello'
21389d_ftime='$d_ftime'
dc814df1 21390d_futimes='$d_futimes'
b4eb6b3d
JH
21391d_getcwd='$d_getcwd'
21392d_getespwnam='$d_getespwnam'
21393d_getfsstat='$d_getfsstat'
21394d_getgrent='$d_getgrent'
10bc17b6
JH
21395d_getgrent_r='$d_getgrent_r'
21396d_getgrgid_r='$d_getgrgid_r'
21397d_getgrnam_r='$d_getgrnam_r'
b4eb6b3d
JH
21398d_getgrps='$d_getgrps'
21399d_gethbyaddr='$d_gethbyaddr'
21400d_gethbyname='$d_gethbyname'
21401d_gethent='$d_gethent'
21402d_gethname='$d_gethname'
10bc17b6
JH
21403d_gethostbyaddr_r='$d_gethostbyaddr_r'
21404d_gethostbyname_r='$d_gethostbyname_r'
21405d_gethostent_r='$d_gethostent_r'
b4eb6b3d 21406d_gethostprotos='$d_gethostprotos'
4e0554ec 21407d_getitimer='$d_getitimer'
b4eb6b3d 21408d_getlogin='$d_getlogin'
10bc17b6 21409d_getlogin_r='$d_getlogin_r'
b4eb6b3d
JH
21410d_getmnt='$d_getmnt'
21411d_getmntent='$d_getmntent'
21412d_getnbyaddr='$d_getnbyaddr'
21413d_getnbyname='$d_getnbyname'
21414d_getnent='$d_getnent'
10bc17b6
JH
21415d_getnetbyaddr_r='$d_getnetbyaddr_r'
21416d_getnetbyname_r='$d_getnetbyname_r'
21417d_getnetent_r='$d_getnetent_r'
b4eb6b3d 21418d_getnetprotos='$d_getnetprotos'
0c0643d0 21419d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
21420d_getpbyname='$d_getpbyname'
21421d_getpbynumber='$d_getpbynumber'
21422d_getpent='$d_getpent'
21423d_getpgid='$d_getpgid'
21424d_getpgrp2='$d_getpgrp2'
21425d_getpgrp='$d_getpgrp'
21426d_getppid='$d_getppid'
21427d_getprior='$d_getprior'
10bc17b6
JH
21428d_getprotobyname_r='$d_getprotobyname_r'
21429d_getprotobynumber_r='$d_getprotobynumber_r'
21430d_getprotoent_r='$d_getprotoent_r'
b4eb6b3d
JH
21431d_getprotoprotos='$d_getprotoprotos'
21432d_getprpwnam='$d_getprpwnam'
21433d_getpwent='$d_getpwent'
10bc17b6
JH
21434d_getpwent_r='$d_getpwent_r'
21435d_getpwnam_r='$d_getpwnam_r'
21436d_getpwuid_r='$d_getpwuid_r'
b4eb6b3d
JH
21437d_getsbyname='$d_getsbyname'
21438d_getsbyport='$d_getsbyport'
21439d_getsent='$d_getsent'
10bc17b6
JH
21440d_getservbyname_r='$d_getservbyname_r'
21441d_getservbyport_r='$d_getservbyport_r'
21442d_getservent_r='$d_getservent_r'
b4eb6b3d
JH
21443d_getservprotos='$d_getservprotos'
21444d_getspnam='$d_getspnam'
10bc17b6 21445d_getspnam_r='$d_getspnam_r'
b4eb6b3d 21446d_gettimeod='$d_gettimeod'
10bc17b6 21447d_gmtime_r='$d_gmtime_r'
5f80c64f 21448d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
21449d_grpasswd='$d_grpasswd'
21450d_hasmntopt='$d_hasmntopt'
21451d_htonl='$d_htonl'
55954f19 21452d_ilogbl='$d_ilogbl'
f3f1a2d8 21453d_inc_version_list='$d_inc_version_list'
b4eb6b3d
JH
21454d_index='$d_index'
21455d_inetaton='$d_inetaton'
21456d_int64_t='$d_int64_t'
21457d_isascii='$d_isascii'
758a5d79
JH
21458d_isfinite='$d_isfinite'
21459d_isinf='$d_isinf'
b4eb6b3d
JH
21460d_isnan='$d_isnan'
21461d_isnanl='$d_isnanl'
21462d_killpg='$d_killpg'
21463d_lchown='$d_lchown'
21464d_ldbl_dig='$d_ldbl_dig'
0a0abfba 21465d_libm_lib_version='$d_libm_lib_version'
b4eb6b3d 21466d_link='$d_link'
10bc17b6 21467d_localtime_r='$d_localtime_r'
b4eb6b3d
JH
21468d_locconv='$d_locconv'
21469d_lockf='$d_lockf'
21470d_longdbl='$d_longdbl'
21471d_longlong='$d_longlong'
21472d_lseekproto='$d_lseekproto'
21473d_lstat='$d_lstat'
21474d_madvise='$d_madvise'
7dd121ae
MB
21475d_malloc_good_size='$d_malloc_good_size'
21476d_malloc_size='$d_malloc_size'
b4eb6b3d
JH
21477d_mblen='$d_mblen'
21478d_mbstowcs='$d_mbstowcs'
21479d_mbtowc='$d_mbtowc'
21480d_memchr='$d_memchr'
21481d_memcmp='$d_memcmp'
21482d_memcpy='$d_memcpy'
21483d_memmove='$d_memmove'
21484d_memset='$d_memset'
21485d_mkdir='$d_mkdir'
21486d_mkdtemp='$d_mkdtemp'
21487d_mkfifo='$d_mkfifo'
21488d_mkstemp='$d_mkstemp'
21489d_mkstemps='$d_mkstemps'
21490d_mktime='$d_mktime'
21491d_mmap='$d_mmap'
21492d_modfl='$d_modfl'
e67aeab1 21493d_modfl_pow32_bug='$d_modfl_pow32_bug'
bc9a1b2c 21494d_modflproto='$d_modflproto'
b4eb6b3d
JH
21495d_mprotect='$d_mprotect'
21496d_msg='$d_msg'
21497d_msg_ctrunc='$d_msg_ctrunc'
21498d_msg_dontroute='$d_msg_dontroute'
21499d_msg_oob='$d_msg_oob'
21500d_msg_peek='$d_msg_peek'
21501d_msg_proxy='$d_msg_proxy'
21502d_msgctl='$d_msgctl'
21503d_msgget='$d_msgget'
4e0554ec 21504d_msghdr_s='$d_msghdr_s'
b4eb6b3d
JH
21505d_msgrcv='$d_msgrcv'
21506d_msgsnd='$d_msgsnd'
21507d_msync='$d_msync'
21508d_munmap='$d_munmap'
21509d_mymalloc='$d_mymalloc'
21510d_nice='$d_nice'
2765b840 21511d_nl_langinfo='$d_nl_langinfo'
b4eb6b3d 21512d_nv_preserves_uv='$d_nv_preserves_uv'
f607920a 21513d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
b4eb6b3d
JH
21514d_off64_t='$d_off64_t'
21515d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21516d_oldpthreads='$d_oldpthreads'
21517d_oldsock='$d_oldsock'
21518d_open3='$d_open3'
21519d_pathconf='$d_pathconf'
21520d_pause='$d_pause'
21521d_perl_otherlibdirs='$d_perl_otherlibdirs'
21522d_phostname='$d_phostname'
21523d_pipe='$d_pipe'
21524d_poll='$d_poll'
5f80c64f 21525d_portable='$d_portable'
c7aff470 21526d_procselfexe='$d_procselfexe'
d6483fcc 21527d_pthread_atfork='$d_pthread_atfork'
58d975c3 21528d_pthread_attr_setscope='$d_pthread_attr_setscope'
b4eb6b3d
JH
21529d_pthread_yield='$d_pthread_yield'
21530d_pwage='$d_pwage'
21531d_pwchange='$d_pwchange'
21532d_pwclass='$d_pwclass'
21533d_pwcomment='$d_pwcomment'
21534d_pwexpire='$d_pwexpire'
21535d_pwgecos='$d_pwgecos'
21536d_pwpasswd='$d_pwpasswd'
21537d_pwquota='$d_pwquota'
21538d_qgcvt='$d_qgcvt'
21539d_quad='$d_quad'
10bc17b6
JH
21540d_random_r='$d_random_r'
21541d_readdir64_r='$d_readdir64_r'
b4eb6b3d 21542d_readdir='$d_readdir'
10bc17b6 21543d_readdir_r='$d_readdir_r'
b4eb6b3d 21544d_readlink='$d_readlink'
4e0554ec
JH
21545d_readv='$d_readv'
21546d_recvmsg='$d_recvmsg'
b4eb6b3d
JH
21547d_rename='$d_rename'
21548d_rewinddir='$d_rewinddir'
21549d_rmdir='$d_rmdir'
21550d_safebcpy='$d_safebcpy'
21551d_safemcpy='$d_safemcpy'
21552d_sanemcmp='$d_sanemcmp'
ef9f17be 21553d_sbrkproto='$d_sbrkproto'
55954f19 21554d_scalbnl='$d_scalbnl'
b4eb6b3d
JH
21555d_sched_yield='$d_sched_yield'
21556d_scm_rights='$d_scm_rights'
21557d_seekdir='$d_seekdir'
21558d_select='$d_select'
21559d_sem='$d_sem'
21560d_semctl='$d_semctl'
21561d_semctl_semid_ds='$d_semctl_semid_ds'
21562d_semctl_semun='$d_semctl_semun'
21563d_semget='$d_semget'
21564d_semop='$d_semop'
4e0554ec 21565d_sendmsg='$d_sendmsg'
b4eb6b3d
JH
21566d_setegid='$d_setegid'
21567d_seteuid='$d_seteuid'
21568d_setgrent='$d_setgrent'
10bc17b6 21569d_setgrent_r='$d_setgrent_r'
b4eb6b3d
JH
21570d_setgrps='$d_setgrps'
21571d_sethent='$d_sethent'
10bc17b6 21572d_sethostent_r='$d_sethostent_r'
4e0554ec 21573d_setitimer='$d_setitimer'
b4eb6b3d
JH
21574d_setlinebuf='$d_setlinebuf'
21575d_setlocale='$d_setlocale'
10bc17b6 21576d_setlocale_r='$d_setlocale_r'
b4eb6b3d 21577d_setnent='$d_setnent'
10bc17b6 21578d_setnetent_r='$d_setnetent_r'
b4eb6b3d
JH
21579d_setpent='$d_setpent'
21580d_setpgid='$d_setpgid'
21581d_setpgrp2='$d_setpgrp2'
21582d_setpgrp='$d_setpgrp'
21583d_setprior='$d_setprior'
21584d_setproctitle='$d_setproctitle'
10bc17b6 21585d_setprotoent_r='$d_setprotoent_r'
b4eb6b3d 21586d_setpwent='$d_setpwent'
10bc17b6 21587d_setpwent_r='$d_setpwent_r'
b4eb6b3d
JH
21588d_setregid='$d_setregid'
21589d_setresgid='$d_setresgid'
21590d_setresuid='$d_setresuid'
21591d_setreuid='$d_setreuid'
21592d_setrgid='$d_setrgid'
21593d_setruid='$d_setruid'
21594d_setsent='$d_setsent'
10bc17b6 21595d_setservent_r='$d_setservent_r'
b4eb6b3d
JH
21596d_setsid='$d_setsid'
21597d_setvbuf='$d_setvbuf'
21598d_sfio='$d_sfio'
21599d_shm='$d_shm'
21600d_shmat='$d_shmat'
21601d_shmatprototype='$d_shmatprototype'
21602d_shmctl='$d_shmctl'
21603d_shmdt='$d_shmdt'
21604d_shmget='$d_shmget'
21605d_sigaction='$d_sigaction'
983dbef6 21606d_sigprocmask='$d_sigprocmask'
b4eb6b3d 21607d_sigsetjmp='$d_sigsetjmp'
c95d0e17 21608d_sitearch='$d_sitearch'
4f5da3e9 21609d_snprintf='$d_snprintf'
49a78c82 21610d_sockatmark='$d_sockatmark'
2ef53570 21611d_sockatmarkproto='$d_sockatmarkproto'
b4eb6b3d
JH
21612d_socket='$d_socket'
21613d_socklen_t='$d_socklen_t'
21614d_sockpair='$d_sockpair'
21615d_socks5_init='$d_socks5_init'
360321b3 21616d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
b4eb6b3d 21617d_sqrtl='$d_sqrtl'
10bc17b6
JH
21618d_srand48_r='$d_srand48_r'
21619d_srandom_r='$d_srandom_r'
eef837ea 21620d_sresgproto='$d_sresgproto'
640374d0 21621d_sresuproto='$d_sresuproto'
b4eb6b3d
JH
21622d_statblks='$d_statblks'
21623d_statfs_f_flags='$d_statfs_f_flags'
21624d_statfs_s='$d_statfs_s'
21625d_statvfs='$d_statvfs'
21626d_stdio_cnt_lval='$d_stdio_cnt_lval'
21627d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
21628d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21629d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
21630d_stdio_stream_array='$d_stdio_stream_array'
21631d_stdiobase='$d_stdiobase'
21632d_stdstdio='$d_stdstdio'
21633d_strchr='$d_strchr'
21634d_strcoll='$d_strcoll'
21635d_strctcpy='$d_strctcpy'
21636d_strerrm='$d_strerrm'
21637d_strerror='$d_strerror'
10bc17b6 21638d_strerror_r='$d_strerror_r'
b3c85772 21639d_strftime='$d_strftime'
08c92000
MB
21640d_strlcat='$d_strlcat'
21641d_strlcpy='$d_strlcpy'
b4eb6b3d
JH
21642d_strtod='$d_strtod'
21643d_strtol='$d_strtol'
21644d_strtold='$d_strtold'
21645d_strtoll='$d_strtoll'
28e5dec8 21646d_strtoq='$d_strtoq'
b4eb6b3d
JH
21647d_strtoul='$d_strtoul'
21648d_strtoull='$d_strtoull'
21649d_strtouq='$d_strtouq'
21650d_strxfrm='$d_strxfrm'
21651d_suidsafe='$d_suidsafe'
21652d_symlink='$d_symlink'
21653d_syscall='$d_syscall'
2ef53570 21654d_syscallproto='$d_syscallproto'
b4eb6b3d
JH
21655d_sysconf='$d_sysconf'
21656d_sysernlst='$d_sysernlst'
21657d_syserrlst='$d_syserrlst'
21658d_system='$d_system'
21659d_tcgetpgrp='$d_tcgetpgrp'
21660d_tcsetpgrp='$d_tcsetpgrp'
21661d_telldir='$d_telldir'
21662d_telldirproto='$d_telldirproto'
21663d_time='$d_time'
21664d_times='$d_times'
14b90194
JH
21665d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21666d_tm_tm_zone='$d_tm_tm_zone'
10bc17b6 21667d_tmpnam_r='$d_tmpnam_r'
b4eb6b3d 21668d_truncate='$d_truncate'
10bc17b6 21669d_ttyname_r='$d_ttyname_r'
b4eb6b3d 21670d_tzname='$d_tzname'
4e0554ec
JH
21671d_u32align='$d_u32align'
21672d_ualarm='$d_ualarm'
b4eb6b3d
JH
21673d_umask='$d_umask'
21674d_uname='$d_uname'
21675d_union_semun='$d_union_semun'
758a5d79 21676d_unordered='$d_unordered'
bdf33aa7 21677d_unsetenv='$d_unsetenv'
4e0554ec 21678d_usleep='$d_usleep'
2ef53570 21679d_usleepproto='$d_usleepproto'
b4eb6b3d
JH
21680d_ustat='$d_ustat'
21681d_vendorarch='$d_vendorarch'
21682d_vendorbin='$d_vendorbin'
21683d_vendorlib='$d_vendorlib'
6e1038e0 21684d_vendorscript='$d_vendorscript'
b4eb6b3d
JH
21685d_vfork='$d_vfork'
21686d_void_closedir='$d_void_closedir'
21687d_voidsig='$d_voidsig'
21688d_voidtty='$d_voidtty'
21689d_volatile='$d_volatile'
21690d_vprintf='$d_vprintf'
4f5da3e9 21691d_vsnprintf='$d_vsnprintf'
b4eb6b3d
JH
21692d_wait4='$d_wait4'
21693d_waitpid='$d_waitpid'
21694d_wcstombs='$d_wcstombs'
21695d_wctomb='$d_wctomb'
4e0554ec 21696d_writev='$d_writev'
5f80c64f
JH
21697d_xenix='$d_xenix'
21698date='$date'
b4eb6b3d
JH
21699db_hashtype='$db_hashtype'
21700db_prefixtype='$db_prefixtype'
640374d0
JH
21701db_version_major='$db_version_major'
21702db_version_minor='$db_version_minor'
21703db_version_patch='$db_version_patch'
b4eb6b3d
JH
21704defvoidused='$defvoidused'
21705direntrytype='$direntrytype'
21706dlext='$dlext'
5f80c64f 21707dlsrc='$dlsrc'
b4eb6b3d
JH
21708doublesize='$doublesize'
21709drand01='$drand01'
10bc17b6 21710drand48_r_proto='$drand48_r_proto'
b4eb6b3d
JH
21711dynamic_ext='$dynamic_ext'
21712eagain='$eagain'
21713ebcdic='$ebcdic'
5f80c64f
JH
21714echo='$echo'
21715egrep='$egrep'
21716emacs='$emacs'
10bc17b6
JH
21717endgrent_r_proto='$endgrent_r_proto'
21718endhostent_r_proto='$endhostent_r_proto'
21719endnetent_r_proto='$endnetent_r_proto'
21720endprotoent_r_proto='$endprotoent_r_proto'
21721endpwent_r_proto='$endpwent_r_proto'
21722endservent_r_proto='$endservent_r_proto'
5f80c64f
JH
21723eunicefix='$eunicefix'
21724exe_ext='$exe_ext'
21725expr='$expr'
b4eb6b3d 21726extensions='$extensions'
6fcddf3b 21727extras='$extras'
b4eb6b3d
JH
21728fflushNULL='$fflushNULL'
21729fflushall='$fflushall'
5f80c64f
JH
21730find='$find'
21731firstmakefile='$firstmakefile'
21732flex='$flex'
b4eb6b3d
JH
21733fpossize='$fpossize'
21734fpostype='$fpostype'
21735freetype='$freetype'
5440bc8e 21736from='$from'
b4eb6b3d
JH
21737full_ar='$full_ar'
21738full_csh='$full_csh'
21739full_sed='$full_sed'
2d736872 21740gccansipedantic='$gccansipedantic'
5b463ca7 21741gccosandvers='$gccosandvers'
5f80c64f 21742gccversion='$gccversion'
10bc17b6
JH
21743getgrent_r_proto='$getgrent_r_proto'
21744getgrgid_r_proto='$getgrgid_r_proto'
21745getgrnam_r_proto='$getgrnam_r_proto'
21746gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21747gethostbyname_r_proto='$gethostbyname_r_proto'
21748gethostent_r_proto='$gethostent_r_proto'
21749getlogin_r_proto='$getlogin_r_proto'
21750getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21751getnetbyname_r_proto='$getnetbyname_r_proto'
21752getnetent_r_proto='$getnetent_r_proto'
21753getprotobyname_r_proto='$getprotobyname_r_proto'
21754getprotobynumber_r_proto='$getprotobynumber_r_proto'
21755getprotoent_r_proto='$getprotoent_r_proto'
21756getpwent_r_proto='$getpwent_r_proto'
21757getpwnam_r_proto='$getpwnam_r_proto'
21758getpwuid_r_proto='$getpwuid_r_proto'
21759getservbyname_r_proto='$getservbyname_r_proto'
21760getservbyport_r_proto='$getservbyport_r_proto'
21761getservent_r_proto='$getservent_r_proto'
21762getspnam_r_proto='$getspnam_r_proto'
b4eb6b3d
JH
21763gidformat='$gidformat'
21764gidsign='$gidsign'
21765gidsize='$gidsize'
21766gidtype='$gidtype'
5f80c64f 21767glibpth='$glibpth'
3c728e00 21768gmake='$gmake'
10bc17b6 21769gmtime_r_proto='$gmtime_r_proto'
5f6e0ee4 21770gnulibc_version='$gnulibc_version'
5f80c64f 21771grep='$grep'
b4eb6b3d
JH
21772groupcat='$groupcat'
21773groupstype='$groupstype'
5f80c64f 21774gzip='$gzip'
b4eb6b3d
JH
21775h_fcntl='$h_fcntl'
21776h_sysfile='$h_sysfile'
5f80c64f 21777hint='$hint'
b4eb6b3d 21778hostcat='$hostcat'
6e1038e0
MB
21779html1dir='$html1dir'
21780html1direxp='$html1direxp'
21781html3dir='$html3dir'
21782html3direxp='$html3direxp'
b4eb6b3d
JH
21783i16size='$i16size'
21784i16type='$i16type'
21785i32size='$i32size'
21786i32type='$i32type'
21787i64size='$i64size'
21788i64type='$i64type'
21789i8size='$i8size'
21790i8type='$i8type'
21791i_arpainet='$i_arpainet'
21792i_bsdioctl='$i_bsdioctl'
10bc17b6 21793i_crypt='$i_crypt'
b4eb6b3d
JH
21794i_db='$i_db'
21795i_dbm='$i_dbm'
21796i_dirent='$i_dirent'
5f80c64f 21797i_dld='$i_dld'
b4eb6b3d
JH
21798i_dlfcn='$i_dlfcn'
21799i_fcntl='$i_fcntl'
21800i_float='$i_float'
758a5d79
JH
21801i_fp='$i_fp'
21802i_fp_class='$i_fp_class'
b4eb6b3d
JH
21803i_gdbm='$i_gdbm'
21804i_grp='$i_grp'
b4eb6b3d
JH
21805i_ieeefp='$i_ieeefp'
21806i_inttypes='$i_inttypes'
2765b840 21807i_langinfo='$i_langinfo'
b4eb6b3d
JH
21808i_libutil='$i_libutil'
21809i_limits='$i_limits'
21810i_locale='$i_locale'
21811i_machcthr='$i_machcthr'
21812i_malloc='$i_malloc'
21813i_math='$i_math'
21814i_memory='$i_memory'
21815i_mntent='$i_mntent'
21816i_ndbm='$i_ndbm'
21817i_netdb='$i_netdb'
21818i_neterrno='$i_neterrno'
21819i_netinettcp='$i_netinettcp'
21820i_niin='$i_niin'
21821i_poll='$i_poll'
21822i_prot='$i_prot'
21823i_pthread='$i_pthread'
21824i_pwd='$i_pwd'
21825i_rpcsvcdbm='$i_rpcsvcdbm'
21826i_sfio='$i_sfio'
21827i_sgtty='$i_sgtty'
21828i_shadow='$i_shadow'
21829i_socks='$i_socks'
21830i_stdarg='$i_stdarg'
21831i_stddef='$i_stddef'
21832i_stdlib='$i_stdlib'
21833i_string='$i_string'
21834i_sunmath='$i_sunmath'
21835i_sysaccess='$i_sysaccess'
21836i_sysdir='$i_sysdir'
21837i_sysfile='$i_sysfile'
21838i_sysfilio='$i_sysfilio'
21839i_sysin='$i_sysin'
21840i_sysioctl='$i_sysioctl'
21841i_syslog='$i_syslog'
21842i_sysmman='$i_sysmman'
21843i_sysmode='$i_sysmode'
21844i_sysmount='$i_sysmount'
21845i_sysndir='$i_sysndir'
21846i_sysparam='$i_sysparam'
21847i_sysresrc='$i_sysresrc'
21848i_syssecrt='$i_syssecrt'
21849i_sysselct='$i_sysselct'
21850i_syssockio='$i_syssockio'
21851i_sysstat='$i_sysstat'
21852i_sysstatfs='$i_sysstatfs'
21853i_sysstatvfs='$i_sysstatvfs'
21854i_systime='$i_systime'
21855i_systimek='$i_systimek'
21856i_systimes='$i_systimes'
21857i_systypes='$i_systypes'
21858i_sysuio='$i_sysuio'
21859i_sysun='$i_sysun'
21860i_sysutsname='$i_sysutsname'
21861i_sysvfs='$i_sysvfs'
21862i_syswait='$i_syswait'
21863i_termio='$i_termio'
21864i_termios='$i_termios'
21865i_time='$i_time'
21866i_unistd='$i_unistd'
21867i_ustat='$i_ustat'
21868i_utime='$i_utime'
21869i_values='$i_values'
21870i_varargs='$i_varargs'
21871i_varhdr='$i_varhdr'
21872i_vfork='$i_vfork'
5f80c64f 21873ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
21874inc_version_list='$inc_version_list'
21875inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
21876incpath='$incpath'
21877inews='$inews'
f3f1a2d8 21878initialinstalllocation='$initialinstalllocation'
b4eb6b3d
JH
21879installarchlib='$installarchlib'
21880installbin='$installbin'
6e1038e0
MB
21881installhtml1dir='$installhtml1dir'
21882installhtml3dir='$installhtml3dir'
b4eb6b3d
JH
21883installman1dir='$installman1dir'
21884installman3dir='$installman3dir'
21885installprefix='$installprefix'
21886installprefixexp='$installprefixexp'
21887installprivlib='$installprivlib'
21888installscript='$installscript'
21889installsitearch='$installsitearch'
21890installsitebin='$installsitebin'
8d2cbf27
JH
21891installsitehtml1dir='$installsitehtml1dir'
21892installsitehtml3dir='$installsitehtml3dir'
b4eb6b3d 21893installsitelib='$installsitelib'
91e123a8
JH
21894installsiteman1dir='$installsiteman1dir'
21895installsiteman3dir='$installsiteman3dir'
6e1038e0 21896installsitescript='$installsitescript'
b4eb6b3d
JH
21897installstyle='$installstyle'
21898installusrbinperl='$installusrbinperl'
21899installvendorarch='$installvendorarch'
21900installvendorbin='$installvendorbin'
8d2cbf27
JH
21901installvendorhtml1dir='$installvendorhtml1dir'
21902installvendorhtml3dir='$installvendorhtml3dir'
b4eb6b3d 21903installvendorlib='$installvendorlib'
91e123a8
JH
21904installvendorman1dir='$installvendorman1dir'
21905installvendorman3dir='$installvendorman3dir'
6e1038e0 21906installvendorscript='$installvendorscript'
b4eb6b3d 21907intsize='$intsize'
4b661809 21908issymlink='$issymlink'
b4eb6b3d
JH
21909ivdformat='$ivdformat'
21910ivsize='$ivsize'
21911ivtype='$ivtype'
21912known_extensions='$known_extensions'
5f80c64f 21913ksh='$ksh'
5f80c64f
JH
21914ld='$ld'
21915lddlflags='$lddlflags'
21916ldflags='$ldflags'
b4eb6b3d
JH
21917ldflags_uselargefiles='$ldflags_uselargefiles'
21918ldlibpthname='$ldlibpthname'
5f80c64f
JH
21919less='$less'
21920lib_ext='$lib_ext'
21921libc='$libc'
b4eb6b3d 21922libperl='$libperl'
5f80c64f
JH
21923libpth='$libpth'
21924libs='$libs'
43999f95
JH
21925libsdirs='$libsdirs'
21926libsfiles='$libsfiles'
21927libsfound='$libsfound'
13b3f787 21928libspath='$libspath'
5f80c64f 21929libswanted='$libswanted'
b4eb6b3d 21930libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
21931line='$line'
21932lint='$lint'
21933lkflags='$lkflags'
21934ln='$ln'
21935lns='$lns'
10bc17b6 21936localtime_r_proto='$localtime_r_proto'
5f80c64f
JH
21937locincpth='$locincpth'
21938loclibpth='$loclibpth'
b4eb6b3d
JH
21939longdblsize='$longdblsize'
21940longlongsize='$longlongsize'
21941longsize='$longsize'
5f80c64f
JH
21942lp='$lp'
21943lpr='$lpr'
21944ls='$ls'
b4eb6b3d
JH
21945lseeksize='$lseeksize'
21946lseektype='$lseektype'
a724edfe 21947mad='$mad'
f3f1a2d8
MB
21948madlyh='$madlyh'
21949madlyobj='$madlyobj'
21950madlysrc='$madlysrc'
5f80c64f
JH
21951mail='$mail'
21952mailx='$mailx'
21953make='$make'
21954make_set_make='$make_set_make'
b4eb6b3d
JH
21955mallocobj='$mallocobj'
21956mallocsrc='$mallocsrc'
21957malloctype='$malloctype'
21958man1dir='$man1dir'
21959man1direxp='$man1direxp'
21960man1ext='$man1ext'
21961man3dir='$man3dir'
21962man3direxp='$man3direxp'
21963man3ext='$man3ext'
5f80c64f 21964mips_type='$mips_type'
5129fff4 21965mistrustnm='$mistrustnm'
5f80c64f 21966mkdir='$mkdir'
b4eb6b3d
JH
21967mmaptype='$mmaptype'
21968modetype='$modetype'
5f80c64f 21969more='$more'
b4eb6b3d 21970multiarch='$multiarch'
5f80c64f 21971mv='$mv'
b4eb6b3d
JH
21972myarchname='$myarchname'
21973mydomain='$mydomain'
21974myhostname='$myhostname'
5f80c64f
JH
21975myuname='$myuname'
21976n='$n'
2cc61e15 21977need_va_copy='$need_va_copy'
b4eb6b3d
JH
21978netdb_hlen_type='$netdb_hlen_type'
21979netdb_host_type='$netdb_host_type'
21980netdb_name_type='$netdb_name_type'
21981netdb_net_type='$netdb_net_type'
5f80c64f
JH
21982nm='$nm'
21983nm_opt='$nm_opt'
21984nm_so_opt='$nm_so_opt'
b4eb6b3d 21985nonxs_ext='$nonxs_ext'
5f80c64f 21986nroff='$nroff'
b4eb6b3d
JH
21987nvEUformat='$nvEUformat'
21988nvFUformat='$nvFUformat'
21989nvGUformat='$nvGUformat'
53133ed1 21990nv_preserves_uv_bits='$nv_preserves_uv_bits'
b4eb6b3d
JH
21991nveformat='$nveformat'
21992nvfformat='$nvfformat'
21993nvgformat='$nvgformat'
21994nvsize='$nvsize'
21995nvtype='$nvtype'
21996o_nonblock='$o_nonblock'
5f80c64f 21997obj_ext='$obj_ext'
b4eb6b3d 21998old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 21999optimize='$optimize'
b4eb6b3d 22000orderlib='$orderlib'
5f80c64f
JH
22001osname='$osname'
22002osvers='$osvers'
b4eb6b3d 22003otherlibdirs='$otherlibdirs'
5f80c64f 22004package='$package'
b4eb6b3d
JH
22005pager='$pager'
22006passcat='$passcat'
22007patchlevel='$patchlevel'
5f80c64f 22008path_sep='$path_sep'
b4eb6b3d 22009perl5='$perl5'
5f80c64f 22010perl='$perl'
151e6568 22011perl_patchlevel='$perl_patchlevel'
b4eb6b3d 22012perladmin='$perladmin'
9c839522 22013perllibs='$perllibs'
b4eb6b3d 22014perlpath='$perlpath'
5f80c64f 22015pg='$pg'
b4eb6b3d
JH
22016phostname='$phostname'
22017pidtype='$pidtype'
5f80c64f
JH
22018plibpth='$plibpth'
22019pmake='$pmake'
22020pr='$pr'
b4eb6b3d
JH
22021prefix='$prefix'
22022prefixexp='$prefixexp'
22023privlib='$privlib'
22024privlibexp='$privlibexp'
f24dbf84 22025procselfexe='$procselfexe'
b4eb6b3d
JH
22026prototype='$prototype'
22027ptrsize='$ptrsize'
22028quadkind='$quadkind'
22029quadtype='$quadtype'
22030randbits='$randbits'
22031randfunc='$randfunc'
10bc17b6 22032random_r_proto='$random_r_proto'
b4eb6b3d
JH
22033randseedtype='$randseedtype'
22034ranlib='$ranlib'
22035rd_nodata='$rd_nodata'
10bc17b6
JH
22036readdir64_r_proto='$readdir64_r_proto'
22037readdir_r_proto='$readdir_r_proto'
b4eb6b3d 22038revision='$revision'
5f80c64f
JH
22039rm='$rm'
22040rmail='$rmail'
5440bc8e 22041run='$run'
5f80c64f 22042runnm='$runnm'
b4eb6b3d
JH
22043sPRIEUldbl='$sPRIEUldbl'
22044sPRIFUldbl='$sPRIFUldbl'
22045sPRIGUldbl='$sPRIGUldbl'
22046sPRIXU64='$sPRIXU64'
22047sPRId64='$sPRId64'
22048sPRIeldbl='$sPRIeldbl'
22049sPRIfldbl='$sPRIfldbl'
22050sPRIgldbl='$sPRIgldbl'
22051sPRIi64='$sPRIi64'
22052sPRIo64='$sPRIo64'
22053sPRIu64='$sPRIu64'
22054sPRIx64='$sPRIx64'
22055sSCNfldbl='$sSCNfldbl'
22056sched_yield='$sched_yield'
22057scriptdir='$scriptdir'
22058scriptdirexp='$scriptdirexp'
5f80c64f 22059sed='$sed'
b4eb6b3d
JH
22060seedfunc='$seedfunc'
22061selectminbits='$selectminbits'
22062selecttype='$selecttype'
5f80c64f 22063sendmail='$sendmail'
10bc17b6
JH
22064setgrent_r_proto='$setgrent_r_proto'
22065sethostent_r_proto='$sethostent_r_proto'
22066setlocale_r_proto='$setlocale_r_proto'
22067setnetent_r_proto='$setnetent_r_proto'
22068setprotoent_r_proto='$setprotoent_r_proto'
22069setpwent_r_proto='$setpwent_r_proto'
22070setservent_r_proto='$setservent_r_proto'
5f80c64f
JH
22071sh='$sh'
22072shar='$shar'
22073sharpbang='$sharpbang'
b4eb6b3d
JH
22074shmattype='$shmattype'
22075shortsize='$shortsize'
22076shrpenv='$shrpenv'
5f80c64f 22077shsharp='$shsharp'
b4eb6b3d
JH
22078sig_count='$sig_count'
22079sig_name='$sig_name'
22080sig_name_init='$sig_name_init'
22081sig_num='$sig_num'
22082sig_num_init='$sig_num_init'
76d3c696 22083sig_size='$sig_size'
b4eb6b3d
JH
22084signal_t='$signal_t'
22085sitearch='$sitearch'
22086sitearchexp='$sitearchexp'
22087sitebin='$sitebin'
22088sitebinexp='$sitebinexp'
8d2cbf27
JH
22089sitehtml1dir='$sitehtml1dir'
22090sitehtml1direxp='$sitehtml1direxp'
22091sitehtml3dir='$sitehtml3dir'
22092sitehtml3direxp='$sitehtml3direxp'
b4eb6b3d
JH
22093sitelib='$sitelib'
22094sitelib_stem='$sitelib_stem'
22095sitelibexp='$sitelibexp'
91e123a8
JH
22096siteman1dir='$siteman1dir'
22097siteman1direxp='$siteman1direxp'
22098siteman3dir='$siteman3dir'
22099siteman3direxp='$siteman3direxp'
b4eb6b3d
JH
22100siteprefix='$siteprefix'
22101siteprefixexp='$siteprefixexp'
6e1038e0
MB
22102sitescript='$sitescript'
22103sitescriptexp='$sitescriptexp'
b4eb6b3d
JH
22104sizesize='$sizesize'
22105sizetype='$sizetype'
5f80c64f
JH
22106sleep='$sleep'
22107smail='$smail'
5f80c64f 22108so='$so'
b4eb6b3d
JH
22109sockethdr='$sockethdr'
22110socketlib='$socketlib'
22111socksizetype='$socksizetype'
5f80c64f
JH
22112sort='$sort'
22113spackage='$spackage'
22114spitshell='$spitshell'
10bc17b6
JH
22115srand48_r_proto='$srand48_r_proto'
22116srandom_r_proto='$srandom_r_proto'
5f80c64f 22117src='$src'
b4eb6b3d
JH
22118ssizetype='$ssizetype'
22119startperl='$startperl'
5f80c64f 22120startsh='$startsh'
b4eb6b3d
JH
22121static_ext='$static_ext'
22122stdchar='$stdchar'
22123stdio_base='$stdio_base'
22124stdio_bufsiz='$stdio_bufsiz'
22125stdio_cnt='$stdio_cnt'
22126stdio_filbuf='$stdio_filbuf'
22127stdio_ptr='$stdio_ptr'
22128stdio_stream_array='$stdio_stream_array'
10bc17b6 22129strerror_r_proto='$strerror_r_proto'
b4eb6b3d 22130strings='$strings'
5f80c64f 22131submit='$submit'
b4eb6b3d
JH
22132subversion='$subversion'
22133sysman='$sysman'
5f80c64f
JH
22134tail='$tail'
22135tar='$tar'
5440bc8e 22136targetarch='$targetarch'
5f80c64f
JH
22137tbl='$tbl'
22138tee='$tee'
22139test='$test'
b4eb6b3d
JH
22140timeincl='$timeincl'
22141timetype='$timetype'
10bc17b6 22142tmpnam_r_proto='$tmpnam_r_proto'
5440bc8e 22143to='$to'
5f80c64f
JH
22144touch='$touch'
22145tr='$tr'
22146trnl='$trnl'
22147troff='$troff'
10bc17b6 22148ttyname_r_proto='$ttyname_r_proto'
b4eb6b3d
JH
22149u16size='$u16size'
22150u16type='$u16type'
22151u32size='$u32size'
22152u32type='$u32type'
22153u64size='$u64size'
22154u64type='$u64type'
22155u8size='$u8size'
22156u8type='$u8type'
22157uidformat='$uidformat'
22158uidsign='$uidsign'
22159uidsize='$uidsize'
22160uidtype='$uidtype'
5f80c64f
JH
22161uname='$uname'
22162uniq='$uniq'
b4eb6b3d
JH
22163uquadtype='$uquadtype'
22164use5005threads='$use5005threads'
22165use64bitall='$use64bitall'
22166use64bitint='$use64bitint'
5440bc8e 22167usecrosscompile='$usecrosscompile'
5f80c64f 22168usedl='$usedl'
15b61c98 22169usefaststdio='$usefaststdio'
b4eb6b3d
JH
22170useithreads='$useithreads'
22171uselargefiles='$uselargefiles'
22172uselongdouble='$uselongdouble'
19a100ff 22173usemallocwrap='$usemallocwrap'
b4eb6b3d
JH
22174usemorebits='$usemorebits'
22175usemultiplicity='$usemultiplicity'
22176usemymalloc='$usemymalloc'
5f80c64f 22177usenm='$usenm'
b4eb6b3d
JH
22178useopcode='$useopcode'
22179useperlio='$useperlio'
22180useposix='$useposix'
9514c62b 22181usereentrant='$usereentrant'
d51aaa9d 22182userelocatableinc='$userelocatableinc'
b4eb6b3d
JH
22183usesfio='$usesfio'
22184useshrplib='$useshrplib'
5f106f9c 22185usesitecustomize='$usesitecustomize'
29209bc5 22186usesocks='$usesocks'
b4eb6b3d
JH
22187usethreads='$usethreads'
22188usevendorprefix='$usevendorprefix'
22189usevfork='$usevfork'
5f80c64f
JH
22190usrinc='$usrinc'
22191uuname='$uuname'
b4eb6b3d
JH
22192uvXUformat='$uvXUformat'
22193uvoformat='$uvoformat'
22194uvsize='$uvsize'
22195uvtype='$uvtype'
22196uvuformat='$uvuformat'
22197uvxformat='$uvxformat'
22198vendorarch='$vendorarch'
22199vendorarchexp='$vendorarchexp'
22200vendorbin='$vendorbin'
22201vendorbinexp='$vendorbinexp'
8d2cbf27
JH
22202vendorhtml1dir='$vendorhtml1dir'
22203vendorhtml1direxp='$vendorhtml1direxp'
22204vendorhtml3dir='$vendorhtml3dir'
22205vendorhtml3direxp='$vendorhtml3direxp'
b4eb6b3d
JH
22206vendorlib='$vendorlib'
22207vendorlib_stem='$vendorlib_stem'
22208vendorlibexp='$vendorlibexp'
91e123a8
JH
22209vendorman1dir='$vendorman1dir'
22210vendorman1direxp='$vendorman1direxp'
22211vendorman3dir='$vendorman3dir'
22212vendorman3direxp='$vendorman3direxp'
b4eb6b3d
JH
22213vendorprefix='$vendorprefix'
22214vendorprefixexp='$vendorprefixexp'
6e1038e0
MB
22215vendorscript='$vendorscript'
22216vendorscriptexp='$vendorscriptexp'
b4eb6b3d 22217version='$version'
861eb78d 22218version_patchlevel_string='$version_patchlevel_string'
d56c5707 22219versiononly='$versiononly'
5f80c64f 22220vi='$vi'
b4eb6b3d 22221voidflags='$voidflags'
5f80c64f 22222xlibpth='$xlibpth'
3659ebf1
JH
22223yacc='$yacc'
22224yaccflags='$yaccflags'
5f80c64f
JH
22225zcat='$zcat'
22226zip='$zip'
22227EOT
22228
22229: Add in command line options if available
22230$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22231
22232: add special variables
22233$test -f $src/patchlevel.h && \
d00b958f 22234awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
151e6568 22235echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
a02608de 22236echo "PERL_CONFIG_SH=true" >>config.sh
5f80c64f
JH
22237
22238: propagate old symbols
22239if $test -f UU/config.sh; then
381aa1ff 22240 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
5f80c64f 22241 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
aef7654c 22242 $sort | $uniq -u >UU/oldsyms
5f80c64f
JH
22243 set X `cat UU/oldsyms`
22244 shift
22245 case $# in
22246 0) ;;
22247 *)
22248 cat <<EOM
22249Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22250EOM
22251 echo "# Variables propagated from previous config.sh file." >>config.sh
22252 for sym in `cat UU/oldsyms`; do
22253 echo " Propagating $hint variable "'$'"$sym..."
22254 eval 'tmp="$'"${sym}"'"'
22255 echo "$tmp" | \
22256 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22257 done
22258 ;;
22259 esac
22260fi
22261
22262: Finish up by extracting the .SH files
22263case "$alldone" in
22264exit)
22265 $rm -rf UU
24ccb310 22266 echo "Extraction done."
5f80c64f
JH
22267 exit 0
22268 ;;
22269cont)
22270 ;;
22271'')
22272 dflt=''
22273 nostick=true
22274 $cat <<EOM
22275
22276If you'd like to make any changes to the config.sh file before I begin
22277to configure things, do it as a shell escape now (e.g. !vi config.sh).
22278
22279EOM
22280 rp="Press return or use a shell escape to edit config.sh:"
22281 . UU/myread
22282 nostick=''
22283 case "$ans" in
22284 '') ;;
22285 *) : in case they cannot read
22286 sh 1>&4 -c "$ans";;
22287 esac
22288 ;;
22289esac
22290
22291: if this fails, just run all the .SH files by hand
22292. ./config.sh
22293
22294echo " "
22295exec 1>&4
a43e8593 22296pwd=`pwd`
5f80c64f 22297. ./UU/extract
6904989c 22298cd "$pwd"
5f80c64f
JH
22299
22300if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22301 dflt=y
22302 case "$silent" in
22303 true) ;;
22304 *)
22305 $cat <<EOM
22306
22307Now you need to generate make dependencies by running "$make depend".
22308You might prefer to run it in background: "$make depend > makedepend.out &"
22309It can take a while, so you might not want to run it right now.
22310
22311EOM
22312 ;;
22313 esac
22314 rp="Run $make depend now?"
22315 . UU/myread
22316 case "$ans" in
22317 y*)
3d5d58b1 22318 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
22319 ;;
22320 *)
22321 echo "You must run '$make depend' then '$make'."
22322 ;;
22323 esac
22324elif test -f [Mm]akefile; then
22325 echo " "
22326 echo "Now you must run a $make."
22327else
24ccb310 22328 echo "Configure done."
5f80c64f
JH
22329fi
22330
22331if $test -f Policy.sh; then
22332 $cat <<EOM
22333
22334If you compile $package on a different machine or from a different object
22335directory, copy the Policy.sh file from this object directory to the
22336new one before you run Configure -- this will help you with most of
22337the policy defaults.
22338
22339EOM
22340fi
22341if $test -f config.msg; then
22342 echo "Hmm. I also noted the following information while running:"
22343 echo " "
22344 $cat config.msg >&4
22345 $rm -f config.msg
22346fi
22347$rm -f kit*isdone ark*isdone
22348$rm -rf UU
22349
22350: End of Configure
22351